Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ntdll/tests/om.c | 170 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index a0702a580b7..f18afa05ae9 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -78,6 +78,16 @@ static NTSTATUS (WINAPI *pNtCompareObjects)(HANDLE,HANDLE); #define KEYEDEVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x0003) #define DESKTOP_ALL_ACCESS 0x01ff
+#define check_unicode_string(a, b) check_unicode_string_(__LINE__, a, b) +static void check_unicode_string_( int line, const UNICODE_STRING *string, const WCHAR *expect ) +{ + size_t len = wcslen( expect ) * sizeof(WCHAR); + + ok_(__FILE__, line)( !wcscmp( string->Buffer, expect ), "got string %s\n", debugstr_w( string->Buffer )); + ok_(__FILE__, line)( string->Length == len, "got length %u\n", string->Length ); + ok_(__FILE__, line)( string->MaximumLength == len + sizeof(WCHAR), "got max length %u\n", string->MaximumLength ); +} + static void test_case_sensitive (void) { NTSTATUS status; @@ -2500,6 +2510,165 @@ static void test_object_identity(void) pNtClose( h1 ); }
+static void test_query_directory(void) +{ + char buffer[200]; + DIRECTORY_BASIC_INFORMATION *info = (void *)buffer; + ULONG context, size, needed_size; + HANDLE dir, child1, child2; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING string; + NTSTATUS status; + + RtlInitUnicodeString( &string, L"\BaseNamedObjects\winetest" ); + InitializeObjectAttributes( &attr, &string, 0, 0, NULL ); + status = NtCreateDirectoryObject( &dir, DIRECTORY_QUERY, &attr ); + ok( !status, "got %#x\n", status ); + + context = 0xdeadbeef; + size = 0xdeadbeef; + status = NtQueryDirectoryObject( dir, info, sizeof(buffer), TRUE, TRUE, &context, &size ); + ok( status == STATUS_NO_MORE_ENTRIES, "got %#x\n", status ); + todo_wine ok( context == 0xdeadbeef, "got context %#x\n", context ); + todo_wine ok( !size, "got size %u\n", size ); + + RtlInitUnicodeString( &string, L"\BaseNamedObjects\winetest\Telamon" ); + status = NtCreateMutant( &child1, GENERIC_ALL, &attr, FALSE ); + ok( !status, "got %#x\n", status ); + + RtlInitUnicodeString( &string, L"\BaseNamedObjects\winetest\Oileus" ); + status = NtCreateMutant( &child2, GENERIC_ALL, &attr, FALSE ); + ok( !status, "got %#x\n", status ); + + status = NtQueryDirectoryObject( NULL, info, sizeof(buffer), TRUE, TRUE, &context, &size ); + ok( status == STATUS_INVALID_HANDLE, "got %#x\n", status ); + + status = NtQueryDirectoryObject( dir, info, sizeof(buffer), TRUE, TRUE, NULL, &size ); + ok( status == STATUS_ACCESS_VIOLATION, "got %#x\n", status ); + + context = 0xdeadbeef; + size = 0xdeadbeef; + memset( buffer, 0xcc, sizeof(buffer) ); + status = NtQueryDirectoryObject( dir, info, sizeof(buffer), TRUE, TRUE, &context, &size ); + ok( !status, "got %#x\n", status ); + ok( context == 1, "got context %#x\n", context ); + ok( size && size < sizeof(buffer), "got size %u\n", size ); + check_unicode_string( &info[0].ObjectName, L"Oileus" ); + check_unicode_string( &info[0].ObjectTypeName, L"Mutant" ); + todo_wine + { + ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); + ok( !info[1].ObjectName.Length, "got length %u\n", info[1].ObjectName.Length ); + ok( !info[1].ObjectName.MaximumLength, "got max length %u\n", info[1].ObjectName.MaximumLength ); + ok( !info[1].ObjectTypeName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); + ok( !info[1].ObjectTypeName.Length, "got length %u\n", info[1].ObjectTypeName.Length ); + ok( !info[1].ObjectTypeName.MaximumLength, "got max length %u\n", info[1].ObjectTypeName.MaximumLength ); + } + + memset( buffer, 0xcc, sizeof(buffer) ); + status = NtQueryDirectoryObject( dir, info, sizeof(buffer), TRUE, FALSE, &context, &size ); + ok( !status, "got %#x\n", status ); + ok( context == 2, "got context %#x\n", context ); + check_unicode_string( &info[0].ObjectName, L"Telamon" ); + check_unicode_string( &info[0].ObjectTypeName, L"Mutant" ); + todo_wine ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); + + size = 0xdeadbeef; + memset( buffer, 0xcc, sizeof(buffer) ); + status = NtQueryDirectoryObject( dir, info, sizeof(buffer), TRUE, FALSE, &context, &size ); + ok( status == STATUS_NO_MORE_ENTRIES, "got %#x\n", status ); + ok( context == 2, "got context %#x\n", context ); + todo_wine ok( !size, "got size %u\n", size ); + + memset( buffer, 0xcc, sizeof(buffer) ); + status = NtQueryDirectoryObject( dir, info, sizeof(buffer), TRUE, TRUE, &context, &size ); + ok( !status, "got %#x\n", status ); + ok( context == 1, "got context %#x\n", context ); + check_unicode_string( &info[0].ObjectName, L"Oileus" ); + check_unicode_string( &info[0].ObjectTypeName, L"Mutant" ); + todo_wine ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); + + needed_size = size; + + size = 0xdeadbeef; + context = 0xdeadbeef; + status = NtQueryDirectoryObject( dir, info, 0, TRUE, TRUE, &context, &size ); + todo_wine ok( status == STATUS_BUFFER_TOO_SMALL, "got %#x\n", status ); + todo_wine ok( context == 0xdeadbeef, "got context %#x\n", context ); + todo_wine ok( size == needed_size, "expected size %u, got %u\n", needed_size, size ); + + size = 0xdeadbeef; + memset( buffer, 0xcc, sizeof(buffer) ); + status = NtQueryDirectoryObject( dir, info, needed_size - 1, TRUE, TRUE, &context, &size ); + todo_wine ok( status == STATUS_BUFFER_TOO_SMALL, "got %#x\n", status ); + todo_wine ok( size == needed_size, "expected size %u, got %u\n", needed_size, size ); + ok( info[0].ObjectName.Length == 0xcccc, "got length %u\n", info[0].ObjectName.Length ); + + status = NtQueryDirectoryObject( dir, info, sizeof(buffer), TRUE, TRUE, &context, NULL ); + ok( !status, "got %#x\n", status ); + + context = 0; + memset( buffer, 0xcc, sizeof(buffer) ); + status = NtQueryDirectoryObject( dir, info, sizeof(buffer), TRUE, FALSE, &context, &size ); + ok( !status, "got %#x\n", status ); + ok( context == 1, "got context %#x\n", context ); + check_unicode_string( &info[0].ObjectName, L"Oileus" ); + check_unicode_string( &info[0].ObjectTypeName, L"Mutant" ); + todo_wine ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); + + memset( buffer, 0xcc, sizeof(buffer) ); + status = NtQueryDirectoryObject( dir, info, sizeof(buffer), FALSE, TRUE, &context, &size ); + todo_wine ok( !status, "got %#x\n", status ); + if (!status) + { + ok( context == 2, "got context %#x\n", context ); + check_unicode_string( &info[0].ObjectName, L"Oileus" ); + check_unicode_string( &info[0].ObjectTypeName, L"Mutant" ); + check_unicode_string( &info[1].ObjectName, L"Telamon" ); + check_unicode_string( &info[1].ObjectTypeName, L"Mutant" ); + ok( !info[2].ObjectName.Buffer, "got string %p\n", info[2].ObjectName.Buffer ); + } + + needed_size = size; + size = 0xdeadbeef; + context = 0xdeadbeef; + memset( buffer, 0xcc, sizeof(buffer) ); + status = NtQueryDirectoryObject( dir, info, needed_size - 1, FALSE, TRUE, &context, &size ); + todo_wine ok( status == STATUS_MORE_ENTRIES, "got %#x\n", status ); + if (status == STATUS_MORE_ENTRIES) + { + ok( context == 1, "got context %#x\n", context ); + ok( size > 0 && size < needed_size, "got size %u\n", size ); + check_unicode_string( &info[0].ObjectName, L"Oileus" ); + check_unicode_string( &info[0].ObjectTypeName, L"Mutant" ); + ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); + + context = 0xdeadbeef; + memset( buffer, 0xcc, sizeof(buffer) ); + status = NtQueryDirectoryObject( dir, info, size - 1, FALSE, TRUE, &context, &size ); + todo_wine ok( status == STATUS_BUFFER_TOO_SMALL, "got %#x\n", status ); + todo_wine ok( context == 0xdeadbeef, "got context %#x\n", context ); + todo_wine ok( size == needed_size, "expected size %u, got %u\n", needed_size, size ); + ok( info[0].ObjectName.Length == 0xcccc, "got length %u\n", info[0].ObjectName.Length ); + } + + context = 1; + memset( buffer, 0xcc, sizeof(buffer) ); + status = NtQueryDirectoryObject( dir, info, sizeof(buffer), FALSE, FALSE, &context, &size ); + todo_wine ok( !status, "got %#x\n", status ); + if (!status) + { + ok( context == 2, "got context %#x\n", context ); + check_unicode_string( &info[0].ObjectName, L"Telamon" ); + check_unicode_string( &info[0].ObjectTypeName, L"Mutant" ); + ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); + } + + NtClose( child1 ); + NtClose( child2 ); + NtClose( dir ); +} + START_TEST(om) { HMODULE hntdll = GetModuleHandleA("ntdll.dll"); @@ -2561,4 +2730,5 @@ START_TEST(om) test_get_next_thread(); test_globalroot(); test_object_identity(); + test_query_directory(); }
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ntdll/tests/om.c | 4 ++-- dlls/ntdll/unix/sync.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index f18afa05ae9..b0fea870809 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -2529,7 +2529,7 @@ static void test_query_directory(void) size = 0xdeadbeef; status = NtQueryDirectoryObject( dir, info, sizeof(buffer), TRUE, TRUE, &context, &size ); ok( status == STATUS_NO_MORE_ENTRIES, "got %#x\n", status ); - todo_wine ok( context == 0xdeadbeef, "got context %#x\n", context ); + ok( context == 0xdeadbeef, "got context %#x\n", context ); todo_wine ok( !size, "got size %u\n", size );
RtlInitUnicodeString( &string, L"\BaseNamedObjects\winetest\Telamon" ); @@ -2594,7 +2594,7 @@ static void test_query_directory(void) context = 0xdeadbeef; status = NtQueryDirectoryObject( dir, info, 0, TRUE, TRUE, &context, &size ); todo_wine ok( status == STATUS_BUFFER_TOO_SMALL, "got %#x\n", status ); - todo_wine ok( context == 0xdeadbeef, "got context %#x\n", context ); + ok( context == 0xdeadbeef, "got context %#x\n", context ); todo_wine ok( size == needed_size, "expected size %u, got %u\n", needed_size, size );
size = 0xdeadbeef; diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 0786454dad2..373afd69b2b 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -1099,10 +1099,9 @@ NTSTATUS WINAPI NtQueryDirectoryObject( HANDLE handle, DIRECTORY_BASIC_INFORMATI ULONG size, BOOLEAN single_entry, BOOLEAN restart, ULONG *context, ULONG *ret_size ) { + ULONG index = restart ? 0 : *context; NTSTATUS ret;
- if (restart) *context = 0; - if (single_entry) { if (size <= sizeof(*buffer) + 2 * sizeof(WCHAR)) return STATUS_BUFFER_OVERFLOW; @@ -1110,7 +1109,7 @@ NTSTATUS WINAPI NtQueryDirectoryObject( HANDLE handle, DIRECTORY_BASIC_INFORMATI SERVER_START_REQ( get_directory_entry ) { req->handle = wine_server_obj_handle( handle ); - req->index = *context; + req->index = index; wine_server_set_reply( req, buffer + 1, size - sizeof(*buffer) - 2*sizeof(WCHAR) ); if (!(ret = wine_server_call( req ))) { @@ -1125,7 +1124,7 @@ NTSTATUS WINAPI NtQueryDirectoryObject( HANDLE handle, DIRECTORY_BASIC_INFORMATI buffer->ObjectTypeName.Length ); buffer->ObjectName.Buffer[buffer->ObjectName.Length/sizeof(WCHAR)] = 0; buffer->ObjectTypeName.Buffer[buffer->ObjectTypeName.Length/sizeof(WCHAR)] = 0; - (*context)++; + *context = index + 1; } } SERVER_END_REQ;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=111913
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2572: Test failed: got string L"Oileus" om.c:2572: Test failed: got length 12 om.c:2572: Test failed: got max length 14 om.c:2581: Test failed: got size 16 om.c:2587: Test failed: got string L"Telamon" om.c:2587: Test failed: got length 14 om.c:2587: Test failed: got max length 16 om.c:2605: Test failed: got length 0 om.c:2615: Test failed: got string L"Telamon" om.c:2615: Test failed: got length 14 om.c:2615: Test failed: got max length 16 om.c:2625: Test failed: got string L"Telamon" om.c:2625: Test failed: got length 14 om.c:2625: Test failed: got max length 16 om.c:2627: Test failed: got string L"Oileus" om.c:2627: Test failed: got length 12 om.c:2627: Test failed: got max length 14 om.c:2642: Test failed: got string L"Telamon" om.c:2642: Test failed: got length 14 om.c:2642: Test failed: got max length 16 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 106, got 16 om.c:2652: Test failed: got length 0 om.c:2662: Test failed: got string L"Oileus" om.c:2662: Test failed: got length 12 om.c:2662: Test failed: got max length 14
=== w7u_adm (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2572: Test failed: got string L"Oileus" om.c:2572: Test failed: got length 12 om.c:2572: Test failed: got max length 14 om.c:2581: Test failed: got size 16 om.c:2587: Test failed: got string L"Telamon" om.c:2587: Test failed: got length 14 om.c:2587: Test failed: got max length 16 om.c:2605: Test failed: got length 0 om.c:2615: Test failed: got string L"Telamon" om.c:2615: Test failed: got length 14 om.c:2615: Test failed: got max length 16 om.c:2625: Test failed: got string L"Telamon" om.c:2625: Test failed: got length 14 om.c:2625: Test failed: got max length 16 om.c:2627: Test failed: got string L"Oileus" om.c:2627: Test failed: got length 12 om.c:2627: Test failed: got max length 14 om.c:2642: Test failed: got string L"Telamon" om.c:2642: Test failed: got length 14 om.c:2642: Test failed: got max length 16 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 106, got 16 om.c:2652: Test failed: got length 0 om.c:2662: Test failed: got string L"Oileus" om.c:2662: Test failed: got length 12 om.c:2662: Test failed: got max length 14
=== w7u_el (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2572: Test failed: got string L"Oileus" om.c:2572: Test failed: got length 12 om.c:2572: Test failed: got max length 14 om.c:2581: Test failed: got size 16 om.c:2587: Test failed: got string L"Telamon" om.c:2587: Test failed: got length 14 om.c:2587: Test failed: got max length 16 om.c:2605: Test failed: got length 0 om.c:2615: Test failed: got string L"Telamon" om.c:2615: Test failed: got length 14 om.c:2615: Test failed: got max length 16 om.c:2625: Test failed: got string L"Telamon" om.c:2625: Test failed: got length 14 om.c:2625: Test failed: got max length 16 om.c:2627: Test failed: got string L"Oileus" om.c:2627: Test failed: got length 12 om.c:2627: Test failed: got max length 14 om.c:2642: Test failed: got string L"Telamon" om.c:2642: Test failed: got length 14 om.c:2642: Test failed: got max length 16 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 106, got 16 om.c:2652: Test failed: got length 0 om.c:2662: Test failed: got string L"Oileus" om.c:2662: Test failed: got length 12 om.c:2662: Test failed: got max length 14
=== w8 (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2572: Test failed: got string L"Oileus" om.c:2572: Test failed: got length 12 om.c:2572: Test failed: got max length 14 om.c:2581: Test failed: got size 16 om.c:2587: Test failed: got string L"Telamon" om.c:2587: Test failed: got length 14 om.c:2587: Test failed: got max length 16 om.c:2605: Test failed: got length 0 om.c:2615: Test failed: got string L"Telamon" om.c:2615: Test failed: got length 14 om.c:2615: Test failed: got max length 16 om.c:2625: Test failed: got string L"Telamon" om.c:2625: Test failed: got length 14 om.c:2625: Test failed: got max length 16 om.c:2627: Test failed: got string L"Oileus" om.c:2627: Test failed: got length 12 om.c:2627: Test failed: got max length 14 om.c:2642: Test failed: got string L"Telamon" om.c:2642: Test failed: got length 14 om.c:2642: Test failed: got max length 16 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 106, got 16 om.c:2652: Test failed: got length 0 om.c:2662: Test failed: got string L"Oileus" om.c:2662: Test failed: got length 12 om.c:2662: Test failed: got max length 14
=== w8adm (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2572: Test failed: got string L"Oileus" om.c:2572: Test failed: got length 12 om.c:2572: Test failed: got max length 14 om.c:2581: Test failed: got size 16 om.c:2587: Test failed: got string L"Telamon" om.c:2587: Test failed: got length 14 om.c:2587: Test failed: got max length 16 om.c:2605: Test failed: got length 0 om.c:2615: Test failed: got string L"Telamon" om.c:2615: Test failed: got length 14 om.c:2615: Test failed: got max length 16 om.c:2625: Test failed: got string L"Telamon" om.c:2625: Test failed: got length 14 om.c:2625: Test failed: got max length 16 om.c:2627: Test failed: got string L"Oileus" om.c:2627: Test failed: got length 12 om.c:2627: Test failed: got max length 14 om.c:2642: Test failed: got string L"Telamon" om.c:2642: Test failed: got length 14 om.c:2642: Test failed: got max length 16 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 106, got 16 om.c:2652: Test failed: got length 0 om.c:2662: Test failed: got string L"Oileus" om.c:2662: Test failed: got length 12 om.c:2662: Test failed: got max length 14
=== w864 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w1064v1507 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w1064v1809 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w1064 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w1064_2qxl (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w1064_tsign (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w10pro64 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w10pro64_ar (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w10pro64_he (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w10pro64_ja (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w10pro64_zh_CN (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ntdll/tests/om.c | 21 +++++++++------------ dlls/ntdll/unix/sync.c | 13 ++++++++----- 2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index b0fea870809..a419a9d9cf2 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -2555,15 +2555,12 @@ static void test_query_directory(void) ok( size && size < sizeof(buffer), "got size %u\n", size ); check_unicode_string( &info[0].ObjectName, L"Oileus" ); check_unicode_string( &info[0].ObjectTypeName, L"Mutant" ); - todo_wine - { - ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); - ok( !info[1].ObjectName.Length, "got length %u\n", info[1].ObjectName.Length ); - ok( !info[1].ObjectName.MaximumLength, "got max length %u\n", info[1].ObjectName.MaximumLength ); - ok( !info[1].ObjectTypeName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); - ok( !info[1].ObjectTypeName.Length, "got length %u\n", info[1].ObjectTypeName.Length ); - ok( !info[1].ObjectTypeName.MaximumLength, "got max length %u\n", info[1].ObjectTypeName.MaximumLength ); - } + ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); + ok( !info[1].ObjectName.Length, "got length %u\n", info[1].ObjectName.Length ); + ok( !info[1].ObjectName.MaximumLength, "got max length %u\n", info[1].ObjectName.MaximumLength ); + ok( !info[1].ObjectTypeName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); + ok( !info[1].ObjectTypeName.Length, "got length %u\n", info[1].ObjectTypeName.Length ); + ok( !info[1].ObjectTypeName.MaximumLength, "got max length %u\n", info[1].ObjectTypeName.MaximumLength );
memset( buffer, 0xcc, sizeof(buffer) ); status = NtQueryDirectoryObject( dir, info, sizeof(buffer), TRUE, FALSE, &context, &size ); @@ -2571,7 +2568,7 @@ static void test_query_directory(void) ok( context == 2, "got context %#x\n", context ); check_unicode_string( &info[0].ObjectName, L"Telamon" ); check_unicode_string( &info[0].ObjectTypeName, L"Mutant" ); - todo_wine ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); + ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer );
size = 0xdeadbeef; memset( buffer, 0xcc, sizeof(buffer) ); @@ -2586,7 +2583,7 @@ static void test_query_directory(void) ok( context == 1, "got context %#x\n", context ); check_unicode_string( &info[0].ObjectName, L"Oileus" ); check_unicode_string( &info[0].ObjectTypeName, L"Mutant" ); - todo_wine ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); + ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer );
needed_size = size;
@@ -2614,7 +2611,7 @@ static void test_query_directory(void) ok( context == 1, "got context %#x\n", context ); check_unicode_string( &info[0].ObjectName, L"Oileus" ); check_unicode_string( &info[0].ObjectTypeName, L"Mutant" ); - todo_wine ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer ); + ok( !info[1].ObjectName.Buffer, "got string %p\n", info[1].ObjectName.Buffer );
memset( buffer, 0xcc, sizeof(buffer) ); status = NtQueryDirectoryObject( dir, info, sizeof(buffer), FALSE, TRUE, &context, &size ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 373afd69b2b..2d1012f89c8 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -1104,19 +1104,19 @@ NTSTATUS WINAPI NtQueryDirectoryObject( HANDLE handle, DIRECTORY_BASIC_INFORMATI
if (single_entry) { - if (size <= sizeof(*buffer) + 2 * sizeof(WCHAR)) return STATUS_BUFFER_OVERFLOW; + if (size <= 2 * sizeof(*buffer) + 2 * sizeof(WCHAR)) return STATUS_BUFFER_OVERFLOW;
SERVER_START_REQ( get_directory_entry ) { req->handle = wine_server_obj_handle( handle ); req->index = index; - wine_server_set_reply( req, buffer + 1, size - sizeof(*buffer) - 2*sizeof(WCHAR) ); + wine_server_set_reply( req, buffer + 2, size - 2 * sizeof(*buffer) - 2 * sizeof(WCHAR) ); if (!(ret = wine_server_call( req ))) { - buffer->ObjectName.Buffer = (WCHAR *)(buffer + 1); + buffer->ObjectName.Buffer = (WCHAR *)(buffer + 2); buffer->ObjectName.Length = reply->name_len; buffer->ObjectName.MaximumLength = reply->name_len + sizeof(WCHAR); - buffer->ObjectTypeName.Buffer = (WCHAR *)(buffer + 1) + reply->name_len/sizeof(WCHAR) + 1; + buffer->ObjectTypeName.Buffer = (WCHAR *)(buffer + 2) + reply->name_len/sizeof(WCHAR) + 1; buffer->ObjectTypeName.Length = wine_server_reply_size( reply ) - reply->name_len; buffer->ObjectTypeName.MaximumLength = buffer->ObjectTypeName.Length + sizeof(WCHAR); /* make room for the terminating null */ @@ -1124,12 +1124,15 @@ NTSTATUS WINAPI NtQueryDirectoryObject( HANDLE handle, DIRECTORY_BASIC_INFORMATI buffer->ObjectTypeName.Length ); buffer->ObjectName.Buffer[buffer->ObjectName.Length/sizeof(WCHAR)] = 0; buffer->ObjectTypeName.Buffer[buffer->ObjectTypeName.Length/sizeof(WCHAR)] = 0; + + memset( &buffer[1], 0, sizeof(buffer[1]) ); + *context = index + 1; } } SERVER_END_REQ; if (ret_size) - *ret_size = buffer->ObjectName.MaximumLength + buffer->ObjectTypeName.MaximumLength + sizeof(*buffer); + *ret_size = buffer->ObjectName.MaximumLength + buffer->ObjectTypeName.MaximumLength + 2 * sizeof(*buffer); } else {
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=111914
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w7u_adm (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w7u_el (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w8 (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w8adm (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w864 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064v1507 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064v1809 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064_2qxl (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064_tsign (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64_ar (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64_he (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64_ja (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64_zh_CN (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ntdll/tests/om.c | 2 +- dlls/ntdll/unix/sync.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index a419a9d9cf2..854317d5ef2 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -2590,7 +2590,7 @@ static void test_query_directory(void) size = 0xdeadbeef; context = 0xdeadbeef; status = NtQueryDirectoryObject( dir, info, 0, TRUE, TRUE, &context, &size ); - todo_wine ok( status == STATUS_BUFFER_TOO_SMALL, "got %#x\n", status ); + ok( status == STATUS_BUFFER_TOO_SMALL, "got %#x\n", status ); ok( context == 0xdeadbeef, "got context %#x\n", context ); todo_wine ok( size == needed_size, "expected size %u, got %u\n", needed_size, size );
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 2d1012f89c8..ff0273b49eb 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -1104,7 +1104,7 @@ NTSTATUS WINAPI NtQueryDirectoryObject( HANDLE handle, DIRECTORY_BASIC_INFORMATI
if (single_entry) { - if (size <= 2 * sizeof(*buffer) + 2 * sizeof(WCHAR)) return STATUS_BUFFER_OVERFLOW; + if (size <= 2 * sizeof(*buffer) + 2 * sizeof(WCHAR)) return STATUS_BUFFER_TOO_SMALL;
SERVER_START_REQ( get_directory_entry ) {
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=111915
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w7u_adm (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w7u_el (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w8 (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w8adm (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w864 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064v1507 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064v1809 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064_2qxl (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064_tsign (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64_ar (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64_he (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64_ja (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64_zh_CN (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ntdll/tests/om.c | 2 +- server/directory.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index 854317d5ef2..309bcc8b94b 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -2597,7 +2597,7 @@ static void test_query_directory(void) size = 0xdeadbeef; memset( buffer, 0xcc, sizeof(buffer) ); status = NtQueryDirectoryObject( dir, info, needed_size - 1, TRUE, TRUE, &context, &size ); - todo_wine ok( status == STATUS_BUFFER_TOO_SMALL, "got %#x\n", status ); + ok( status == STATUS_BUFFER_TOO_SMALL, "got %#x\n", status ); todo_wine ok( size == needed_size, "expected size %u, got %u\n", needed_size, size ); ok( info[0].ObjectName.Length == 0xcccc, "got length %u\n", info[0].ObjectName.Length );
diff --git a/server/directory.c b/server/directory.c index 2cd61be0838..caaf8c43d33 100644 --- a/server/directory.c +++ b/server/directory.c @@ -556,7 +556,7 @@ DECL_HANDLER(get_directory_entry) memcpy( (char *)ptr + name_len, type_name->str, type_name->len ); } } - else set_error( STATUS_BUFFER_OVERFLOW ); + else set_error( STATUS_BUFFER_TOO_SMALL );
release_object( obj ); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=111916
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w7u_adm (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w7u_el (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w8 (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w8adm (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2569: Test failed: got string L"Oileus" om.c:2569: Test failed: got length 12 om.c:2569: Test failed: got max length 14 om.c:2578: Test failed: got size 16 om.c:2584: Test failed: got string L"Telamon" om.c:2584: Test failed: got length 14 om.c:2584: Test failed: got max length 16 om.c:2602: Test failed: got length 0 om.c:2612: Test failed: got string L"Telamon" om.c:2612: Test failed: got length 14 om.c:2612: Test failed: got max length 16 om.c:2622: Test failed: got string L"Telamon" om.c:2622: Test failed: got length 14 om.c:2622: Test failed: got max length 16 om.c:2624: Test failed: got string L"Oileus" om.c:2624: Test failed: got length 12 om.c:2624: Test failed: got max length 14 om.c:2639: Test failed: got string L"Telamon" om.c:2639: Test failed: got length 14 om.c:2639: Test failed: got max length 16 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 106, got 16 om.c:2649: Test failed: got length 0 om.c:2659: Test failed: got string L"Oileus" om.c:2659: Test failed: got length 12 om.c:2659: Test failed: got max length 14
=== w864 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064v1507 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064v1809 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064_2qxl (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w1064_tsign (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64_ar (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64_he (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64_ja (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
=== w10pro64_zh_CN (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2578: Test failed: got size 32 om.c:2602: Test failed: got length 0 om.c:2646: Test failed: got 0x105 om.c:2647: Test failed: got context 0 om.c:2648: Test failed: expected size 154, got 32 om.c:2649: Test failed: got length 0
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52585 Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ntdll/unix/sync.c | 112 ++++++++++++++++++++++++++++------------- server/directory.c | 77 ++++++++++++++++++++++------ server/object.c | 1 - server/protocol.def | 22 +++++--- server/trace.c | 34 +++++++++++++ 5 files changed, 190 insertions(+), 56 deletions(-)
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index ff0273b49eb..4555277f1ae 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -1095,51 +1095,93 @@ NTSTATUS WINAPI NtOpenDirectoryObject( HANDLE *handle, ACCESS_MASK access, const /************************************************************************** * NtQueryDirectoryObject (NTDLL.@) */ -NTSTATUS WINAPI NtQueryDirectoryObject( HANDLE handle, DIRECTORY_BASIC_INFORMATION *buffer, +NTSTATUS WINAPI NtQueryDirectoryObject( HANDLE handle, DIRECTORY_BASIC_INFORMATION *info, ULONG size, BOOLEAN single_entry, BOOLEAN restart, ULONG *context, ULONG *ret_size ) { + unsigned int i, count, total_count, total_len, pos, used_size, used_count; ULONG index = restart ? 0 : *context; - NTSTATUS ret; + struct directory_entry *buffer; + NTSTATUS status; + char *p; + + if (!(buffer = malloc( size ))) return STATUS_NO_MEMORY;
- if (single_entry) + SERVER_START_REQ( get_directory_entries ) { - if (size <= 2 * sizeof(*buffer) + 2 * sizeof(WCHAR)) return STATUS_BUFFER_TOO_SMALL; + req->handle = wine_server_obj_handle( handle ); + req->index = index; + req->max_count = single_entry ? 1 : UINT_MAX; + wine_server_set_reply( req, buffer, size ); + status = wine_server_call( req ); + count = reply->count; + total_count = reply->total_count; + total_len = reply->total_len; + } + SERVER_END_REQ;
- SERVER_START_REQ( get_directory_entry ) - { - req->handle = wine_server_obj_handle( handle ); - req->index = index; - wine_server_set_reply( req, buffer + 2, size - 2 * sizeof(*buffer) - 2 * sizeof(WCHAR) ); - if (!(ret = wine_server_call( req ))) - { - buffer->ObjectName.Buffer = (WCHAR *)(buffer + 2); - buffer->ObjectName.Length = reply->name_len; - buffer->ObjectName.MaximumLength = reply->name_len + sizeof(WCHAR); - buffer->ObjectTypeName.Buffer = (WCHAR *)(buffer + 2) + reply->name_len/sizeof(WCHAR) + 1; - buffer->ObjectTypeName.Length = wine_server_reply_size( reply ) - reply->name_len; - buffer->ObjectTypeName.MaximumLength = buffer->ObjectTypeName.Length + sizeof(WCHAR); - /* make room for the terminating null */ - memmove( buffer->ObjectTypeName.Buffer, buffer->ObjectTypeName.Buffer - 1, - buffer->ObjectTypeName.Length ); - buffer->ObjectName.Buffer[buffer->ObjectName.Length/sizeof(WCHAR)] = 0; - buffer->ObjectTypeName.Buffer[buffer->ObjectTypeName.Length/sizeof(WCHAR)] = 0; - - memset( &buffer[1], 0, sizeof(buffer[1]) ); - - *context = index + 1; - } - } - SERVER_END_REQ; - if (ret_size) - *ret_size = buffer->ObjectName.MaximumLength + buffer->ObjectTypeName.MaximumLength + 2 * sizeof(*buffer); + if (status) + { + free( buffer ); + return status; } - else + + if (!total_count) { - FIXME("multiple entries not implemented\n"); - ret = STATUS_NOT_IMPLEMENTED; + free( buffer ); + if (ret_size) *ret_size = 0; + return STATUS_NO_MORE_ENTRIES; } - return ret; + + used_count = 0; + used_size = sizeof(*info); /* null terminator */ + for (i = pos = 0; i < count; ++i) + { + const struct directory_entry *entry = (const struct directory_entry *)((char *)buffer + pos); + unsigned int entry_size = sizeof(*info) + entry->name_len + entry->type_len + 2 * sizeof(WCHAR); + + if (used_size + entry_size > size) + break; + used_count++; + used_size += entry_size; + pos += sizeof(*entry) + ((entry->name_len + entry->type_len + 3) & ~3); + } + + if (!used_count) + { + if (ret_size) *ret_size = total_count * (sizeof(*info) + 2 * sizeof(WCHAR)) + sizeof(*info) + total_len; + free( buffer ); + return STATUS_BUFFER_TOO_SMALL; + } + + p = (char *)&info[used_count + 1]; /* after the null terminator */ + for (i = pos = 0; i < used_count; ++i) + { + const struct directory_entry *entry = (const struct directory_entry *)((char *)buffer + pos); + + info[i].ObjectName.Buffer = (WCHAR *)p; + info[i].ObjectName.Length = entry->name_len; + info[i].ObjectName.MaximumLength = entry->name_len + sizeof(WCHAR); + memcpy( p, (entry + 1), entry->name_len ); + info[i].ObjectName.Buffer[entry->name_len / sizeof(WCHAR)] = 0; + p += entry->name_len + sizeof(WCHAR); + + info[i].ObjectTypeName.Buffer = (WCHAR *)p; + info[i].ObjectTypeName.Length = entry->type_len; + info[i].ObjectTypeName.MaximumLength = entry->type_len + sizeof(WCHAR); + memcpy( p, (char *)(entry + 1) + entry->name_len, entry->type_len ); + info[i].ObjectTypeName.Buffer[entry->type_len / sizeof(WCHAR)] = 0; + p += entry->type_len + sizeof(WCHAR); + + pos += sizeof(*entry) + ((entry->name_len + entry->type_len + 3) & ~3); + } + + memset( &info[used_count], 0, sizeof(info[used_count]) ); + + if (ret_size) *ret_size = (char *)p - (char *)info; + *context = index + used_count; + free( buffer ); + return (used_count < total_count ? STATUS_MORE_ENTRIES : STATUS_SUCCESS); }
diff --git a/server/directory.c b/server/directory.c index caaf8c43d33..a7619c5a6af 100644 --- a/server/directory.c +++ b/server/directory.c @@ -533,30 +533,79 @@ DECL_HANDLER(open_directory) }
/* get a directory entry by index */ -DECL_HANDLER(get_directory_entry) +DECL_HANDLER(get_directory_entries) { struct directory *dir = (struct directory *)get_handle_obj( current->process, req->handle, DIRECTORY_QUERY, &directory_ops ); if (dir) { - struct object *obj = find_object_index( dir->entries, req->index ); - if (obj) + struct directory_entry *entry; + struct object *obj; + data_size_t size; + unsigned int i; + char *buffer; + + reply->count = 0; + reply->total_count = 0; + reply->total_len = 0; + + size = 0; + for (i = 0; i < req->max_count; ++i) { + const struct unicode_str *type_name; data_size_t name_len; - const struct unicode_str *type_name = &obj->ops->type->name; - const WCHAR *name = get_object_name( obj, &name_len ); + size_t entry_size;
- if (name_len + type_name->len <= get_reply_max_size()) + if (!(obj = find_object_index( dir->entries, req->index + reply->total_count ))) + break; + type_name = &obj->ops->type->name; + get_object_name( obj, &name_len ); + entry_size = (sizeof(*entry) + name_len + type_name->len + 3) & ~3; + + reply->total_count++; + reply->total_len += name_len + type_name->len; + + if (size + entry_size <= get_reply_max_size()) { - void *ptr = set_reply_data_size( name_len + type_name->len ); - if (ptr) - { - reply->name_len = name_len; - memcpy( ptr, name, name_len ); - memcpy( (char *)ptr + name_len, type_name->str, type_name->len ); - } + reply->count++; + size += entry_size; + } + + release_object( obj ); + } + + if (!(buffer = set_reply_data_size( size ))) + { + release_object( dir ); + return; + } + + size = 0; + for (i = 0; i < reply->count; ++i) + { + const struct unicode_str *type_name; + data_size_t name_len; + const WCHAR *name; + + obj = find_object_index( dir->entries, req->index + i ); + assert( obj ); + type_name = &obj->ops->type->name; + name = get_object_name( obj, &name_len ); + + entry = (struct directory_entry *)(buffer + size); + entry->name_len = name_len; + entry->type_len = type_name->len; + + size += sizeof(entry); + memcpy( buffer + size, name, name_len ); + size += name_len; + memcpy( buffer + size, type_name->str, type_name->len ); + size += type_name->len; + if (size & 3) + { + memset( buffer + size, 0, 4 - (size & 3) ); + size += 4 - (size & 3); } - else set_error( STATUS_BUFFER_TOO_SMALL );
release_object( obj ); } diff --git a/server/object.c b/server/object.c index 907bc087444..84c8e70e6a2 100644 --- a/server/object.c +++ b/server/object.c @@ -485,7 +485,6 @@ struct object *find_object_index( const struct namespace *namespace, unsigned in if (!index--) return grab_object( ptr->obj ); } } - set_error( STATUS_NO_MORE_ENTRIES ); return NULL; }
diff --git a/server/protocol.def b/server/protocol.def index d9bed6855e9..7381c26645f 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -847,6 +847,14 @@ typedef struct lparam_t info; } cursor_pos_t;
+struct directory_entry +{ + data_size_t name_len; + data_size_t type_len; + /* VARARG(name,unicode_str,name_len); */ + /* VARARG(type,unicode_str,type_len); */ +}; + /****************************************************************/ /* Request declarations */
@@ -3270,14 +3278,16 @@ struct handle_info @END
-/* Get a directory entry by index */ -@REQ(get_directory_entry) +/* Get directory entries */ +@REQ(get_directory_entries) obj_handle_t handle; /* handle to the directory */ - unsigned int index; /* entry index */ + unsigned int index; /* index of first entry */ + unsigned int max_count; /* maximum number of entries to return */ @REPLY - data_size_t name_len; /* length of the entry name in bytes */ - VARARG(name,unicode_str,name_len); /* entry name */ - VARARG(type,unicode_str); /* entry type */ + unsigned int count; /* number of entries returned */ + unsigned int total_count; /* total number of entries starting at index */ + data_size_t total_len; /* total length of all strings starting at index */ + VARARG(entries,directory_entries); @END
diff --git a/server/trace.c b/server/trace.c index a792b74dc05..4464d3d0450 100644 --- a/server/trace.c +++ b/server/trace.c @@ -1349,6 +1349,40 @@ static void dump_varargs_handle_infos( const char *prefix, data_size_t size ) fputc( '}', stderr ); }
+static void dump_varargs_directory_entries( const char *prefix, data_size_t size ) +{ + fprintf( stderr, "%s{", prefix ); + while (size) + { + const struct directory_entry *entry = cur_data; + data_size_t entry_size; + const char *next; + + if (size < sizeof(*entry) || + (size - sizeof(*entry) < entry->name_len) || + (size - sizeof(*entry) - entry->name_len < entry->type_len)) + { + fprintf( stderr, "***invalid***}" ); + remove_data( size ); + return; + } + + next = (const char *)(entry + 1); + fprintf( stderr, "{name=L"" ); + dump_strW( (const WCHAR *)next, entry->name_len, stderr, """" ); + next += entry->name_len; + fprintf( stderr, "",type=L"" ); + dump_strW( (const WCHAR *)next, entry->type_len, stderr, """" ); + fprintf( stderr, ""}" ); + + entry_size = min( size, (sizeof(*entry) + entry->name_len + entry->type_len + 3) & ~3 ); + size -= entry_size; + remove_data( entry_size ); + if (size) fputc( ',', stderr ); + } + fputc( '}', stderr ); +} + typedef void (*dump_func)( const void *req );
/* Everything below this line is generated automatically by tools/make_requests */
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=111917
Your paranoid android.
=== debian11 (32 bit report) ===
ntdll: om.c:2533: Test succeeded inside todo block: got size 0 om.c:2547: Test failed: got 0xc0000023 om.c:2553: Test failed: got 0xc0000023 om.c:2554: Test failed: got context 0xdeadbeef Unhandled exception: page fault on read access to 0xcccccccc in 32-bit code (0x6a2e8e7a).
=== debian11 (32 bit Chinese:China report) ===
ntdll: om.c:2533: Test succeeded inside todo block: got size 0 om.c:2547: Test failed: got 0xc0000023 om.c:2553: Test failed: got 0xc0000023 om.c:2554: Test failed: got context 0xdeadbeef Unhandled exception: page fault on read access to 0xcccccccc in 32-bit code (0x6a2e8e7a).
=== debian11 (32 bit WoW report) ===
ntdll: om.c:2533: Test succeeded inside todo block: got size 0 om.c:2578: Test succeeded inside todo block: got size 0 om.c:2595: Test succeeded inside todo block: expected size 60, got 60 om.c:2601: Test succeeded inside todo block: expected size 60, got 60 om.c:2618: Test succeeded inside todo block: got 0 om.c:2634: Test succeeded inside todo block: got 0x105 om.c:2646: Test succeeded inside todo block: got 0xc0000023 om.c:2647: Test succeeded inside todo block: got context 0xdeadbeef om.c:2648: Test succeeded inside todo block: expected size 106, got 106 om.c:2655: Test succeeded inside todo block: got 0
=== debian11 (64 bit WoW report) ===
ntdll: om.c:2533: Test succeeded inside todo block: got size 0 om.c:2578: Test succeeded inside todo block: got size 0 om.c:2595: Test succeeded inside todo block: expected size 92, got 92 om.c:2601: Test succeeded inside todo block: expected size 92, got 92 om.c:2618: Test succeeded inside todo block: got 0 om.c:2634: Test succeeded inside todo block: got 0x105 om.c:2646: Test succeeded inside todo block: got 0xc0000023 om.c:2647: Test succeeded inside todo block: got context 0xdeadbeef om.c:2648: Test succeeded inside todo block: expected size 154, got 154 om.c:2655: Test succeeded inside todo block: got 0
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=111912
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2572: Test failed: got string L"Oileus" om.c:2572: Test failed: got length 12 om.c:2572: Test failed: got max length 14 om.c:2581: Test failed: got size 16 om.c:2587: Test failed: got string L"Telamon" om.c:2587: Test failed: got length 14 om.c:2587: Test failed: got max length 16 om.c:2605: Test failed: got length 0 om.c:2615: Test failed: got string L"Telamon" om.c:2615: Test failed: got length 14 om.c:2615: Test failed: got max length 16 om.c:2625: Test failed: got string L"Telamon" om.c:2625: Test failed: got length 14 om.c:2625: Test failed: got max length 16 om.c:2627: Test failed: got string L"Oileus" om.c:2627: Test failed: got length 12 om.c:2627: Test failed: got max length 14 om.c:2642: Test failed: got string L"Telamon" om.c:2642: Test failed: got length 14 om.c:2642: Test failed: got max length 16 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 106, got 16 om.c:2652: Test failed: got length 0 om.c:2662: Test failed: got string L"Oileus" om.c:2662: Test failed: got length 12 om.c:2662: Test failed: got max length 14
=== w7u_adm (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2572: Test failed: got string L"Oileus" om.c:2572: Test failed: got length 12 om.c:2572: Test failed: got max length 14 om.c:2581: Test failed: got size 16 om.c:2587: Test failed: got string L"Telamon" om.c:2587: Test failed: got length 14 om.c:2587: Test failed: got max length 16 om.c:2605: Test failed: got length 0 om.c:2615: Test failed: got string L"Telamon" om.c:2615: Test failed: got length 14 om.c:2615: Test failed: got max length 16 om.c:2625: Test failed: got string L"Telamon" om.c:2625: Test failed: got length 14 om.c:2625: Test failed: got max length 16 om.c:2627: Test failed: got string L"Oileus" om.c:2627: Test failed: got length 12 om.c:2627: Test failed: got max length 14 om.c:2642: Test failed: got string L"Telamon" om.c:2642: Test failed: got length 14 om.c:2642: Test failed: got max length 16 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 106, got 16 om.c:2652: Test failed: got length 0 om.c:2662: Test failed: got string L"Oileus" om.c:2662: Test failed: got length 12 om.c:2662: Test failed: got max length 14
=== w7u_el (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2572: Test failed: got string L"Oileus" om.c:2572: Test failed: got length 12 om.c:2572: Test failed: got max length 14 om.c:2581: Test failed: got size 16 om.c:2587: Test failed: got string L"Telamon" om.c:2587: Test failed: got length 14 om.c:2587: Test failed: got max length 16 om.c:2605: Test failed: got length 0 om.c:2615: Test failed: got string L"Telamon" om.c:2615: Test failed: got length 14 om.c:2615: Test failed: got max length 16 om.c:2625: Test failed: got string L"Telamon" om.c:2625: Test failed: got length 14 om.c:2625: Test failed: got max length 16 om.c:2627: Test failed: got string L"Oileus" om.c:2627: Test failed: got length 12 om.c:2627: Test failed: got max length 14 om.c:2642: Test failed: got string L"Telamon" om.c:2642: Test failed: got length 14 om.c:2642: Test failed: got max length 16 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 106, got 16 om.c:2652: Test failed: got length 0 om.c:2662: Test failed: got string L"Oileus" om.c:2662: Test failed: got length 12 om.c:2662: Test failed: got max length 14
=== w8 (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2572: Test failed: got string L"Oileus" om.c:2572: Test failed: got length 12 om.c:2572: Test failed: got max length 14 om.c:2581: Test failed: got size 16 om.c:2587: Test failed: got string L"Telamon" om.c:2587: Test failed: got length 14 om.c:2587: Test failed: got max length 16 om.c:2605: Test failed: got length 0 om.c:2615: Test failed: got string L"Telamon" om.c:2615: Test failed: got length 14 om.c:2615: Test failed: got max length 16 om.c:2625: Test failed: got string L"Telamon" om.c:2625: Test failed: got length 14 om.c:2625: Test failed: got max length 16 om.c:2627: Test failed: got string L"Oileus" om.c:2627: Test failed: got length 12 om.c:2627: Test failed: got max length 14 om.c:2642: Test failed: got string L"Telamon" om.c:2642: Test failed: got length 14 om.c:2642: Test failed: got max length 16 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 106, got 16 om.c:2652: Test failed: got length 0 om.c:2662: Test failed: got string L"Oileus" om.c:2662: Test failed: got length 12 om.c:2662: Test failed: got max length 14
=== w8adm (32 bit report) ===
ntdll: om.c:2533: Test failed: got size 16 om.c:2556: Test failed: got string L"Telamon" om.c:2556: Test failed: got length 14 om.c:2556: Test failed: got max length 16 om.c:2572: Test failed: got string L"Oileus" om.c:2572: Test failed: got length 12 om.c:2572: Test failed: got max length 14 om.c:2581: Test failed: got size 16 om.c:2587: Test failed: got string L"Telamon" om.c:2587: Test failed: got length 14 om.c:2587: Test failed: got max length 16 om.c:2605: Test failed: got length 0 om.c:2615: Test failed: got string L"Telamon" om.c:2615: Test failed: got length 14 om.c:2615: Test failed: got max length 16 om.c:2625: Test failed: got string L"Telamon" om.c:2625: Test failed: got length 14 om.c:2625: Test failed: got max length 16 om.c:2627: Test failed: got string L"Oileus" om.c:2627: Test failed: got length 12 om.c:2627: Test failed: got max length 14 om.c:2642: Test failed: got string L"Telamon" om.c:2642: Test failed: got length 14 om.c:2642: Test failed: got max length 16 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 106, got 16 om.c:2652: Test failed: got length 0 om.c:2662: Test failed: got string L"Oileus" om.c:2662: Test failed: got length 12 om.c:2662: Test failed: got max length 14
=== w864 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w1064v1507 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w1064v1809 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w1064 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w1064_2qxl (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w1064_tsign (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w10pro64 (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w10pro64_ar (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w10pro64_he (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w10pro64_ja (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0
=== w10pro64_zh_CN (64 bit report) ===
ntdll: om.c:2533: Test failed: got size 32 om.c:2581: Test failed: got size 32 om.c:2605: Test failed: got length 0 om.c:2649: Test failed: got 0x105 om.c:2650: Test failed: got context 0 om.c:2651: Test failed: expected size 154, got 32 om.c:2652: Test failed: got length 0