Commit 8b3944e1 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ntdll: Only allocate debug info in critical sections with…

ntdll: Only allocate debug info in critical sections with RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO.
parent 9115dc0a
......@@ -2741,7 +2741,7 @@ static void test_crit_section(void)
to override that. */
memset(&cs, 0, sizeof(cs));
InitializeCriticalSection(&cs);
todo_wine ok(cs.DebugInfo == (void *)(ULONG_PTR)-1 || broken(!!cs.DebugInfo) /* before Win8 */,
ok(cs.DebugInfo == (void *)(ULONG_PTR)-1 || broken(!!cs.DebugInfo) /* before Win8 */,
"Unexpected debug info pointer %p.\n", cs.DebugInfo);
DeleteCriticalSection(&cs);
ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo);
......@@ -2755,7 +2755,7 @@ static void test_crit_section(void)
memset(&cs, 0, sizeof(cs));
ret = pInitializeCriticalSectionEx(&cs, 0, 0);
ok(ret, "Failed to initialize critical section.\n");
todo_wine ok(cs.DebugInfo == (void *)(ULONG_PTR)-1 || broken(!!cs.DebugInfo) /* before Win8 */,
ok(cs.DebugInfo == (void *)(ULONG_PTR)-1 || broken(!!cs.DebugInfo) /* before Win8 */,
"Unexpected debug info pointer %p.\n", cs.DebugInfo);
DeleteCriticalSection(&cs);
ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo);
......@@ -2765,12 +2765,12 @@ 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, 0);
ok(ret, "Failed to initialize critical section.\n");
todo_wine ok(cs.DebugInfo == (void *)(ULONG_PTR)-1 || broken(!!cs.DebugInfo) /* before Win8 */,
ok(cs.DebugInfo == (void *)(ULONG_PTR)-1 || broken(!!cs.DebugInfo) /* before Win8 */,
"Unexpected debug info pointer %p.\n", cs.DebugInfo);
DeleteCriticalSection(&cs);
ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo);
......
......@@ -232,7 +232,7 @@ NTSTATUS WINAPI RtlInitializeCriticalSectionEx( RTL_CRITICAL_SECTION *crit, ULON
* is done, then debug info should be managed through Rtlp[Allocate|Free]DebugInfo
* so (e.g.) MakeCriticalSectionGlobal() doesn't free it using HeapFree().
*/
if (flags & RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO)
if (!(flags & RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO))
crit->DebugInfo = no_debug_info_marker;
else
{
......@@ -288,7 +288,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;
}
......
......@@ -2973,7 +2973,7 @@ static void test_RtlInitializeCriticalSectionEx(void)
memset(&cs, 0x11, sizeof(cs));
pRtlInitializeCriticalSectionEx(&cs, 0, 0);
ok((cs.DebugInfo != NULL && cs.DebugInfo != no_debug) || broken(cs.DebugInfo == no_debug) /* >= Win 8 */,
ok(cs.DebugInfo == no_debug || broken(cs.DebugInfo != NULL && cs.DebugInfo != no_debug) /* < Win8 */,
"expected DebugInfo != NULL and DebugInfo != ~0, got %p\n", cs.DebugInfo);
ok(cs.LockCount == -1, "expected LockCount == -1, got %ld\n", cs.LockCount);
ok(cs.RecursionCount == 0, "expected RecursionCount == 0, got %ld\n", cs.RecursionCount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment