Commit c55c4ab8 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

server: Support token object type.

parent eea7702e
......@@ -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)
......
......@@ -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;
......
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