Howto call MessageBox in dllmain

前端 未结 2 714
滥情空心
滥情空心 2021-01-19 12:11

I\'m creating a little dll to use in a DLL-INJECTION POC (proof-of-concept). I\'m using codeblocks\' c++ ide.

My dll\'s main (dllmain) looks like this:



        
相关标签:
2条回答
  • 2021-01-19 12:51

    See this question to read about the huge number of limitations in DllMain. It's not just security problems. Anything exported by user32 falls into this category.

    In other words, you cannot use MessageBox in DllMain. Use something like OutputDebugString instead, which is in kernel32 and does not display any UI.

    0 讨论(0)
  • 2021-01-19 12:52

    There's a lot of useful stuff that just can not be done in DllMain. Read all relating articles in Raymond Chen's blog for more info. Can't even delay execution with SetTimer, because that function is in user32.dll, and that library may not be loaded yet.

    0 讨论(0)
提交回复
热议问题