Author: jmorlan
Date: Wed Jul 30 10:00:57 2008
New Revision: 34961
URL:
http://svn.reactos.org/svn/reactos?rev=34961&view=rev
Log:
kernel32: Don't enter the ConsoleLock if it has already been deleted by DllMain. Patch
by hto (hto at dev dot null) (Bug 2308)
Modified:
trunk/reactos/dll/win32/kernel32/misc/console.c
trunk/reactos/dll/win32/kernel32/misc/dllmain.c
Modified: trunk/reactos/dll/win32/kernel32/misc/console.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/co…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/console.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/console.c [iso-8859-1] Wed Jul 30 10:00:57 2008
@@ -22,6 +22,7 @@
extern BOOL WINAPI DefaultConsoleCtrlHandler(DWORD Event);
extern __declspec(noreturn) VOID CALLBACK ConsoleControlDispatcher(DWORD CodeAndFlag);
extern RTL_CRITICAL_SECTION ConsoleLock;
+extern BOOL ConsoleInitialized;
extern BOOL WINAPI IsDebuggerPresent(VOID);
/* GLOBALS *******************************************************************/
@@ -87,6 +88,8 @@
erException.NumberParameters = 0;
RtlRaiseException(&erException);
}
+
+ if (!ConsoleInitialized) ExitThread(0);
RtlEnterCriticalSection(&ConsoleLock);
if(!(nCode == CTRL_C_EVENT &&
@@ -106,6 +109,7 @@
default: ExitThread(0);
}
+ if (!ConsoleInitialized) ExitThread(0);
RtlEnterCriticalSection(&ConsoleLock);
if(!(nCode == CTRL_C_EVENT &&
Modified: trunk/reactos/dll/win32/kernel32/misc/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/dl…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/dllmain.c [iso-8859-1] Wed Jul 30 10:00:57 2008
@@ -26,9 +26,9 @@
HANDLE hBaseDir = NULL;
PPEB Peb;
ULONG SessionId;
+BOOL ConsoleInitialized = FALSE;
static BOOL DllInitialized = FALSE;
-static BOOL ConsoleInitialized = FALSE;
BOOL STDCALL
DllMain(HANDLE hInst,
@@ -374,6 +374,7 @@
/* Delete DLL critical section */
if (ConsoleInitialized == TRUE)
{
+ ConsoleInitialized = FALSE;
RtlDeleteCriticalSection (&ConsoleLock);
}
RtlDeleteCriticalSection (&DllLock);