update for HEAD-2003091401
[reactos.git] / lib / kernel32 / misc / dllmain.c
index ccef239..404a03e 100644 (file)
@@ -33,6 +33,9 @@ DllMain(HANDLE hInst,
 
 /* Critical section for various kernel32 data structures */
 CRITICAL_SECTION DllLock;
+CRITICAL_SECTION ConsoleLock;
+
+extern BOOL WINAPI DefaultConsoleCtrlHandler(DWORD Event);
 
 /* FUNCTIONS *****************************************************************/
 
@@ -129,6 +132,10 @@ DllMain(HANDLE hDll,
        /* Initialize the DLL critical section */
        RtlInitializeCriticalSection(&DllLock);
 
+       /* Initialize console ctrl handler */
+       RtlInitializeCriticalSection(&ConsoleLock);
+       SetConsoleCtrlHandler(DefaultConsoleCtrlHandler, TRUE);
+
        /* Insert more dll attach stuff here! */
 
        DllInitialized = TRUE;
@@ -141,6 +148,7 @@ DllMain(HANDLE hDll,
            /* Insert more dll detach stuff here! */
 
            /* Delete DLL critical section */
+           RtlDeleteCriticalSection (&ConsoleLock);
            RtlDeleteCriticalSection (&DllLock);
 
            /* Close object base directory */