e2d487715b55cddc5be52cc8591c61825f3c13c9
[reactos.git] / rostests / apitests / gdi32 / EngCreateSemaphore.c
1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for EngCreateSemaphore
5 * PROGRAMMERS: Magnus Olsen
6 */
7
8 #include <wine/test.h>
9 #include <wingdi.h>
10 #include <winddi.h>
11
12 void Test_EngCreateSemaphore()
13 {
14 HSEMAPHORE hsem;
15 PRTL_CRITICAL_SECTION lpcrit;
16
17 hsem = EngCreateSemaphore();
18 ok(hsem != NULL, "EngCreateSemaphore failed\n");
19 if (!hsem) return;
20 lpcrit = (PRTL_CRITICAL_SECTION)hsem;
21
22 ok(lpcrit->LockCount == -1, "lpcrit->LockCount=%ld\n", lpcrit->LockCount);
23 ok(lpcrit->RecursionCount == 0, "lpcrit->RecursionCount=%ld\n", lpcrit->RecursionCount);
24 ok(lpcrit->OwningThread == 0, "lpcrit->OwningThread=%p\n", lpcrit->OwningThread);
25 ok(lpcrit->LockSemaphore == 0, "lpcrit->LockSemaphore=%p\n", lpcrit->LockSemaphore);
26 ok(lpcrit->SpinCount == 0, "lpcrit->SpinCount=%ld\n", lpcrit->SpinCount);
27
28 ok(lpcrit->DebugInfo != NULL, "no DebugInfo\n");
29 if (lpcrit->DebugInfo)
30 {
31 ok(lpcrit->DebugInfo->Type == 0, "DebugInfo->Type=%d\n", lpcrit->DebugInfo->Type);
32 ok(lpcrit->DebugInfo->CreatorBackTraceIndex == 0, "DebugInfo->CreatorBackTraceIndex=%d\n", lpcrit->DebugInfo->CreatorBackTraceIndex);
33 ok(lpcrit->DebugInfo->EntryCount == 0, "DebugInfo->EntryCount=%ld\n", lpcrit->DebugInfo->EntryCount);
34 ok(lpcrit->DebugInfo->ContentionCount == 0, "DebugInfo->ContentionCount=%ld\n", lpcrit->DebugInfo->ContentionCount);
35 }
36
37 EngDeleteSemaphore(hsem);
38 }
39
40 START_TEST(EngCreateSemaphore)
41 {
42 Test_EngCreateSemaphore();
43 }
44