From d78bfe1149c1974d29d602a219f4423eaaa4e921 Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Wed, 16 Nov 2011 16:28:20 +0100 Subject: [PATCH] msvcrt: Statically initialize and name the MSVCRT_file_cs critical section. --- dlls/msvcrt/file.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 1334ec6978d..c636e85cb65 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -128,6 +128,13 @@ static const ULONGLONG WCCOM = TOUL('c') << 32 | TOUL('o') << 16 | TOUL('m'); * protection, rather than locking the whole table for every change. */ static CRITICAL_SECTION MSVCRT_file_cs; +static CRITICAL_SECTION_DEBUG MSVCRT_file_cs_debug = +{ + 0, 0, &MSVCRT_file_cs, + { &MSVCRT_file_cs_debug.ProcessLocksList, &MSVCRT_file_cs_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": MSVCRT_file_cs") } +}; +static CRITICAL_SECTION MSVCRT_file_cs = { &MSVCRT_file_cs_debug, -1, 0, 0, 0, 0 }; #define LOCK_FILES() do { EnterCriticalSection(&MSVCRT_file_cs); } while (0) #define UNLOCK_FILES() do { LeaveCriticalSection(&MSVCRT_file_cs); } while (0) @@ -440,8 +447,6 @@ void msvcrt_init_io(void) int i; ioinfo *fdinfo; - InitializeCriticalSection(&MSVCRT_file_cs); - MSVCRT_file_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": MSVCRT_file_cs"); GetStartupInfoA(&si); if (si.cbReserved2 >= sizeof(unsigned int) && si.lpReserved2 != NULL) { @@ -983,7 +988,6 @@ void msvcrt_free_io(void) for(i=0; iSpare[0] = 0; DeleteCriticalSection(&MSVCRT_file_cs); }