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

@ -88,7 +88,8 @@ HWINSTA WINAPI CreateWindowStationW( LPCWSTR name, DWORD reserved, ACCESS_MASK a
{
req->flags = 0;
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) );
/* it doesn't seem to set last error */
wine_server_call( req );
@ -132,7 +133,7 @@ HWINSTA WINAPI OpenWindowStationW( LPCWSTR name, BOOL inherit, ACCESS_MASK acces
SERVER_START_REQ( open_winstation )
{
req->access = access;
req->inherit = inherit;
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;
}
@ -260,7 +261,8 @@ HDESK WINAPI CreateDesktopW( LPCWSTR name, LPCWSTR device, LPDEVMODEW devmode,
{
req->flags = flags;
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) );
/* it doesn't seem to set last error */
wine_server_call( req );
@ -305,7 +307,7 @@ HDESK WINAPI OpenDesktopW( LPCWSTR name, DWORD flags, BOOL inherit, ACCESS_MASK
{
req->flags = flags;
req->access = access;
req->inherit = inherit;
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;
}

View File

@ -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 */

View File

@ -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 */

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, " 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 );
}

View File

@ -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 );