Hi!
I want to get file paths of other modules running on my computer using GetModuleFileName(), but don't really know how to do it. Anyone know any helpfull lessons/tutorials please?
Thanks.
Printable View
Hi!
I want to get file paths of other modules running on my computer using GetModuleFileName(), but don't really know how to do it. Anyone know any helpfull lessons/tutorials please?
Thanks.
You can use the Process32First/Process32Next functions.
Thanks.
Though I'm having some troubles. I have the below code up to now:
I'm trying to step through each process and get their module paths. But me32.szExePath returns nothing. please show me my fault.Code:......
......
HANDLE hProcSnap = NULL;
PROCESSENTRY32 pe32;
MODULEENTRY32 me32;
hProcSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
if(hProcSnap==INVALID_HANDLE_VALUE) ErrHandler();
pe32.dwSize=sizeof(PROCESSENTRY32);
me32.dwSize=sizeof(MODULEENTRY32);
if(Process32First(hProcSnap,&pe32))
{
do
{
Module32First(hProcSnap,&me32);
strcpy(fpth,me32.szExePath);
}while(Process32Next(hProcSnap,&pe32));
}
else
{
ErrHandler();
}
......
......
Thanks.
Seems you need to create a snapshot for each process:
Example