server: Make TEB and PEB client_ptr_t instead of void pointers.
This commit is contained in:
parent
c6c335d70e
commit
fa8643805b
|
@ -79,7 +79,7 @@ BOOL WINAPI WaitForDebugEvent(
|
|||
break;
|
||||
case CREATE_THREAD_DEBUG_EVENT:
|
||||
event->u.CreateThread.hThread = wine_server_ptr_handle( data.info.create_thread.handle );
|
||||
event->u.CreateThread.lpThreadLocalBase = data.info.create_thread.teb;
|
||||
event->u.CreateThread.lpThreadLocalBase = wine_server_get_ptr( data.info.create_thread.teb );
|
||||
event->u.CreateThread.lpStartAddress = wine_server_get_ptr( data.info.create_thread.start );
|
||||
break;
|
||||
case CREATE_PROCESS_DEBUG_EVENT:
|
||||
|
@ -89,7 +89,7 @@ BOOL WINAPI WaitForDebugEvent(
|
|||
event->u.CreateProcessInfo.lpBaseOfImage = wine_server_get_ptr( data.info.create_process.base );
|
||||
event->u.CreateProcessInfo.dwDebugInfoFileOffset = data.info.create_process.dbg_offset;
|
||||
event->u.CreateProcessInfo.nDebugInfoSize = data.info.create_process.dbg_size;
|
||||
event->u.CreateProcessInfo.lpThreadLocalBase = data.info.create_process.teb;
|
||||
event->u.CreateProcessInfo.lpThreadLocalBase = wine_server_get_ptr( data.info.create_process.teb );
|
||||
event->u.CreateProcessInfo.lpStartAddress = wine_server_get_ptr( data.info.create_process.start );
|
||||
event->u.CreateProcessInfo.lpImageName = wine_server_get_ptr( data.info.create_process.name );
|
||||
event->u.CreateProcessInfo.fUnicode = data.info.create_process.unicode;
|
||||
|
|
|
@ -162,7 +162,7 @@ NTSTATUS WINAPI NtQueryInformationProcess(
|
|||
if ((ret = wine_server_call( req )) == STATUS_SUCCESS)
|
||||
{
|
||||
pbi.ExitStatus = reply->exit_code;
|
||||
pbi.PebBaseAddress = reply->peb;
|
||||
pbi.PebBaseAddress = wine_server_get_ptr( reply->peb );
|
||||
pbi.AffinityMask = reply->affinity & affinity_mask;
|
||||
pbi.BasePriority = reply->priority;
|
||||
pbi.UniqueProcessId = reply->pid;
|
||||
|
|
|
@ -1048,8 +1048,8 @@ size_t server_init_thread( int unix_pid, int unix_tid, void *entry_point )
|
|||
{
|
||||
req->unix_pid = unix_pid;
|
||||
req->unix_tid = unix_tid;
|
||||
req->teb = NtCurrentTeb();
|
||||
req->peb = NtCurrentTeb()->Peb;
|
||||
req->teb = wine_server_client_ptr( NtCurrentTeb() );
|
||||
req->peb = wine_server_client_ptr( NtCurrentTeb()->Peb );
|
||||
req->entry = wine_server_client_ptr( entry_point );
|
||||
req->reply_fd = reply_pipe[1];
|
||||
req->wait_fd = ntdll_get_thread_data()->wait_fd[1];
|
||||
|
|
|
@ -1178,7 +1178,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
|
|||
if (!(status = wine_server_call( req )))
|
||||
{
|
||||
info.ExitStatus = reply->exit_code;
|
||||
info.TebBaseAddress = reply->teb;
|
||||
info.TebBaseAddress = wine_server_get_ptr( reply->teb );
|
||||
info.ClientId.UniqueProcess = ULongToHandle(reply->pid);
|
||||
info.ClientId.UniqueThread = ULongToHandle(reply->tid);
|
||||
info.AffinityMask = reply->affinity & affinity_mask;
|
||||
|
|
|
@ -62,7 +62,7 @@ struct debug_event_exception
|
|||
struct debug_event_create_thread
|
||||
{
|
||||
obj_handle_t handle;
|
||||
void *teb;
|
||||
client_ptr_t teb;
|
||||
client_ptr_t start;
|
||||
};
|
||||
struct debug_event_create_process
|
||||
|
@ -73,7 +73,7 @@ struct debug_event_create_process
|
|||
mod_handle_t base;
|
||||
int dbg_offset;
|
||||
int dbg_size;
|
||||
void *teb;
|
||||
client_ptr_t teb;
|
||||
client_ptr_t start;
|
||||
client_ptr_t name;
|
||||
int unicode;
|
||||
|
@ -558,11 +558,11 @@ struct init_thread_request
|
|||
int unix_pid;
|
||||
int unix_tid;
|
||||
int debug_level;
|
||||
void* teb;
|
||||
void* peb;
|
||||
client_ptr_t teb;
|
||||
client_ptr_t entry;
|
||||
int reply_fd;
|
||||
int wait_fd;
|
||||
client_ptr_t peb;
|
||||
};
|
||||
struct init_thread_reply
|
||||
{
|
||||
|
@ -615,12 +615,12 @@ struct get_process_info_reply
|
|||
struct reply_header __header;
|
||||
process_id_t pid;
|
||||
process_id_t ppid;
|
||||
int exit_code;
|
||||
int priority;
|
||||
unsigned int affinity;
|
||||
void* peb;
|
||||
client_ptr_t peb;
|
||||
timeout_t start_time;
|
||||
timeout_t end_time;
|
||||
int exit_code;
|
||||
};
|
||||
|
||||
|
||||
|
@ -653,12 +653,12 @@ struct get_thread_info_reply
|
|||
struct reply_header __header;
|
||||
process_id_t pid;
|
||||
thread_id_t tid;
|
||||
void* teb;
|
||||
int exit_code;
|
||||
client_ptr_t teb;
|
||||
int priority;
|
||||
unsigned int affinity;
|
||||
timeout_t creation_time;
|
||||
timeout_t exit_time;
|
||||
int exit_code;
|
||||
int last;
|
||||
};
|
||||
|
||||
|
@ -5061,6 +5061,6 @@ union generic_reply
|
|||
struct set_window_layered_info_reply set_window_layered_info_reply;
|
||||
};
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 375
|
||||
#define SERVER_PROTOCOL_VERSION 376
|
||||
|
||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||
|
|
|
@ -331,7 +331,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
|
|||
process->startup_info = NULL;
|
||||
process->idle_event = NULL;
|
||||
process->queue = NULL;
|
||||
process->peb = NULL;
|
||||
process->peb = 0;
|
||||
process->ldt_copy = 0;
|
||||
process->winstation = 0;
|
||||
process->desktop = 0;
|
||||
|
@ -829,7 +829,7 @@ int set_process_debug_flag( struct process *process, int flag )
|
|||
char data = (flag != 0);
|
||||
|
||||
/* BeingDebugged flag is the byte at offset 2 in the PEB */
|
||||
return write_process_memory( process, (client_ptr_t)(unsigned long)((char *)process->peb + 2), 1, &data );
|
||||
return write_process_memory( process, process->peb + 2, 1, &data );
|
||||
}
|
||||
|
||||
/* take a snapshot of currently running processes */
|
||||
|
|
|
@ -79,7 +79,7 @@ struct process
|
|||
obj_handle_t desktop; /* handle to desktop to use for new threads */
|
||||
struct token *token; /* security token associated with this process */
|
||||
struct list dlls; /* list of loaded dlls */
|
||||
void *peb; /* PEB address in client address space */
|
||||
client_ptr_t peb; /* PEB address in client address space */
|
||||
client_ptr_t ldt_copy; /* pointer to LDT copy in client addr space */
|
||||
unsigned int trace_data; /* opaque data used by the process tracing mechanism */
|
||||
};
|
||||
|
|
|
@ -78,7 +78,7 @@ struct debug_event_exception
|
|||
struct debug_event_create_thread
|
||||
{
|
||||
obj_handle_t handle; /* handle to the new thread */
|
||||
void *teb; /* thread teb (in debugged process address space) */
|
||||
client_ptr_t teb; /* thread teb (in debugged process address space) */
|
||||
client_ptr_t start; /* thread startup routine */
|
||||
};
|
||||
struct debug_event_create_process
|
||||
|
@ -89,7 +89,7 @@ struct debug_event_create_process
|
|||
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) */
|
||||
client_ptr_t teb; /* thread teb (in debugged process address space) */
|
||||
client_ptr_t start; /* thread startup routine */
|
||||
client_ptr_t name; /* image name (optional) */
|
||||
int unicode; /* is it Unicode? */
|
||||
|
@ -546,11 +546,11 @@ typedef union
|
|||
int unix_pid; /* Unix pid of new thread */
|
||||
int unix_tid; /* Unix tid of new thread */
|
||||
int debug_level; /* new debug level */
|
||||
void* teb; /* TEB of new thread (in thread address space) */
|
||||
void* peb; /* address of PEB (in thread address space) */
|
||||
client_ptr_t teb; /* TEB of new thread (in thread address space) */
|
||||
client_ptr_t entry; /* thread entry point (in thread address space) */
|
||||
int reply_fd; /* fd for reply pipe */
|
||||
int wait_fd; /* fd for blocking calls pipe */
|
||||
client_ptr_t peb; /* address of PEB (in thread address space) */
|
||||
@REPLY
|
||||
process_id_t pid; /* process id of the new thread's process */
|
||||
thread_id_t tid; /* thread id of the new thread */
|
||||
|
@ -585,12 +585,12 @@ typedef union
|
|||
@REPLY
|
||||
process_id_t pid; /* server process id */
|
||||
process_id_t ppid; /* server process id of parent */
|
||||
int exit_code; /* process exit code */
|
||||
int priority; /* priority class */
|
||||
unsigned int affinity; /* process affinity mask */
|
||||
void* peb; /* PEB address in process address space */
|
||||
client_ptr_t peb; /* PEB address in process address space */
|
||||
timeout_t start_time; /* process start time */
|
||||
timeout_t end_time; /* process end time */
|
||||
int exit_code; /* process exit code */
|
||||
@END
|
||||
|
||||
|
||||
|
@ -612,12 +612,12 @@ typedef union
|
|||
@REPLY
|
||||
process_id_t pid; /* server process id */
|
||||
thread_id_t tid; /* server thread id */
|
||||
void* teb; /* thread teb pointer */
|
||||
int exit_code; /* thread exit code */
|
||||
client_ptr_t teb; /* thread teb pointer */
|
||||
int priority; /* thread priority level */
|
||||
unsigned int affinity; /* thread affinity mask */
|
||||
timeout_t creation_time; /* thread creation time */
|
||||
timeout_t exit_time; /* thread exit time */
|
||||
int exit_code; /* thread exit code */
|
||||
int last; /* last thread in process */
|
||||
@END
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ static inline void init_thread_structure( struct thread *thread )
|
|||
thread->unix_tid = -1; /* not known yet */
|
||||
thread->context = NULL;
|
||||
thread->suspend_context = NULL;
|
||||
thread->teb = NULL;
|
||||
thread->teb = 0;
|
||||
thread->debug_ctx = NULL;
|
||||
thread->debug_event = NULL;
|
||||
thread->debug_break = 0;
|
||||
|
@ -188,9 +188,9 @@ static inline void init_thread_structure( struct thread *thread )
|
|||
}
|
||||
|
||||
/* check if address looks valid for a client-side data structure (TEB etc.) */
|
||||
static inline int is_valid_address( void *addr )
|
||||
static inline int is_valid_address( client_ptr_t addr )
|
||||
{
|
||||
return addr && !((unsigned long)addr % sizeof(int));
|
||||
return addr && !(addr % sizeof(int));
|
||||
}
|
||||
|
||||
/* create a new thread */
|
||||
|
@ -291,8 +291,8 @@ static void dump_thread( struct object *obj, int verbose )
|
|||
struct thread *thread = (struct thread *)obj;
|
||||
assert( obj->ops == &thread_ops );
|
||||
|
||||
fprintf( stderr, "Thread id=%04x unix pid=%d unix tid=%d teb=%p state=%d\n",
|
||||
thread->id, thread->unix_pid, thread->unix_tid, thread->teb, thread->state );
|
||||
fprintf( stderr, "Thread id=%04x unix pid=%d unix tid=%d state=%d\n",
|
||||
thread->id, thread->unix_pid, thread->unix_tid, thread->state );
|
||||
}
|
||||
|
||||
static int thread_signaled( struct object *obj, struct thread *thread )
|
||||
|
|
|
@ -78,7 +78,7 @@ struct thread
|
|||
int unix_tid; /* Unix tid of client */
|
||||
CONTEXT *context; /* current context if in an exception handler */
|
||||
CONTEXT *suspend_context; /* current context if suspended */
|
||||
void *teb; /* TEB address (in client address space) */
|
||||
client_ptr_t teb; /* TEB address (in client address space) */
|
||||
int priority; /* priority level */
|
||||
unsigned int affinity; /* affinity mask */
|
||||
int suspend; /* suspend count */
|
||||
|
|
|
@ -499,8 +499,9 @@ static void dump_varargs_debug_event( data_size_t size )
|
|||
fprintf( stderr, ",first=%d}", event->info.exception.first );
|
||||
break;
|
||||
case CREATE_THREAD_DEBUG_EVENT:
|
||||
fprintf( stderr, "{create_thread,thread=%04x,teb=%p,start=",
|
||||
event->info.create_thread.handle, event->info.create_thread.teb );
|
||||
fprintf( stderr, "{create_thread,thread=%04x,teb=", event->info.create_thread.handle );
|
||||
dump_uint64( &event->info.create_thread.teb );
|
||||
fprintf( stderr, ",start=" );
|
||||
dump_uint64( &event->info.create_thread.start );
|
||||
fputc( '}', stderr );
|
||||
break;
|
||||
|
@ -509,9 +510,10 @@ static void dump_varargs_debug_event( data_size_t size )
|
|||
event->info.create_process.file, event->info.create_process.process,
|
||||
event->info.create_process.thread );
|
||||
dump_uint64( &event->info.create_process.base );
|
||||
fprintf( stderr, ",offset=%d,size=%d,teb=%p,start=",
|
||||
event->info.create_process.dbg_offset, event->info.create_process.dbg_size,
|
||||
event->info.create_process.teb );
|
||||
fprintf( stderr, ",offset=%d,size=%d,teb=",
|
||||
event->info.create_process.dbg_offset, event->info.create_process.dbg_size );
|
||||
dump_uint64( &event->info.create_process.teb );
|
||||
fprintf( stderr, ",start=" );
|
||||
dump_uint64( &event->info.create_process.start );
|
||||
fprintf( stderr, ",name=" );
|
||||
dump_uint64( &event->info.create_process.name );
|
||||
|
@ -986,13 +988,16 @@ static void dump_init_thread_request( const struct init_thread_request *req )
|
|||
fprintf( stderr, " unix_pid=%d,", req->unix_pid );
|
||||
fprintf( stderr, " unix_tid=%d,", req->unix_tid );
|
||||
fprintf( stderr, " debug_level=%d,", req->debug_level );
|
||||
fprintf( stderr, " teb=%p,", req->teb );
|
||||
fprintf( stderr, " peb=%p,", req->peb );
|
||||
fprintf( stderr, " teb=" );
|
||||
dump_uint64( &req->teb );
|
||||
fprintf( stderr, "," );
|
||||
fprintf( stderr, " entry=" );
|
||||
dump_uint64( &req->entry );
|
||||
fprintf( stderr, "," );
|
||||
fprintf( stderr, " reply_fd=%d,", req->reply_fd );
|
||||
fprintf( stderr, " wait_fd=%d", req->wait_fd );
|
||||
fprintf( stderr, " wait_fd=%d,", req->wait_fd );
|
||||
fprintf( stderr, " peb=" );
|
||||
dump_uint64( &req->peb );
|
||||
}
|
||||
|
||||
static void dump_init_thread_reply( const struct init_thread_reply *req )
|
||||
|
@ -1038,15 +1043,18 @@ static void dump_get_process_info_reply( const struct get_process_info_reply *re
|
|||
{
|
||||
fprintf( stderr, " pid=%04x,", req->pid );
|
||||
fprintf( stderr, " ppid=%04x,", req->ppid );
|
||||
fprintf( stderr, " exit_code=%d,", req->exit_code );
|
||||
fprintf( stderr, " priority=%d,", req->priority );
|
||||
fprintf( stderr, " affinity=%08x,", req->affinity );
|
||||
fprintf( stderr, " peb=%p,", req->peb );
|
||||
fprintf( stderr, " peb=" );
|
||||
dump_uint64( &req->peb );
|
||||
fprintf( stderr, "," );
|
||||
fprintf( stderr, " start_time=" );
|
||||
dump_timeout( &req->start_time );
|
||||
fprintf( stderr, "," );
|
||||
fprintf( stderr, " end_time=" );
|
||||
dump_timeout( &req->end_time );
|
||||
fprintf( stderr, "," );
|
||||
fprintf( stderr, " exit_code=%d", req->exit_code );
|
||||
}
|
||||
|
||||
static void dump_set_process_info_request( const struct set_process_info_request *req )
|
||||
|
@ -1067,8 +1075,9 @@ static void dump_get_thread_info_reply( const struct get_thread_info_reply *req
|
|||
{
|
||||
fprintf( stderr, " pid=%04x,", req->pid );
|
||||
fprintf( stderr, " tid=%04x,", req->tid );
|
||||
fprintf( stderr, " teb=%p,", req->teb );
|
||||
fprintf( stderr, " exit_code=%d,", req->exit_code );
|
||||
fprintf( stderr, " teb=" );
|
||||
dump_uint64( &req->teb );
|
||||
fprintf( stderr, "," );
|
||||
fprintf( stderr, " priority=%d,", req->priority );
|
||||
fprintf( stderr, " affinity=%08x,", req->affinity );
|
||||
fprintf( stderr, " creation_time=" );
|
||||
|
@ -1077,6 +1086,7 @@ static void dump_get_thread_info_reply( const struct get_thread_info_reply *req
|
|||
fprintf( stderr, " exit_time=" );
|
||||
dump_timeout( &req->exit_time );
|
||||
fprintf( stderr, "," );
|
||||
fprintf( stderr, " exit_code=%d,", req->exit_code );
|
||||
fprintf( stderr, " last=%d", req->last );
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ my %formats =
|
|||
"unsigned char" => [ 1, 1, "%02x" ],
|
||||
"unsigned short"=> [ 2, 2, "%04x" ],
|
||||
"unsigned int" => [ 4, 4, "%08x" ],
|
||||
"void*" => [ 4, 4, "%p" ],
|
||||
"data_size_t" => [ 4, 4, "%u" ],
|
||||
"obj_handle_t" => [ 4, 4, "%04x" ],
|
||||
"atom_t" => [ 2, 2, "%04x" ],
|
||||
|
|
Loading…
Reference in New Issue