oliver369 Posted January 29, 2008 Share Posted January 29, 2008 (edited) Hi, I am trying to create a function that lists out processes with their full paths, after quite a bit of research I have found what I want. Here is the code: Func _ProcessGetLocation($iPID) Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID) If $aProc[0] = 0 Then Return SetError(1, 0, '') Local $vStruct = DllStructCreate('int[1024]') DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int*', 0) Local $aReturn = DllCall('psapi.dll', 'int', 'GetModuleFileNameEx', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'str', '', 'int', 2048) If StringLen($aReturn[3]) = 0 Then Return SetError(2, 0, '') Return $aReturn[3] EndFunc This works fine under 32bit editions of Windows (XP+Vista) but not under 64bit editions. Does anybody know a workaround/solution to this problem? Edited January 29, 2008 by oliver369 Link to comment Share on other sites More sharing options...
oliver369 Posted January 29, 2008 Author Share Posted January 29, 2008 Answered my own question. But here is the answer for future reference: when compiling use the x64 option Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now