From 83ef91ce2d218c782a5b8a3f8808ef98b9cce5f8 Mon Sep 17 00:00:00 2001 From: Vitaliy Margolen Date: Mon, 21 Nov 2005 12:05:38 +0000 Subject: [PATCH] Replace inherit flag with object attributes in winstation and desktop create & open. Use OBJ_OPENIF flag to create winstation & desktop. --- dlls/user/winstation.c | 24 +++++++++++++----------- include/wine/server_protocol.h | 10 +++++----- server/protocol.def | 8 ++++---- server/trace.c | 8 ++++---- server/winstation.c | 33 +++++++++++++++++---------------- 5 files changed, 43 insertions(+), 40 deletions(-) diff --git a/dlls/user/winstation.c b/dlls/user/winstation.c index 9e7214646f9..3ad5918c272 100644 --- a/dlls/user/winstation.c +++ b/dlls/user/winstation.c @@ -86,9 +86,10 @@ HWINSTA WINAPI CreateWindowStationW( LPCWSTR name, DWORD reserved, ACCESS_MASK a } SERVER_START_REQ( create_winstation ) { - req->flags = 0; - req->access = access; - req->inherit = (sa && sa->bInheritHandle); + req->flags = 0; + req->access = access; + req->attributes = OBJ_CASE_INSENSITIVE | OBJ_OPENIF | + ((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0); wine_server_add_data( req, name, len * sizeof(WCHAR) ); /* it doesn't seem to set last error */ wine_server_call( req ); @@ -131,8 +132,8 @@ HWINSTA WINAPI OpenWindowStationW( LPCWSTR name, BOOL inherit, ACCESS_MASK acces } SERVER_START_REQ( open_winstation ) { - req->access = access; - req->inherit = inherit; + req->access = access; + req->attributes = OBJ_CASE_INSENSITIVE | (inherit ? OBJ_INHERIT : 0); wine_server_add_data( req, name, len * sizeof(WCHAR) ); 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 ) { - req->flags = flags; - req->access = access; - req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle); + req->flags = flags; + req->access = access; + req->attributes = OBJ_CASE_INSENSITIVE | OBJ_OPENIF | + ((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0); wine_server_add_data( req, name, len * sizeof(WCHAR) ); /* it doesn't seem to set last error */ wine_server_call( req ); @@ -303,9 +305,9 @@ HDESK WINAPI OpenDesktopW( LPCWSTR name, DWORD flags, BOOL inherit, ACCESS_MASK } SERVER_START_REQ( open_desktop ) { - req->flags = flags; - req->access = access; - req->inherit = inherit; + req->flags = flags; + req->access = access; + req->attributes = OBJ_CASE_INSENSITIVE | (inherit ? OBJ_INHERIT : 0); wine_server_add_data( req, name, len * sizeof(WCHAR) ); if (!wine_server_call( req )) ret = reply->handle; } diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 4a241510ca6..e8dc3b346cb 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -2889,7 +2889,7 @@ struct create_winstation_request struct request_header __header; unsigned int flags; unsigned int access; - int inherit; + unsigned int attributes; /* VARARG(name,unicode_str); */ }; struct create_winstation_reply @@ -2904,7 +2904,7 @@ struct open_winstation_request { struct request_header __header; unsigned int access; - int inherit; + unsigned int attributes; /* VARARG(name,unicode_str); */ }; struct open_winstation_reply @@ -2956,7 +2956,7 @@ struct create_desktop_request struct request_header __header; unsigned int flags; unsigned int access; - int inherit; + unsigned int attributes; /* VARARG(name,unicode_str); */ }; struct create_desktop_reply @@ -2972,7 +2972,7 @@ struct open_desktop_request struct request_header __header; unsigned int flags; unsigned int access; - int inherit; + unsigned int attributes; /* VARARG(name,unicode_str); */ }; struct open_desktop_reply @@ -4208,6 +4208,6 @@ union generic_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 */ diff --git a/server/protocol.def b/server/protocol.def index b5bfd5dc13c..23140dfe4a5 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2035,7 +2035,7 @@ enum message_type @REQ(create_winstation) unsigned int flags; /* window station flags */ unsigned int access; /* wanted access rights */ - int inherit; /* inherit flag */ + unsigned int attributes; /* object attributes */ VARARG(name,unicode_str); /* object name */ @REPLY obj_handle_t handle; /* handle to the window station */ @@ -2045,7 +2045,7 @@ enum message_type /* Open a handle to a window station */ @REQ(open_winstation) unsigned int access; /* wanted access rights */ - int inherit; /* inherit flag */ + unsigned int attributes; /* object attributes */ VARARG(name,unicode_str); /* object name */ @REPLY obj_handle_t handle; /* handle to the window station */ @@ -2075,7 +2075,7 @@ enum message_type @REQ(create_desktop) unsigned int flags; /* desktop flags */ unsigned int access; /* wanted access rights */ - int inherit; /* inherit flag */ + unsigned int attributes; /* object attributes */ VARARG(name,unicode_str); /* object name */ @REPLY obj_handle_t handle; /* handle to the desktop */ @@ -2086,7 +2086,7 @@ enum message_type @REQ(open_desktop) unsigned int flags; /* desktop flags */ unsigned int access; /* wanted access rights */ - int inherit; /* inherit flag */ + unsigned int attributes; /* object attributes */ VARARG(name,unicode_str); /* object name */ @REPLY obj_handle_t handle; /* handle to the desktop */ diff --git a/server/trace.c b/server/trace.c index 622f0c76311..7f98962662c 100644 --- a/server/trace.c +++ b/server/trace.c @@ -2546,7 +2546,7 @@ static void dump_create_winstation_request( const struct create_winstation_reque { fprintf( stderr, " flags=%08x,", req->flags ); fprintf( stderr, " access=%08x,", req->access ); - fprintf( stderr, " inherit=%d,", req->inherit ); + fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " name=" ); 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 ) { fprintf( stderr, " access=%08x,", req->access ); - fprintf( stderr, " inherit=%d,", req->inherit ); + fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " name=" ); 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, " access=%08x,", req->access ); - fprintf( stderr, " inherit=%d,", req->inherit ); + fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " name=" ); 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, " access=%08x,", req->access ); - fprintf( stderr, " inherit=%d,", req->inherit ); + fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " name=" ); dump_varargs_unicode_str( cur_size ); } diff --git a/server/winstation.c b/server/winstation.c index e461afb3d56..642bf787c99 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -80,7 +80,8 @@ static const struct object_ops desktop_ops = #define DESKTOP_ALL_ACCESS 0x01ff /* 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; @@ -93,8 +94,7 @@ static struct winstation *create_winstation( const struct unicode_str *name, uns return NULL; } - if ((winstation = create_named_object( winstation_namespace, &winstation_ops, name, - OBJ_CASE_INSENSITIVE ))) + if ((winstation = create_named_object( winstation_namespace, &winstation_ops, name, attr ))) { 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 */ -static struct desktop *create_desktop( const struct unicode_str *name, unsigned int flags, - struct winstation *winstation ) +static struct desktop *create_desktop( const struct unicode_str *name, unsigned int attr, + unsigned int flags, struct winstation *winstation ) { struct desktop *desktop; 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 ((desktop = create_named_object( winstation_namespace, &desktop_ops, &full_str, - OBJ_CASE_INSENSITIVE ))) + if ((desktop = create_named_object( winstation_namespace, &desktop_ops, &full_str, attr ))) { if (get_error() != STATUS_OBJECT_NAME_COLLISION) { @@ -250,7 +249,7 @@ void connect_process_winstation( struct process *process, const struct unicode_s if (name) { - winstation = create_winstation( name, 0 ); + winstation = create_winstation( name, OBJ_CASE_INSENSITIVE | OBJ_OPENIF, 0 ); } 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 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; } 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) }; 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 ); release_object( desktop ); @@ -314,9 +313,10 @@ DECL_HANDLER(create_winstation) reply->handle = 0; 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 ); } } @@ -329,7 +329,7 @@ DECL_HANDLER(open_winstation) get_req_unicode_str( &name ); if (winstation_namespace) reply->handle = open_object( winstation_namespace, &name, &winstation_ops, req->access, - OBJ_CASE_INSENSITIVE | (req->inherit ? OBJ_INHERIT:0) ); + req->attributes ); else set_error( STATUS_OBJECT_NAME_NOT_FOUND ); } @@ -381,9 +381,10 @@ DECL_HANDLER(create_desktop) get_req_unicode_str( &name ); 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( winstation ); @@ -405,7 +406,7 @@ DECL_HANDLER(open_desktop) if ((full_name = build_desktop_name( &name, winstation, &full_str ))) { 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 ); } release_object( winstation );