#include <iostream>
#include <Windows.h>
#include <TlHelp32.h>
#include <Psapi.h>
using namespace std;
int main()
{
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, 7632);
char lpFilename[1024];
GetModuleFileNameExA(hProcess, NULL, (LPSTR)lpFilename, 1024);
printf("%s\n", lpFilename); //C:\Users\ajanuw\Desktop\game2.exe
CloseHandle(hProcess);
return 0;
}
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, 7632);
char lpFilename[1024];
size_t lpdwSize = sizeof(lpFilename);
QueryFullProcessImageNameA(hProcess, 0, lpFilename, (PDWORD)&lpdwSize);
cout << lpFilename << endl;
CloseHandle(hProcess);