GetModuleFileName function
Retrieves the fully qualified path for the file that contains the specified module. The module must have been loaded by the current process.
To locate the file for a module that was loaded by another process, use the GetModuleFileNameEx function.
HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, g_dwPid );
{
std::vector<TCHAR> vcFileName(128, 0);
if (!GetModuleFileNameEx(hProcess, hModule, &vcFileName[0], vcFileName.size() - 1))
{
PrintError(TEXT("[0x%08X]GetModuleFileName False"), hModule);
}
_tprintf(TEXT("FileName:%s\n"), &vcFileName[0]);
}
CloseHandle(hProcess);