server: Avoid redefining the DuplicateHandle() constants.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-02-16 11:27:18 +01:00
parent d3df2b12ce
commit 584427fc89
10 changed files with 18 additions and 21 deletions

View File

@ -273,7 +273,7 @@ HANDLE WINAPI ConvertToGlobalHandle(HANDLE hSrc)
{
HANDLE ret = INVALID_HANDLE_VALUE;
DuplicateHandle( GetCurrentProcess(), hSrc, GetCurrentProcess(), &ret, 0, FALSE,
DUP_HANDLE_MAKE_GLOBAL | DUP_HANDLE_SAME_ACCESS | DUP_HANDLE_CLOSE_SOURCE );
DUPLICATE_MAKE_GLOBAL | DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE );
return ret;
}

View File

@ -213,7 +213,7 @@ done:
RtlLeaveCriticalSection( &vxd_section );
if (!DuplicateHandle( GetCurrentProcess(), handle, GetCurrentProcess(), &handle, 0,
(sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle),
DUP_HANDLE_SAME_ACCESS ))
DUPLICATE_SAME_ACCESS ))
handle = 0;
return handle;
}

View File

@ -975,7 +975,7 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
if (!sem) NtCreateSemaphore( &sem, SEMAPHORE_ALL_ACCESS, NULL, 0, 1 );
NtDuplicateObject( NtCurrentProcess(), sem, NtCurrentProcess(), &sem, 0, 0,
DUP_HANDLE_MAKE_GLOBAL | DUP_HANDLE_SAME_ACCESS | DUP_HANDLE_CLOSE_SOURCE );
DUPLICATE_MAKE_GLOBAL | DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE );
heap->critSection.LockSemaphore = sem;
RtlFreeHeap( processHeap, 0, heap->critSection.DebugInfo );
heap->critSection.DebugInfo = NULL;

View File

@ -332,7 +332,7 @@ static int duplicate_fd( HANDLE client, int fd )
if (!wine_server_fd_to_handle( dup(fd), GENERIC_READ | SYNCHRONIZE, 0, &handle ))
DuplicateHandle( GetCurrentProcess(), handle, client, &ret,
DUPLICATE_SAME_ACCESS, FALSE, DUP_HANDLE_CLOSE_SOURCE );
0, FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE );
if (!ret) return -1;
return HandleToLong( ret );
@ -348,7 +348,7 @@ static int map_native_handle( union native_handle_buffer *dest, const native_han
{
HANDLE ret = 0;
if (!DuplicateHandle( GetCurrentProcess(), mapping, client, &ret,
DUPLICATE_SAME_ACCESS, FALSE, DUP_HANDLE_CLOSE_SOURCE ))
0, FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE ))
return -ENOSPC;
dest->handle.numFds = 0;
dest->handle.numInts = 1;

View File

@ -1259,9 +1259,6 @@ struct dup_handle_reply
int closed;
char __pad_20[4];
};
#define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
#define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
#define DUP_HANDLE_MAKE_GLOBAL 0x80000000

View File

@ -5531,6 +5531,9 @@ typedef struct _QUOTA_LIMITS_EX {
#define DUPLICATE_CLOSE_SOURCE 0x00000001
#define DUPLICATE_SAME_ACCESS 0x00000002
#ifdef __WINESRC__
#define DUPLICATE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
#endif
/* File attribute flags */
#define FILE_SHARE_READ 0x00000001

View File

@ -566,7 +566,7 @@ obj_handle_t duplicate_handle( struct process *src, obj_handle_t src_handle, str
src_access = obj->ops->map_access( obj, GENERIC_ALL );
src_access &= ~RESERVED_ALL;
if (options & DUP_HANDLE_SAME_ACCESS)
if (options & DUPLICATE_SAME_ACCESS)
access = src_access;
else
access = obj->ops->map_access( obj, access ) & ~RESERVED_ALL;
@ -581,16 +581,16 @@ obj_handle_t duplicate_handle( struct process *src, obj_handle_t src_handle, str
return 0;
}
if (options & DUP_HANDLE_MAKE_GLOBAL)
if (options & DUPLICATE_MAKE_GLOBAL)
res = alloc_global_handle( obj, access );
else
res = alloc_handle_no_access_check( dst, obj, access, attr );
}
else
{
if (options & DUP_HANDLE_MAKE_GLOBAL)
if (options & DUPLICATE_MAKE_GLOBAL)
res = alloc_global_handle_no_access_check( obj, access );
else if ((options & DUP_HANDLE_CLOSE_SOURCE) && src == dst &&
else if ((options & DUPLICATE_CLOSE_SOURCE) && src == dst &&
entry && !(entry->access & RESERVED_CLOSE_PROTECT))
{
if (attr & OBJ_INHERIT) access |= RESERVED_INHERIT;
@ -665,7 +665,7 @@ DECL_HANDLER(dup_handle)
reply->handle = 0;
if ((src = get_process_from_handle( req->src_process, PROCESS_DUP_HANDLE )))
{
if (req->options & DUP_HANDLE_MAKE_GLOBAL)
if (req->options & DUPLICATE_MAKE_GLOBAL)
{
reply->handle = duplicate_handle( src, req->src_handle, NULL,
req->access, req->attributes, req->options );
@ -677,7 +677,7 @@ DECL_HANDLER(dup_handle)
release_object( dst );
}
/* close the handle no matter what happened */
if ((req->options & DUP_HANDLE_CLOSE_SOURCE) && (src != dst || req->src_handle != reply->handle))
if ((req->options & DUPLICATE_CLOSE_SOURCE) && (src != dst || req->src_handle != reply->handle))
reply->closed = !close_handle( src, req->src_handle );
reply->self = (src == current->process);
release_object( src );

View File

@ -1122,9 +1122,6 @@ typedef struct
int self; /* is the source the current process? */
int closed; /* whether the source handle has been closed */
@END
#define DUP_HANDLE_CLOSE_SOURCE DUPLICATE_CLOSE_SOURCE
#define DUP_HANDLE_SAME_ACCESS DUPLICATE_SAME_ACCESS
#define DUP_HANDLE_MAKE_GLOBAL 0x80000000 /* Not a Windows flag */
/* Make an object temporary */

View File

@ -1644,7 +1644,7 @@ DECL_HANDLER(select)
if (apc->result.type == APC_CREATE_THREAD) /* transfer the handle to the caller process */
{
obj_handle_t handle = duplicate_handle( current->process, apc->result.create_thread.handle,
apc->caller->process, 0, 0, DUP_HANDLE_SAME_ACCESS );
apc->caller->process, 0, 0, DUPLICATE_SAME_ACCESS );
close_handle( current->process, apc->result.create_thread.handle );
apc->result.create_thread.handle = handle;
clear_error(); /* ignore errors from the above calls */
@ -1740,7 +1740,7 @@ DECL_HANDLER(queue_apc)
{
/* duplicate the handle into the target process */
obj_handle_t handle = duplicate_handle( current->process, apc->call.map_view.handle,
process, 0, 0, DUP_HANDLE_SAME_ACCESS );
process, 0, 0, DUPLICATE_SAME_ACCESS );
if (handle) apc->call.map_view.handle = handle;
else
{

View File

@ -376,7 +376,7 @@ void connect_process_winstation( struct process *process, struct thread *parent_
else if (parent_process->winstation)
{
handle = duplicate_handle( parent_process, parent_process->winstation,
process, 0, 0, DUP_HANDLE_SAME_ACCESS );
process, 0, 0, DUPLICATE_SAME_ACCESS );
winstation = (struct winstation *)get_handle_obj( process, handle, 0, &winstation_ops );
}
if (!winstation) goto done;
@ -400,7 +400,7 @@ void connect_process_winstation( struct process *process, struct thread *parent_
if (!desktop || desktop->winstation != winstation) goto done;
handle = duplicate_handle( parent_process, handle, process, 0, 0, DUP_HANDLE_SAME_ACCESS );
handle = duplicate_handle( parent_process, handle, process, 0, 0, DUPLICATE_SAME_ACCESS );
}
if (handle) set_process_default_desktop( process, desktop, handle );