mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 01:57:23 +00:00
kernel32/tests: Add tests for critical section debug info presence.
This commit is contained in:
parent
e8f4909ac3
commit
0b441c4c8f
2 changed files with 38 additions and 6 deletions
|
@ -2741,7 +2741,8 @@ static void test_crit_section(void)
|
||||||
to override that. */
|
to override that. */
|
||||||
memset(&cs, 0, sizeof(cs));
|
memset(&cs, 0, sizeof(cs));
|
||||||
InitializeCriticalSection(&cs);
|
InitializeCriticalSection(&cs);
|
||||||
ok(cs.DebugInfo != NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo);
|
todo_wine ok(cs.DebugInfo == (void *)(ULONG_PTR)-1 || broken(!!cs.DebugInfo) /* before Win8 */,
|
||||||
|
"Unexpected debug info pointer %p.\n", cs.DebugInfo);
|
||||||
DeleteCriticalSection(&cs);
|
DeleteCriticalSection(&cs);
|
||||||
ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo);
|
ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo);
|
||||||
|
|
||||||
|
@ -2751,10 +2752,39 @@ static void test_crit_section(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 */,
|
||||||
|
"Unexpected debug info pointer %p.\n", cs.DebugInfo);
|
||||||
|
DeleteCriticalSection(&cs);
|
||||||
|
ok(cs.DebugInfo == NULL, "Unexpected debug info pointer %p.\n", cs.DebugInfo);
|
||||||
|
|
||||||
memset(&cs, 0, sizeof(cs));
|
memset(&cs, 0, sizeof(cs));
|
||||||
ret = pInitializeCriticalSectionEx(&cs, 0, CRITICAL_SECTION_NO_DEBUG_INFO);
|
ret = pInitializeCriticalSectionEx(&cs, 0, CRITICAL_SECTION_NO_DEBUG_INFO);
|
||||||
ok(ret, "Failed to initialize critical section.\n");
|
ok(ret, "Failed to initialize critical section.\n");
|
||||||
ok(cs.DebugInfo == (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo);
|
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);
|
||||||
|
|
||||||
|
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 */,
|
||||||
|
"Unexpected debug info pointer %p.\n", cs.DebugInfo);
|
||||||
|
DeleteCriticalSection(&cs);
|
||||||
|
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);
|
||||||
|
ok(ret || broken(GetLastError() == ERROR_INVALID_PARAMETER) /* before Win8 */,
|
||||||
|
"Failed to initialize critical section, error %lu.\n", GetLastError());
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
ret = pInitializeCriticalSectionEx(&cs, 0, 0);
|
||||||
|
ok(ret, "Failed to initialize critical section.\n");
|
||||||
|
}
|
||||||
|
ok(cs.DebugInfo && cs.DebugInfo != (void *)(ULONG_PTR)-1, "Unexpected debug info pointer %p.\n", cs.DebugInfo);
|
||||||
|
|
||||||
ret = TryEnterCriticalSection(&cs);
|
ret = TryEnterCriticalSection(&cs);
|
||||||
ok(ret, "Failed to enter critical section.\n");
|
ok(ret, "Failed to enter critical section.\n");
|
||||||
|
|
|
@ -6113,11 +6113,13 @@ typedef struct _RTL_CRITICAL_SECTION {
|
||||||
ULONG_PTR SpinCount;
|
ULONG_PTR SpinCount;
|
||||||
} RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
|
} RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
|
||||||
|
|
||||||
#define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
|
#define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x01000000
|
||||||
#define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
|
#define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x02000000
|
||||||
#define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
|
#define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x04000000
|
||||||
#define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
|
#define RTL_CRITICAL_SECTION_FLAG_RESOURCE_TYPE 0x08000000
|
||||||
#define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
|
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO 0x10000000
|
||||||
|
#define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xff000000
|
||||||
|
#define RTL_CRITICAL_SECTION_FLAG_RESERVED 0xe0000000
|
||||||
|
|
||||||
typedef struct _RTL_SRWLOCK {
|
typedef struct _RTL_SRWLOCK {
|
||||||
PVOID Ptr;
|
PVOID Ptr;
|
||||||
|
|
Loading…
Reference in a new issue