From 0f273c17ff53423627cc404dc9ec6526c6b1a0cd Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 26 Jul 2006 10:43:25 +0200 Subject: [PATCH] server: Added data_size_t type to represent sizes in the server protocol. Make it an unsigned int to save some space on Win64, if we need to transfer more than 4Gb over the server pipe something is seriously wrong. --- include/wine/server.h | 8 +-- include/wine/server_protocol.h | 65 +++++++++++---------- server/atom.c | 14 ++--- server/console.c | 14 ++--- server/debugger.c | 4 +- server/file.c | 2 +- server/hook.c | 4 +- server/object.c | 6 +- server/object.h | 8 +-- server/process.c | 14 ++--- server/process.h | 10 ++-- server/protocol.def | 63 ++++++++++---------- server/ptrace.c | 8 +-- server/queue.c | 8 +-- server/region.c | 6 +- server/registry.c | 36 ++++++------ server/request.c | 2 +- server/request.h | 10 ++-- server/snapshot.c | 4 +- server/symlink.c | 2 +- server/token.c | 8 +-- server/trace.c | 103 ++++++++++++++++----------------- server/user.h | 12 ++-- server/window.c | 10 ++-- server/winstation.c | 4 +- tools/make_requests | 1 + 26 files changed, 213 insertions(+), 213 deletions(-) diff --git a/include/wine/server.h b/include/wine/server.h index 6a031007b20..929ca711734 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -32,7 +32,7 @@ struct __server_iovec { const void *ptr; - unsigned int size; + data_size_t size; }; #define __SERVER_MAX_DATA 5 @@ -64,13 +64,13 @@ inline static unsigned int wine_server_call_err( void *req_ptr ) } /* get the size of the variable part of the returned reply */ -inline static size_t wine_server_reply_size( const void *reply ) +inline static data_size_t wine_server_reply_size( const void *reply ) { return ((const struct reply_header *)reply)->reply_size; } /* add some data to be sent along with the request */ -inline static void wine_server_add_data( void *req_ptr, const void *ptr, unsigned int size ) +inline static void wine_server_add_data( void *req_ptr, const void *ptr, data_size_t size ) { struct __server_request_info * const req = req_ptr; if (size) @@ -82,7 +82,7 @@ inline static void wine_server_add_data( void *req_ptr, const void *ptr, unsigne } /* set the pointer and max size for the reply var data */ -inline static void wine_server_set_reply( void *req_ptr, void *ptr, unsigned int max_size ) +inline static void wine_server_set_reply( void *req_ptr, void *ptr, data_size_t max_size ) { struct __server_request_info * const req = req_ptr; req->reply_data = ptr; diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 6186fb8f40e..8e8a8c60a1d 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -15,17 +15,24 @@ #include #include +typedef void *obj_handle_t; +typedef void *user_handle_t; +typedef unsigned short atom_t; +typedef unsigned int process_id_t; +typedef unsigned int thread_id_t; +typedef unsigned int data_size_t; + struct request_header { int req; - size_t request_size; - size_t reply_size; + data_size_t request_size; + data_size_t reply_size; }; struct reply_header { unsigned int error; - size_t reply_size; + data_size_t reply_size; }; @@ -35,12 +42,6 @@ struct request_max_size int pad[16]; }; -typedef void *obj_handle_t; -typedef void *user_handle_t; -typedef unsigned short atom_t; -typedef unsigned int process_id_t; -typedef unsigned int thread_id_t; - #define FIRST_USER_HANDLE 0x0020 #define LAST_USER_HANDLE 0xffef @@ -167,10 +168,10 @@ typedef struct struct security_descriptor { unsigned int control; - size_t owner_len; - size_t group_len; - size_t sacl_len; - size_t dacl_len; + data_size_t owner_len; + data_size_t group_len; + data_size_t sacl_len; + data_size_t dacl_len; @@ -297,7 +298,7 @@ struct init_thread_reply struct reply_header __header; process_id_t pid; thread_id_t tid; - size_t info_size; + data_size_t info_size; time_t server_start; int version; }; @@ -1718,7 +1719,7 @@ struct create_key_request unsigned int attributes; unsigned int options; time_t modif; - size_t namelen; + data_size_t namelen; /* VARARG(name,unicode_str,namelen); */ /* VARARG(class,unicode_str); */ }; @@ -1787,8 +1788,8 @@ struct enum_key_reply int max_value; int max_data; time_t modif; - size_t total; - size_t namelen; + data_size_t total; + data_size_t namelen; /* VARARG(name,unicode_str,namelen); */ /* VARARG(class,unicode_str); */ }; @@ -1800,7 +1801,7 @@ struct set_key_value_request struct request_header __header; obj_handle_t hkey; int type; - size_t namelen; + data_size_t namelen; /* VARARG(name,unicode_str,namelen); */ /* VARARG(data,bytes); */ }; @@ -1821,7 +1822,7 @@ struct get_key_value_reply { struct reply_header __header; int type; - size_t total; + data_size_t total; /* VARARG(data,bytes); */ }; @@ -1838,8 +1839,8 @@ struct enum_key_value_reply { struct reply_header __header; int type; - size_t total; - size_t namelen; + data_size_t total; + data_size_t namelen; /* VARARG(name,unicode_str,namelen); */ /* VARARG(data,bytes); */ }; @@ -2087,7 +2088,7 @@ struct get_atom_information_reply struct reply_header __header; int count; int pinned; - size_t total; + data_size_t total; /* VARARG(name,unicode_str); */ }; @@ -2263,7 +2264,7 @@ struct get_message_reply unsigned int info; unsigned int hw_id; unsigned int active_hooks; - size_t total; + data_size_t total; /* VARARG(data,bytes); */ }; #define GET_MSG_REMOVE 1 @@ -2607,7 +2608,7 @@ struct set_window_info_request int is_unicode; void* user_data; int extra_offset; - size_t extra_size; + data_size_t extra_size; unsigned int extra_value; }; struct set_window_info_reply @@ -2798,7 +2799,7 @@ struct get_visible_region_reply int top_org_y; int win_org_x; int win_org_y; - size_t total_size; + data_size_t total_size; /* VARARG(region,rectangles); */ }; @@ -2812,7 +2813,7 @@ struct get_window_region_request struct get_window_region_reply { struct reply_header __header; - size_t total_size; + data_size_t total_size; /* VARARG(region,rectangles); */ }; @@ -2843,7 +2844,7 @@ struct get_update_region_reply struct reply_header __header; user_handle_t child; unsigned int flags; - size_t total_size; + data_size_t total_size; /* VARARG(region,rectangles); */ }; #define UPDATE_NONCLIENT 0x01 @@ -3403,7 +3404,7 @@ struct set_class_info_request int win_extra; void* instance; int extra_offset; - size_t extra_size; + data_size_t extra_size; unsigned long extra_value; }; struct set_class_info_reply @@ -3581,7 +3582,7 @@ struct get_token_user_request struct get_token_user_reply { struct reply_header __header; - size_t user_len; + data_size_t user_len; /* VARARG(user,SID); */ }; @@ -3593,7 +3594,7 @@ struct get_token_groups_request struct get_token_groups_reply { struct reply_header __header; - size_t user_len; + data_size_t user_len; /* VARARG(user,token_groups); */ }; @@ -3690,7 +3691,7 @@ struct create_symlink_request unsigned int access; unsigned int attributes; obj_handle_t rootdir; - size_t name_len; + data_size_t name_len; /* VARARG(name,unicode_str,name_len); */ /* VARARG(target_name,unicode_str); */ }; @@ -4385,6 +4386,6 @@ union generic_reply struct query_symlink_reply query_symlink_reply; }; -#define SERVER_PROTOCOL_VERSION 239 +#define SERVER_PROTOCOL_VERSION 240 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/atom.c b/server/atom.c index b88cd3edf1b..889193504a1 100644 --- a/server/atom.c +++ b/server/atom.c @@ -156,7 +156,7 @@ static atom_t add_atom_entry( struct atom_table *table, struct atom_entry *entry } /* compute the hash code for a string */ -static unsigned short atom_hash( struct atom_table *table, const WCHAR *str, size_t len ) +static unsigned short atom_hash( struct atom_table *table, const WCHAR *str, data_size_t len ) { unsigned int i; unsigned short hash = 0; @@ -201,7 +201,7 @@ static void atom_table_destroy( struct object *obj ) /* find an atom entry in its hash list */ static struct atom_entry *find_atom_entry( struct atom_table *table, const WCHAR *str, - size_t len, unsigned short hash ) + data_size_t len, unsigned short hash ) { struct atom_entry *entry = table->entries[hash]; while (entry) @@ -213,7 +213,7 @@ static struct atom_entry *find_atom_entry( struct atom_table *table, const WCHAR } /* add an atom to the table */ -static atom_t add_atom( struct atom_table *table, const WCHAR *str, size_t len ) +static atom_t add_atom( struct atom_table *table, const WCHAR *str, data_size_t len ) { struct atom_entry *entry; unsigned short hash = atom_hash( table, str, len ); @@ -271,7 +271,7 @@ static void delete_atom( struct atom_table *table, atom_t atom, int if_pinned ) } /* find an atom in the table */ -static atom_t find_atom( struct atom_table *table, const WCHAR *str, size_t len ) +static atom_t find_atom( struct atom_table *table, const WCHAR *str, data_size_t len ) { struct atom_entry *entry; @@ -328,7 +328,7 @@ static struct atom_table *get_table( obj_handle_t h, int create ) } /* add an atom in the global table; used for window properties */ -atom_t add_global_atom( struct winstation *winstation, const WCHAR *str, size_t len ) +atom_t add_global_atom( struct winstation *winstation, const WCHAR *str, data_size_t len ) { struct atom_table *global_table = get_global_table( winstation, 1 ); if (!global_table) return 0; @@ -336,7 +336,7 @@ atom_t add_global_atom( struct winstation *winstation, const WCHAR *str, size_t } /* find an atom in the global table; used for window properties */ -atom_t find_global_atom( struct winstation *winstation, const WCHAR *str, size_t len ) +atom_t find_global_atom( struct winstation *winstation, const WCHAR *str, data_size_t len ) { struct atom_table *global_table = get_global_table( winstation, 0 ); struct atom_entry *entry; @@ -417,7 +417,7 @@ DECL_HANDLER(get_atom_information) if ((entry = get_atom_entry( table, req->atom ))) { - size_t len = entry->len * sizeof(WCHAR); + data_size_t len = entry->len * sizeof(WCHAR); if (get_reply_max_size()) set_reply_data( entry->str, min( len, get_reply_max_size())); reply->count = entry->count; diff --git a/server/console.c b/server/console.c index b080293b256..5e65704fa43 100644 --- a/server/console.c +++ b/server/console.c @@ -211,7 +211,7 @@ static void console_input_events_append( struct console_input_events* evts, /* retrieves events from the console's renderer events list */ static void console_input_events_get( struct console_input_events* evts ) { - size_t num = get_reply_max_size() / sizeof(evts->events[0]); + data_size_t num = get_reply_max_size() / sizeof(evts->events[0]); if (num > evts->num_used) num = evts->num_used; set_reply_data( evts->events, num * sizeof(evts->events[0]) ); @@ -595,7 +595,7 @@ static int read_console_input( obj_handle_t handle, int count, int flush ) /* set misc console input information */ static int set_console_input_info( const struct set_console_input_info_request *req, - const WCHAR *title, size_t len ) + const WCHAR *title, data_size_t len ) { struct console_input *console; struct console_renderer_event evt; @@ -892,7 +892,7 @@ static int set_console_output_info( struct screen_buffer *screen_buffer, } /* appends a new line to history (history is a fixed size array) */ -static void console_input_append_hist( struct console_input* console, const WCHAR* buf, size_t len ) +static void console_input_append_hist( struct console_input* console, const WCHAR* buf, data_size_t len ) { WCHAR* ptr = mem_alloc( (len + 1) * sizeof(WCHAR) ); @@ -934,9 +934,9 @@ static void console_input_append_hist( struct console_input* console, const WCHA } /* returns a line from the cache */ -static size_t console_input_get_hist( struct console_input *console, int index ) +static data_size_t console_input_get_hist( struct console_input *console, int index ) { - size_t ret = 0; + data_size_t ret = 0; if (index >= console->history_index) set_error( STATUS_INVALID_PARAMETER ); else @@ -1017,7 +1017,7 @@ static void screen_buffer_destroy( struct object *obj ) } /* write data into a screen buffer */ -static int write_console_output( struct screen_buffer *screen_buffer, size_t size, +static int write_console_output( struct screen_buffer *screen_buffer, data_size_t size, const void* data, enum char_info_mode mode, int x, int y, int wrap ) { @@ -1353,7 +1353,7 @@ DECL_HANDLER(get_console_input_info) if (!(console = console_input_get( req->handle, CONSOLE_READ ))) return; if (console->title) { - size_t len = strlenW( console->title ) * sizeof(WCHAR); + data_size_t len = strlenW( console->title ) * sizeof(WCHAR); if (len > get_reply_max_size()) len = get_reply_max_size(); set_reply_data( console->title, len ); } diff --git a/server/debugger.c b/server/debugger.c index 9f55eed9707..fa4371db595 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -571,7 +571,7 @@ DECL_HANDLER(wait_debug_event) reply->wait = 0; if ((event = find_event_to_send( debug_ctx ))) { - size_t size = get_reply_max_size(); + data_size_t size = get_reply_max_size(); event->state = EVENT_SENT; event->sender->debug_event = event; reply->pid = get_process_id( event->sender->process ); @@ -666,7 +666,7 @@ DECL_HANDLER(get_exception_status) { if (current->context == &event->context) { - size_t size = min( sizeof(CONTEXT), get_reply_max_size() ); + data_size_t size = min( sizeof(CONTEXT), get_reply_max_size() ); set_reply_data( &event->context, size ); current->context = NULL; } diff --git a/server/file.c b/server/file.c index 7ddcd3553c2..b315425be5d 100644 --- a/server/file.c +++ b/server/file.c @@ -135,7 +135,7 @@ static struct object *create_file_obj( struct fd *fd, unsigned int access, unsig return &file->obj; } -static struct object *create_file( const char *nameptr, size_t len, unsigned int access, +static struct object *create_file( const char *nameptr, data_size_t len, unsigned int access, unsigned int sharing, int create, unsigned int options, unsigned int attrs ) { diff --git a/server/hook.c b/server/hook.c index b0d1b8f62d3..b2cb0b8e003 100644 --- a/server/hook.c +++ b/server/hook.c @@ -55,7 +55,7 @@ struct hook void *proc; /* hook function */ int unicode; /* is it a unicode hook? */ WCHAR *module; /* module name for global hooks */ - size_t module_size; + data_size_t module_size; }; #define WH_WINEVENT (WH_MAXHOOK+1) @@ -373,7 +373,7 @@ DECL_HANDLER(set_hook) struct hook *hook; WCHAR *module; int global; - size_t module_size = get_req_data_size(); + data_size_t module_size = get_req_data_size(); if (!req->proc || req->id < WH_MINHOOK || req->id > WH_WINEVENT) { diff --git a/server/object.c b/server/object.c index d3734c723a6..6efe239ab16 100644 --- a/server/object.c +++ b/server/object.c @@ -43,7 +43,7 @@ struct object_name struct list entry; /* entry in the hash list */ struct object *obj; /* object owning this name */ struct object *parent; /* parent object */ - size_t len; /* name length in bytes */ + data_size_t len; /* name length in bytes */ WCHAR name[1]; }; @@ -118,7 +118,7 @@ void *memdup( const void *data, size_t len ) /*****************************************************************/ -static int get_name_hash( const struct namespace *namespace, const WCHAR *name, size_t len ) +static int get_name_hash( const struct namespace *namespace, const WCHAR *name, data_size_t len ) { WCHAR hash = 0; len /= sizeof(WCHAR); @@ -161,7 +161,7 @@ static void set_object_name( struct namespace *namespace, } /* get the name of an existing object */ -const WCHAR *get_object_name( struct object *obj, size_t *len ) +const WCHAR *get_object_name( struct object *obj, data_size_t *len ) { struct object_name *ptr = obj->name; if (!ptr) return NULL; diff --git a/server/object.h b/server/object.h index 57dab07b9e9..46b34e13651 100644 --- a/server/object.h +++ b/server/object.h @@ -50,7 +50,7 @@ struct directory; struct unicode_str { const WCHAR *str; - size_t len; + data_size_t len; }; /* operations valid on all objects */ @@ -103,7 +103,7 @@ struct wait_queue_entry extern void *mem_alloc( size_t size ); /* malloc wrapper */ extern void *memdup( const void *data, size_t len ); extern void *alloc_object( const struct object_ops *ops ); -extern const WCHAR *get_object_name( struct object *obj, size_t *len ); +extern const WCHAR *get_object_name( struct object *obj, data_size_t *len ); extern void dump_object_name( struct object *obj ); extern void *create_object( struct namespace *namespace, const struct object_ops *ops, const struct unicode_str *name, struct object *parent ); @@ -179,8 +179,8 @@ extern void init_signals(void); /* atom functions */ -extern atom_t add_global_atom( struct winstation *winstation, const WCHAR *str, size_t len ); -extern atom_t find_global_atom( struct winstation *winstation, const WCHAR *str, size_t len ); +extern atom_t add_global_atom( struct winstation *winstation, const WCHAR *str, data_size_t len ); +extern atom_t find_global_atom( struct winstation *winstation, const WCHAR *str, data_size_t len ); extern int grab_global_atom( struct winstation *winstation, atom_t atom ); extern void release_global_atom( struct winstation *winstation, atom_t atom ); diff --git a/server/process.c b/server/process.c index acc582ef88c..e949b40432b 100644 --- a/server/process.c +++ b/server/process.c @@ -99,7 +99,7 @@ struct startup_info obj_handle_t hstderr; /* handle for stderr */ struct file *exe_file; /* file handle for main exe */ struct process *process; /* created process */ - size_t data_size; /* size of startup data */ + data_size_t data_size; /* size of startup data */ void *data; /* data for startup info */ }; @@ -303,7 +303,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit } /* initialize the current process and fill in the request */ -size_t init_process( struct thread *thread ) +data_size_t init_process( struct thread *thread ) { struct process *process = thread->process; struct startup_info *info = process->startup_info; @@ -420,7 +420,7 @@ static inline struct process_dll *find_process_dll( struct process *process, voi /* add a dll to a process list */ static struct process_dll *process_load_dll( struct process *process, struct file *file, - void *base, const WCHAR *filename, size_t name_len ) + void *base, const WCHAR *filename, data_size_t name_len ) { struct process_dll *dll; @@ -838,7 +838,7 @@ DECL_HANDLER(get_startup_info) { struct process *process = current->process; struct startup_info *info = process->startup_info; - size_t size; + data_size_t size; if (!info) return; @@ -953,7 +953,7 @@ DECL_HANDLER(set_process_info) DECL_HANDLER(read_process_memory) { struct process *process; - size_t len = get_reply_max_size(); + data_size_t len = get_reply_max_size(); if (!(process = get_process_from_handle( req->handle, PROCESS_VM_READ ))) return; @@ -978,7 +978,7 @@ DECL_HANDLER(write_process_memory) if ((process = get_process_from_handle( req->handle, PROCESS_VM_WRITE ))) { - size_t len = get_req_data_size(); + data_size_t len = get_req_data_size(); if (len) write_process_memory( process, req->addr, len, get_req_data() ); else set_error( STATUS_INVALID_PARAMETER ); release_object( process ); @@ -1029,7 +1029,7 @@ DECL_HANDLER(get_dll_info) reply->entry_point = NULL; /* FIXME */ if (dll->filename) { - size_t len = min( dll->namelen, get_reply_max_size() ); + data_size_t len = min( dll->namelen, get_reply_max_size() ); set_reply_data( dll->filename, len ); } } diff --git a/server/process.h b/server/process.h index e5289daef41..6edb1e6b877 100644 --- a/server/process.h +++ b/server/process.h @@ -42,7 +42,7 @@ struct process_dll void *name; /* ptr to ptr to name (in process addr space) */ int dbg_offset; /* debug info offset */ int dbg_size; /* debug info size */ - size_t namelen; /* length of dll file name */ + data_size_t namelen; /* length of dll file name */ WCHAR *filename; /* dll file name */ }; @@ -93,7 +93,7 @@ struct module_snapshot { void *base; /* module base addr */ size_t size; /* module size */ - size_t namelen; /* length of file name */ + data_size_t namelen; /* length of file name */ WCHAR *filename; /* module file name */ }; @@ -103,7 +103,7 @@ extern unsigned int alloc_ptid( void *ptr ); extern void free_ptid( unsigned int id ); extern void *get_ptid_entry( unsigned int id ); extern struct thread *create_process( int fd, struct thread *parent_thread, int inherit_all ); -extern size_t init_process( struct thread *thread ); +extern data_size_t init_process( struct thread *thread ); extern struct thread *get_process_first_thread( struct process *process ); extern struct process *get_process_from_id( process_id_t id ); extern struct process *get_process_from_handle( obj_handle_t handle, unsigned int access ); @@ -126,8 +126,8 @@ extern void detach_debugged_processes( struct thread *debugger ); extern struct process_snapshot *process_snap( int *count ); extern struct module_snapshot *module_snap( struct process *process, int *count ); extern void enum_processes( int (*cb)(struct process*, void*), void *user); -extern int read_process_memory( struct process *process, const void *ptr, size_t size, char *dest ); -extern int write_process_memory( struct process *process, void *ptr, size_t size, const char *src ); +extern int read_process_memory( struct process *process, const void *ptr, data_size_t size, char *dest ); +extern int write_process_memory( struct process *process, void *ptr, data_size_t size, const char *src ); inline static process_id_t get_process_id( struct process *process ) { return process->id; } diff --git a/server/protocol.def b/server/protocol.def index 0b0d40f7bc0..4cd8099b50f 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -31,17 +31,24 @@ #include #include +typedef void *obj_handle_t; +typedef void *user_handle_t; +typedef unsigned short atom_t; +typedef unsigned int process_id_t; +typedef unsigned int thread_id_t; +typedef unsigned int data_size_t; + struct request_header { int req; /* request code */ - size_t request_size; /* request variable part size */ - size_t reply_size; /* reply variable part maximum size */ + data_size_t request_size; /* request variable part size */ + data_size_t reply_size; /* reply variable part maximum size */ }; struct reply_header { unsigned int error; /* error result */ - size_t reply_size; /* reply variable part size */ + data_size_t reply_size; /* reply variable part size */ }; /* placeholder structure for the maximum allowed request size */ @@ -51,12 +58,6 @@ struct request_max_size int pad[16]; /* the max request size is 16 ints */ }; -typedef void *obj_handle_t; -typedef void *user_handle_t; -typedef unsigned short atom_t; -typedef unsigned int process_id_t; -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 */ @@ -183,10 +184,10 @@ typedef struct struct security_descriptor { unsigned int control; /* SE_ flags */ - size_t owner_len; - size_t group_len; - size_t sacl_len; - size_t dacl_len; + data_size_t owner_len; + data_size_t group_len; + data_size_t sacl_len; + data_size_t dacl_len; /* VARARGS(owner,SID); */ /* VARARGS(group,SID); */ /* VARARGS(sacl,ACL); */ @@ -282,7 +283,7 @@ struct token_groups @REPLY process_id_t pid; /* process id of the new thread's process */ thread_id_t tid; /* thread id of the new thread */ - size_t info_size; /* total size of startup info */ + data_size_t info_size; /* total size of startup info */ time_t server_start; /* server start time */ int version; /* protocol version */ @END @@ -1261,7 +1262,7 @@ enum char_info_mode unsigned int attributes; /* object attributes */ unsigned int options; /* creation options */ time_t modif; /* last modification time */ - size_t namelen; /* length of key name in bytes */ + data_size_t namelen; /* length of key name in bytes */ VARARG(name,unicode_str,namelen); /* key name */ VARARG(class,unicode_str); /* class name */ @REPLY @@ -1305,8 +1306,8 @@ enum char_info_mode int max_value; /* longest value name */ int max_data; /* longest value data */ time_t modif; /* last modification time */ - size_t total; /* total length needed for full name and class */ - size_t namelen; /* length of key name in bytes */ + data_size_t total; /* total length needed for full name and class */ + data_size_t namelen; /* length of key name in bytes */ VARARG(name,unicode_str,namelen); /* key name */ VARARG(class,unicode_str); /* class name */ @END @@ -1316,7 +1317,7 @@ enum char_info_mode @REQ(set_key_value) obj_handle_t hkey; /* handle to registry key */ int type; /* value type */ - size_t namelen; /* length of value name in bytes */ + data_size_t namelen; /* length of value name in bytes */ VARARG(name,unicode_str,namelen); /* value name */ VARARG(data,bytes); /* value data */ @END @@ -1328,7 +1329,7 @@ enum char_info_mode VARARG(name,unicode_str); /* value name */ @REPLY int type; /* value type */ - size_t total; /* total length needed for data */ + data_size_t total; /* total length needed for data */ VARARG(data,bytes); /* value data */ @END @@ -1340,8 +1341,8 @@ enum char_info_mode int info_class; /* requested information class */ @REPLY int type; /* value type */ - size_t total; /* total length needed for full name and data */ - size_t namelen; /* length of value name in bytes */ + data_size_t total; /* total length needed for full name and data */ + data_size_t namelen; /* length of value name in bytes */ VARARG(name,unicode_str,namelen); /* value name */ VARARG(data,bytes); /* value data */ @END @@ -1498,7 +1499,7 @@ enum char_info_mode @REPLY int count; /* atom lock count */ int pinned; /* whether the atom has been pinned */ - size_t total; /* actual length of atom name */ + data_size_t total; /* actual length of atom name */ VARARG(name,unicode_str); /* atom name */ @END @@ -1620,7 +1621,7 @@ enum message_type unsigned int info; /* extra info (callback argument for MSG_CALLBACK_RESULT) */ unsigned int hw_id; /* id if hardware message */ unsigned int active_hooks; /* active hooks bitmap */ - size_t total; /* total size of extra data */ + data_size_t total; /* total size of extra data */ VARARG(data,bytes); /* message data for sent messages */ @END #define GET_MSG_REMOVE 1 /* remove the message */ @@ -1853,7 +1854,7 @@ enum message_type int is_unicode; /* ANSI or unicode */ void* user_data; /* user-specific data */ int extra_offset; /* offset to set in extra bytes */ - size_t extra_size; /* size to set in extra bytes */ + data_size_t extra_size; /* size to set in extra bytes */ unsigned int extra_value; /* value to set in extra bytes */ @REPLY unsigned int old_style; /* old window style */ @@ -1985,7 +1986,7 @@ enum message_type int top_org_y; int win_org_x; /* window rect origin in screen coords */ int win_org_y; - size_t total_size; /* total size of the resulting region */ + data_size_t total_size; /* total size of the resulting region */ VARARG(region,rectangles); /* list of rectangles for the region (in screen coords) */ @END @@ -1994,7 +1995,7 @@ enum message_type @REQ(get_window_region) user_handle_t window; /* handle to the window */ @REPLY - size_t total_size; /* total size of the resulting region */ + data_size_t total_size; /* total size of the resulting region */ VARARG(region,rectangles); /* list of rectangles for the region */ @END @@ -2014,7 +2015,7 @@ enum message_type @REPLY user_handle_t child; /* child to repaint (or window itself) */ unsigned int flags; /* resulting update flags (see below) */ - size_t total_size; /* total size of the resulting region */ + data_size_t total_size; /* total size of the resulting region */ VARARG(region,rectangles); /* list of rectangles for the region */ @END #define UPDATE_NONCLIENT 0x01 /* get region for repainting non-client area */ @@ -2386,7 +2387,7 @@ enum message_type int win_extra; /* number of window extra bytes */ void* instance; /* module instance */ int extra_offset; /* offset to set in extra bytes */ - size_t extra_size; /* size to set in extra bytes */ + data_size_t extra_size; /* size to set in extra bytes */ unsigned long extra_value; /* value to set in extra bytes */ @REPLY atom_t old_atom; /* previous class atom */ @@ -2516,14 +2517,14 @@ enum message_type @REQ(get_token_user) obj_handle_t handle; /* handle to the token */ @REPLY - size_t user_len; /* length needed to store user */ + data_size_t user_len; /* length needed to store user */ VARARG(user,SID); /* sid of the user the token represents */ @END @REQ(get_token_groups) obj_handle_t handle; /* handle to the token */ @REPLY - size_t user_len; /* length needed to store user */ + data_size_t user_len; /* length needed to store user */ VARARG(user,token_groups); /* groups the token's user belongs to */ @END @@ -2593,7 +2594,7 @@ enum message_type unsigned int access; /* access flags */ unsigned int attributes; /* object attributes */ obj_handle_t rootdir; /* root directory */ - size_t name_len; /* length of the symlink name in bytes */ + data_size_t name_len; /* length of the symlink name in bytes */ VARARG(name,unicode_str,name_len); /* symlink name */ VARARG(target_name,unicode_str); /* target name */ @REPLY diff --git a/server/ptrace.c b/server/ptrace.c index ed35d2e50c3..c84451b16a1 100644 --- a/server/ptrace.c +++ b/server/ptrace.c @@ -312,7 +312,7 @@ static struct thread *get_ptrace_thread( struct process *process ) } /* read data from a process memory space */ -int read_process_memory( struct process *process, const void *ptr, size_t size, char *dest ) +int read_process_memory( struct process *process, const void *ptr, data_size_t size, char *dest ) { struct thread *thread = get_ptrace_thread( process ); unsigned int first_offset, last_offset, len; @@ -358,7 +358,7 @@ int read_process_memory( struct process *process, const void *ptr, size_t size, /* make sure we can write to the whole address range */ /* len is the total size (in ints) */ -static int check_process_write_access( struct thread *thread, int *addr, size_t len ) +static int check_process_write_access( struct thread *thread, int *addr, data_size_t len ) { int page = get_page_size() / sizeof(int); @@ -373,11 +373,11 @@ static int check_process_write_access( struct thread *thread, int *addr, size_t } /* write data to a process memory space */ -int write_process_memory( struct process *process, void *ptr, size_t size, const char *src ) +int write_process_memory( struct process *process, void *ptr, data_size_t size, const char *src ) { struct thread *thread = get_ptrace_thread( process ); int ret = 0, data = 0; - size_t len; + data_size_t len; int *addr; unsigned int first_mask, first_offset, last_mask, last_offset; diff --git a/server/queue.c b/server/queue.c index 60f177b69a9..965ede00393 100644 --- a/server/queue.c +++ b/server/queue.c @@ -616,7 +616,7 @@ static void receive_message( struct msg_queue *queue, struct message *msg, /* set the result of the current received message */ static void reply_message( struct msg_queue *queue, unsigned int result, - unsigned int error, int remove, const void *data, size_t len ) + unsigned int error, int remove, const void *data, data_size_t len ) { struct message_result *res = queue->recv_result; @@ -1480,7 +1480,7 @@ void post_message( user_handle_t win, unsigned int message, void post_win_event( struct thread *thread, unsigned int event, user_handle_t win, unsigned int object_id, unsigned int child_id, void *hook_proc, - const WCHAR *module, size_t module_size, + const WCHAR *module, data_size_t module_size, user_handle_t hook) { struct message *msg; @@ -1791,7 +1791,7 @@ DECL_HANDLER(get_message_reply) set_error( result->error ); if (result->data) { - size_t data_len = min( result->data_size, get_reply_max_size() ); + data_size_t data_len = min( result->data_size, get_reply_max_size() ); set_reply_data_ptr( result->data, data_len ); result->data = NULL; result->data_size = 0; @@ -1989,7 +1989,7 @@ DECL_HANDLER(set_key_state) input = thread->queue ? thread->queue->input : NULL; if (input) { - size_t size = min( sizeof(input->keystate), get_req_data_size() ); + data_size_t size = min( sizeof(input->keystate), get_req_data_size() ); if (size) memcpy( input->keystate, get_req_data(), size ); } release_object( thread ); diff --git a/server/region.c b/server/region.c index 0ce493e77ea..2efbd303ebd 100644 --- a/server/region.c +++ b/server/region.c @@ -581,7 +581,7 @@ struct region *create_empty_region(void) } /* create a region from request data */ -struct region *create_region_from_req_data( const void *data, size_t size ) +struct region *create_region_from_req_data( const void *data, data_size_t size ) { unsigned int alloc_rects; struct region *region; @@ -638,7 +638,7 @@ void set_region_rect( struct region *region, const rectangle_t *rect ) } /* retrieve the region data for sending to the client */ -rectangle_t *get_region_data( const struct region *region, size_t max_size, size_t *total_size ) +rectangle_t *get_region_data( const struct region *region, data_size_t max_size, data_size_t *total_size ) { const rectangle_t *data = region->rects; @@ -654,7 +654,7 @@ rectangle_t *get_region_data( const struct region *region, size_t max_size, size } /* retrieve the region data for sending to the client and free the region at the same time */ -rectangle_t *get_region_data_and_free( struct region *region, size_t max_size, size_t *total_size ) +rectangle_t *get_region_data_and_free( struct region *region, data_size_t max_size, data_size_t *total_size ) { rectangle_t *ret = region->rects; diff --git a/server/registry.c b/server/registry.c index ae32aa74aa8..f56051c2163 100644 --- a/server/registry.c +++ b/server/registry.c @@ -90,7 +90,7 @@ struct key_value WCHAR *name; /* value name */ unsigned short namelen; /* length of value name */ unsigned short type; /* value type */ - size_t len; /* value data length in bytes */ + data_size_t len; /* value data length in bytes */ void *data; /* pointer to value data */ }; @@ -369,7 +369,7 @@ inline static void get_req_path( struct unicode_str *str, int skip_root ) /* token->str must point inside the path, or be NULL for the first call */ static struct unicode_str *get_path_token( const struct unicode_str *path, struct unicode_str *token ) { - size_t i = 0, len = path->len / sizeof(WCHAR); + data_size_t i = 0, len = path->len / sizeof(WCHAR); if (!token->str) /* first time */ { @@ -555,7 +555,7 @@ static void free_subkey( struct key *parent, int index ) static struct key *find_subkey( const struct key *key, const struct unicode_str *name, int *index ) { int i, min, max, res; - size_t len; + data_size_t len; min = 0; max = key->last_subkey; @@ -668,7 +668,7 @@ static void enum_key( const struct key *key, int index, int info_class, struct enum_key_reply *reply ) { int i; - size_t len, namelen, classlen; + data_size_t len, namelen, classlen; int max_subkey = 0, max_class = 0; int max_value = 0, max_data = 0; char *data; @@ -814,7 +814,7 @@ static int grow_values( struct key *key ) static struct key_value *find_value( const struct key *key, const struct unicode_str *name, int *index ) { int i, min, max, res; - size_t len; + data_size_t len; min = 0; max = key->last_value; @@ -864,7 +864,7 @@ static struct key_value *insert_value( struct key *key, const struct unicode_str /* set a key value */ static void set_value( struct key *key, const struct unicode_str *name, - int type, const void *data, size_t len ) + int type, const void *data, data_size_t len ) { struct key_value *value; void *ptr = NULL; @@ -901,7 +901,7 @@ static void set_value( struct key *key, const struct unicode_str *name, } /* get a key value */ -static void get_value( struct key *key, const struct unicode_str *name, int *type, size_t *len ) +static void get_value( struct key *key, const struct unicode_str *name, int *type, data_size_t *len ) { struct key_value *value; int index; @@ -929,7 +929,7 @@ static void enum_value( struct key *key, int i, int info_class, struct enum_key_ else { void *data; - size_t namelen, maxlen; + data_size_t namelen, maxlen; value = &key->values[i]; reply->type = value->type; @@ -1074,9 +1074,9 @@ static void file_read_error( const char *err, struct file_load_info *info ) /* parse an escaped string back into Unicode */ /* return the number of chars read from the input, or -1 on output overflow */ -static int parse_strW( WCHAR *dest, size_t *len, const char *src, char endchar ) +static int parse_strW( WCHAR *dest, data_size_t *len, const char *src, char endchar ) { - size_t count = sizeof(WCHAR); /* for terminating null */ + data_size_t count = sizeof(WCHAR); /* for terminating null */ const char *p = src; while (*p && *p != endchar) { @@ -1172,7 +1172,7 @@ static struct key *load_key( struct key *base, const char *buffer, int flags, WCHAR *p; struct unicode_str name; int res, modif; - size_t len = strlen(buffer) * sizeof(WCHAR); + data_size_t len = strlen(buffer) * sizeof(WCHAR); if (!get_file_tmp_space( info, len )) return NULL; @@ -1202,10 +1202,10 @@ static struct key *load_key( struct key *base, const char *buffer, int flags, } /* parse a comma-separated list of hex digits */ -static int parse_hex( unsigned char *dest, size_t *len, const char *buffer ) +static int parse_hex( unsigned char *dest, data_size_t *len, const char *buffer ) { const char *p = buffer; - size_t count = 0; + data_size_t count = 0; while (isxdigit(*p)) { int val; @@ -1223,13 +1223,13 @@ static int parse_hex( unsigned char *dest, size_t *len, const char *buffer ) } /* parse a value name and create the corresponding value */ -static struct key_value *parse_value_name( struct key *key, const char *buffer, size_t *len, +static struct key_value *parse_value_name( struct key *key, const char *buffer, data_size_t *len, struct file_load_info *info ) { struct key_value *value; struct unicode_str name; int index; - size_t maxlen = strlen(buffer) * sizeof(WCHAR); + data_size_t maxlen = strlen(buffer) * sizeof(WCHAR); if (!get_file_tmp_space( info, maxlen )) return NULL; name.str = info->tmp; @@ -1263,7 +1263,7 @@ static int load_value( struct key *key, const char *buffer, struct file_load_inf DWORD dw; void *ptr, *newptr; int res, type, parse_type; - size_t maxlen, len; + data_size_t maxlen, len; struct key_value *value; if (!(value = parse_value_name( key, buffer, &len, info ))) return 0; @@ -1328,7 +1328,7 @@ static int get_prefix_len( struct key *key, const char *name, struct file_load_i { WCHAR *p; int res; - size_t len = strlen(name) * sizeof(WCHAR); + data_size_t len = strlen(name) * sizeof(WCHAR); if (!get_file_tmp_space( info, len )) return 0; @@ -1820,7 +1820,7 @@ DECL_HANDLER(set_key_value) if ((key = get_hkey_obj( req->hkey, KEY_SET_VALUE ))) { - size_t datalen = get_req_data_size() - req->namelen; + data_size_t datalen = get_req_data_size() - req->namelen; const char *data = (const char *)get_req_data() + req->namelen; set_value( key, &name, req->type, data, datalen ); diff --git a/server/request.c b/server/request.c index 260fc62c362..6fc7fcb94cd 100644 --- a/server/request.c +++ b/server/request.c @@ -188,7 +188,7 @@ void fatal_perror( const char *err, ... ) } /* allocate the reply data */ -void *set_reply_data_size( size_t size ) +void *set_reply_data_size( data_size_t size ) { assert( size <= get_reply_max_size() ); if (size && !(current->reply_data = mem_alloc( size ))) size = 0; diff --git a/server/request.h b/server/request.h index 7cdff4a1d0c..bbe1a7cafcd 100644 --- a/server/request.h +++ b/server/request.h @@ -50,7 +50,7 @@ extern void fatal_perror( const char *err, ... ); #endif extern const char *get_config_dir(void); -extern void *set_reply_data_size( size_t size ); +extern void *set_reply_data_size( data_size_t size ); extern int receive_fd( struct process *process ); extern int send_client_fd( struct process *process, int fd, obj_handle_t handle ); extern void read_request( struct thread *thread ); @@ -72,7 +72,7 @@ inline static const void *get_req_data(void) } /* get the request vararg size */ -inline static size_t get_req_data_size(void) +inline static data_size_t get_req_data_size(void) { return current->req.request_header.request_size; } @@ -85,13 +85,13 @@ inline static void get_req_unicode_str( struct unicode_str *str ) } /* get the reply maximum vararg size */ -inline static size_t get_reply_max_size(void) +inline static data_size_t get_reply_max_size(void) { return current->req.request_header.reply_size; } /* allocate and fill the reply data */ -inline static void *set_reply_data( const void *data, size_t size ) +inline static void *set_reply_data( const void *data, data_size_t size ) { void *ret = set_reply_data_size( size ); if (ret) memcpy( ret, data, size ); @@ -99,7 +99,7 @@ inline static void *set_reply_data( const void *data, size_t size ) } /* set the reply data pointer directly (will be freed by request code) */ -inline static void set_reply_data_ptr( void *data, size_t size ) +inline static void set_reply_data_ptr( void *data, data_size_t size ) { assert( size <= get_reply_max_size() ); current->reply_size = size; diff --git a/server/snapshot.c b/server/snapshot.c index 61b66f2e522..fafe65ce1ce 100644 --- a/server/snapshot.c +++ b/server/snapshot.c @@ -140,7 +140,7 @@ static int snapshot_next_process( struct snapshot *snapshot, struct next_process reply->handles = ptr->handles; if ((exe_module = get_process_exe_module( ptr->process )) && exe_module->filename) { - size_t len = min( exe_module->namelen, get_reply_max_size() ); + data_size_t len = min( exe_module->namelen, get_reply_max_size() ); set_reply_data( exe_module->filename, len ); } return 1; @@ -191,7 +191,7 @@ static int snapshot_next_module( struct snapshot *snapshot, struct next_module_r reply->size = ptr->size; if (ptr->filename) { - size_t len = min( ptr->namelen, get_reply_max_size() ); + data_size_t len = min( ptr->namelen, get_reply_max_size() ); set_reply_data( ptr->filename, len ); } return 1; diff --git a/server/symlink.c b/server/symlink.c index 3731cb8ff03..c3f9cedd2a4 100644 --- a/server/symlink.c +++ b/server/symlink.c @@ -42,7 +42,7 @@ struct symlink { struct object obj; /* object header */ WCHAR *target; /* target of the symlink */ - size_t len; /* target len in bytes */ + data_size_t len; /* target len in bytes */ }; static void symlink_dump( struct object *obj, int verbose ); diff --git a/server/token.c b/server/token.c index 983d7519ba1..1d08eebf68c 100644 --- a/server/token.c +++ b/server/token.c @@ -189,7 +189,7 @@ static const ACE_HEADER *ace_next( const ACE_HEADER *ace ) return (const ACE_HEADER *)((const char *)ace + ace->AceSize); } -static int acl_is_valid( const ACL *acl, size_t size ) +static int acl_is_valid( const ACL *acl, data_size_t size ) { ULONG i; const ACE_HEADER *ace; @@ -205,7 +205,7 @@ static int acl_is_valid( const ACL *acl, size_t size ) for (i = 0; i < acl->AceCount; i++) { const SID *sid; - size_t sid_size; + data_size_t sid_size; if (size < sizeof(ACE_HEADER)) return FALSE; @@ -285,7 +285,7 @@ static inline const SID *sd_get_group( const struct security_descriptor *sd ) /* checks whether all members of a security descriptor fit inside the size * of memory specified */ -static int sd_is_valid( const struct security_descriptor *sd, size_t size ) +static int sd_is_valid( const struct security_descriptor *sd, data_size_t size ) { size_t offset = sizeof(struct security_descriptor); const SID *group; @@ -1079,7 +1079,7 @@ DECL_HANDLER(check_token_privileges) * represented by a security descriptor */ DECL_HANDLER(access_check) { - size_t sd_size = get_req_data_size(); + data_size_t sd_size = get_req_data_size(); const struct security_descriptor *sd = get_req_data(); struct token *token; diff --git a/server/trace.c b/server/trace.c index a30310ca032..cfa14eaa3b4 100644 --- a/server/trace.c +++ b/server/trace.c @@ -39,13 +39,12 @@ #include "request.h" #include "unicode.h" -static int cur_pos; static const void *cur_data; -static int cur_size; +static data_size_t cur_size; /* utility functions */ -inline static void remove_data( size_t size ) +inline static void remove_data( data_size_t size ) { cur_data = (const char *)cur_data + size; cur_size -= size; @@ -130,10 +129,10 @@ static void dump_exc_record( const EXCEPTION_RECORD *rec ) fputc( '}', stderr ); } -static void dump_varargs_ints( size_t size ) +static void dump_varargs_ints( data_size_t size ) { const int *data = cur_data; - size_t len = size / sizeof(*data); + data_size_t len = size / sizeof(*data); fputc( '{', stderr ); while (len > 0) @@ -145,10 +144,10 @@ static void dump_varargs_ints( size_t size ) remove_data( size ); } -static void dump_varargs_handles( size_t size ) +static void dump_varargs_handles( data_size_t size ) { const obj_handle_t *data = cur_data; - size_t len = size / sizeof(*data); + data_size_t len = size / sizeof(*data); fputc( '{', stderr ); while (len > 0) @@ -160,10 +159,10 @@ static void dump_varargs_handles( size_t size ) remove_data( size ); } -static void dump_varargs_user_handles( size_t size ) +static void dump_varargs_user_handles( data_size_t size ) { const user_handle_t *data = cur_data; - size_t len = size / sizeof(*data); + data_size_t len = size / sizeof(*data); fputc( '{', stderr ); while (len > 0) @@ -175,10 +174,10 @@ static void dump_varargs_user_handles( size_t size ) remove_data( size ); } -static void dump_varargs_bytes( size_t size ) +static void dump_varargs_bytes( data_size_t size ) { const unsigned char *data = cur_data; - size_t len = size; + data_size_t len = size; fputc( '{', stderr ); while (len > 0) @@ -190,13 +189,13 @@ static void dump_varargs_bytes( size_t size ) remove_data( size ); } -static void dump_varargs_string( size_t size ) +static void dump_varargs_string( data_size_t size ) { fprintf( stderr, "\"%.*s\"", (int)size, (const char *)cur_data ); remove_data( size ); } -static void dump_varargs_unicode_str( size_t size ) +static void dump_varargs_unicode_str( data_size_t size ) { fprintf( stderr, "L\"" ); dump_strW( cur_data, size / sizeof(WCHAR), stderr, "\"\"" ); @@ -204,7 +203,7 @@ static void dump_varargs_unicode_str( size_t size ) remove_data( size ); } -static void dump_varargs_context( size_t size ) +static void dump_varargs_context( data_size_t size ) { if (!size) { @@ -215,7 +214,7 @@ static void dump_varargs_context( size_t size ) remove_data( size ); } -static void dump_varargs_exc_event( size_t size ) +static void dump_varargs_exc_event( data_size_t size ) { const CONTEXT *ptr = cur_data; @@ -232,7 +231,7 @@ static void dump_varargs_exc_event( size_t size ) remove_data( size ); } -static void dump_varargs_debug_event( size_t size ) +static void dump_varargs_debug_event( data_size_t size ) { const debug_event_t *event = cur_data; @@ -297,7 +296,7 @@ static void dump_varargs_debug_event( size_t size ) } /* dump a unicode string contained in a buffer; helper for dump_varargs_startup_info */ -static void dump_inline_unicode_string( const UNICODE_STRING *str, const void *data, size_t size ) +static void dump_inline_unicode_string( const UNICODE_STRING *str, const void *data, data_size_t size ) { size_t length = str->Length; size_t offset = (size_t)str->Buffer; @@ -307,7 +306,7 @@ static void dump_inline_unicode_string( const UNICODE_STRING *str, const void *d dump_strW( (const WCHAR *)data + offset/sizeof(WCHAR), length/sizeof(WCHAR), stderr, "\"\"" ); } -static void dump_varargs_startup_info( size_t size ) +static void dump_varargs_startup_info( data_size_t size ) { const RTL_USER_PROCESS_PARAMETERS *ptr = cur_data; RTL_USER_PROCESS_PARAMETERS params; @@ -360,10 +359,10 @@ static void dump_varargs_startup_info( size_t size ) remove_data( size ); } -static void dump_varargs_input_records( size_t size ) +static void dump_varargs_input_records( data_size_t size ) { const INPUT_RECORD *rec = cur_data; - size_t len = size / sizeof(*rec); + data_size_t len = size / sizeof(*rec); fputc( '{', stderr ); while (len > 0) @@ -376,10 +375,10 @@ static void dump_varargs_input_records( size_t size ) remove_data( size ); } -static void dump_varargs_rectangles( size_t size ) +static void dump_varargs_rectangles( data_size_t size ) { const rectangle_t *rect = cur_data; - size_t len = size / sizeof(*rect); + data_size_t len = size / sizeof(*rect); fputc( '{', stderr ); while (len > 0) @@ -391,10 +390,10 @@ static void dump_varargs_rectangles( size_t size ) remove_data( size ); } -static void dump_varargs_properties( size_t size ) +static void dump_varargs_properties( data_size_t size ) { const property_data_t *prop = cur_data; - size_t len = size / sizeof(*prop); + data_size_t len = size / sizeof(*prop); fputc( '{', stderr ); while (len > 0) @@ -408,10 +407,10 @@ static void dump_varargs_properties( size_t size ) remove_data( size ); } -static void dump_varargs_LUID_AND_ATTRIBUTES( size_t size ) +static void dump_varargs_LUID_AND_ATTRIBUTES( data_size_t size ) { const LUID_AND_ATTRIBUTES *lat = cur_data; - size_t len = size / sizeof(*lat); + data_size_t len = size / sizeof(*lat); fputc( '{', stderr ); while (len > 0) @@ -425,7 +424,7 @@ static void dump_varargs_LUID_AND_ATTRIBUTES( size_t size ) remove_data( size ); } -static void dump_inline_sid( const SID *sid, size_t size ) +static void dump_inline_sid( const SID *sid, data_size_t size ) { DWORD i; @@ -448,14 +447,14 @@ static void dump_inline_sid( const SID *sid, size_t size ) fputc( '}', stderr ); } -static void dump_varargs_SID( size_t size ) +static void dump_varargs_SID( data_size_t size ) { const SID *sid = cur_data; dump_inline_sid( sid, size ); remove_data( size ); } -static void dump_inline_acl( const ACL *acl, size_t size ) +static void dump_inline_acl( const ACL *acl, data_size_t size ) { const ACE_HEADER *ace; ULONG i; @@ -473,7 +472,7 @@ static void dump_inline_acl( const ACL *acl, size_t size ) for (i = 0; i < acl->AceCount; i++) { const SID *sid = NULL; - size_t sid_size = 0; + data_size_t sid_size = 0; if (size < sizeof(ACE_HEADER)) return; @@ -522,7 +521,7 @@ static void dump_inline_acl( const ACL *acl, size_t size ) fputc( '}', stderr ); } -static void dump_inline_security_descriptor( const struct security_descriptor *sd, size_t size ) +static void dump_inline_security_descriptor( const struct security_descriptor *sd, data_size_t size ) { fputc( '{', stderr ); if (size >= sizeof(struct security_descriptor)) @@ -553,14 +552,14 @@ static void dump_inline_security_descriptor( const struct security_descriptor *s fputc( '}', stderr ); } -static void dump_varargs_security_descriptor( size_t size ) +static void dump_varargs_security_descriptor( data_size_t size ) { const struct security_descriptor *sd = cur_data; dump_inline_security_descriptor( sd, size ); remove_data( size ); } -static void dump_varargs_token_groups( size_t size ) +static void dump_varargs_token_groups( data_size_t size ) { const struct token_groups *tg = cur_data; fputc( '{', stderr ); @@ -697,7 +696,7 @@ static void dump_init_thread_reply( const struct init_thread_reply *req ) { fprintf( stderr, " pid=%04x,", req->pid ); fprintf( stderr, " tid=%04x,", req->tid ); - fprintf( stderr, " info_size=%lu,", (unsigned long)req->info_size ); + fprintf( stderr, " info_size=%u,", req->info_size ); fprintf( stderr, " server_start=%ld,", (long)req->server_start ); fprintf( stderr, " version=%d", req->version ); } @@ -1715,7 +1714,7 @@ static void dump_create_key_request( const struct create_key_request *req ) fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " options=%08x,", req->options ); fprintf( stderr, " modif=%ld,", (long)req->modif ); - fprintf( stderr, " namelen=%lu,", (unsigned long)req->namelen ); + fprintf( stderr, " namelen=%u,", req->namelen ); fprintf( stderr, " name=" ); dump_varargs_unicode_str( min(cur_size,req->namelen) ); fputc( ',', stderr ); @@ -1769,8 +1768,8 @@ static void dump_enum_key_reply( const struct enum_key_reply *req ) fprintf( stderr, " max_value=%d,", req->max_value ); fprintf( stderr, " max_data=%d,", req->max_data ); fprintf( stderr, " modif=%ld,", (long)req->modif ); - fprintf( stderr, " total=%lu,", (unsigned long)req->total ); - fprintf( stderr, " namelen=%lu,", (unsigned long)req->namelen ); + fprintf( stderr, " total=%u,", req->total ); + fprintf( stderr, " namelen=%u,", req->namelen ); fprintf( stderr, " name=" ); dump_varargs_unicode_str( min(cur_size,req->namelen) ); fputc( ',', stderr ); @@ -1782,7 +1781,7 @@ static void dump_set_key_value_request( const struct set_key_value_request *req { fprintf( stderr, " hkey=%p,", req->hkey ); fprintf( stderr, " type=%d,", req->type ); - fprintf( stderr, " namelen=%lu,", (unsigned long)req->namelen ); + fprintf( stderr, " namelen=%u,", req->namelen ); fprintf( stderr, " name=" ); dump_varargs_unicode_str( min(cur_size,req->namelen) ); fputc( ',', stderr ); @@ -1800,7 +1799,7 @@ static void dump_get_key_value_request( const struct get_key_value_request *req static void dump_get_key_value_reply( const struct get_key_value_reply *req ) { fprintf( stderr, " type=%d,", req->type ); - fprintf( stderr, " total=%lu,", (unsigned long)req->total ); + fprintf( stderr, " total=%u,", req->total ); fprintf( stderr, " data=" ); dump_varargs_bytes( cur_size ); } @@ -1815,8 +1814,8 @@ static void dump_enum_key_value_request( const struct enum_key_value_request *re static void dump_enum_key_value_reply( const struct enum_key_value_reply *req ) { fprintf( stderr, " type=%d,", req->type ); - fprintf( stderr, " total=%lu,", (unsigned long)req->total ); - fprintf( stderr, " namelen=%lu,", (unsigned long)req->namelen ); + fprintf( stderr, " total=%u,", req->total ); + fprintf( stderr, " namelen=%u,", req->namelen ); fprintf( stderr, " name=" ); dump_varargs_unicode_str( min(cur_size,req->namelen) ); fputc( ',', stderr ); @@ -2007,7 +2006,7 @@ static void dump_get_atom_information_reply( const struct get_atom_information_r { fprintf( stderr, " count=%d,", req->count ); fprintf( stderr, " pinned=%d,", req->pinned ); - fprintf( stderr, " total=%lu,", (unsigned long)req->total ); + fprintf( stderr, " total=%u,", req->total ); fprintf( stderr, " name=" ); dump_varargs_unicode_str( cur_size ); } @@ -2127,7 +2126,7 @@ static void dump_get_message_reply( const struct get_message_reply *req ) fprintf( stderr, " info=%08x,", req->info ); fprintf( stderr, " hw_id=%08x,", req->hw_id ); fprintf( stderr, " active_hooks=%08x,", req->active_hooks ); - fprintf( stderr, " total=%lu,", (unsigned long)req->total ); + fprintf( stderr, " total=%u,", req->total ); fprintf( stderr, " data=" ); dump_varargs_bytes( cur_size ); } @@ -2368,7 +2367,7 @@ static void dump_set_window_info_request( const struct set_window_info_request * fprintf( stderr, " is_unicode=%d,", req->is_unicode ); fprintf( stderr, " user_data=%p,", req->user_data ); fprintf( stderr, " extra_offset=%d,", req->extra_offset ); - fprintf( stderr, " extra_size=%lu,", (unsigned long)req->extra_size ); + fprintf( stderr, " extra_size=%u,", req->extra_size ); fprintf( stderr, " extra_value=%08x", req->extra_value ); } @@ -2531,7 +2530,7 @@ static void dump_get_visible_region_reply( const struct get_visible_region_reply fprintf( stderr, " top_org_y=%d,", req->top_org_y ); fprintf( stderr, " win_org_x=%d,", req->win_org_x ); fprintf( stderr, " win_org_y=%d,", req->win_org_y ); - fprintf( stderr, " total_size=%lu,", (unsigned long)req->total_size ); + fprintf( stderr, " total_size=%u,", req->total_size ); fprintf( stderr, " region=" ); dump_varargs_rectangles( cur_size ); } @@ -2543,7 +2542,7 @@ static void dump_get_window_region_request( const struct get_window_region_reque static void dump_get_window_region_reply( const struct get_window_region_reply *req ) { - fprintf( stderr, " total_size=%lu,", (unsigned long)req->total_size ); + fprintf( stderr, " total_size=%u,", req->total_size ); fprintf( stderr, " region=" ); dump_varargs_rectangles( cur_size ); } @@ -2566,7 +2565,7 @@ static void dump_get_update_region_reply( const struct get_update_region_reply * { fprintf( stderr, " child=%p,", req->child ); fprintf( stderr, " flags=%08x,", req->flags ); - fprintf( stderr, " total_size=%lu,", (unsigned long)req->total_size ); + fprintf( stderr, " total_size=%u,", req->total_size ); fprintf( stderr, " region=" ); dump_varargs_rectangles( cur_size ); } @@ -2988,7 +2987,7 @@ static void dump_set_class_info_request( const struct set_class_info_request *re fprintf( stderr, " win_extra=%d,", req->win_extra ); fprintf( stderr, " instance=%p,", req->instance ); fprintf( stderr, " extra_offset=%d,", req->extra_offset ); - fprintf( stderr, " extra_size=%lu,", (unsigned long)req->extra_size ); + fprintf( stderr, " extra_size=%u,", req->extra_size ); fprintf( stderr, " extra_value=%lx", req->extra_value ); } @@ -3135,7 +3134,7 @@ static void dump_get_token_user_request( const struct get_token_user_request *re static void dump_get_token_user_reply( const struct get_token_user_reply *req ) { - fprintf( stderr, " user_len=%lu,", (unsigned long)req->user_len ); + fprintf( stderr, " user_len=%u,", req->user_len ); fprintf( stderr, " user=" ); dump_varargs_SID( cur_size ); } @@ -3147,7 +3146,7 @@ static void dump_get_token_groups_request( const struct get_token_groups_request static void dump_get_token_groups_reply( const struct get_token_groups_reply *req ) { - fprintf( stderr, " user_len=%lu,", (unsigned long)req->user_len ); + fprintf( stderr, " user_len=%u,", req->user_len ); fprintf( stderr, " user=" ); dump_varargs_token_groups( cur_size ); } @@ -3231,7 +3230,7 @@ static void dump_create_symlink_request( const struct create_symlink_request *re fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " rootdir=%p,", req->rootdir ); - fprintf( stderr, " name_len=%lu,", (unsigned long)req->name_len ); + fprintf( stderr, " name_len=%u,", req->name_len ); fprintf( stderr, " name=" ); dump_varargs_unicode_str( min(cur_size,req->name_len) ); fputc( ',', stderr ); @@ -4019,7 +4018,6 @@ void trace_request(void) fprintf( stderr, "%04x: %s(", current->id, req_names[req] ); if (req_dumpers[req]) { - cur_pos = 0; cur_data = get_req_data(); cur_size = get_req_data_size(); req_dumpers[req]( ¤t->req ); @@ -4038,7 +4036,6 @@ void trace_reply( enum request req, const union generic_reply *reply ) if (reply_dumpers[req]) { fprintf( stderr, " {" ); - cur_pos = 0; cur_data = current->reply_data; cur_size = reply->reply_header.reply_size; reply_dumpers[req]( reply ); diff --git a/server/user.h b/server/user.h index 662b796dc3d..946b57864c9 100644 --- a/server/user.h +++ b/server/user.h @@ -95,19 +95,19 @@ extern void post_message( user_handle_t win, unsigned int message, extern void post_win_event( struct thread *thread, unsigned int event, user_handle_t win, unsigned int object_id, unsigned int child_id, void *proc, - const WCHAR *module, size_t module_size, + const WCHAR *module, data_size_t module_size, user_handle_t handle ); /* region functions */ extern struct region *create_empty_region(void); -extern struct region *create_region_from_req_data( const void *data, size_t size ); +extern struct region *create_region_from_req_data( const void *data, data_size_t size ); extern void free_region( struct region *region ); extern void set_region_rect( struct region *region, const rectangle_t *rect ); -extern rectangle_t *get_region_data( const struct region *region, size_t max_size, - size_t *total_size ); -extern rectangle_t *get_region_data_and_free( struct region *region, size_t max_size, - size_t *total_size ); +extern rectangle_t *get_region_data( const struct region *region, data_size_t max_size, + data_size_t *total_size ); +extern rectangle_t *get_region_data_and_free( struct region *region, data_size_t max_size, + data_size_t *total_size ); extern int is_region_empty( const struct region *region ); extern void get_region_extents( const struct region *region, rectangle_t *rect ); extern void offset_region( struct region *region, int x, int y ); diff --git a/server/window.c b/server/window.c index 82d709d47a2..91930d0cc2c 100644 --- a/server/window.c +++ b/server/window.c @@ -1561,7 +1561,7 @@ DECL_HANDLER(get_window_parents) struct window *ptr, *win = get_window( req->handle ); int total = 0; user_handle_t *data; - size_t len; + data_size_t len; if (win) for (ptr = win->parent; ptr; ptr = ptr->parent) total++; @@ -1581,7 +1581,7 @@ DECL_HANDLER(get_window_children) struct window *ptr, *parent = get_window( req->parent ); int total = 0; user_handle_t *data; - size_t len; + data_size_t len; if (parent) { @@ -1613,7 +1613,7 @@ DECL_HANDLER(get_window_children_from_point) { struct user_handle_array array; struct window *parent = get_window( req->parent ); - size_t len; + data_size_t len; if (!parent) return; @@ -1731,7 +1731,7 @@ DECL_HANDLER(get_window_text) if (win && win->text) { - size_t len = strlenW( win->text ) * sizeof(WCHAR); + data_size_t len = strlenW( win->text ) * sizeof(WCHAR); if (len > get_reply_max_size()) len = get_reply_max_size(); set_reply_data( win->text, len ); } @@ -1746,7 +1746,7 @@ DECL_HANDLER(set_window_text) if (win) { WCHAR *text = NULL; - size_t len = get_req_data_size() / sizeof(WCHAR); + data_size_t len = get_req_data_size() / sizeof(WCHAR); if (len) { if (!(text = mem_alloc( (len+1) * sizeof(WCHAR) ))) return; diff --git a/server/winstation.c b/server/winstation.c index 14a8869a726..6fced818724 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -152,7 +152,7 @@ static WCHAR *build_desktop_name( const struct unicode_str *name, { const WCHAR *winstation_name; WCHAR *full_name; - size_t winstation_len; + data_size_t winstation_len; if (memchrW( name->str, '\\', name->len / sizeof(WCHAR) )) { @@ -565,7 +565,7 @@ DECL_HANDLER(set_user_object_info) } if (get_reply_max_size()) { - size_t len; + data_size_t len; const WCHAR *ptr, *name = get_object_name( obj, &len ); /* if there is a backslash return the part of the name after it */ diff --git a/tools/make_requests b/tools/make_requests index a11cc242973..ccef89bdf1f 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -33,6 +33,7 @@ my %formats = "void*" => "%p", "time_t" => "%ld (long)", "size_t" => "%lu (unsigned long)", + "data_size_t" => "%u", "obj_handle_t" => "%p", "atom_t" => "%04x", "user_handle_t" => "%p",