Archive: nsProcess and x64 Solution


nsProcess and x64 Solution
Hi all,

After some tests with x64 OS (XP and 7) I see that only nsProcess plugin (thanks to Instructor) is able to find processes for x64 applications installed and running from "Program Files" and not from "Program Files (x64)". You can test it easy by installing "WinRAR 64bits" then try to find the running process name "WinRAR.exe". Only nsProcess plugin is able to find it. All other FindProcess plugins will fail.

Now my issue:

Inside my script I use this function:

http://nsis.sourceforge.net/Get_a_li...ning_processes

but now I see that this also fail inside x64 OS. Can anyone update or modify this function or maybe create a new one capable to get a list of running processes also inside x64 OS as this one only works in x86 (32bit) OS?


That uses some API's that will fail with 64-bit processes among others (namely GetModuleBaseName). A lot of plug-ins use the exact same API's and fail for the same reason.

There are 4 options that I can think of:
1. Use EnumProcesses to get an array of process id's followed by an OpenProcess with PROCESS_QUERY_INFORMATION and then a GetModuleFileNameEx.
2. Use NtQuerySystemInformation with SystemProcessInformation to get an (undocumented) SYSTEM_PROCESS_INFORMATION struct (see http://processhacker.sourceforge.net...ng/structs.php - the MSDN page does not document the entire struct) - Instructor's nsProcess plug-in uses this on Windows 2000+.
3. Use the WmiInspector::Request plug-in function with the Win32_Process class.
4. Write a .NET DLL (the System.Diagnostics.Process.GetProcesses() method is what you need) and call it using the CLR plug-in.

All of the above only work on Windows 2000 and above. 1 and 2 can be done using the System plug-in directly or in a DLL and called using the System plug-in.

Perhaps I'll add this as another utility function to LockedList, but first can I enquire why you need a list of all processes?

Stu


Hi Afrow

I needed a list of all running processes to check some incompatible processes with my app but now is fixed as I just search only for incompatible processes using nsProcess plugin instead getting first a list of all running processes.


Just to end this topic I have added an EnumProcesses function to LockedList which allows processes to be enumerated using a callback function. I have also added a FindProcess function which works on x64.

Stu