Posted on 2004-11-11
At the moment i use this code to find the filepaths of processes. It is a toolhelp function:
c : cardinal;
me : TModuleEntry32;
c := CreateToolhelp32Snapshot(TH32CS_SnapModule, PROCESSPIDHERE);
me.dwSize := sizeof(me);
I have no problem using this function.
The problem is this:
Certain processes filepaths cannot be extracted using this function even if provided the correct PID (i have no problem finding PIDs or enumerating processes). Such processes are svchost.exe, winlogon.exe etc. I have solved this problem by assuming any of these processes reside within %windir%/System32. This is fine for most microsoft programs as this is the case. However, some Norton programs i cannot extract the filepaths using this function and they do not reside in system32. My question is:
Is there other code (i want code no components) that will solve my stated problem?