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 {