Hi!
Looking for working code to get full path of process - both 32 & 64 bit.
I tryed this bellow, but it works only for 32-bit processes, even if compiled for x64...
Thanx for suggestions!
Func _ProcessGetPath($vProcess) ;get the program path done by MrCreatoR
Local $iPID = ProcessExists($vProcess)
If NOT $iPID Then Return SetError(1, 0, -1)
Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID)
If NOT IsArray($aProc) OR NOT $aProc[0] Then Return SetError(2, 0, -1)
Local $vStruct = DllStructCreate('int[1024]')
Local $hPsapi_Dll = DllOpen('Psapi.dll')
If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@SystemDir & '\Psapi.dll')
If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@WindowsDir & '\Psapi.dll')
If $hPsapi_Dll = -1 Then Return SetError(3, 0, '')
DllCall($hPsapi_Dll, 'int', 'EnumProcessModules', _
'hwnd', $aProc[0], _
'ptr', DllStructGetPtr($vStruct), _
'int', DllStructGetSize($vStruct), _
'int_ptr', 0)
Local $aRet = DllCall($hPsapi_Dll, 'int', 'GetModuleFileNameEx', _
'hwnd', $aProc[0], _
'int', DllStructGetData($vStruct, 1), _
'str', '', _
'int', 2048)
DllClose($hPsapi_Dll)
If NOT IsArray($aRet) OR StringLen($aRet[3]) = 0 Then Return SetError(4, 0, '')
Return $aRet[3]
EndFunc