server: Add a module_handle_t type to represent client-side module handles.

This commit is contained in:
Alexandre Julliard 2008-12-29 16:41:44 +01:00
parent edda4637b4
commit cb2788efaf
9 changed files with 47 additions and 40 deletions

View File

@ -26,6 +26,8 @@ typedef unsigned __int64 lparam_t;
typedef unsigned __int64 apc_param_t;
typedef unsigned __int64 mem_size_t;
typedef unsigned __int64 file_pos_t;
typedef void *client_ptr_t;
typedef client_ptr_t mod_handle_t;
struct request_header
{
@ -68,7 +70,7 @@ struct debug_event_create_process
obj_handle_t file;
obj_handle_t process;
obj_handle_t thread;
void *base;
mod_handle_t base;
int dbg_offset;
int dbg_size;
void *teb;
@ -83,7 +85,7 @@ struct debug_event_exit
struct debug_event_load_dll
{
obj_handle_t handle;
void *base;
mod_handle_t base;
int dbg_offset;
int dbg_size;
void *name;
@ -91,7 +93,7 @@ struct debug_event_load_dll
};
struct debug_event_unload_dll
{
void *base;
mod_handle_t base;
};
struct debug_event_output_string
{
@ -530,7 +532,7 @@ struct get_startup_info_reply
struct init_process_done_request
{
struct request_header __header;
void* module;
mod_handle_t module;
void* entry;
int gui;
};
@ -677,7 +679,7 @@ struct get_dll_info_request
{
struct request_header __header;
obj_handle_t handle;
void* base_address;
mod_handle_t base_address;
};
struct get_dll_info_reply
{
@ -720,7 +722,7 @@ struct load_dll_request
{
struct request_header __header;
obj_handle_t handle;
void* base;
mod_handle_t base;
void* name;
data_size_t size;
int dbg_offset;
@ -737,7 +739,7 @@ struct load_dll_reply
struct unload_dll_request
{
struct request_header __header;
void* base;
mod_handle_t base;
};
struct unload_dll_reply
{
@ -2777,7 +2779,7 @@ struct create_window_request
user_handle_t parent;
user_handle_t owner;
atom_t atom;
void* instance;
mod_handle_t instance;
/* VARARG(class,unicode_str); */
};
struct create_window_reply
@ -2860,7 +2862,7 @@ struct set_window_info_request
unsigned int ex_style;
unsigned int id;
int is_unicode;
void* instance;
mod_handle_t instance;
lparam_t user_data;
int extra_offset;
data_size_t extra_size;
@ -2872,7 +2874,7 @@ struct set_window_info_reply
unsigned int old_style;
unsigned int old_ex_style;
unsigned int old_id;
void* old_instance;
mod_handle_t old_instance;
lparam_t old_user_data;
lparam_t old_extra_value;
};
@ -3656,7 +3658,7 @@ struct create_class_request
int local;
atom_t atom;
unsigned int style;
void* instance;
mod_handle_t instance;
int extra;
int win_extra;
void* client_ptr;
@ -3674,7 +3676,7 @@ struct destroy_class_request
{
struct request_header __header;
atom_t atom;
void* instance;
mod_handle_t instance;
/* VARARG(name,unicode_str); */
};
struct destroy_class_reply
@ -3693,7 +3695,7 @@ struct set_class_info_request
atom_t atom;
unsigned int style;
int win_extra;
void* instance;
mod_handle_t instance;
int extra_offset;
data_size_t extra_size;
lparam_t extra_value;
@ -3705,7 +3707,7 @@ struct set_class_info_reply
unsigned int old_style;
int old_extra;
int old_win_extra;
void* old_instance;
mod_handle_t old_instance;
lparam_t old_extra_value;
};
#define SET_CLASS_ATOM 0x0001

View File

@ -46,7 +46,7 @@ struct window_class
int count; /* reference count */
int local; /* local class? */
atom_t atom; /* class atom */
void *instance; /* module instance */
mod_handle_t instance; /* module instance */
unsigned int style; /* class style */
int win_extra; /* number of window extra bytes */
void *client_ptr; /* pointer to class in client address space */
@ -91,7 +91,7 @@ void destroy_process_classes( struct process *process )
}
}
static struct window_class *find_class( struct process *process, atom_t atom, void *instance )
static struct window_class *find_class( struct process *process, atom_t atom, mod_handle_t instance )
{
struct list *ptr;
@ -105,7 +105,7 @@ static struct window_class *find_class( struct process *process, atom_t atom, vo
}
struct window_class *grab_class( struct process *process, atom_t atom,
void *instance, int *extra_bytes )
mod_handle_t instance, int *extra_bytes )
{
struct window_class *class = find_class( process, atom, instance );
if (class)

View File

@ -205,7 +205,8 @@ static int fill_load_dll_event( struct debug_event *event, void *arg )
static int fill_unload_dll_event( struct debug_event *event, void *arg )
{
event->data.info.unload_dll.base = arg;
mod_handle_t *base = arg;
event->data.info.unload_dll.base = *base;
return 1;
}

View File

@ -505,7 +505,7 @@ struct process *get_process_from_handle( obj_handle_t handle, unsigned int acces
}
/* find a dll from its base address */
static inline struct process_dll *find_process_dll( struct process *process, void *base )
static inline struct process_dll *find_process_dll( struct process *process, mod_handle_t base )
{
struct process_dll *dll;
@ -518,7 +518,8 @@ 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, data_size_t name_len )
mod_handle_t base, const WCHAR *filename,
data_size_t name_len )
{
struct process_dll *dll;
@ -547,7 +548,7 @@ static struct process_dll *process_load_dll( struct process *process, struct fil
}
/* remove a dll from a process list */
static void process_unload_dll( struct process *process, void *base )
static void process_unload_dll( struct process *process, mod_handle_t base )
{
struct process_dll *dll = find_process_dll( process, base );
@ -557,7 +558,7 @@ static void process_unload_dll( struct process *process, void *base )
free( dll->filename );
list_remove( &dll->entry );
free( dll );
generate_debug_event( current, UNLOAD_DLL_DEBUG_EVENT, base );
generate_debug_event( current, UNLOAD_DLL_DEBUG_EVENT, &base );
}
else set_error( STATUS_INVALID_PARAMETER );
}

View File

@ -37,7 +37,7 @@ struct process_dll
{
struct list entry; /* entry in per-process dll list */
struct file *file; /* dll file */
void *base; /* dll base address (in process addr space) */
mod_handle_t base; /* dll base address (in process addr space) */
void *name; /* ptr to ptr to name (in process addr space) */
data_size_t size; /* dll size */
int dbg_offset; /* debug info offset */

View File

@ -42,6 +42,8 @@ typedef unsigned __int64 lparam_t;
typedef unsigned __int64 apc_param_t;
typedef unsigned __int64 mem_size_t;
typedef unsigned __int64 file_pos_t;
typedef void *client_ptr_t;
typedef client_ptr_t mod_handle_t;
struct request_header
{
@ -84,7 +86,7 @@ struct debug_event_create_process
obj_handle_t file; /* handle to the process exe file */
obj_handle_t process; /* handle to the new process */
obj_handle_t thread; /* handle to the new thread */
void *base; /* base of executable image */
mod_handle_t base; /* base of executable image */
int dbg_offset; /* offset of debug info in file */
int dbg_size; /* size of debug info */
void *teb; /* thread teb (in debugged process address space) */
@ -99,7 +101,7 @@ struct debug_event_exit
struct debug_event_load_dll
{
obj_handle_t handle; /* file handle for the dll */
void *base; /* base address of the dll */
mod_handle_t base; /* base address of the dll */
int dbg_offset; /* offset of debug info in file */
int dbg_size; /* size of debug info */
void *name; /* image name (optional) */
@ -107,7 +109,7 @@ struct debug_event_load_dll
};
struct debug_event_unload_dll
{
void *base; /* base address of the dll */
mod_handle_t base; /* base address of the dll */
};
struct debug_event_output_string
{
@ -524,7 +526,7 @@ typedef union
/* Signal the end of the process initialization */
@REQ(init_process_done)
void* module; /* main module base address */
mod_handle_t module; /* main module base address */
void* entry; /* process entry point */
int gui; /* is it a GUI process? */
@END
@ -628,7 +630,7 @@ typedef union
/* Retrieve information about a module */
@REQ(get_dll_info)
obj_handle_t handle; /* process handle */
void* base_address; /* base address of module */
mod_handle_t base_address; /* base address of module */
@REPLY
void* entry_point;
data_size_t size; /* module size */
@ -656,7 +658,7 @@ typedef union
/* Notify the server that a dll has been loaded */
@REQ(load_dll)
obj_handle_t handle; /* file handle */
void* base; /* base address */
mod_handle_t base; /* base address */
void* name; /* ptr to ptr to name (in process addr space) */
data_size_t size; /* dll size */
int dbg_offset; /* debug info offset */
@ -667,7 +669,7 @@ typedef union
/* Notify the server that a dll is being unloaded */
@REQ(unload_dll)
void* base; /* base address */
mod_handle_t base; /* base address */
@END
@ -2050,7 +2052,7 @@ enum message_type
user_handle_t parent; /* parent window */
user_handle_t owner; /* owner window */
atom_t atom; /* class atom */
void* instance; /* module instance */
mod_handle_t instance; /* module instance */
VARARG(class,unicode_str); /* class name */
@REPLY
user_handle_t handle; /* created window */
@ -2107,7 +2109,7 @@ enum message_type
unsigned int ex_style; /* window extended style */
unsigned int id; /* window id */
int is_unicode; /* ANSI or unicode */
void* instance; /* creator instance */
mod_handle_t instance; /* creator instance */
lparam_t user_data; /* user-specific data */
int extra_offset; /* offset to set in extra bytes */
data_size_t extra_size; /* size to set in extra bytes */
@ -2116,7 +2118,7 @@ enum message_type
unsigned int old_style; /* old window style */
unsigned int old_ex_style; /* old window extended style */
unsigned int old_id; /* old window id */
void* old_instance; /* old creator instance */
mod_handle_t old_instance; /* old creator instance */
lparam_t old_user_data; /* old user-specific data */
lparam_t old_extra_value; /* old value in extra bytes */
@END
@ -2641,7 +2643,7 @@ enum message_type
int local; /* is it a local class? */
atom_t atom; /* class atom */
unsigned int style; /* class style */
void* instance; /* module instance */
mod_handle_t instance; /* module instance */
int extra; /* number of extra class bytes */
int win_extra; /* number of window extra bytes */
void* client_ptr; /* pointer to class in client address space */
@ -2654,7 +2656,7 @@ enum message_type
/* Destroy a window class */
@REQ(destroy_class)
atom_t atom; /* class atom */
void* instance; /* module instance */
mod_handle_t instance; /* module instance */
VARARG(name,unicode_str); /* class name */
@REPLY
void* client_ptr; /* pointer to class in client address space */
@ -2668,7 +2670,7 @@ enum message_type
atom_t atom; /* class atom */
unsigned int style; /* class style */
int win_extra; /* number of window extra bytes */
void* instance; /* module instance */
mod_handle_t instance; /* module instance */
int extra_offset; /* offset to set in extra bytes */
data_size_t extra_size; /* size to set in extra bytes */
lparam_t extra_value; /* value to set in extra bytes */
@ -2677,7 +2679,7 @@ enum message_type
unsigned int old_style; /* previous class style */
int old_extra; /* previous number of class extra bytes */
int old_win_extra; /* previous number of window extra bytes */
void* old_instance; /* previous module instance */
mod_handle_t old_instance; /* previous module instance */
lparam_t old_extra_value; /* old value in extra bytes */
@END
#define SET_CLASS_ATOM 0x0001

View File

@ -143,7 +143,7 @@ extern struct window_class *get_window_class( user_handle_t window );
extern void destroy_process_classes( struct process *process );
extern struct window_class *grab_class( struct process *process, atom_t atom,
void *instance, int *extra_bytes );
mod_handle_t instance, int *extra_bytes );
extern void release_class( struct window_class *class );
extern int is_desktop_class( struct window_class *class );
extern int is_hwnd_message_class( struct window_class *class );

View File

@ -76,7 +76,7 @@ struct window
unsigned int style; /* window style */
unsigned int ex_style; /* window extended style */
unsigned int id; /* window id */
void* instance; /* creator instance */
mod_handle_t instance; /* creator instance */
unsigned int is_unicode : 1; /* ANSI or unicode */
unsigned int is_linked : 1; /* is it linked into the parent z-order list? */
unsigned int is_layered : 1; /* has layered info been set? */
@ -428,7 +428,7 @@ void close_desktop_window( struct desktop *desktop )
/* create a new window structure (note: the window is not linked in the window tree) */
static struct window *create_window( struct window *parent, struct window *owner,
atom_t atom, void *instance )
atom_t atom, mod_handle_t instance )
{
static const rectangle_t empty_rect;
int extra_bytes;

View File

@ -36,6 +36,7 @@ my %formats =
"user_handle_t" => [ 4, 4, "%08x" ],
"process_id_t" => [ 4, 4, "%04x" ],
"thread_id_t" => [ 4, 4, "%04x" ],
"mod_handle_t" => [ 4, 4, "%p" ],
"lparam_t" => [ 8, 8, "&dump_uint64" ],
"apc_param_t" => [ 8, 8, "&dump_uint64" ],
"file_pos_t" => [ 8, 8, "&dump_uint64" ],