The key here is to use OpenProcess, EnumProcessModules and GetModuleBaseName. Assume that the Process ID is in the value DWORD dwPid.
HANDLE hProc;
char szProcessName [80];
HMODULE ahMod [10];
DWORD dwNeeded;
hProc = OpenProcess (PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,
FALSE,
dwPid);
if (hProc)
{
if (EnumProcessModules (hProc,
ahMod,
sizeof(ahMod),
&dwNeeded))
{
if (GetModuleBaseName (hProc,
ahMod[0],
szProcessName,
sizeof(szProcessName)))
{
}
else
{
}
}
CloseHandle (hProc);
}
}
0 nhận xét:
Post a Comment