This does not print out anything at all. With windbg I verified that the pointer returned by GetProcessNameFromPid() is indeed correct and points to a null terminated string representation of process name. But I dont understand why I cannot see it in DbgView. I am doing these tests on Windows 7 64 bit.
What type is ProcessId? %4x sucks up a 32-bit thing. If ProcessId is a 64-bit type (like a void *, say), that leaves the high half of the value on the stack to be sucked up by the %s. If that’s the case, use %4I64x (percent four eye sixty-four ex) or %4llx (ell ell ex).
—
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Thanks, with your hint I figured it out. Apparently PsGetProcessImageFileName() is not defined nowhere in my header files. My compiler did not complain about it neither my linker, but the latter took it as its return value was DWORD.