Run-Time Check Failure #0 loading QueryFullProcessImageName from kernel32.dll
I have an application that needs to run both on WinXP and Vista64. My program requires QueryFullProcessImageName() to work on Vista but not on XP. I try to load QueryFullProcessImageName() (instead of linking statically) via the kernel32.dll so that the same executable can run on both WinXP and Vista. The code that loads it is: //only gets called on vista bool LoadQueryFullProcessImageName() { HMODULE hDLL = LoadLibrary("kernel32.dll"); if (!hDLL) return(0); //Now use pointer to get access to functions defined in DLL fpQueryFullProcessImageName = (LPQueryFullProcessImageName)GetProcAddress