Visual Studio and .NET Framework Home
Entry Point Not Found
as By Design
8/11/2009 6:46:51 PM
User(s) can reproduce this bug
I just installed Visual Studio 2010 and converted a 2008 C++ Win32 project to 2010, but encountered a bug that prevent my application from being debugged. When I start debugging, I get "The procedure entry point K32EnumProcessModules could not be located in the dynamic link library KERNEL32.dll". I haven't had this error when compiling with 2008.
Included header: <Psapi.h>
C++ Linker Additional Dependencies: "Psapi.lib"
I just think the compiler is linking the EnumProcessModule to the wrong library. This function is found in Kernel32.dll but on Windows 7 only. It should link to Psaspi.
Visual Studio 2010 Beta 1
Operating System Language
Steps to Reproduce
1. Create a new C++ Win32 Project
2. Add "Psapi.lib" to the C++ linker additional dependencies
3. Add this line of code in the header: "#include <Psapi.h>"
4. Add these line of codes anywhere within the "int APIENTRY _tWinMain" procedure block:
DWORD dwData = 0;
EnumProcessModules(NULL, lphMod, sizeof(lphMod), &dwData);
5. Debug\Start Debugging
You get an error saying "The procedure entry point K32EnumProcessModules could not be located in the dynamic link library KERNEL32.dll" and the app then crashes.
There should be no error and the compiled app shouldn't crash. Should behave like in Visual Studio 2008. Or maybe I am missing something?
TAP Code (if applicable)
You can indicate your satisfaction with how Microsoft handled this issue by completing this quick
3 question survey
to post a comment.
Please enter a comment.
on 8/13/2009 at 3:16 PM
Thanks it works now. I added -DPSAPI_VERSION=1 to the additional command-line compile options. The documentation on this on MSDN is not very clear. You can close this issue.
on 8/13/2009 at 12:30 PM
There were some changes in this area starting with the release of Windows Server 2008 R2. This MSDN article has some information that might help:
From the article:
"Starting with PSAPI version 2 for Windows 7 and Windows Server 2008 R2, this function is defined as K32EnumProcessModules in Psapi.h and exported in Kernel32.lib and Kernel32.dll. However, you should always call this function as EnumProcessModules. To ensure correct resolution of symbols for programs that will run on earlier versions of Windows, add Psapi.lib to the TARGETLIBS macro and compile the program with –DPSAPI_VERSION=1."
I hope this helps.
on 8/13/2009 at 12:17 AM
Thanks for your feedback.
We were able to reproduce the issue you are seeing. We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and
resolution. These specialized experts will follow-up with your issue.
to post a workaround.
Please enter a workaround.
© 2014 Microsoft