Removed dst_handle in duplicate_handle request.

Added inherit flag in create_mapping request.
This commit is contained in:
Alexandre Julliard 1999-02-28 10:12:48 +00:00
parent bc5477f7d2
commit 875d112dd7
6 changed files with 8 additions and 36 deletions

View File

@ -201,7 +201,6 @@ struct dup_handle_request
int src_process; /* src process handle */
int src_handle; /* src handle to duplicate */
int dst_process; /* dst process handle */
int dst_handle; /* handle to duplicate to (or -1 for any) */
unsigned int access; /* wanted access rights */
int inherit; /* inherit flag */
int options; /* duplicate options (see below) */
@ -573,6 +572,7 @@ struct create_mapping_request
int size_high; /* mapping size */
int size_low; /* mapping size */
int protect; /* protection flags (see below) */
int inherit; /* inherit flag */
int handle; /* file handle */
char name[0]; /* object name */
};

View File

@ -56,7 +56,7 @@ extern int set_handle_info( struct process *process, int handle,
extern struct object *get_handle_obj( struct process *process, int handle,
unsigned int access, const struct object_ops *ops );
extern int duplicate_handle( struct process *src, int src_handle, struct process *dst,
int dst_handle, unsigned int access, int inherit, int options );
unsigned int access, int inherit, int options );
extern int open_object( const char *name, const struct object_ops *ops,
unsigned int access, int inherit );

View File

@ -356,7 +356,6 @@ int CLIENT_DuplicateHandle( int src_process, int src_handle, int dst_process, in
req.src_process = src_process;
req.src_handle = src_handle;
req.dst_process = dst_process;
req.dst_handle = dst_handle;
req.access = access;
req.inherit = inherit;
req.options = options;

View File

@ -288,33 +288,6 @@ int alloc_handle( struct process *process, void *obj, unsigned int access,
return handle + 1; /* avoid handle 0 */
}
/* allocate a specific handle for an object, incrementing its refcount */
static int alloc_specific_handle( struct process *process, void *obj, int handle,
unsigned int access, int inherit )
{
struct handle_entry *entry;
struct object *old;
if (handle == -1) return alloc_handle( process, obj, access, inherit );
assert( !(access & RESERVED_ALL) );
if (inherit) access |= RESERVED_INHERIT;
handle--; /* handles start at 1 */
if ((handle < 0) || (handle > process->handle_last))
{
SET_ERROR( ERROR_INVALID_HANDLE );
return -1;
}
entry = process->entries + handle;
old = entry->ptr;
entry->ptr = grab_object( obj );
entry->access = access;
if (old) release_object( old );
return handle + 1;
}
/* return an handle entry, or NULL if the handle is invalid */
static struct handle_entry *get_handle( struct process *process, int handle )
{
@ -469,7 +442,7 @@ int set_handle_info( struct process *process, int handle, int mask, int flags )
/* duplicate a handle */
int duplicate_handle( struct process *src, int src_handle, struct process *dst,
int dst_handle, unsigned int access, int inherit, int options )
unsigned int access, int inherit, int options )
{
int res;
struct handle_entry *entry = get_handle( src, src_handle );
@ -478,7 +451,7 @@ int duplicate_handle( struct process *src, int src_handle, struct process *dst,
if (options & DUP_HANDLE_SAME_ACCESS) access = entry->access;
if (options & DUP_HANDLE_MAKE_GLOBAL) dst = initial_process;
access &= ~RESERVED_ALL;
res = alloc_specific_handle( dst, entry->ptr, dst_handle, access, inherit );
res = alloc_handle( dst, entry->ptr, access, inherit );
if (options & DUP_HANDLE_MAKE_GLOBAL) res = HANDLE_LOCAL_TO_GLOBAL(res);
return res;
}

View File

@ -223,12 +223,12 @@ DECL_HANDLER(dup_handle)
{
if (req->options & DUP_HANDLE_MAKE_GLOBAL)
{
reply.handle = duplicate_handle( src, req->src_handle, NULL, -1,
reply.handle = duplicate_handle( src, req->src_handle, NULL,
req->access, req->inherit, req->options );
}
else if ((dst = get_process_from_handle( req->dst_process, PROCESS_DUP_HANDLE )))
{
reply.handle = duplicate_handle( src, req->src_handle, dst, req->dst_handle,
reply.handle = duplicate_handle( src, req->src_handle, dst,
req->access, req->inherit, req->options );
release_object( dst );
}
@ -742,7 +742,7 @@ DECL_HANDLER(create_mapping)
{
int access = FILE_MAP_ALL_ACCESS;
if (!(req->protect & VPROT_WRITE)) access &= ~FILE_MAP_WRITE;
reply.handle = alloc_handle( current->process, obj, access, 0 );
reply.handle = alloc_handle( current->process, obj, access, req->inherit );
release_object( obj );
}
send_reply( current, -1, 1, &reply, sizeof(reply) );

View File

@ -159,7 +159,6 @@ static int dump_dup_handle_request( struct dup_handle_request *req, int len )
fprintf( stderr, " src_process=%d,", req->src_process );
fprintf( stderr, " src_handle=%d,", req->src_handle );
fprintf( stderr, " dst_process=%d,", req->dst_process );
fprintf( stderr, " dst_handle=%d,", req->dst_handle );
fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d,", req->inherit );
fprintf( stderr, " options=%d", req->options );
@ -522,6 +521,7 @@ static int dump_create_mapping_request( struct create_mapping_request *req, int
fprintf( stderr, " size_high=%d,", req->size_high );
fprintf( stderr, " size_low=%d,", req->size_low );
fprintf( stderr, " protect=%d,", req->protect );
fprintf( stderr, " inherit=%d,", req->inherit );
fprintf( stderr, " handle=%d,", req->handle );
fprintf( stderr, " name=\"%.*s\"", len - (int)sizeof(*req), (char *)(req+1) );
return len;