diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index 00e3141dbc3ce17d62c9969afcaaf391f20d08a3..d995cf7459c9a3cb195f7d9d4ad46be9b2865669 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -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); diff --git a/server/main.c b/server/main.c index 3e25868211491c3cf236468e28d8929620193cb9..6609a3aae0010bc305a99ae117a9df153684c9ee 100644 --- a/server/main.c +++ b/server/main.c @@ -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() ); diff --git a/server/object.c b/server/object.c index 26b0f29d16abfdf3b4df263b64f3124d8dd113dc..342ce0c1039ed774bea031aa9a89ff8beeb0e752 100644 --- a/server/object.c +++ b/server/object.c @@ -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 namespace *namespace, const WCHAR *name, { 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 namespace *namespace, const WCHAR *name 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( unsigned int hash_size, int case_sensitive ) 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; diff --git a/server/object.h b/server/object.h index a360ebe41e3da7973a14cbd689fd9fe1b5b9515d..33bab5192684ea09f028c14a1f0f926adc317afa 100644 --- a/server/object.h +++ b/server/object.h @@ -95,7 +95,7 @@ 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, 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 ); diff --git a/server/winstation.c b/server/winstation.c index 0b457c45f413c55b43f69ac4a7b50c807156a66d..486b2e228ed0cafb88e3ee8a99c809da763f2651 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -84,7 +84,7 @@ static struct winstation *create_winstation( const WCHAR *name, size_t len, unsi { 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 */