I need the image name and path from a PID. I found this example code on MSDN's site, but I'm having some trouble with it. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/perfmon/base/enumerating_all_modules_for_a_process.asp
I'm using VC 2005 Express and it wont compile without a typecast on the 3rd parameter of GetModuleFileNameEx. If I do type cast it as (LPWSTR), then I run into stack curruption. When it does run, I only get a single char returned "C", without the path or image name.
Can someone please help me out here, I just need to resolve random PID's to image/path.