Replace inherit flag with object attributes in winstation and desktop

create & open. Use OBJ_OPENIF flag to create winstation & desktop.
This commit is contained in:
Vitaliy Margolen 2005-11-21 12:05:38 +00:00 committed by Alexandre Julliard
parent 6f92870a80
commit 83ef91ce2d
5 changed files with 43 additions and 40 deletions

View file

@ -86,9 +86,10 @@ HWINSTA WINAPI CreateWindowStationW( LPCWSTR name, DWORD reserved, ACCESS_MASK a
} }
SERVER_START_REQ( create_winstation ) SERVER_START_REQ( create_winstation )
{ {
req->flags = 0; req->flags = 0;
req->access = access; req->access = access;
req->inherit = (sa && sa->bInheritHandle); req->attributes = OBJ_CASE_INSENSITIVE | OBJ_OPENIF |
((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0);
wine_server_add_data( req, name, len * sizeof(WCHAR) ); wine_server_add_data( req, name, len * sizeof(WCHAR) );
/* it doesn't seem to set last error */ /* it doesn't seem to set last error */
wine_server_call( req ); wine_server_call( req );
@ -131,8 +132,8 @@ HWINSTA WINAPI OpenWindowStationW( LPCWSTR name, BOOL inherit, ACCESS_MASK acces
} }
SERVER_START_REQ( open_winstation ) SERVER_START_REQ( open_winstation )
{ {
req->access = access; req->access = access;
req->inherit = inherit; req->attributes = OBJ_CASE_INSENSITIVE | (inherit ? OBJ_INHERIT : 0);
wine_server_add_data( req, name, len * sizeof(WCHAR) ); wine_server_add_data( req, name, len * sizeof(WCHAR) );
if (!wine_server_call_err( req )) ret = reply->handle; if (!wine_server_call_err( req )) ret = reply->handle;
} }
@ -258,9 +259,10 @@ HDESK WINAPI CreateDesktopW( LPCWSTR name, LPCWSTR device, LPDEVMODEW devmode,
} }
SERVER_START_REQ( create_desktop ) SERVER_START_REQ( create_desktop )
{ {
req->flags = flags; req->flags = flags;
req->access = access; req->access = access;
req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle); req->attributes = OBJ_CASE_INSENSITIVE | OBJ_OPENIF |
((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0);
wine_server_add_data( req, name, len * sizeof(WCHAR) ); wine_server_add_data( req, name, len * sizeof(WCHAR) );
/* it doesn't seem to set last error */ /* it doesn't seem to set last error */
wine_server_call( req ); wine_server_call( req );
@ -303,9 +305,9 @@ HDESK WINAPI OpenDesktopW( LPCWSTR name, DWORD flags, BOOL inherit, ACCESS_MASK
} }
SERVER_START_REQ( open_desktop ) SERVER_START_REQ( open_desktop )
{ {
req->flags = flags; req->flags = flags;
req->access = access; req->access = access;
req->inherit = inherit; req->attributes = OBJ_CASE_INSENSITIVE | (inherit ? OBJ_INHERIT : 0);
wine_server_add_data( req, name, len * sizeof(WCHAR) ); wine_server_add_data( req, name, len * sizeof(WCHAR) );
if (!wine_server_call( req )) ret = reply->handle; if (!wine_server_call( req )) ret = reply->handle;
} }

View file

@ -2889,7 +2889,7 @@ struct create_winstation_request
struct request_header __header; struct request_header __header;
unsigned int flags; unsigned int flags;
unsigned int access; unsigned int access;
int inherit; unsigned int attributes;
/* VARARG(name,unicode_str); */ /* VARARG(name,unicode_str); */
}; };
struct create_winstation_reply struct create_winstation_reply
@ -2904,7 +2904,7 @@ struct open_winstation_request
{ {
struct request_header __header; struct request_header __header;
unsigned int access; unsigned int access;
int inherit; unsigned int attributes;
/* VARARG(name,unicode_str); */ /* VARARG(name,unicode_str); */
}; };
struct open_winstation_reply struct open_winstation_reply
@ -2956,7 +2956,7 @@ struct create_desktop_request
struct request_header __header; struct request_header __header;
unsigned int flags; unsigned int flags;
unsigned int access; unsigned int access;
int inherit; unsigned int attributes;
/* VARARG(name,unicode_str); */ /* VARARG(name,unicode_str); */
}; };
struct create_desktop_reply struct create_desktop_reply
@ -2972,7 +2972,7 @@ struct open_desktop_request
struct request_header __header; struct request_header __header;
unsigned int flags; unsigned int flags;
unsigned int access; unsigned int access;
int inherit; unsigned int attributes;
/* VARARG(name,unicode_str); */ /* VARARG(name,unicode_str); */
}; };
struct open_desktop_reply struct open_desktop_reply
@ -4208,6 +4208,6 @@ union generic_reply
struct set_mailslot_info_reply set_mailslot_info_reply; struct set_mailslot_info_reply set_mailslot_info_reply;
}; };
#define SERVER_PROTOCOL_VERSION 197 #define SERVER_PROTOCOL_VERSION 198
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View file

@ -2035,7 +2035,7 @@ enum message_type
@REQ(create_winstation) @REQ(create_winstation)
unsigned int flags; /* window station flags */ unsigned int flags; /* window station flags */
unsigned int access; /* wanted access rights */ unsigned int access; /* wanted access rights */
int inherit; /* inherit flag */ unsigned int attributes; /* object attributes */
VARARG(name,unicode_str); /* object name */ VARARG(name,unicode_str); /* object name */
@REPLY @REPLY
obj_handle_t handle; /* handle to the window station */ obj_handle_t handle; /* handle to the window station */
@ -2045,7 +2045,7 @@ enum message_type
/* Open a handle to a window station */ /* Open a handle to a window station */
@REQ(open_winstation) @REQ(open_winstation)
unsigned int access; /* wanted access rights */ unsigned int access; /* wanted access rights */
int inherit; /* inherit flag */ unsigned int attributes; /* object attributes */
VARARG(name,unicode_str); /* object name */ VARARG(name,unicode_str); /* object name */
@REPLY @REPLY
obj_handle_t handle; /* handle to the window station */ obj_handle_t handle; /* handle to the window station */
@ -2075,7 +2075,7 @@ enum message_type
@REQ(create_desktop) @REQ(create_desktop)
unsigned int flags; /* desktop flags */ unsigned int flags; /* desktop flags */
unsigned int access; /* wanted access rights */ unsigned int access; /* wanted access rights */
int inherit; /* inherit flag */ unsigned int attributes; /* object attributes */
VARARG(name,unicode_str); /* object name */ VARARG(name,unicode_str); /* object name */
@REPLY @REPLY
obj_handle_t handle; /* handle to the desktop */ obj_handle_t handle; /* handle to the desktop */
@ -2086,7 +2086,7 @@ enum message_type
@REQ(open_desktop) @REQ(open_desktop)
unsigned int flags; /* desktop flags */ unsigned int flags; /* desktop flags */
unsigned int access; /* wanted access rights */ unsigned int access; /* wanted access rights */
int inherit; /* inherit flag */ unsigned int attributes; /* object attributes */
VARARG(name,unicode_str); /* object name */ VARARG(name,unicode_str); /* object name */
@REPLY @REPLY
obj_handle_t handle; /* handle to the desktop */ obj_handle_t handle; /* handle to the desktop */

View file

@ -2546,7 +2546,7 @@ static void dump_create_winstation_request( const struct create_winstation_reque
{ {
fprintf( stderr, " flags=%08x,", req->flags ); fprintf( stderr, " flags=%08x,", req->flags );
fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d,", req->inherit ); fprintf( stderr, " attributes=%08x,", req->attributes );
fprintf( stderr, " name=" ); fprintf( stderr, " name=" );
dump_varargs_unicode_str( cur_size ); dump_varargs_unicode_str( cur_size );
} }
@ -2559,7 +2559,7 @@ static void dump_create_winstation_reply( const struct create_winstation_reply *
static void dump_open_winstation_request( const struct open_winstation_request *req ) static void dump_open_winstation_request( const struct open_winstation_request *req )
{ {
fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d,", req->inherit ); fprintf( stderr, " attributes=%08x,", req->attributes );
fprintf( stderr, " name=" ); fprintf( stderr, " name=" );
dump_varargs_unicode_str( cur_size ); dump_varargs_unicode_str( cur_size );
} }
@ -2592,7 +2592,7 @@ static void dump_create_desktop_request( const struct create_desktop_request *re
{ {
fprintf( stderr, " flags=%08x,", req->flags ); fprintf( stderr, " flags=%08x,", req->flags );
fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d,", req->inherit ); fprintf( stderr, " attributes=%08x,", req->attributes );
fprintf( stderr, " name=" ); fprintf( stderr, " name=" );
dump_varargs_unicode_str( cur_size ); dump_varargs_unicode_str( cur_size );
} }
@ -2606,7 +2606,7 @@ static void dump_open_desktop_request( const struct open_desktop_request *req )
{ {
fprintf( stderr, " flags=%08x,", req->flags ); fprintf( stderr, " flags=%08x,", req->flags );
fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d,", req->inherit ); fprintf( stderr, " attributes=%08x,", req->attributes );
fprintf( stderr, " name=" ); fprintf( stderr, " name=" );
dump_varargs_unicode_str( cur_size ); dump_varargs_unicode_str( cur_size );
} }

View file

@ -80,7 +80,8 @@ static const struct object_ops desktop_ops =
#define DESKTOP_ALL_ACCESS 0x01ff #define DESKTOP_ALL_ACCESS 0x01ff
/* create a winstation object */ /* create a winstation object */
static struct winstation *create_winstation( const struct unicode_str *name, unsigned int flags ) static struct winstation *create_winstation( const struct unicode_str *name, unsigned int attr,
unsigned int flags )
{ {
struct winstation *winstation; struct winstation *winstation;
@ -93,8 +94,7 @@ static struct winstation *create_winstation( const struct unicode_str *name, uns
return NULL; return NULL;
} }
if ((winstation = create_named_object( winstation_namespace, &winstation_ops, name, if ((winstation = create_named_object( winstation_namespace, &winstation_ops, name, attr )))
OBJ_CASE_INSENSITIVE )))
{ {
if (get_error() != STATUS_OBJECT_NAME_COLLISION) if (get_error() != STATUS_OBJECT_NAME_COLLISION)
{ {
@ -175,8 +175,8 @@ inline static struct desktop *get_desktop_obj( struct process *process, obj_hand
} }
/* create a desktop object */ /* create a desktop object */
static struct desktop *create_desktop( const struct unicode_str *name, unsigned int flags, static struct desktop *create_desktop( const struct unicode_str *name, unsigned int attr,
struct winstation *winstation ) unsigned int flags, struct winstation *winstation )
{ {
struct desktop *desktop; struct desktop *desktop;
struct unicode_str full_str; struct unicode_str full_str;
@ -184,8 +184,7 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned
if (!(full_name = build_desktop_name( name, winstation, &full_str ))) return NULL; if (!(full_name = build_desktop_name( name, winstation, &full_str ))) return NULL;
if ((desktop = create_named_object( winstation_namespace, &desktop_ops, &full_str, if ((desktop = create_named_object( winstation_namespace, &desktop_ops, &full_str, attr )))
OBJ_CASE_INSENSITIVE )))
{ {
if (get_error() != STATUS_OBJECT_NAME_COLLISION) if (get_error() != STATUS_OBJECT_NAME_COLLISION)
{ {
@ -250,7 +249,7 @@ void connect_process_winstation( struct process *process, const struct unicode_s
if (name) if (name)
{ {
winstation = create_winstation( name, 0 ); winstation = create_winstation( name, OBJ_CASE_INSENSITIVE | OBJ_OPENIF, 0 );
} }
else else
{ {
@ -258,7 +257,7 @@ void connect_process_winstation( struct process *process, const struct unicode_s
{ {
static const WCHAR winsta0W[] = {'W','i','n','S','t','a','0'}; static const WCHAR winsta0W[] = {'W','i','n','S','t','a','0'};
static const struct unicode_str winsta0 = { winsta0W, sizeof(winsta0W) }; static const struct unicode_str winsta0 = { winsta0W, sizeof(winsta0W) };
interactive_winstation = create_winstation( &winsta0, 0 ); interactive_winstation = create_winstation( &winsta0, OBJ_CASE_INSENSITIVE | OBJ_OPENIF, 0 );
winstation = interactive_winstation; winstation = interactive_winstation;
} }
else winstation = (struct winstation *)grab_object( interactive_winstation ); else winstation = (struct winstation *)grab_object( interactive_winstation );
@ -285,7 +284,7 @@ void connect_process_desktop( struct process *process, const struct unicode_str
static const struct unicode_str default_str = { defaultW, sizeof(defaultW) }; static const struct unicode_str default_str = { defaultW, sizeof(defaultW) };
if (!name) name = &default_str; if (!name) name = &default_str;
if ((desktop = create_desktop( name, 0, winstation ))) if ((desktop = create_desktop( name, OBJ_CASE_INSENSITIVE | OBJ_OPENIF, 0, winstation )))
{ {
process->desktop = alloc_handle( process, desktop, DESKTOP_ALL_ACCESS, FALSE ); process->desktop = alloc_handle( process, desktop, DESKTOP_ALL_ACCESS, FALSE );
release_object( desktop ); release_object( desktop );
@ -314,9 +313,10 @@ DECL_HANDLER(create_winstation)
reply->handle = 0; reply->handle = 0;
get_req_unicode_str( &name ); get_req_unicode_str( &name );
if ((winstation = create_winstation( &name, req->flags ))) if ((winstation = create_winstation( &name, req->attributes, req->flags )))
{ {
reply->handle = alloc_handle( current->process, winstation, req->access, req->inherit ); reply->handle = alloc_handle( current->process, winstation, req->access,
req->attributes & OBJ_INHERIT );
release_object( winstation ); release_object( winstation );
} }
} }
@ -329,7 +329,7 @@ DECL_HANDLER(open_winstation)
get_req_unicode_str( &name ); get_req_unicode_str( &name );
if (winstation_namespace) if (winstation_namespace)
reply->handle = open_object( winstation_namespace, &name, &winstation_ops, req->access, reply->handle = open_object( winstation_namespace, &name, &winstation_ops, req->access,
OBJ_CASE_INSENSITIVE | (req->inherit ? OBJ_INHERIT:0) ); req->attributes );
else else
set_error( STATUS_OBJECT_NAME_NOT_FOUND ); set_error( STATUS_OBJECT_NAME_NOT_FOUND );
} }
@ -381,9 +381,10 @@ DECL_HANDLER(create_desktop)
get_req_unicode_str( &name ); get_req_unicode_str( &name );
if ((winstation = get_process_winstation( current->process, WINSTA_CREATEDESKTOP ))) if ((winstation = get_process_winstation( current->process, WINSTA_CREATEDESKTOP )))
{ {
if ((desktop = create_desktop( &name, req->flags, winstation ))) if ((desktop = create_desktop( &name, req->attributes, req->flags, winstation )))
{ {
reply->handle = alloc_handle( current->process, desktop, req->access, req->inherit ); reply->handle = alloc_handle( current->process, desktop, req->access,
req->attributes & OBJ_INHERIT );
release_object( desktop ); release_object( desktop );
} }
release_object( winstation ); release_object( winstation );
@ -405,7 +406,7 @@ DECL_HANDLER(open_desktop)
if ((full_name = build_desktop_name( &name, winstation, &full_str ))) if ((full_name = build_desktop_name( &name, winstation, &full_str )))
{ {
reply->handle = open_object( winstation_namespace, &full_str, &desktop_ops, req->access, reply->handle = open_object( winstation_namespace, &full_str, &desktop_ops, req->access,
OBJ_CASE_INSENSITIVE | (req->inherit ? OBJ_INHERIT:0) ); req->attributes );
free( full_name ); free( full_name );
} }
release_object( winstation ); release_object( winstation );