ReactOS 0.4.15-dev-7931-gfd331f1
EngAcquireSemaphore.c File Reference
#include "precomp.h"
Include dependency graph for EngAcquireSemaphore.c:

Go to the source code of this file.

Functions

void Test_EngAcquireSemaphore ()
 
 START_TEST (EngAcquireSemaphore)
 

Function Documentation

◆ START_TEST()

START_TEST ( EngAcquireSemaphore  )

Definition at line 53 of file EngAcquireSemaphore.c.

54{
56}
void Test_EngAcquireSemaphore()

◆ Test_EngAcquireSemaphore()

void Test_EngAcquireSemaphore ( )

Definition at line 10 of file EngAcquireSemaphore.c.

11{
12 HSEMAPHORE hsem;
14
15 hsem = EngCreateSemaphore();
16 ok(hsem != NULL, "EngCreateSemaphore failed\n");
17 if (!hsem) return;
18 lpcrit = (PRTL_CRITICAL_SECTION)hsem;
19
20 /* real data test */
22// ok(lpcrit->LockCount == -2); doesn't work on XP
23 ok(lpcrit->RecursionCount == 1, "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
39
40 /* NULL pointer test */
41 // Note NULL pointer test crash in Vista */
42 // EngAcquireSemaphore(NULL);
43
44 /* negtive pointer test */
45 // Note negtive pointer test crash in Vista */
46 // EngAcquireSemaphore((HSEMAPHORE)-1);
47
48 /* try with deleted Semaphore */
49 // Note deleted Semaphore pointer test does freze the whole program in Vista */
50 // EngAcquireSemaphore(hsem);
51}
#define ok(value,...)
Definition: atltest.h:57
DWORD_PTR HSEMAPHORE
Definition: axcore.idl:60
#define NULL
Definition: types.h:112
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
HSEMAPHORE WINAPI EngCreateSemaphore(VOID)
Definition: eng.c:75
struct _RTL_CRITICAL_SECTION * PRTL_CRITICAL_SECTION
PRTL_CRITICAL_SECTION_DEBUG DebugInfo
Definition: rtltypes.h:1431
_Requires_lock_not_held_ hsem ENGAPI VOID APIENTRY EngDeleteSemaphore(_Inout_ __drv_freesMem(Mem) HSEMAPHORE hsem)
Definition: semaphor.c:106
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)

Referenced by START_TEST().