server: Try3: add case-sensitivity comparison flag to find_object & co

Vitaliy Margolen wine-patch at kievinfo.com
Mon Sep 19 17:07:23 CDT 2005


Diff from Try2: Combined with tests to object manager. Made all functions that
                deal with named objects pass Attributes part of
                OBJECT_ATTRIBUTES structure to the server. This replaces
                inherited flag.
                Fixed errors returned from wineserver's create_named_object to
                match native and fixed refcount "leak".
                
Diff from Try1: Fix hash calculation

Ok, this is a bit more then that. I removed case_sensitive flag from name space,
since it's no use anymore. OBJECT_ATTRIBUTES.Attributes should specify that
instead. 

Todo:
  Verify that kernel32 sets OBJ_CASE_INSENSITIVE flag when calling ntdll.

  
Vitaliy Margolen

changelog:
  Add case-sensitivity comparison flag to find_object & co
  Pass all object attributes to the server instead of just inherit flag
  Fix refcount "leak" in create_named_object and make it return correct error.
  Add few tests for object manager to test case-sensitivity
-------------- next part --------------
Index: dlls/ntdll/file.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/file.c,v
retrieving revision 1.99
diff -u -p -r1.99 file.c
--- dlls/ntdll/file.c	6 Sep 2005 14:09:42 -0000	1.99
+++ dlls/ntdll/file.c	19 Sep 2005 21:48:13 -0000
@@ -164,8 +164,8 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE ha
         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 ha
         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 );
@@ -1915,7 +1915,7 @@ NTSTATUS WINAPI NtUnlockFile( HANDLE hFi
  *
  */
 NTSTATUS WINAPI NtCreateNamedPipeFile( PHANDLE handle, ULONG access,
-                                       POBJECT_ATTRIBUTES oa, PIO_STATUS_BLOCK iosb,
+                                       POBJECT_ATTRIBUTES attr, PIO_STATUS_BLOCK iosb,
                                        ULONG sharing, ULONG dispo, ULONG options,
                                        ULONG pipe_type, ULONG read_mode, 
                                        ULONG completion_mode, ULONG max_inst,
@@ -1926,12 +1926,12 @@ NTSTATUS WINAPI NtCreateNamedPipeFile( P
     static const WCHAR leadin[] = {'\\','?','?','\\','P','I','P','E','\\'};
 
     TRACE("(%p %lx %s %p %lx %ld %lx %ld %ld %ld %ld %ld %ld %p)\n",
-          handle, access, debugstr_w(oa->ObjectName->Buffer), iosb, sharing, dispo,
+          handle, access, debugstr_w(attr->ObjectName->Buffer), iosb, sharing, dispo,
           options, pipe_type, read_mode, completion_mode, max_inst, inbound_quota,
           outbound_quota, timeout);
 
-    if (oa->ObjectName->Length < sizeof(leadin) ||
-        strncmpiW( oa->ObjectName->Buffer, 
+    if (attr->ObjectName->Length < sizeof(leadin) ||
+        strncmpiW( attr->ObjectName->Buffer, 
                    leadin, sizeof(leadin)/sizeof(leadin[0]) ))
         return STATUS_OBJECT_NAME_INVALID;
     /* assume we only get relative timeout, and storable in a DWORD as ms */
@@ -1949,9 +1949,9 @@ NTSTATUS WINAPI NtCreateNamedPipeFile( P
         req->outsize = outbound_quota;
         req->insize  = inbound_quota;
         req->timeout = timeout->QuadPart / -10000;
-        req->inherit = (oa->Attributes & OBJ_INHERIT) != 0;
-        wine_server_add_data( req, oa->ObjectName->Buffer + 4, 
-                              oa->ObjectName->Length - 4 * sizeof(WCHAR) );
+        req->attributes = (attr) ? attr->Attributes : 0;
+        wine_server_add_data( req, attr->ObjectName->Buffer + 4, 
+                              attr->ObjectName->Length - 4 * sizeof(WCHAR) );
         status = wine_server_call( req );
         if (!status) *handle = reply->handle;
     }
@@ -2046,7 +2046,7 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHA
     {
         req->max_msgsize = MaxMessageSize;
         req->read_timeout = TimeOut->QuadPart / -10000;
-        req->inherit = (attr->Attributes & OBJ_INHERIT) != 0;
+        req->attributes = (attr) ? attr->Attributes : 0;
         wine_server_add_data( req, attr->ObjectName->Buffer + 4,
                               attr->ObjectName->Length - 4*sizeof(WCHAR) );
         ret = wine_server_call( req );
Index: dlls/ntdll/sync.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/sync.c,v
retrieving revision 1.51
diff -u -p -r1.51 sync.c
--- dlls/ntdll/sync.c	21 Jun 2005 09:52:41 -0000	1.51
+++ dlls/ntdll/sync.c	19 Sep 2005 21:48:14 -0000
@@ -82,9 +82,9 @@ NTSTATUS WINAPI NtCreateSemaphore( OUT P
     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 PHA
     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 HANDL
     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*
     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
     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 
     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;
Index: dlls/ntdll/virtual.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/virtual.c,v
retrieving revision 1.67
diff -u -p -r1.67 virtual.c
--- dlls/ntdll/virtual.c	14 Sep 2005 10:36:58 -0000	1.67
+++ dlls/ntdll/virtual.c	19 Sep 2005 21:48:14 -0000
@@ -1652,7 +1656,7 @@ NTSTATUS WINAPI NtCreateSection( HANDLE 
         req->size_low    = size ? size->u.LowPart : 0;
         req->protect     = vprot;
         req->access      = access;
-        req->inherit     = (attr && (attr->Attributes & OBJ_INHERIT) != 0);
+        req->attributes  = (attr) ? attr->Attributes : 0;
         if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
         ret = wine_server_call( req );
         *handle = reply->handle;
@@ -1676,7 +1680,7 @@ NTSTATUS WINAPI NtOpenSection( HANDLE *h
     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;
     }
Index: dlls/ntdll/tests/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/tests/Makefile.in,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile.in
--- dlls/ntdll/tests/Makefile.in	11 May 2005 15:56:09 -0000	1.14
+++ dlls/ntdll/tests/Makefile.in	19 Sep 2005 21:48:14 -0000
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 TESTDLL   = ntdll.dll
-IMPORTS   = kernel32
+IMPORTS   = kernel32 ntdll
 
 CTESTS = \
 	atom.c \
@@ -13,6 +13,7 @@ CTESTS = \
 	info.c \
 	large_int.c \
 	path.c \
+	om.c \
 	reg.c \
 	rtl.c \
 	rtlbitmap.c \
Index: include/wine/server_protocol.h
===================================================================
RCS file: /home/wine/wine/include/wine/server_protocol.h,v
retrieving revision 1.156
diff -u -p -r1.156 server_protocol.h
--- include/wine/server_protocol.h	6 Sep 2005 14:10:53 -0000	1.156
+++ include/wine/server_protocol.h	19 Sep 2005 21:48:15 -0000
@@ -44,6 +44,15 @@ typedef unsigned int thread_id_t;
 #define FIRST_USER_HANDLE 0x0020
 #define LAST_USER_HANDLE  0xffef
 
+#define OBJ_INHERIT          0x00000002L
+#define OBJ_PERMANENT        0x00000010L
+#define OBJ_EXCLUSIVE        0x00000020L
+#define OBJ_CASE_INSENSITIVE 0x00000040L
+#define OBJ_OPENIF           0x00000080L
+#define OBJ_OPENLINK         0x00000100L
+#define OBJ_KERNEL_HANDLE    0x00000200L
+#define OBJ_VALID_ATTRIBUTES 0x000003F2L
+
 
 
 struct debug_event_exception
@@ -614,9 +623,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
@@ -644,7 +653,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
@@ -659,8 +668,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
@@ -688,7 +697,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
@@ -703,9 +712,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
@@ -734,7 +743,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
@@ -1404,7 +1413,7 @@ struct create_mapping_request
     int          size_low;
     int          protect;
     unsigned int access;
-    int          inherit;
+    unsigned int attributes;
     obj_handle_t file_handle;
     /* VARARG(name,unicode_str); */
 };
@@ -1429,7 +1438,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
@@ -1880,7 +1889,7 @@ struct create_timer_request
 {
     struct request_header __header;
     unsigned int access;
-    int          inherit;
+    unsigned int attributes;
     int          manual;
     /* VARARG(name,unicode_str); */
 };
@@ -1896,7 +1905,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 +2375,13 @@ struct cancel_async_reply
 struct create_named_pipe_request
 {
     struct request_header __header;
+    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 +2401,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
@@ -3530,7 +3539,7 @@ struct create_mailslot_request
     struct request_header __header;
     unsigned int   max_msgsize;
     unsigned int   read_timeout;
-    int            inherit;
+    unsigned int   attributes;
     /* VARARG(name,unicode_str); */
 };
 struct create_mailslot_reply
@@ -3545,7 +3554,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 +4215,6 @@ union generic_reply
     struct set_mailslot_info_reply set_mailslot_info_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 192
+#define SERVER_PROTOCOL_VERSION 193
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
Index: server/console.c
===================================================================
RCS file: /home/wine/wine/server/console.c,v
retrieving revision 1.59
diff -u -p -r1.59 console.c
--- server/console.c	12 Jul 2005 20:27:09 -0000	1.59
+++ server/console.c	19 Sep 2005 21:48:15 -0000
@@ -227,7 +227,7 @@ static struct object *create_console_inp
     console_input->history_index = 0;
     console_input->history_mode  = 0;
     console_input->edition_mode  = 0;
-    console_input->event         = create_event( NULL, 0, 1, 0 );
+    console_input->event         = create_event( NULL, 0, FALSE, 1, 0 );
 
     if (!console_input->history || !console_input->evt)
     {
Index: server/event.c
===================================================================
RCS file: /home/wine/wine/server/event.c,v
retrieving revision 1.31
diff -u -p -r1.31 event.c
--- server/event.c	9 Jun 2005 15:39:52 -0000	1.31
+++ server/event.c	19 Sep 2005 21:48:15 -0000
@@ -59,11 +59,12 @@ static const struct object_ops event_ops
 
 
 struct event *create_event( const WCHAR *name, size_t len,
+                            int case_sensitive,
                             int manual_reset, int initial_state )
 {
     struct event *event;
 
-    if ((event = create_named_object( sync_namespace, &event_ops, name, len )))
+    if ((event = create_named_object( sync_namespace, &event_ops, name, len, case_sensitive )))
     {
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
         {
@@ -147,9 +148,11 @@ DECL_HANDLER(create_event)
 
     reply->handle = 0;
     if ((event = create_event( get_req_data(), get_req_data_size(),
+                               IS_CASE_SENSITIVE( req->attributes ),
                                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,
+                                      IS_INHERIT( req->attributes ) );
         release_object( event );
     }
 }
@@ -158,7 +161,8 @@ 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 );
+                                 IS_CASE_SENSITIVE( req->attributes ),
+                                 &event_ops, req->access, IS_INHERIT( req->attributes ) );
 }
 
 /* do an event operation */
Index: server/handle.c
===================================================================
RCS file: /home/wine/wine/server/handle.c,v
retrieving revision 1.38
diff -u -p -r1.38 handle.c
--- server/handle.c	24 Aug 2005 18:33:50 -0000	1.38
+++ server/handle.c	19 Sep 2005 21:48:15 -0000
@@ -521,10 +521,11 @@ obj_handle_t duplicate_handle( struct pr
 
 /* 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 )
+                          int case_sensitive, const struct object_ops *ops,
+                          unsigned int access, int inherit )
 {
     obj_handle_t handle = 0;
-    struct object *obj = find_object( namespace, name, len );
+    struct object *obj = find_object( namespace, name, len, case_sensitive );
     if (obj)
     {
         if (ops && obj->ops != ops)
Index: server/handle.h
===================================================================
RCS file: /home/wine/wine/server/handle.h,v
retrieving revision 1.17
diff -u -p -r1.17 handle.h
--- server/handle.h	24 Aug 2005 18:33:50 -0000	1.17
+++ server/handle.h	19 Sep 2005 21:48:15 -0000
@@ -44,7 +44,8 @@ extern int set_handle_unix_fd( struct pr
 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 );
+                                 int case_sensitive, const struct object_ops *ops,
+                                 unsigned int access, int inherit );
 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 );
Index: server/mailslot.c
===================================================================
RCS file: /home/wine/wine/server/mailslot.c,v
retrieving revision 1.9
diff -u -p -r1.9 mailslot.c
--- server/mailslot.c	14 Jul 2005 12:18:05 -0000	1.9
+++ server/mailslot.c	19 Sep 2005 21:48:15 -0000
@@ -212,8 +212,8 @@ static void mailslot_queue_async( struct
     fd_queue_async_timeout( fd, apc, user, iosb, type, count, timeout );
 }
 
-static struct mailslot *create_mailslot( const WCHAR *name, size_t len, int max_msgsize,
-                                         int read_timeout )
+static struct mailslot *create_mailslot( const WCHAR *name, size_t len, int case_sensitive,
+                                         int max_msgsize, int read_timeout )
 {
     struct mailslot *mailslot;
     int fds[2];
@@ -225,7 +225,7 @@ static struct mailslot *create_mailslot(
         return NULL;
     }
 
-    mailslot = create_named_object( sync_namespace, &mailslot_ops, name, len );
+    mailslot = create_named_object( sync_namespace, &mailslot_ops, name, len, case_sensitive );
     if (!mailslot)
         return NULL;
 
@@ -258,11 +258,11 @@ static struct mailslot *create_mailslot(
     return NULL;
 }
 
-static struct mailslot *open_mailslot( const WCHAR *name, size_t len )
+static struct mailslot *open_mailslot( const WCHAR *name, size_t len, int case_sensitive )
 {
     struct object *obj;
 
-    obj = find_object( sync_namespace, name, len );
+    obj = find_object( sync_namespace, name, len, case_sensitive );
     if (obj)
     {
         if (obj->ops == &mailslot_ops)
@@ -352,11 +352,12 @@ DECL_HANDLER(create_mailslot)
 
     reply->handle = 0;
     mailslot = create_mailslot( get_req_data(), get_req_data_size(),
+                                IS_CASE_SENSITIVE( req->attributes ),
                                 req->max_msgsize, req->read_timeout );
     if (mailslot)
     {
         reply->handle = alloc_handle( current->process, mailslot,
-                                      GENERIC_READ, req->inherit );
+                                      GENERIC_READ, IS_INHERIT( req->attributes ) );
         release_object( mailslot );
     }
 }
@@ -375,7 +376,8 @@ DECL_HANDLER(open_mailslot)
         return;
     }
 
-    mailslot = open_mailslot( get_req_data(), get_req_data_size() );
+    mailslot = open_mailslot( get_req_data(), get_req_data_size(),
+                              IS_CASE_SENSITIVE( req->attributes ) );
     if (mailslot)
     {
         struct mail_writer *writer;
@@ -384,7 +386,7 @@ DECL_HANDLER(open_mailslot)
         if (writer)
         {
             reply->handle = alloc_handle( current->process, writer,
-                                          req->access, req->inherit );
+                                          req->access, IS_INHERIT( req->attributes ) );
             release_object( writer );
         }
         release_object( mailslot );
Index: server/main.c
===================================================================
RCS file: /home/wine/wine/server/main.c,v
retrieving revision 1.34
diff -u -p -r1.34 main.c
--- server/main.c	25 May 2005 18:41:09 -0000	1.34
+++ server/main.c	19 Sep 2005 21:48:15 -0000
@@ -130,7 +130,7 @@ int main( int argc, char *argv[] )
 
     sock_init();
     open_master_socket();
-    sync_namespace = create_namespace( 37, TRUE );
+    sync_namespace = create_namespace( 37 );
     setvbuf( stderr, NULL, _IOLBF, 0 );
 
     if (debug_level) fprintf( stderr, "wineserver: starting (pid=%ld)\n", (long) getpid() );
Index: server/mapping.c
===================================================================
RCS file: /home/wine/wine/server/mapping.c,v
retrieving revision 1.56
diff -u -p -r1.56 mapping.c
--- server/mapping.c	15 Aug 2005 14:50:06 -0000	1.56
+++ server/mapping.c	19 Sep 2005 21:48:15 -0000
@@ -270,14 +270,14 @@ inline static int get_file_size( struct 
 }
 
 static struct object *create_mapping( file_pos_t size, int protect, obj_handle_t handle,
-                                      const WCHAR *name, size_t len )
+                                      const WCHAR *name, size_t len, int case_sensitive )
 {
     struct mapping *mapping;
     int access = 0;
 
     if (!page_mask) init_page_size();
 
-    if (!(mapping = create_named_object( sync_namespace, &mapping_ops, name, len )))
+    if (!(mapping = create_named_object( sync_namespace, &mapping_ops, name, len, case_sensitive )))
         return NULL;
     if (get_error() == STATUS_OBJECT_NAME_COLLISION)
         return &mapping->obj;  /* Nothing else to do */
@@ -377,9 +377,10 @@ DECL_HANDLER(create_mapping)
 
     reply->handle = 0;
     if ((obj = create_mapping( size, req->protect, req->file_handle,
-                               get_req_data(), get_req_data_size() )))
+                               get_req_data(), get_req_data_size(),
+                               IS_CASE_SENSITIVE( req->attributes ) )))
     {
-        reply->handle = alloc_handle( current->process, obj, req->access, req->inherit );
+        reply->handle = alloc_handle( current->process, obj, req->access, IS_INHERIT( req->attributes ) );
         release_object( obj );
     }
 }
@@ -388,7 +389,8 @@ 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 );
+                                 IS_CASE_SENSITIVE( req->attributes ),
+                                 &mapping_ops, req->access, IS_INHERIT( req->attributes ) );
 }
 
 /* get a mapping information */
Index: server/mutex.c
===================================================================
RCS file: /home/wine/wine/server/mutex.c,v
retrieving revision 1.29
diff -u -p -r1.29 mutex.c
--- server/mutex.c	9 Jun 2005 15:39:52 -0000	1.29
+++ server/mutex.c	19 Sep 2005 21:48:15 -0000
@@ -61,11 +61,12 @@ static const struct object_ops mutex_ops
 };
 
 
-static struct mutex *create_mutex( const WCHAR *name, size_t len, int owned )
+static struct mutex *create_mutex( const WCHAR *name, size_t len, int case_sensitive,
+                                   int owned )
 {
     struct mutex *mutex;
 
-    if ((mutex = create_named_object( sync_namespace, &mutex_ops, name, len )))
+    if ((mutex = create_named_object( sync_namespace, &mutex_ops, name, len, case_sensitive )))
     {
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
         {
@@ -171,9 +172,12 @@ DECL_HANDLER(create_mutex)
     struct mutex *mutex;
 
     reply->handle = 0;
-    if ((mutex = create_mutex( get_req_data(), get_req_data_size(), req->owned )))
+    if ((mutex = create_mutex( get_req_data(), get_req_data_size(),
+                               IS_CASE_SENSITIVE( req->attributes ),
+                               req->owned )))
     {
-        reply->handle = alloc_handle( current->process, mutex, req->access, req->inherit );
+        reply->handle = alloc_handle( current->process, mutex, req->access,
+                                      IS_INHERIT( req->attributes ) );
         release_object( mutex );
     }
 }
@@ -182,7 +186,8 @@ 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 );
+                                 IS_CASE_SENSITIVE( req->attributes ),
+                                 &mutex_ops, req->access, IS_INHERIT( req->attributes ) );
 }
 
 /* release a mutex */
Index: server/named_pipe.c
===================================================================
RCS file: /home/wine/wine/server/named_pipe.c,v
retrieving revision 1.47
diff -u -p -r1.47 named_pipe.c
--- server/named_pipe.c	6 Sep 2005 14:10:53 -0000	1.47
+++ server/named_pipe.c	19 Sep 2005 21:48:15 -0000
@@ -397,7 +397,7 @@ static int pipe_server_flush( struct fd 
 
         /* this kind of sux - 
            there's no unix way to be alerted when a pipe becomes empty */
-        server->event = create_event( NULL, 0, 0, 0 );
+        server->event = create_event( NULL, 0, FALSE, 0, 0 );
         if (!server->event)
             return 0;
         gettimeofday( &tv, NULL );
@@ -440,11 +440,11 @@ static int pipe_client_get_info( struct 
     return flags;
 }
 
-static struct named_pipe *create_named_pipe( const WCHAR *name, size_t len )
+static struct named_pipe *create_named_pipe( const WCHAR *name, size_t len, int case_sensitive )
 {
     struct named_pipe *pipe;
 
-    pipe = create_named_object( sync_namespace, &named_pipe_ops, name, len );
+    pipe = create_named_object( sync_namespace, &named_pipe_ops, name, len, case_sensitive );
     if (pipe)
     {
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
@@ -458,11 +458,11 @@ static struct named_pipe *create_named_p
     return pipe;
 }
 
-static struct named_pipe *open_named_pipe( const WCHAR *name, size_t len )
+static struct named_pipe *open_named_pipe( const WCHAR *name, size_t len, int case_sensitive )
 {
     struct object *obj;
 
-    if ((obj = find_object( sync_namespace, name, len )))
+    if ((obj = find_object( sync_namespace, name, len, case_sensitive )))
     {
         if (obj->ops == &named_pipe_ops) return (struct named_pipe *)obj;
         release_object( obj );
@@ -548,7 +548,8 @@ DECL_HANDLER(create_named_pipe)
     struct pipe_server *server;
 
     reply->handle = 0;
-    pipe = create_named_pipe( get_req_data(), get_req_data_size() );
+    pipe = create_named_pipe( get_req_data(), get_req_data_size(),
+                              IS_CASE_SENSITIVE( req->attributes ) );
     if (!pipe)
         return;
 
@@ -583,7 +584,8 @@ DECL_HANDLER(create_named_pipe)
     if (server)
     {
         reply->handle = alloc_handle( current->process, server,
-                                      GENERIC_READ|GENERIC_WRITE, req->inherit );
+                                      GENERIC_READ|GENERIC_WRITE,
+                                      IS_INHERIT( req->attributes ) );
         server->pipe->instances++;
         release_object( server );
     }
@@ -598,7 +600,8 @@ DECL_HANDLER(open_named_pipe)
     struct named_pipe *pipe;
     int fds[2];
 
-    pipe = open_named_pipe( get_req_data(), get_req_data_size() );
+    pipe = open_named_pipe( get_req_data(), get_req_data_size(),
+                            IS_INHERIT( req->attributes ) );
     if (!pipe)
     {
         set_error( STATUS_NO_SUCH_FILE );
@@ -645,7 +648,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, IS_INHERIT( req->attributes ) );
             }
         }
         else
@@ -697,7 +700,7 @@ DECL_HANDLER(wait_named_pipe)
     struct named_pipe *pipe;
     struct pipe_server *server;
 
-    if (!(pipe = open_named_pipe( get_req_data(), get_req_data_size() )))
+    if (!(pipe = open_named_pipe( get_req_data(), get_req_data_size(), FALSE )))
     {
         set_error( STATUS_PIPE_NOT_AVAILABLE );
         return;
Index: server/object.c
===================================================================
RCS file: /home/wine/wine/server/object.c,v
retrieving revision 1.33
diff -u -p -r1.33 object.c
--- server/object.c	9 Jun 2005 15:39:52 -0000	1.33
+++ server/object.c	19 Sep 2005 21:48:15 -0000
@@ -44,7 +44,6 @@ struct object_name
 struct namespace
 {
     unsigned int        hash_size;       /* size of hash table */
-    int                 case_sensitive;  /* are names case sensitive? */
     struct list         names[1];        /* array of hash entry lists */
 };
 
@@ -92,8 +91,7 @@ static int get_name_hash( const struct n
 {
     WCHAR hash = 0;
     len /= sizeof(WCHAR);
-    if (namespace->case_sensitive) while (len--) hash ^= *name++;
-    else while (len--) hash ^= tolowerW(*name++);
+    while (len--) hash ^=  tolowerW(*name++);
     return hash % namespace->hash_size;
 }
 
@@ -157,22 +155,22 @@ void *alloc_object( const struct object_
 }
 
 void *create_named_object( struct namespace *namespace, const struct object_ops *ops,
-                           const WCHAR *name, size_t len )
+                           const WCHAR *name, size_t len, int case_sensitive )
 {
     struct object *obj;
     struct object_name *name_ptr;
 
     if (!name || !len) return alloc_object( ops );
 
-    if ((obj = find_object( namespace, name, len )))
+    if ((obj = find_object( namespace, name, len, case_sensitive )))
     {
-        if (obj->ops == ops)
+        if (obj->ops != ops)
         {
-            set_error( STATUS_OBJECT_NAME_COLLISION );
-            return obj;
+            release_object( obj );
+            obj = NULL;
         }
-        set_error( STATUS_OBJECT_TYPE_MISMATCH );
-        return NULL;
+        set_error( STATUS_OBJECT_NAME_COLLISION );
+        return obj;
     }
     if (!(name_ptr = alloc_name( name, len ))) return NULL;
     if ((obj = alloc_object( ops )))
@@ -225,28 +223,23 @@ void release_object( void *ptr )
 }
 
 /* find an object by its name; the refcount is incremented */
-struct object *find_object( const struct namespace *namespace, const WCHAR *name, size_t len )
+struct object *find_object( const struct namespace *namespace, const WCHAR *name, size_t len, int case_sensitive )
 {
     const struct list *list, *p;
 
     if (!name || !len) return NULL;
 
     list = &namespace->names[ get_name_hash( namespace, name, len ) ];
-    if (namespace->case_sensitive)
+    LIST_FOR_EACH( p, list )
     {
-        LIST_FOR_EACH( p, list )
+        const struct object_name *ptr = LIST_ENTRY( p, const struct object_name, entry );
+        if (ptr->len != len) continue;
+        if (case_sensitive)
         {
-            const struct object_name *ptr = LIST_ENTRY( p, const struct object_name, entry );
-            if (ptr->len != len) continue;
             if (!memcmp( ptr->name, name, len )) return grab_object( ptr->obj );
         }
-    }
-    else
-    {
-        LIST_FOR_EACH( p, list )
+        else
         {
-            const struct object_name *ptr = LIST_ENTRY( p, const struct object_name, entry );
-            if (ptr->len != len) continue;
             if (!strncmpiW( ptr->name, name, len/sizeof(WCHAR) )) return grab_object( ptr->obj );
         }
     }
@@ -254,7 +247,7 @@ struct object *find_object( const struct
 }
 
 /* allocate a namespace */
-struct namespace *create_namespace( unsigned int hash_size, int case_sensitive )
+struct namespace *create_namespace( unsigned int hash_size )
 {
     struct namespace *namespace;
     unsigned int i;
@@ -263,7 +256,6 @@ struct namespace *create_namespace( unsi
     if (namespace)
     {
         namespace->hash_size      = hash_size;
-        namespace->case_sensitive = case_sensitive;
         for (i = 0; i < hash_size; i++) list_init( &namespace->names[i] );
     }
     return namespace;
Index: server/object.h
===================================================================
RCS file: /home/wine/wine/server/object.h,v
retrieving revision 1.66
diff -u -p -r1.66 object.h
--- server/object.h	19 Aug 2005 14:01:43 -0000	1.66
+++ server/object.h	19 Sep 2005 21:48:15 -0000
@@ -29,6 +29,9 @@
 #include "wine/server_protocol.h"
 #include "wine/list.h"
 
+#define IS_CASE_SENSITIVE(a) (((a)&OBJ_CASE_INSENSITIVE)==0)
+#define IS_INHERIT(a) ((a)&OBJ_INHERIT)
+
 #define DEBUG_OBJECTS
 
 /* kernel objects */
@@ -94,13 +97,14 @@ extern void *alloc_object( const struct 
 extern const WCHAR *get_object_name( struct object *obj, size_t *len );
 extern void dump_object_name( struct object *obj );
 extern void *create_named_object( struct namespace *namespace, const struct object_ops *ops,
-                                  const WCHAR *name, size_t len );
-extern struct namespace *create_namespace( unsigned int hash_size, int case_sensitive );
+                                  const WCHAR *name, size_t len, int case_sensitive );
+extern struct namespace *create_namespace( unsigned int hash_size );
 /* grab/release_object can take any pointer, but you better make sure */
 /* that the thing pointed to starts with a struct object... */
 extern struct object *grab_object( void *obj );
 extern void release_object( void *obj );
-extern struct object *find_object( const struct namespace *namespace, const WCHAR *name, size_t len );
+extern struct object *find_object( const struct namespace *namespace, const WCHAR *name, size_t len,
+                                   int case_sensitive );
 extern int no_add_queue( struct object *obj, struct wait_queue_entry *entry );
 extern int no_satisfied( struct object *obj, struct thread *thread );
 extern int no_signal( struct object *obj, unsigned int access );
@@ -115,7 +119,7 @@ extern void dump_objects(void);
 
 struct event;
 
-extern struct event *create_event( const WCHAR *name, size_t len,
+extern struct event *create_event( const WCHAR *name, size_t len, int case_sensitive,
                                    int manual_reset, int initial_state );
 extern struct event *get_event_obj( struct process *process, obj_handle_t handle, unsigned int access );
 extern void pulse_event( struct event *event );
Index: server/process.c
===================================================================
RCS file: /home/wine/wine/server/process.c,v
retrieving revision 1.140
diff -u -p -r1.140 process.c
--- server/process.c	6 Sep 2005 10:25:11 -0000	1.140
+++ server/process.c	19 Sep 2005 21:48:15 -0000
@@ -993,7 +993,7 @@ DECL_HANDLER(init_process_done)
     generate_startup_debug_events( process, req->entry );
     set_process_startup_state( process, STARTUP_DONE );
 
-    if (req->gui) process->idle_event = create_event( NULL, 0, 1, 0 );
+    if (req->gui) process->idle_event = create_event( NULL, 0, FALSE, 1, 0 );
     if (current->suspend + process->suspend > 0) stop_thread( current );
     if (process->debugger) set_process_debug_flag( process, 1 );
 }
Index: server/protocol.def
===================================================================
RCS file: /home/wine/wine/server/protocol.def,v
retrieving revision 1.155
diff -u -p -r1.155 protocol.def
--- server/protocol.def	6 Sep 2005 14:10:53 -0000	1.155
+++ server/protocol.def	19 Sep 2005 21:48:16 -0000
@@ -60,6 +60,15 @@ typedef unsigned int thread_id_t;
 #define FIRST_USER_HANDLE 0x0020  /* first possible value for low word of user handle */
 #define LAST_USER_HANDLE  0xffef  /* last possible value for low word of user handle */
 
+#define OBJ_INHERIT          0x00000002L
+#define OBJ_PERMANENT        0x00000010L
+#define OBJ_EXCLUSIVE        0x00000020L
+#define OBJ_CASE_INSENSITIVE 0x00000040L
+#define OBJ_OPENIF           0x00000080L
+#define OBJ_OPENLINK         0x00000100L
+#define OBJ_KERNEL_HANDLE    0x00000200L
+#define OBJ_VALID_ATTRIBUTES 0x000003F2L
+
 
 /* definitions of the event data depending on the event code */
 struct debug_event_exception
@@ -496,9 +505,9 @@ enum apc_type { APC_NONE, APC_USER, APC_
 /* 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 */
@@ -515,7 +524,7 @@ enum event_op { PULSE_EVENT, SET_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 */
@@ -525,8 +534,8 @@ enum event_op { PULSE_EVENT, SET_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 */
@@ -544,7 +553,7 @@ enum event_op { PULSE_EVENT, SET_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 */
@@ -554,9 +563,9 @@ enum event_op { PULSE_EVENT, SET_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 */
@@ -575,7 +584,7 @@ enum event_op { PULSE_EVENT, SET_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 */
@@ -1042,7 +1051,7 @@ enum char_info_mode
     int          size_low;      /* mapping size */
     int          protect;       /* protection flags (see below) */
     unsigned int access;        /* wanted access rights */
-    int          inherit;       /* inherit flag */
+    unsigned int attributes;    /* object attributes */
     obj_handle_t file_handle;   /* file handle */
     VARARG(name,unicode_str);   /* object name */
 @REPLY
@@ -1062,7 +1071,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 */
@@ -1355,7 +1364,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
@@ -1366,7 +1375,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 +1689,13 @@ enum message_type
 
 /* Create a named pipe */
 @REQ(create_named_pipe)
+    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 +1710,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 */
@@ -2473,7 +2482,7 @@ enum message_type
 @REQ(create_mailslot)
     unsigned int   max_msgsize;
     unsigned int   read_timeout;
-    int            inherit;
+    unsigned int   attributes;    /* object attributes */
     VARARG(name,unicode_str);     /* mailslot name */
 @REPLY
     obj_handle_t   handle;        /* handle to the mailslot */
@@ -2483,7 +2492,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
Index: server/semaphore.c
===================================================================
RCS file: /home/wine/wine/server/semaphore.c,v
retrieving revision 1.29
diff -u -p -r1.29 semaphore.c
--- server/semaphore.c	9 Jun 2005 15:39:52 -0000	1.29
+++ server/semaphore.c	19 Sep 2005 21:48:16 -0000
@@ -59,6 +59,7 @@ static const struct object_ops semaphore
 
 
 static struct semaphore *create_semaphore( const WCHAR *name, size_t len,
+                                           int case_sensitive,
                                            unsigned int initial, unsigned int max )
 {
     struct semaphore *sem;
@@ -68,7 +69,7 @@ static struct semaphore *create_semaphor
         set_error( STATUS_INVALID_PARAMETER );
         return NULL;
     }
-    if ((sem = create_named_object( sync_namespace, &semaphore_ops, name, len )))
+    if ((sem = create_named_object( sync_namespace, &semaphore_ops, name, len, case_sensitive )))
     {
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
         {
@@ -147,9 +148,11 @@ DECL_HANDLER(create_semaphore)
 
     reply->handle = 0;
     if ((sem = create_semaphore( get_req_data(), get_req_data_size(),
+                                 IS_CASE_SENSITIVE( req->attributes ),
                                  req->initial, req->max )))
     {
-        reply->handle = alloc_handle( current->process, sem, req->access, req->inherit );
+        reply->handle = alloc_handle( current->process, sem, req->access,
+                                      IS_INHERIT( req->attributes ) );
         release_object( sem );
     }
 }
@@ -158,7 +161,8 @@ 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 );
+                                 IS_CASE_SENSITIVE( req->attributes ), &semaphore_ops,
+                                 req->access, IS_INHERIT( req->attributes ) );
 }
 
 /* release a semaphore */
Index: server/timer.c
===================================================================
RCS file: /home/wine/wine/server/timer.c,v
retrieving revision 1.28
diff -u -p -r1.28 timer.c
--- server/timer.c	9 Jun 2005 15:39:52 -0000	1.28
+++ server/timer.c	19 Sep 2005 21:48:16 -0000
@@ -67,11 +67,12 @@ static const struct object_ops timer_ops
 
 
 /* create a timer object */
-static struct timer *create_timer( const WCHAR *name, size_t len, int manual )
+static struct timer *create_timer( const WCHAR *name, size_t len, int case_sensitive,
+                                   int manual )
 {
     struct timer *timer;
 
-    if ((timer = create_named_object( sync_namespace, &timer_ops, name, len )))
+    if ((timer = create_named_object( sync_namespace, &timer_ops, name, len, case_sensitive )))
     {
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
         {
@@ -204,9 +205,12 @@ DECL_HANDLER(create_timer)
     struct timer *timer;
 
     reply->handle = 0;
-    if ((timer = create_timer( get_req_data(), get_req_data_size(), req->manual )))
+    if ((timer = create_timer( get_req_data(), get_req_data_size(),
+                               IS_CASE_SENSITIVE( req->attributes ),
+                               IS_INHERIT( req->attributes ) )))
     {
-        reply->handle = alloc_handle( current->process, timer, req->access, req->inherit );
+        reply->handle = alloc_handle( current->process, timer, req->access,
+                                      IS_INHERIT( req->attributes ) );
         release_object( timer );
     }
 }
@@ -215,7 +219,8 @@ 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 );
+                                 IS_CASE_SENSITIVE( req->attributes ),
+                                 &timer_ops, req->access, IS_INHERIT( req->attributes ) );
 }
 
 /* set a waitable timer */
Index: server/trace.c
===================================================================
RCS file: /home/wine/wine/server/trace.c,v
retrieving revision 1.263
diff -u -p -r1.263 trace.c
--- server/trace.c	6 Sep 2005 14:10:53 -0000	1.263
+++ server/trace.c	19 Sep 2005 21:48:16 -0000
@@ -891,9 +891,9 @@ static void dump_select_request( const s
 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 );
 }
@@ -912,7 +912,7 @@ static void dump_event_op_request( const
 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 );
 }
@@ -925,8 +925,8 @@ static void dump_open_event_reply( const
 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 );
 }
@@ -949,7 +949,7 @@ static void dump_release_mutex_reply( co
 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 );
 }
@@ -962,9 +962,9 @@ static void dump_open_mutex_reply( const
 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 );
 }
@@ -988,7 +988,7 @@ static void dump_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 );
 }
@@ -1443,7 +1443,7 @@ static void dump_create_mapping_request(
     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, " attributes=%08x,", req->attributes );
     fprintf( stderr, " file_handle=%p,", req->file_handle );
     fprintf( stderr, " name=" );
     dump_varargs_unicode_str( cur_size );
@@ -1457,7 +1457,7 @@ static void dump_create_mapping_reply( c
 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 );
 }
@@ -1791,7 +1791,7 @@ static void dump_set_registry_notificati
 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 );
@@ -1805,7 +1805,7 @@ static void dump_create_timer_reply( con
 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( c
 
 static void dump_create_named_pipe_request( const struct create_named_pipe_request *req )
 {
+    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
 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 );
 }
@@ -3050,7 +3050,7 @@ static void dump_create_mailslot_request
 {
     fprintf( stderr, " max_msgsize=%08x,", req->max_msgsize );
     fprintf( stderr, " read_timeout=%08x,", req->read_timeout );
-    fprintf( stderr, " inherit=%d,", req->inherit );
+    fprintf( stderr, " attributes=%08x,", req->attributes );
     fprintf( stderr, " name=" );
     dump_varargs_unicode_str( cur_size );
 }
@@ -3063,7 +3063,7 @@ static void dump_create_mailslot_reply( 
 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 );
Index: server/winstation.c
===================================================================
RCS file: /home/wine/wine/server/winstation.c,v
retrieving revision 1.10
diff -u -p -r1.10 winstation.c
--- server/winstation.c	11 Jul 2005 18:05:50 -0000	1.10
+++ server/winstation.c	19 Sep 2005 21:48:16 -0000
@@ -83,7 +83,7 @@ static struct winstation *create_winstat
 {
     struct winstation *winstation;
 
-    if (!winstation_namespace && !(winstation_namespace = create_namespace( 7, FALSE )))
+    if (!winstation_namespace && !(winstation_namespace = create_namespace( 7 )))
         return NULL;
 
     if (memchrW( name, '\\', len / sizeof(WCHAR) ))  /* no backslash allowed in name */
@@ -92,7 +92,7 @@ static struct winstation *create_winstat
         return NULL;
     }
 
-    if ((winstation = create_named_object( winstation_namespace, &winstation_ops, name, len )))
+    if ((winstation = create_named_object( winstation_namespace, &winstation_ops, name, len, FALSE )))
     {
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
         {
@@ -181,7 +181,7 @@ static struct desktop *create_desktop( c
 
     if (!(full_name = build_desktop_name( name, len, winstation, &full_len ))) return NULL;
 
-    if ((desktop = create_named_object( winstation_namespace, &desktop_ops, full_name, full_len )))
+    if ((desktop = create_named_object( winstation_namespace, &desktop_ops, full_name, full_len, FALSE )))
     {
         if (get_error() != STATUS_OBJECT_NAME_COLLISION)
         {
@@ -322,7 +322,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 );
+                                     FALSE, &winstation_ops, req->access, req->inherit );
     else
         set_error( STATUS_OBJECT_NAME_NOT_FOUND );
 }
@@ -395,7 +395,7 @@ DECL_HANDLER(open_desktop)
         if ((full_name = build_desktop_name( get_req_data(), get_req_data_size(),
                                              winstation, &full_len )))
         {
-            reply->handle = open_object( winstation_namespace, full_name, full_len,
+            reply->handle = open_object( winstation_namespace, full_name, full_len, FALSE,
                                          &desktop_ops, req->access, req->inherit );
             free( full_name );
         }
--- /dev/null	2005-03-19 12:36:14.000000000 -0700
+++ dlls/ntdll/tests/om.c	2005-09-19 15:34:15.000000000 -0600
@@ -0,0 +1,82 @@
+/*
+ * Unit test suite for object manager functions
+ *
+ * Copyright 2005 Robert Shearman
+ * Copyright 2005 Vitaliy Margolen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "ntdll_test.h"
+#include "winternl.h"
+#include "stdio.h"
+#include "winnt.h"
+#include "stdlib.h"
+
+void test_case_sensitive (void)
+{
+    WCHAR buffer1[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s','\\','t','e','s','t',0};
+    WCHAR buffer2[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s','\\','T','e','s','t',0};
+    WCHAR buffer3[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s','\\','T','E','s','t',0};
+    WCHAR buffer4[] = {'\\','B','A','S','E','N','a','m','e','d','O','b','j','e','c','t','s','\\','t','e','s','t',0};
+    HANDLE Event, Mutant, h;
+    NTSTATUS status;
+    OBJECT_ATTRIBUTES attr;
+    UNICODE_STRING str;
+
+    RtlInitUnicodeString(&str, buffer1);
+    InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
+    status = NtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
+    ok(status == STATUS_SUCCESS, "Failed to create Mutant(%08lx)\n", status);
+
+    status = NtCreateEvent(&Event, GENERIC_ALL, &attr, FALSE, FALSE);
+    ok(status == STATUS_OBJECT_NAME_COLLISION,
+        "NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08lx)\n", status);
+
+    RtlInitUnicodeString(&str, buffer2);
+    InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
+    status = NtCreateEvent(&Event, GENERIC_ALL, &attr, FALSE, FALSE);
+    ok(status == STATUS_SUCCESS, "Failed to create Event(%08lx)\n", status);
+
+    RtlInitUnicodeString(&str, buffer3);
+    InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
+    status = NtOpenMutant(&h, GENERIC_ALL, &attr);
+    ok(status == STATUS_OBJECT_TYPE_MISMATCH,
+        "NtOpenMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08lx)\n", status);
+
+    NtClose(Mutant);
+
+    RtlInitUnicodeString(&str, buffer4);
+    InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
+    status = NtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
+    ok(status == STATUS_OBJECT_NAME_COLLISION,
+        "NtCreateMutant should have failed with STATUS_OBJECT_NAME_COLLISION got(%08lx)\n", status);
+
+    status = NtCreateEvent(&h, GENERIC_ALL, &attr, FALSE, FALSE);
+    ok(status == STATUS_OBJECT_NAME_COLLISION,
+        "NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08lx)\n", status);
+
+    attr.Attributes = 0;
+    status = NtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
+    todo_wine ok(status == STATUS_OBJECT_PATH_NOT_FOUND,
+        "NtCreateMutant should have failed with STATUS_OBJECT_PATH_NOT_FOUND got(%08lx)\n", status);
+
+    NtClose(Event);
+}
+
+START_TEST(om)
+{
+    test_case_sensitive();
+}


More information about the wine-patches mailing list