From 54f228733ac8263f55d2292afc797a4df288413c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 3 Oct 2002 19:54:57 +0000 Subject: [PATCH] Added process_id_t and thread_it_t types to the server interface instead of using void*, and removed a number of type casts. --- dlls/kernel/console.c | 2 +- dlls/kernel/debugger.c | 8 ++--- dlls/kernel/toolhelp.c | 4 +-- dlls/user/message.c | 4 +-- include/thread.h | 4 +-- include/wine/server_protocol.h | 62 ++++++++++++++++++++------------------ programs/wineconsole/wineconsole.c | 4 +-- scheduler/client.c | 8 ++--- scheduler/process.c | 2 +- scheduler/syslevel.c | 8 ++--- scheduler/thread.c | 8 ++--- server/console.c | 10 +++--- server/debugger.c | 4 +-- server/process.c | 8 ++--- server/process.h | 6 ++-- server/protocol.def | 60 ++++++++++++++++++------------------ server/snapshot.c | 2 +- server/thread.c | 6 ++-- server/thread.h | 4 +-- server/trace.c | 54 ++++++++++++++++----------------- tools/make_requests | 2 ++ windows/input.c | 2 +- windows/message.c | 2 +- windows/win.c | 2 +- 24 files changed, 141 insertions(+), 135 deletions(-) diff --git a/dlls/kernel/console.c b/dlls/kernel/console.c index ca84f15cace..7091b1fd9a5 100644 --- a/dlls/kernel/console.c +++ b/dlls/kernel/console.c @@ -1406,7 +1406,7 @@ BOOL WINAPI GenerateConsoleCtrlEvent(DWORD dwCtrlEvent, SERVER_START_REQ( send_console_signal ) { req->signal = dwCtrlEvent; - req->group_id = (void*)dwProcessGroupID; + req->group_id = dwProcessGroupID; ret = !wine_server_call_err( req ); } SERVER_END_REQ; diff --git a/dlls/kernel/debugger.c b/dlls/kernel/debugger.c index 96e9e0167ee..92402feb8a6 100644 --- a/dlls/kernel/debugger.c +++ b/dlls/kernel/debugger.c @@ -149,8 +149,8 @@ BOOL WINAPI ContinueDebugEvent( BOOL ret; SERVER_START_REQ( continue_debug_event ) { - req->pid = (void *)pid; - req->tid = (void *)tid; + req->pid = pid; + req->tid = tid; req->status = status; ret = !wine_server_call_err( req ); } @@ -174,7 +174,7 @@ BOOL WINAPI DebugActiveProcess( BOOL ret; SERVER_START_REQ( debug_process ) { - req->pid = (void *)pid; + req->pid = pid; req->attach = 1; ret = !wine_server_call_err( req ); } @@ -197,7 +197,7 @@ BOOL WINAPI DebugActiveProcessStop( BOOL ret; SERVER_START_REQ( debug_process ) { - req->pid = (void *)pid; + req->pid = pid; req->attach = 0; ret = !wine_server_call_err( req ); } diff --git a/dlls/kernel/toolhelp.c b/dlls/kernel/toolhelp.c index 0602cd94907..11b76607482 100644 --- a/dlls/kernel/toolhelp.c +++ b/dlls/kernel/toolhelp.c @@ -223,7 +223,7 @@ HANDLE WINAPI CreateToolhelp32Snapshot( DWORD flags, DWORD process ) { req->flags = flags & ~TH32CS_INHERIT; req->inherit = (flags & TH32CS_INHERIT) != 0; - req->pid = (void *)process; + req->pid = process; wine_server_call_err( req ); ret = reply->handle; } @@ -373,7 +373,7 @@ static BOOL TOOLHELP_Module32Next( HANDLE handle, LPMODULEENTRY32 lpme, BOOL fir lpme->ProccntUsage = 0; /* FIXME */ lpme->modBaseAddr = reply->base; lpme->modBaseSize = reply->size; - lpme->hModule = (DWORD)reply->base; + lpme->hModule = (HMODULE)reply->base; lpme->szModule[0] = 0; /* FIXME */ lpme->szExePath[wine_server_reply_size(reply)] = 0; } diff --git a/dlls/user/message.c b/dlls/user/message.c index b6c9f9cf3e1..76968fffb48 100644 --- a/dlls/user/message.c +++ b/dlls/user/message.c @@ -1229,7 +1229,7 @@ static BOOL post_dde_message( DWORD dest_tid, struct packed_message *data, const } SERVER_START_REQ( send_message ) { - req->id = (void *)dest_tid; + req->id = dest_tid; req->type = info->type; req->win = info->hwnd; req->msg = info->msg; @@ -1606,7 +1606,7 @@ static BOOL put_message_in_queue( DWORD dest_tid, const struct send_message_info SERVER_START_REQ( send_message ) { - req->id = (void *)dest_tid; + req->id = dest_tid; req->type = info->type; req->win = info->hwnd; req->msg = info->msg; diff --git a/include/thread.h b/include/thread.h index b21406522c8..9ee3a2331be 100644 --- a/include/thread.h +++ b/include/thread.h @@ -58,8 +58,8 @@ typedef struct _TEB struct _TEB *self; /* 12- 18 Pointer to this structure */ WORD tibflags; /* 1!n 1c Flags (NT: EnvironmentPointer) */ WORD mutex_count; /* 1-n 1e Win16 mutex count */ - void *pid; /* !2- 20 Process id (win95: debug context) */ - void *tid; /* -2- 24 Thread id */ + DWORD pid; /* !2- 20 Process id (win95: debug context) */ + DWORD tid; /* -2- 24 Thread id */ HQUEUE16 queue; /* 1!- 28 Message queue (NT: DWORD ActiveRpcHandle)*/ WORD pad1; /* --n 2a */ LPVOID *tls_ptr; /* 1-- 2c Pointer to TLS array */ diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 06e68663002..8b2a63fae7d 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -35,6 +35,8 @@ struct request_max_size typedef int obj_handle_t; typedef unsigned short atom_t; typedef unsigned int user_handle_t; +typedef unsigned int process_id_t; +typedef unsigned int thread_id_t; #define FIRST_USER_HANDLE 0x0020 #define LAST_USER_HANDLE 0xffef @@ -115,8 +117,8 @@ typedef struct struct send_fd { - void *tid; - int fd; + thread_id_t tid; + int fd; }; @@ -207,9 +209,9 @@ struct get_new_process_info_request struct get_new_process_info_reply { struct reply_header __header; - void* pid; + process_id_t pid; obj_handle_t phandle; - void* tid; + thread_id_t tid; obj_handle_t thandle; int success; }; @@ -226,7 +228,7 @@ struct new_thread_request struct new_thread_reply { struct reply_header __header; - void* tid; + thread_id_t tid; obj_handle_t handle; }; @@ -307,8 +309,8 @@ struct init_thread_request struct init_thread_reply { struct reply_header __header; - void* pid; - void* tid; + process_id_t pid; + thread_id_t tid; int boot; int version; }; @@ -352,7 +354,7 @@ struct get_process_info_request struct get_process_info_reply { struct reply_header __header; - void* pid; + process_id_t pid; int debugged; int exit_code; int priority; @@ -383,12 +385,12 @@ struct get_thread_info_request { struct request_header __header; obj_handle_t handle; - void* tid_in; + thread_id_t tid_in; }; struct get_thread_info_reply { struct reply_header __header; - void* tid; + thread_id_t tid; void* teb; int exit_code; int priority; @@ -555,7 +557,7 @@ struct dup_handle_reply struct open_process_request { struct request_header __header; - void* pid; + process_id_t pid; unsigned int access; int inherit; }; @@ -570,7 +572,7 @@ struct open_process_reply struct open_thread_request { struct request_header __header; - void* tid; + thread_id_t tid; unsigned int access; int inherit; }; @@ -1014,7 +1016,7 @@ struct alloc_console_request struct request_header __header; unsigned int access; int inherit; - void* pid; + process_id_t pid; }; struct alloc_console_reply { @@ -1389,7 +1391,7 @@ struct send_console_signal_request { struct request_header __header; int signal; - void* group_id; + process_id_t group_id; }; struct send_console_signal_reply { @@ -1495,7 +1497,7 @@ struct create_snapshot_request struct request_header __header; int inherit; int flags; - void* pid; + process_id_t pid; }; struct create_snapshot_reply { @@ -1515,8 +1517,8 @@ struct next_process_reply { struct reply_header __header; int count; - void* pid; - void* ppid; + process_id_t pid; + process_id_t ppid; void* heap; void* module; int threads; @@ -1536,8 +1538,8 @@ struct next_thread_reply { struct reply_header __header; int count; - void* pid; - void* tid; + process_id_t pid; + thread_id_t tid; int base_pri; int delta_pri; }; @@ -1553,7 +1555,7 @@ struct next_module_request struct next_module_reply { struct reply_header __header; - void* pid; + process_id_t pid; void* base; size_t size; /* VARARG(filename,string); */ @@ -1569,8 +1571,8 @@ struct wait_debug_event_request struct wait_debug_event_reply { struct reply_header __header; - void* pid; - void* tid; + process_id_t pid; + thread_id_t tid; obj_handle_t wait; /* VARARG(event,debug_event); */ }; @@ -1622,8 +1624,8 @@ struct output_debug_string_reply struct continue_debug_event_request { struct request_header __header; - void* pid; - void* tid; + process_id_t pid; + thread_id_t tid; int status; }; struct continue_debug_event_reply @@ -1636,7 +1638,7 @@ struct continue_debug_event_reply struct debug_process_request { struct request_header __header; - void* pid; + process_id_t pid; int attach; }; struct debug_process_reply @@ -2118,7 +2120,7 @@ struct wait_input_idle_reply struct send_message_request { struct request_header __header; - void* id; + thread_id_t id; int type; user_handle_t win; unsigned int msg; @@ -2505,8 +2507,8 @@ struct get_window_info_reply { struct reply_header __header; user_handle_t full_handle; - void* pid; - void* tid; + process_id_t pid; + thread_id_t tid; atom_t atom; }; @@ -2559,7 +2561,7 @@ struct get_window_children_request struct request_header __header; user_handle_t parent; atom_t atom; - void* tid; + thread_id_t tid; }; struct get_window_children_reply { @@ -3211,6 +3213,6 @@ union generic_reply struct get_window_properties_reply get_window_properties_reply; }; -#define SERVER_PROTOCOL_VERSION 83 +#define SERVER_PROTOCOL_VERSION 84 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/programs/wineconsole/wineconsole.c b/programs/wineconsole/wineconsole.c index 18a8d3a7a9d..20ae39dc668 100644 --- a/programs/wineconsole/wineconsole.c +++ b/programs/wineconsole/wineconsole.c @@ -442,7 +442,7 @@ static void WINECON_Delete(struct inner_data* data) * Initialisation part I. Creation of server object (console input and * active screen buffer) */ -static struct inner_data* WINECON_Init(HINSTANCE hInst, void* pid, LPCWSTR appname, +static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appname, BOOL (*backend)(struct inner_data*)) { struct inner_data* data = NULL; @@ -635,7 +635,7 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh while (*src && *src != ' ') *dst++ = *src++; *dst = 0; - if (!(data = WINECON_Init(hInst, (void*)GetCurrentProcessId(), buffer, backend))) return 0; + if (!(data = WINECON_Init(hInst, GetCurrentProcessId(), buffer, backend))) return 0; ret = WINECON_Spawn(data, wcmdLine); if (!ret) { diff --git a/scheduler/client.c b/scheduler/client.c index df281db91fa..246d91c1b12 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -71,7 +71,7 @@ struct cmsg_fd }; #endif /* HAVE_MSGHDR_ACCRIGHTS */ -static void *boot_thread_id; +static DWORD boot_thread_id; static sigset_t block_set; /* signals to block during server calls */ static int fd_socket; /* socket to exchange file descriptors with the server */ @@ -114,7 +114,7 @@ void server_protocol_error( const char *err, ... ) va_list args; va_start( args, err ); - fprintf( stderr, "wine client error:%p: ", NtCurrentTeb()->tid ); + fprintf( stderr, "wine client error:%lx: ", NtCurrentTeb()->tid ); vfprintf( stderr, err, args ); va_end( args ); SYSDEPS_AbortThread(1); @@ -126,7 +126,7 @@ void server_protocol_error( const char *err, ... ) */ void server_protocol_perror( const char *err ) { - fprintf( stderr, "wine client error:%p: ", NtCurrentTeb()->tid ); + fprintf( stderr, "wine client error:%lx: ", NtCurrentTeb()->tid ); perror( err ); SYSDEPS_AbortThread(1); } @@ -263,7 +263,7 @@ void wine_server_send_fd( int fd ) msghdr.msg_flags = 0; #endif /* HAVE_MSGHDR_ACCRIGHTS */ - data.tid = (void *)GetCurrentThreadId(); + data.tid = GetCurrentThreadId(); data.fd = fd; for (;;) diff --git a/scheduler/process.c b/scheduler/process.c index d0ed92c10be..26959c4af7e 100644 --- a/scheduler/process.c +++ b/scheduler/process.c @@ -1488,7 +1488,7 @@ HANDLE WINAPI OpenProcess( DWORD access, BOOL inherit, DWORD id ) HANDLE ret = 0; SERVER_START_REQ( open_process ) { - req->pid = (void *)id; + req->pid = id; req->access = access; req->inherit = inherit; if (!wine_server_call_err( req )) ret = reply->handle; diff --git a/scheduler/syslevel.c b/scheduler/syslevel.c index 68dcb86aeb4..5533c825aa6 100644 --- a/scheduler/syslevel.c +++ b/scheduler/syslevel.c @@ -83,7 +83,7 @@ VOID WINAPI _EnterSysLevel(SYSLEVEL *lock) TEB *teb = NtCurrentTeb(); int i; - TRACE("(%p, level %d): thread %p (fs %04x, pid %ld) count before %ld\n", + TRACE("(%p, level %d): thread %lx (fs %04x, pid %ld) count before %ld\n", lock, lock->level, teb->tid, teb->teb_sel, (long) getpid(), teb->sys_count[lock->level] ); @@ -99,7 +99,7 @@ VOID WINAPI _EnterSysLevel(SYSLEVEL *lock) teb->sys_count[lock->level]++; teb->sys_mutex[lock->level] = lock; - TRACE("(%p, level %d): thread %p (fs %04x, pid %ld) count after %ld\n", + TRACE("(%p, level %d): thread %lx (fs %04x, pid %ld) count after %ld\n", lock, lock->level, teb->tid, teb->teb_sel, (long) getpid(), teb->sys_count[lock->level] ); @@ -115,7 +115,7 @@ VOID WINAPI _LeaveSysLevel(SYSLEVEL *lock) { TEB *teb = NtCurrentTeb(); - TRACE("(%p, level %d): thread %p (fs %04x, pid %ld) count before %ld\n", + TRACE("(%p, level %d): thread %lx (fs %04x, pid %ld) count before %ld\n", lock, lock->level, teb->tid, teb->teb_sel, (long) getpid(), teb->sys_count[lock->level] ); @@ -133,7 +133,7 @@ VOID WINAPI _LeaveSysLevel(SYSLEVEL *lock) LeaveCriticalSection( &lock->crst ); - TRACE("(%p, level %d): thread %p (fs %04x, pid %ld) count after %ld\n", + TRACE("(%p, level %d): thread %lx (fs %04x, pid %ld) count after %ld\n", lock, lock->level, teb->tid, teb->teb_sel, (long) getpid(), teb->sys_count[lock->level] ); } diff --git a/scheduler/thread.c b/scheduler/thread.c index eb5fe605461..09b9288f89e 100644 --- a/scheduler/thread.c +++ b/scheduler/thread.c @@ -64,7 +64,7 @@ TEB *THREAD_IdToTEB( DWORD id ) SERVER_START_REQ( get_thread_info ) { req->handle = 0; - req->tid_in = (void *)id; + req->tid_in = id; if (!wine_server_call( req )) ret = reply->teb; } SERVER_END_REQ; @@ -277,7 +277,7 @@ HANDLE WINAPI CreateThread( SECURITY_ATTRIBUTES *sa, SIZE_T stack, { HANDLE handle = 0; TEB *teb; - void *tid = 0; + DWORD tid = 0; int request_pipe[2]; if (pipe( request_pipe ) == -1) @@ -316,7 +316,7 @@ HANDLE WINAPI CreateThread( SECURITY_ATTRIBUTES *sa, SIZE_T stack, teb->startup = THREAD_Start; teb->htask16 = GetCurrentTask(); - if (id) *id = (DWORD)tid; + if (id) *id = tid; if (SYSDEPS_SpawnThread( teb ) == -1) { CloseHandle( handle ); @@ -395,7 +395,7 @@ HANDLE WINAPI OpenThread( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwTh HANDLE ret = 0; SERVER_START_REQ( open_thread ) { - req->tid = (void *)dwThreadId; + req->tid = dwThreadId; req->access = dwDesiredAccess; req->inherit = bInheritHandle; if (!wine_server_call_err( req )) ret = reply->handle; diff --git a/server/console.c b/server/console.c index 12a7abdecf6..51aa9f90855 100644 --- a/server/console.c +++ b/server/console.c @@ -388,7 +388,7 @@ static int console_input_signaled( struct object *obj, struct thread *thread ) struct console_signal_info { struct console_input *console; - struct process *group; + process_id_t group; int signal; }; @@ -397,7 +397,7 @@ static int propagate_console_signal_cb(struct process *process, void *user) struct console_signal_info* csi = (struct console_signal_info*)user; if (process->console == csi->console && process->running_threads && - (csi->group == NULL || process->group_id == csi->group)) + (!csi->group || process->group_id == csi->group)) { struct thread *thread = process->thread_list; @@ -412,7 +412,7 @@ static int propagate_console_signal_cb(struct process *process, void *user) } static void propagate_console_signal( struct console_input *console, - int sig, void* group_id ) + int sig, process_id_t group_id ) { struct console_signal_info csi; @@ -510,7 +510,7 @@ static int write_console_input( struct console_input* console, int count, if (records[i].Event.KeyEvent.bKeyDown) { /* send SIGINT to all processes attached to this console */ - propagate_console_signal( console, CTRL_C_EVENT, NULL ); + propagate_console_signal( console, CTRL_C_EVENT, 0 ); } } else i++; @@ -1461,7 +1461,7 @@ DECL_HANDLER(move_console_output) /* sends a signal to a console (process, group...) */ DECL_HANDLER(send_console_signal) { - void* group; + process_id_t group; group = req->group_id ? req->group_id : current->process->group_id; diff --git a/server/debugger.c b/server/debugger.c index 409adc3d1bf..ba08bd2fde9 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -593,8 +593,8 @@ DECL_HANDLER(wait_debug_event) size_t size = get_reply_max_size(); event->state = EVENT_SENT; event->sender->debug_event = event; - reply->pid = event->sender->process; - reply->tid = event->sender; + reply->pid = get_process_id( event->sender->process ); + reply->tid = get_thread_id( event->sender ); if (size > sizeof(debug_event_t)) size = sizeof(debug_event_t); set_reply_data( &event->data, size ); } diff --git a/server/process.c b/server/process.c index 74f879c0072..9a0ed20b82b 100644 --- a/server/process.c +++ b/server/process.c @@ -218,7 +218,7 @@ struct thread *create_process( int fd ) process->exe.dbg_size = 0; process->exe.namelen = 0; process->exe.filename = NULL; - process->group_id = NULL; + process->group_id = 0; gettimeofday( &process->start_time, NULL ); if ((process->next = first_process) != NULL) process->next->prev = process; @@ -292,7 +292,7 @@ static struct startup_info *init_process( int ppid, struct init_process_reply *r /* set the process console */ if (!set_process_console( process, parent_thread, info, reply )) return NULL; - process->group_id = process; + process->group_id = get_process_id( process ); if (parent) { /* attach to the debugger if requested */ @@ -397,10 +397,10 @@ static int startup_info_signaled( struct object *obj, struct thread *thread ) } /* get a process from an id (and increment the refcount) */ -struct process *get_process_from_id( void *id ) +struct process *get_process_from_id( process_id_t id ) { struct process *p = first_process; - while (p && (p != id)) p = p->next; + while (p && (get_process_id(p) != id)) p = p->next; if (p) grab_object( p ); else set_error( STATUS_INVALID_PARAMETER ); return p; diff --git a/server/process.h b/server/process.h index e89764e37f0..c56af7fb9a6 100644 --- a/server/process.h +++ b/server/process.h @@ -73,7 +73,7 @@ struct process struct process_dll exe; /* main exe file */ void *ldt_copy; /* pointer to LDT copy in client addr space */ void *ldt_flags; /* pointer to LDT flags in client addr space */ - void *group_id; /* group ID of the process */ + process_id_t group_id; /* group ID of the process */ }; struct process_snapshot @@ -95,7 +95,7 @@ struct module_snapshot /* process functions */ extern struct thread *create_process( int fd ); -extern struct process *get_process_from_id( void *id ); +extern struct process *get_process_from_id( process_id_t id ); extern struct process *get_process_from_handle( obj_handle_t handle, unsigned int access ); extern int process_set_debugger( struct process *process, struct thread *thread ); extern int debugger_detach( struct process* process, struct thread* debugger ); @@ -115,7 +115,7 @@ 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); -inline static void *get_process_id( struct process *process ) { return process; } +inline static process_id_t get_process_id( struct process *process ) { return (process_id_t)process; } inline static int is_process_init_done( struct process *process ) { return process->startup_state == STARTUP_DONE; diff --git a/server/protocol.def b/server/protocol.def index 6e69e934669..1aeb6c4b244 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -51,6 +51,8 @@ struct request_max_size typedef int obj_handle_t; typedef unsigned short atom_t; typedef unsigned int user_handle_t; +typedef unsigned int process_id_t; +typedef unsigned int thread_id_t; #define FIRST_USER_HANDLE 0x0020 /* first possible value for low word of user handle */ #define LAST_USER_HANDLE 0xffef /* last possible value for low word of user handle */ @@ -131,8 +133,8 @@ typedef struct /* structure used in sending an fd from client to server */ struct send_fd { - void *tid; /* thread id */ - int fd; /* file descriptor on client-side */ + thread_id_t tid; /* thread id */ + int fd; /* file descriptor on client-side */ }; /* structure sent by the server on the wait fifo */ @@ -213,9 +215,9 @@ typedef struct int pinherit; /* process handle inherit flag */ int tinherit; /* thread handle inherit flag */ @REPLY - void* pid; /* process id */ + process_id_t pid; /* process id */ obj_handle_t phandle; /* process handle (in the current process) */ - void* tid; /* thread id */ + thread_id_t tid; /* thread id */ obj_handle_t thandle; /* thread handle (in the current process) */ int success; /* did the process start successfully? */ @END @@ -227,7 +229,7 @@ typedef struct int inherit; /* inherit flag */ int request_fd; /* fd for request pipe */ @REPLY - void* tid; /* thread id */ + thread_id_t tid; /* thread id */ obj_handle_t handle; /* thread handle (in the current process) */ @END @@ -282,8 +284,8 @@ typedef struct int reply_fd; /* fd for reply pipe */ int wait_fd; /* fd for blocking calls pipe */ @REPLY - void* pid; /* process id of the new thread's process */ - void* tid; /* thread id of the new thread */ + process_id_t pid; /* process id of the new thread's process */ + thread_id_t tid; /* thread id of the new thread */ int boot; /* is this the boot thread? */ int version; /* protocol version */ @END @@ -312,7 +314,7 @@ typedef struct @REQ(get_process_info) obj_handle_t handle; /* process handle */ @REPLY - void* pid; /* server process id */ + process_id_t pid; /* server process id */ int debugged; /* debugged? */ int exit_code; /* process exit code */ int priority; /* priority class */ @@ -335,9 +337,9 @@ typedef struct /* Retrieve information about a thread */ @REQ(get_thread_info) obj_handle_t handle; /* thread handle */ - void* tid_in; /* thread id (optional) */ + thread_id_t tid_in; /* thread id (optional) */ @REPLY - void* tid; /* server thread id */ + thread_id_t tid; /* server thread id */ void* teb; /* thread teb pointer */ int exit_code; /* thread exit code */ int priority; /* thread priority level */ @@ -448,7 +450,7 @@ enum apc_type { APC_NONE, APC_USER, APC_TIMER, APC_ASYNC, APC_ASYNC_IO }; /* Open a handle to a process */ @REQ(open_process) - void* pid; /* process id to open */ + process_id_t pid; /* process id to open */ unsigned int access; /* wanted access rights */ int inherit; /* inherit flag */ @REPLY @@ -458,7 +460,7 @@ enum apc_type { APC_NONE, APC_USER, APC_TIMER, APC_ASYNC, APC_ASYNC_IO }; /* Open a handle to a thread */ @REQ(open_thread) - void* tid; /* thread id to open */ + thread_id_t tid; /* thread id to open */ unsigned int access; /* wanted access rights */ int inherit; /* inherit flag */ @REPLY @@ -751,7 +753,7 @@ enum fd_type @REQ(alloc_console) unsigned int access; /* wanted access rights */ int inherit; /* inherit flag */ - void* pid; /* pid of process which shall be attached to the console */ + process_id_t pid; /* pid of process which shall be attached to the console */ @REPLY obj_handle_t handle_in; /* handle to console input */ obj_handle_t event; /* handle to renderer events change notification */ @@ -1025,7 +1027,7 @@ enum char_info_mode /* Sends a signal to a process group */ @REQ(send_console_signal) int signal; /* the signal to send */ - void* group_id; /* the group to send the signal to */ + process_id_t group_id; /* the group to send the signal to */ @END @@ -1100,7 +1102,7 @@ enum char_info_mode @REQ(create_snapshot) int inherit; /* inherit flag */ int flags; /* snapshot flags (TH32CS_*) */ - void* pid; /* process id */ + process_id_t pid; /* process id */ @REPLY obj_handle_t handle; /* handle to the snapshot */ @END @@ -1112,8 +1114,8 @@ enum char_info_mode int reset; /* reset snapshot position? */ @REPLY int count; /* process usage count */ - void* pid; /* process id */ - void* ppid; /* parent process id */ + 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 */ @@ -1128,8 +1130,8 @@ enum char_info_mode int reset; /* reset snapshot position? */ @REPLY int count; /* thread usage count */ - void* pid; /* process id */ - void* tid; /* thread id */ + process_id_t pid; /* process id */ + thread_id_t tid; /* thread id */ int base_pri; /* base priority */ int delta_pri; /* delta priority */ @END @@ -1140,7 +1142,7 @@ enum char_info_mode obj_handle_t handle; /* handle to the snapshot */ int reset; /* reset snapshot position? */ @REPLY - void* pid; /* process id */ + process_id_t pid; /* process id */ void* base; /* module base address */ size_t size; /* module size */ VARARG(filename,string); /* file name of module */ @@ -1151,8 +1153,8 @@ enum char_info_mode @REQ(wait_debug_event) int get_handle; /* should we alloc a handle for waiting? */ @REPLY - void* pid; /* process id */ - void* tid; /* thread id */ + process_id_t pid; /* process id */ + thread_id_t tid; /* thread id */ obj_handle_t wait; /* wait handle if no event ready */ VARARG(event,debug_event); /* debug event data */ @END @@ -1186,15 +1188,15 @@ enum char_info_mode /* Continue a debug event */ @REQ(continue_debug_event) - void* pid; /* process id to continue */ - void* tid; /* thread id to continue */ + process_id_t pid; /* process id to continue */ + thread_id_t tid; /* thread id to continue */ int status; /* continuation status */ @END /* Start/stop debugging an existing process */ @REQ(debug_process) - void* pid; /* id of the process to debug */ + process_id_t pid; /* id of the process to debug */ int attach; /* 1=attaching / 0=detaching from the process */ @END @@ -1496,7 +1498,7 @@ enum char_info_mode /* Send a message to a thread queue */ @REQ(send_message) - void* id; /* thread id */ + thread_id_t id; /* thread id */ int type; /* message type (see below) */ user_handle_t win; /* window handle */ unsigned int msg; /* message code */ @@ -1760,8 +1762,8 @@ enum message_type user_handle_t handle; /* handle to the window */ @REPLY user_handle_t full_handle; /* full 32-bit handle */ - void* pid; /* process owning the window */ - void* tid; /* thread owning the window */ + process_id_t pid; /* process owning the window */ + thread_id_t tid; /* thread owning the window */ atom_t atom; /* class atom */ @END @@ -1802,7 +1804,7 @@ enum message_type @REQ(get_window_children) user_handle_t parent; /* parent window */ atom_t atom; /* class atom for the listed children */ - void* tid; /* thread owning the listed children */ + thread_id_t tid; /* thread owning the listed children */ @REPLY int count; /* total count of children */ VARARG(children,user_handles); /* children handles */ diff --git a/server/snapshot.c b/server/snapshot.c index c9a12253f56..562f9014875 100644 --- a/server/snapshot.c +++ b/server/snapshot.c @@ -73,7 +73,7 @@ static const struct object_ops snapshot_ops = /* create a new snapshot */ -static struct snapshot *create_snapshot( void *pid, int flags ) +static struct snapshot *create_snapshot( process_id_t pid, int flags ) { struct process *process = NULL; struct snapshot *snapshot; diff --git a/server/thread.c b/server/thread.c index b5a95becf57..0338b8b22c0 100644 --- a/server/thread.c +++ b/server/thread.c @@ -244,10 +244,10 @@ static int thread_signaled( struct object *obj, struct thread *thread ) } /* get a thread pointer from a thread id (and increment the refcount) */ -struct thread *get_thread_from_id( void *id ) +struct thread *get_thread_from_id( thread_id_t id ) { struct thread *t = first_thread; - while (t && (t != id)) t = t->next; + while (t && (get_thread_id(t) != id)) t = t->next; if (t) grab_object( t ); else set_error( STATUS_INVALID_PARAMETER ); return t; @@ -778,7 +778,7 @@ DECL_HANDLER(new_thread) if ((thread = create_thread( request_fd, current->process ))) { if (req->suspend) thread->suspend++; - reply->tid = thread; + reply->tid = get_thread_id( thread ); if ((reply->handle = alloc_handle( current->process, thread, THREAD_ALL_ACCESS, req->inherit ))) { diff --git a/server/thread.h b/server/thread.h index e502c233a71..fed326b6076 100644 --- a/server/thread.h +++ b/server/thread.h @@ -104,7 +104,7 @@ extern struct thread *current; /* thread functions */ extern struct thread *create_thread( int fd, struct process *process ); -extern struct thread *get_thread_from_id( void *id ); +extern struct thread *get_thread_from_id( thread_id_t id ); extern struct thread *get_thread_from_handle( obj_handle_t handle, unsigned int access ); extern struct thread *get_thread_from_pid( int pid ); extern int suspend_thread( struct thread *thread, int check_limit ); @@ -139,6 +139,6 @@ static inline unsigned int get_error(void) { return current ? current->err static inline void set_error( unsigned int err ) { global_error = err; if (current) current->error = err; } static inline void clear_error(void) { set_error(0); } -static inline void *get_thread_id( struct thread *thread ) { return thread; } +static inline thread_id_t get_thread_id( struct thread *thread ) { return (thread_id_t)thread; } #endif /* __WINE_SERVER_THREAD_H */ diff --git a/server/trace.c b/server/trace.c index 70d7b9d379b..18cda73d3ce 100644 --- a/server/trace.c +++ b/server/trace.c @@ -372,9 +372,9 @@ static void dump_get_new_process_info_request( const struct get_new_process_info static void dump_get_new_process_info_reply( const struct get_new_process_info_reply *req ) { - fprintf( stderr, " pid=%p,", req->pid ); + fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " phandle=%d,", req->phandle ); - fprintf( stderr, " tid=%p,", req->tid ); + fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " thandle=%d,", req->thandle ); fprintf( stderr, " success=%d", req->success ); } @@ -388,7 +388,7 @@ static void dump_new_thread_request( const struct new_thread_request *req ) static void dump_new_thread_reply( const struct new_thread_reply *req ) { - fprintf( stderr, " tid=%p,", req->tid ); + fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " handle=%d", req->handle ); } @@ -452,8 +452,8 @@ static void dump_init_thread_request( const struct init_thread_request *req ) static void dump_init_thread_reply( const struct init_thread_reply *req ) { - fprintf( stderr, " pid=%p,", req->pid ); - fprintf( stderr, " tid=%p,", req->tid ); + fprintf( stderr, " pid=%08x,", req->pid ); + fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " boot=%d,", req->boot ); fprintf( stderr, " version=%d", req->version ); } @@ -488,7 +488,7 @@ static void dump_get_process_info_request( const struct get_process_info_request static void dump_get_process_info_reply( const struct get_process_info_reply *req ) { - fprintf( stderr, " pid=%p,", req->pid ); + fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " debugged=%d,", req->debugged ); fprintf( stderr, " exit_code=%d,", req->exit_code ); fprintf( stderr, " priority=%d,", req->priority ); @@ -507,12 +507,12 @@ static void dump_set_process_info_request( const struct set_process_info_request static void dump_get_thread_info_request( const struct get_thread_info_request *req ) { fprintf( stderr, " handle=%d,", req->handle ); - fprintf( stderr, " tid_in=%p", req->tid_in ); + fprintf( stderr, " tid_in=%08x", req->tid_in ); } static void dump_get_thread_info_reply( const struct get_thread_info_reply *req ) { - fprintf( stderr, " tid=%p,", req->tid ); + fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " teb=%p,", req->teb ); fprintf( stderr, " exit_code=%d,", req->exit_code ); fprintf( stderr, " priority=%d", req->priority ); @@ -626,7 +626,7 @@ static void dump_dup_handle_reply( const struct dup_handle_reply *req ) static void dump_open_process_request( const struct open_process_request *req ) { - fprintf( stderr, " pid=%p,", req->pid ); + fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " inherit=%d", req->inherit ); } @@ -638,7 +638,7 @@ static void dump_open_process_reply( const struct open_process_reply *req ) static void dump_open_thread_request( const struct open_thread_request *req ) { - fprintf( stderr, " tid=%p,", req->tid ); + fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " inherit=%d", req->inherit ); } @@ -951,7 +951,7 @@ static void dump_alloc_console_request( const struct alloc_console_request *req { fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " inherit=%d,", req->inherit ); - fprintf( stderr, " pid=%p", req->pid ); + fprintf( stderr, " pid=%08x", req->pid ); } static void dump_alloc_console_reply( const struct alloc_console_reply *req ) @@ -1194,7 +1194,7 @@ static void dump_move_console_output_request( const struct move_console_output_r static void dump_send_console_signal_request( const struct send_console_signal_request *req ) { fprintf( stderr, " signal=%d,", req->signal ); - fprintf( stderr, " group_id=%p", req->group_id ); + fprintf( stderr, " group_id=%08x", req->group_id ); } static void dump_create_change_notification_request( const struct create_change_notification_request *req ) @@ -1271,7 +1271,7 @@ static void dump_create_snapshot_request( const struct create_snapshot_request * { fprintf( stderr, " inherit=%d,", req->inherit ); fprintf( stderr, " flags=%d,", req->flags ); - fprintf( stderr, " pid=%p", req->pid ); + fprintf( stderr, " pid=%08x", req->pid ); } static void dump_create_snapshot_reply( const struct create_snapshot_reply *req ) @@ -1288,8 +1288,8 @@ static void dump_next_process_request( const struct next_process_request *req ) static void dump_next_process_reply( const struct next_process_reply *req ) { fprintf( stderr, " count=%d,", req->count ); - fprintf( stderr, " pid=%p,", req->pid ); - fprintf( stderr, " ppid=%p,", req->ppid ); + fprintf( stderr, " pid=%08x,", req->pid ); + fprintf( stderr, " ppid=%08x,", req->ppid ); fprintf( stderr, " heap=%p,", req->heap ); fprintf( stderr, " module=%p,", req->module ); fprintf( stderr, " threads=%d,", req->threads ); @@ -1307,8 +1307,8 @@ static void dump_next_thread_request( const struct next_thread_request *req ) static void dump_next_thread_reply( const struct next_thread_reply *req ) { fprintf( stderr, " count=%d,", req->count ); - fprintf( stderr, " pid=%p,", req->pid ); - fprintf( stderr, " tid=%p,", req->tid ); + fprintf( stderr, " pid=%08x,", req->pid ); + fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " base_pri=%d,", req->base_pri ); fprintf( stderr, " delta_pri=%d", req->delta_pri ); } @@ -1321,7 +1321,7 @@ static void dump_next_module_request( const struct next_module_request *req ) static void dump_next_module_reply( const struct next_module_reply *req ) { - fprintf( stderr, " pid=%p,", req->pid ); + fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " base=%p,", req->base ); fprintf( stderr, " size=%d,", req->size ); fprintf( stderr, " filename=" ); @@ -1335,8 +1335,8 @@ static void dump_wait_debug_event_request( const struct wait_debug_event_request static void dump_wait_debug_event_reply( const struct wait_debug_event_reply *req ) { - fprintf( stderr, " pid=%p,", req->pid ); - fprintf( stderr, " tid=%p,", req->tid ); + fprintf( stderr, " pid=%08x,", req->pid ); + fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " wait=%d,", req->wait ); fprintf( stderr, " event=" ); dump_varargs_debug_event( cur_size ); @@ -1375,14 +1375,14 @@ static void dump_output_debug_string_request( const struct output_debug_string_r static void dump_continue_debug_event_request( const struct continue_debug_event_request *req ) { - fprintf( stderr, " pid=%p,", req->pid ); - fprintf( stderr, " tid=%p,", req->tid ); + fprintf( stderr, " pid=%08x,", req->pid ); + fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " status=%d", req->status ); } static void dump_debug_process_request( const struct debug_process_request *req ) { - fprintf( stderr, " pid=%p,", req->pid ); + fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " attach=%d", req->attach ); } @@ -1735,7 +1735,7 @@ static void dump_wait_input_idle_reply( const struct wait_input_idle_reply *req static void dump_send_message_request( const struct send_message_request *req ) { - fprintf( stderr, " id=%p,", req->id ); + fprintf( stderr, " id=%08x,", req->id ); fprintf( stderr, " type=%d,", req->type ); fprintf( stderr, " win=%08x,", req->win ); fprintf( stderr, " msg=%08x,", req->msg ); @@ -2005,8 +2005,8 @@ static void dump_get_window_info_request( const struct get_window_info_request * static void dump_get_window_info_reply( const struct get_window_info_reply *req ) { fprintf( stderr, " full_handle=%08x,", req->full_handle ); - fprintf( stderr, " pid=%p,", req->pid ); - fprintf( stderr, " tid=%p,", req->tid ); + fprintf( stderr, " pid=%08x,", req->pid ); + fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " atom=%04x", req->atom ); } @@ -2046,7 +2046,7 @@ static void dump_get_window_children_request( const struct get_window_children_r { fprintf( stderr, " parent=%08x,", req->parent ); fprintf( stderr, " atom=%04x,", req->atom ); - fprintf( stderr, " tid=%p", req->tid ); + fprintf( stderr, " tid=%08x", req->tid ); } static void dump_get_window_children_reply( const struct get_window_children_reply *req ) diff --git a/tools/make_requests b/tools/make_requests index 54612d5bd53..9cad33f2252 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -34,6 +34,8 @@ "obj_handle_t" => "%d", "atom_t" => "%04x", "user_handle_t" => "%08x", + "process_id_t" => "%08x", + "thread_id_t" => "%08x", "rectangle_t" => "&dump_rectangle", "char_info_t" => "&dump_char_info", ); diff --git a/windows/input.c b/windows/input.c index c4273b44fa6..8857879de65 100644 --- a/windows/input.c +++ b/windows/input.c @@ -112,7 +112,7 @@ static void queue_raw_hardware_message( UINT message, WPARAM wParam, LPARAM lPar { SERVER_START_REQ( send_message ) { - req->id = (void *)GetCurrentThreadId(); + req->id = GetCurrentThreadId(); req->type = MSG_HARDWARE_RAW; req->win = 0; req->msg = message; diff --git a/windows/message.c b/windows/message.c index c1431dde5ca..5951bffa9a6 100644 --- a/windows/message.c +++ b/windows/message.c @@ -116,7 +116,7 @@ static void queue_hardware_message( MSG *msg, ULONG_PTR extra_info, enum message SERVER_START_REQ( send_message ) { req->type = type; - req->id = (void *)GetWindowThreadProcessId( msg->hwnd, NULL ); + req->id = GetWindowThreadProcessId( msg->hwnd, NULL ); req->win = msg->hwnd; req->msg = msg->message; req->wparam = msg->wParam; diff --git a/windows/win.c b/windows/win.c index 453c968588a..5a69a8c3554 100644 --- a/windows/win.c +++ b/windows/win.c @@ -181,7 +181,7 @@ static HWND *list_window_children( HWND hwnd, ATOM atom, DWORD tid ) { req->parent = hwnd; req->atom = atom; - req->tid = (void *)tid; + req->tid = tid; wine_server_set_reply( req, list, (size-1) * sizeof(HWND) ); if (!wine_server_call( req )) count = reply->count; } -- 2.11.4.GIT