Nikolay Sivov : kernel32/tests: Add a test for critical section DebugInfo initial value.

Alexandre Julliard julliard at winehq.org
Mon Nov 25 09:12:22 CST 2019


Module: wine
Branch: stable
Commit: 0a77cef2eef6fcb17cfecaa21ae7aed5cae535b9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0a77cef2eef6fcb17cfecaa21ae7aed5cae535b9

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Apr 25 12:31:55 2019 +0300

kernel32/tests: Add a test for critical section DebugInfo initial value.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit bf174815ba8529bfbbda8697503d3c2539f82359)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/kernel32/tests/sync.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c
index f7be51e972..8dea3b30c3 100644
--- a/dlls/kernel32/tests/sync.c
+++ b/dlls/kernel32/tests/sync.c
@@ -2636,6 +2636,26 @@ static void test_apc_deadlock(void)
     CloseHandle(pi.hProcess);
 }
 
+static void test_crit_section(void)
+{
+    CRITICAL_SECTION cs;
+    BOOL ret;
+
+    /* Win8+ does not initialize debug info, one has to use RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO
+       to override that. */
+    memset(&cs, 0, sizeof(cs));
+    InitializeCriticalSection(&cs);
+    ok(cs.DebugInfo != NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo);
+    DeleteCriticalSection(&cs);
+
+    memset(&cs, 0, sizeof(cs));
+    ret = InitializeCriticalSectionEx(&cs, 0, CRITICAL_SECTION_NO_DEBUG_INFO);
+    ok(ret, "Failed to initialize critical section.\n");
+todo_wine
+    ok(cs.DebugInfo == (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo);
+    DeleteCriticalSection(&cs);
+}
+
 START_TEST(sync)
 {
     char **argv;
@@ -2694,4 +2714,5 @@ START_TEST(sync)
     test_srwlock_example();
     test_alertable_wait();
     test_apc_deadlock();
+    test_crit_section();
 }




More information about the wine-cvs mailing list