Skip to content

Commit

Permalink
ntdll: Set DebugInfo to NULL for absent DebugInfo in RtlDeleteCritica…
Browse files Browse the repository at this point in the history
…lSection().

CW-Bug-Id: #23142
  • Loading branch information
Paul Gofman authored and rbernon committed Dec 19, 2023
1 parent 8725630 commit 6b88b8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions dlls/kernel32/tests/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion dlls/ntdll/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 6b88b8c

Please sign in to comment.