DllMain in exe?

Is it possible to get DllMain as thread mount / disconnect notifications in standalone exe without using any additional dlls?

Edit: This is just a theoretical question related to some testing that I am doing. not a real life situation.

+3
source share
3 answers

There is no external code that runs in the thread and downloads the executable file, so there are no notifications about thread attachment / detachment [1]. The code in the executable usually controls streaming [2].

If you describe your scenario, people can give you some ideas on how to achieve it.


[1] , . , .
[2] , , . COM/RPC.

+1

. Win32 - , , , DLL, API, , /.

, DLL, , API (WaitForDebugEvent() ). "" ( , ), , exe CreateProcess() DEBUG_ONLY_THIS_PROCESS, ( "" ) WaitForDebugEvent() , . ( ) , , .

, DLL , , .

+1

Your question is to receive a notification while the process is loading and unloading. This is more applicable to DLLs as they are loaded by other processes.

For Exes, you have InitInstance and ExitInstance, which you can handle the same!

0
source

Source: https://habr.com/ru/post/1698078/


All Articles