server: Use attributes instead of inherit flag in process and thread requests.

oldstable
Alexandre Julliard 2005-12-09 12:13:11 +01:00
parent f11d0a375f
commit f2d7dd645e
8 changed files with 46 additions and 32 deletions

View File

@ -1603,9 +1603,11 @@ static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPW
WaitForSingleObject( process_info, INFINITE );
SERVER_START_REQ( get_new_process_info )
{
req->info = process_info;
req->pinherit = (psa && (psa->nLength >= sizeof(*psa)) && psa->bInheritHandle);
req->tinherit = (tsa && (tsa->nLength >= sizeof(*tsa)) && tsa->bInheritHandle);
req->info = process_info;
req->process_access = PROCESS_ALL_ACCESS;
req->process_attr = (psa && (psa->nLength >= sizeof(*psa)) && psa->bInheritHandle) ? OBJ_INHERIT : 0;
req->thread_access = THREAD_ALL_ACCESS;
req->thread_attr = (tsa && (tsa->nLength >= sizeof(*tsa)) && tsa->bInheritHandle) ? OBJ_INHERIT : 0;
if ((ret = !wine_server_call_err( req )))
{
info->dwProcessId = (DWORD)reply->pid;

View File

@ -375,9 +375,9 @@ NTSTATUS WINAPI NtOpenProcess(PHANDLE handle, ACCESS_MASK access,
SERVER_START_REQ( open_process )
{
req->pid = (DWORD)cid->UniqueProcess;
req->access = access;
req->inherit = attr && (attr->Attributes & OBJ_INHERIT);
req->pid = (process_id_t)cid->UniqueProcess;
req->access = access;
req->attributes = attr ? attr->Attributes : 0;
status = wine_server_call( req );
if (!status) *handle = reply->handle;
}

View File

@ -265,8 +265,9 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
SERVER_START_REQ( new_thread )
{
req->access = THREAD_ALL_ACCESS;
req->attributes = 0; /* FIXME */
req->suspend = suspended;
req->inherit = 0; /* FIXME */
req->request_fd = request_pipe[0];
if (!(status = wine_server_call( req )))
{
@ -362,9 +363,9 @@ NTSTATUS WINAPI NtOpenThread( HANDLE *handle, ACCESS_MASK access,
SERVER_START_REQ( open_thread )
{
req->tid = (thread_id_t)id->UniqueThread;
req->access = access;
req->inherit = attr && (attr->Attributes & OBJ_INHERIT);
req->tid = (thread_id_t)id->UniqueThread;
req->access = access;
req->attributes = attr ? attr->Attributes : 0;
ret = wine_server_call( req );
*handle = reply->handle;
}

View File

@ -206,8 +206,10 @@ struct get_new_process_info_request
{
struct request_header __header;
obj_handle_t info;
int pinherit;
int tinherit;
unsigned int process_access;
unsigned int process_attr;
unsigned int thread_access;
unsigned int thread_attr;
};
struct get_new_process_info_reply
{
@ -224,8 +226,9 @@ struct get_new_process_info_reply
struct new_thread_request
{
struct request_header __header;
unsigned int access;
unsigned int attributes;
int suspend;
int inherit;
int request_fd;
};
struct new_thread_reply
@ -564,7 +567,7 @@ struct open_process_request
struct request_header __header;
process_id_t pid;
unsigned int access;
int inherit;
unsigned int attributes;
};
struct open_process_reply
{
@ -579,7 +582,7 @@ struct open_thread_request
struct request_header __header;
thread_id_t tid;
unsigned int access;
int inherit;
unsigned int attributes;
};
struct open_thread_reply
{
@ -4316,6 +4319,6 @@ union generic_reply
struct query_symlink_reply query_symlink_reply;
};
#define SERVER_PROTOCOL_VERSION 211
#define SERVER_PROTOCOL_VERSION 212
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -909,9 +909,9 @@ DECL_HANDLER(get_new_process_info)
reply->pid = get_process_id( info->process );
reply->tid = get_thread_id( info->thread );
reply->phandle = alloc_handle( current->process, info->process,
PROCESS_ALL_ACCESS, req->pinherit );
req->process_access, req->process_attr & OBJ_INHERIT );
reply->thandle = alloc_handle( current->process, info->thread,
THREAD_ALL_ACCESS, req->tinherit );
req->thread_access, req->thread_attr & OBJ_INHERIT );
reply->success = is_process_init_done( info->process );
release_object( info );
}
@ -1009,7 +1009,8 @@ DECL_HANDLER(open_process)
reply->handle = 0;
if (process)
{
reply->handle = alloc_handle( current->process, process, req->access, req->inherit );
reply->handle = alloc_handle( current->process, process, req->access,
req->attributes & OBJ_INHERIT );
release_object( process );
}
}

View File

@ -214,9 +214,11 @@ struct security_descriptor
/* Retrieve information about a newly started process */
@REQ(get_new_process_info)
obj_handle_t info; /* info handle returned from new_process_request */
int pinherit; /* process handle inherit flag */
int tinherit; /* thread handle inherit flag */
obj_handle_t info; /* info handle returned from new_process_request */
unsigned int process_access; /* access rights for process object */
unsigned int process_attr; /* attributes for process object */
unsigned int thread_access; /* access rights for thread object */
unsigned int thread_attr; /* attributes for thread object */
@REPLY
process_id_t pid; /* process id */
obj_handle_t phandle; /* process handle (in the current process) */
@ -228,8 +230,9 @@ struct security_descriptor
/* Create a new thread from the context of the parent */
@REQ(new_thread)
unsigned int access; /* wanted access rights */
unsigned int attributes; /* object attributes */
int suspend; /* new thread should be suspended on creation */
int inherit; /* inherit flag */
int request_fd; /* fd for request pipe */
@REPLY
thread_id_t tid; /* thread id */
@ -462,7 +465,7 @@ enum apc_type { APC_NONE, APC_USER, APC_TIMER, APC_ASYNC_IO };
@REQ(open_process)
process_id_t pid; /* process id to open */
unsigned int access; /* wanted access rights */
int inherit; /* inherit flag */
unsigned int attributes; /* object attributes */
@REPLY
obj_handle_t handle; /* handle to the process */
@END
@ -472,7 +475,7 @@ enum apc_type { APC_NONE, APC_USER, APC_TIMER, APC_ASYNC_IO };
@REQ(open_thread)
thread_id_t tid; /* thread id to open */
unsigned int access; /* wanted access rights */
int inherit; /* inherit flag */
unsigned int attributes; /* object attributes */
@REPLY
obj_handle_t handle; /* handle to the thread */
@END

View File

@ -829,7 +829,7 @@ DECL_HANDLER(new_thread)
if (req->suspend) thread->suspend++;
reply->tid = get_thread_id( thread );
if ((reply->handle = alloc_handle( current->process, thread,
THREAD_ALL_ACCESS, req->inherit )))
req->access, req->attributes & OBJ_INHERIT )))
{
/* thread object will be released when the thread gets killed */
return;
@ -931,7 +931,8 @@ DECL_HANDLER(open_thread)
reply->handle = 0;
if (thread)
{
reply->handle = alloc_handle( current->process, thread, req->access, req->inherit );
reply->handle = alloc_handle( current->process, thread, req->access,
req->attributes & OBJ_INHERIT );
release_object( thread );
}
}

View File

@ -589,8 +589,10 @@ static void dump_new_process_reply( const struct new_process_reply *req )
static void dump_get_new_process_info_request( const struct get_new_process_info_request *req )
{
fprintf( stderr, " info=%p,", req->info );
fprintf( stderr, " pinherit=%d,", req->pinherit );
fprintf( stderr, " tinherit=%d", req->tinherit );
fprintf( stderr, " process_access=%08x,", req->process_access );
fprintf( stderr, " process_attr=%08x,", req->process_attr );
fprintf( stderr, " thread_access=%08x,", req->thread_access );
fprintf( stderr, " thread_attr=%08x", req->thread_attr );
}
static void dump_get_new_process_info_reply( const struct get_new_process_info_reply *req )
@ -604,8 +606,9 @@ static void dump_get_new_process_info_reply( const struct get_new_process_info_r
static void dump_new_thread_request( const struct new_thread_request *req )
{
fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " attributes=%08x,", req->attributes );
fprintf( stderr, " suspend=%d,", req->suspend );
fprintf( stderr, " inherit=%d,", req->inherit );
fprintf( stderr, " request_fd=%d", req->request_fd );
}
@ -857,7 +860,7 @@ static void dump_open_process_request( const struct open_process_request *req )
{
fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d", req->inherit );
fprintf( stderr, " attributes=%08x", req->attributes );
}
static void dump_open_process_reply( const struct open_process_reply *req )
@ -869,7 +872,7 @@ static void dump_open_thread_request( const struct open_thread_request *req )
{
fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d", req->inherit );
fprintf( stderr, " attributes=%08x", req->attributes );
}
static void dump_open_thread_reply( const struct open_thread_reply *req )