Commit 749f8c25 authored by Gijs Vermeulen's avatar Gijs Vermeulen Committed by Alexandre Julliard

ntdll: Return STATUS_INFO_LENGTH_MISMATCH when len is too small in…

ntdll: Return STATUS_INFO_LENGTH_MISMATCH when len is too small in NtQueryObject(ObjectBasicInformation). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50791Signed-off-by: 's avatarGijs Vermeulen <gijsvrm@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 250072f9
......@@ -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,20 @@ static void test_query_object(void)
handle = CreateEventA( NULL, FALSE, FALSE, "test_event" );
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 );
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 );
......
......@@ -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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment