[NTDLL_WINETEST] Fix failing tests on Windows Vista

This commit is contained in:
Timo Kreuzer
2026-05-05 07:44:54 +00:00
parent fc78efb162
commit 5be29348db
8 changed files with 109 additions and 13 deletions
+5
View File
@@ -432,6 +432,11 @@ static void test_process_params(void)
ok( params->Flags == 0, "wrong Flags %lu\n", params->Flags );
ok( params->DebugFlags == 0, "wrong Flags %lu\n", params->DebugFlags );
ok( params->ConsoleHandle == 0, "wrong ConsoleHandle %p\n", params->ConsoleHandle );
#ifdef __REACTOS__
if (GetEnvironmentVariableW(L"ROSAUTOTEST_DIR", NULL, 0))
ok( params->ConsoleFlags == 1, "wrong ConsoleFlags %lu\n", params->ConsoleFlags );
else
#endif
ok( params->ConsoleFlags == 0, "wrong ConsoleFlags %lu\n", params->ConsoleFlags );
ok( params->hStdInput == 0, "wrong hStdInput %p\n", params->hStdInput );
ok( params->hStdOutput == 0, "wrong hStdOutput %p\n", params->hStdOutput );
+32 -1
View File
@@ -4575,6 +4575,12 @@ static void test_wow64_context(void)
ctx.ContextFlags = WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST;
ret = pRtlWow64GetThreadContext( pi.hThread, &ctx );
ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
#ifdef __REACTOS__
if (GetNTVersion() <= _WIN32_WINNT_WIN7)
ok( ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST),
"got context flags %#lx\n", ctx.ContextFlags );
else
#endif
ok( (ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING) || broken( ctx.ContextFlags == WOW64_CONTEXT_ALL ) /*Win 7*/,
"got context flags %#lx\n", ctx.ContextFlags );
@@ -4805,7 +4811,9 @@ static LONG WINAPI dbg_except_continue_vectored_handler(struct _EXCEPTION_POINTE
if (rec->ExceptionCode == 0xceadbeef)
{
#ifndef __REACTOS__ // Broken on Windows Vista and Windows 10
ok(context->P1Home == (ULONG64)0xdeadbeeffeedcafe, "Got unexpected context->P1Home %#Ix.\n", context->P1Home);
#endif
context->R12 = test_kiuserexceptiondispatcher_saved_r12;
return EXCEPTION_CONTINUE_EXECUTION;
}
@@ -4838,6 +4846,14 @@ static void * WINAPI hook_KiUserExceptionDispatcher(EXCEPTION_RECORD *rec, CONTE
"Got unexpected ExceptionCode %#lx.\n", rec->ExceptionCode);
ok( !((ULONG_PTR)context & 15), "unaligned context %p\n", context );
#ifdef __REACTOS__
if (GetNTVersion() < _WIN32_WINNT_WIN8)
{
win_skip("No extended context support.\n");
}
else
{
#endif
ok( xctx->All.Offset == -sizeof(CONTEXT), "wrong All.Offset %lx\n", xctx->All.Offset );
ok( xctx->All.Length >= sizeof(CONTEXT) + offsetof(CONTEXT_EX, align), "wrong All.Length %lx\n", xctx->All.Length );
ok( xctx->Legacy.Offset == -sizeof(CONTEXT), "wrong Legacy.Offset %lx\n", xctx->All.Offset );
@@ -4845,6 +4861,9 @@ static void * WINAPI hook_KiUserExceptionDispatcher(EXCEPTION_RECORD *rec, CONTE
ok( (void *)(xctx + 1) == (void *)rec, "wrong ptrs %p / %p\n", xctx, rec );
ok( frame->rip == context->Rip, "wrong rip %Ix / %Ix\n", frame->rip, context->Rip );
ok( frame->rsp == context->Rsp, "wrong rsp %Ix / %Ix\n", frame->rsp, context->Rsp );
#ifdef __REACTOS__
}
#endif
hook_KiUserExceptionDispatcher_rip = (void *)context->Rip;
hook_exception_address = rec->ExceptionAddress;
@@ -5111,7 +5130,9 @@ static void * WINAPI hook_KiUserApcDispatcher(CONTEXT *context)
context, context->Rip, context->Rsp,
(char *)context->Rsp - (char *)context, context->ContextFlags );
#ifndef __REACTOS__ // Broken on Windows Vista and Windows 10
ok( context->P1Home == 0x1234, "wrong p1 %#Ix\n", context->P1Home );
#endif
ok( context->P2Home == 0x5678, "wrong p2 %#Ix\n", context->P2Home );
ok( context->P3Home == 0xdeadbeef, "wrong p3 %#Ix\n", context->P3Home );
ok( context->P4Home == (ULONG_PTR)apc_func, "wrong p4 %#Ix / %p\n", context->P4Home, apc_func );
@@ -11877,17 +11898,27 @@ static void test_context_exception_request(void)
}
#endif
expected_flags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING;
expected_flags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING; // 0xC0010001
c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST;
ret = GetThreadContext( thread, &c );
ok( ret, "got error %lu.\n", GetLastError() );
#ifdef __REACTOS__
if (GetNTVersion() < _WIN32_WINNT_VISTA)
ok( c.ContextFlags == (expected_flags & ~CONTEXT_EXCEPTION_REPORTING), "got %#lx.\n", c.ContextFlags );
else
#endif
ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE
| CONTEXT_EXCEPTION_ACTIVE;
ret = GetThreadContext( thread, &c );
ok( ret, "got error %lu.\n", GetLastError() );
#ifdef __REACTOS__
if (GetNTVersion() < _WIN32_WINNT_VISTA)
ok( c.ContextFlags == (expected_flags | CONTEXT_SERVICE_ACTIVE | CONTEXT_EXCEPTION_ACTIVE), "got %#lx, expected %#lx.\n", c.ContextFlags, expected_flags );
else
#endif
ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
WriteRelease( &p.sync, 6 );
+26
View File
@@ -1610,6 +1610,14 @@ static void test_query_firmware(void)
sfti->Action = SystemFirmwareTable_Get;
status = pNtQuerySystemInformation(SystemFirmwareTableInformation, sfti, min_sfti_len, &len1);
#ifdef __REACTOS__
if (status == STATUS_INVALID_DEVICE_REQUEST)
{
win_skip("SystemFirmwareTableInformation not available\n");
HeapFree(GetProcessHeap(), 0, sfti);
return;
}
#endif
ok(status == STATUS_BUFFER_TOO_SMALL, "Expected STATUS_BUFFER_TOO_SMALL, got %08lx\n", status);
ok(len1 >= min_sfti_len, "Expected length >= %lu, got %lu\n", min_sfti_len, len1);
ok(sfti->TableBufferLength == len1 - min_sfti_len,
@@ -2452,6 +2460,11 @@ static void test_query_process_image_info(void)
broken( !info.MajorOperatingSystemVersion ), /* <= win8 */
"wrong major OS version %x/%x\n",
info.MajorOperatingSystemVersion, nt->OptionalHeader.MajorOperatingSystemVersion );
#ifdef __REACTOS__
if (GetNTVersion() < _WIN32_WINNT_WIN7)
ok( info.MinorOperatingSystemVersion == 0, "wrong minor version %x/%x\n", info.MinorOperatingSystemVersion, 0 );
else
#endif
ok( info.MinorOperatingSystemVersion == nt->OptionalHeader.MinorOperatingSystemVersion,
"wrong minor OS version %x/%x\n",
info.MinorOperatingSystemVersion, nt->OptionalHeader.MinorOperatingSystemVersion );
@@ -3596,10 +3609,18 @@ static void test_thread_ideal_processor(void)
ok(status == STATUS_INVALID_INFO_CLASS, "Unexpected status %#lx.\n", status);
status = pNtQueryInformationThread( GetCurrentThread(), ThreadIdealProcessorEx, &processor, sizeof(processor) + 1, &len );
#ifdef __REACTOS__
ok(status == (GetNTVersion() >= _WIN32_WINNT_WIN7 ? STATUS_INFO_LENGTH_MISMATCH : STATUS_INVALID_INFO_CLASS), "Unexpected status %#lx.\n", status);
#else
ok(status == STATUS_INFO_LENGTH_MISMATCH, "Unexpected status %#lx.\n", status);
#endif
status = pNtQueryInformationThread( GetCurrentThread(), ThreadIdealProcessorEx, &processor, sizeof(processor), &len );
#ifdef __REACTOS__
ok(status == (GetNTVersion() >= _WIN32_WINNT_WIN7 ? STATUS_SUCCESS : STATUS_INVALID_INFO_CLASS), "Unexpected status %#lx.\n", status);
#else
ok(status == STATUS_SUCCESS, "Unexpected status %#lx.\n", status);
#endif
}
static void test_thread_info(void)
@@ -3913,6 +3934,11 @@ static void test_process_token(int argc, char **argv)
ret = DuplicateTokenEx( token, TOKEN_ALL_ACCESS, NULL, SecurityAnonymous, TokenImpersonation, &token_info.Token );
ok( ret, "got error %lu\n", GetLastError() );
status = pNtSetInformationProcess( pi.hProcess, ProcessAccessToken, &token_info, sizeof(token_info) );
#ifdef __REACTOS__
if (GetNTVersion() < _WIN32_WINNT_WIN7)
todo_wine ok( status == STATUS_BAD_TOKEN_TYPE, "got %#lx\n", status );
else
#endif
todo_wine ok( status == STATUS_BAD_IMPERSONATION_LEVEL, "got %#lx\n", status );
CloseHandle( token_info.Token );
+37 -9
View File
@@ -666,9 +666,9 @@ static void test_name_limits(void)
ok( status == STATUS_SUCCESS, "%u: NtCreateMutant failed %lx\n", str.Length, status );
attr3.RootDirectory = ret;
status = pNtOpenMutant( &ret2, GENERIC_ALL, &attr );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenMutant failed %lx\n", str.Length, status );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenMutant failed %lx\n", str.Length, status);
status = pNtOpenMutant( &ret2, GENERIC_ALL, &attr3 );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenMutant failed %lx\n", str.Length, status );
ok( status == (__REACTOS__WinVer_lt(_WIN32_WINNT_WIN7) ? STATUS_INVALID_HANDLE : STATUS_OBJECT_TYPE_MISMATCH), "%u: NtOpenMutant failed %lx\n", str.Length, status );
pNtClose( ret );
status = pNtCreateSemaphore( &ret, GENERIC_ALL, &attr2, 1, 2 );
ok( status == STATUS_SUCCESS, "%u: NtCreateSemaphore failed %lx\n", str.Length, status );
@@ -676,7 +676,7 @@ static void test_name_limits(void)
status = pNtOpenSemaphore( &ret2, GENERIC_ALL, &attr );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenSemaphore failed %lx\n", str.Length, status );
status = pNtOpenSemaphore( &ret2, GENERIC_ALL, &attr3 );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenSemaphore failed %lx\n", str.Length, status );
ok( status == STATUS_OBJECT_TYPE_MISMATCH || /* __REACTOS__ */ broken(status == STATUS_INVALID_HANDLE), "%u: NtOpenSemaphore failed %lx\n", str.Length, status );
pNtClose( ret );
status = pNtCreateEvent( &ret, GENERIC_ALL, &attr2, SynchronizationEvent, 0 );
ok( status == STATUS_SUCCESS, "%u: NtCreateEvent failed %lx\n", str.Length, status );
@@ -684,7 +684,7 @@ static void test_name_limits(void)
status = pNtOpenEvent( &ret2, GENERIC_ALL, &attr );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenEvent failed %lx\n", str.Length, status );
status = pNtOpenEvent( &ret2, GENERIC_ALL, &attr3 );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenEvent failed %lx\n", str.Length, status );
ok( status == STATUS_OBJECT_TYPE_MISMATCH || /* __REACTOS__ */ broken(status == STATUS_INVALID_HANDLE), "%u: NtOpenEvent failed %lx\n", str.Length, status );
pNtClose( ret );
status = pNtCreateKeyedEvent( &ret, GENERIC_ALL, &attr2, 0 );
ok( status == STATUS_SUCCESS, "%u: NtCreateKeyedEvent failed %lx\n", str.Length, status );
@@ -692,7 +692,7 @@ static void test_name_limits(void)
status = pNtOpenKeyedEvent( &ret2, GENERIC_ALL, &attr );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenKeyedEvent failed %lx\n", str.Length, status );
status = pNtOpenKeyedEvent( &ret2, GENERIC_ALL, &attr3 );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenKeyedEvent failed %lx\n", str.Length, status );
ok( status == STATUS_OBJECT_TYPE_MISMATCH || /* __REACTOS__ */ broken(status == STATUS_INVALID_HANDLE), "%u: NtOpenKeyedEvent failed %lx\n", str.Length, status );
pNtClose( ret );
status = pNtCreateTimer( &ret, GENERIC_ALL, &attr2, NotificationTimer );
ok( status == STATUS_SUCCESS, "%u: NtCreateTimer failed %lx\n", str.Length, status );
@@ -700,7 +700,7 @@ static void test_name_limits(void)
status = pNtOpenTimer( &ret2, GENERIC_ALL, &attr );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenTimer failed %lx\n", str.Length, status );
status = pNtOpenTimer( &ret2, GENERIC_ALL, &attr3 );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenTimer failed %lx\n", str.Length, status );
ok( status == STATUS_OBJECT_TYPE_MISMATCH || /* __REACTOS__ */ broken(status == STATUS_INVALID_HANDLE), "%u: NtOpenTimer failed %lx\n", str.Length, status );
pNtClose( ret );
status = pNtCreateIoCompletion( &ret, GENERIC_ALL, &attr2, 0 );
ok( status == STATUS_SUCCESS, "%u: NtCreateCompletion failed %lx\n", str.Length, status );
@@ -708,7 +708,7 @@ static void test_name_limits(void)
status = pNtOpenIoCompletion( &ret2, GENERIC_ALL, &attr );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenCompletion failed %lx\n", str.Length, status );
status = pNtOpenIoCompletion( &ret2, GENERIC_ALL, &attr3 );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenCompletion failed %lx\n", str.Length, status );
ok( status == STATUS_OBJECT_TYPE_MISMATCH || /* __REACTOS__ */ broken(status == STATUS_INVALID_HANDLE), "%u: NtOpenCompletion failed %lx\n", str.Length, status );
pNtClose( ret );
status = pNtCreateJobObject( &ret, GENERIC_ALL, &attr2 );
ok( status == STATUS_SUCCESS, "%u: NtCreateJobObject failed %lx\n", str.Length, status );
@@ -716,7 +716,7 @@ static void test_name_limits(void)
status = pNtOpenJobObject( &ret2, GENERIC_ALL, &attr );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenJobObject failed %lx\n", str.Length, status );
status = pNtOpenJobObject( &ret2, GENERIC_ALL, &attr3 );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenJobObject failed %lx\n", str.Length, status );
ok( status == STATUS_OBJECT_TYPE_MISMATCH || /* __REACTOS__ */ broken(status == STATUS_INVALID_HANDLE), "%u: NtOpenJobObject failed %lx\n", str.Length, status );
pNtClose( ret );
status = pNtCreateDirectoryObject( &ret, GENERIC_ALL, &attr2 );
ok( status == STATUS_SUCCESS, "%u: NtCreateDirectoryObject failed %lx\n", str.Length, status );
@@ -743,7 +743,7 @@ static void test_name_limits(void)
status = pNtOpenSection( &ret2, SECTION_MAP_WRITE, &attr );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenSection failed %lx\n", str.Length, status );
status = pNtOpenSection( &ret2, SECTION_MAP_WRITE, &attr3 );
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "%u: NtOpenSection failed %lx\n", str.Length, status );
ok( status == STATUS_OBJECT_TYPE_MISMATCH || /* __REACTOS__ */ broken(status == STATUS_INVALID_HANDLE), "%u: NtOpenSection failed %lx\n", str.Length, status );
pNtClose( ret );
str.Length = 67;
@@ -2334,17 +2334,34 @@ static void test_object_types(void)
TYPE( L"File", FILE, 0, 0 ),
TYPE( L"IoCompletion", IO_COMPLETION, 0, 0 ),
TYPE( L"IoCompletionReserve", IO_COMPLETION_RESERVE, 0, 0 ),
#ifdef __REACTOS__
TYPE( L"Job", JOB_OBJECT, 0, JOB_OBJECT_IMPERSONATE ),
TYPE( L"Key", KEY, SYNCHRONIZE, KEY_CREATE_LINK ),
#else
TYPE( L"Job", JOB_OBJECT, 0, JOB_OBJECT_IMPERSONATE | 0x3C0 ),
TYPE( L"Key", KEY, SYNCHRONIZE, 0 ),
#endif
TYPE( L"KeyedEvent", KEYEDEVENT, SYNCHRONIZE, 0 ),
TYPE( L"Mutant", MUTANT, 0, 0 ),
#ifdef __REACTOS__
TYPE( L"Process", PROCESS, 0, PROCESS_TERMINATE ),
#else
TYPE( L"Process", PROCESS, 0, 0 ),
#endif
TYPE( L"Section", SECTION, SYNCHRONIZE, 0 ),
TYPE( L"Semaphore", SEMAPHORE, 0, 0 ),
TYPE( L"SymbolicLink", SYMBOLIC_LINK, 0, 0xfffe ),
#ifdef __REACTOS__
TYPE( L"Thread", THREAD, 0, THREAD_RESUME | THREAD_QUERY_LIMITED_INFORMATION ),
#else
TYPE( L"Thread", THREAD, 0, THREAD_RESUME ),
#endif
TYPE( L"Timer", TIMER, 0, 0 ),
#ifdef __REACTOS__
TYPE( L"Token", TOKEN, SYNCHRONIZE, TOKEN_QUERY_SOURCE | TOKEN_IMPERSONATE | TOKEN_DUPLICATE | TOKEN_ASSIGN_PRIMARY),
#else
TYPE( L"Token", TOKEN, SYNCHRONIZE, 0 ),
#endif
TYPE( L"Type", TYPE, SYNCHRONIZE, 0 ),
TYPE( L"UserApcReserve", USER_APC_RESERVE, 0, 0 ),
TYPE( L"WindowStation", WINSTA, 0, 0 ),
@@ -2384,6 +2401,17 @@ static void test_object_types(void)
for (i = 0; i < ARRAY_SIZE(tests); i++)
{
#ifdef __REACTOS__
if (GetNTVersion() < _WIN32_WINNT_WIN7)
{
if (!wcscmp(tests[i].name, L"IoCompletionReserve") ||
!wcscmp(tests[i].name, L"UserApcReserve"))
{
skip("%s not implemented before Win7\n", tests[i].name);
break;
}
}
#endif
for (j = 0; j < ARRAY_SIZE(all_types); j++)
{
if (!all_types[j].TypeName.Buffer) continue;
+2 -2
View File
@@ -981,9 +981,9 @@ static void test_completion_port_scheduling(void)
BOOL bret;
#if defined(__REACTOS__)
if (is_reactos())
if ((GetNTVersion() < _WIN32_WINNT_WIN7) || is_reactos())
{
skip("Skipping completion port scheduling test, because it hangs on ReactOS\n");
skip("Skipping completion port scheduling test, because it hangs on Windows 2003, Vista and ReactOS\n");
return;
}
#endif
+1 -1
View File
@@ -225,7 +225,7 @@ static void test_RtlQueryPerformanceCounter(void)
#define CHECK_CURRENT_TIMER(expected) \
do { \
ok(status == STATUS_SUCCESS, "NtSetTimerResolution failed %lx\n", status); \
ok(cur2 == (expected) || broken(abs((int)((expected) - cur2)) <= TIMER_LEEWAY), "expected new timer resolution %lu, got %lu\n", (expected), cur2); \
ok(cur2 == (expected) || broken(abs((int)((expected) - cur2)) <= TIMER_LEEWAY) || /* __REACTOS__ */ broken(GetNTVersion() < _WIN32_WINNT_WIN7), "expected new timer resolution %lu, got %lu\n", (expected), cur2); \
set = cur2; \
min2 = min + 20000; \
cur2 = min2 + 1; \
@@ -1634,6 +1634,11 @@ static void test_NtMapViewOfSection(void)
ok(status == STATUS_SUCCESS || status == STATUS_IMAGE_NOT_AT_BASE, "NtMapViewOfSection returned %08lx\n", status);
ok(!((ULONG_PTR)ptr & 0xffff), "returned memory %p is not aligned to 64k\n", ptr);
#ifdef __REACTOS__
if (GetNTVersion() < _WIN32_WINNT_WIN7 && !is_reactos())
win_skip("Skipping test on pre-Win7, because it's broken\n");
else
#endif
ok(((UINT_PTR)ptr & ~get_zero_bits_mask(zero_bits)) == 0, "NtMapViewOfSection returned address %p\n", ptr);
status = NtUnmapViewOfSection(process, ptr);
+1
View File
@@ -1016,6 +1016,7 @@ extern void winetest_end_nocount(void);
#define GetMajorNTVersion() (*(ULONG*)(KUSER_SHARED_DATA_UMPTR + 0x026C))
#define GetMinorNTVersion() (*(ULONG*)(KUSER_SHARED_DATA_UMPTR + 0x0270))
#define GetNTVersion() ((GetMajorNTVersion() << 8) | GetMinorNTVersion())
#define __REACTOS__WinVer_lt(Ver) ((GetNTVersion() < (Ver)))
#ifdef STANDALONE