server: add case-sensitivity comparison flag to find_object & co
Vitaliy Margolen
wine-patch at kievinfo.com
Sat Sep 3 21:59:12 CDT 2005
Ok, this is a bit more then that. I removed case_sensitive flag from name space,
since it's at no use anymore. OBJECT_ATTRIBUTES should specify that instead.
Vitaliy Margolen
changelog:
Add case-sensitivity comparison flag to find_object & co
-------------- next part --------------
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 3 Sep 2005 23:49:07 -0000
@@ -158,7 +158,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->inherit, TRUE );
}
/* 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 3 Sep 2005 23:49:07 -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 )
+ const struct object_ops *ops, unsigned int access, int inherit,
+ int case_sensitive )
{
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 3 Sep 2005 23:49:07 -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 );
+ const struct object_ops *ops, unsigned int access, int inherit,
+ int case_sensitive );
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 3 Sep 2005 23:49:07 -0000
@@ -262,7 +262,7 @@ static struct mailslot *open_mailslot( c
{
struct object *obj;
- obj = find_object( sync_namespace, name, len );
+ obj = find_object( sync_namespace, name, len, TRUE );
if (obj)
{
if (obj->ops == &mailslot_ops)
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 3 Sep 2005 23:49:07 -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 3 Sep 2005 23:49:07 -0000
@@ -388,7 +388,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->inherit, TRUE );
}
/* 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 3 Sep 2005 23:49:07 -0000
@@ -182,7 +182,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->inherit, TRUE );
}
/* release a mutex */
Index: server/named_pipe.c
===================================================================
RCS file: /home/wine/wine/server/named_pipe.c,v
retrieving revision 1.46
diff -u -p -r1.46 named_pipe.c
--- server/named_pipe.c 9 Aug 2005 10:37:50 -0000 1.46
+++ server/named_pipe.c 3 Sep 2005 23:49:07 -0000
@@ -455,7 +455,7 @@ static struct named_pipe *create_named_p
static struct named_pipe *open_named_pipe( const WCHAR *name, size_t len )
{
struct object *obj;
- if ((obj = find_object( sync_namespace, name, len )))
+ if ((obj = find_object( sync_namespace, name, len, TRUE )))
{
if (obj->ops == &named_pipe_ops) return (struct named_pipe *)obj;
release_object( obj );
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 3 Sep 2005 23:49:07 -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 ^= *name++;
return hash % namespace->hash_size;
}
@@ -164,7 +162,7 @@ void *create_named_object( struct namesp
if (!name || !len) return alloc_object( ops );
- if ((obj = find_object( namespace, name, len )))
+ if ((obj = find_object( namespace, name, len, FALSE )))
{
if (obj->ops == 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 3 Sep 2005 23:49:07 -0000
@@ -95,12 +95,13 @@ 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 );
-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 );
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 );
Index: server/protocol.def
===================================================================
RCS file: /home/wine/wine/server/protocol.def,v
retrieving revision 1.154
diff -u -p -r1.154 protocol.def
--- server/protocol.def 24 Aug 2005 18:33:50 -0000 1.154
+++ server/protocol.def 3 Sep 2005 23:49:07 -0000
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 3 Sep 2005 23:49:08 -0000
@@ -158,7 +158,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->inherit, TRUE );
}
/* 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 3 Sep 2005 23:49:08 -0000
@@ -215,7 +215,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->inherit, TRUE );
}
/* set a waitable timer */
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 3 Sep 2005 23:49:08 -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 */
@@ -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 );
+ &winstation_ops, req->access, req->inherit, FALSE );
else
set_error( STATUS_OBJECT_NAME_NOT_FOUND );
}
@@ -396,7 +396,7 @@ 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, FALSE );
free( full_name );
}
release_object( winstation );
More information about the wine-patches
mailing list