Commit 0f273c17 authored by Alexandre Julliard's avatar Alexandre Julliard

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.
parent dd6598b8
......@@ -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;
......
......@@ -15,17 +15,24 @@
#include <windef.h>
#include <winbase.h>
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 */
......@@ -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;
......
......@@ -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 );
}
......
......@@ -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;
}
......
......@@ -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 )
{
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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 );
}
}
......
......@@ -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; }
......
......@@ -31,17 +31,24 @@
#include <windef.h>
#include <winbase.h>
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
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment