diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index 516304eec0d..3110dbf8e41 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -1348,6 +1348,7 @@ static void test_query_object(void) UNICODE_STRING path, session, *str; char dir[MAX_PATH], tmp_path[MAX_PATH], file1[MAX_PATH + 16]; LARGE_INTEGER size; + BOOL ret; sprintf( tmp_path, "\\Sessions\\%u", NtCurrentTeb()->Peb->SessionId ); pRtlCreateUnicodeStringFromAsciiz( &session, tmp_path ); @@ -1566,6 +1567,15 @@ static void test_query_object(void) test_object_type( GetCurrentThread(), "Thread" ); test_no_file_info( GetCurrentThread() ); + + ret = OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &handle); + ok(ret, "OpenProcessToken failed: %u\n", GetLastError()); + + test_object_type( handle, "Token" ); + test_no_file_info( handle ); + + pNtClose(handle); + } static void test_type_mismatch(void) diff --git a/server/token.c b/server/token.c index d88f16c4ce3..e440d489f2d 100644 --- a/server/token.c +++ b/server/token.c @@ -134,6 +134,7 @@ struct group }; static void token_dump( struct object *obj, int verbose ); +static struct object_type *token_get_type( struct object *obj ); static unsigned int token_map_access( struct object *obj, unsigned int access ); static void token_destroy( struct object *obj ); @@ -141,7 +142,7 @@ static const struct object_ops token_ops = { sizeof(struct token), /* size */ token_dump, /* dump */ - no_get_type, /* get_type */ + token_get_type, /* get_type */ no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ @@ -167,6 +168,13 @@ static void token_dump( struct object *obj, int verbose ) token->token_id.low_part, token->primary, token->impersonation_level ); } +static struct object_type *token_get_type( struct object *obj ) +{ + static const WCHAR name[] = {'T','o','k','e','n'}; + static const struct unicode_str str = { name, sizeof(name) }; + return get_object_type( &str ); +} + static unsigned int token_map_access( struct object *obj, unsigned int access ) { if (access & GENERIC_READ) access |= TOKEN_READ;