DLL_PROCESS_ATTACH failing to execute on Windows 7 C++

前端 未结 2 426
野性不改
野性不改 2021-01-03 12:49

I am trying to load a .dll file and have it display a message box when loaded. From my understanding, once a .dll is loaded, it makes a call to

2条回答
  •  無奈伤痛
    2021-01-03 13:27

    In addition to the blog post Greg links to there are several other informative posts about the loader lock and things you should not do in DllMain.

    In general you should only call functions in kernel32 that don't create threads/windows, use COM or calls LoadLibrary (or other functions involving the loader lock).

    A reasonable list of safe things IMHO would be: DisableThreadLibraryCalls, Tls*, InitializeCriticalSection and in your case (for debugging purposes); OutputDebugString

提交回复
热议问题