Archived

This topic is now archived and is closed to further replies.

JohanOfverstedt

Path and filename to process exefile

Recommended Posts

Hello everyone! I have encountered a problem with the WIN API for getting the list of processes in the system! It''s probably something quite obvious, but I can''t see it! In the PROCESSENTRY32 structure there is a member called szExeFile, that is supposed to be filled with path and filname of the process, but as I have discovered, only the filename is stored. I am using the Process32First and Process32Next functions for querying the list! I am hoping that somebody might enlighten me to what I am doing wrong, or if it is impossible(!!!) to get this information! I am running Windows XP, by the way! Thanks for your time! My game: Swift blocks

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
there''s a difference between a path and a fully qualified path.

i use the GetModuleFileNameEx function of the Process Status api (psapi.dll) and that always returns the fully qualified path for the executable, if you have the process''s handle and the exe''s module handle. calling EnumProcessModules and using the first (0th index) handle in the array will get the exe''s module handle. calling OpenProcess gets the process handle for a pid. and if you need to get the pid, GetWindowThreadProcessId will get the pid for an HWND.

Share this post


Link to post
Share on other sites