From fc78efb162b6409eb45de265b476d17535e0f56a Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 5 Jan 2026 15:34:00 +0200 Subject: [PATCH] [NTDLL_WINETEST] Fix failing tests on Windows 2003 --- modules/rostests/winetests/ntdll/env.c | 16 +++++++-------- modules/rostests/winetests/ntdll/file.c | 15 ++++++++++++++ modules/rostests/winetests/ntdll/info.c | 27 ++++++++++++++++++++++++- modules/rostests/winetests/ntdll/om.c | 25 +++++++++++++++++------ modules/rostests/winetests/ntdll/path.c | 21 +++++++++++++++++++ modules/rostests/winetests/ntdll/pipe.c | 15 ++++++++++++++ modules/rostests/winetests/ntdll/rtl.c | 8 ++++++++ 7 files changed, 112 insertions(+), 15 deletions(-) diff --git a/modules/rostests/winetests/ntdll/env.c b/modules/rostests/winetests/ntdll/env.c index 3cc16e19387..d58a71d1391 100644 --- a/modules/rostests/winetests/ntdll/env.c +++ b/modules/rostests/winetests/ntdll/env.c @@ -428,7 +428,7 @@ static void test_process_params(void) ok( size != ~(SIZE_T)0, "not a heap block %p\n", params ); ok( params->AllocationSize == params->Size, "wrong AllocationSize %lx/%lx\n", params->AllocationSize, params->Size ); - ok( params->Size < size, "wrong Size %lx/%Ix\n", params->Size, size ); + ok( params->Size < size || /* __REACTOS__ Win 2003: */ broken(params->Size == size), "wrong Size %lx/%Ix\n", params->Size, size); 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 ); @@ -465,12 +465,12 @@ static void test_process_params(void) ok( pos == params->Size || pos + 4 == params->Size, "wrong pos %Ix/%lx\n", pos, params->Size ); pos = params->Size; - ok( (char *)params->Environment - (char *)params == (UINT_PTR)pos, + ok( (char *)params->Environment - (char *)params == (UINT_PTR)pos || broken(/* __REACTOS__ */ GetNTVersion() < _WIN32_WINNT_VISTA), "wrong env %Ix/%Ix\n", (UINT_PTR)((char *)params->Environment - (char *)params), pos); pos += get_env_length(params->Environment) * sizeof(WCHAR); ok( align(pos, sizeof(void *)) == size || - broken( align(pos, 4) == size ), "wrong size %Ix/%Ix\n", pos, size ); - ok( params->EnvironmentSize == size - ((char *)params->Environment - (char *)params), + broken( align(pos, 4) == size ) || broken(/* __REACTOS__ */ GetNTVersion() < _WIN32_WINNT_VISTA), "wrong size %Ix/%Ix\n", pos, size ); + ok( params->EnvironmentSize == size - ((char *)params->Environment - (char *)params) || broken(/* __REACTOS__ */ GetNTVersion() < _WIN32_WINNT_VISTA), "wrong len %Ix/%Ix\n", params->EnvironmentSize, size - ((char *)params->Environment - (char *)params) ); pRtlDestroyProcessParameters( params ); @@ -482,7 +482,7 @@ static void test_process_params(void) ok( size != ~(SIZE_T)0, "not a heap block %p\n", params ); ok( params->AllocationSize == params->Size, "wrong AllocationSize %lx/%lx\n", params->AllocationSize, params->Size ); - ok( params->Size < size, "wrong Size %lx/%Ix\n", params->Size, size ); + ok( params->Size < size || broken(/* __REACTOS__ */ GetNTVersion() < _WIN32_WINNT_VISTA), "wrong Size %lx/%Ix\n", params->Size, size ); pos = (UINT_PTR)params->CurrentDirectory.DosPath.Buffer; if (params->CurrentDirectory.DosPath.Length == dummy_dir.Length + sizeof(WCHAR)) @@ -503,12 +503,12 @@ static void test_process_params(void) ok( pos == params->Size || pos + 4 == params->Size, "wrong pos %Ix/%lx\n", pos, params->Size ); pos = params->Size; - ok( (char *)params->Environment - (char *)params == pos, + ok( (char *)params->Environment - (char *)params == pos || broken(/* __REACTOS__ */ GetNTVersion() < _WIN32_WINNT_VISTA), "wrong env %Ix/%Ix\n", (UINT_PTR)((char *)params->Environment - (char *)params), pos); pos += get_env_length(params->Environment) * sizeof(WCHAR); ok( align(pos, sizeof(void *)) == size || - broken( align(pos, 4) == size ), "wrong size %Ix/%Ix\n", pos, size ); - ok( params->EnvironmentSize == size - ((char *)params->Environment - (char *)params), + broken( align(pos, 4) == size || broken(/* __REACTOS__ */ GetNTVersion() < _WIN32_WINNT_VISTA) ), "wrong size %Ix/%Ix\n", pos, size ); + ok( params->EnvironmentSize == size - ((char *)params->Environment - (char *)params) || broken(/* __REACTOS__ */ GetNTVersion() < _WIN32_WINNT_VISTA), "wrong len %Ix/%Ix\n", params->EnvironmentSize, size - ((char *)params->Environment - (char *)params) ); pRtlDestroyProcessParameters( params ); diff --git a/modules/rostests/winetests/ntdll/file.c b/modules/rostests/winetests/ntdll/file.c index 17744e7fc23..4f3581fe956 100644 --- a/modules/rostests/winetests/ntdll/file.c +++ b/modules/rostests/winetests/ntdll/file.c @@ -4331,8 +4331,19 @@ static void test_file_completion_information(void) info.Flags = flag; status = pNtSetInformationFile(server, &io, &info, sizeof(info), FileIoCompletionNotificationInformation); +#ifdef __REACTOS__ + if (GetNTVersion() < _WIN32_WINNT_VISTA) + { + ok(status == STATUS_ACCESS_DENIED, "Got unexpected status %#lx.\n", status); + } + else + { +#endif ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status); test_completion_flags(server, flag); +#ifdef __REACTOS__ + } +#endif fci.CompletionPort = completion; fci.CompletionKey = CKEY_FIRST; @@ -4340,7 +4351,11 @@ static void test_file_completion_information(void) status = pNtSetInformationFile(server, &io, &fci, sizeof(fci), FileCompletionInformation); ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status); ok(io.Status == STATUS_SUCCESS, "Got unexpected iosb.Status %#lx.\n", io.Status); +#ifdef __REACTOS__ + if ((flag == FILE_SKIP_SET_EVENT_ON_HANDLE) && (GetNTVersion() >= _WIN32_WINNT_VISTA)) +#else if (flag == FILE_SKIP_SET_EVENT_ON_HANDLE) +#endif ok(!is_signaled(server), "Expected not signaled.\n"); else ok(is_signaled(server), "Expected signaled.\n"); diff --git a/modules/rostests/winetests/ntdll/info.c b/modules/rostests/winetests/ntdll/info.c index 7a6a0b0aa9d..b17b13c81c3 100644 --- a/modules/rostests/winetests/ntdll/info.c +++ b/modules/rostests/winetests/ntdll/info.c @@ -412,6 +412,13 @@ static void test_query_cpu(void) len = 0xdeadbeef; status = pNtQuerySystemInformation( SystemProcessorBrandString, buffer, sizeof(buffer), &len ); +#ifdef __REACTOS__ + if (GetNTVersion() < _WIN32_WINNT_VISTA) + { + ok(status == STATUS_INVALID_INFO_CLASS, "Unexpected status 0x%lx\n", status ); + } + else +#endif if (status != STATUS_NOT_SUPPORTED) { ok( !status, "SystemProcessorBrandString failed %lx\n", status ); @@ -638,6 +645,9 @@ static void test_query_process( BOOL extended ) { todo_wine ok( !!ti->StackBase, "Got NULL StackBase.\n" ); todo_wine ok( !!ti->StackLimit, "Got NULL StackLimit.\n" ); +#ifdef __REACTOS__ + if ((GetNTVersion() >= _WIN32_WINNT_VISTA) && !is_reactos()) // Broken on Win 2003 +#endif ok( !!ti->Win32StartAddress, "Got NULL Win32StartAddress.\n" ); cid.UniqueProcess = 0; @@ -654,6 +664,10 @@ static void test_query_process( BOOL extended ) expected_address = tbi.TebBaseAddress; if (is_wow64 && is_process_wow64) expected_address = (BYTE *)expected_address - 0x2000; +#ifdef __REACTOS__ + if ((GetNTVersion() < _WIN32_WINNT_VISTA) && !is_reactos()) // Broken on Win 2003 + expected_address = NULL; +#endif if (!is_wow64 && !is_process_wow64 && !tbi.TebBaseAddress) win_skip( "Could not get TebBaseAddress, thread %lu.\n", j ); else @@ -682,6 +696,14 @@ static void test_query_process( BOOL extended ) HeapFree( GetProcessHeap(), 0, spi_buf); +#ifdef __REACTOS__ + if (GetNTVersion() < _WIN32_WINNT_VISTA) + { + win_skip("Skipping ClientId tests on pre-NT6.\n"); + } + else + { +#endif for (i = 1; i < 4; ++i) { InitializeObjectAttributes( &attr, NULL, 0, NULL, NULL ); @@ -719,6 +741,9 @@ static void test_query_process( BOOL extended ) NtClose( handle ); } +#ifdef __REACTOS__ + } +#endif winetest_pop_context(); } @@ -3846,7 +3871,7 @@ static void test_system_debug_control(void) } else { - ok( status == STATUS_DEBUGGER_INACTIVE || status == STATUS_ACCESS_DENIED || status == STATUS_INFO_LENGTH_MISMATCH, + ok( status == STATUS_DEBUGGER_INACTIVE || status == STATUS_ACCESS_DENIED || status == STATUS_INFO_LENGTH_MISMATCH || broken(/* __REACTOS__ Win 2003: */ status == STATUS_NOT_IMPLEMENTED), "class %d, got %#lx.\n", class, status ); } } diff --git a/modules/rostests/winetests/ntdll/om.c b/modules/rostests/winetests/ntdll/om.c index b97992bdd64..4aa6419cca5 100644 --- a/modules/rostests/winetests/ntdll/om.c +++ b/modules/rostests/winetests/ntdll/om.c @@ -1675,8 +1675,8 @@ static void _test_object_name( unsigned line, HANDLE handle, const WCHAR *expect memset( buffer, 0, sizeof(buffer) ); status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(buffer), &len ); ok_(__FILE__,line)( status == STATUS_SUCCESS, "NtQueryObject failed %lx\n", status ); - ok_(__FILE__,line)( len >= sizeof(OBJECT_NAME_INFORMATION) + str->Length, "unexpected len %lu\n", len ); - ok_(__FILE__,line)( compare_unicode_string( str, expected_name ), "got %s, expected %s\n", + ok_(__FILE__,line)( len >= sizeof(OBJECT_NAME_INFORMATION) + str->Length || broken(/* __REACTOS__ */ GetNTVersion() < _WIN32_WINNT_VISTA), "unexpected len %lu\n", len ); + ok_(__FILE__,line)( compare_unicode_string( str, expected_name ) || broken(/* __REACTOS__ */ GetNTVersion() < _WIN32_WINNT_VISTA), "got %s, expected %s\n", debugstr_w(str->Buffer), debugstr_w(expected_name) ); } @@ -1743,7 +1743,7 @@ static void test_query_object(void) "name too short %s\n", wine_dbgstr_w(str->Buffer) ); /* check for \\Sessions prefix in the name */ swprintf( expect, ARRAY_SIZE(expect), L"\\Sessions\\%u%s", NtCurrentTeb()->Peb->SessionId, name ); - ok( (str->Length == wcslen( expect ) * sizeof(WCHAR) && !wcscmp( str->Buffer, expect )), + ok( (str->Length == wcslen( expect ) * sizeof(WCHAR) && !wcscmp( str->Buffer, expect )) || broken(/* __REACTOS__ */ (GetNTVersion() < _WIN32_WINNT_VISTA) && (str->Length == wcslen( name ) * sizeof(WCHAR)) && !wcscmp( str->Buffer, name )), "wrong name %s\n", wine_dbgstr_w(str->Buffer) ); trace( "got %s len %lu\n", wine_dbgstr_w(str->Buffer), len ); @@ -1788,7 +1788,7 @@ static void test_query_object(void) len = 0; status = pNtQueryObject( handle, ObjectNameInformation, buffer, 0, &len ); ok( status == STATUS_INFO_LENGTH_MISMATCH, "got %#lx\n", status ); - ok( len == expected_len, "unexpected len %lu\n", len ); + ok( len == expected_len || broken(/* __REACTOS__ */ (GetNTVersion() < _WIN32_WINNT_VISTA) && (len == sizeof(UNICODE_STRING))), "unexpected len %lu\n", len); len = 0; status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(UNICODE_STRING), &len ); @@ -2132,7 +2132,7 @@ static void test_process(void) cid.UniqueProcess = 0; cid.UniqueThread = 0; status = pNtOpenProcess( &process, PROCESS_QUERY_LIMITED_INFORMATION, &attr, &cid ); - ok( status == STATUS_INVALID_CID, "NtOpenProcess returned %lx\n", status ); + ok( status == STATUS_INVALID_CID || broken(/* __REACTOS__ */ (GetNTVersion() < _WIN32_WINNT_VISTA) && (status == STATUS_INVALID_PARAMETER)), "NtOpenProcess returned %lx\n", status ); cid.UniqueProcess = ULongToHandle( 0xdeadbeef ); cid.UniqueThread = ULongToHandle( 0xdeadbeef ); @@ -2145,7 +2145,7 @@ static void test_process(void) cid.UniqueThread = 0; process = (HANDLE)0xdeadbeef; status = pNtOpenProcess( &process, PROCESS_QUERY_LIMITED_INFORMATION, &attr, &cid ); - ok( status == STATUS_INVALID_CID, "NtOpenProcess returned %lx\n", status ); + ok( status == STATUS_INVALID_CID || broken(/* __REACTOS__ */ (GetNTVersion() < _WIN32_WINNT_VISTA) && (status == STATUS_INVALID_PARAMETER)), "NtOpenProcess returned %lx\n", status ); ok( !process || broken(process == (HANDLE)0xdeadbeef) /* vista */, "handle set %p\n", process ); cid.UniqueProcess = ULongToHandle( GetCurrentProcessId() ); @@ -3412,6 +3412,14 @@ static void test_zero_access(void) HANDLE h1, h2; DWORD err; +#ifdef __REACTOS__ + if (GetNTVersion() < _WIN32_WINNT_VISTA) + { + skip("Zero access tests don't work on Windows 2003\n"); + return; + } +#endif + size.QuadPart = 4096; timeout.QuadPart = -10000; swprintf( name, ARRAY_SIZE(name), L"\\Sessions\\%u\\BaseNamedObjects\\test_object", NtCurrentTeb()->Peb->SessionId ); @@ -3918,6 +3926,11 @@ START_TEST(om) pNtCompareObjects = (void *)GetProcAddress(hntdll, "NtCompareObjects"); pNtOpenThread = (void *)GetProcAddress(hntdll, "NtOpenThread"); +#ifdef __REACTOS__ + if (GetNTVersion() < _WIN32_WINNT_VISTA) + win_skip("test_null_in_object_name() doesn't work on Windows 2003\n"); + else +#endif test_null_in_object_name(); test_case_sensitive(); test_namespace_pipe(); diff --git a/modules/rostests/winetests/ntdll/path.c b/modules/rostests/winetests/ntdll/path.c index 27dfd189a29..4ed819a014c 100644 --- a/modules/rostests/winetests/ntdll/path.c +++ b/modules/rostests/winetests/ntdll/path.c @@ -557,6 +557,21 @@ static void test_RtlDosPathNameToNtPathName_U(void) {L"\\??", L"\\??\\C:\\??", 7}, {L"\\??\\", L"\\??\\C:\\??\\", -1}, +#ifdef __REACTOS__ + {L"\\??\\/", L"\\??\\/", 4, L"\\??\\C:\\??\\" /* Windows 2003 */ }, + {L"\\??\\foo", L"\\??\\foo", 4, L"\\??\\C:\\??\\foo" /* Windows 2003 */ }, + {L"\\??\\foo/", L"\\??\\foo/", 4, L"\\??\\C:\\??\\foo\\" /* Windows 2003 */ }, + {L"\\??\\foo/bar", L"\\??\\foo/bar", 4, L"\\??\\C:\\??\\foo\\bar" /* Windows 2003 */ }, + {L"\\??\\foo/.", L"\\??\\foo/.", 4, L"\\??\\C:\\??\\foo" /* Windows 2003 */ }, + {L"\\??\\foo/..", L"\\??\\foo/..", 4, L"\\??\\C:\\??" /* Windows 2003 */ }, + {L"\\??\\\\", L"\\??\\\\", -1, L"\\??\\C:\\??\\" /* Windows 2003 */ }, + {L"\\??\\\\\\", L"\\??\\\\\\", -1, L"\\??\\C:\\??\\" /* Windows 2003 */ }, + {L"\\??\\foo\\", L"\\??\\foo\\", -1, L"\\??\\C:\\??\\foo\\" /* Windows 2003 */ }, + {L"\\??\\foo\\bar", L"\\??\\foo\\bar", 8, L"\\??\\C:\\??\\foo\\bar" /* Windows 2003 */ }, + {L"\\??\\foo\\.", L"\\??\\foo\\.", 8, L"\\??\\C:\\??\\foo" /* Windows 2003 */ }, + {L"\\??\\foo\\..", L"\\??\\foo\\..", 8, L"\\??\\C:\\??" /* Windows 2003 */ }, + {L"\\??\\foo. . ", L"\\??\\foo. . ", 4, L"\\??\\C:\\??\\foo" /* Windows 2003 */ }, +#else {L"\\??\\/", L"\\??\\/", 4}, {L"\\??\\foo", L"\\??\\foo", 4}, {L"\\??\\foo/", L"\\??\\foo/", 4}, @@ -570,6 +585,7 @@ static void test_RtlDosPathNameToNtPathName_U(void) {L"\\??\\foo\\.", L"\\??\\foo\\.", 8}, {L"\\??\\foo\\..", L"\\??\\foo\\..", 8}, {L"\\??\\foo. . ", L"\\??\\foo. . ", 4}, +#endif {L"CONIN$", L"\\??\\CONIN$", -1, L"\\??\\C:\\windows\\CONIN$" /* win7 */ }, {L"CONOUT$", L"\\??\\CONOUT$", -1, L"\\??\\C:\\windows\\CONOUT$" /* win7 */ }, @@ -593,6 +609,11 @@ static void test_RtlDosPathNameToNtPathName_U(void) if (pRtlDosPathNameToNtPathName_U_WithStatus) { status = pRtlDosPathNameToNtPathName_U_WithStatus(error_paths[i], &nameW, &file_part, NULL); +#ifdef __REACTOS__ + if (GetNTVersion() < _WIN32_WINNT_VISTA) + ok(status == STATUS_OBJECT_PATH_NOT_FOUND, "Got status %#lx.\n", status); + else +#endif ok(status == STATUS_OBJECT_NAME_INVALID, "Got status %#lx.\n", status); } diff --git a/modules/rostests/winetests/ntdll/pipe.c b/modules/rostests/winetests/ntdll/pipe.c index c3b2d17a050..b0cb7462dc5 100644 --- a/modules/rostests/winetests/ntdll/pipe.c +++ b/modules/rostests/winetests/ntdll/pipe.c @@ -2969,6 +2969,13 @@ static void subtest_pipe_name(const struct pipe_name_test *pnt) UNICODE_STRING name; NTSTATUS status; +#ifdef __REACTOS__ + if ((GetNTVersion() < _WIN32_WINNT_VISTA) && (wcscmp(pnt->name, L"\\Device\\NamedPipe\\\\") == 0)) + { + win_skip("Skipping subtest_pipe_name for '%ws' on Windows 2003\n", pnt->name); + return; + } +#endif pRtlInitUnicodeString(&name, pnt->name); InitializeObjectAttributes(&attr, &name, OBJ_CASE_INSENSITIVE, NULL, NULL); timeout.QuadPart = -100000000; @@ -3124,6 +3131,9 @@ static void test_async_cancel_on_handle_close(void) ok(io.Status == 0xcccccccc, "got %#lx.\n", io.Status); if (other_process && tests[i].apc_context && !tests[i].event) +#ifdef __REACTOS__ + todo_if((GetNTVersion() < _WIN32_WINNT_VISTA) && !tests[i].event && !tests[i].apc && tests[i].apc_context) +#endif test_queued_completion(port, &io, STATUS_CANCELLED, 0); else test_no_queued_completion(port); @@ -3226,6 +3236,11 @@ START_TEST(pipe) test_volume_info(); test_file_info(); test_security_info(); +#ifdef __REACTOS__ + if (GetNTVersion() < _WIN32_WINNT_VISTA) + win_skip("Skipping empty name pipe tests on Windows 2003.\n"); + else +#endif test_empty_name(); test_pipe_names(); test_async_cancel_on_handle_close(); diff --git a/modules/rostests/winetests/ntdll/rtl.c b/modules/rostests/winetests/ntdll/rtl.c index 8d0a8e471cc..79773b8628a 100644 --- a/modules/rostests/winetests/ntdll/rtl.c +++ b/modules/rostests/winetests/ntdll/rtl.c @@ -202,7 +202,11 @@ static void test_RtlQueryProcessDebugInformation(void) ok( buffer != NULL, "RtlCreateQueryDebugBuffer returned NULL" ); status = RtlQueryProcessDebugInformation( GetCurrentThreadId(), PDI_HEAPS | PDI_HEAP_BLOCKS, buffer ); +#ifdef __REACTOS__ + ok( status == (GetNTVersion() >= _WIN32_WINNT_VISTA ? STATUS_INVALID_CID : STATUS_INVALID_PARAMETER), "RtlQueryProcessDebugInformation returned %lx\n", status ); +#else ok( status == STATUS_INVALID_CID, "RtlQueryProcessDebugInformation returned %lx\n", status ); +#endif status = RtlQueryProcessDebugInformation( GetCurrentProcessId(), PDI_HEAPS | PDI_HEAP_BLOCKS, buffer ); ok( !status, "RtlQueryProcessDebugInformation returned %lx\n", status ); @@ -3504,7 +3508,11 @@ static void test_DbgPrint(void) test_dbg_print_except = FALSE; test_dbg_print_except_ret = (LONG)EXCEPTION_EXECUTE_HANDLER; status = DbgPrint( "test_DbgPrint: %s", "Hello World" ); +#ifdef __REACTOS__ + ok(status == (GetNTVersion() >= _WIN32_WINNT_VISTA ? 0 : 1), "DbgPrint returned %lx\n", status ); +#else ok( !status, "DbgPrint returned %lx\n", status ); +#endif ok( !test_dbg_print_except, "DBG_PRINTEXCEPTION_C received\n" ); #ifdef __REACTOS__