Commit 55946e3c authored by Austin Lund's avatar Austin Lund Committed by Alexandre Julliard

ntdll/tests: Added tests for ObjectTypeInformation class in NtQueryObject.

parent 84e9a23d
...@@ -658,6 +658,8 @@ static void test_query_object(void) ...@@ -658,6 +658,8 @@ static void test_query_object(void)
{ {
static const WCHAR name[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s', static const WCHAR name[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s',
'\\','t','e','s','t','_','e','v','e','n','t'}; '\\','t','e','s','t','_','e','v','e','n','t'};
static const WCHAR type_event[] = {'E','v','e','n','t'};
static const WCHAR type_file[] = {'F','i','l','e'};
HANDLE handle; HANDLE handle;
char buffer[1024]; char buffer[1024];
NTSTATUS status; NTSTATUS status;
...@@ -673,11 +675,21 @@ static void test_query_object(void) ...@@ -673,11 +675,21 @@ static void test_query_object(void)
ok( len >= sizeof(UNICODE_STRING) + sizeof(name) + sizeof(WCHAR), "unexpected len %u\n", len ); ok( len >= sizeof(UNICODE_STRING) + sizeof(name) + sizeof(WCHAR), "unexpected len %u\n", len );
len = 0; len = 0;
status = pNtQueryObject( handle, ObjectTypeInformation, buffer, 0, &len );
todo_wine ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
todo_wine ok( len >= sizeof(OBJECT_TYPE_INFORMATION) + sizeof(type_event) + sizeof(WCHAR), "unexpected len %u\n", len );
len = 0;
status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(UNICODE_STRING), &len ); status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(UNICODE_STRING), &len );
ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status ); ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
ok( len >= sizeof(UNICODE_STRING) + sizeof(name) + sizeof(WCHAR), "unexpected len %u\n", len ); ok( len >= sizeof(UNICODE_STRING) + sizeof(name) + sizeof(WCHAR), "unexpected len %u\n", len );
len = 0; len = 0;
status = pNtQueryObject( handle, ObjectTypeInformation, buffer, sizeof(OBJECT_TYPE_INFORMATION), &len );
todo_wine ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
todo_wine ok( len >= sizeof(OBJECT_TYPE_INFORMATION) + sizeof(type_event) + sizeof(WCHAR), "unexpected len %u\n", len );
len = 0;
status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(buffer), &len ); status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(buffer), &len );
ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status ); ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
ok( len > sizeof(UNICODE_STRING), "unexpected len %u\n", len ); ok( len > sizeof(UNICODE_STRING), "unexpected len %u\n", len );
...@@ -693,6 +705,21 @@ static void test_query_object(void) ...@@ -693,6 +705,21 @@ static void test_query_object(void)
ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status ); ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
ok( len >= sizeof(UNICODE_STRING) + sizeof(name) + sizeof(WCHAR), "unexpected len %u\n", len ); ok( len >= sizeof(UNICODE_STRING) + sizeof(name) + sizeof(WCHAR), "unexpected len %u\n", len );
len = 0;
memset( buffer, 0, sizeof(buffer) );
status = pNtQueryObject( handle, ObjectTypeInformation, buffer, sizeof(buffer), &len );
todo_wine ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
todo_wine ok( len > sizeof(OBJECT_TYPE_INFORMATION), "unexpected len %u\n", len );
str = (UNICODE_STRING *)buffer;
todo_wine ok( len >= sizeof(OBJECT_TYPE_INFORMATION) + str->Length + sizeof(WCHAR), "unexpected len %u\n", len );
todo_wine ok( str->Buffer && !memcmp( str->Buffer, type_event, sizeof(type_file) ),
"wrong/bad type name %s (%p)\n", wine_dbgstr_w(str->Buffer), str->Buffer );
len -= sizeof(WCHAR);
status = pNtQueryObject( handle, ObjectTypeInformation, buffer, len, &len );
todo_wine ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
todo_wine ok( len >= sizeof(OBJECT_TYPE_INFORMATION) + sizeof(type_event) + sizeof(WCHAR), "unexpected len %u\n", len );
pNtClose( handle ); pNtClose( handle );
handle = CreateEventA( NULL, FALSE, FALSE, NULL ); handle = CreateEventA( NULL, FALSE, FALSE, NULL );
...@@ -733,6 +760,17 @@ static void test_query_object(void) ...@@ -733,6 +760,17 @@ static void test_query_object(void)
ok( len == expected_len || broken(!len), ok( len == expected_len || broken(!len),
"unexpected len %u\n", len ); "unexpected len %u\n", len );
len = 0;
memset( buffer, 0, sizeof(buffer) );
status = pNtQueryObject( handle, ObjectTypeInformation, buffer, sizeof(buffer), &len );
todo_wine ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
todo_wine ok( len > sizeof(OBJECT_TYPE_INFORMATION), "unexpected len %u\n", len );
str = (UNICODE_STRING *)buffer;
expected_len = sizeof(OBJECT_TYPE_INFORMATION) + str->Length + sizeof(WCHAR);
todo_wine ok( len >= expected_len, "unexpected len %u\n", len );
todo_wine ok( str->Buffer && !memcmp( str->Buffer, type_file, sizeof(type_file) ),
"wrong/bad type name %s (%p)\n", wine_dbgstr_w(str->Buffer), str->Buffer );
pNtClose( handle ); pNtClose( handle );
} }
......
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