#include <windows.h> #include <tchar.h> #include <TlHelp32.h> int main() { PROCESSENTRY32 pe32 = {0}; pe32.dwSize = sizeof(PROCESSENTRY32); HANDLE hSnapshot; hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL); if (hSnapshot != INVALID_HANDLE_VALUE) { if (!Process32First(hSnapshot, &pe32)) { DWORD dwError = GetLastError(); if (dwError == ERROR_NO_MORE_FILES) { _tprintf(TEXT("Error ! :%d \r\n"), dwError); } } do { // _tprintf(TEXT("PID :%d \t"), pe32.th32ProcessID); // _tprintf(TEXT("File :%s \r\n"), pe32.szExeFile); if (!_tcscmp(TEXT("QQ.exe"),pe32.szExeFile)) { MODULEENTRY32 me32 = { 0 }; me32.dwSize = sizeof(MODULEENTRY32); HANDLE hModuleSnop = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pe32.th32ProcessID); if (hModuleSnop != INVALID_HANDLE_VALUE) { if (Module32First(hModuleSnop, &me32)) { DWORD dwError = GetLastError(); if (dwError == ERROR_NO_MORE_FILES) { _tprintf(TEXT("Error ! :%d \r\n"), dwError); } do { _tprintf(TEXT("\tModuleName :%s \r\n"), me32.szModule); _tprintf(TEXT("\tModuleBase :0x%x \r\n"), me32.modBaseAddr); _tprintf(TEXT("\tModulePath :%s \r\n"), me32.szExePath); } while (Module32Next(hModuleSnop, &me32)); CloseHandle(hModuleSnop); } } } } while (Process32Next(hSnapshot, &pe32)); CloseHandle(hSnapshot); } system("pause"); return 0; }