mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
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:
parent
8c33c79951
commit
92680636ef
2 changed files with 6 additions and 1 deletions
|
@ -22,6 +22,7 @@
|
||||||
extern BOOL WINAPI DefaultConsoleCtrlHandler(DWORD Event);
|
extern BOOL WINAPI DefaultConsoleCtrlHandler(DWORD Event);
|
||||||
extern __declspec(noreturn) VOID CALLBACK ConsoleControlDispatcher(DWORD CodeAndFlag);
|
extern __declspec(noreturn) VOID CALLBACK ConsoleControlDispatcher(DWORD CodeAndFlag);
|
||||||
extern RTL_CRITICAL_SECTION ConsoleLock;
|
extern RTL_CRITICAL_SECTION ConsoleLock;
|
||||||
|
extern BOOL ConsoleInitialized;
|
||||||
extern BOOL WINAPI IsDebuggerPresent(VOID);
|
extern BOOL WINAPI IsDebuggerPresent(VOID);
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
@ -87,6 +88,8 @@ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
||||||
erException.NumberParameters = 0;
|
erException.NumberParameters = 0;
|
||||||
RtlRaiseException(&erException);
|
RtlRaiseException(&erException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ConsoleInitialized) ExitThread(0);
|
||||||
RtlEnterCriticalSection(&ConsoleLock);
|
RtlEnterCriticalSection(&ConsoleLock);
|
||||||
|
|
||||||
if(!(nCode == CTRL_C_EVENT &&
|
if(!(nCode == CTRL_C_EVENT &&
|
||||||
|
@ -106,6 +109,7 @@ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
||||||
default: ExitThread(0);
|
default: ExitThread(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ConsoleInitialized) ExitThread(0);
|
||||||
RtlEnterCriticalSection(&ConsoleLock);
|
RtlEnterCriticalSection(&ConsoleLock);
|
||||||
|
|
||||||
if(!(nCode == CTRL_C_EVENT &&
|
if(!(nCode == CTRL_C_EVENT &&
|
||||||
|
|
|
@ -26,9 +26,9 @@ HMODULE hCurrentModule = NULL;
|
||||||
HANDLE hBaseDir = NULL;
|
HANDLE hBaseDir = NULL;
|
||||||
PPEB Peb;
|
PPEB Peb;
|
||||||
ULONG SessionId;
|
ULONG SessionId;
|
||||||
|
BOOL ConsoleInitialized = FALSE;
|
||||||
|
|
||||||
static BOOL DllInitialized = FALSE;
|
static BOOL DllInitialized = FALSE;
|
||||||
static BOOL ConsoleInitialized = FALSE;
|
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
DllMain(HANDLE hInst,
|
DllMain(HANDLE hInst,
|
||||||
|
@ -374,6 +374,7 @@ DllMain(HANDLE hDll,
|
||||||
/* Delete DLL critical section */
|
/* Delete DLL critical section */
|
||||||
if (ConsoleInitialized == TRUE)
|
if (ConsoleInitialized == TRUE)
|
||||||
{
|
{
|
||||||
|
ConsoleInitialized = FALSE;
|
||||||
RtlDeleteCriticalSection (&ConsoleLock);
|
RtlDeleteCriticalSection (&ConsoleLock);
|
||||||
}
|
}
|
||||||
RtlDeleteCriticalSection (&DllLock);
|
RtlDeleteCriticalSection (&DllLock);
|
||||||
|
|
Loading…
Reference in a new issue