From 6b88b8c60ae1520cfcf418cf52b54269d2f83ce6 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 18 Dec 2023 17:49:20 -0600 Subject: [PATCH] ntdll: Set DebugInfo to NULL for absent DebugInfo in RtlDeleteCriticalSection(). CW-Bug-Id: #23142 --- dlls/kernel32/tests/sync.c | 6 +++--- dlls/ntdll/sync.c | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index bc8ea6a32e3..ad35cdebf6c 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -3114,21 +3114,21 @@ static void test_crit_section(void) ok(ret, "Failed to initialize critical section.\n"); ok(cs.DebugInfo == (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo); DeleteCriticalSection(&cs); - todo_wine ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); memset(&cs, 0, sizeof(cs)); ret = pInitializeCriticalSectionEx(&cs, 0, CRITICAL_SECTION_NO_DEBUG_INFO); ok(ret, "Failed to initialize critical section.\n"); ok(cs.DebugInfo == (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo); DeleteCriticalSection(&cs); - todo_wine ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); memset(&cs, 0, sizeof(cs)); ret = pInitializeCriticalSectionEx(&cs, 0, 0); ok(ret, "Failed to initialize critical section.\n"); ok(cs.DebugInfo == (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo); DeleteCriticalSection(&cs); - todo_wine ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); + ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo); memset(&cs, 0, sizeof(cs)); ret = pInitializeCriticalSectionEx(&cs, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO); diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index 288e8b792b4..3ee9b338715 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -289,7 +289,11 @@ NTSTATUS WINAPI RtlDeleteCriticalSection( RTL_CRITICAL_SECTION *crit ) crit->DebugInfo = NULL; } } - else NtClose( crit->LockSemaphore ); + else + { + NtClose( crit->LockSemaphore ); + crit->DebugInfo = NULL; + } crit->LockSemaphore = 0; return STATUS_SUCCESS; }