Alexandre Julliard : server: Avoid redefining the DuplicateHandle() constants.
Alexandre Julliard
julliard at winehq.org
Tue Feb 16 16:03:18 CST 2021
Module: wine
Branch: master
Commit: 584427fc89f943d40fb6ee4d51e14ff46b0f9300
URL: https://source.winehq.org/git/wine.git/?a=commit;h=584427fc89f943d40fb6ee4d51e14ff46b0f9300
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Feb 16 11:27:18 2021 +0100
server: Avoid redefining the DuplicateHandle() constants.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/process.c | 2 +-
dlls/krnl386.exe16/vxd.c | 2 +-
dlls/ntdll/heap.c | 2 +-
dlls/wineandroid.drv/device.c | 4 ++--
include/wine/server_protocol.h | 3 ---
include/winnt.h | 3 +++
server/handle.c | 12 ++++++------
server/protocol.def | 3 ---
server/thread.c | 4 ++--
server/winstation.c | 4 ++--
10 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 085fff1454e..756d1ef3f87 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -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;
}
diff --git a/dlls/krnl386.exe16/vxd.c b/dlls/krnl386.exe16/vxd.c
index ab9d916d834..c259cd60775 100644
--- a/dlls/krnl386.exe16/vxd.c
+++ b/dlls/krnl386.exe16/vxd.c
@@ -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;
}
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index 88db935746a..2d7b229174d 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -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;
diff --git a/dlls/wineandroid.drv/device.c b/dlls/wineandroid.drv/device.c
index 5bebc5c7901..4a16e6836ed 100644
--- a/dlls/wineandroid.drv/device.c
+++ b/dlls/wineandroid.drv/device.c
@@ -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;
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 416f1af9212..ec34867caf1 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -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
diff --git a/include/winnt.h b/include/winnt.h
index 8feb2e53a4c..48f1715c3b6 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -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
diff --git a/server/handle.c b/server/handle.c
index a6fcb871e2d..ef0f595bf08 100644
--- a/server/handle.c
+++ b/server/handle.c
@@ -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 );
diff --git a/server/protocol.def b/server/protocol.def
index b210a4cf7d1..fb3ee3a52de 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -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 */
diff --git a/server/thread.c b/server/thread.c
index 38bc25ae5f5..3cee717e169 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -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
{
diff --git a/server/winstation.c b/server/winstation.c
index 0403825b575..1c7552f0687 100644
--- a/server/winstation.c
+++ b/server/winstation.c
@@ -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 );
More information about the wine-cvs
mailing list