server: Get rid of the support for module snapshots, it is no longer needed.

This commit is contained in:
Alexandre Julliard 2008-12-09 11:49:37 +01:00
parent 82280618db
commit db6e45488d
8 changed files with 13 additions and 185 deletions

View File

@ -787,7 +787,6 @@ NTSTATUS WINAPI NtQuerySystemInformation(
{
req->flags = SNAP_PROCESS | SNAP_THREAD;
req->attributes = 0;
req->pid = 0;
if (!(ret = wine_server_call( req )))
hSnap = wine_server_ptr_handle( reply->handle );
}

View File

@ -1760,17 +1760,14 @@ struct add_mapping_committed_range_reply
};
#define SNAP_HEAPLIST 0x00000001
#define SNAP_PROCESS 0x00000002
#define SNAP_THREAD 0x00000004
#define SNAP_MODULE 0x00000008
#define SNAP_PROCESS 0x00000001
#define SNAP_THREAD 0x00000002
struct create_snapshot_request
{
struct request_header __header;
unsigned int attributes;
int flags;
process_id_t pid;
unsigned int flags;
};
struct create_snapshot_reply
{
@ -1792,8 +1789,6 @@ struct next_process_reply
int count;
process_id_t pid;
process_id_t ppid;
void* heap;
void* module;
int threads;
int priority;
int handles;
@ -1820,23 +1815,6 @@ struct next_thread_reply
struct next_module_request
{
struct request_header __header;
obj_handle_t handle;
int reset;
};
struct next_module_reply
{
struct reply_header __header;
process_id_t pid;
void* base;
size_t size;
/* VARARG(filename,unicode_str); */
};
struct wait_debug_event_request
{
struct request_header __header;
@ -4424,7 +4402,6 @@ enum request
REQ_create_snapshot,
REQ_next_process,
REQ_next_thread,
REQ_next_module,
REQ_wait_debug_event,
REQ_queue_exception_event,
REQ_get_exception_status,
@ -4668,7 +4645,6 @@ union generic_request
struct create_snapshot_request create_snapshot_request;
struct next_process_request next_process_request;
struct next_thread_request next_thread_request;
struct next_module_request next_module_request;
struct wait_debug_event_request wait_debug_event_request;
struct queue_exception_event_request queue_exception_event_request;
struct get_exception_status_request get_exception_status_request;
@ -4910,7 +4886,6 @@ union generic_reply
struct create_snapshot_reply create_snapshot_reply;
struct next_process_reply next_process_reply;
struct next_thread_reply next_thread_reply;
struct next_module_reply next_module_reply;
struct wait_debug_event_reply wait_debug_event_reply;
struct queue_exception_event_reply queue_exception_event_reply;
struct get_exception_status_reply get_exception_status_reply;
@ -5071,6 +5046,6 @@ union generic_reply
struct set_window_layered_info_reply set_window_layered_info_reply;
};
#define SERVER_PROTOCOL_VERSION 347
#define SERVER_PROTOCOL_VERSION 348
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -861,30 +861,6 @@ struct process_snapshot *process_snap( int *count )
return snapshot;
}
/* take a snapshot of the modules of a process */
struct module_snapshot *module_snap( struct process *process, int *count )
{
struct module_snapshot *snapshot, *ptr;
struct process_dll *dll;
int total = 0;
LIST_FOR_EACH_ENTRY( dll, &process->dlls, struct process_dll, entry ) total++;
if (!(snapshot = mem_alloc( sizeof(*snapshot) * total ))) return NULL;
ptr = snapshot;
LIST_FOR_EACH_ENTRY( dll, &process->dlls, struct process_dll, entry )
{
ptr->base = dll->base;
ptr->size = dll->size;
ptr->namelen = dll->namelen;
ptr->filename = memdup( dll->filename, dll->namelen );
ptr++;
}
*count = total;
return snapshot;
}
/* create a new process */
DECL_HANDLER(new_process)
{

View File

@ -93,14 +93,6 @@ struct process_snapshot
int handles; /* number of handles */
};
struct module_snapshot
{
void *base; /* module base addr */
size_t size; /* module size */
data_size_t namelen; /* length of file name */
WCHAR *filename; /* module file name */
};
/* process functions */
extern unsigned int alloc_ptid( void *ptr );
@ -127,7 +119,6 @@ extern void kill_debugged_processes( struct thread *debugger, int exit_code );
extern void break_process( struct process *process );
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);
/* console functions */

View File

@ -1381,15 +1381,12 @@ enum char_info_mode
@END
#define SNAP_HEAPLIST 0x00000001
#define SNAP_PROCESS 0x00000002
#define SNAP_THREAD 0x00000004
#define SNAP_MODULE 0x00000008
#define SNAP_PROCESS 0x00000001
#define SNAP_THREAD 0x00000002
/* Create a snapshot */
@REQ(create_snapshot)
unsigned int attributes; /* object attributes */
int flags; /* snapshot flags (SNAP_*) */
process_id_t pid; /* process id */
unsigned int flags; /* snapshot flags (SNAP_*) */
@REPLY
obj_handle_t handle; /* handle to the snapshot */
@END
@ -1403,8 +1400,6 @@ enum char_info_mode
int count; /* process usage count */
process_id_t pid; /* process id */
process_id_t ppid; /* parent process id */
void* heap; /* heap base */
void* module; /* main module */
int threads; /* number of threads */
int priority; /* process priority */
int handles; /* number of handles */
@ -1425,18 +1420,6 @@ enum char_info_mode
@END
/* Get the next module from a snapshot */
@REQ(next_module)
obj_handle_t handle; /* handle to the snapshot */
int reset; /* reset snapshot position? */
@REPLY
process_id_t pid; /* process id */
void* base; /* module base address */
size_t size; /* module size */
VARARG(filename,unicode_str); /* file name of module */
@END
/* Wait for a debug event */
@REQ(wait_debug_event)
int get_handle; /* should we alloc a handle for waiting? */

View File

@ -189,7 +189,6 @@ DECL_HANDLER(add_mapping_committed_range);
DECL_HANDLER(create_snapshot);
DECL_HANDLER(next_process);
DECL_HANDLER(next_thread);
DECL_HANDLER(next_module);
DECL_HANDLER(wait_debug_event);
DECL_HANDLER(queue_exception_event);
DECL_HANDLER(get_exception_status);
@ -432,7 +431,6 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_create_snapshot,
(req_handler)req_next_process,
(req_handler)req_next_thread,
(req_handler)req_next_module,
(req_handler)req_wait_debug_event,
(req_handler)req_queue_exception_event,
(req_handler)req_get_exception_status,

View File

@ -42,16 +42,12 @@
struct snapshot
{
struct object obj; /* object header */
struct process *process; /* process of this snapshot (for modules and heaps) */
struct process_snapshot *processes; /* processes snapshot */
int process_count; /* count of processes */
int process_pos; /* current position in proc snapshot */
struct thread_snapshot *threads; /* threads snapshot */
int thread_count; /* count of threads */
int thread_pos; /* current position in thread snapshot */
struct module_snapshot *modules; /* modules snapshot */
int module_count; /* count of modules */
int module_pos; /* current position in module snapshot */
};
static void snapshot_dump( struct object *obj, int verbose );
@ -79,25 +75,11 @@ static const struct object_ops snapshot_ops =
/* create a new snapshot */
static struct snapshot *create_snapshot( process_id_t pid, int flags )
static struct snapshot *create_snapshot( unsigned int flags )
{
struct process *process = NULL;
struct snapshot *snapshot;
/* need a process for modules and heaps */
if (flags & (SNAP_MODULE|SNAP_HEAPLIST))
{
if (!pid) process = (struct process *)grab_object( current->process );
else if (!(process = get_process_from_id( pid ))) return NULL;
}
if (!(snapshot = alloc_object( &snapshot_ops )))
{
if (process) release_object( process );
return NULL;
}
snapshot->process = process;
if (!(snapshot = alloc_object( &snapshot_ops ))) return NULL;
snapshot->process_pos = 0;
snapshot->process_count = 0;
@ -109,11 +91,6 @@ static struct snapshot *create_snapshot( process_id_t pid, int flags )
if (flags & SNAP_THREAD)
snapshot->threads = thread_snap( &snapshot->thread_count );
snapshot->module_pos = 0;
snapshot->module_count = 0;
if (flags & SNAP_MODULE)
snapshot->modules = module_snap( process, &snapshot->module_count );
return snapshot;
}
@ -137,8 +114,6 @@ static int snapshot_next_process( struct snapshot *snapshot, struct next_process
reply->count = ptr->count;
reply->pid = get_process_id( ptr->process );
reply->ppid = ptr->process->parent ? get_process_id( ptr->process->parent ) : 0;
reply->heap = NULL; /* FIXME */
reply->module = NULL; /* FIXME */
reply->threads = ptr->threads;
reply->priority = ptr->priority;
reply->handles = ptr->handles;
@ -174,39 +149,12 @@ static int snapshot_next_thread( struct snapshot *snapshot, struct next_thread_r
return 1;
}
/* get the next module in the snapshot */
static int snapshot_next_module( struct snapshot *snapshot, struct next_module_reply *reply )
{
struct module_snapshot *ptr;
if (!snapshot->module_count)
{
set_error( STATUS_INVALID_PARAMETER ); /* FIXME */
return 0;
}
if (snapshot->module_pos >= snapshot->module_count)
{
set_error( STATUS_NO_MORE_FILES );
return 0;
}
ptr = &snapshot->modules[snapshot->module_pos++];
reply->pid = get_process_id( snapshot->process );
reply->base = ptr->base;
reply->size = ptr->size;
if (ptr->filename)
{
data_size_t len = min( ptr->namelen, get_reply_max_size() );
set_reply_data( ptr->filename, len );
}
return 1;
}
static void snapshot_dump( struct object *obj, int verbose )
{
struct snapshot *snapshot = (struct snapshot *)obj;
assert( obj->ops == &snapshot_ops );
fprintf( stderr, "Snapshot: %d procs %d threads %d modules\n",
snapshot->process_count, snapshot->thread_count, snapshot->module_count );
fprintf( stderr, "Snapshot: %d procs %d threads\n",
snapshot->process_count, snapshot->thread_count );
}
static void snapshot_destroy( struct object *obj )
@ -226,13 +174,6 @@ static void snapshot_destroy( struct object *obj )
release_object( snapshot->threads[i].thread );
free( snapshot->threads );
}
if (snapshot->module_count)
{
for (i = 0; i < snapshot->module_count; i++)
free( snapshot->modules[i].filename );
free( snapshot->modules );
}
if (snapshot->process) release_object( snapshot->process );
}
/* create a snapshot */
@ -241,7 +182,7 @@ DECL_HANDLER(create_snapshot)
struct snapshot *snapshot;
reply->handle = 0;
if ((snapshot = create_snapshot( req->pid, req->flags )))
if ((snapshot = create_snapshot( req->flags )))
{
reply->handle = alloc_handle( current->process, snapshot, 0, req->attributes );
release_object( snapshot );
@ -275,17 +216,3 @@ DECL_HANDLER(next_thread)
release_object( snapshot );
}
}
/* get the next module from a snapshot */
DECL_HANDLER(next_module)
{
struct snapshot *snapshot;
if ((snapshot = (struct snapshot *)get_handle_obj( current->process, req->handle,
0, &snapshot_ops )))
{
if (req->reset) snapshot->module_pos = 0;
snapshot_next_module( snapshot, reply );
release_object( snapshot );
}
}

View File

@ -1813,8 +1813,7 @@ static void dump_add_mapping_committed_range_request( const struct add_mapping_c
static void dump_create_snapshot_request( const struct create_snapshot_request *req )
{
fprintf( stderr, " attributes=%08x,", req->attributes );
fprintf( stderr, " flags=%d,", req->flags );
fprintf( stderr, " pid=%04x", req->pid );
fprintf( stderr, " flags=%08x", req->flags );
}
static void dump_create_snapshot_reply( const struct create_snapshot_reply *req )
@ -1833,8 +1832,6 @@ static void dump_next_process_reply( const struct next_process_reply *req )
fprintf( stderr, " count=%d,", req->count );
fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " ppid=%04x,", req->ppid );
fprintf( stderr, " heap=%p,", req->heap );
fprintf( stderr, " module=%p,", req->module );
fprintf( stderr, " threads=%d,", req->threads );
fprintf( stderr, " priority=%d,", req->priority );
fprintf( stderr, " handles=%d,", req->handles );
@ -1857,21 +1854,6 @@ static void dump_next_thread_reply( const struct next_thread_reply *req )
fprintf( stderr, " delta_pri=%d", req->delta_pri );
}
static void dump_next_module_request( const struct next_module_request *req )
{
fprintf( stderr, " handle=%04x,", req->handle );
fprintf( stderr, " reset=%d", req->reset );
}
static void dump_next_module_reply( const struct next_module_reply *req )
{
fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " base=%p,", req->base );
fprintf( stderr, " size=%lu,", (unsigned long)req->size );
fprintf( stderr, " filename=" );
dump_varargs_unicode_str( cur_size );
}
static void dump_wait_debug_event_request( const struct wait_debug_event_request *req )
{
fprintf( stderr, " get_handle=%d", req->get_handle );
@ -3904,7 +3886,6 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_create_snapshot_request,
(dump_func)dump_next_process_request,
(dump_func)dump_next_thread_request,
(dump_func)dump_next_module_request,
(dump_func)dump_wait_debug_event_request,
(dump_func)dump_queue_exception_event_request,
(dump_func)dump_get_exception_status_request,
@ -4144,7 +4125,6 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_create_snapshot_reply,
(dump_func)dump_next_process_reply,
(dump_func)dump_next_thread_reply,
(dump_func)dump_next_module_reply,
(dump_func)dump_wait_debug_event_reply,
(dump_func)dump_queue_exception_event_reply,
(dump_func)dump_get_exception_status_reply,
@ -4384,7 +4364,6 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"create_snapshot",
"next_process",
"next_thread",
"next_module",
"wait_debug_event",
"queue_exception_event",
"get_exception_status",