Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50791 Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/ntdll/tests/om.c | 19 +++++++++++++++++++ dlls/ntdll/unix/file.c | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index e93f11e1126..e6597235aba 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -1379,6 +1379,7 @@ static void test_query_object(void) char buffer[1024]; NTSTATUS status; ULONG len, expected_len; + OBJECT_BASIC_INFORMATION info; OBJECT_ATTRIBUTES attr; UNICODE_STRING path, target, *str; char dir[MAX_PATH], tmp_path[MAX_PATH], file1[MAX_PATH + 16]; @@ -1390,6 +1391,24 @@ static void test_query_object(void)
handle = CreateEventA( NULL, FALSE, FALSE, "test_event" );
+ status = pNtQueryObject( NULL, ObjectBasicInformation, NULL, 0, NULL ); + todo_wine ok( status == STATUS_INVALID_HANDLE, "NtQueryObject failed %x\n", status ); + + status = pNtQueryObject( handle, ObjectBasicInformation, NULL, 0, NULL ); + ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status ); + + status = pNtQueryObject( handle, ObjectBasicInformation, &info, 0, NULL ); + ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status ); + + len = 0; + status = pNtQueryObject( handle, ObjectBasicInformation, NULL, 0, &len ); + ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status ); + + len = 0; + status = pNtQueryObject( handle, ObjectBasicInformation, &info, sizeof(OBJECT_BASIC_INFORMATION), &len ); + ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status ); + ok( len >= sizeof(OBJECT_BASIC_INFORMATION), "unexpected len %u\n", len ); + len = 0; status = pNtQueryObject( handle, ObjectNameInformation, buffer, 0, &len ); ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status ); diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index b4d834b7855..488f7485ad8 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -6734,7 +6734,7 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas { OBJECT_BASIC_INFORMATION *p = ptr;
- if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE; + if (len < sizeof(*p)) return STATUS_INFO_LENGTH_MISMATCH;
SERVER_START_REQ( get_object_info ) {