From a996000ad5adcaccbae4fdc55823d85b440f06dc Mon Sep 17 00:00:00 2001
From: Vitaliy Margolen <wine-patch@kievinfo.com>
Date: Thu, 27 Oct 2005 18:30:37 +0000
Subject: [PATCH] - Send whole OBJECT_ATTRIBUTES.Attributes to the server not
 just an   inherit flag. - Pass DesiredAccess to the server when creating
 mailslot.

---
 dlls/ntdll/file.c              |  9 +++++----
 dlls/ntdll/sync.c              | 16 ++++++++--------
 dlls/ntdll/virtual.c           |  6 +++---
 include/wine/server_protocol.h | 33 +++++++++++++++++----------------
 server/event.c                 |  6 ++++--
 server/handle.c                |  5 +++--
 server/handle.h                |  2 +-
 server/mailslot.c              |  5 +++--
 server/mapping.c               |  6 ++++--
 server/mutex.c                 |  6 ++++--
 server/named_pipe.c            |  4 ++--
 server/protocol.def            | 31 ++++++++++++++++---------------
 server/semaphore.c             |  6 ++++--
 server/timer.c                 |  6 ++++--
 server/trace.c                 | 31 ++++++++++++++++---------------
 server/winstation.c            |  6 ++++--
 16 files changed, 98 insertions(+), 80 deletions(-)

diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index e010b67e3eb..54250abd40f 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -164,8 +164,8 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB
         SERVER_START_REQ( open_named_pipe )
         {
             req->access = access;
+            req->attributes = (attr) ? attr->Attributes : 0;
             req->flags = options;
-            req->inherit = (attr->Attributes & OBJ_INHERIT) != 0;
             wine_server_add_data( req, attr->ObjectName->Buffer + 4,
                                   attr->ObjectName->Length - 4*sizeof(WCHAR) );
             io->u.Status = wine_server_call( req );
@@ -183,8 +183,8 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB
         SERVER_START_REQ( open_mailslot )
         {
             req->access = access & GENERIC_WRITE;
+            req->attributes = (attr) ? attr->Attributes : 0;
             req->sharing = sharing;
-            req->inherit = (attr->Attributes & OBJ_INHERIT) != 0;
             wine_server_add_data( req, attr->ObjectName->Buffer + 4,
                                   attr->ObjectName->Length - 4*sizeof(WCHAR) );
             io->u.Status = wine_server_call( req );
@@ -1941,6 +1941,7 @@ NTSTATUS WINAPI NtCreateNamedPipeFile( PHANDLE handle, ULONG access,
     SERVER_START_REQ( create_named_pipe )
     {
         req->access  = access;
+        req->attributes = (attr) ? attr->Attributes : 0;
         req->options = options;
         req->flags = 
             (pipe_type) ? NAMED_PIPE_MESSAGE_STREAM_WRITE : 0 |
@@ -1950,7 +1951,6 @@ NTSTATUS WINAPI NtCreateNamedPipeFile( PHANDLE handle, ULONG access,
         req->outsize = outbound_quota;
         req->insize  = inbound_quota;
         req->timeout = timeout->QuadPart / -10000;
-        req->inherit = (attr->Attributes & OBJ_INHERIT) != 0;
         wine_server_add_data( req, attr->ObjectName->Buffer + 4, 
                               attr->ObjectName->Length - 4 * sizeof(WCHAR) );
         status = wine_server_call( req );
@@ -2045,9 +2045,10 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess,
 
     SERVER_START_REQ( create_mailslot )
     {
+        req->access = DesiredAccess;
+        req->attributes = (attr) ? attr->Attributes : 0;
         req->max_msgsize = MaxMessageSize;
         req->read_timeout = TimeOut->QuadPart / -10000;
-        req->inherit = (attr->Attributes & OBJ_INHERIT) != 0;
         wine_server_add_data( req, attr->ObjectName->Buffer + 4,
                               attr->ObjectName->Length - 4*sizeof(WCHAR) );
         ret = wine_server_call( req );
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index 7242a0449a8..670da4d90d0 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -82,9 +82,9 @@ NTSTATUS WINAPI NtCreateSemaphore( OUT PHANDLE SemaphoreHandle,
     SERVER_START_REQ( create_semaphore )
     {
         req->access  = access;
+        req->attributes = (attr) ? attr->Attributes : 0;
         req->initial = InitialCount;
         req->max     = MaximumCount;
-        req->inherit = attr && (attr->Attributes & OBJ_INHERIT);
         if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
         ret = wine_server_call( req );
         *SemaphoreHandle = reply->handle;
@@ -108,7 +108,7 @@ NTSTATUS WINAPI NtOpenSemaphore( OUT PHANDLE SemaphoreHandle,
     SERVER_START_REQ( open_semaphore )
     {
         req->access  = access;
-        req->inherit = attr && (attr->Attributes & OBJ_INHERIT);
+        req->attributes = (attr) ? attr->Attributes : 0;
         if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
         ret = wine_server_call( req );
         *SemaphoreHandle = reply->handle;
@@ -174,9 +174,9 @@ NTSTATUS WINAPI NtCreateEvent(
     SERVER_START_REQ( create_event )
     {
         req->access = DesiredAccess;
+        req->attributes = (attr) ? attr->Attributes : 0;
         req->manual_reset = ManualReset;
         req->initial_state = InitialState;
-        req->inherit = attr && (attr->Attributes & OBJ_INHERIT);
         if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
         ret = wine_server_call( req );
         *EventHandle = reply->handle;
@@ -202,7 +202,7 @@ NTSTATUS WINAPI NtOpenEvent(
     SERVER_START_REQ( open_event )
     {
         req->access  = DesiredAccess;
-        req->inherit = attr && (attr->Attributes & OBJ_INHERIT);
+        req->attributes = (attr) ? attr->Attributes : 0;
         if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
         ret = wine_server_call( req );
         *EventHandle = reply->handle;
@@ -321,8 +321,8 @@ NTSTATUS WINAPI NtCreateMutant(OUT HANDLE* MutantHandle,
     SERVER_START_REQ( create_mutex )
     {
         req->access  = access;
+        req->attributes = (attr) ? attr->Attributes : 0;
         req->owned   = InitialOwner;
-        req->inherit = attr && (attr->Attributes & OBJ_INHERIT);
         if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
         status = wine_server_call( req );
         *MutantHandle = reply->handle;
@@ -347,7 +347,7 @@ NTSTATUS WINAPI NtOpenMutant(OUT HANDLE* MutantHandle,
     SERVER_START_REQ( open_mutex )
     {
         req->access  = access;
-        req->inherit = attr && (attr->Attributes & OBJ_INHERIT);
+        req->attributes = (attr) ? attr->Attributes : 0;
         if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
         status = wine_server_call( req );
         *MutantHandle = reply->handle;
@@ -413,8 +413,8 @@ NTSTATUS WINAPI NtCreateTimer(OUT HANDLE *handle,
     SERVER_START_REQ( create_timer )
     {
         req->access  = access;
+        req->attributes = (attr) ? attr->Attributes : 0;
         req->manual  = (timer_type == NotificationTimer) ? TRUE : FALSE;
-        req->inherit = attr && (attr->Attributes & OBJ_INHERIT);
         if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
         status = wine_server_call( req );
         *handle = reply->handle;
@@ -440,7 +440,7 @@ NTSTATUS WINAPI NtOpenTimer(OUT PHANDLE handle,
     SERVER_START_REQ( open_timer )
     {
         req->access  = access;
-        req->inherit = attr && (attr->Attributes & OBJ_INHERIT);
+        req->attributes = (attr) ? attr->Attributes : 0;
         if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
         status = wine_server_call( req );
         *handle = reply->handle;
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 277ea6a6729..03b971168de 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1654,12 +1654,12 @@ NTSTATUS WINAPI NtCreateSection( HANDLE *handle, ACCESS_MASK access, const OBJEC
 
     SERVER_START_REQ( create_mapping )
     {
+        req->access      = access;
+        req->attributes  = (attr) ? attr->Attributes : 0;
         req->file_handle = file;
         req->size_high   = size ? size->u.HighPart : 0;
         req->size_low    = size ? size->u.LowPart : 0;
         req->protect     = vprot;
-        req->access      = access;
-        req->inherit     = (attr && (attr->Attributes & OBJ_INHERIT) != 0);
         if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
         ret = wine_server_call( req );
         *handle = reply->handle;
@@ -1683,7 +1683,7 @@ NTSTATUS WINAPI NtOpenSection( HANDLE *handle, ACCESS_MASK access, const OBJECT_
     SERVER_START_REQ( open_mapping )
     {
         req->access  = access;
-        req->inherit = (attr->Attributes & OBJ_INHERIT) != 0;
+        req->attributes = (attr) ? attr->Attributes : 0;
         wine_server_add_data( req, attr->ObjectName->Buffer, len );
         if (!(ret = wine_server_call( req ))) *handle = reply->handle;
     }
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 48dc8bd7d39..3676e3c2a7f 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -613,9 +613,9 @@ struct create_event_request
 {
     struct request_header __header;
     unsigned int access;
+    unsigned int attributes;
     int          manual_reset;
     int          initial_state;
-    int          inherit;
     /* VARARG(name,unicode_str); */
 };
 struct create_event_reply
@@ -643,7 +643,7 @@ struct open_event_request
 {
     struct request_header __header;
     unsigned int access;
-    int          inherit;
+    unsigned int attributes;
     /* VARARG(name,unicode_str); */
 };
 struct open_event_reply
@@ -658,8 +658,8 @@ struct create_mutex_request
 {
     struct request_header __header;
     unsigned int access;
+    unsigned int attributes;
     int          owned;
-    int          inherit;
     /* VARARG(name,unicode_str); */
 };
 struct create_mutex_reply
@@ -687,7 +687,7 @@ struct open_mutex_request
 {
     struct request_header __header;
     unsigned int access;
-    int          inherit;
+    unsigned int attributes;
     /* VARARG(name,unicode_str); */
 };
 struct open_mutex_reply
@@ -702,9 +702,9 @@ struct create_semaphore_request
 {
     struct request_header __header;
     unsigned int access;
+    unsigned int attributes;
     unsigned int initial;
     unsigned int max;
-    int          inherit;
     /* VARARG(name,unicode_str); */
 };
 struct create_semaphore_reply
@@ -733,7 +733,7 @@ struct open_semaphore_request
 {
     struct request_header __header;
     unsigned int access;
-    int          inherit;
+    unsigned int attributes;
     /* VARARG(name,unicode_str); */
 };
 struct open_semaphore_reply
@@ -1399,11 +1399,11 @@ struct next_change_notification_reply
 struct create_mapping_request
 {
     struct request_header __header;
+    unsigned int access;
+    unsigned int attributes;
     int          size_high;
     int          size_low;
     int          protect;
-    unsigned int access;
-    int          inherit;
     obj_handle_t file_handle;
     /* VARARG(name,unicode_str); */
 };
@@ -1428,7 +1428,7 @@ struct open_mapping_request
 {
     struct request_header __header;
     unsigned int access;
-    int          inherit;
+    unsigned int attributes;
     /* VARARG(name,unicode_str); */
 };
 struct open_mapping_reply
@@ -1879,7 +1879,7 @@ struct create_timer_request
 {
     struct request_header __header;
     unsigned int access;
-    int          inherit;
+    unsigned int attributes;
     int          manual;
     /* VARARG(name,unicode_str); */
 };
@@ -1895,7 +1895,7 @@ struct open_timer_request
 {
     struct request_header __header;
     unsigned int access;
-    int          inherit;
+    unsigned int attributes;
     /* VARARG(name,unicode_str); */
 };
 struct open_timer_reply
@@ -2366,13 +2366,13 @@ struct create_named_pipe_request
 {
     struct request_header __header;
     unsigned int   access;
+    unsigned int   attributes;
     unsigned int   options;
     unsigned int   flags;
     unsigned int   maxinstances;
     unsigned int   outsize;
     unsigned int   insize;
     unsigned int   timeout;
-    int            inherit;
     /* VARARG(name,unicode_str); */
 };
 struct create_named_pipe_reply
@@ -2392,8 +2392,8 @@ struct open_named_pipe_request
 {
     struct request_header __header;
     unsigned int   access;
+    unsigned int   attributes;
     unsigned int   flags;
-    int            inherit;
     /* VARARG(name,unicode_str); */
 };
 struct open_named_pipe_reply
@@ -3528,9 +3528,10 @@ struct get_token_user_reply
 struct create_mailslot_request
 {
     struct request_header __header;
+    unsigned int   access;
+    unsigned int   attributes;
     unsigned int   max_msgsize;
     unsigned int   read_timeout;
-    int            inherit;
     /* VARARG(name,unicode_str); */
 };
 struct create_mailslot_reply
@@ -3545,7 +3546,7 @@ struct open_mailslot_request
 {
     struct request_header __header;
     unsigned int   access;
-    int            inherit;
+    unsigned int   attributes;
     unsigned int   sharing;
     /* VARARG(name,unicode_str); */
 };
@@ -4206,6 +4207,6 @@ union generic_reply
     struct set_mailslot_info_reply set_mailslot_info_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 194
+#define SERVER_PROTOCOL_VERSION 195
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/event.c b/server/event.c
index 3445185aeb5..43b64af9d37 100644
--- a/server/event.c
+++ b/server/event.c
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 
 #include "windef.h"
+#include "winternl.h"
 
 #include "handle.h"
 #include "thread.h"
@@ -149,7 +150,8 @@ DECL_HANDLER(create_event)
     if ((event = create_event( get_req_data(), get_req_data_size(),
                                req->manual_reset, req->initial_state )))
     {
-        reply->handle = alloc_handle( current->process, event, req->access, req->inherit );
+        reply->handle = alloc_handle( current->process, event, req->access,
+                                      req->attributes & OBJ_INHERIT );
         release_object( event );
     }
 }
@@ -158,7 +160,7 @@ DECL_HANDLER(create_event)
 DECL_HANDLER(open_event)
 {
     reply->handle = open_object( sync_namespace, get_req_data(), get_req_data_size(),
-                                 &event_ops, req->access, req->inherit );
+                                 &event_ops, req->access, req->attributes );
 }
 
 /* do an event operation */
diff --git a/server/handle.c b/server/handle.c
index a5b286b89f5..b865fd39755 100644
--- a/server/handle.c
+++ b/server/handle.c
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 
 #include "windef.h"
+#include "winternl.h"
 
 #include "handle.h"
 #include "process.h"
@@ -521,7 +522,7 @@ obj_handle_t duplicate_handle( struct process *src, obj_handle_t src_handle, str
 
 /* open a new handle to an existing object */
 obj_handle_t open_object( const struct namespace *namespace, const WCHAR *name, size_t len,
-                          const struct object_ops *ops, unsigned int access, int inherit )
+                          const struct object_ops *ops, unsigned int access, unsigned int attr )
 {
     obj_handle_t handle = 0;
     struct object *obj = find_object( namespace, name, len );
@@ -530,7 +531,7 @@ obj_handle_t open_object( const struct namespace *namespace, const WCHAR *name,
         if (ops && obj->ops != ops)
             set_error( STATUS_OBJECT_TYPE_MISMATCH );
         else
-            handle = alloc_handle( current->process, obj, access, inherit );
+            handle = alloc_handle( current->process, obj, access, attr & OBJ_INHERIT );
         release_object( obj );
     }
     else
diff --git a/server/handle.h b/server/handle.h
index 626064f512a..990190ffbf4 100644
--- a/server/handle.h
+++ b/server/handle.h
@@ -44,7 +44,7 @@ extern int set_handle_unix_fd( struct process *process, obj_handle_t handle, int
 extern obj_handle_t duplicate_handle( struct process *src, obj_handle_t src_handle, struct process *dst,
                                   unsigned int access, int inherit, int options );
 extern obj_handle_t open_object( const struct namespace *namespace, const WCHAR *name, size_t len,
-                                 const struct object_ops *ops, unsigned int access, int inherit );
+                                 const struct object_ops *ops, unsigned int access, unsigned int attr );
 extern obj_handle_t find_inherited_handle( struct process *process, const struct object_ops *ops );
 extern struct handle_table *alloc_handle_table( struct process *process, int count );
 extern struct handle_table *copy_handle_table( struct process *process, struct process *parent );
diff --git a/server/mailslot.c b/server/mailslot.c
index 18b39204890..d461a52f7de 100644
--- a/server/mailslot.c
+++ b/server/mailslot.c
@@ -43,6 +43,7 @@
 #include <sys/filio.h>
 #endif
 #include "windef.h"
+#include "winternl.h"
 
 #include "file.h"
 #include "handle.h"
@@ -356,7 +357,7 @@ DECL_HANDLER(create_mailslot)
     if (mailslot)
     {
         reply->handle = alloc_handle( current->process, mailslot,
-                                      GENERIC_READ, req->inherit );
+                                      req->access, req->attributes & OBJ_INHERIT );
         release_object( mailslot );
     }
 }
@@ -384,7 +385,7 @@ DECL_HANDLER(open_mailslot)
         if (writer)
         {
             reply->handle = alloc_handle( current->process, writer,
-                                          req->access, req->inherit );
+                                          req->access, req->attributes & OBJ_INHERIT );
             release_object( writer );
         }
         release_object( mailslot );
diff --git a/server/mapping.c b/server/mapping.c
index 81e4806c672..7edba4cae82 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -29,6 +29,7 @@
 #include <unistd.h>
 
 #include "windef.h"
+#include "winternl.h"
 
 #include "file.h"
 #include "handle.h"
@@ -379,7 +380,8 @@ DECL_HANDLER(create_mapping)
     if ((obj = create_mapping( size, req->protect, req->file_handle,
                                get_req_data(), get_req_data_size() )))
     {
-        reply->handle = alloc_handle( current->process, obj, req->access, req->inherit );
+        reply->handle = alloc_handle( current->process, obj, req->access,
+                                      req->attributes & OBJ_INHERIT );
         release_object( obj );
     }
 }
@@ -388,7 +390,7 @@ DECL_HANDLER(create_mapping)
 DECL_HANDLER(open_mapping)
 {
     reply->handle = open_object( sync_namespace, get_req_data(), get_req_data_size(),
-                                 &mapping_ops, req->access, req->inherit );
+                                 &mapping_ops, req->access, req->attributes );
 }
 
 /* get a mapping information */
diff --git a/server/mutex.c b/server/mutex.c
index c9bee831be9..e773d441a28 100644
--- a/server/mutex.c
+++ b/server/mutex.c
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 
 #include "windef.h"
+#include "winternl.h"
 
 #include "handle.h"
 #include "thread.h"
@@ -173,7 +174,8 @@ DECL_HANDLER(create_mutex)
     reply->handle = 0;
     if ((mutex = create_mutex( get_req_data(), get_req_data_size(), req->owned )))
     {
-        reply->handle = alloc_handle( current->process, mutex, req->access, req->inherit );
+        reply->handle = alloc_handle( current->process, mutex, req->access,
+                                      req->attributes & OBJ_INHERIT );
         release_object( mutex );
     }
 }
@@ -182,7 +184,7 @@ DECL_HANDLER(create_mutex)
 DECL_HANDLER(open_mutex)
 {
     reply->handle = open_object( sync_namespace, get_req_data(), get_req_data_size(),
-                                 &mutex_ops, req->access, req->inherit );
+                                 &mutex_ops, req->access, req->attributes );
 }
 
 /* release a mutex */
diff --git a/server/named_pipe.c b/server/named_pipe.c
index ba56d2f988b..6f4e55db820 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -583,7 +583,7 @@ DECL_HANDLER(create_named_pipe)
     if (server)
     {
         reply->handle = alloc_handle( current->process, server,
-                                      req->access, req->inherit );
+                                      req->access, req->attributes & OBJ_INHERIT );
         server->pipe->instances++;
         release_object( server );
     }
@@ -645,7 +645,7 @@ DECL_HANDLER(open_named_pipe)
                 server->client = client;
                 client->server = server;
                 reply->handle = alloc_handle( current->process, client,
-                                              req->access, req->inherit );
+                                              req->access, req->attributes & OBJ_INHERIT );
             }
         }
         else
diff --git a/server/protocol.def b/server/protocol.def
index 61a4e09dbab..f0490cbd3dc 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -495,9 +495,9 @@ enum apc_type { APC_NONE, APC_USER, APC_TIMER, APC_ASYNC_IO };
 /* Create an event */
 @REQ(create_event)
     unsigned int access;        /* wanted access rights */
+    unsigned int attributes;    /* object attributes */
     int          manual_reset;  /* manual reset event */
     int          initial_state; /* initial state of the event */
-    int          inherit;       /* inherit flag */
     VARARG(name,unicode_str);   /* object name */
 @REPLY
     obj_handle_t handle;        /* handle to the event */
@@ -514,7 +514,7 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
 /* Open an event */
 @REQ(open_event)
     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 event */
@@ -524,8 +524,8 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
 /* Create a mutex */
 @REQ(create_mutex)
     unsigned int access;        /* wanted access rights */
+    unsigned int attributes;    /* object attributes */
     int          owned;         /* initially owned? */
-    int          inherit;       /* inherit flag */
     VARARG(name,unicode_str);   /* object name */
 @REPLY
     obj_handle_t handle;        /* handle to the mutex */
@@ -543,7 +543,7 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
 /* Open a mutex */
 @REQ(open_mutex)
     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 mutex */
@@ -553,9 +553,9 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
 /* Create a semaphore */
 @REQ(create_semaphore)
     unsigned int access;        /* wanted access rights */
+    unsigned int attributes;    /* object attributes */
     unsigned int initial;       /* initial count */
     unsigned int max;           /* maximum count */
-    int          inherit;       /* inherit flag */
     VARARG(name,unicode_str);   /* object name */
 @REPLY
     obj_handle_t handle;        /* handle to the semaphore */
@@ -574,7 +574,7 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };
 /* Open a semaphore */
 @REQ(open_semaphore)
     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 semaphore */
@@ -1037,11 +1037,11 @@ enum char_info_mode
 
 /* Create a file mapping */
 @REQ(create_mapping)
+    unsigned int access;        /* wanted access rights */
+    unsigned int attributes;    /* object attributes */
     int          size_high;     /* mapping size */
     int          size_low;      /* mapping size */
     int          protect;       /* protection flags (see below) */
-    unsigned int access;        /* wanted access rights */
-    int          inherit;       /* inherit flag */
     obj_handle_t file_handle;   /* file handle */
     VARARG(name,unicode_str);   /* object name */
 @REPLY
@@ -1061,7 +1061,7 @@ enum char_info_mode
 /* Open a mapping */
 @REQ(open_mapping)
     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 mapping */
@@ -1354,7 +1354,7 @@ enum char_info_mode
 /* Create a waitable timer */
 @REQ(create_timer)
     unsigned int access;        /* wanted access rights */
-    int          inherit;       /* inherit flag */
+    unsigned int attributes;    /* object attributes */
     int          manual;        /* manual reset */
     VARARG(name,unicode_str);   /* object name */
 @REPLY
@@ -1365,7 +1365,7 @@ enum char_info_mode
 /* Open a waitable timer */
 @REQ(open_timer)
     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 timer */
@@ -1680,13 +1680,13 @@ enum message_type
 /* Create a named pipe */
 @REQ(create_named_pipe)
     unsigned int   access;
+    unsigned int   attributes;   /* object attributes */
     unsigned int   options;
     unsigned int   flags;
     unsigned int   maxinstances;
     unsigned int   outsize;
     unsigned int   insize;
     unsigned int   timeout;
-    int            inherit;      /* inherit flag */
     VARARG(name,unicode_str);    /* pipe name */
 @REPLY
     obj_handle_t   handle;       /* handle to the pipe */
@@ -1701,8 +1701,8 @@ enum message_type
 /* Open an existing named pipe */
 @REQ(open_named_pipe)
     unsigned int   access;
+    unsigned int   attributes;   /* object attributes */
     unsigned int   flags;        /* file flags */
-    int            inherit;      /* inherit flag */
     VARARG(name,unicode_str);    /* pipe name */
 @REPLY
     obj_handle_t   handle;       /* handle to the pipe */
@@ -2471,9 +2471,10 @@ enum message_type
 
 /* Create a mailslot */
 @REQ(create_mailslot)
+    unsigned int   access;        /* wanted access rights */
+    unsigned int   attributes;    /* object attributes */
     unsigned int   max_msgsize;
     unsigned int   read_timeout;
-    int            inherit;
     VARARG(name,unicode_str);     /* mailslot name */
 @REPLY
     obj_handle_t   handle;        /* handle to the mailslot */
@@ -2483,7 +2484,7 @@ enum message_type
 /* Open an existing mailslot */
 @REQ(open_mailslot)
     unsigned int   access;
-    int            inherit;       /* inherit flag */
+    unsigned int   attributes;    /* object attributes */
     unsigned int   sharing;       /* sharing mode */
     VARARG(name,unicode_str);     /* mailslot name */
 @REPLY
diff --git a/server/semaphore.c b/server/semaphore.c
index 64c34478a8f..6f3a7ea0ca7 100644
--- a/server/semaphore.c
+++ b/server/semaphore.c
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 
 #include "windef.h"
+#include "winternl.h"
 
 #include "handle.h"
 #include "thread.h"
@@ -149,7 +150,8 @@ DECL_HANDLER(create_semaphore)
     if ((sem = create_semaphore( get_req_data(), get_req_data_size(),
                                  req->initial, req->max )))
     {
-        reply->handle = alloc_handle( current->process, sem, req->access, req->inherit );
+        reply->handle = alloc_handle( current->process, sem, req->access,
+                                      req->attributes & OBJ_INHERIT );
         release_object( sem );
     }
 }
@@ -158,7 +160,7 @@ DECL_HANDLER(create_semaphore)
 DECL_HANDLER(open_semaphore)
 {
     reply->handle = open_object( sync_namespace, get_req_data(), get_req_data_size(),
-                                 &semaphore_ops, req->access, req->inherit );
+                                 &semaphore_ops, req->access, req->attributes );
 }
 
 /* release a semaphore */
diff --git a/server/timer.c b/server/timer.c
index c4ab0e874bc..1a7d0d8eda7 100644
--- a/server/timer.c
+++ b/server/timer.c
@@ -28,6 +28,7 @@
 #include <sys/types.h>
 
 #include "windef.h"
+#include "winternl.h"
 
 #include "file.h"
 #include "handle.h"
@@ -206,7 +207,8 @@ DECL_HANDLER(create_timer)
     reply->handle = 0;
     if ((timer = create_timer( get_req_data(), get_req_data_size(), req->manual )))
     {
-        reply->handle = alloc_handle( current->process, timer, req->access, req->inherit );
+        reply->handle = alloc_handle( current->process, timer, req->access,
+                                      req->attributes & OBJ_INHERIT );
         release_object( timer );
     }
 }
@@ -215,7 +217,7 @@ DECL_HANDLER(create_timer)
 DECL_HANDLER(open_timer)
 {
     reply->handle = open_object( sync_namespace, get_req_data(), get_req_data_size(),
-                                 &timer_ops, req->access, req->inherit );
+                                 &timer_ops, req->access, req->attributes );
 }
 
 /* set a waitable timer */
diff --git a/server/trace.c b/server/trace.c
index db86a582501..b614e7a2e1c 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -890,9 +890,9 @@ static void dump_select_request( const struct select_request *req )
 static void dump_create_event_request( const struct create_event_request *req )
 {
     fprintf( stderr, " access=%08x,", req->access );
+    fprintf( stderr, " attributes=%08x,", req->attributes );
     fprintf( stderr, " manual_reset=%d,", req->manual_reset );
     fprintf( stderr, " initial_state=%d,", req->initial_state );
-    fprintf( stderr, " inherit=%d,", req->inherit );
     fprintf( stderr, " name=" );
     dump_varargs_unicode_str( cur_size );
 }
@@ -911,7 +911,7 @@ static void dump_event_op_request( const struct event_op_request *req )
 static void dump_open_event_request( const struct open_event_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 );
 }
@@ -924,8 +924,8 @@ static void dump_open_event_reply( const struct open_event_reply *req )
 static void dump_create_mutex_request( const struct create_mutex_request *req )
 {
     fprintf( stderr, " access=%08x,", req->access );
+    fprintf( stderr, " attributes=%08x,", req->attributes );
     fprintf( stderr, " owned=%d,", req->owned );
-    fprintf( stderr, " inherit=%d,", req->inherit );
     fprintf( stderr, " name=" );
     dump_varargs_unicode_str( cur_size );
 }
@@ -948,7 +948,7 @@ static void dump_release_mutex_reply( const struct release_mutex_reply *req )
 static void dump_open_mutex_request( const struct open_mutex_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 );
 }
@@ -961,9 +961,9 @@ static void dump_open_mutex_reply( const struct open_mutex_reply *req )
 static void dump_create_semaphore_request( const struct create_semaphore_request *req )
 {
     fprintf( stderr, " access=%08x,", req->access );
+    fprintf( stderr, " attributes=%08x,", req->attributes );
     fprintf( stderr, " initial=%08x,", req->initial );
     fprintf( stderr, " max=%08x,", req->max );
-    fprintf( stderr, " inherit=%d,", req->inherit );
     fprintf( stderr, " name=" );
     dump_varargs_unicode_str( cur_size );
 }
@@ -987,7 +987,7 @@ static void dump_release_semaphore_reply( const struct release_semaphore_reply *
 static void dump_open_semaphore_request( const struct open_semaphore_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 );
 }
@@ -1438,11 +1438,11 @@ static void dump_next_change_notification_request( const struct next_change_noti
 
 static void dump_create_mapping_request( const struct create_mapping_request *req )
 {
+    fprintf( stderr, " access=%08x,", req->access );
+    fprintf( stderr, " attributes=%08x,", req->attributes );
     fprintf( stderr, " size_high=%d,", req->size_high );
     fprintf( stderr, " size_low=%d,", req->size_low );
     fprintf( stderr, " protect=%d,", req->protect );
-    fprintf( stderr, " access=%08x,", req->access );
-    fprintf( stderr, " inherit=%d,", req->inherit );
     fprintf( stderr, " file_handle=%p,", req->file_handle );
     fprintf( stderr, " name=" );
     dump_varargs_unicode_str( cur_size );
@@ -1456,7 +1456,7 @@ static void dump_create_mapping_reply( const struct create_mapping_reply *req )
 static void dump_open_mapping_request( const struct open_mapping_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 );
 }
@@ -1790,7 +1790,7 @@ static void dump_set_registry_notification_request( const struct set_registry_no
 static void dump_create_timer_request( const struct create_timer_request *req )
 {
     fprintf( stderr, " access=%08x,", req->access );
-    fprintf( stderr, " inherit=%d,", req->inherit );
+    fprintf( stderr, " attributes=%08x,", req->attributes );
     fprintf( stderr, " manual=%d,", req->manual );
     fprintf( stderr, " name=" );
     dump_varargs_unicode_str( cur_size );
@@ -1804,7 +1804,7 @@ static void dump_create_timer_reply( const struct create_timer_reply *req )
 static void dump_open_timer_request( const struct open_timer_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 );
 }
@@ -2140,13 +2140,13 @@ static void dump_cancel_async_request( const struct cancel_async_request *req )
 static void dump_create_named_pipe_request( const struct create_named_pipe_request *req )
 {
     fprintf( stderr, " access=%08x,", req->access );
+    fprintf( stderr, " attributes=%08x,", req->attributes );
     fprintf( stderr, " options=%08x,", req->options );
     fprintf( stderr, " flags=%08x,", req->flags );
     fprintf( stderr, " maxinstances=%08x,", req->maxinstances );
     fprintf( stderr, " outsize=%08x,", req->outsize );
     fprintf( stderr, " insize=%08x,", req->insize );
     fprintf( stderr, " timeout=%08x,", req->timeout );
-    fprintf( stderr, " inherit=%d,", req->inherit );
     fprintf( stderr, " name=" );
     dump_varargs_unicode_str( cur_size );
 }
@@ -2159,8 +2159,8 @@ static void dump_create_named_pipe_reply( const struct create_named_pipe_reply *
 static void dump_open_named_pipe_request( const struct open_named_pipe_request *req )
 {
     fprintf( stderr, " access=%08x,", req->access );
+    fprintf( stderr, " attributes=%08x,", req->attributes );
     fprintf( stderr, " flags=%08x,", req->flags );
-    fprintf( stderr, " inherit=%d,", req->inherit );
     fprintf( stderr, " name=" );
     dump_varargs_unicode_str( cur_size );
 }
@@ -3048,9 +3048,10 @@ static void dump_get_token_user_reply( const struct get_token_user_reply *req )
 
 static void dump_create_mailslot_request( const struct create_mailslot_request *req )
 {
+    fprintf( stderr, " access=%08x,", req->access );
+    fprintf( stderr, " attributes=%08x,", req->attributes );
     fprintf( stderr, " max_msgsize=%08x,", req->max_msgsize );
     fprintf( stderr, " read_timeout=%08x,", req->read_timeout );
-    fprintf( stderr, " inherit=%d,", req->inherit );
     fprintf( stderr, " name=" );
     dump_varargs_unicode_str( cur_size );
 }
@@ -3063,7 +3064,7 @@ static void dump_create_mailslot_reply( const struct create_mailslot_reply *req
 static void dump_open_mailslot_request( const struct open_mailslot_request *req )
 {
     fprintf( stderr, " access=%08x,", req->access );
-    fprintf( stderr, " inherit=%d,", req->inherit );
+    fprintf( stderr, " attributes=%08x,", req->attributes );
     fprintf( stderr, " sharing=%08x,", req->sharing );
     fprintf( stderr, " name=" );
     dump_varargs_unicode_str( cur_size );
diff --git a/server/winstation.c b/server/winstation.c
index a51315113a9..91cf703e3ca 100644
--- a/server/winstation.c
+++ b/server/winstation.c
@@ -27,6 +27,7 @@
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
+#include "winternl.h"
 
 #include "object.h"
 #include "handle.h"
@@ -322,7 +323,7 @@ DECL_HANDLER(open_winstation)
 {
     if (winstation_namespace)
         reply->handle = open_object( winstation_namespace, get_req_data(), get_req_data_size(),
-                                     &winstation_ops, req->access, req->inherit );
+                                     &winstation_ops, req->access, (req->inherit) ? OBJ_INHERIT:0 );
     else
         set_error( STATUS_OBJECT_NAME_NOT_FOUND );
 }
@@ -396,7 +397,8 @@ DECL_HANDLER(open_desktop)
                                              winstation, &full_len )))
         {
             reply->handle = open_object( winstation_namespace, full_name, full_len,
-                                         &desktop_ops, req->access, req->inherit );
+                                         &desktop_ops, req->access,
+                                         (req->inherit) ? OBJ_INHERIT:0 );
             free( full_name );
         }
         release_object( winstation );
-- 
GitLab