- no longer depend on toolhelp definitions for generating snapshots
- added get_dll_info request
This commit is contained in:
parent
4b708a3ffd
commit
2359b57574
|
@ -221,7 +221,11 @@ HANDLE WINAPI CreateToolhelp32Snapshot( DWORD flags, DWORD process )
|
|||
/* Now do the snapshot */
|
||||
SERVER_START_REQ( create_snapshot )
|
||||
{
|
||||
req->flags = flags & ~TH32CS_INHERIT;
|
||||
req->flags = 0;
|
||||
if (flags & TH32CS_SNAPMODULE) req->flags |= SNAP_MODULE;
|
||||
if (flags & TH32CS_SNAPPROCESS) req->flags |= SNAP_PROCESS;
|
||||
if (flags & TH32CS_SNAPTHREAD) req->flags |= SNAP_THREAD;
|
||||
|
||||
req->inherit = (flags & TH32CS_INHERIT) != 0;
|
||||
req->pid = process;
|
||||
wine_server_call_err( req );
|
||||
|
|
|
@ -417,6 +417,22 @@ struct set_thread_info_reply
|
|||
|
||||
|
||||
|
||||
struct get_dll_info_request
|
||||
{
|
||||
struct request_header __header;
|
||||
obj_handle_t handle;
|
||||
void* base_address;
|
||||
};
|
||||
struct get_dll_info_reply
|
||||
{
|
||||
struct reply_header __header;
|
||||
size_t size;
|
||||
void* entry_point;
|
||||
/* VARARG(filename,string); */
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct suspend_thread_request
|
||||
{
|
||||
struct request_header __header;
|
||||
|
@ -1493,6 +1509,10 @@ struct create_device_reply
|
|||
};
|
||||
|
||||
|
||||
#define SNAP_HEAPLIST 0x00000001
|
||||
#define SNAP_PROCESS 0x00000002
|
||||
#define SNAP_THREAD 0x00000004
|
||||
#define SNAP_MODULE 0x00000008
|
||||
|
||||
struct create_snapshot_request
|
||||
{
|
||||
|
@ -2993,6 +3013,7 @@ enum request
|
|||
REQ_set_process_info,
|
||||
REQ_get_thread_info,
|
||||
REQ_set_thread_info,
|
||||
REQ_get_dll_info,
|
||||
REQ_suspend_thread,
|
||||
REQ_resume_thread,
|
||||
REQ_load_dll,
|
||||
|
@ -3172,6 +3193,7 @@ union generic_request
|
|||
struct set_process_info_request set_process_info_request;
|
||||
struct get_thread_info_request get_thread_info_request;
|
||||
struct set_thread_info_request set_thread_info_request;
|
||||
struct get_dll_info_request get_dll_info_request;
|
||||
struct suspend_thread_request suspend_thread_request;
|
||||
struct resume_thread_request resume_thread_request;
|
||||
struct load_dll_request load_dll_request;
|
||||
|
@ -3349,6 +3371,7 @@ union generic_reply
|
|||
struct set_process_info_reply set_process_info_reply;
|
||||
struct get_thread_info_reply get_thread_info_reply;
|
||||
struct set_thread_info_reply set_thread_info_reply;
|
||||
struct get_dll_info_reply get_dll_info_reply;
|
||||
struct suspend_thread_reply suspend_thread_reply;
|
||||
struct resume_thread_reply resume_thread_reply;
|
||||
struct load_dll_reply load_dll_reply;
|
||||
|
@ -3509,6 +3532,6 @@ union generic_reply
|
|||
struct get_next_hook_reply get_next_hook_reply;
|
||||
};
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 94
|
||||
#define SERVER_PROTOCOL_VERSION 95
|
||||
|
||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||
|
|
|
@ -1058,6 +1058,35 @@ DECL_HANDLER(unload_dll)
|
|||
process_unload_dll( current->process, req->base );
|
||||
}
|
||||
|
||||
/* retrieve information about a module in a process */
|
||||
DECL_HANDLER(get_dll_info)
|
||||
{
|
||||
struct process *process;
|
||||
|
||||
if ((process = get_process_from_handle( req->handle, PROCESS_QUERY_INFORMATION )))
|
||||
{
|
||||
struct process_dll *dll;
|
||||
|
||||
for (dll = &process->exe; dll; dll = dll->next)
|
||||
{
|
||||
if (dll->base == req->base_address)
|
||||
{
|
||||
reply->size = dll->size;
|
||||
reply->entry_point = 0; /* FIXME */
|
||||
if (dll->filename)
|
||||
{
|
||||
size_t len = min( dll->namelen, get_reply_max_size() );
|
||||
set_reply_data( dll->filename, len );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dll)
|
||||
set_error(STATUS_DLL_NOT_FOUND);
|
||||
release_object( process );
|
||||
}
|
||||
}
|
||||
|
||||
/* wait for a process to start waiting on input */
|
||||
/* FIXME: only returns event for now, wait is done in the client */
|
||||
DECL_HANDLER(wait_input_idle)
|
||||
|
|
|
@ -359,6 +359,17 @@ typedef struct
|
|||
#define SET_THREAD_INFO_AFFINITY 0x02
|
||||
|
||||
|
||||
/* Retrieve information about a module */
|
||||
@REQ(get_dll_info)
|
||||
obj_handle_t handle; /* process handle */
|
||||
void* base_address; /* base address of module */
|
||||
@REPLY
|
||||
size_t size; /* module size */
|
||||
void* entry_point;
|
||||
VARARG(filename,string); /* file name of module */
|
||||
@END
|
||||
|
||||
|
||||
/* Suspend a thread */
|
||||
@REQ(suspend_thread)
|
||||
obj_handle_t handle; /* thread handle */
|
||||
|
@ -1100,10 +1111,14 @@ enum char_info_mode
|
|||
@END
|
||||
|
||||
|
||||
#define SNAP_HEAPLIST 0x00000001
|
||||
#define SNAP_PROCESS 0x00000002
|
||||
#define SNAP_THREAD 0x00000004
|
||||
#define SNAP_MODULE 0x00000008
|
||||
/* Create a snapshot */
|
||||
@REQ(create_snapshot)
|
||||
int inherit; /* inherit flag */
|
||||
int flags; /* snapshot flags (TH32CS_*) */
|
||||
int flags; /* snapshot flags (SNAP_*) */
|
||||
process_id_t pid; /* process id */
|
||||
@REPLY
|
||||
obj_handle_t handle; /* handle to the snapshot */
|
||||
|
|
|
@ -117,6 +117,7 @@ DECL_HANDLER(get_process_info);
|
|||
DECL_HANDLER(set_process_info);
|
||||
DECL_HANDLER(get_thread_info);
|
||||
DECL_HANDLER(set_thread_info);
|
||||
DECL_HANDLER(get_dll_info);
|
||||
DECL_HANDLER(suspend_thread);
|
||||
DECL_HANDLER(resume_thread);
|
||||
DECL_HANDLER(load_dll);
|
||||
|
@ -295,6 +296,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
|
|||
(req_handler)req_set_process_info,
|
||||
(req_handler)req_get_thread_info,
|
||||
(req_handler)req_set_thread_info,
|
||||
(req_handler)req_get_dll_info,
|
||||
(req_handler)req_suspend_thread,
|
||||
(req_handler)req_resume_thread,
|
||||
(req_handler)req_load_dll,
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "tlhelp32.h"
|
||||
|
||||
#include "handle.h"
|
||||
#include "process.h"
|
||||
|
@ -79,7 +78,7 @@ static struct snapshot *create_snapshot( process_id_t pid, int flags )
|
|||
struct snapshot *snapshot;
|
||||
|
||||
/* need a process for modules and heaps */
|
||||
if (flags & (TH32CS_SNAPMODULE|TH32CS_SNAPHEAPLIST))
|
||||
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;
|
||||
|
@ -95,17 +94,17 @@ static struct snapshot *create_snapshot( process_id_t pid, int flags )
|
|||
|
||||
snapshot->process_pos = 0;
|
||||
snapshot->process_count = 0;
|
||||
if (flags & TH32CS_SNAPPROCESS)
|
||||
if (flags & SNAP_PROCESS)
|
||||
snapshot->processes = process_snap( &snapshot->process_count );
|
||||
|
||||
snapshot->thread_pos = 0;
|
||||
snapshot->thread_count = 0;
|
||||
if (flags & TH32CS_SNAPTHREAD)
|
||||
if (flags & SNAP_THREAD)
|
||||
snapshot->threads = thread_snap( &snapshot->thread_count );
|
||||
|
||||
snapshot->module_pos = 0;
|
||||
snapshot->module_count = 0;
|
||||
if (flags & TH32CS_SNAPMODULE)
|
||||
if (flags & SNAP_MODULE)
|
||||
snapshot->modules = module_snap( process, &snapshot->module_count );
|
||||
|
||||
return snapshot;
|
||||
|
|
|
@ -528,6 +528,20 @@ static void dump_set_thread_info_request( const struct set_thread_info_request *
|
|||
fprintf( stderr, " affinity=%d", req->affinity );
|
||||
}
|
||||
|
||||
static void dump_get_dll_info_request( const struct get_dll_info_request *req )
|
||||
{
|
||||
fprintf( stderr, " handle=%p,", req->handle );
|
||||
fprintf( stderr, " base_address=%p", req->base_address );
|
||||
}
|
||||
|
||||
static void dump_get_dll_info_reply( const struct get_dll_info_reply *req )
|
||||
{
|
||||
fprintf( stderr, " size=%d,", req->size );
|
||||
fprintf( stderr, " entry_point=%p,", req->entry_point );
|
||||
fprintf( stderr, " filename=" );
|
||||
dump_varargs_string( cur_size );
|
||||
}
|
||||
|
||||
static void dump_suspend_thread_request( const struct suspend_thread_request *req )
|
||||
{
|
||||
fprintf( stderr, " handle=%p", req->handle );
|
||||
|
@ -2384,6 +2398,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
|
|||
(dump_func)dump_set_process_info_request,
|
||||
(dump_func)dump_get_thread_info_request,
|
||||
(dump_func)dump_set_thread_info_request,
|
||||
(dump_func)dump_get_dll_info_request,
|
||||
(dump_func)dump_suspend_thread_request,
|
||||
(dump_func)dump_resume_thread_request,
|
||||
(dump_func)dump_load_dll_request,
|
||||
|
@ -2559,6 +2574,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
|
|||
(dump_func)0,
|
||||
(dump_func)dump_get_thread_info_reply,
|
||||
(dump_func)0,
|
||||
(dump_func)dump_get_dll_info_reply,
|
||||
(dump_func)dump_suspend_thread_reply,
|
||||
(dump_func)dump_resume_thread_reply,
|
||||
(dump_func)0,
|
||||
|
@ -2734,6 +2750,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
|
|||
"set_process_info",
|
||||
"get_thread_info",
|
||||
"set_thread_info",
|
||||
"get_dll_info",
|
||||
"suspend_thread",
|
||||
"resume_thread",
|
||||
"load_dll",
|
||||
|
|
Loading…
Reference in New Issue