wine/ server/winstation.c server/object.h serv ...

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 1 04:22:38 CST 2005


ChangeSet ID:	21014
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/01 04:22:38

Modified files:
	server         : winstation.c object.h object.c main.c 
	dlls/ntdll/tests: om.c 

Log message:
	Vitaliy Margolen <wine-patch at kievinfo.com>
	- Use OBJ_CASE_INSENSITIVE in object lookup.
	- Remove case_sensitive flag from namespace.
	- Remove todo_wine from now succeeding tests.

Patch: http://cvs.winehq.org/patch.py?id=21014

Old revision  New revision  Changes     Path
 1.12          1.13          +1 -1       wine/server/winstation.c
 1.67          1.68          +1 -1       wine/server/object.h
 1.35          1.36          +11 -17     wine/server/object.c
 1.34          1.35          +1 -1       wine/server/main.c
 1.1           1.2           +2 -2       wine/dlls/ntdll/tests/om.c

Index: wine/server/winstation.c
diff -u -p wine/server/winstation.c:1.12 wine/server/winstation.c:1.13
--- wine/server/winstation.c	1 Nov 2005 10:22:38 -0000
+++ /dev/null	1 Nov 2005 10:22:38 -0000
@@ -84,7 +84,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 */
Index: wine/server/object.h
diff -u -p wine/server/object.h:1.67 wine/server/object.h:1.68
--- wine/server/object.h	1 Nov 2005 10:22:38 -0000
+++ /dev/null	1 Nov 2005 10:22:38 -0000
@@ -95,7 +95,7 @@ extern const WCHAR *get_object_name( str
 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, unsigned int attributes );
-extern struct namespace *create_namespace( unsigned int hash_size, 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 );
Index: wine/server/object.c
diff -u -p wine/server/object.c:1.35 wine/server/object.c:1.36
--- wine/server/object.c	1 Nov 2005 10:22:38 -0000
+++ /dev/null	1 Nov 2005 10:22:38 -0000
@@ -28,6 +28,8 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "winternl.h"
+
 #include "file.h"
 #include "thread.h"
 #include "unicode.h"
@@ -44,7 +46,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 +93,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;
 }
 
@@ -233,29 +233,24 @@ struct object *find_object( const struct
     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 (attributes & OBJ_CASE_INSENSITIVE)
         {
-            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 );
+            if (!strncmpiW( ptr->name, name, len/sizeof(WCHAR) )) 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 );
+            if (!memcmp( ptr->name, name, len )) return grab_object( ptr->obj );
         }
     }
     return NULL;
 }
 
 /* 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;
@@ -264,7 +259,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: wine/server/main.c
diff -u -p wine/server/main.c:1.34 wine/server/main.c:1.35
--- wine/server/main.c	1 Nov 2005 10:22:38 -0000
+++ /dev/null	1 Nov 2005 10:22:38 -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: wine/dlls/ntdll/tests/om.c
diff -u -p wine/dlls/ntdll/tests/om.c:1.1 wine/dlls/ntdll/tests/om.c:1.2
--- wine/dlls/ntdll/tests/om.c	1 Nov 2005 10:22:38 -0000
+++ /dev/null	1 Nov 2005 10:22:38 -0000
@@ -63,7 +63,7 @@ void test_case_sensitive (void)
     pRtlInitUnicodeString(&str, buffer3);
     InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
     status = pNtOpenMutant(&h, GENERIC_ALL, &attr);
-    todo_wine ok(status == STATUS_OBJECT_TYPE_MISMATCH,
+    ok(status == STATUS_OBJECT_TYPE_MISMATCH,
         "NtOpenMutant should have failed with STATUS_OBJECT_TYPE_MISMATCH got(%08lx)\n", status);
 
     pNtClose(Mutant);
@@ -71,7 +71,7 @@ void test_case_sensitive (void)
     pRtlInitUnicodeString(&str, buffer4);
     InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
     status = pNtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
-    todo_wine ok(status == STATUS_OBJECT_NAME_COLLISION,
+    ok(status == STATUS_OBJECT_NAME_COLLISION,
         "NtCreateMutant should have failed with STATUS_OBJECT_NAME_COLLISION got(%08lx)\n", status);
 
     status = pNtCreateEvent(&h, GENERIC_ALL, &attr, FALSE, FALSE);



More information about the wine-cvs mailing list