I'm trying to get a running program's full path, I'm currently using this code
process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
char phew[MAX_PATH + 1];
GetFinalPathNameByHandle(process, phew, MAX_PATH, FILE_NAME_OPENED);
TRACE("Path : %s\n", phew);
but that always returns and empty string. I need a result like C:\Program\File.exe. I couldn't find any other help for WinAPI elsewhere.