{
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 );
}
};
-#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
{
int count;
process_id_t pid;
process_id_t ppid;
- void* heap;
- void* module;
int threads;
int priority;
int handles;
-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;
REQ_create_snapshot,
REQ_next_process,
REQ_next_thread,
- REQ_next_module,
REQ_wait_debug_event,
REQ_queue_exception_event,
REQ_get_exception_status,
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;
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;
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 */
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)
{
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 );
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 */
@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
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 */
@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? */
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);
(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,
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 );
/* 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;
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;
}
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;
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 )
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 */
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 );
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 );
- }
-}
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 )
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 );
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 );
(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,
(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,
"create_snapshot",
"next_process",
"next_thread",
- "next_module",
"wait_debug_event",
"queue_exception_event",
"get_exception_status",