kernel32: Don't enter the ConsoleLock if it has already been deleted by DllMain. Patch by hto (hto at dev dot null) (Bug 2308)

svn path=/trunk/; revision=34961
This commit is contained in:
Jeffrey Morlan 2008-07-30 15:00:57 +00:00
parent 8c33c79951
commit 92680636ef
2 changed files with 6 additions and 1 deletions

View file

@ -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 @@ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
erException.NumberParameters = 0;
RtlRaiseException(&erException);
}
if (!ConsoleInitialized) ExitThread(0);
RtlEnterCriticalSection(&ConsoleLock);
if(!(nCode == CTRL_C_EVENT &&
@ -106,6 +109,7 @@ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
default: ExitThread(0);
}
if (!ConsoleInitialized) ExitThread(0);
RtlEnterCriticalSection(&ConsoleLock);
if(!(nCode == CTRL_C_EVENT &&

View file

@ -26,9 +26,9 @@ HMODULE hCurrentModule = NULL;
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 @@ DllMain(HANDLE hDll,
/* Delete DLL critical section */
if (ConsoleInitialized == TRUE)
{
ConsoleInitialized = FALSE;
RtlDeleteCriticalSection (&ConsoleLock);
}
RtlDeleteCriticalSection (&DllLock);