2,640
社区成员
发帖
与我相关
我的任务
分享
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);
if(NULL != hProcess)
{
TCHAR szPath[MAX_PATH] = {0};
if(GetModuleFileNameEx(hProcess, NULL, szPath, MAX_PATH))
{
AfxMessageBox(szPath);
}
else
{
CString str;
str.Format(_T("%d"), GetLastError());
AfxMessageBox(str);
}
}
TCHAR szFile[255];
HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, idProcess );
if( NULL != hProcess )
{
HMODULE hMod;
DWORD cbNeeded;
// 获取路径
if( EnumProcessModules( hProcess, &hMod, sizeof( hMod ), &cbNeeded ) )
{
DWORD dw = GetModuleFileNameEx( hProcess, hMod, szFile, MAX_PATH );
}
CloseHandle( hProcess );
}
Debug() <<"123"<< szFile;