The DllMain() function in ntoskrnl.exe appears to be unused: making it static causes a compiler warning to that effect and removing it entirely does not cause a compilation failure. Should it be removed or is there a build issue with ntoskrnl.exe?
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 2b84297..ffeb2f8 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -1711,30 +1711,6 @@ VOID WINAPI IoInitializeRemoveLockEx(PIO_REMOVE_LOCK lock, ULONG tag, }
/***************************************************** - * DllMain - */ -BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) -{ - static void *handler; - LARGE_INTEGER count; - - switch(reason) - { - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls( inst ); -#ifdef __i386__ - handler = RtlAddVectoredExceptionHandler( TRUE, vectored_handler ); -#endif - KeQueryTickCount( &count ); /* initialize the global KeTickCount */ - break; - case DLL_PROCESS_DETACH: - RtlRemoveVectoredExceptionHandler( handler ); - break; - } - return TRUE; -} - -/***************************************************** * Ke386IoSetAccessProcess (NTOSKRNL.EXE.@) */ BOOLEAN WINAPI Ke386IoSetAccessProcess(PEPROCESS *process, ULONG flag)
On Wed, Jun 13, 2012 at 07:46:47PM +0200, Francois Gouget wrote:
The DllMain() function in ntoskrnl.exe appears to be unused: making it static causes a compiler warning to that effect and removing it entirely does not cause a compilation failure. Should it be removed or is there a build issue with ntoskrnl.exe?
I added a FIXME() at the beginning, then typed "notepad" and it showed
fixme:ntoskrnl:DllMain called
So it is called. Not exactly sure, but I guess somehow via the loader magic.
Ciao, Marcus