Commit 7fdadbb3 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Add functions for conversions between server user handles and pointer-style handles.

parent d7641074
......@@ -142,7 +142,7 @@ HWND WINAPI GetConsoleWindow(VOID)
SERVER_START_REQ(get_console_input_info)
{
req->handle = 0;
if (!wine_server_call_err(req)) hWnd = reply->win;
if (!wine_server_call_err(req)) hWnd = wine_server_ptr_handle( reply->win );
}
SERVER_END_REQ;
......
......@@ -82,14 +82,14 @@ static void CALLBACK CARET_Callback( HWND hwnd, UINT msg, UINT_PTR id, DWORD cti
SERVER_START_REQ( set_caret_info )
{
req->flags = SET_CARET_STATE;
req->handle = hwnd;
req->handle = wine_server_user_handle( hwnd );
req->x = 0;
req->y = 0;
req->hide = 0;
req->state = -1; /* toggle current state */
if ((ret = !wine_server_call( req )))
{
hwnd = reply->full_handle;
hwnd = wine_server_ptr_handle( reply->full_handle );
r.left = reply->old_rect.left;
r.top = reply->old_rect.top;
r.right = reply->old_rect.right;
......@@ -166,12 +166,12 @@ BOOL WINAPI CreateCaret( HWND hwnd, HBITMAP bitmap, INT width, INT height )
SERVER_START_REQ( set_caret_window )
{
req->handle = hwnd;
req->handle = wine_server_user_handle( hwnd );
req->width = width;
req->height = height;
if ((ret = !wine_server_call_err( req )))
{
prev = reply->previous;
prev = wine_server_ptr_handle( reply->previous );
r.left = reply->old_rect.left;
r.top = reply->old_rect.top;
r.right = reply->old_rect.right;
......@@ -215,7 +215,7 @@ BOOL WINAPI DestroyCaret(void)
req->height = 0;
if ((ret = !wine_server_call_err( req )))
{
prev = reply->previous;
prev = wine_server_ptr_handle( reply->previous );
r.left = reply->old_rect.left;
r.top = reply->old_rect.top;
r.right = reply->old_rect.right;
......@@ -259,7 +259,7 @@ BOOL WINAPI SetCaretPos( INT x, INT y )
req->state = 1;
if ((ret = !wine_server_call_err( req )))
{
hwnd = reply->full_handle;
hwnd = wine_server_ptr_handle( reply->full_handle );
r.left = reply->old_rect.left;
r.top = reply->old_rect.top;
r.right = reply->old_rect.right;
......@@ -296,14 +296,14 @@ BOOL WINAPI HideCaret( HWND hwnd )
SERVER_START_REQ( set_caret_info )
{
req->flags = SET_CARET_HIDE|SET_CARET_STATE;
req->handle = hwnd;
req->handle = wine_server_user_handle( hwnd );
req->x = 0;
req->y = 0;
req->hide = 1;
req->state = 0;
if ((ret = !wine_server_call_err( req )))
{
hwnd = reply->full_handle;
hwnd = wine_server_ptr_handle( reply->full_handle );
r.left = reply->old_rect.left;
r.top = reply->old_rect.top;
r.right = reply->old_rect.right;
......@@ -335,14 +335,14 @@ BOOL WINAPI ShowCaret( HWND hwnd )
SERVER_START_REQ( set_caret_info )
{
req->flags = SET_CARET_HIDE|SET_CARET_STATE;
req->handle = hwnd;
req->handle = wine_server_user_handle( hwnd );
req->x = 0;
req->y = 0;
req->hide = -1;
req->state = 1;
if ((ret = !wine_server_call_err( req )))
{
hwnd = reply->full_handle;
hwnd = wine_server_ptr_handle( reply->full_handle );
r.left = reply->old_rect.left;
r.top = reply->old_rect.top;
r.right = reply->old_rect.right;
......
......@@ -129,7 +129,7 @@ static BOOL set_server_info( HWND hwnd, INT offset, LONG_PTR newval, UINT size )
SERVER_START_REQ( set_class_info )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
req->extra_offset = -1;
switch(offset)
{
......@@ -653,7 +653,7 @@ WORD WINAPI GetClassWord( HWND hwnd, INT offset )
{
SERVER_START_REQ( set_class_info )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
req->flags = 0;
req->extra_offset = offset;
req->extra_size = sizeof(retvalue);
......@@ -690,7 +690,7 @@ static ULONG_PTR CLASS_GetClassLong( HWND hwnd, INT offset, UINT size,
{
SERVER_START_REQ( set_class_info )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
req->flags = 0;
req->extra_offset = (offset >= 0) ? offset : -1;
req->extra_size = (offset >= 0) ? size : 0;
......@@ -845,7 +845,7 @@ WORD WINAPI SetClassWord( HWND hwnd, INT offset, WORD newval )
SERVER_START_REQ( set_class_info )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
req->flags = SET_CLASS_EXTRA;
req->extra_offset = offset;
req->extra_size = sizeof(newval);
......
......@@ -81,23 +81,15 @@ static BOOL bCBHasChanged = FALSE;
*/
static BOOL CLIPBOARD_SetClipboardOwner(HWND hWnd)
{
BOOL bRet = FALSE;
BOOL bRet;
TRACE(" hWnd(%p)\n", hWnd);
SERVER_START_REQ( set_clipboard_info )
{
req->flags = SET_CB_OWNER;
req->owner = WIN_GetFullHandle( hWnd );
if (wine_server_call_err( req ))
{
ERR("Failed to set clipboard owner to %p\n", hWnd);
}
else
{
bRet = TRUE;
}
req->owner = wine_server_user_handle( hWnd );
bRet = !wine_server_call_err( req );
}
SERVER_END_REQ;
......@@ -110,25 +102,19 @@ static BOOL CLIPBOARD_SetClipboardOwner(HWND hWnd)
*/
static BOOL CLIPBOARD_GetClipboardInfo(LPCLIPBOARDINFO cbInfo)
{
BOOL bRet = FALSE;
BOOL bRet;
SERVER_START_REQ( set_clipboard_info )
{
req->flags = 0;
if (wine_server_call_err( req ))
{
ERR("Failed to get clipboard info\n");
}
else
if (((bRet = !wine_server_call_err( req ))))
{
cbInfo->hWndOpen = reply->old_clipboard;
cbInfo->hWndOwner = reply->old_owner;
cbInfo->hWndViewer = reply->old_viewer;
cbInfo->hWndOpen = wine_server_ptr_handle( reply->old_clipboard );
cbInfo->hWndOwner = wine_server_ptr_handle( reply->old_owner );
cbInfo->hWndViewer = wine_server_ptr_handle( reply->old_viewer );
cbInfo->seqno = reply->seqno;
cbInfo->flags = reply->flags;
bRet = TRUE;
}
}
SERVER_END_REQ;
......@@ -168,15 +154,13 @@ BOOL CLIPBOARD_ReleaseOwner(void)
*/
static BOOL CLIPBOARD_OpenClipboard(HWND hWnd)
{
BOOL bRet = FALSE;
BOOL bRet;
SERVER_START_REQ( set_clipboard_info )
{
req->flags = SET_CB_OPEN;
req->clipboard = WIN_GetFullHandle( hWnd );
if (!wine_server_call( req ))
bRet = TRUE;
req->clipboard = wine_server_user_handle( hWnd );
bRet = !wine_server_call( req );
}
SERVER_END_REQ;
......@@ -189,28 +173,15 @@ static BOOL CLIPBOARD_OpenClipboard(HWND hWnd)
*/
static BOOL CLIPBOARD_CloseClipboard(void)
{
BOOL bRet = FALSE;
BOOL bRet;
TRACE(" Changed=%d\n", bCBHasChanged);
SERVER_START_REQ( set_clipboard_info )
{
req->flags = SET_CB_CLOSE;
if (bCBHasChanged)
{
req->flags |= SET_CB_SEQNO;
TRACE("Clipboard data changed\n");
}
if (wine_server_call_err( req ))
{
ERR("Failed to set clipboard.\n");
}
else
{
bRet = TRUE;
}
if (bCBHasChanged) req->flags |= SET_CB_SEQNO;
bRet = !wine_server_call_err( req );
}
SERVER_END_REQ;
......@@ -384,7 +355,7 @@ HWND WINAPI GetClipboardOwner(void)
SERVER_START_REQ( set_clipboard_info )
{
req->flags = 0;
if (!wine_server_call_err( req )) hWndOwner = reply->old_owner;
if (!wine_server_call_err( req )) hWndOwner = wine_server_ptr_handle( reply->old_owner );
}
SERVER_END_REQ;
......@@ -404,7 +375,7 @@ HWND WINAPI GetOpenClipboardWindow(void)
SERVER_START_REQ( set_clipboard_info )
{
req->flags = 0;
if (!wine_server_call_err( req )) hWndOpen = reply->old_clipboard;
if (!wine_server_call_err( req )) hWndOpen = wine_server_ptr_handle( reply->old_clipboard );
}
SERVER_END_REQ;
......@@ -424,16 +395,9 @@ HWND WINAPI SetClipboardViewer( HWND hWnd )
SERVER_START_REQ( set_clipboard_info )
{
req->flags = SET_CB_VIEWER;
req->viewer = WIN_GetFullHandle(hWnd);
if (wine_server_call_err( req ))
{
ERR("Failed to set clipboard.\n");
}
else
{
hwndPrev = reply->old_viewer;
}
req->viewer = wine_server_user_handle( hWnd );
if (!wine_server_call_err( req ))
hwndPrev = wine_server_ptr_handle( reply->old_viewer );
}
SERVER_END_REQ;
......@@ -453,7 +417,7 @@ HWND WINAPI GetClipboardViewer(void)
SERVER_START_REQ( set_clipboard_info )
{
req->flags = 0;
if (!wine_server_call_err( req )) hWndViewer = reply->old_viewer;
if (!wine_server_call_err( req )) hWndViewer = wine_server_ptr_handle( reply->old_viewer );
}
SERVER_END_REQ;
......
......@@ -97,7 +97,7 @@ static void DEFWND_SetTextA( HWND hwnd, LPCSTR text )
MultiByteToWideChar( CP_ACP, 0, text, -1, textW, count );
SERVER_START_REQ( set_window_text )
{
req->handle = hwnd;
req->handle = wine_server_user_handle( hwnd );
wine_server_add_data( req, textW, (count-1) * sizeof(WCHAR) );
wine_server_call( req );
}
......@@ -131,7 +131,7 @@ static void DEFWND_SetTextW( HWND hwnd, LPCWSTR text )
strcpyW( wndPtr->text, text );
SERVER_START_REQ( set_window_text )
{
req->handle = hwnd;
req->handle = wine_server_user_handle( hwnd );
wine_server_add_data( req, wndPtr->text, (count-1) * sizeof(WCHAR) );
wine_server_call( req );
}
......
......@@ -48,8 +48,9 @@ static HWND set_focus_window( HWND hwnd )
SERVER_START_REQ( set_focus_window )
{
req->handle = hwnd;
if ((ret = !wine_server_call_err( req ))) previous = reply->previous;
req->handle = wine_server_user_handle( hwnd );
if ((ret = !wine_server_call_err( req )))
previous = wine_server_ptr_handle( reply->previous );
}
SERVER_END_REQ;
if (!ret) return 0;
......@@ -99,8 +100,9 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
SERVER_START_REQ( set_active_window )
{
req->handle = hwnd;
if ((ret = !wine_server_call_err( req ))) previous = reply->previous;
req->handle = wine_server_user_handle( hwnd );
if ((ret = !wine_server_call_err( req )))
previous = wine_server_ptr_handle( reply->previous );
}
SERVER_END_REQ;
if (!ret) return FALSE;
......@@ -181,10 +183,10 @@ static BOOL set_foreground_window( HWND hwnd, BOOL mouse )
SERVER_START_REQ( set_foreground_window )
{
req->handle = hwnd;
req->handle = wine_server_user_handle( hwnd );
if ((ret = !wine_server_call_err( req )))
{
previous = reply->previous;
previous = wine_server_ptr_handle( reply->previous );
send_msg_old = reply->send_msg_old;
send_msg_new = reply->send_msg_new;
}
......@@ -314,7 +316,7 @@ HWND WINAPI GetActiveWindow(void)
SERVER_START_REQ( get_thread_input )
{
req->tid = GetCurrentThreadId();
if (!wine_server_call_err( req )) ret = reply->active;
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->active );
}
SERVER_END_REQ;
return ret;
......@@ -331,7 +333,7 @@ HWND WINAPI GetFocus(void)
SERVER_START_REQ( get_thread_input )
{
req->tid = GetCurrentThreadId();
if (!wine_server_call_err( req )) ret = reply->focus;
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->focus );
}
SERVER_END_REQ;
return ret;
......@@ -348,7 +350,7 @@ HWND WINAPI GetForegroundWindow(void)
SERVER_START_REQ( get_thread_input )
{
req->tid = 0;
if (!wine_server_call_err( req )) ret = reply->foreground;
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->foreground );
}
SERVER_END_REQ;
return ret;
......@@ -388,8 +390,8 @@ BOOL WINAPI SetShellWindowEx(HWND hwndShell, HWND hwndListView)
SERVER_START_REQ(set_global_windows)
{
req->flags = SET_GLOBAL_SHELL_WINDOWS;
req->shell_window = hwndShell;
req->shell_listview = hwndListView;
req->shell_window = wine_server_user_handle( hwndShell );
req->shell_listview = wine_server_user_handle( hwndListView );
ret = !wine_server_call_err(req);
}
SERVER_END_REQ;
......@@ -418,7 +420,7 @@ HWND WINAPI GetShellWindow(void)
{
req->flags = 0;
if (!wine_server_call_err(req))
hwndShell = reply->old_shell_window;
hwndShell = wine_server_ptr_handle( reply->old_shell_window );
}
SERVER_END_REQ;
......@@ -434,7 +436,7 @@ HWND WINAPI SetProgmanWindow ( HWND hwnd )
SERVER_START_REQ(set_global_windows)
{
req->flags = SET_GLOBAL_PROGMAN_WINDOW;
req->progman_window = hwnd;
req->progman_window = wine_server_user_handle( hwnd );
if (wine_server_call_err( req )) hwnd = 0;
}
SERVER_END_REQ;
......@@ -452,7 +454,8 @@ HWND WINAPI GetProgmanWindow(void)
SERVER_START_REQ(set_global_windows)
{
req->flags = 0;
if (!wine_server_call_err(req)) ret = reply->old_progman_window;
if (!wine_server_call_err(req))
ret = wine_server_ptr_handle( reply->old_progman_window );
}
SERVER_END_REQ;
return ret;
......@@ -470,7 +473,7 @@ HWND WINAPI SetTaskmanWindow ( HWND hwnd )
SERVER_START_REQ(set_global_windows)
{
req->flags = SET_GLOBAL_TASKMAN_WINDOW;
req->taskman_window = hwnd;
req->taskman_window = wine_server_user_handle( hwnd );
if (wine_server_call_err( req )) hwnd = 0;
}
SERVER_END_REQ;
......@@ -487,7 +490,8 @@ HWND WINAPI GetTaskmanWindow(void)
SERVER_START_REQ(set_global_windows)
{
req->flags = 0;
if (!wine_server_call_err(req)) ret = reply->old_taskman_window;
if (!wine_server_call_err(req))
ret = wine_server_ptr_handle( reply->old_taskman_window );
}
SERVER_END_REQ;
return ret;
......
......@@ -191,7 +191,7 @@ static HHOOK set_windows_hook( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid,
if (!wine_server_call_err( req ))
{
handle = reply->handle;
handle = wine_server_ptr_handle( reply->handle );
get_user_thread_info()->active_hooks = reply->active_hooks;
}
}
......@@ -417,7 +417,7 @@ LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL uni
if (!wine_server_call( req ))
{
info.module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
info.handle = reply->handle;
info.handle = wine_server_ptr_handle( reply->handle );
info.pid = reply->pid;
info.tid = reply->tid;
info.proc = reply->proc;
......@@ -520,7 +520,7 @@ BOOL WINAPI UnhookWindowsHookEx( HHOOK hhook )
SERVER_START_REQ( remove_hook )
{
req->handle = hhook;
req->handle = wine_server_user_handle( hhook );
req->id = 0;
ret = !wine_server_call_err( req );
if (ret) get_user_thread_info()->active_hooks = reply->active_hooks;
......@@ -543,14 +543,14 @@ LRESULT WINAPI CallNextHookEx( HHOOK hhook, INT code, WPARAM wparam, LPARAM lpar
SERVER_START_REQ( get_hook_info )
{
req->handle = thread_info->hook;
req->handle = wine_server_user_handle( thread_info->hook );
req->get_next = 1;
req->event = EVENT_MIN;
wine_server_set_reply( req, info.module, sizeof(info.module)-sizeof(WCHAR) );
if (!wine_server_call_err( req ))
{
info.module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
info.handle = reply->handle;
info.handle = wine_server_ptr_handle( reply->handle );
info.id = reply->id;
info.pid = reply->pid;
info.tid = reply->tid;
......@@ -573,14 +573,14 @@ LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam )
SERVER_START_REQ( get_hook_info )
{
req->handle = hhook;
req->handle = wine_server_user_handle( hhook );
req->get_next = 0;
req->event = EVENT_MIN;
wine_server_set_reply( req, info.module, sizeof(info.module)-sizeof(WCHAR) );
if (!wine_server_call_err( req ))
{
info.module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
info.handle = reply->handle;
info.handle = wine_server_ptr_handle( reply->handle );
info.id = reply->id;
info.pid = reply->pid;
info.tid = reply->tid;
......@@ -683,7 +683,7 @@ HWINEVENTHOOK WINAPI SetWinEventHook(DWORD event_min, DWORD event_max,
if (!wine_server_call_err( req ))
{
handle = reply->handle;
handle = wine_server_ptr_handle( reply->handle );
get_user_thread_info()->active_hooks = reply->active_hooks;
}
}
......@@ -712,7 +712,7 @@ BOOL WINAPI UnhookWinEvent(HWINEVENTHOOK hEventHook)
SERVER_START_REQ( remove_hook )
{
req->handle = hEventHook;
req->handle = wine_server_user_handle( hEventHook );
req->id = WH_WINEVENT;
ret = !wine_server_call_err( req );
if (ret) get_user_thread_info()->active_hooks = reply->active_hooks;
......@@ -737,7 +737,7 @@ static inline BOOL find_first_hook(DWORD id, DWORD event, HWND hwnd, LONG object
{
req->id = id;
req->event = event;
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
req->object_id = object_id;
req->child_id = child_id;
wine_server_set_reply( req, info->module, sizeof(info->module)-sizeof(WCHAR) );
......@@ -745,7 +745,7 @@ static inline BOOL find_first_hook(DWORD id, DWORD event, HWND hwnd, LONG object
if (ret)
{
info->module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
info->handle = reply->handle;
info->handle = wine_server_ptr_handle( reply->handle );
info->proc = reply->proc;
info->tid = reply->tid;
thread_info->active_hooks = reply->active_hooks;
......@@ -762,10 +762,10 @@ static inline BOOL find_next_hook(DWORD event, HWND hwnd, LONG object_id,
SERVER_START_REQ( get_hook_info )
{
req->handle = info->handle;
req->handle = wine_server_user_handle( info->handle );
req->get_next = 1;
req->event = event;
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
req->object_id = object_id;
req->child_id = child_id;
wine_server_set_reply( req, info->module, sizeof(info->module)-sizeof(WCHAR) );
......@@ -773,7 +773,7 @@ static inline BOOL find_next_hook(DWORD event, HWND hwnd, LONG object_id,
if (ret)
{
info->module[wine_server_reply_size(req) / sizeof(WCHAR)] = 0;
info->handle = reply->handle;
info->handle = wine_server_ptr_handle( reply->handle );
info->proc = reply->proc;
info->tid = reply->tid;
}
......
......@@ -90,12 +90,12 @@ BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
SERVER_START_REQ( set_capture_window )
{
req->handle = hwnd;
req->handle = wine_server_user_handle( hwnd );
req->flags = flags;
if ((ret = !wine_server_call_err( req )))
{
previous = reply->previous;
hwnd = reply->full_handle;
previous = wine_server_ptr_handle( reply->previous );
hwnd = wine_server_ptr_handle( reply->full_handle );
}
}
SERVER_END_REQ;
......@@ -256,7 +256,7 @@ HWND WINAPI GetCapture(void)
SERVER_START_REQ( get_thread_input )
{
req->tid = GetCurrentThreadId();
if (!wine_server_call_err( req )) ret = reply->capture;
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->capture );
}
SERVER_END_REQ;
return ret;
......
......@@ -1495,7 +1495,7 @@ static BOOL post_dde_message( struct packed_message *data, const struct send_mes
req->id = info->dest_tid;
req->type = info->type;
req->flags = 0;
req->win = info->hwnd;
req->win = wine_server_user_handle( info->hwnd );
req->msg = info->msg;
req->wparam = info->wparam;
req->lparam = lp;
......@@ -1683,7 +1683,7 @@ static void accept_hardware_message( UINT hw_id, BOOL remove, HWND new_hwnd )
{
req->hw_id = hw_id;
req->remove = remove;
req->new_win = new_hwnd;
req->new_win = wine_server_user_handle( new_hwnd );
if (wine_server_call( req ))
FIXME("Failed to reply to MSG_HARDWARE message. Message may not be removed from queue.\n");
}
......@@ -2043,7 +2043,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
SERVER_START_REQ( get_message )
{
req->flags = flags;
req->get_win = hwnd;
req->get_win = wine_server_user_handle( hwnd );
req->get_first = first;
req->get_last = last;
req->hw_id = hw_id;
......@@ -2054,7 +2054,7 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
{
size = wine_server_reply_size( reply );
info.type = reply->type;
info.msg.hwnd = reply->win;
info.msg.hwnd = wine_server_ptr_handle( reply->win );
info.msg.message = reply->msg;
info.msg.wParam = reply->wparam;
info.msg.lParam = reply->lparam;
......@@ -2125,16 +2125,16 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
}
if (TRACE_ON(relay))
DPRINTF( "%04x:Call winevent proc %p (hook=%p,event=%x,hwnd=%p,object_id=%lx,child_id=%lx,tid=%04x,time=%x)\n",
DPRINTF( "%04x:Call winevent proc %p (hook=%04x,event=%x,hwnd=%p,object_id=%lx,child_id=%lx,tid=%04x,time=%x)\n",
GetCurrentThreadId(), hook_proc,
data->hook, info.msg.message, info.msg.hwnd, info.msg.wParam,
info.msg.lParam, data->tid, info.msg.time);
hook_proc( data->hook, info.msg.message, info.msg.hwnd, info.msg.wParam,
info.msg.lParam, data->tid, info.msg.time );
hook_proc( wine_server_ptr_handle( data->hook ), info.msg.message,
info.msg.hwnd, info.msg.wParam, info.msg.lParam, data->tid, info.msg.time );
if (TRACE_ON(relay))
DPRINTF( "%04x:Ret winevent proc %p (hook=%p,event=%x,hwnd=%p,object_id=%lx,child_id=%lx,tid=%04x,time=%x)\n",
DPRINTF( "%04x:Ret winevent proc %p (hook=%04x,event=%x,hwnd=%p,object_id=%lx,child_id=%lx,tid=%04x,time=%x)\n",
GetCurrentThreadId(), hook_proc,
data->hook, info.msg.message, info.msg.hwnd, info.msg.wParam,
info.msg.lParam, data->tid, info.msg.time);
......@@ -2339,7 +2339,7 @@ static BOOL put_message_in_queue( const struct send_message_info *info, size_t *
req->id = info->dest_tid;
req->type = info->type;
req->flags = 0;
req->win = info->hwnd;
req->win = wine_server_user_handle( info->hwnd );
req->msg = info->msg;
req->wparam = info->wparam;
req->lparam = info->lparam;
......@@ -3569,7 +3569,7 @@ UINT_PTR WINAPI SetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc )
SERVER_START_REQ( set_win_timer )
{
req->win = hwnd;
req->win = wine_server_user_handle( hwnd );
req->msg = WM_TIMER;
req->id = id;
req->rate = max( timeout, SYS_TIMER_RATE );
......@@ -3600,7 +3600,7 @@ UINT_PTR WINAPI SetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC
SERVER_START_REQ( set_win_timer )
{
req->win = hwnd;
req->win = wine_server_user_handle( hwnd );
req->msg = WM_SYSTIMER;
req->id = id;
req->rate = max( timeout, SYS_TIMER_RATE );
......@@ -3628,7 +3628,7 @@ BOOL WINAPI KillTimer( HWND hwnd, UINT_PTR id )
SERVER_START_REQ( kill_win_timer )
{
req->win = hwnd;
req->win = wine_server_user_handle( hwnd );
req->msg = WM_TIMER;
req->id = id;
ret = !wine_server_call_err( req );
......@@ -3647,7 +3647,7 @@ BOOL WINAPI KillSystemTimer( HWND hwnd, UINT_PTR id )
SERVER_START_REQ( kill_win_timer )
{
req->win = hwnd;
req->win = wine_server_user_handle( hwnd );
req->msg = WM_SYSTIMER;
req->id = id;
ret = !wine_server_call_err( req );
......@@ -3670,12 +3670,12 @@ BOOL WINAPI GetGUIThreadInfo( DWORD id, GUITHREADINFO *info )
if ((ret = !wine_server_call_err( req )))
{
info->flags = 0;
info->hwndActive = reply->active;
info->hwndFocus = reply->focus;
info->hwndCapture = reply->capture;
info->hwndMenuOwner = reply->menu_owner;
info->hwndMoveSize = reply->move_size;
info->hwndCaret = reply->caret;
info->hwndActive = wine_server_ptr_handle( reply->active );
info->hwndFocus = wine_server_ptr_handle( reply->focus );
info->hwndCapture = wine_server_ptr_handle( reply->capture );
info->hwndMenuOwner = wine_server_ptr_handle( reply->menu_owner );
info->hwndMoveSize = wine_server_ptr_handle( reply->move_size );
info->hwndCaret = wine_server_ptr_handle( reply->caret );
info->rcCaret.left = reply->rect.left;
info->rcCaret.top = reply->rect.top;
info->rcCaret.right = reply->rect.right;
......@@ -3700,7 +3700,7 @@ BOOL WINAPI IsHungAppWindow( HWND hWnd )
SERVER_START_REQ( is_window_hung )
{
req->win = hWnd;
req->win = wine_server_user_handle( hWnd );
ret = !wine_server_call_err( req ) && reply->is_hung;
}
SERVER_END_REQ;
......
......@@ -125,7 +125,7 @@ static void update_visible_region( struct dce *dce )
SERVER_START_REQ( get_visible_region )
{
req->window = dce->hwnd;
req->window = wine_server_user_handle( dce->hwnd );
req->flags = flags;
wine_server_set_reply( req, data->Buffer, size );
if (!(status = wine_server_call( req )))
......@@ -137,7 +137,7 @@ static void update_visible_region( struct dce *dce )
data->rdh.nRgnSize = reply_size;
vis_rgn = ExtCreateRegion( NULL, size, data );
top_win = reply->top_win;
top_win = wine_server_ptr_handle( reply->top_win );
win_rect.left = reply->win_rect.left;
win_rect.top = reply->win_rect.top;
win_rect.right = reply->win_rect.right;
......@@ -535,8 +535,8 @@ static HRGN get_update_region( HWND hwnd, UINT *flags, HWND *child )
SERVER_START_REQ( get_update_region )
{
req->window = hwnd;
req->from_child = child ? *child : 0;
req->window = wine_server_user_handle( hwnd );
req->from_child = wine_server_user_handle( child ? *child : 0 );
req->flags = *flags;
wine_server_set_reply( req, data->Buffer, size );
if (!(status = wine_server_call( req )))
......@@ -547,7 +547,7 @@ static HRGN get_update_region( HWND hwnd, UINT *flags, HWND *child )
data->rdh.nCount = reply_size / sizeof(RECT);
data->rdh.nRgnSize = reply_size;
hrgn = ExtCreateRegion( NULL, size, data );
if (child) *child = reply->child;
if (child) *child = wine_server_ptr_handle( reply->child );
*flags = reply->flags;
}
else size = reply->total_size;
......@@ -572,12 +572,12 @@ static BOOL get_update_flags( HWND hwnd, HWND *child, UINT *flags )
SERVER_START_REQ( get_update_region )
{
req->window = hwnd;
req->from_child = child ? *child : 0;
req->window = wine_server_user_handle( hwnd );
req->from_child = wine_server_user_handle( child ? *child : 0 );
req->flags = *flags | UPDATE_NOREGION;
if ((ret = !wine_server_call_err( req )))
{
if (child) *child = reply->child;
if (child) *child = wine_server_ptr_handle( reply->child );
*flags = reply->flags;
}
}
......@@ -600,7 +600,7 @@ static BOOL redraw_window_rects( HWND hwnd, UINT flags, const RECT *rects, UINT
SERVER_START_REQ( redraw_window )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
req->flags = flags;
wine_server_add_data( req, rects, count * sizeof(RECT) );
ret = !wine_server_call_err( req );
......
......@@ -53,7 +53,7 @@ static property_data_t *get_properties( HWND hwnd, int *count )
*count = 0;
SERVER_START_REQ( get_window_properties )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
wine_server_set_reply( req, data, total * sizeof(*data) );
if (!wine_server_call( req )) res = reply->total;
}
......@@ -134,7 +134,7 @@ HANDLE WINAPI GetPropW( HWND hwnd, LPCWSTR str )
SERVER_START_REQ( get_window_property )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
if (!HIWORD(str)) req->atom = LOWORD(str);
else wine_server_add_data( req, str, strlenW(str) * sizeof(WCHAR) );
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->handle );
......@@ -166,7 +166,7 @@ BOOL WINAPI SetPropW( HWND hwnd, LPCWSTR str, HANDLE handle )
SERVER_START_REQ( set_window_property )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
req->handle = wine_server_obj_handle( handle );
if (!HIWORD(str)) req->atom = LOWORD(str);
else wine_server_add_data( req, str, strlenW(str) * sizeof(WCHAR) );
......@@ -199,7 +199,7 @@ HANDLE WINAPI RemovePropW( HWND hwnd, LPCWSTR str )
SERVER_START_REQ( remove_window_property )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
if (!HIWORD(str)) req->atom = LOWORD(str);
else wine_server_add_data( req, str, strlenW(str) * sizeof(WCHAR) );
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->handle );
......
......@@ -126,7 +126,7 @@ int WINAPI GetWindowRgn ( HWND hwnd, HRGN hrgn )
}
SERVER_START_REQ( get_window_region )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
wine_server_set_reply( req, data->Buffer, size );
if (!(status = wine_server_call( req )))
{
......@@ -178,7 +178,7 @@ int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw )
}
SERVER_START_REQ( set_window_region )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
req->redraw = (bRedraw != 0);
if (data->rdh.nCount)
wine_server_add_data( req, data->Buffer, data->rdh.nCount * sizeof(RECT) );
......@@ -192,7 +192,7 @@ int WINAPI SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL bRedraw )
{
SERVER_START_REQ( set_window_region )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
req->redraw = (bRedraw != 0);
ret = !wine_server_call_err( req );
}
......@@ -259,7 +259,7 @@ BOOL WINAPI ScreenToClient( HWND hwnd, LPPOINT lppnt )
static HWND *list_children_from_point( HWND hwnd, POINT pt )
{
HWND *list;
int size = 128;
int i, size = 128;
for (;;)
{
......@@ -269,15 +269,18 @@ static HWND *list_children_from_point( HWND hwnd, POINT pt )
SERVER_START_REQ( get_window_children_from_point )
{
req->parent = hwnd;
req->parent = wine_server_user_handle( hwnd );
req->x = pt.x;
req->y = pt.y;
wine_server_set_reply( req, list, (size-1) * sizeof(HWND) );
wine_server_set_reply( req, list, (size-1) * sizeof(user_handle_t) );
if (!wine_server_call( req )) count = reply->count;
}
SERVER_END_REQ;
if (count && count < size)
{
/* start from the end since HWND is potentially larger than user_handle_t */
for (i = count - 1; i >= 0; i--)
list[i] = wine_server_ptr_handle( ((user_handle_t *)list)[i] );
list[count] = 0;
return list;
}
......@@ -473,8 +476,8 @@ static void WINPOS_GetWinOffset( HWND hwndFrom, HWND hwndTo, POINT *offset )
offset->x = offset->y = 0;
SERVER_START_REQ( get_windows_offset )
{
req->from = hwndFrom;
req->to = hwndTo;
req->from = wine_server_user_handle( hwndFrom );
req->to = wine_server_user_handle( hwndTo );
if (!wine_server_call( req ))
{
offset->x = reply->x;
......@@ -1894,8 +1897,8 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
old_window_rect = win->rectWindow;
SERVER_START_REQ( set_window_pos )
{
req->handle = hwnd;
req->previous = insert_after;
req->handle = wine_server_user_handle( hwnd );
req->previous = wine_server_user_handle( insert_after );
req->flags = swp_flags;
req->window.left = window_rect->left;
req->window.top = window_rect->top;
......
......@@ -563,9 +563,9 @@ static BOOL X11DRV_CLIPBOARD_GetClipboardInfo(LPCLIPBOARDINFO cbInfo)
}
else
{
cbInfo->hWndOpen = reply->old_clipboard;
cbInfo->hWndOwner = reply->old_owner;
cbInfo->hWndViewer = reply->old_viewer;
cbInfo->hWndOpen = wine_server_ptr_handle( reply->old_clipboard );
cbInfo->hWndOwner = wine_server_ptr_handle( reply->old_owner );
cbInfo->hWndViewer = wine_server_ptr_handle( reply->old_viewer );
cbInfo->seqno = reply->seqno;
cbInfo->flags = reply->flags;
......
......@@ -724,7 +724,7 @@ static void X11DRV_Expose( HWND hwnd, XEvent *xev )
{
SERVER_START_REQ( update_window_zorder )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
req->rect.left = rect.left;
req->rect.top = rect.top;
req->rect.right = rect.right;
......
......@@ -196,7 +196,7 @@ static void update_mouse_state( HWND hwnd, Window window, int x, int y, unsigned
{
SERVER_START_REQ( update_window_zorder )
{
req->window = hwnd;
req->window = wine_server_user_handle( hwnd );
req->rect.left = pt->x;
req->rect.top = pt->y;
req->rect.right = pt->x + 1;
......@@ -255,7 +255,7 @@ static void queue_raw_mouse_message( UINT message, HWND hwnd, DWORD x, DWORD y,
SERVER_START_REQ( send_hardware_message )
{
req->id = (injected_flags & LLMHF_INJECTED) ? 0 : GetCurrentThreadId();
req->win = hwnd;
req->win = wine_server_user_handle( hwnd );
req->msg = message;
req->wparam = MAKEWPARAM( get_key_state(), data );
req->lparam = 0;
......
......@@ -1636,7 +1636,7 @@ BOOL X11DRV_CreateDesktopWindow( HWND hwnd )
/* retrieve the real size of the desktop */
SERVER_START_REQ( get_window_rectangles )
{
req->handle = hwnd;
req->handle = wine_server_user_handle( hwnd );
wine_server_call( req );
width = reply->window.right - reply->window.left;
height = reply->window.bottom - reply->window.top;
......@@ -1647,7 +1647,7 @@ BOOL X11DRV_CreateDesktopWindow( HWND hwnd )
{
SERVER_START_REQ( set_window_pos )
{
req->handle = hwnd;
req->handle = wine_server_user_handle( hwnd );
req->previous = 0;
req->flags = SWP_NOZORDER;
req->window.left = virtual_screen_rect.left;
......
......@@ -3720,7 +3720,7 @@ INT WINAPI WSAAsyncSelect(SOCKET s, HWND hWnd, UINT uMsg, LONG lEvent)
req->handle = wine_server_obj_handle( SOCKET2HANDLE(s) );
req->mask = lEvent;
req->event = 0;
req->window = hWnd;
req->window = wine_server_user_handle( hWnd );
req->msg = uMsg;
ret = wine_server_call( req );
}
......
......@@ -96,6 +96,12 @@ static inline obj_handle_t wine_server_obj_handle( HANDLE handle )
return (INT_PTR)handle;
}
/* convert a user handle to a server handle */
static inline user_handle_t wine_server_user_handle( HANDLE handle )
{
return (UINT_PTR)handle;
}
/* convert a server handle to a generic handle */
static inline HANDLE wine_server_ptr_handle( obj_handle_t handle )
{
......
......@@ -681,7 +681,7 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
SERVER_START_REQ( set_console_input_info )
{
req->handle = wine_server_obj_handle( data->hConIn );
req->win = data->hWnd;
req->win = wine_server_user_handle( data->hWnd );
req->mask = SET_CONSOLE_INPUT_INFO_TITLE |
SET_CONSOLE_INPUT_INFO_WIN;
wine_server_add_data( req, appname, lstrlenW(appname) * sizeof(WCHAR) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment