Commit 4d646de9 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Add generic mapping masks for all object types.

parent e0302343
......@@ -6618,6 +6618,11 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
p->HighWaterNumberOfObjects = info->obj_max;
p->HighWaterNumberOfHandles = info->handle_max;
p->TypeIndex = info->index + 2;
p->GenericMapping.GenericRead = info->mapping.read;
p->GenericMapping.GenericWrite = info->mapping.write;
p->GenericMapping.GenericExecute = info->mapping.exec;
p->GenericMapping.GenericAll = info->mapping.all;
p->ValidAccessMask = info->valid_access;
memcpy( p->TypeName.Buffer, info + 1, info->name_len );
p->TypeName.Buffer[info->name_len / sizeof(WCHAR)] = 0;
if (used_len) *used_len = sizeof(*p) + p->TypeName.MaximumLength;
......
......@@ -407,6 +407,8 @@ struct object_type_info
unsigned int handle_count;
unsigned int obj_max;
unsigned int handle_max;
unsigned int valid_access;
generic_map_t mapping;
};
......@@ -6243,7 +6245,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 666
#define SERVER_PROTOCOL_VERSION 667
/* ### protocol_version end ### */
......
......@@ -48,6 +48,13 @@ static const WCHAR completion_name[] = {'I','o','C','o','m','p','l','e','t','i',
struct type_descr completion_type =
{
{ completion_name, sizeof(completion_name) }, /* name */
IO_COMPLETION_ALL_ACCESS, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | IO_COMPLETION_QUERY_STATE,
STANDARD_RIGHTS_WRITE | IO_COMPLETION_MODIFY_STATE,
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
IO_COMPLETION_ALL_ACCESS
},
};
struct completion
......
......@@ -57,6 +57,13 @@ static const WCHAR debug_obj_name[] = {'D','e','b','u','g','O','b','j','e','c','
struct type_descr debug_obj_type =
{
{ debug_obj_name, sizeof(debug_obj_name) }, /* name */
DEBUG_ALL_ACCESS | SYNCHRONIZE, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | DEBUG_READ_EVENT,
STANDARD_RIGHTS_WRITE | DEBUG_PROCESS_ASSIGN,
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
DEBUG_ALL_ACCESS
},
};
/* debug object */
......
......@@ -132,6 +132,13 @@ static const WCHAR device_name[] = {'D','e','v','i','c','e'};
struct type_descr device_type =
{
{ device_name, sizeof(device_name) }, /* name */
FILE_ALL_ACCESS, /* valid_access */
{ /* mapping */
FILE_GENERIC_READ,
FILE_GENERIC_WRITE,
FILE_GENERIC_EXECUTE,
FILE_ALL_ACCESS
},
};
struct device
......
......@@ -45,7 +45,14 @@ static const WCHAR objtype_name[] = {'T','y','p','e'};
struct type_descr objtype_type =
{
{ objtype_name, sizeof(objtype_name) }, /* name */
{ objtype_name, sizeof(objtype_name) }, /* name */
STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ,
STANDARD_RIGHTS_WRITE,
STANDARD_RIGHTS_EXECUTE,
STANDARD_RIGHTS_REQUIRED | 0x1
},
};
struct object_type
......@@ -85,6 +92,13 @@ static const WCHAR directory_name[] = {'D','i','r','e','c','t','o','r','y'};
struct type_descr directory_type =
{
{ directory_name, sizeof(directory_name) }, /* name */
DIRECTORY_ALL_ACCESS, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | DIRECTORY_TRAVERSE | DIRECTORY_QUERY,
STANDARD_RIGHTS_WRITE | DIRECTORY_CREATE_SUBDIRECTORY | DIRECTORY_CREATE_OBJECT,
STANDARD_RIGHTS_EXECUTE | DIRECTORY_TRAVERSE | DIRECTORY_QUERY,
DIRECTORY_ALL_ACCESS
},
};
struct directory
......@@ -568,6 +582,8 @@ DECL_HANDLER(get_object_type)
info->handle_count = type->handle_count;
info->obj_max = type->obj_max;
info->handle_max = type->handle_max;
info->valid_access = type->valid_access;
info->mapping = type->mapping;
memcpy( info + 1, type->name.str, type->name.len );
}
}
......
......@@ -41,6 +41,13 @@ static const WCHAR event_name[] = {'E','v','e','n','t'};
struct type_descr event_type =
{
{ event_name, sizeof(event_name) }, /* name */
EVENT_ALL_ACCESS, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | EVENT_QUERY_STATE,
STANDARD_RIGHTS_WRITE | EVENT_MODIFY_STATE,
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
EVENT_ALL_ACCESS
},
};
struct event
......@@ -88,6 +95,13 @@ static const WCHAR keyed_event_name[] = {'K','e','y','e','d','E','v','e','n','t'
struct type_descr keyed_event_type =
{
{ keyed_event_name, sizeof(keyed_event_name) }, /* name */
KEYEDEVENT_ALL_ACCESS | SYNCHRONIZE, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | KEYEDEVENT_WAIT,
STANDARD_RIGHTS_WRITE | KEYEDEVENT_WAKE,
STANDARD_RIGHTS_EXECUTE,
KEYEDEVENT_ALL_ACCESS
},
};
struct keyed_event
......
......@@ -57,6 +57,13 @@ static const WCHAR file_name[] = {'F','i','l','e'};
struct type_descr file_type =
{
{ file_name, sizeof(file_name) }, /* name */
FILE_ALL_ACCESS, /* valid_access */
{ /* mapping */
FILE_GENERIC_READ,
FILE_GENERIC_WRITE,
FILE_GENERIC_EXECUTE,
FILE_ALL_ACCESS
},
};
struct file
......
......@@ -142,6 +142,13 @@ static const WCHAR mapping_name[] = {'S','e','c','t','i','o','n'};
struct type_descr mapping_type =
{
{ mapping_name, sizeof(mapping_name) }, /* name */
SECTION_ALL_ACCESS | SYNCHRONIZE, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | SECTION_QUERY | SECTION_MAP_READ,
STANDARD_RIGHTS_WRITE | SECTION_MAP_WRITE,
STANDARD_RIGHTS_EXECUTE | SECTION_MAP_EXECUTE,
SECTION_ALL_ACCESS
},
};
struct mapping
......
......@@ -41,6 +41,13 @@ static const WCHAR mutex_name[] = {'M','u','t','a','n','t'};
struct type_descr mutex_type =
{
{ mutex_name, sizeof(mutex_name) }, /* name */
MUTANT_ALL_ACCESS, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | MUTANT_QUERY_STATE,
STANDARD_RIGHTS_WRITE,
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
MUTANT_ALL_ACCESS
},
};
struct mutex
......
......@@ -50,7 +50,17 @@ struct namespace
};
struct type_descr no_type = {{ 0 }};
struct type_descr no_type =
{
{ NULL, 0 }, /* name */
STANDARD_RIGHTS_REQUIRED, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ,
STANDARD_RIGHTS_WRITE,
STANDARD_RIGHTS_EXECUTE,
STANDARD_RIGHTS_REQUIRED
},
};
#ifdef DEBUG_OBJECTS
static struct list object_list = LIST_INIT(object_list);
......
......@@ -57,6 +57,8 @@ struct unicode_str
struct type_descr
{
struct unicode_str name; /* type name */
unsigned int valid_access; /* mask for valid access bits */
generic_map_t mapping; /* generic access mapping */
unsigned int index; /* index in global array of types */
unsigned int obj_count; /* count of objects of this type */
unsigned int handle_count; /* count of handles of this type */
......
......@@ -63,6 +63,15 @@ static const WCHAR process_name[] = {'P','r','o','c','e','s','s'};
struct type_descr process_type =
{
{ process_name, sizeof(process_name) }, /* name */
PROCESS_ALL_ACCESS, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | PROCESS_VM_READ | PROCESS_QUERY_INFORMATION,
STANDARD_RIGHTS_WRITE | PROCESS_SUSPEND_RESUME | PROCESS_SET_INFORMATION | PROCESS_SET_QUOTA
| PROCESS_CREATE_PROCESS | PROCESS_DUP_HANDLE | PROCESS_VM_WRITE | PROCESS_VM_OPERATION
| PROCESS_CREATE_THREAD,
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE | PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_TERMINATE,
PROCESS_ALL_ACCESS
},
};
static void process_dump( struct object *obj, int verbose );
......@@ -156,6 +165,13 @@ static const WCHAR job_name[] = {'J','o','b'};
struct type_descr job_type =
{
{ job_name, sizeof(job_name) }, /* name */
JOB_OBJECT_ALL_ACCESS, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | JOB_OBJECT_QUERY,
STANDARD_RIGHTS_WRITE | JOB_OBJECT_TERMINATE | JOB_OBJECT_SET_ATTRIBUTES | JOB_OBJECT_ASSIGN_PROCESS,
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
JOB_OBJECT_ALL_ACCESS
},
};
static void job_dump( struct object *obj, int verbose );
......
......@@ -423,6 +423,8 @@ struct object_type_info
unsigned int handle_count; /* count of handles of this type */
unsigned int obj_max; /* max count of objects of this type */
unsigned int handle_max; /* max count of handles of this type */
unsigned int valid_access; /* mask for valid access bits */
generic_map_t mapping; /* generic access mappings */
/* VARARG(name,unicode_str); */
};
......
......@@ -65,6 +65,13 @@ static const WCHAR key_name[] = {'K','e','y'};
struct type_descr key_type =
{
{ key_name, sizeof(key_name) }, /* name */
KEY_ALL_ACCESS | SYNCHRONIZE, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | KEY_NOTIFY | KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE,
STANDARD_RIGHTS_WRITE | KEY_CREATE_SUB_KEY | KEY_SET_VALUE,
STANDARD_RIGHTS_EXECUTE | KEY_CREATE_LINK | KEY_NOTIFY | KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE,
KEY_ALL_ACCESS
},
};
/* a registry key */
......
......@@ -41,6 +41,13 @@ static const WCHAR semaphore_name[] = {'S','e','m','a','p','h','o','r','e'};
struct type_descr semaphore_type =
{
{ semaphore_name, sizeof(semaphore_name) }, /* name */
SEMAPHORE_ALL_ACCESS, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | SEMAPHORE_QUERY_STATE,
STANDARD_RIGHTS_WRITE | SEMAPHORE_MODIFY_STATE,
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
SEMAPHORE_ALL_ACCESS
},
};
struct semaphore
......
......@@ -43,6 +43,13 @@ static const WCHAR symlink_name[] = {'S','y','m','b','o','l','i','c','L','i','n'
struct type_descr symlink_type =
{
{ symlink_name, sizeof(symlink_name) }, /* name */
SYMBOLIC_LINK_ALL_ACCESS, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | SYMBOLIC_LINK_QUERY,
STANDARD_RIGHTS_WRITE,
STANDARD_RIGHTS_EXECUTE | SYMBOLIC_LINK_QUERY,
SYMBOLIC_LINK_ALL_ACCESS
},
};
struct symlink
......
......@@ -171,6 +171,14 @@ static const WCHAR thread_name[] = {'T','h','r','e','a','d'};
struct type_descr thread_type =
{
{ thread_name, sizeof(thread_name) }, /* name */
THREAD_ALL_ACCESS, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | THREAD_QUERY_INFORMATION | THREAD_GET_CONTEXT,
STANDARD_RIGHTS_WRITE | THREAD_SET_LIMITED_INFORMATION | THREAD_SET_INFORMATION
| THREAD_SET_CONTEXT | THREAD_SUSPEND_RESUME | THREAD_TERMINATE | 0x04,
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE | THREAD_RESUME | THREAD_QUERY_LIMITED_INFORMATION,
THREAD_ALL_ACCESS
},
};
static void dump_thread( struct object *obj, int verbose );
......
......@@ -42,6 +42,13 @@ static const WCHAR timer_name[] = {'T','i','m','e','r'};
struct type_descr timer_type =
{
{ timer_name, sizeof(timer_name) }, /* name */
TIMER_ALL_ACCESS, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | TIMER_QUERY_STATE,
STANDARD_RIGHTS_WRITE | TIMER_MODIFY_STATE,
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
TIMER_ALL_ACCESS
},
};
struct timer
......
......@@ -102,6 +102,14 @@ static const WCHAR token_name[] = {'T','o','k','e','n'};
struct type_descr token_type =
{
{ token_name, sizeof(token_name) }, /* name */
TOKEN_ALL_ACCESS | SYNCHRONIZE, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | TOKEN_QUERY_SOURCE | TOKEN_QUERY | TOKEN_DUPLICATE,
STANDARD_RIGHTS_WRITE | TOKEN_ADJUST_SESSIONID | TOKEN_ADJUST_DEFAULT | TOKEN_ADJUST_GROUPS
| TOKEN_ADJUST_PRIVILEGES,
STANDARD_RIGHTS_EXECUTE | TOKEN_IMPERSONATE | TOKEN_ASSIGN_PRIMARY,
TOKEN_ALL_ACCESS
},
};
struct token
......
......@@ -1228,8 +1228,11 @@ static void dump_varargs_object_type_info( const char *prefix, data_size_t size
return;
}
fprintf( stderr, "index=%u,obj_count=%u,handle_count=%u,obj_max=%u,handle_max=%u,name=L\"",
info->index,info->obj_count, info->handle_count, info->obj_max, info->handle_max );
fprintf( stderr, "index=%u,obj_count=%u,handle_count=%u,obj_max=%u,handle_max=%u,valid=%08x",
info->index,info->obj_count, info->handle_count, info->obj_max, info->handle_max,
info->valid_access );
dump_generic_map( ",access=", &info->mapping );
fprintf( stderr, ",name=L\"" );
dump_strW( (const WCHAR *)(info + 1), info->name_len, stderr, "\"\"" );
fputc( '\"', stderr );
remove_data( min( size, sizeof(*info) + ((info->name_len + 2) & ~3 )));
......
......@@ -39,6 +39,7 @@
#include "file.h"
#include "security.h"
#define DESKTOP_ALL_ACCESS 0x01ff
static struct list winstation_list = LIST_INIT(winstation_list);
......@@ -59,6 +60,13 @@ static const WCHAR winstation_name[] = {'W','i','n','d','o','w','S','t','a','t',
struct type_descr winstation_type =
{
{ winstation_name, sizeof(winstation_name) }, /* name */
STANDARD_RIGHTS_REQUIRED | WINSTA_ALL_ACCESS, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | WINSTA_READSCREEN | WINSTA_ENUMERATE | WINSTA_READATTRIBUTES | WINSTA_ENUMDESKTOPS,
STANDARD_RIGHTS_WRITE | WINSTA_WRITEATTRIBUTES | WINSTA_CREATEDESKTOP | WINSTA_ACCESSCLIPBOARD,
STANDARD_RIGHTS_EXECUTE | WINSTA_EXITWINDOWS | WINSTA_ACCESSGLOBALATOMS,
STANDARD_RIGHTS_REQUIRED | WINSTA_ALL_ACCESS
},
};
static const struct object_ops winstation_ops =
......@@ -91,6 +99,14 @@ static const WCHAR desktop_name[] = {'D','e','s','k','t','o','p'};
struct type_descr desktop_type =
{
{ desktop_name, sizeof(desktop_name) }, /* name */
STANDARD_RIGHTS_REQUIRED | DESKTOP_ALL_ACCESS, /* valid_access */
{ /* mapping */
STANDARD_RIGHTS_READ | DESKTOP_ENUMERATE | DESKTOP_READOBJECTS,
STANDARD_RIGHTS_WRITE | DESKTOP_WRITEOBJECTS | DESKTOP_JOURNALPLAYBACK | DESKTOP_JOURNALRECORD
| DESKTOP_HOOKCONTROL | DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW,
STANDARD_RIGHTS_EXECUTE | DESKTOP_SWITCHDESKTOP,
STANDARD_RIGHTS_REQUIRED | DESKTOP_ALL_ACCESS
},
};
static const struct object_ops desktop_ops =
......@@ -117,8 +133,6 @@ static const struct object_ops desktop_ops =
desktop_destroy /* destroy */
};
#define DESKTOP_ALL_ACCESS 0x01ff
/* create a winstation object */
static struct winstation *create_winstation( struct object *root, const struct unicode_str *name,
unsigned int attr, unsigned int flags )
......
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