win32u: Use user message packing for WM_NCCALCSIZE.
[wine.git] / dlls / wow64win / user.c
blob7aea543ea6a13bd14cac12db212b33b8f58ec538
1 /*
2 * WoW64 User functions
4 * Copyright 2021 Jacek Caban for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #include "ntstatus.h"
24 #define WIN32_NO_STATUS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "ntuser.h"
28 #include "wow64win_private.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(wow);
33 typedef struct
35 DWORD cbSize;
36 DWORD fMask;
37 DWORD dwStyle;
38 UINT cyMax;
39 ULONG hbrBack;
40 DWORD dwContextHelpID;
41 ULONG dwMenuData;
42 } MENUINFO32;
44 typedef struct
46 UINT cbSize;
47 UINT fMask;
48 UINT fType;
49 UINT fState;
50 UINT wID;
51 UINT32 hSubMenu;
52 UINT32 hbmpChecked;
53 UINT32 hbmpUnchecked;
54 UINT32 dwItemData;
55 UINT32 dwTypeData;
56 UINT cch;
57 UINT32 hbmpItem;
58 } MENUITEMINFOW32;
60 typedef struct
62 UINT32 hwnd;
63 UINT message;
64 UINT32 wParam;
65 UINT32 lParam;
66 DWORD time;
67 POINT pt;
68 } MSG32;
70 typedef struct
72 DWORD dwType;
73 DWORD dwSize;
74 UINT32 hDevice;
75 UINT32 wParam;
76 } RAWINPUTHEADER32;
78 typedef struct
80 USHORT usUsagePage;
81 USHORT usUsage;
82 DWORD dwFlags;
83 UINT32 hwndTarget;
84 } RAWINPUTDEVICE32;
86 typedef struct
88 UINT32 hDevice;
89 DWORD dwType;
90 } RAWINPUTDEVICELIST32;
92 typedef struct
94 LONG dx;
95 LONG dy;
96 DWORD mouseData;
97 DWORD dwFlags;
98 DWORD time;
99 ULONG dwExtraInfo;
100 } MOUSEINPUT32;
102 typedef struct
104 WORD wVk;
105 WORD wScan;
106 DWORD dwFlags;
107 DWORD time;
108 ULONG dwExtraInfo;
109 } KEYBDINPUT32;
111 typedef struct
113 DWORD type;
114 union
116 MOUSEINPUT32 mi;
117 KEYBDINPUT32 ki;
118 HARDWAREINPUT hi;
119 } DUMMYUNIONNAME;
120 } INPUT32;
122 typedef struct
124 int x;
125 int y;
126 DWORD time;
127 ULONG dwExtraInfo;
128 } MOUSEMOVEPOINT32;
130 typedef struct
132 UINT32 hdc;
133 BOOL fErase;
134 RECT rcPaint;
135 BOOL fRestore;
136 BOOL fIncUpdate;
137 BYTE rgbReserved[32];
138 } PAINTSTRUCT32;
140 typedef struct
142 ULONG lpCreateParams;
143 ULONG hInstance;
144 ULONG hMenu;
145 ULONG hwndParent;
146 INT cy;
147 INT cx;
148 INT y;
149 INT x;
150 LONG style;
151 ULONG lpszName;
152 ULONG lpszClass;
153 DWORD dwExStyle;
154 } CREATESTRUCT32;
156 typedef struct
158 ULONG szClass;
159 ULONG szTitle;
160 ULONG hOwner;
161 INT x;
162 INT y;
163 INT cx;
164 INT cy;
165 DWORD style;
166 ULONG lParam;
167 } MDICREATESTRUCT32;
169 typedef struct
171 ULONG hmenuIn;
172 ULONG hmenuNext;
173 ULONG hwndNext;
174 } MDINEXTMENU32;
176 typedef struct
178 LONG lResult;
179 LONG lParam;
180 LONG wParam;
181 DWORD message;
182 ULONG hwnd;
183 } CWPRETSTRUCT32;
185 typedef struct
187 ULONG hwnd;
188 ULONG hwndInsertAfter;
189 INT x;
190 INT y;
191 INT cx;
192 INT cy;
193 UINT flags;
194 } WINDOWPOS32;
196 typedef struct
198 RECT rgrc[3];
199 ULONG lppos;
200 } NCCALCSIZE_PARAMS32;
202 typedef struct
204 UINT CtlType;
205 UINT CtlID;
206 ULONG hwndItem;
207 UINT itemID1;
208 ULONG itemData1;
209 UINT itemID2;
210 ULONG itemData2;
211 DWORD dwLocaleId;
212 } COMPAREITEMSTRUCT32;
214 typedef struct
216 ULONG dwData;
217 DWORD cbData;
218 ULONG lpData;
219 } COPYDATASTRUCT32;
221 typedef struct
223 UINT CtlType;
224 UINT CtlID;
225 UINT itemID;
226 UINT itemWidth;
227 UINT itemHeight;
228 ULONG itemData;
229 } MEASUREITEMSTRUCT32;
231 typedef struct
233 UINT CtlType;
234 UINT CtlID;
235 UINT itemID;
236 UINT itemAction;
237 UINT itemState;
238 ULONG hwndItem;
239 ULONG hDC;
240 RECT rcItem;
241 ULONG itemData;
242 } DRAWITEMSTRUCT32;
244 typedef struct
246 ULONG lParam;
247 ULONG wParam;
248 UINT message;
249 ULONG hwnd;
250 } CWPSTRUCT32;
252 typedef struct
254 POINT pt;
255 ULONG hwnd;
256 UINT wHitTestCode;
257 ULONG dwExtraInfo;
258 DWORD mouseData;
259 } MOUSEHOOKSTRUCTEX32;
261 typedef struct
263 POINT pt;
264 DWORD mouseData;
265 DWORD flags;
266 DWORD time;
267 ULONG dwExtraInfo;
268 } MSLLHOOKSTRUCT32;
270 typedef struct
272 DWORD vkCode;
273 DWORD scanCode;
274 DWORD flags;
275 DWORD time;
276 ULONG dwExtraInfo;
277 } KBDLLHOOKSTRUCT32;
279 typedef struct
281 UINT message;
282 UINT paramL;
283 UINT paramH;
284 DWORD time;
285 ULONG hwnd;
286 } EVENTMSG32;
288 typedef struct
290 BOOL fMouse;
291 ULONG hWndActive;
292 } CBTACTIVATESTRUCT32;
294 typedef struct
296 UINT CtlType;
297 UINT CtlID;
298 UINT itemID;
299 ULONG hwndItem;
300 ULONG itemData;
301 } DELETEITEMSTRUCT32;
303 typedef struct
305 UINT cbSize;
306 UINT style;
307 ULONG lpfnWndProc;
308 INT cbClsExtra;
309 INT cbWndExtra;
310 ULONG hInstance;
311 ULONG hIcon;
312 ULONG hCursor;
313 ULONG hbrBackground;
314 ULONG lpszMenuName;
315 ULONG lpszClassName;
316 ULONG hIconSm;
317 } WNDCLASSEXW32;
319 struct client_menu_name32
321 ULONG nameA;
322 ULONG nameW;
323 ULONG nameUS;
326 struct win_proc_params32
328 ULONG func;
329 ULONG hwnd;
330 UINT msg;
331 ULONG wparam;
332 ULONG lparam;
333 BOOL ansi;
334 BOOL ansi_dst;
335 BOOL needs_unpack;
336 enum wm_char_mapping mapping;
337 ULONG dpi_awareness;
338 ULONG procA;
339 ULONG procW;
342 struct win_hook_params32
344 ULONG proc;
345 ULONG handle;
346 DWORD pid;
347 DWORD tid;
348 int id;
349 int code;
350 ULONG wparam;
351 ULONG lparam;
352 BOOL prev_unicode;
353 BOOL next_unicode;
354 WCHAR module[1];
357 struct win_event_hook_params32
359 DWORD event;
360 ULONG hwnd;
361 LONG object_id;
362 LONG child_id;
363 ULONG handle;
364 DWORD tid;
365 DWORD time;
366 ULONG proc;
367 WCHAR module[MAX_PATH];
370 struct draw_text_params32
372 ULONG hdc;
373 int count;
374 RECT rect;
375 UINT flags;
376 WCHAR str[1];
379 struct unpack_dde_message_params32
381 ULONG result;
382 ULONG hwnd;
383 UINT message;
384 LONG wparam;
385 LONG lparam;
386 char data[1];
389 static MSG *msg_32to64( MSG *msg, const MSG32 *msg32 )
391 if (!msg32) return NULL;
393 msg->hwnd = LongToHandle( msg32->hwnd );
394 msg->message = msg32->message;
395 msg->wParam = msg32->wParam;
396 msg->lParam = msg32->lParam;
397 msg->time = msg32->time;
398 msg->pt = msg32->pt;
399 return msg;
402 static MSG32 *msg_64to32( const MSG *msg64, MSG32 *msg32 )
404 MSG32 msg;
406 if (!msg32) return NULL;
408 msg.hwnd = HandleToLong( msg64->hwnd );
409 msg.message = msg64->message;
410 msg.wParam = msg64->wParam;
411 msg.lParam = msg64->lParam;
412 msg.time = msg64->time;
413 msg.pt = msg64->pt;
414 memcpy( msg32, &msg, sizeof(msg) );
415 return msg32;
418 static struct client_menu_name *client_menu_name_32to64( struct client_menu_name *name,
419 const struct client_menu_name32 *name32 )
421 if (!name32) return NULL;
422 name->nameA = UlongToPtr( name32->nameA );
423 name->nameW = UlongToPtr( name32->nameW );
424 name->nameUS = UlongToPtr( name32->nameUS );
425 return name;
428 static struct client_menu_name32 *client_menu_name_64to32( const struct client_menu_name *name64,
429 struct client_menu_name32 *name32 )
431 if (name32)
433 struct client_menu_name32 name;
434 name.nameA = PtrToUlong( name64->nameA );
435 name.nameW = PtrToUlong( name64->nameW );
436 name.nameUS = PtrToUlong( name64->nameUS );
437 memcpy( name32, &name, sizeof(name) );
439 return name32;
442 static void win_proc_params_64to32( const struct win_proc_params *src, struct win_proc_params32 *dst )
444 struct win_proc_params32 params;
446 params.func = PtrToUlong( src->func );
447 params.hwnd = HandleToUlong( src->hwnd );
448 params.msg = src->msg;
449 params.wparam = src->wparam;
450 params.lparam = src->lparam;
451 params.ansi = src->ansi;
452 params.ansi_dst = src->ansi_dst;
453 params.needs_unpack = src->needs_unpack;
454 params.mapping = src->mapping;
455 params.dpi_awareness = HandleToUlong( src->dpi_awareness );
456 params.procA = PtrToUlong( src->procA );
457 params.procW = PtrToUlong( src->procW );
458 memcpy( dst, &params, sizeof(params) );
461 static void createstruct_32to64( const CREATESTRUCT32 *from, CREATESTRUCTW *to )
464 to->lpCreateParams = UlongToPtr( from->lpCreateParams );
465 to->hInstance = UlongToPtr( from->hInstance );
466 to->hMenu = LongToHandle( from->hMenu );
467 to->hwndParent = LongToHandle( from->hwndParent );
468 to->cy = from->cy;
469 to->cx = from->cx;
470 to->y = from->y;
471 to->x = from->x;
472 to->style = from->style;
473 to->dwExStyle = from->dwExStyle;
474 to->lpszName = UlongToPtr( from->lpszName );
475 to->lpszClass = UlongToPtr( from->lpszClass );
478 static void createstruct_64to32( const CREATESTRUCTW *from, CREATESTRUCT32 *to )
480 CREATESTRUCT32 cs;
482 cs.lpCreateParams = PtrToUlong( from->lpCreateParams );
483 cs.hInstance = PtrToUlong( from->hInstance );
484 cs.hMenu = HandleToUlong( from->hMenu );
485 cs.hwndParent = HandleToUlong( from->hwndParent );
486 cs.cy = from->cy;
487 cs.cx = from->cx;
488 cs.y = from->y;
489 cs.x = from->x;
490 cs.style = from->style;
491 cs.lpszName = PtrToUlong( from->lpszName );
492 cs.lpszClass = PtrToUlong( from->lpszClass );
493 cs.dwExStyle = from->dwExStyle;
494 memcpy( to, &cs, sizeof(cs) );
497 static void winpos_32to64( WINDOWPOS *dst, const WINDOWPOS32 *src )
499 dst->hwnd = LongToHandle( src->hwnd );
500 dst->hwndInsertAfter = LongToHandle( src->hwndInsertAfter );
501 dst->x = src->x;
502 dst->y = src->y;
503 dst->cx = src->cx;
504 dst->cy = src->cy;
505 dst->flags = src->flags;
508 static void winpos_64to32( const WINDOWPOS *src, WINDOWPOS32 *dst )
510 WINDOWPOS32 wp;
512 wp.hwnd = HandleToUlong( src->hwnd );
513 wp.hwndInsertAfter = HandleToUlong( src->hwndInsertAfter );
514 wp.x = src->x;
515 wp.y = src->y;
516 wp.cx = src->cx;
517 wp.cy = src->cy;
518 wp.flags = src->flags;
519 memcpy( dst, &wp, sizeof(wp) );
522 static PAINTSTRUCT *paintstruct_32to64( PAINTSTRUCT *ps, const PAINTSTRUCT32 *ps32 )
524 if (!ps32) return NULL;
525 ps->hdc = ULongToHandle( ps32->hdc );
526 ps->fErase = ps32->fErase;
527 ps->rcPaint = ps32->rcPaint;
528 ps->fRestore = ps32->fRestore;
529 ps->fIncUpdate = ps32->fIncUpdate;
530 return ps;
533 static MOUSEHOOKSTRUCTEX32 *mousehookstruct_64to32( const MOUSEHOOKSTRUCTEX *hook64,
534 MOUSEHOOKSTRUCTEX32 *hook32 )
536 MOUSEHOOKSTRUCTEX32 hook;
538 if (!hook64) return NULL;
540 hook.pt = hook64->pt;
541 hook.hwnd = HandleToUlong( hook64->hwnd );
542 hook.wHitTestCode = hook64->wHitTestCode;
543 hook.dwExtraInfo = hook64->dwExtraInfo;
544 hook.mouseData = hook64->mouseData;
545 memcpy( hook32, &hook, sizeof(hook) );
546 return hook32;
549 static NTSTATUS dispatch_callback( ULONG id, void *args, ULONG len )
551 void *ret_ptr;
552 ULONG ret_len;
553 NTSTATUS status = Wow64KiUserCallbackDispatcher( id, args, len, &ret_ptr, &ret_len );
554 return NtCallbackReturn( ret_ptr, ret_len, status );
557 static NTSTATUS WINAPI wow64_NtUserCallEnumDisplayMonitor( void *arg, ULONG size )
559 struct enum_display_monitor_params *params = arg;
560 struct
562 ULONG proc;
563 ULONG monitor;
564 ULONG hdc;
565 RECT rect;
566 ULONG lparam;
567 } params32;
569 params32.proc = PtrToUlong( params->proc );
570 params32.monitor = HandleToUlong( params->monitor );
571 params32.hdc = HandleToUlong( params->hdc );
572 params32.rect = params->rect;
573 params32.lparam = params->lparam;
574 return dispatch_callback( NtUserCallEnumDisplayMonitor, &params32, sizeof(params32) );
577 static NTSTATUS WINAPI wow64_NtUserCallSendAsyncCallback( void *arg, ULONG size )
579 struct send_async_params *params = arg;
580 struct
582 ULONG callback;
583 ULONG hwnd;
584 UINT msg;
585 ULONG data;
586 ULONG result;
587 } params32;
589 params32.callback = PtrToUlong( params->callback );
590 params32.hwnd = HandleToUlong( params->hwnd );
591 params32.msg = params->msg;
592 params32.data = params->data;
593 params32.result = params->result;
594 return dispatch_callback( NtUserCallSendAsyncCallback, &params32, sizeof(params32) );
597 static NTSTATUS WINAPI wow64_NtUserCallWinEventHook( void *arg, ULONG size )
599 struct win_event_hook_params *params = arg;
600 struct win_event_hook_params32 params32;
602 params32.event = params->event;
603 params32.hwnd = HandleToUlong( params->hwnd );
604 params32.object_id = params->object_id;
605 params32.child_id = params->child_id;
606 params32.handle = HandleToUlong( params->handle );
607 params32.tid = params->tid;
608 params32.time = params->time;
609 params32.proc = PtrToUlong( params->proc );
611 size -= FIELD_OFFSET( struct win_event_hook_params, module );
612 if (size) memcpy( params32.module, params->module, size );
613 return dispatch_callback( NtUserCallWinEventHook, &params32,
614 FIELD_OFFSET( struct win_event_hook_params32, module ) + size);
617 static size_t packed_message_64to32( UINT message, WPARAM wparam,
618 const void *params64, void *params32, size_t size )
620 if (!size) return 0;
622 switch (message)
624 case WM_NCCREATE:
625 case WM_CREATE:
627 CREATESTRUCT32 *cs32 = params32;
628 const CREATESTRUCTW *cs64 = params64;
630 createstruct_64to32( cs64, cs32 );
631 size -= sizeof(*cs64);
632 if (size) memmove( cs32 + 1, cs64 + 1, size );
633 return sizeof(*cs32) + size;
636 case WM_NCCALCSIZE:
637 if (wparam)
639 NCCALCSIZE_PARAMS32 ncp32;
640 const NCCALCSIZE_PARAMS *ncp64 = params64;
642 ncp32.rgrc[0] = ncp64->rgrc[0];
643 ncp32.rgrc[1] = ncp64->rgrc[1];
644 ncp32.rgrc[2] = ncp64->rgrc[2];
645 winpos_64to32( (const WINDOWPOS *)(ncp64 + 1),
646 (WINDOWPOS32 *)((const char *)params32 + sizeof(ncp32)) );
647 memcpy( params32, &ncp32, sizeof(ncp32) );
648 return sizeof(ncp32) + sizeof(WINDOWPOS32);
650 break;
653 memmove( params32, params64, size );
654 return size;
657 static size_t packed_result_32to64( UINT message, WPARAM wparam, const void *params32,
658 size_t size, void *params64 )
660 if (!size) return 0;
662 switch (message)
664 case WM_NCCREATE:
665 case WM_CREATE:
666 if (size >= sizeof(CREATESTRUCT32))
668 const CREATESTRUCT32 *cs32 = params32;
669 CREATESTRUCTW *cs64 = params64;
671 cs64->lpCreateParams = UlongToPtr( cs32->lpCreateParams );
672 cs64->hInstance = UlongToPtr( cs32->hInstance );
673 cs64->hMenu = LongToHandle( cs32->hMenu );
674 cs64->hwndParent = LongToHandle( cs32->hwndParent );
675 cs64->cy = cs32->cy;
676 cs64->cx = cs32->cx;
677 cs64->y = cs32->y;
678 cs64->x = cs32->x;
679 cs64->style = cs32->style;
680 cs64->dwExStyle = cs32->dwExStyle;
681 return sizeof(*cs64);
684 case WM_NCCALCSIZE:
685 if (wparam)
687 const NCCALCSIZE_PARAMS32 *ncp32 = params32;
688 NCCALCSIZE_PARAMS *ncp64 = params64;
690 ncp64->rgrc[0] = ncp32->rgrc[0];
691 ncp64->rgrc[1] = ncp32->rgrc[1];
692 ncp64->rgrc[2] = ncp32->rgrc[2];
693 winpos_32to64( (WINDOWPOS *)(ncp64 + 1), (const WINDOWPOS32 *)(ncp32 + 1) );
694 return sizeof(*ncp64) + sizeof(WINDOWPOS);
696 break;
698 default:
699 return 0;
702 if (size) memcpy( params64, params32, size );
703 return size;
706 static NTSTATUS WINAPI wow64_NtUserCallWinProc( void *arg, ULONG size )
708 struct win_proc_params *params = arg;
709 struct win_proc_params32 *params32 = arg;
710 size_t lparam_size = 0;
711 LRESULT result = 0;
712 void *ret_ptr;
713 ULONG ret_len;
714 NTSTATUS status;
716 win_proc_params_64to32( params, params32 );
717 if (size > sizeof(*params))
718 lparam_size = packed_message_64to32( params32->msg, params32->wparam, params + 1, params32 + 1,
719 size - sizeof(*params) );
721 status = Wow64KiUserCallbackDispatcher( NtUserCallWinProc, params32,
722 sizeof(*params32) + lparam_size,
723 &ret_ptr, &ret_len );
725 if (ret_len >= sizeof(LONG))
727 LRESULT *result_ptr = arg;
728 result = *(LONG *)ret_ptr;
729 ret_len = packed_result_32to64( params32->msg, params32->wparam, (LONG *)ret_ptr + 1,
730 ret_len - sizeof(LONG), result_ptr + 1 );
731 *result_ptr = result;
732 return NtCallbackReturn( result_ptr, sizeof(*result_ptr) + ret_len, status );
735 return NtCallbackReturn( &result, sizeof(result), status );
738 static UINT hook_lparam_64to32( int id, int code, const void *lp, size_t size, void *lp32 )
740 if (!size) return 0;
742 switch (id)
744 case WH_SYSMSGFILTER:
745 case WH_MSGFILTER:
746 case WH_GETMESSAGE:
747 msg_64to32( lp, lp32 );
748 return sizeof(MSG32);
750 case WH_CBT:
751 switch (code)
753 case HCBT_CREATEWND:
754 return packed_message_64to32( WM_CREATE, 0, lp, lp32, size );
756 case HCBT_ACTIVATE:
758 const CBTACTIVATESTRUCT *cbt = lp;
759 CBTACTIVATESTRUCT32 cbt32;
760 cbt32.fMouse = cbt->fMouse;
761 cbt32.hWndActive = HandleToUlong( cbt->hWndActive );
762 memcpy( lp32, &cbt32, sizeof(cbt32) );
763 return sizeof(cbt32);
766 case HCBT_CLICKSKIPPED:
767 mousehookstruct_64to32( lp, lp32 );
768 return sizeof(MOUSEHOOKSTRUCTEX32);
770 break;
772 case WH_CALLWNDPROC:
774 const CWPSTRUCT *cwp = lp;
775 CWPSTRUCT32 cwp32;
776 cwp32.lParam = cwp->lParam;
777 cwp32.wParam = cwp->wParam;
778 cwp32.message = cwp->message;
779 cwp32.hwnd = HandleToUlong( cwp->hwnd );
780 memcpy( lp32, &cwp32, sizeof(cwp32) );
781 if (size > sizeof(*cwp))
783 const size_t offset64 = (sizeof(*cwp) + 15) & ~15;
784 const size_t offset32 = (sizeof(cwp32) + 15) & ~15;
785 size = packed_message_64to32( cwp32.message, cwp32.wParam,
786 (const char *)lp + offset64,
787 (char *)lp32 + offset32, size - offset64 );
788 return offset32 + size;
790 return sizeof(cwp32);
793 case WH_CALLWNDPROCRET:
795 const CWPRETSTRUCT *cwpret = lp;
796 CWPRETSTRUCT32 cwpret32;
797 cwpret32.lResult = cwpret->lResult;
798 cwpret32.lParam = cwpret->lParam;
799 cwpret32.wParam = cwpret->wParam;
800 cwpret32.message = cwpret->message;
801 cwpret32.hwnd = HandleToUlong( cwpret->hwnd );
802 memcpy( lp32, &cwpret32, sizeof(cwpret32) );
803 if (size > sizeof(*cwpret))
805 const size_t offset64 = (sizeof(*cwpret) + 15) & ~15;
806 const size_t offset32 = (sizeof(cwpret32) + 15) & ~15;
807 size = packed_message_64to32( cwpret32.message, cwpret32.wParam,
808 (const char *)lp + offset64,
809 (char *)lp32 + offset32, size - offset64 );
810 return offset32 + size;
812 return sizeof(cwpret32);
815 case WH_MOUSE:
816 mousehookstruct_64to32( lp, lp32 );
817 return sizeof(MOUSEHOOKSTRUCTEX32);
819 case WH_MOUSE_LL:
821 const MSLLHOOKSTRUCT *hook = lp;
822 MSLLHOOKSTRUCT32 hook32;
823 hook32.pt = hook->pt;
824 hook32.mouseData = hook->mouseData;
825 hook32.flags = hook->flags;
826 hook32.time = hook->time;
827 hook32.dwExtraInfo = hook->dwExtraInfo;
828 memcpy( lp32, &hook32, sizeof(hook32) );
829 return sizeof(hook32);
832 case WH_KEYBOARD_LL:
834 const KBDLLHOOKSTRUCT *hook = lp;
835 KBDLLHOOKSTRUCT32 hook32;
836 hook32.vkCode = hook->vkCode;
837 hook32.scanCode = hook->scanCode;
838 hook32.flags = hook->flags;
839 hook32.time = hook->time;
840 hook32.dwExtraInfo = hook->dwExtraInfo;
841 memcpy( lp32, &hook32, sizeof(hook32) );
842 return sizeof(hook32);
845 case WH_JOURNALRECORD:
847 const EVENTMSG *event = lp;
848 EVENTMSG32 event32;
850 event32.message = event->message;
851 event32.paramL = event->paramL;
852 event32.paramH = event->paramH;
853 event32.time = event->time;
854 event32.hwnd = HandleToUlong( event->hwnd );
855 memcpy( lp32, &event32, sizeof(event32) );
856 return sizeof(event32);
860 memmove( lp32, lp, size );
861 return size;
864 static NTSTATUS WINAPI wow64_NtUserCallWindowsHook( void *arg, ULONG size )
866 struct win_hook_params *params = arg;
867 struct win_hook_params32 params32;
868 UINT module_len, size32, offset;
869 void *ret_ptr;
870 ULONG ret_len;
871 NTSTATUS ret;
873 module_len = wcslen( params->module );
874 size32 = FIELD_OFFSET( struct win_hook_params32, module[module_len + 1] );
875 offset = FIELD_OFFSET( struct win_hook_params, module[module_len + 1] );
877 params32.proc = PtrToUlong( params->proc );
878 params32.handle = HandleToUlong( params->handle );
879 params32.pid = params->pid;
880 params32.tid = params->tid;
881 params32.id = params->id;
882 params32.code = params->code;
883 params32.wparam = params->wparam;
884 params32.lparam = params->lparam;
885 params32.prev_unicode = params->prev_unicode;
886 params32.next_unicode = params->next_unicode;
887 memcpy( arg, &params32, FIELD_OFFSET( struct win_hook_params32, module ));
888 memmove( ((struct win_hook_params32 *)arg)->module, params->module,
889 (module_len + 1) * sizeof(WCHAR) );
891 if (size > offset)
893 size32 = (size32 + 15) & ~15;
894 offset = (offset + 15) & ~15;
895 size32 += hook_lparam_64to32( params32.id, params32.code, (char *)params + offset,
896 size - offset, (char *)arg + size32 );
899 ret = Wow64KiUserCallbackDispatcher( NtUserCallWindowsHook, arg, size32, &ret_ptr, &ret_len );
901 switch (params32.id)
903 case WH_SYSMSGFILTER:
904 case WH_MSGFILTER:
905 case WH_GETMESSAGE:
906 if (ret_len == sizeof(MSG32))
908 MSG msg;
909 msg_32to64( &msg, ret_ptr );
910 return NtCallbackReturn( &msg, sizeof(msg), ret );
914 return ret;
917 static NTSTATUS WINAPI wow64_NtUserCopyImage( void *arg, ULONG size )
919 struct copy_image_params *params = arg;
920 struct
922 ULONG hwnd;
923 UINT type;
924 INT dx;
925 INT dy;
926 UINT flags;
927 } params32;
929 params32.hwnd = HandleToUlong( params->hwnd );
930 params32.type = params->type;
931 params32.dx = params->dx;
932 params32.dy = params->dy;
933 params32.flags = params->flags;
934 return dispatch_callback( NtUserCopyImage, &params32, sizeof(params32) );
937 static NTSTATUS WINAPI wow64_NtUserDrawNonClientButton( void *arg, ULONG size )
939 struct draw_non_client_button_params *params = arg;
940 struct
942 ULONG hwnd;
943 ULONG hdc;
944 enum NONCLIENT_BUTTON_TYPE type;
945 RECT rect;
946 BOOL down;
947 BOOL grayed;
948 } params32;
950 params32.hwnd = HandleToUlong( params->hwnd );
951 params32.hdc = HandleToUlong( params->hdc );
952 params32.type = params->type;
953 params32.rect = params->rect;
954 params32.down = params->down;
955 params32.grayed = params->grayed;
956 return dispatch_callback( NtUserDrawNonClientButton, &params32, sizeof(params32) );
959 static NTSTATUS WINAPI wow64_NtUserDrawScrollBar( void *arg, ULONG size )
961 struct draw_scroll_bar_params *params = arg;
962 struct
964 ULONG hwnd;
965 ULONG hdc;
966 INT bar;
967 UINT hit_test;
968 struct
970 ULONG win;
971 INT bar;
972 INT thumb_pos;
973 INT thumb_val;
974 BOOL vertical;
975 enum SCROLL_HITTEST hit_test;
976 } tracking_info;
977 BOOL arrows;
978 BOOL interior;
979 RECT rect;
980 UINT enable_flags;
981 INT arrow_size;
982 INT thumb_pos;
983 INT thumb_size;
984 BOOL vertical;
985 } params32;
987 params32.hwnd = HandleToUlong( params->hwnd );
988 params32.hdc = HandleToUlong( params->hdc );
989 params32.bar = params->bar;
990 params32.hit_test = params->hit_test;
991 params32.tracking_info.win = HandleToUlong( params->tracking_info.win );
992 params32.tracking_info.bar = params->tracking_info.bar;
993 params32.tracking_info.thumb_pos = params->tracking_info.thumb_pos;
994 params32.tracking_info.thumb_val = params->tracking_info.thumb_val;
995 params32.tracking_info.vertical = params->tracking_info.vertical;
996 params32.tracking_info.hit_test = params->tracking_info.hit_test;
997 params32.arrows = params->arrows;
998 params32.interior = params->interior;
999 params32.rect = params->rect;
1000 params32.enable_flags = params->enable_flags;
1001 params32.arrow_size = params->arrow_size;
1002 params32.thumb_pos = params->thumb_pos;
1003 params32.thumb_size = params->thumb_size;
1004 params32.vertical = params->vertical;
1005 return dispatch_callback( NtUserDrawScrollBar, &params32, sizeof(params32) );
1008 static NTSTATUS WINAPI wow64_NtUserDrawText( void *arg, ULONG size )
1010 struct draw_text_params *params = arg;
1011 struct draw_text_params32 *params32;
1012 ULONG offset = offsetof( struct draw_text_params, str ) - offsetof( struct draw_text_params32, str );
1013 ULONG ret_len;
1014 void *ret_ptr;
1015 NTSTATUS ret;
1017 params32 = (struct draw_text_params32 *)((char *)params + offset);
1018 params32->flags = params->flags;
1019 params32->rect = params->rect;
1020 params32->count = params->count;
1021 params32->hdc = HandleToUlong( params->hdc );
1023 ret = Wow64KiUserCallbackDispatcher( NtUserDrawText, params32, size - offset, &ret_ptr, &ret_len );
1024 return NtCallbackReturn( ret_ptr, ret_len, ret );
1027 static NTSTATUS WINAPI wow64_NtUserFreeCachedClipboardData( void *arg, ULONG size )
1029 struct free_cached_data_params *params = arg;
1030 struct
1032 UINT format;
1033 ULONG handle;
1034 } params32;
1036 params32.format = params->format;
1037 params32.handle = HandleToUlong( params->handle );
1038 return dispatch_callback( NtUserFreeCachedClipboardData, &params32, sizeof(params32) );
1041 static NTSTATUS WINAPI wow64_NtUserImmProcessKey( void *arg, ULONG size )
1043 struct imm_process_key_params *params = arg;
1044 struct
1046 ULONG hwnd;
1047 ULONG hkl;
1048 UINT vkey;
1049 ULONG key_data;
1050 } params32;
1052 params32.hwnd = HandleToUlong( params->hwnd );
1053 params32.hkl = HandleToUlong( params->hkl );
1054 params32.vkey = params->vkey;
1055 params32.key_data = params->key_data;
1056 return dispatch_callback( NtUserImmProcessKey, &params32, sizeof(params32) );
1059 static NTSTATUS WINAPI wow64_NtUserImmTranslateMessage( void *arg, ULONG size )
1061 FIXME( "\n" );
1062 return 0;
1065 static NTSTATUS WINAPI wow64_NtUserInitBuiltinClasses( void *arg, ULONG size )
1067 return dispatch_callback( NtUserInitBuiltinClasses, arg, size );
1070 static NTSTATUS WINAPI wow64_NtUserLoadDriver( void *arg, ULONG size )
1072 return dispatch_callback( NtUserLoadDriver, arg, size );
1075 static NTSTATUS WINAPI wow64_NtUserLoadImage( void *arg, ULONG size )
1077 struct load_image_params *params = arg;
1078 struct
1080 ULONG hinst;
1081 ULONG name;
1082 UINT type;
1083 INT dx;
1084 INT dy;
1085 UINT flags;
1086 } params32;
1088 params32.hinst = PtrToUlong( params->hinst );
1089 params32.name = PtrToUlong( params->name );
1090 params32.type = params->type;
1091 params32.dx = params->dx;
1092 params32.dy = params->dy;
1093 params32.flags = params->flags;
1094 return dispatch_callback( NtUserLoadImage, &params32, sizeof(params32) );
1097 static NTSTATUS WINAPI wow64_NtUserLoadSysMenu( void *arg, ULONG size )
1099 return dispatch_callback( NtUserLoadSysMenu, arg, size );
1102 static NTSTATUS WINAPI wow64_NtUserPostDDEMessage( void *arg, ULONG size )
1104 struct post_dde_message_params *params = arg;
1105 struct
1107 ULONG hwnd;
1108 UINT msg;
1109 LONG wparam;
1110 LONG lparam;
1111 DWORD dest_tid;
1112 DWORD type;
1113 } params32;
1115 params32.hwnd = HandleToUlong( params->hwnd );
1116 params32.msg = params->msg;
1117 params32.wparam = params->wparam;
1118 params32.lparam = params->lparam;
1119 params32.dest_tid = params->dest_tid;
1120 params32.type = params->type;
1121 return dispatch_callback( NtUserPostDDEMessage, &params32, sizeof(params32) );
1124 static NTSTATUS WINAPI wow64_NtUserRenderSynthesizedFormat( void *arg, ULONG size )
1126 return dispatch_callback( NtUserRenderSynthesizedFormat, arg, size );
1129 static NTSTATUS WINAPI wow64_NtUserUnpackDDEMessage( void *arg, ULONG size )
1131 struct unpack_dde_message_params *params = arg;
1132 struct unpack_dde_message_params32 *params32;
1133 struct unpack_dde_message_result result;
1134 struct
1136 LONG wparam;
1137 LONG lparam;
1138 } *result32;
1139 void *ret_ptr;
1140 ULONG ret_len;
1142 size -= FIELD_OFFSET( struct unpack_dde_message_params, data );
1143 if (!(params32 = Wow64AllocateTemp( FIELD_OFFSET( struct unpack_dde_message_params32, data[size] ))))
1144 return 0;
1146 params32->result = 0;
1147 params32->hwnd = HandleToUlong( params->hwnd );
1148 params32->message = params->message;
1149 params32->wparam = params->wparam;
1150 params32->lparam = params->lparam;
1151 if (size) memcpy( params32->data, params->data, size );
1152 size = FIELD_OFFSET( struct unpack_dde_message_params32, data[size] );
1154 if (!Wow64KiUserCallbackDispatcher( NtUserUnpackDDEMessage, params32, size, &ret_ptr, &ret_len ))
1155 return FALSE;
1156 if (ret_len == sizeof(*result32))
1158 result32 = ret_ptr;
1159 result.wparam = result32->wparam;
1160 result.lparam = result32->lparam;
1163 if (!params->result) NtCallbackReturn( &result, sizeof(result), TRUE );
1164 *params->result = result;
1165 return TRUE;
1168 static NTSTATUS WINAPI wow64_NtUserCallFreeIcon( void *arg, ULONG size )
1170 return dispatch_callback( NtUserCallFreeIcon, arg, size );
1173 static NTSTATUS WINAPI wow64_NtUserThunkLock( void *arg, ULONG size )
1175 return dispatch_callback( NtUserThunkLock, arg, size );
1178 static NTSTATUS WINAPI wow64_NtUserCallVulkanDebugReportCallback( void *arg, ULONG size )
1180 FIXME( "\n" );
1181 return 0;
1184 static NTSTATUS WINAPI wow64_NtUserCallVulkanDebugUtilsCallback( void *arg, ULONG size )
1186 FIXME( "\n" );
1187 return 0;
1190 static NTSTATUS WINAPI wow64_NtUserCallOpenGLDebugMessageCallback( void *arg, ULONG size )
1192 FIXME( "\n" );
1193 return 0;
1196 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst0( void *arg, ULONG size )
1198 return dispatch_callback( NtUserDriverCallbackFirst + 0, arg, size );
1201 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst1( void *arg, ULONG size )
1203 return dispatch_callback( NtUserDriverCallbackFirst + 1, arg, size );
1206 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst2( void *arg, ULONG size )
1208 return dispatch_callback( NtUserDriverCallbackFirst + 2, arg, size );
1211 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst3( void *arg, ULONG size )
1213 return dispatch_callback( NtUserDriverCallbackFirst + 3, arg, size );
1216 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst4( void *arg, ULONG size )
1218 return dispatch_callback( NtUserDriverCallbackFirst + 4, arg, size );
1221 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst5( void *arg, ULONG size )
1223 return dispatch_callback( NtUserDriverCallbackFirst + 5, arg, size );
1226 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst6( void *arg, ULONG size )
1228 return dispatch_callback( NtUserDriverCallbackFirst + 6, arg, size );
1231 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst7( void *arg, ULONG size )
1233 return dispatch_callback( NtUserDriverCallbackFirst + 7, arg, size );
1236 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst8( void *arg, ULONG size )
1238 return dispatch_callback( NtUserDriverCallbackFirst + 8, arg, size );
1241 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst9( void *arg, ULONG size )
1243 return dispatch_callback( NtUserDriverCallbackFirst + 9, arg, size );
1246 user_callback user_callbacks[] =
1248 /* user32 callbacks */
1249 wow64_NtUserCallEnumDisplayMonitor,
1250 wow64_NtUserCallSendAsyncCallback,
1251 wow64_NtUserCallWinEventHook,
1252 wow64_NtUserCallWinProc,
1253 wow64_NtUserCallWindowsHook,
1254 wow64_NtUserCopyImage,
1255 wow64_NtUserDrawNonClientButton,
1256 wow64_NtUserDrawScrollBar,
1257 wow64_NtUserDrawText,
1258 wow64_NtUserFreeCachedClipboardData,
1259 wow64_NtUserImmProcessKey,
1260 wow64_NtUserImmTranslateMessage,
1261 wow64_NtUserInitBuiltinClasses,
1262 wow64_NtUserLoadDriver,
1263 wow64_NtUserLoadImage,
1264 wow64_NtUserLoadSysMenu,
1265 wow64_NtUserPostDDEMessage,
1266 wow64_NtUserRenderSynthesizedFormat,
1267 wow64_NtUserUnpackDDEMessage,
1268 /* win16 hooks */
1269 wow64_NtUserCallFreeIcon,
1270 wow64_NtUserThunkLock,
1271 /* Vulkan support */
1272 wow64_NtUserCallVulkanDebugReportCallback,
1273 wow64_NtUserCallVulkanDebugUtilsCallback,
1274 /* OpenGL support */
1275 wow64_NtUserCallOpenGLDebugMessageCallback,
1276 /* Driver-specific callbacks */
1277 wow64_NtUserDriverCallbackFirst0,
1278 wow64_NtUserDriverCallbackFirst1,
1279 wow64_NtUserDriverCallbackFirst2,
1280 wow64_NtUserDriverCallbackFirst3,
1281 wow64_NtUserDriverCallbackFirst4,
1282 wow64_NtUserDriverCallbackFirst5,
1283 wow64_NtUserDriverCallbackFirst6,
1284 wow64_NtUserDriverCallbackFirst7,
1285 wow64_NtUserDriverCallbackFirst8,
1286 wow64_NtUserDriverCallbackFirst9,
1289 C_ASSERT( ARRAYSIZE(user_callbacks) == NtUserCallCount );
1291 NTSTATUS WINAPI wow64_NtUserActivateKeyboardLayout( UINT *args )
1293 HKL layout = get_handle( &args );
1294 UINT flags = get_ulong( &args );
1296 return HandleToUlong( NtUserActivateKeyboardLayout( layout, flags ));
1299 NTSTATUS WINAPI wow64_NtUserAddClipboardFormatListener( UINT *args )
1301 HWND hwnd = get_handle( &args );
1303 return NtUserAddClipboardFormatListener( hwnd );
1306 NTSTATUS WINAPI wow64_NtUserAssociateInputContext( UINT *args )
1308 HWND hwnd = get_handle( &args );
1309 HIMC ctx = get_handle( &args );
1310 ULONG flags = get_ulong( &args );
1312 return NtUserAssociateInputContext( hwnd, ctx, flags );
1315 NTSTATUS WINAPI wow64_NtUserAttachThreadInput( UINT *args )
1317 DWORD from = get_ulong( &args );
1318 DWORD to = get_ulong( &args );
1319 BOOL attach = get_ulong( &args );
1321 return NtUserAttachThreadInput( from, to, attach );
1324 NTSTATUS WINAPI wow64_NtUserBeginPaint( UINT *args )
1326 HWND hwnd = get_handle( &args );
1327 PAINTSTRUCT32 *ps32 = get_ptr( &args );
1329 PAINTSTRUCT ps;
1330 HDC ret;
1332 ret = NtUserBeginPaint( hwnd, ps32 ? & ps : NULL );
1333 if (ret && ps32)
1335 ps32->hdc = HandleToUlong( ps.hdc );
1336 ps32->fErase = ps.fErase;
1337 ps32->rcPaint = ps.rcPaint;
1339 return HandleToUlong( ret );
1342 NTSTATUS WINAPI wow64_NtUserBuildHimcList( UINT *args )
1344 ULONG thread_id = get_ulong( &args );
1345 ULONG count = get_ulong( &args );
1346 UINT32 *buffer32 = get_ptr( &args );
1347 UINT *size = get_ptr( &args );
1349 HIMC *buffer = NULL;
1350 ULONG i;
1351 NTSTATUS status;
1353 if (buffer32 && !(buffer = Wow64AllocateTemp( count * sizeof(*buffer) )))
1354 return STATUS_NO_MEMORY;
1356 if ((status = NtUserBuildHimcList( thread_id, count, buffer, size ))) return status;
1358 for (i = 0; i < *size; i++) buffer32[i] = HandleToUlong( buffer[i] );
1359 return status;
1362 NTSTATUS WINAPI wow64_NtUserBuildHwndList( UINT *args )
1364 HDESK desktop = get_handle( &args );
1365 ULONG unk2 = get_ulong( &args );
1366 ULONG unk3 = get_ulong( &args );
1367 ULONG unk4 = get_ulong( &args );
1368 ULONG thread_id = get_ulong( &args );
1369 ULONG count = get_ulong( &args );
1370 UINT32 *buffer32 = get_ptr( &args );
1371 ULONG *size = get_ptr( &args );
1373 HWND *buffer;
1374 ULONG i;
1375 NTSTATUS status;
1377 if (!(buffer = Wow64AllocateTemp( count * sizeof(*buffer) ))) return STATUS_NO_MEMORY;
1379 if ((status = NtUserBuildHwndList( desktop, unk2, unk3, unk4, thread_id, count, buffer, size )))
1380 return status;
1382 for (i = 0; i < *size; i++)
1383 buffer32[i] = HandleToUlong( buffer[i] );
1384 return status;
1387 NTSTATUS WINAPI wow64_NtUserCallHwnd( UINT *args )
1389 HWND hwnd = get_handle( &args );
1390 DWORD code = get_ulong( &args );
1392 return NtUserCallHwnd( hwnd, code );
1395 NTSTATUS WINAPI wow64_NtUserCallHwndParam( UINT *args )
1397 HWND hwnd = get_handle( &args );
1398 DWORD_PTR param = get_ulong( &args );
1399 DWORD code = get_ulong( &args );
1401 switch (code)
1403 case NtUserCallHwndParam_GetScrollInfo:
1405 struct
1407 int bar;
1408 ULONG info;
1409 } *info32 = UlongToPtr( param );
1410 struct get_scroll_info_params info;
1412 info.bar = info32->bar;
1413 info.info = UlongToPtr( info32->info );
1414 return NtUserCallHwndParam( hwnd, (UINT_PTR)&info, code );
1417 case NtUserCallHwndParam_MapWindowPoints:
1419 struct
1421 ULONG hwnd_to;
1422 ULONG points;
1423 UINT count;
1424 } *params32 = UlongToPtr( param );
1425 struct map_window_points_params params;
1427 params.hwnd_to = LongToHandle( params32->hwnd_to );
1428 params.points = UlongToPtr( params32->points );
1429 params.count = params32->count;
1430 return NtUserCallHwndParam( hwnd, (UINT_PTR)&params, code );
1433 default:
1434 return NtUserCallHwndParam( hwnd, param, code );
1438 NTSTATUS WINAPI wow64_NtUserCallMsgFilter( UINT *args )
1440 MSG32 *msg32 = get_ptr( &args );
1441 INT code = get_ulong( &args );
1442 MSG msg;
1443 BOOL ret;
1445 ret = NtUserCallMsgFilter( msg_32to64( &msg, msg32 ), code );
1446 msg_64to32( &msg, msg32 );
1447 return ret;
1450 NTSTATUS WINAPI wow64_NtUserCallNextHookEx( UINT *args )
1452 HHOOK hhook = get_handle( &args );
1453 INT code = get_ulong( &args );
1454 WPARAM wparam = get_ulong( &args );
1455 LPARAM lparam = get_ulong( &args );
1457 return NtUserCallNextHookEx( hhook, code, wparam, lparam );
1460 NTSTATUS WINAPI wow64_NtUserCallNoParam( UINT *args )
1462 ULONG code = get_ulong( &args );
1464 return NtUserCallNoParam( code );
1467 NTSTATUS WINAPI wow64_NtUserCallOneParam( UINT *args )
1469 ULONG_PTR arg = get_ulong( &args );
1470 ULONG code = get_ulong( &args );
1472 return NtUserCallOneParam( arg, code );
1475 NTSTATUS WINAPI wow64_NtUserCallTwoParam( UINT *args )
1477 ULONG_PTR arg1 = get_ulong( &args );
1478 ULONG_PTR arg2 = get_ulong( &args );
1479 ULONG code = get_ulong( &args );
1481 switch (code)
1483 case NtUserCallTwoParam_GetMenuInfo:
1485 MENUINFO32 *info32 = UlongToPtr( arg2 );
1486 MENUINFO info;
1488 if (!info32 || info32->cbSize != sizeof(*info32))
1490 set_last_error32( ERROR_INVALID_PARAMETER );
1491 return FALSE;
1494 info.cbSize = sizeof(info);
1495 info.fMask = info32->fMask;
1496 if (!NtUserCallTwoParam( arg1, (UINT_PTR)&info, code )) return FALSE;
1497 if (info.fMask & MIM_BACKGROUND) info32->hbrBack = HandleToUlong( info.hbrBack );
1498 if (info.fMask & MIM_HELPID) info32->dwContextHelpID = info.dwContextHelpID;
1499 if (info.fMask & MIM_MAXHEIGHT) info32->cyMax = info.cyMax;
1500 if (info.fMask & MIM_MENUDATA) info32->dwMenuData = info.dwMenuData;
1501 if (info.fMask & MIM_STYLE) info32->dwStyle = info.dwStyle;
1502 return TRUE;
1505 default:
1506 return NtUserCallTwoParam( arg1, arg2, code );
1510 NTSTATUS WINAPI wow64_NtUserChangeClipboardChain( UINT *args )
1512 HWND hwnd = get_handle( &args );
1513 HWND next = get_handle( &args );
1515 return NtUserChangeClipboardChain( hwnd, next );
1518 NTSTATUS WINAPI wow64_NtUserChangeDisplaySettings( UINT *args )
1520 UNICODE_STRING32 *devname32 = get_ptr( &args );
1521 DEVMODEW *devmode = get_ptr( &args );
1522 HWND hwnd = get_handle( &args );
1523 DWORD flags = get_ulong( &args );
1524 void *lparam = get_ptr( &args );
1526 UNICODE_STRING devname;
1528 return NtUserChangeDisplaySettings( unicode_str_32to64( &devname, devname32 ),
1529 devmode, hwnd, flags, lparam );
1532 NTSTATUS WINAPI wow64_NtUserCheckMenuItem( UINT *args )
1534 HMENU handle = get_handle( &args );
1535 UINT id = get_ulong( &args );
1536 UINT flags = get_ulong( &args );
1538 return NtUserCheckMenuItem( handle, id, flags );
1541 NTSTATUS WINAPI wow64_NtUserChildWindowFromPointEx( UINT *args )
1543 HWND parent = get_handle( &args );
1544 LONG x = get_ulong( &args );
1545 LONG y = get_ulong( &args );
1546 UINT flags = get_ulong( &args );
1548 return HandleToUlong( NtUserChildWindowFromPointEx( parent, x, y, flags ));
1551 NTSTATUS WINAPI wow64_NtUserClipCursor( UINT *args )
1553 const RECT *rect = get_ptr( &args );
1555 return NtUserClipCursor( rect );
1558 NTSTATUS WINAPI wow64_NtUserCloseClipboard( UINT *args )
1560 return NtUserCloseClipboard();
1563 NTSTATUS WINAPI wow64_NtUserCloseDesktop( UINT *args )
1565 HDESK handle = get_handle( &args );
1567 return NtUserCloseDesktop( handle );
1570 NTSTATUS WINAPI wow64_NtUserCloseWindowStation( UINT *args )
1572 HWINSTA handle = get_handle( &args );
1574 return NtUserCloseWindowStation( handle );
1577 NTSTATUS WINAPI wow64_NtUserCopyAcceleratorTable( UINT *args )
1579 HACCEL src = get_handle( &args );
1580 ACCEL *dst = get_ptr( &args );
1581 INT count = get_ulong( &args );
1583 return NtUserCopyAcceleratorTable( src, dst, count );
1586 NTSTATUS WINAPI wow64_NtUserCountClipboardFormats( UINT *args )
1588 return NtUserCountClipboardFormats();
1591 NTSTATUS WINAPI wow64_NtUserCreateAcceleratorTable( UINT *args )
1593 ACCEL *table = get_ptr( &args );
1594 INT count = get_ulong( &args );
1596 return HandleToUlong( NtUserCreateAcceleratorTable( table, count ));
1599 NTSTATUS WINAPI wow64_NtUserCreateCaret( UINT *args )
1601 HWND hwnd = get_handle( &args );
1602 HBITMAP bitmap = get_handle( &args );
1603 int width = get_ulong( &args );
1604 int height = get_ulong( &args );
1606 return NtUserCreateCaret( hwnd, bitmap, width, height );
1609 NTSTATUS WINAPI wow64_NtUserCreateDesktopEx( UINT *args )
1611 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
1612 UNICODE_STRING32 *device32 = get_ptr( &args );
1613 DEVMODEW *devmode = get_ptr( &args );
1614 DWORD flags = get_ulong( &args );
1615 ACCESS_MASK access = get_ulong( &args );
1616 ULONG heap_size = get_ulong( &args );
1618 struct object_attr64 attr;
1619 UNICODE_STRING device;
1620 HANDLE ret;
1622 ret = NtUserCreateDesktopEx( objattr_32to64( &attr, attr32 ),
1623 unicode_str_32to64( &device, device32 ),
1624 devmode, flags, access, heap_size );
1625 return HandleToUlong( ret );
1628 NTSTATUS WINAPI wow64_NtUserCreateInputContext( UINT *args )
1630 UINT_PTR client_ptr = get_ulong( &args );
1632 return HandleToUlong( NtUserCreateInputContext( client_ptr ));
1635 NTSTATUS WINAPI wow64_NtUserCreateWindowEx( UINT *args )
1637 DWORD ex_style = get_ulong( &args );
1638 UNICODE_STRING32 *class_name32 = get_ptr( &args );
1639 UNICODE_STRING32 *version32 = get_ptr( &args );
1640 UNICODE_STRING32 *window_name32 = get_ptr( &args );
1641 DWORD style = get_ulong( &args );
1642 int x = get_ulong( &args );
1643 int y = get_ulong( &args );
1644 int width = get_ulong( &args );
1645 int height = get_ulong( &args );
1646 HWND parent = get_handle( &args );
1647 HMENU menu = get_handle( &args );
1648 HINSTANCE instance = get_ptr( &args );
1649 void *params = get_ptr( &args );
1650 DWORD flags = get_ulong( &args );
1651 HINSTANCE client_instance = get_ptr( &args );
1652 DWORD unk = get_ulong( &args );
1653 BOOL ansi = get_ulong( &args );
1655 UNICODE_STRING class_name, version, window_name;
1656 HWND ret;
1658 ret = NtUserCreateWindowEx( ex_style,
1659 unicode_str_32to64( &class_name, class_name32),
1660 unicode_str_32to64( &version, version32 ),
1661 unicode_str_32to64( &window_name, window_name32 ),
1662 style, x, y, width, height, parent, menu,
1663 instance, params, flags, client_instance, unk, ansi );
1664 return HandleToUlong( ret );
1667 NTSTATUS WINAPI wow64_NtUserCreateWindowStation( UINT *args )
1669 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
1670 ACCESS_MASK access = get_ulong( &args );
1671 ULONG arg3 = get_ulong( &args );
1672 ULONG arg4 = get_ulong( &args );
1673 ULONG arg5 = get_ulong( &args );
1674 ULONG arg6 = get_ulong( &args );
1675 ULONG arg7 = get_ulong( &args );
1677 struct object_attr64 attr;
1679 return HandleToUlong( NtUserCreateWindowStation( objattr_32to64( &attr, attr32 ), access,
1680 arg3, arg4, arg5, arg6, arg7 ));
1683 NTSTATUS WINAPI wow64_NtUserDeferWindowPosAndBand( UINT *args )
1685 HDWP hdwp = get_handle( &args );
1686 HWND hwnd = get_handle( &args );
1687 HWND after = get_handle( &args );
1688 INT x = get_ulong( &args );
1689 INT y = get_ulong( &args );
1690 INT cx = get_ulong( &args );
1691 INT cy = get_ulong( &args );
1692 UINT flags = get_ulong( &args );
1693 UINT unk1 = get_ulong( &args );
1694 UINT unk2 = get_ulong( &args );
1696 HDWP ret = NtUserDeferWindowPosAndBand( hdwp, hwnd, after, x, y, cx, cy, flags, unk1, unk2 );
1697 return HandleToUlong( ret );
1700 NTSTATUS WINAPI wow64_NtUserDeleteMenu( UINT *args )
1702 HMENU menu = get_handle( &args );
1703 UINT id = get_ulong( &args );
1704 UINT flags = get_ulong( &args );
1706 return NtUserDeleteMenu( menu, id, flags );
1709 NTSTATUS WINAPI wow64_NtUserDestroyAcceleratorTable( UINT *args )
1711 HACCEL handle = get_handle( &args );
1713 return NtUserDestroyAcceleratorTable( handle );
1716 NTSTATUS WINAPI wow64_NtUserDestroyCursor( UINT *args )
1718 HCURSOR cursor = get_handle( &args );
1719 ULONG arg = get_ulong( &args );
1721 return NtUserDestroyCursor( cursor, arg );
1724 NTSTATUS WINAPI wow64_NtUserDestroyInputContext( UINT *args )
1726 HIMC handle = get_handle( &args );
1728 return NtUserDestroyInputContext( handle );
1731 NTSTATUS WINAPI wow64_NtUserDestroyMenu( UINT *args )
1733 HMENU handle = get_handle( &args );
1735 return NtUserDestroyMenu( handle );
1738 NTSTATUS WINAPI wow64_NtUserDestroyWindow( UINT *args )
1740 HWND hwnd = get_handle( &args );
1742 return NtUserDestroyWindow( hwnd );
1745 NTSTATUS WINAPI wow64_NtUserDisableThreadIme( UINT *args )
1747 DWORD thread_id = get_ulong( &args );
1749 return NtUserDisableThreadIme( thread_id );
1752 NTSTATUS WINAPI wow64_NtUserDispatchMessage( UINT *args )
1754 const MSG32 *msg32 = get_ptr( &args );
1755 MSG msg;
1757 return NtUserDispatchMessage( msg_32to64( &msg, msg32 ));
1760 NTSTATUS WINAPI wow64_NtUserDragDetect( UINT *args )
1762 HWND hwnd = get_handle( &args );
1763 int x = get_ulong( &args );
1764 int y = get_ulong( &args );
1766 return NtUserDragDetect( hwnd, x, y );
1769 NTSTATUS WINAPI wow64_NtUserDragObject( UINT *args )
1771 HWND parent = get_handle( &args );
1772 HWND hwnd = get_handle( &args );
1773 UINT fmt = get_ulong( &args );
1774 ULONG_PTR data = get_ulong( &args );
1775 HCURSOR hcursor = get_handle( &args );
1777 return NtUserDragObject( parent, hwnd, fmt, data, hcursor );
1780 NTSTATUS WINAPI wow64_NtUserDrawCaptionTemp( UINT *args )
1782 HWND hwnd = get_handle( &args );
1783 HDC hdc = get_handle( &args );
1784 const RECT *rect = get_ptr( &args );
1785 HFONT font = get_handle( &args );
1786 HICON icon = get_handle( &args );
1787 const WCHAR *str = get_ptr( &args );
1788 UINT flags = get_ulong( &args );
1790 return NtUserDrawCaptionTemp( hwnd, hdc, rect, font, icon, str, flags );
1793 NTSTATUS WINAPI wow64_NtUserDrawIconEx( UINT *args )
1795 HDC hdc = get_handle( &args );
1796 int x0 = get_ulong( &args );
1797 int y0 = get_ulong( &args );
1798 HICON icon = get_handle( &args );
1799 int width = get_ulong( &args );
1800 int height = get_ulong( &args );
1801 UINT istep = get_ulong( &args );
1802 HBRUSH hbr = get_handle( &args );
1803 UINT flags = get_ulong( &args );
1805 return NtUserDrawIconEx( hdc, x0, y0, icon, width, height, istep, hbr, flags );
1808 NTSTATUS WINAPI wow64_NtUserDrawMenuBarTemp( UINT *args )
1810 HWND hwnd = get_handle( &args );
1811 HDC hdc = get_handle( &args );
1812 RECT *rect = get_ptr( &args );
1813 HMENU handle = get_handle( &args );
1814 HFONT font = get_handle( &args );
1816 return NtUserDrawMenuBarTemp( hwnd, hdc, rect, handle, font );
1819 NTSTATUS WINAPI wow64_NtUserEmptyClipboard( UINT *args )
1821 return NtUserEmptyClipboard();
1824 NTSTATUS WINAPI wow64_NtUserEnableMenuItem( UINT *args )
1826 HMENU handle = get_handle( &args );
1827 UINT id = get_ulong( &args );
1828 UINT flags = get_ulong( &args );
1830 return NtUserEnableMenuItem( handle, id, flags );
1833 NTSTATUS WINAPI wow64_NtUserEnableMouseInPointer( UINT *args )
1835 UINT enable = get_ulong( &args );
1837 return NtUserEnableMouseInPointer( enable );
1840 NTSTATUS WINAPI wow64_NtUserEnableScrollBar( UINT *args )
1842 HWND hwnd = get_handle( &args );
1843 UINT bar = get_ulong( &args );
1844 UINT flags = get_ulong( &args );
1846 return NtUserEnableScrollBar( hwnd, bar, flags );
1849 NTSTATUS WINAPI wow64_NtUserEndDeferWindowPosEx( UINT *args )
1851 HDWP hdwp = get_handle( &args );
1852 BOOL async = get_ulong( &args );
1854 return NtUserEndDeferWindowPosEx( hdwp, async );
1857 NTSTATUS WINAPI wow64_NtUserEndMenu( UINT *args )
1859 return NtUserEndMenu();
1862 NTSTATUS WINAPI wow64_NtUserEndPaint( UINT *args )
1864 HWND hwnd = get_handle( &args );
1865 const PAINTSTRUCT32 *ps32 = get_ptr( &args );
1866 PAINTSTRUCT ps;
1868 return NtUserEndPaint( hwnd, paintstruct_32to64( &ps, ps32 ));
1871 NTSTATUS WINAPI wow64_NtUserEnumDisplayDevices( UINT *args )
1873 UNICODE_STRING32 *device32 = get_ptr( &args );
1874 DWORD index = get_ulong( &args );
1875 DISPLAY_DEVICEW *info = get_ptr( &args );
1876 DWORD flags = get_ulong( &args );
1878 UNICODE_STRING device;
1880 return NtUserEnumDisplayDevices( unicode_str_32to64( &device, device32 ), index, info, flags );
1883 NTSTATUS WINAPI wow64_NtUserEnumDisplayMonitors( UINT *args )
1885 HDC hdc = get_handle( &args );
1886 RECT *rect = get_ptr( &args );
1887 MONITORENUMPROC proc = get_ptr( &args );
1888 LPARAM lp = get_ulong( &args );
1890 return NtUserEnumDisplayMonitors( hdc, rect, proc, lp );
1893 NTSTATUS WINAPI wow64_NtUserEnumDisplaySettings( UINT *args )
1895 UNICODE_STRING32 *device32 = get_ptr( &args );
1896 DWORD mode = get_ulong( &args );
1897 DEVMODEW *dev_mode = get_ptr( &args );
1898 DWORD flags = get_ulong( &args );
1900 UNICODE_STRING device;
1902 return NtUserEnumDisplaySettings( unicode_str_32to64( &device, device32 ),
1903 mode, dev_mode, flags );
1906 NTSTATUS WINAPI wow64_NtUserExcludeUpdateRgn( UINT *args )
1908 HDC hdc = get_handle( &args );
1909 HWND hwnd = get_handle( &args );
1911 return NtUserExcludeUpdateRgn( hdc, hwnd );
1914 NTSTATUS WINAPI wow64_NtUserFindExistingCursorIcon( UINT *args )
1916 UNICODE_STRING32 *module32 = get_ptr( &args );
1917 UNICODE_STRING32 *res_name32 = get_ptr( &args );
1918 void *desc = get_ptr( &args );
1920 UNICODE_STRING module;
1921 UNICODE_STRING res_name;
1922 HICON ret;
1924 ret = NtUserFindExistingCursorIcon( unicode_str_32to64( &module, module32 ),
1925 unicode_str_32to64( &res_name, res_name32 ), desc );
1926 return HandleToUlong( ret );
1929 NTSTATUS WINAPI wow64_NtUserFindWindowEx( UINT *args )
1931 HWND parent = get_handle( &args );
1932 HWND child = get_handle( &args );
1933 UNICODE_STRING32 *class32 = get_ptr( &args );
1934 UNICODE_STRING32 *title32 = get_ptr( &args );
1935 ULONG unk = get_ulong( &args );
1937 UNICODE_STRING class, title;
1938 HWND ret;
1940 ret = NtUserFindWindowEx( parent, child, unicode_str_32to64( &class, class32 ),
1941 unicode_str_32to64( &title, title32 ), unk );
1942 return HandleToUlong( ret );
1945 NTSTATUS WINAPI wow64_NtUserFlashWindowEx( UINT *args )
1947 struct
1949 UINT cbSize;
1950 ULONG hwnd;
1951 DWORD dwFlags;
1952 UINT uCount;
1953 DWORD dwTimeout;
1954 } *info32 = get_ptr( &args );
1956 FLASHWINFO info;
1958 if (!info32)
1960 set_last_error32( ERROR_NOACCESS );
1961 return FALSE;
1964 if (info32->cbSize != sizeof(*info32))
1966 set_last_error32( ERROR_INVALID_PARAMETER );
1967 return FALSE;
1970 info.cbSize = sizeof(info);
1971 info.hwnd = LongToHandle( info32->hwnd );
1972 info.dwFlags = info32->dwFlags;
1973 info.uCount = info32->uCount;
1974 info.dwTimeout = info32->dwTimeout;
1975 return NtUserFlashWindowEx( &info );
1978 NTSTATUS WINAPI wow64_NtUserGetAncestor( UINT *args )
1980 HWND hwnd = get_handle( &args );
1981 UINT type = get_ulong( &args );
1983 return HandleToUlong( NtUserGetAncestor( hwnd, type ));
1986 NTSTATUS WINAPI wow64_NtUserGetAsyncKeyState( UINT *args )
1988 INT key = get_ulong( &args );
1990 return NtUserGetAsyncKeyState( key );
1993 NTSTATUS WINAPI wow64_NtUserGetAtomName( UINT *args )
1995 ATOM atom = get_ulong( &args );
1996 UNICODE_STRING32 *str32 = get_ptr( &args );
1998 UNICODE_STRING str;
2000 return NtUserGetAtomName( atom, unicode_str_32to64( &str, str32 ));
2003 NTSTATUS WINAPI wow64_NtUserGetCaretBlinkTime( UINT *args )
2005 return NtUserGetCaretBlinkTime();
2008 NTSTATUS WINAPI wow64_NtUserGetCaretPos( UINT *args )
2010 POINT *pt = get_ptr( &args );
2012 return NtUserGetCaretPos( pt );
2015 NTSTATUS WINAPI wow64_NtUserGetClassInfoEx( UINT *args )
2017 HINSTANCE instance = get_ptr( &args );
2018 UNICODE_STRING32 *name32 = get_ptr( &args );
2019 WNDCLASSEXW32 *wc32 = get_ptr( &args );
2020 struct client_menu_name32 *client_name32 = get_ptr( &args );
2021 BOOL ansi = get_ulong( &args );
2023 struct client_menu_name client_name;
2024 UNICODE_STRING name;
2025 WNDCLASSEXW wc;
2026 ATOM ret;
2028 wc.cbSize = sizeof(wc);
2029 if (!(ret = NtUserGetClassInfoEx( instance, unicode_str_32to64( &name, name32 ), &wc,
2030 &client_name, ansi )))
2031 return 0;
2033 wc32->style = wc.style;
2034 wc32->lpfnWndProc = PtrToUlong( wc.lpfnWndProc );
2035 wc32->cbClsExtra = wc.cbClsExtra;
2036 wc32->cbWndExtra = wc.cbWndExtra;
2037 wc32->hInstance = PtrToUlong( wc.hInstance );
2038 wc32->hIcon = HandleToUlong( wc.hIcon );
2039 wc32->hCursor = HandleToUlong( wc.hCursor );
2040 wc32->hbrBackground = HandleToUlong( wc.hbrBackground );
2041 wc32->lpszMenuName = PtrToUlong( wc.lpszMenuName );
2042 wc32->lpszClassName = PtrToUlong( wc.lpszClassName );
2043 wc32->hIconSm = HandleToUlong( wc.hIconSm );
2044 client_menu_name_64to32( &client_name, client_name32 );
2045 return ret;
2048 NTSTATUS WINAPI wow64_NtUserGetClassName( UINT *args )
2050 HWND hwnd = get_handle( &args );
2051 BOOL real = get_ulong( &args );
2052 UNICODE_STRING32 *str32 = get_ptr( &args );
2054 UNICODE_STRING str;
2056 return NtUserGetClassName( hwnd, real, unicode_str_32to64( &str, str32 ));
2059 NTSTATUS WINAPI wow64_NtUserGetClipboardData( UINT *args )
2061 UINT format = get_ulong( &args );
2062 struct
2064 UINT32 data;
2065 UINT32 size;
2066 UINT32 data_size;
2067 UINT seqno;
2068 BOOL data_only;
2069 } *params32 = get_ptr( &args );
2071 struct get_clipboard_params params;
2072 HANDLE ret;
2074 params.data = UlongToPtr( params32->data );
2075 params.size = params32->size;
2076 params.data_size = params32->data_size;
2077 params.data_only = params32->data_only;
2079 ret = NtUserGetClipboardData( format, &params );
2081 params32->size = params.size;
2082 params32->data_size = params.data_size;
2083 params32->seqno = params.seqno;
2084 return HandleToUlong( ret );
2087 NTSTATUS WINAPI wow64_NtUserGetClipboardFormatName( UINT *args )
2089 UINT format = get_ulong( &args );
2090 WCHAR *buffer = get_ptr( &args );
2091 INT maxlen = get_ulong( &args );
2093 return NtUserGetClipboardFormatName( format, buffer, maxlen );
2096 NTSTATUS WINAPI wow64_NtUserGetClipboardOwner( UINT *args )
2098 return HandleToUlong( NtUserGetClipboardOwner() );
2101 NTSTATUS WINAPI wow64_NtUserGetClipboardSequenceNumber( UINT *args )
2103 return NtUserGetClipboardSequenceNumber();
2106 NTSTATUS WINAPI wow64_NtUserGetClipboardViewer( UINT *args )
2108 return HandleToUlong( NtUserGetClipboardViewer() );
2111 NTSTATUS WINAPI wow64_NtUserGetCursor( UINT *args )
2113 return HandleToUlong( NtUserGetCursor() );
2116 NTSTATUS WINAPI wow64_NtUserGetCursorFrameInfo( UINT *args )
2118 HCURSOR cursor = get_ptr( &args );
2119 DWORD istep = get_ulong( &args );
2120 DWORD *rate_jiffies = get_ptr( &args );
2121 DWORD *num_steps = get_ptr( &args );
2123 return HandleToUlong( NtUserGetCursorFrameInfo( cursor, istep, rate_jiffies, num_steps ));
2126 NTSTATUS WINAPI wow64_NtUserGetCursorInfo( UINT *args )
2128 struct
2130 DWORD cbSize;
2131 DWORD flags;
2132 ULONG hCursor;
2133 POINT ptScreenPos;
2134 } *info32 = get_ptr( &args );
2135 CURSORINFO info;
2137 if (!info32) return FALSE;
2138 info.cbSize = sizeof(info);
2139 if (!NtUserGetCursorInfo( &info )) return FALSE;
2140 info32->flags = info.flags;
2141 info32->hCursor = HandleToUlong( info.hCursor );
2142 info32->ptScreenPos = info.ptScreenPos;
2143 return TRUE;
2146 NTSTATUS WINAPI wow64_NtUserGetDC( UINT *args )
2148 HWND hwnd = get_handle( &args );
2150 return HandleToUlong( NtUserGetDC( hwnd ));
2153 NTSTATUS WINAPI wow64_NtUserGetDCEx( UINT *args )
2155 HWND hwnd = get_handle( &args );
2156 HRGN clip_rgn = get_handle( &args );
2157 DWORD flags = get_ulong( &args );
2159 return HandleToUlong( NtUserGetDCEx( hwnd, clip_rgn, flags ));
2162 NTSTATUS WINAPI wow64_NtUserGetDisplayConfigBufferSizes( UINT *args )
2164 UINT32 flags = get_ulong( &args );
2165 UINT32 *num_path_info = get_ptr( &args );
2166 UINT32 *num_mode_info = get_ptr( &args );
2168 return NtUserGetDisplayConfigBufferSizes( flags, num_path_info, num_mode_info );
2171 NTSTATUS WINAPI wow64_NtUserGetDoubleClickTime( UINT *args )
2173 return NtUserGetDoubleClickTime();
2176 NTSTATUS WINAPI wow64_NtUserGetDpiForMonitor( UINT *args )
2178 HMONITOR monitor = get_handle( &args );
2179 UINT type = get_ulong( &args );
2180 UINT *x = get_ptr( &args );
2181 UINT *y = get_ptr( &args );
2183 return NtUserGetDpiForMonitor( monitor, type, x, y );
2186 NTSTATUS WINAPI wow64_NtUserGetForegroundWindow( UINT *args )
2188 return HandleToUlong( NtUserGetForegroundWindow() );
2191 NTSTATUS WINAPI wow64_NtUserGetGUIThreadInfo( UINT *args )
2193 DWORD id = get_ulong( &args );
2194 struct
2196 DWORD cbSize;
2197 DWORD flags;
2198 ULONG hwndActive;
2199 ULONG hwndFocus;
2200 ULONG hwndCapture;
2201 ULONG hwndMenuOwner;
2202 ULONG hwndMoveSize;
2203 ULONG hwndCaret;
2204 RECT rcCaret;
2205 } *info32 = get_ptr( &args );
2206 GUITHREADINFO info;
2208 if (info32->cbSize != sizeof(*info32))
2210 set_last_error32( ERROR_INVALID_PARAMETER );
2211 return FALSE;
2214 info.cbSize = sizeof(info);
2215 if (!NtUserGetGUIThreadInfo( id, &info )) return FALSE;
2216 info32->flags = info.flags;
2217 info32->hwndActive = HandleToUlong( info.hwndActive );
2218 info32->hwndFocus = HandleToUlong( info.hwndFocus );
2219 info32->hwndCapture = HandleToUlong( info.hwndCapture );
2220 info32->hwndMenuOwner = HandleToUlong( info.hwndMenuOwner );
2221 info32->hwndMoveSize = HandleToUlong( info.hwndMoveSize );
2222 info32->hwndCaret = HandleToUlong( info.hwndCaret );
2223 info32->rcCaret = info.rcCaret;
2224 return TRUE;
2227 NTSTATUS WINAPI wow64_NtUserGetIconInfo( UINT *args )
2229 HICON icon = get_handle( &args );
2230 struct
2232 BOOL fIcon;
2233 DWORD xHotspot;
2234 DWORD yHotspot;
2235 UINT32 hbmMask;
2236 UINT32 hbmColor;
2237 } *info32 = get_ptr( &args );
2238 UNICODE_STRING32 *module32 = get_ptr( &args );
2239 UNICODE_STRING32 *res_name32 = get_ptr( &args );
2240 DWORD *bpp = get_ptr( &args );
2241 LONG unk = get_ulong( &args );
2243 ICONINFO info;
2244 UNICODE_STRING module, res_name;
2246 if (!NtUserGetIconInfo( icon, &info, unicode_str_32to64( &module, module32 ),
2247 unicode_str_32to64( &res_name, res_name32 ), bpp, unk ))
2248 return FALSE;
2250 info32->fIcon = info.fIcon;
2251 info32->xHotspot = info.xHotspot;
2252 info32->yHotspot = info.yHotspot;
2253 info32->hbmMask = HandleToUlong( info.hbmMask );
2254 info32->hbmColor = HandleToUlong( info.hbmColor );
2255 if (module32)
2257 module32->Buffer = PtrToUlong( module.Buffer );
2258 module32->Length = module.Length;
2260 if (res_name32)
2262 res_name32->Buffer = PtrToUlong( res_name.Buffer );
2263 res_name32->Length = res_name.Length;
2265 return TRUE;
2268 NTSTATUS WINAPI wow64_NtUserGetIconSize( UINT *args )
2270 HICON handle = get_handle( &args );
2271 UINT step = get_ulong( &args );
2272 LONG *width = get_ptr( &args );
2273 LONG *height = get_ptr( &args );
2275 return NtUserGetIconSize( handle, step, width, height );
2278 NTSTATUS WINAPI wow64_NtUserGetInternalWindowPos( UINT *args )
2280 HWND hwnd = get_handle( &args );
2281 RECT *rect = get_ptr( &args );
2282 POINT *pt = get_ptr( &args );
2284 return NtUserGetInternalWindowPos( hwnd, rect, pt );
2287 NTSTATUS WINAPI wow64_NtUserGetKeyNameText( UINT *args )
2289 LONG lparam = get_ulong( &args );
2290 WCHAR *buffer = get_ptr( &args );
2291 INT size = get_ulong( &args );
2293 return NtUserGetKeyNameText( lparam, buffer, size );
2296 NTSTATUS WINAPI wow64_NtUserGetKeyState( UINT *args )
2298 INT vkey = get_ulong( &args );
2300 return NtUserGetKeyState( vkey );
2303 NTSTATUS WINAPI wow64_NtUserGetKeyboardLayout( UINT *args )
2305 DWORD tid = get_ulong( &args );
2307 return HandleToUlong( NtUserGetKeyboardLayout( tid ));
2310 NTSTATUS WINAPI wow64_NtUserGetKeyboardLayoutList( UINT *args )
2312 INT size = get_ulong( &args );
2313 UINT32 *layouts32 = get_ptr( &args );
2314 HKL *layouts = NULL;
2315 UINT ret, i;
2317 if (layouts32 && size && !(layouts = Wow64AllocateTemp( size * sizeof(*layouts) )))
2318 return 0;
2320 ret = NtUserGetKeyboardLayoutList( size, layouts );
2321 if (layouts)
2322 for (i = 0; i < ret; i++) layouts32[i] = HandleToUlong( layouts[i] );
2323 return ret;
2326 NTSTATUS WINAPI wow64_NtUserGetKeyboardLayoutName( UINT *args )
2328 WCHAR *name = get_ptr( &args );
2330 return NtUserGetKeyboardLayoutName( name );
2333 NTSTATUS WINAPI wow64_NtUserGetKeyboardState( UINT *args )
2335 BYTE *state = get_ptr( &args );
2337 return NtUserGetKeyboardState( state );
2340 NTSTATUS WINAPI wow64_NtUserGetLayeredWindowAttributes( UINT *args )
2342 HWND hwnd = get_handle( &args );
2343 COLORREF *key = get_ptr( &args );
2344 BYTE *alpha = get_ptr( &args );
2345 DWORD *flags = get_ptr( &args );
2347 return NtUserGetLayeredWindowAttributes( hwnd, key, alpha, flags );
2350 NTSTATUS WINAPI wow64_NtUserGetMenuBarInfo( UINT *args )
2352 HWND hwnd = get_handle( &args );
2353 LONG id = get_ulong( &args );
2354 LONG item = get_ulong( &args );
2355 struct
2357 DWORD cbSize;
2358 RECT rcBar;
2359 ULONG hMenu;
2360 ULONG hwndMenu;
2361 BOOL fBarFocused:1;
2362 BOOL fFocused:1;
2363 } *info32 = get_ptr( &args );
2365 MENUBARINFO info;
2367 if (info32->cbSize != sizeof(*info32))
2369 set_last_error32( ERROR_INVALID_PARAMETER );
2370 return FALSE;
2373 info.cbSize = sizeof(info);
2374 if (!NtUserGetMenuBarInfo( hwnd, id, item, &info )) return FALSE;
2375 info32->rcBar = info.rcBar;
2376 info32->hMenu = HandleToUlong( info.hMenu );
2377 info32->hwndMenu = HandleToUlong( info.hwndMenu );
2378 info32->fBarFocused = info.fBarFocused;
2379 info32->fFocused = info.fFocused;
2380 return TRUE;
2383 NTSTATUS WINAPI wow64_NtUserGetMenuItemRect( UINT *args )
2385 HWND hwnd = get_handle( &args );
2386 HMENU handle = get_handle( &args );
2387 UINT item = get_ulong( &args );
2388 RECT *rect = get_ptr( &args );
2390 return NtUserGetMenuItemRect( hwnd, handle, item, rect );
2393 NTSTATUS WINAPI wow64_NtUserGetMessage( UINT *args )
2395 MSG32 *msg32 = get_ptr( &args );
2396 HWND hwnd = get_handle( &args );
2397 UINT first = get_ulong( &args );
2398 UINT last = get_ulong( &args );
2399 MSG msg;
2400 int ret;
2402 ret = NtUserGetMessage( &msg, hwnd, first, last );
2403 if (ret != -1) msg_64to32( &msg, msg32 );
2404 return ret;
2407 NTSTATUS WINAPI wow64_NtUserGetMouseMovePointsEx( UINT *args )
2409 UINT size = get_ulong( &args );
2410 MOUSEMOVEPOINT32 *ptin32 = get_ptr( &args );
2411 MOUSEMOVEPOINT32 *ptout32 = get_ptr( &args );
2412 int count = get_ulong( &args );
2413 DWORD resolution = get_ulong( &args );
2415 MOUSEMOVEPOINT ptin[64], ptout[64];
2416 int ret, i;
2418 if (size != sizeof(MOUSEMOVEPOINT32) || count < 0 || count > ARRAYSIZE( ptin ))
2420 set_last_error32( ERROR_INVALID_PARAMETER );
2421 return -1;
2424 if (!ptin32 || (!ptout32 && count))
2426 set_last_error32( ERROR_NOACCESS );
2427 return -1;
2430 for (i = 0; i < count; i++)
2432 ptin[i].x = ptin32[i].x;
2433 ptin[i].y = ptin32[i].y;
2434 ptin[i].time = ptin32[i].time;
2435 ptin[i].dwExtraInfo = ptin32[i].dwExtraInfo;
2438 ret = NtUserGetMouseMovePointsEx( sizeof(MOUSEMOVEPOINT), ptin, ptout, count, resolution );
2440 for (i = 0; i < ret; i++)
2442 ptout32[i].x = ptout[i].x;
2443 ptout32[i].y = ptout[i].y;
2444 ptout32[i].time = ptout[i].time;
2445 ptout32[i].dwExtraInfo = ptout[i].dwExtraInfo;
2448 return ret;
2451 NTSTATUS WINAPI wow64_NtUserGetObjectInformation( UINT *args )
2453 HANDLE handle = get_handle( &args );
2454 INT index = get_ulong( &args );
2455 void *info = get_ptr( &args );
2456 DWORD len = get_ulong( &args );
2457 DWORD *needed = get_ptr( &args );
2459 return NtUserGetObjectInformation( handle, index, info, len, needed );
2462 NTSTATUS WINAPI wow64_NtUserGetOpenClipboardWindow( UINT *args )
2464 return HandleToUlong( NtUserGetOpenClipboardWindow() );
2467 NTSTATUS WINAPI wow64_NtUserGetPointerInfoList( UINT *args )
2469 UINT id = get_ulong( &args );
2470 UINT type = get_ulong( &args );
2471 UINT unk0 = get_ulong( &args );
2472 UINT unk1 = get_ulong( &args );
2473 UINT size = get_ulong( &args );
2474 void *entry_count = get_ptr( &args );
2475 void *pointer_count = get_ptr( &args );
2476 void *pointer_info = get_ptr( &args );
2478 return NtUserGetPointerInfoList( id, type, unk0, unk1, size, entry_count, pointer_count, pointer_info );
2481 NTSTATUS WINAPI wow64_NtUserGetPriorityClipboardFormat( UINT *args )
2483 UINT *list = get_ptr( &args );
2484 INT count = get_ulong( &args );
2486 return NtUserGetPriorityClipboardFormat( list, count );
2489 NTSTATUS WINAPI wow64_NtUserGetProcessDpiAwarenessContext( UINT *args )
2491 HANDLE process = get_handle( &args );
2493 return NtUserGetProcessDpiAwarenessContext( process );
2496 NTSTATUS WINAPI wow64_NtUserGetProcessWindowStation( UINT *args )
2498 return HandleToUlong( NtUserGetProcessWindowStation() );
2501 NTSTATUS WINAPI wow64_NtUserGetProp( UINT *args )
2503 HWND hwnd = get_handle( &args );
2504 const WCHAR *str = get_ptr( &args );
2506 return HandleToUlong( NtUserGetProp( hwnd, str ));
2509 NTSTATUS WINAPI wow64_NtUserGetQueueStatus( UINT *args )
2511 UINT flags = get_ulong( &args );
2513 return NtUserGetQueueStatus( flags );
2516 NTSTATUS WINAPI wow64_NtUserGetRawInputBuffer( UINT *args )
2518 RAWINPUT *data = get_ptr( &args );
2519 UINT *data_size = get_ptr( &args );
2520 UINT header_size = get_ulong( &args );
2522 if (header_size != sizeof(RAWINPUTHEADER32))
2524 set_last_error32( ERROR_INVALID_PARAMETER );
2525 return ~0u;
2528 /* RAWINPUT has different sizes on 32-bit and 64-bit, but no translation is
2529 * done. The function actually returns different structures depending on
2530 * whether it's operating under WoW64 or not. */
2531 return NtUserGetRawInputBuffer( data, data_size, sizeof(RAWINPUTHEADER) );
2534 NTSTATUS WINAPI wow64_NtUserGetRawInputData( UINT *args )
2536 HRAWINPUT handle = get_handle( &args );
2537 UINT command = get_ulong( &args );
2538 void *data = get_ptr( &args );
2539 UINT *data_size = get_ptr( &args );
2540 UINT header_size = get_ulong( &args );
2542 if (header_size != sizeof(RAWINPUTHEADER32))
2544 set_last_error32( ERROR_INVALID_PARAMETER );
2545 return ~0u;
2548 switch (command)
2550 case RID_INPUT:
2551 if (data)
2553 UINT data_size64, body_size, ret;
2554 RAWINPUTHEADER32 *data32 = data;
2555 RAWINPUTHEADER *data64 = NULL;
2557 data_size64 = *data_size + sizeof(RAWINPUTHEADER);
2558 if (!(data64 = Wow64AllocateTemp( data_size64 )))
2560 set_last_error32( STATUS_NO_MEMORY );
2561 return ~0u;
2564 ret = NtUserGetRawInputData( handle, command, data64, &data_size64, sizeof(RAWINPUTHEADER) );
2565 if (ret == ~0u) return ret;
2567 body_size = ret - sizeof(RAWINPUTHEADER);
2568 if (*data_size < sizeof(RAWINPUTHEADER32) + body_size)
2570 set_last_error32( ERROR_INSUFFICIENT_BUFFER );
2571 return ~0u;
2574 data32->dwType = data64->dwType;
2575 data32->dwSize = sizeof(RAWINPUTHEADER32) + body_size;
2576 data32->hDevice = (UINT_PTR)data64->hDevice;
2577 data32->wParam = data64->wParam;
2578 memcpy( data32 + 1, data64 + 1, body_size );
2579 return sizeof(RAWINPUTHEADER32) + body_size;
2581 else
2583 UINT data_size64, ret;
2585 ret = NtUserGetRawInputData( handle, command, NULL, &data_size64, sizeof(RAWINPUTHEADER) );
2586 if (ret == ~0u) return ret;
2587 *data_size = data_size64 - sizeof(RAWINPUTHEADER) + sizeof(RAWINPUTHEADER32);
2588 return 0;
2591 case RID_HEADER:
2593 UINT data_size64 = sizeof(RAWINPUTHEADER);
2594 RAWINPUTHEADER32 *data32 = data;
2595 RAWINPUTHEADER data64;
2596 UINT ret;
2598 if (!data)
2600 *data_size = sizeof(RAWINPUTHEADER32);
2601 return 0;
2604 if (*data_size < sizeof(RAWINPUTHEADER32))
2606 set_last_error32( ERROR_INSUFFICIENT_BUFFER );
2607 return ~0u;
2610 ret = NtUserGetRawInputData( handle, command, &data64, &data_size64, sizeof(RAWINPUTHEADER) );
2611 if (ret == ~0u) return ret;
2612 data32->dwType = data64.dwType;
2613 data32->dwSize = data64.dwSize - sizeof(RAWINPUTHEADER) + sizeof(RAWINPUTHEADER32);
2614 data32->hDevice = (UINT_PTR)data64.hDevice;
2615 data32->wParam = data64.wParam;
2616 return sizeof(RAWINPUTHEADER32);
2619 default:
2620 set_last_error32( ERROR_INVALID_PARAMETER );
2621 return ~0u;
2625 NTSTATUS WINAPI wow64_NtUserGetRawInputDeviceInfo( UINT *args )
2627 HANDLE handle = get_handle( &args );
2628 UINT command = get_ulong( &args );
2629 void *data = get_ptr( &args );
2630 UINT *data_size = get_ptr( &args );
2632 return NtUserGetRawInputDeviceInfo( handle, command, data, data_size );
2635 NTSTATUS WINAPI wow64_NtUserGetRawInputDeviceList( UINT *args )
2637 RAWINPUTDEVICELIST32 *devices32 = get_ptr( &args );
2638 UINT *count = get_ptr( &args );
2639 UINT size = get_ulong( &args );
2641 if (size != sizeof(RAWINPUTDEVICELIST32))
2643 set_last_error32( ERROR_INVALID_PARAMETER );
2644 return ~0u;
2647 if (devices32)
2649 RAWINPUTDEVICELIST *devices64;
2650 unsigned int ret, i;
2652 if (!(devices64 = Wow64AllocateTemp( (*count) * sizeof(*devices64) )))
2654 set_last_error32( ERROR_NOT_ENOUGH_MEMORY );
2655 return ~0u;
2658 ret = NtUserGetRawInputDeviceList( devices64, count, sizeof(RAWINPUTDEVICELIST) );
2659 if (ret == ~0u) return ret;
2661 for (i = 0; i < *count; ++i)
2663 devices32[i].hDevice = (UINT_PTR)devices64[i].hDevice;
2664 devices32[i].dwType = devices64[i].dwType;
2666 return ret;
2668 else
2670 return NtUserGetRawInputDeviceList( NULL, count, sizeof(RAWINPUTDEVICELIST) );
2674 NTSTATUS WINAPI wow64_NtUserRealChildWindowFromPoint( UINT *args )
2676 HWND parent = get_handle( &args );
2677 LONG x = get_ulong( &args );
2678 LONG y = get_ulong( &args );
2680 return HandleToUlong( NtUserRealChildWindowFromPoint( parent, x, y ));
2683 NTSTATUS WINAPI wow64_NtUserRegisterClassExWOW( UINT *args )
2685 const WNDCLASSEXW32 *wc32 = get_ptr( &args );
2686 UNICODE_STRING32 *name32 = get_ptr( &args );
2687 UNICODE_STRING32 *version32 = get_ptr( &args );
2688 struct client_menu_name32 *client_name32 = get_ptr( &args );
2689 DWORD fnid = get_ulong( &args );
2690 DWORD flags = get_ulong( &args );
2691 DWORD *wow = get_ptr( &args );
2693 struct client_menu_name client_name;
2694 UNICODE_STRING name, version;
2695 WNDCLASSEXW wc;
2697 if (wc32->cbSize != sizeof(*wc32))
2699 set_last_error32( ERROR_INVALID_PARAMETER );
2700 return 0;
2703 wc.cbSize = sizeof(wc);
2704 wc.style = wc32->style;
2705 wc.lpfnWndProc = UlongToPtr( wc32->lpfnWndProc );
2706 wc.cbClsExtra = wc32->cbClsExtra;
2707 wc.cbWndExtra = wc32->cbWndExtra;
2708 wc.hInstance = UlongToPtr( wc32->hInstance );
2709 wc.hIcon = LongToHandle( wc32->hIcon );
2710 wc.hCursor = LongToHandle( wc32->hCursor );
2711 wc.hbrBackground = UlongToHandle( wc32->hbrBackground );
2712 wc.lpszMenuName = UlongToPtr( wc32->lpszMenuName );
2713 wc.lpszClassName = UlongToPtr( wc32->lpszClassName );
2714 wc.hIconSm = LongToHandle( wc32->hIconSm );
2716 return NtUserRegisterClassExWOW( &wc,
2717 unicode_str_32to64( &name, name32 ),
2718 unicode_str_32to64( &version, version32 ),
2719 client_menu_name_32to64( &client_name, client_name32 ),
2720 fnid, flags, wow );
2723 NTSTATUS WINAPI wow64_NtUserGetRegisteredRawInputDevices( UINT *args )
2725 RAWINPUTDEVICE32 *devices32 = get_ptr( &args );
2726 UINT *count = get_ptr( &args );
2727 UINT size = get_ulong( &args );
2729 if (size != sizeof(RAWINPUTDEVICE32))
2731 set_last_error32( ERROR_INVALID_PARAMETER );
2732 return ~0u;
2735 if (devices32)
2737 RAWINPUTDEVICE *devices64;
2738 unsigned int ret, i;
2740 if (!(devices64 = Wow64AllocateTemp( (*count) * sizeof(*devices64) )))
2742 set_last_error32( ERROR_NOT_ENOUGH_MEMORY );
2743 return ~0u;
2746 ret = NtUserGetRegisteredRawInputDevices( devices64, count, sizeof(RAWINPUTDEVICE) );
2747 if (ret == ~0u) return ret;
2749 for (i = 0; i < *count; ++i)
2751 devices32[i].usUsagePage = devices64[i].usUsagePage;
2752 devices32[i].usUsage = devices64[i].usUsage;
2753 devices32[i].dwFlags = devices64[i].dwFlags;
2754 devices32[i].hwndTarget = (ULONG_PTR)devices64[i].hwndTarget;
2756 return ret;
2758 else
2760 return NtUserGetRegisteredRawInputDevices( NULL, count, sizeof(RAWINPUTDEVICE) );
2764 NTSTATUS WINAPI wow64_NtUserGetScrollBarInfo( UINT *args )
2766 HWND hwnd = get_handle( &args );
2767 LONG id = get_ulong( &args );
2768 SCROLLBARINFO *info = get_ptr( &args );
2770 return NtUserGetScrollBarInfo( hwnd, id, info );
2773 NTSTATUS WINAPI wow64_NtUserGetSystemDpiForProcess( UINT *args )
2775 HANDLE process = get_handle( &args );
2777 return NtUserGetSystemDpiForProcess( process );
2780 NTSTATUS WINAPI wow64_NtUserGetSystemMenu( UINT *args )
2782 HWND hwnd = get_handle( &args );
2783 BOOL revert = get_ulong( &args );
2785 return HandleToUlong( NtUserGetSystemMenu( hwnd, revert ));
2788 NTSTATUS WINAPI wow64_NtUserGetThreadDesktop( UINT *args )
2790 DWORD thread = get_ulong( &args );
2792 return HandleToUlong( NtUserGetThreadDesktop( thread ));
2795 NTSTATUS WINAPI wow64_NtUserGetTitleBarInfo( UINT *args )
2797 HWND hwnd = get_handle( &args );
2798 TITLEBARINFO *info = get_ptr( &args );
2800 return NtUserGetTitleBarInfo( hwnd, info );
2803 NTSTATUS WINAPI wow64_NtUserGetUpdateRect( UINT *args )
2805 HWND hwnd = get_handle( &args );
2806 RECT *rect = get_ptr( &args );
2807 BOOL erase = get_ulong( &args );
2809 return NtUserGetUpdateRect( hwnd, rect, erase );
2812 NTSTATUS WINAPI wow64_NtUserGetUpdateRgn( UINT *args )
2814 HWND hwnd = get_handle( &args );
2815 HRGN hrgn = get_handle( &args );
2816 BOOL erase = get_ulong( &args );
2818 return NtUserGetUpdateRgn( hwnd, hrgn, erase );
2821 NTSTATUS WINAPI wow64_NtUserGetUpdatedClipboardFormats( UINT *args )
2823 UINT *formats = get_ptr( &args );
2824 UINT size = get_ulong( &args );
2825 UINT *out_size = get_ptr( &args );
2827 return NtUserGetUpdatedClipboardFormats( formats, size, out_size );
2830 NTSTATUS WINAPI wow64_NtUserGetWindowDC( UINT *args )
2832 HWND hwnd = get_handle( &args );
2834 return HandleToUlong( NtUserGetWindowDC( hwnd ));
2837 NTSTATUS WINAPI wow64_NtUserGetWindowPlacement( UINT *args )
2839 HWND hwnd = get_handle( &args );
2840 WINDOWPLACEMENT *placement = get_ptr( &args );
2842 return NtUserGetWindowPlacement( hwnd, placement );
2845 NTSTATUS WINAPI wow64_NtUserGetWindowRgnEx( UINT *args )
2847 HWND hwnd = get_handle( &args );
2848 HRGN hrgn = get_handle( &args );
2849 UINT unk = get_ulong( &args );
2851 return NtUserGetWindowRgnEx( hwnd, hrgn, unk );
2854 NTSTATUS WINAPI wow64_NtUserHideCaret( UINT *args )
2856 HWND hwnd = get_handle( &args );
2858 return NtUserHideCaret( hwnd );
2861 NTSTATUS WINAPI wow64_NtUserHiliteMenuItem( UINT *args )
2863 HWND hwnd = get_handle( &args );
2864 HMENU handle = get_handle( &args );
2865 UINT item = get_ulong( &args );
2866 UINT hilite = get_ulong( &args );
2868 return NtUserHiliteMenuItem( hwnd, handle, item, hilite );
2871 struct user_client_procs32
2873 ULONG pButtonWndProc;
2874 ULONG pComboWndProc;
2875 ULONG pDefWindowProc;
2876 ULONG pDefDlgProc;
2877 ULONG pEditWndProc;
2878 ULONG pListBoxWndProc;
2879 ULONG pMDIClientWndProc;
2880 ULONG pScrollBarWndProc;
2881 ULONG pStaticWndProc;
2882 ULONG pImeWndProc;
2883 ULONG pDesktopWndProc;
2884 ULONG pIconTitleWndProc;
2885 ULONG pPopupMenuWndProc;
2886 ULONG pMessageWndProc;
2889 static struct user_client_procs *user_client_procs_32to64( struct user_client_procs *procs,
2890 const struct user_client_procs32 *procs32 )
2892 if (!procs32) return NULL;
2894 procs->pButtonWndProc = UlongToPtr( procs32->pButtonWndProc );
2895 procs->pComboWndProc = UlongToPtr( procs32->pComboWndProc );
2896 procs->pDefWindowProc = UlongToPtr( procs32->pDefWindowProc );
2897 procs->pDefDlgProc = UlongToPtr( procs32->pDefDlgProc );
2898 procs->pEditWndProc = UlongToPtr( procs32->pEditWndProc );
2899 procs->pListBoxWndProc = UlongToPtr( procs32->pListBoxWndProc );
2900 procs->pMDIClientWndProc = UlongToPtr( procs32->pMDIClientWndProc );
2901 procs->pScrollBarWndProc = UlongToPtr( procs32->pScrollBarWndProc );
2902 procs->pStaticWndProc = UlongToPtr( procs32->pStaticWndProc );
2903 procs->pImeWndProc = UlongToPtr( procs32->pImeWndProc );
2904 procs->pDesktopWndProc = UlongToPtr( procs32->pDesktopWndProc );
2905 procs->pIconTitleWndProc = UlongToPtr( procs32->pIconTitleWndProc );
2906 procs->pPopupMenuWndProc = UlongToPtr( procs32->pPopupMenuWndProc );
2907 procs->pMessageWndProc = UlongToPtr( procs32->pMessageWndProc );
2908 return procs;
2911 NTSTATUS WINAPI wow64_NtUserInitializeClientPfnArrays( UINT *args )
2913 const struct user_client_procs32 *procsA32 = get_ptr( &args );
2914 const struct user_client_procs32 *procsW32 = get_ptr( &args );
2915 void *workers = get_ptr( &args );
2916 HINSTANCE user_module = get_ptr( &args );
2918 struct user_client_procs procsA, procsW;
2919 return NtUserInitializeClientPfnArrays( user_client_procs_32to64( &procsA, procsA32 ),
2920 user_client_procs_32to64( &procsW, procsW32 ),
2921 workers, user_module );
2924 NTSTATUS WINAPI wow64_NtUserInternalGetWindowIcon( UINT *args )
2926 HWND hwnd = get_handle( &args );
2927 UINT type = get_ulong( &args );
2929 return HandleToUlong( NtUserInternalGetWindowIcon( hwnd, type ));
2932 NTSTATUS WINAPI wow64_NtUserInternalGetWindowText( UINT *args )
2934 HWND hwnd = get_handle( &args );
2935 WCHAR *text = get_ptr( &args );
2936 INT count = get_ulong( &args );
2938 return NtUserInternalGetWindowText( hwnd, text, count );
2941 NTSTATUS WINAPI wow64_NtUserInvalidateRect( UINT *args )
2943 HWND hwnd = get_handle( &args );
2944 const RECT *rect = get_ptr( &args );
2945 BOOL erase = get_ulong( &args );
2947 return NtUserInvalidateRect( hwnd, rect, erase );
2950 NTSTATUS WINAPI wow64_NtUserInvalidateRgn( UINT *args )
2952 HWND hwnd = get_handle( &args );
2953 HRGN hrgn = get_handle( &args );
2954 BOOL erase = get_ulong( &args );
2956 return NtUserInvalidateRgn( hwnd, hrgn, erase );
2959 NTSTATUS WINAPI wow64_NtUserIsClipboardFormatAvailable( UINT *args )
2961 UINT format = get_ulong( &args );
2963 return NtUserIsClipboardFormatAvailable( format );
2966 NTSTATUS WINAPI wow64_NtUserIsMouseInPointerEnabled( UINT *args )
2968 return NtUserIsMouseInPointerEnabled();
2971 NTSTATUS WINAPI wow64_NtUserKillTimer( UINT *args )
2973 HWND hwnd = get_handle( &args );
2974 UINT_PTR id = get_ulong( &args );
2976 return NtUserKillTimer( hwnd, id );
2979 NTSTATUS WINAPI wow64_NtUserLockWindowUpdate( UINT *args )
2981 HWND hwnd = get_handle( &args );
2983 return NtUserLockWindowUpdate( hwnd );
2986 NTSTATUS WINAPI wow64_NtUserLogicalToPerMonitorDPIPhysicalPoint( UINT *args )
2988 HWND hwnd = get_handle( &args );
2989 POINT *pt = get_ptr( &args );
2991 return NtUserLogicalToPerMonitorDPIPhysicalPoint( hwnd, pt );
2994 NTSTATUS WINAPI wow64_NtUserMapVirtualKeyEx( UINT *args )
2996 UINT code = get_ulong( &args );
2997 UINT type = get_ulong( &args );
2998 HKL layout = get_handle( &args );
3000 return NtUserMapVirtualKeyEx( code, type, layout );
3003 NTSTATUS WINAPI wow64_NtUserMenuItemFromPoint( UINT *args )
3005 HWND hwnd = get_handle( &args );
3006 HMENU handle = get_handle( &args );
3007 int x = get_ulong( &args );
3008 int y = get_ulong( &args );
3010 return NtUserMenuItemFromPoint( hwnd, handle, x, y );
3013 static LRESULT message_call_32to64( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
3014 void *result_info, DWORD type, BOOL ansi )
3016 LRESULT ret = 0;
3018 switch (msg)
3020 case WM_NCCREATE:
3021 case WM_CREATE:
3023 CREATESTRUCT32 *cs32 = (void *)lparam;
3024 CREATESTRUCTW cs;
3026 createstruct_32to64( cs32, &cs );
3027 ret = NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&cs, result_info, type, ansi );
3028 cs32->lpCreateParams = PtrToUlong( cs.lpCreateParams );
3029 cs32->hInstance = PtrToUlong( cs.hInstance );
3030 cs32->hMenu = HandleToLong( cs.hMenu );
3031 cs32->hwndParent = HandleToLong( cs.hwndParent );
3032 cs32->cy = cs.cy;
3033 cs32->cx = cs.cx;
3034 cs32->y = cs.y;
3035 cs32->x = cs.x;
3036 cs32->style = cs.style;
3037 cs32->dwExStyle = cs.dwExStyle;
3038 return ret;
3041 case WM_MDICREATE:
3043 MDICREATESTRUCT32 *cs32 = (void *)lparam;
3044 MDICREATESTRUCTW cs;
3046 cs.szClass = UlongToPtr( cs32->szClass );
3047 cs.szTitle = UlongToPtr( cs32->szTitle );
3048 cs.hOwner = LongToHandle( cs32->hOwner );
3049 cs.x = cs32->x;
3050 cs.y = cs32->y;
3051 cs.cx = cs32->cx;
3052 cs.cy = cs32->cy;
3053 cs.style = cs32->style;
3054 cs.lParam = cs32->lParam;
3056 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&cs, result_info, type, ansi );
3059 case WM_WINDOWPOSCHANGING:
3060 case WM_WINDOWPOSCHANGED:
3062 WINDOWPOS32 *winpos32 = (void *)lparam;
3063 WINDOWPOS winpos;
3065 winpos_32to64( &winpos, winpos32 );
3066 ret = NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&winpos, result_info, type, ansi );
3067 winpos_64to32( &winpos, winpos32 );
3068 return ret;
3071 case WM_NCCALCSIZE:
3072 if (wparam)
3074 NCCALCSIZE_PARAMS32 *params32 = (void *)lparam;
3075 NCCALCSIZE_PARAMS params;
3076 WINDOWPOS winpos;
3078 params.rgrc[0] = params32->rgrc[0];
3079 params.rgrc[1] = params32->rgrc[1];
3080 params.rgrc[2] = params32->rgrc[2];
3081 params.lppos = &winpos;
3082 winpos_32to64( &winpos, UlongToPtr( params32->lppos ));
3083 ret = NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&params, result_info, type, ansi );
3084 params32->rgrc[0] = params.rgrc[0];
3085 params32->rgrc[1] = params.rgrc[1];
3086 params32->rgrc[2] = params.rgrc[2];
3087 winpos_64to32( &winpos, UlongToPtr( params32->lppos ));
3088 return ret;
3090 return NtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi );
3092 case WM_COMPAREITEM:
3094 COMPAREITEMSTRUCT32 *cis32 = (void *)lparam;
3095 COMPAREITEMSTRUCT cis;
3097 cis.CtlType = cis32->CtlType;
3098 cis.CtlID = cis32->CtlID;
3099 cis.hwndItem = LongToHandle( cis32->hwndItem );
3100 cis.itemID1 = cis32->itemID1;
3101 cis.itemData1 = cis32->itemData1;
3102 cis.itemID2 = cis32->itemID2;
3103 cis.itemData2 = cis32->itemData2;
3104 cis.dwLocaleId = cis32->dwLocaleId;
3105 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&cis, result_info, type, ansi );
3108 case WM_DELETEITEM:
3110 DELETEITEMSTRUCT32 *dis32 = (void *)lparam;
3111 DELETEITEMSTRUCT dis;
3113 dis.CtlType = dis32->CtlType;
3114 dis.CtlID = dis32->CtlID;
3115 dis.hwndItem = LongToHandle( dis32->hwndItem );
3116 dis.itemData = dis32->itemData;
3117 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&dis, result_info, type, ansi );
3120 case WM_MEASUREITEM:
3122 MEASUREITEMSTRUCT32 *mis32 = (void *)lparam;
3123 MEASUREITEMSTRUCT mis;
3125 mis.CtlType = mis32->CtlType;
3126 mis.CtlID = mis32->CtlID;
3127 mis.itemID = mis32->itemID;
3128 mis.itemWidth = mis32->itemWidth;
3129 mis.itemHeight = mis32->itemHeight;
3130 mis.itemData = mis32->itemData;
3131 ret = NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&mis, result_info, type, ansi );
3132 mis32->itemWidth = mis.itemWidth;
3133 mis32->itemHeight = mis.itemHeight;
3134 return ret;
3137 case WM_DRAWITEM:
3139 DRAWITEMSTRUCT32 *dis32 = (void *)lparam;
3140 DRAWITEMSTRUCT dis;
3142 dis.CtlType = dis32->CtlType;
3143 dis.CtlID = dis32->CtlID;
3144 dis.itemID = dis32->itemID;
3145 dis.itemAction = dis32->itemAction;
3146 dis.itemState = dis32->itemState;
3147 dis.hwndItem = LongToHandle( dis32->hwndItem );
3148 dis.hDC = LongToHandle( dis32->hDC );
3149 dis.itemData = dis32->itemData;
3150 dis.rcItem.left = dis32->rcItem.left;
3151 dis.rcItem.top = dis32->rcItem.top;
3152 dis.rcItem.right = dis32->rcItem.right;
3153 dis.rcItem.bottom = dis32->rcItem.bottom;
3154 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&dis, result_info, type, ansi );
3157 case WM_COPYDATA:
3159 COPYDATASTRUCT32 *cds32 = (void *)lparam;
3160 COPYDATASTRUCT cds;
3162 cds.dwData = cds32->dwData;
3163 cds.cbData = cds32->cbData;
3164 cds.lpData = UlongToPtr( cds32->lpData );
3165 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&cds, result_info, type, ansi );
3168 case WM_GETDLGCODE:
3169 if (lparam)
3171 MSG32 *msg32 = (MSG32 *)lparam;
3172 MSG msg64;
3174 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)msg_32to64( &msg64, msg32 ),
3175 result_info, type, ansi );
3177 return NtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi );
3179 case WM_NEXTMENU:
3181 MDINEXTMENU32 *next32 = (void *)lparam;
3182 MDINEXTMENU next;
3184 next.hmenuIn = LongToHandle( next32->hmenuIn );
3185 next.hmenuNext = LongToHandle( next32->hmenuNext );
3186 next.hwndNext = LongToHandle( next32->hwndNext );
3187 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&next, result_info, type, ansi );
3190 case WM_PAINTCLIPBOARD:
3192 PAINTSTRUCT ps;
3194 paintstruct_32to64( &ps, (PAINTSTRUCT32 *)lparam );
3195 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&ps, result_info, type, ansi );
3198 default:
3199 return NtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi );
3203 NTSTATUS WINAPI wow64_NtUserMessageCall( UINT *args )
3205 HWND hwnd = get_handle( &args );
3206 UINT msg = get_ulong( &args );
3207 LONG wparam = get_ulong( &args );
3208 LONG lparam = get_ulong( &args );
3209 void *result_info = get_ptr( &args );
3210 UINT type = get_ulong ( &args );
3211 BOOL ansi = get_ulong( &args );
3213 switch (type)
3215 case NtUserGetDispatchParams:
3216 case NtUserCallWindowProc:
3218 struct win_proc_params32 *params32 = result_info;
3219 struct win_proc_params params;
3221 if (type == NtUserCallWindowProc) params.func = UlongToPtr( params32->func );
3223 if (!NtUserMessageCall( hwnd, msg, wparam, lparam, &params, type, ansi ))
3224 return FALSE;
3226 win_proc_params_64to32( &params, params32 );
3227 return TRUE;
3230 case NtUserSendMessage:
3232 struct win_proc_params32 *params32 = result_info;
3234 if (params32)
3236 struct win_proc_params params;
3237 NTSTATUS ret;
3239 params.hwnd = 0;
3240 ret = message_call_32to64( hwnd, msg, wparam, lparam, &params, type, ansi );
3241 if (params.hwnd) win_proc_params_64to32( &params, params32 );
3242 return ret;
3245 return message_call_32to64( hwnd, msg, wparam, lparam, result_info, type, ansi );
3248 case NtUserSendMessageTimeout:
3250 struct
3252 UINT flags;
3253 UINT timeout;
3254 DWORD result;
3255 } *params32 = result_info;
3256 struct send_message_timeout_params params;
3257 LRESULT ret;
3259 params.flags = params32->flags;
3260 params.timeout = params32->timeout;
3261 ret = message_call_32to64( hwnd, msg, wparam, lparam, &params, type, ansi );
3262 params32->result = params.result;
3263 return ret;
3266 case NtUserSendMessageCallback:
3268 struct
3270 ULONG callback;
3271 ULONG data;
3272 } *params32 = result_info;
3273 struct send_message_callback_params params;
3275 params.callback = UlongToPtr( params32->callback );
3276 params.data = params32->data;
3277 return message_call_32to64( hwnd, msg, wparam, lparam, &params, type, ansi );
3280 case NtUserSpyGetMsgName:
3281 /* no argument conversion */
3282 return NtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi );
3284 case NtUserWinProcResult:
3286 LONG result32 = PtrToLong( result_info );
3287 return message_call_32to64( hwnd, msg, wparam, lparam,
3288 LongToPtr( result32 ), type, ansi );
3291 case NtUserImeDriverCall:
3293 struct
3295 ULONG himc;
3296 ULONG state;
3297 ULONG compstr;
3298 } *params32 = result_info;
3299 struct ime_driver_call_params params;
3300 params.himc = UlongToPtr( params32->himc );
3301 params.state = UlongToPtr( params32->state );
3302 params.compstr = UlongToPtr( params32->compstr );
3303 return NtUserMessageCall( hwnd, msg, wparam, lparam, &params, type, ansi );
3307 return message_call_32to64( hwnd, msg, wparam, lparam, result_info, type, ansi );
3310 NTSTATUS WINAPI wow64_NtUserMoveWindow( UINT *args )
3312 HWND hwnd = get_handle( &args );
3313 INT x = get_ulong( &args );
3314 INT y = get_ulong( &args );
3315 INT cx = get_ulong( &args );
3316 INT cy = get_ulong( &args );
3317 BOOL repaint = get_ulong( &args );
3319 return NtUserMoveWindow( hwnd, x, y, cx, cy, repaint );
3322 NTSTATUS WINAPI wow64_NtUserMsgWaitForMultipleObjectsEx( UINT *args )
3324 DWORD count = get_ulong( &args );
3325 const ULONG *handles32 = get_ptr( &args );
3326 DWORD timeout = get_ulong( &args );
3327 DWORD mask = get_ulong( &args );
3328 DWORD flags = get_ulong( &args );
3330 HANDLE handles[MAXIMUM_WAIT_OBJECTS];
3331 unsigned int i;
3333 if (count > ARRAYSIZE(handles))
3335 set_last_error32( ERROR_INVALID_PARAMETER );
3336 return WAIT_FAILED;
3338 for (i = 0; i < count; i++) handles[i] = LongToHandle( handles32[i] );
3340 return NtUserMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags );
3343 NTSTATUS WINAPI wow64_NtUserNotifyIMEStatus( UINT *args )
3345 HWND hwnd = get_handle( &args );
3346 ULONG status = get_ulong( &args );
3348 NtUserNotifyIMEStatus( hwnd, status );
3349 return 0;
3352 NTSTATUS WINAPI wow64_NtUserNotifyWinEvent( UINT *args )
3354 DWORD event = get_ulong( &args );
3355 HWND hwnd = get_handle( &args );
3356 LONG object_id = get_ulong( &args );
3357 LONG child_id = get_ulong( &args );
3359 NtUserNotifyWinEvent( event, hwnd, object_id, child_id );
3360 return 0;
3363 NTSTATUS WINAPI wow64_NtUserOpenClipboard( UINT *args )
3365 HWND hwnd = get_handle( &args );
3366 ULONG unk = get_ulong( &args );
3368 return NtUserOpenClipboard( hwnd, unk );
3371 NTSTATUS WINAPI wow64_NtUserOpenDesktop( UINT *args )
3373 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
3374 DWORD flags = get_ulong( &args );
3375 ACCESS_MASK access = get_ulong( &args );
3377 struct object_attr64 attr;
3378 HANDLE ret;
3380 ret = NtUserOpenDesktop( objattr_32to64( &attr, attr32 ), flags, access );
3381 return HandleToUlong( ret );
3384 NTSTATUS WINAPI wow64_NtUserOpenInputDesktop( UINT *args )
3386 DWORD flags = get_ulong( &args );
3387 BOOL inherit = get_ulong( &args );
3388 ACCESS_MASK access = get_ulong( &args );
3390 return HandleToUlong( NtUserOpenInputDesktop( flags, inherit, access ));
3393 NTSTATUS WINAPI wow64_NtUserOpenWindowStation( UINT *args )
3395 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
3396 ACCESS_MASK access = get_ulong( &args );
3398 struct object_attr64 attr;
3400 return HandleToUlong( NtUserOpenWindowStation( objattr_32to64( &attr, attr32 ), access ));
3403 NTSTATUS WINAPI wow64_NtUserPeekMessage( UINT *args )
3405 MSG32 *msg32 = get_ptr( &args );
3406 HWND hwnd = get_handle( &args );
3407 UINT first = get_ulong( &args );
3408 UINT last = get_ulong( &args );
3409 UINT flags = get_ulong( &args );
3410 MSG msg;
3412 if (!NtUserPeekMessage( msg32 ? &msg : NULL, hwnd, first, last, flags )) return FALSE;
3413 msg_64to32( &msg, msg32 );
3414 return TRUE;
3417 NTSTATUS WINAPI wow64_NtUserPerMonitorDPIPhysicalToLogicalPoint( UINT *args )
3419 HWND hwnd = get_handle( &args );
3420 POINT *pt = get_ptr( &args );
3422 return NtUserPerMonitorDPIPhysicalToLogicalPoint( hwnd, pt );
3425 NTSTATUS WINAPI wow64_NtUserPostMessage( UINT *args )
3427 HWND hwnd = get_handle( &args );
3428 UINT msg = get_ulong( &args );
3429 WPARAM wparam = get_ulong( &args );
3430 LPARAM lparam = get_ulong( &args );
3432 return NtUserPostMessage( hwnd, msg, wparam, lparam );
3435 NTSTATUS WINAPI wow64_NtUserPostThreadMessage( UINT *args )
3437 DWORD thread = get_ulong( &args );
3438 UINT msg = get_ulong( &args );
3439 WPARAM wparam = get_ulong( &args );
3440 LPARAM lparam = get_ulong( &args );
3442 return NtUserPostThreadMessage( thread, msg, wparam, lparam );
3445 NTSTATUS WINAPI wow64_NtUserPrintWindow( UINT *args )
3447 HWND hwnd = get_handle( &args );
3448 HDC hdc = get_handle( &args );
3449 UINT flags = get_ulong( &args );
3451 return NtUserPrintWindow( hwnd, hdc, flags );
3454 NTSTATUS WINAPI wow64_NtUserQueryDisplayConfig( UINT *args )
3456 UINT32 flags = get_ulong( &args );
3457 UINT32 *paths_count = get_ptr( &args );
3458 DISPLAYCONFIG_PATH_INFO *paths = get_ptr( &args );
3459 UINT32 *modes_count = get_ptr( &args );
3460 DISPLAYCONFIG_MODE_INFO *modes = get_ptr( &args );
3461 DISPLAYCONFIG_TOPOLOGY_ID *topology_id = get_ptr( &args );
3463 return NtUserQueryDisplayConfig( flags, paths_count, paths, modes_count, modes, topology_id );
3466 NTSTATUS WINAPI wow64_NtUserQueryInputContext( UINT *args )
3468 HIMC handle = get_handle( &args );
3469 UINT attr = get_ulong( &args );
3471 return NtUserQueryInputContext( handle, attr );
3474 NTSTATUS WINAPI wow64_NtUserRedrawWindow( UINT *args )
3476 HWND hwnd = get_handle( &args );
3477 const RECT *rect = get_ptr( &args );
3478 HRGN hrgn = get_handle( &args );
3479 UINT flags = get_ulong( &args );
3481 return NtUserRedrawWindow( hwnd, rect, hrgn, flags );
3484 NTSTATUS WINAPI wow64_NtUserRegisterHotKey( UINT *args )
3486 HWND hwnd = get_handle( &args );
3487 INT id = get_ulong( &args );
3488 UINT modifiers = get_ulong( &args );
3489 UINT vk = get_ulong( &args );
3491 return NtUserRegisterHotKey( hwnd, id, modifiers, vk );
3494 NTSTATUS WINAPI wow64_NtUserRegisterRawInputDevices( UINT *args )
3496 const RAWINPUTDEVICE32 *devices32 = get_ptr( &args );
3497 UINT count = get_ulong( &args );
3498 UINT size = get_ulong( &args );
3500 RAWINPUTDEVICE *devices64;
3501 unsigned int i;
3503 if (size != sizeof(RAWINPUTDEVICE32))
3505 set_last_error32( ERROR_INVALID_PARAMETER );
3506 return FALSE;
3509 if (!(devices64 = Wow64AllocateTemp( count * sizeof(*devices64) )))
3511 set_last_error32( ERROR_NOT_ENOUGH_MEMORY );
3512 return FALSE;
3515 for (i = 0; i < count; ++i)
3517 devices64[i].usUsagePage = devices32[i].usUsagePage;
3518 devices64[i].usUsage = devices32[i].usUsage;
3519 devices64[i].dwFlags = devices32[i].dwFlags;
3520 devices64[i].hwndTarget = UlongToPtr( devices32[i].hwndTarget );
3523 return NtUserRegisterRawInputDevices( devices64, count, sizeof(*devices64) );
3526 NTSTATUS WINAPI wow64_NtUserReleaseDC( UINT *args )
3528 HWND hwnd = get_handle( &args );
3529 HDC hdc = get_handle( &args );
3531 return NtUserReleaseDC( hwnd, hdc );
3534 NTSTATUS WINAPI wow64_NtUserRemoveClipboardFormatListener( UINT *args )
3536 HWND hwnd = get_handle( &args );
3538 return NtUserRemoveClipboardFormatListener( hwnd );
3541 NTSTATUS WINAPI wow64_NtUserRemoveMenu( UINT *args )
3543 HMENU handle = get_handle( &args );
3544 UINT id = get_ulong( &args );
3545 UINT flags = get_ulong( &args );
3547 return NtUserRemoveMenu( handle, id, flags );
3550 NTSTATUS WINAPI wow64_NtUserRemoveProp( UINT *args )
3552 HWND hwnd = get_handle( &args );
3553 const WCHAR *str = get_ptr( &args );
3555 return HandleToUlong( NtUserRemoveProp( hwnd, str ));
3558 NTSTATUS WINAPI wow64_NtUserScrollDC( UINT *args )
3560 HDC hdc = get_handle( &args );
3561 INT dx = get_ulong( &args );
3562 INT dy = get_ulong( &args );
3563 const RECT *scroll = get_ptr( &args );
3564 const RECT *clip = get_ptr( &args );
3565 HRGN ret_update_rgn = get_handle( &args );
3566 RECT *update_rect = get_ptr( &args );
3568 return NtUserScrollDC( hdc, dx, dy, scroll, clip, ret_update_rgn, update_rect );
3571 NTSTATUS WINAPI wow64_NtUserScrollWindowEx( UINT *args )
3573 HWND hwnd = get_handle( &args );
3574 INT dx = get_ulong( &args );
3575 INT dy = get_ulong( &args );
3576 const RECT *rect = get_ptr( &args );
3577 const RECT *clip_rect = get_ptr( &args );
3578 HRGN update_rgn = get_handle( &args );
3579 RECT *update_rect = get_ptr( &args );
3580 UINT flags = get_ulong( &args );
3582 return NtUserScrollWindowEx( hwnd, dx, dy, rect, clip_rect, update_rgn, update_rect, flags );
3585 NTSTATUS WINAPI wow64_NtUserSelectPalette( UINT *args )
3587 HDC hdc = get_handle( &args );
3588 HPALETTE hpal = get_handle( &args );
3589 WORD bkg = get_ulong( &args );
3591 return HandleToUlong( NtUserSelectPalette( hdc, hpal, bkg ));
3594 NTSTATUS WINAPI wow64_NtUserSendInput( UINT *args )
3596 UINT count = get_ulong( &args );
3597 INPUT32 *inputs32 = get_ptr( &args );
3598 int size = get_ulong( &args );
3600 INPUT *inputs = NULL;
3601 unsigned int i;
3603 if (size != sizeof(*inputs32) || !count)
3605 set_last_error32( ERROR_INVALID_PARAMETER );
3606 return 0;
3609 if (!inputs32)
3611 set_last_error32( ERROR_NOACCESS );
3612 return 0;
3615 if (count && !(inputs = Wow64AllocateTemp( count * sizeof(*inputs) )))
3616 return 0;
3618 for (i = 0; i < count; i++)
3620 inputs[i].type = inputs32[i].type;
3621 switch (inputs[i].type)
3623 case INPUT_MOUSE:
3624 inputs[i].mi.dx = inputs32[i].mi.dx;
3625 inputs[i].mi.dy = inputs32[i].mi.dy;
3626 inputs[i].mi.mouseData = inputs32[i].mi.mouseData;
3627 inputs[i].mi.dwFlags = inputs32[i].mi.dwFlags;
3628 inputs[i].mi.time = inputs32[i].mi.time;
3629 inputs[i].mi.dwExtraInfo = inputs32[i].mi.dwExtraInfo;
3630 break;
3631 case INPUT_KEYBOARD:
3632 inputs[i].ki.wVk = inputs32[i].ki.wVk;
3633 inputs[i].ki.wScan = inputs32[i].ki.wScan;
3634 inputs[i].ki.dwFlags = inputs32[i].ki.dwFlags;
3635 inputs[i].ki.time = inputs32[i].ki.time;
3636 inputs[i].ki.dwExtraInfo = inputs32[i].ki.dwExtraInfo;
3637 break;
3638 case INPUT_HARDWARE:
3639 inputs[i].hi = inputs32[i].hi;
3640 break;
3644 return NtUserSendInput( count, inputs, sizeof(*inputs) );
3647 NTSTATUS WINAPI wow64_NtUserSetActiveWindow( UINT *args )
3649 HWND hwnd = get_handle( &args );
3651 return HandleToUlong( NtUserSetActiveWindow( hwnd ));
3654 NTSTATUS WINAPI wow64_NtUserSetCapture( UINT *args )
3656 HWND hwnd = get_handle( &args );
3658 return HandleToUlong( NtUserSetCapture( hwnd ));
3661 NTSTATUS WINAPI wow64_NtUserSetClassLong( UINT *args )
3663 HWND hwnd = get_handle( &args );
3664 INT offset = get_ulong( &args );
3665 LONG newval = get_ulong( &args );
3666 BOOL ansi = get_ulong( &args );
3668 return NtUserSetClassLong( hwnd, offset, newval, ansi );
3671 NTSTATUS WINAPI wow64_NtUserSetClassLongPtr( UINT *args )
3673 HWND hwnd = get_handle( &args );
3674 INT offset = get_ulong( &args );
3675 LONG_PTR newval = get_ulong( &args );
3676 BOOL ansi = get_ulong( &args );
3678 if (offset == GCLP_MENUNAME)
3680 struct client_menu_name menu_name;
3681 struct client_menu_name32 *menu_name32 = UlongToPtr( newval );
3682 NtUserSetClassLongPtr( hwnd, offset,
3683 (UINT_PTR)client_menu_name_32to64( &menu_name, menu_name32 ), ansi );
3684 client_menu_name_64to32( &menu_name, menu_name32 );
3685 return 0;
3688 return NtUserSetClassLongPtr( hwnd, offset, newval, ansi );
3691 NTSTATUS WINAPI wow64_NtUserSetClassWord( UINT *args )
3693 HWND hwnd = get_handle( &args );
3694 INT offset = get_ulong( &args );
3695 WORD newval = get_ulong( &args );
3697 return NtUserSetClassWord( hwnd, offset, newval );
3700 NTSTATUS WINAPI wow64_NtUserSetClipboardData( UINT *args )
3702 UINT format = get_ulong( &args );
3703 HANDLE handle = get_handle( &args );
3704 struct
3706 UINT32 data;
3707 UINT32 size;
3708 BOOL cache_only;
3709 UINT seqno;
3710 } *params32 = get_ptr( &args );
3712 struct set_clipboard_params params;
3713 params.data = UlongToPtr( params32->data );
3714 params.size = params32->size;
3715 params.cache_only = params32->cache_only;
3716 params.seqno = params32->seqno;
3718 return NtUserSetClipboardData( format, handle, &params );
3721 NTSTATUS WINAPI wow64_NtUserSetClipboardViewer( UINT *args )
3723 HWND hwnd = get_handle( &args );
3725 return HandleToUlong( NtUserSetClipboardViewer( hwnd ));
3728 NTSTATUS WINAPI wow64_NtUserSetCursor( UINT *args )
3730 HCURSOR cursor = get_handle( &args );
3732 return HandleToUlong( NtUserSetCursor( cursor ));
3735 NTSTATUS WINAPI wow64_NtUserSetCursorIconData( UINT *args )
3737 HCURSOR cursor = get_handle( &args );
3738 UNICODE_STRING32 *module32 = get_ptr( &args );
3739 UNICODE_STRING32 *res_name32 = get_ptr( &args );
3740 struct
3742 UINT flags;
3743 UINT num_steps;
3744 UINT num_frames;
3745 UINT delay;
3746 ULONG frames;
3747 ULONG frame_seq;
3748 ULONG frame_rates;
3749 ULONG rsrc;
3750 } *desc32 = get_ptr( &args );
3751 struct
3753 UINT width;
3754 UINT height;
3755 ULONG color;
3756 ULONG alpha;
3757 ULONG mask;
3758 POINT hotspot;
3759 } *frames32 = UlongToPtr( desc32->frames );
3761 UNICODE_STRING module, res_name;
3762 struct cursoricon_desc desc;
3763 UINT i, num_frames;
3765 num_frames = max( desc32->num_frames, 1 );
3766 if (!(desc.frames = Wow64AllocateTemp( num_frames * sizeof(*desc.frames) ))) return FALSE;
3767 desc.flags = desc32->flags;
3768 desc.num_steps = desc32->num_steps;
3769 desc.num_frames = desc32->num_frames;
3770 desc.delay = desc32->delay;
3771 desc.frame_seq = UlongToPtr( desc32->frame_seq );
3772 desc.frame_rates = UlongToPtr( desc32->frame_rates );
3773 desc.rsrc = UlongToPtr( desc32->rsrc );
3775 for (i = 0; i < num_frames; i++)
3777 desc.frames[i].width = frames32[i].width;
3778 desc.frames[i].height = frames32[i].height;
3779 desc.frames[i].color = UlongToHandle( frames32[i].color );
3780 desc.frames[i].alpha = UlongToHandle( frames32[i].alpha );
3781 desc.frames[i].mask = UlongToHandle( frames32[i].mask );
3782 desc.frames[i].hotspot = frames32[i].hotspot;
3785 return NtUserSetCursorIconData( cursor, unicode_str_32to64( &module, module32 ),
3786 unicode_str_32to64( &res_name, res_name32), &desc );
3789 NTSTATUS WINAPI wow64_NtUserSetCursorPos( UINT *args )
3791 INT x = get_ulong( &args );
3792 INT y = get_ulong( &args );
3794 return NtUserSetCursorPos( x, y );
3797 NTSTATUS WINAPI wow64_NtUserSetFocus( UINT *args )
3799 HWND hwnd = get_handle( &args );
3801 return HandleToUlong( NtUserSetFocus( hwnd ));
3804 NTSTATUS WINAPI wow64_NtUserSetInternalWindowPos( UINT *args )
3806 HWND hwnd = get_handle( &args );
3807 UINT cmd = get_ulong( &args );
3808 RECT *rect = get_ptr( &args );
3809 POINT *pt = get_ptr( &args );
3811 NtUserSetInternalWindowPos( hwnd, cmd, rect, pt );
3812 return 0;
3815 NTSTATUS WINAPI wow64_NtUserSetKeyboardState( UINT *args )
3817 BYTE *state = get_ptr( &args );
3819 return NtUserSetKeyboardState( state );
3822 NTSTATUS WINAPI wow64_NtUserSetLayeredWindowAttributes( UINT *args )
3824 HWND hwnd = get_handle( &args );
3825 COLORREF key = get_ulong( &args );
3826 BYTE alpha = get_ulong( &args );
3827 DWORD flags = get_ulong( &args );
3829 return NtUserSetLayeredWindowAttributes( hwnd, key, alpha, flags );
3832 NTSTATUS WINAPI wow64_NtUserSetMenu( UINT *args )
3834 HWND hwnd = get_handle( &args );
3835 HMENU menu = get_handle( &args );
3837 return NtUserSetMenu( hwnd, menu );
3840 NTSTATUS WINAPI wow64_NtUserSetMenuContextHelpId( UINT *args )
3842 HMENU menu = get_handle( &args );
3843 DWORD id = get_ulong( &args );
3845 return NtUserSetMenuContextHelpId( menu, id );
3848 NTSTATUS WINAPI wow64_NtUserSetMenuDefaultItem( UINT *args )
3850 HMENU handle = get_handle( &args );
3851 UINT item = get_ulong( &args );
3852 UINT bypos = get_ulong( &args );
3854 return NtUserSetMenuDefaultItem( handle, item, bypos );
3857 NTSTATUS WINAPI wow64_NtUserSetObjectInformation( UINT *args )
3859 HANDLE handle = get_handle( &args );
3860 INT index = get_ulong( &args );
3861 void *info = get_ptr( &args );
3862 DWORD len = get_ulong( &args );
3864 return NtUserSetObjectInformation( handle, index, info, len );
3867 NTSTATUS WINAPI wow64_NtUserSetParent( UINT *args )
3869 HWND hwnd = get_handle( &args );
3870 HWND parent = get_handle( &args );
3872 return HandleToUlong( NtUserSetParent( hwnd, parent ));
3875 NTSTATUS WINAPI wow64_NtUserSetProcessDpiAwarenessContext( UINT *args )
3877 ULONG awareness = get_ulong( &args );
3878 ULONG unknown = get_ulong( &args );
3880 return NtUserSetProcessDpiAwarenessContext( awareness, unknown );
3883 NTSTATUS WINAPI wow64_NtUserSetProcessWindowStation( UINT *args )
3885 HWINSTA handle = get_handle( &args );
3887 return NtUserSetProcessWindowStation( handle );
3890 NTSTATUS WINAPI wow64_NtUserSetProp( UINT *args )
3892 HWND hwnd = get_handle( &args );
3893 const WCHAR *str = get_ptr( &args );
3894 HANDLE handle = get_handle( &args );
3896 return NtUserSetProp( hwnd, str, handle );
3899 NTSTATUS WINAPI wow64_NtUserSetScrollInfo( UINT *args )
3901 HWND hwnd = get_handle( &args );
3902 INT bar = get_ulong( &args );
3903 const SCROLLINFO *info = get_ptr( &args );
3904 BOOL redraw = get_ulong( &args );
3906 return NtUserSetScrollInfo( hwnd, bar, info, redraw );
3909 NTSTATUS WINAPI wow64_NtUserSetShellWindowEx( UINT *args )
3911 HWND shell = get_handle( &args );
3912 HWND list_view = get_handle( &args );
3914 return NtUserSetShellWindowEx( shell, list_view );
3917 NTSTATUS WINAPI wow64_NtUserSetSysColors( UINT *args )
3919 INT count = get_ulong( &args );
3920 const INT *colors = get_ptr( &args );
3921 const COLORREF *values = get_ptr( &args );
3923 return NtUserSetSysColors( count, colors, values );
3926 NTSTATUS WINAPI wow64_NtUserSetSystemMenu( UINT *args )
3928 HWND hwnd = get_handle( &args );
3929 HMENU menu = get_handle( &args );
3931 return NtUserSetSystemMenu( hwnd, menu );
3934 NTSTATUS WINAPI wow64_NtUserSetSystemTimer( UINT *args )
3936 HWND hwnd = get_handle( &args );
3937 UINT_PTR id = get_ulong( &args );
3938 UINT timeout = get_ulong( &args );
3940 return NtUserSetSystemTimer( hwnd, id, timeout );
3943 NTSTATUS WINAPI wow64_NtUserSetThreadDesktop( UINT *args )
3945 HDESK handle = get_handle( &args );
3947 return NtUserSetThreadDesktop( handle );
3950 NTSTATUS WINAPI wow64_NtUserSetTimer( UINT *args )
3952 HWND hwnd = get_handle( &args );
3953 UINT_PTR id = get_ulong( &args );
3954 UINT timeout = get_ulong( &args );
3955 TIMERPROC proc = get_ptr( &args );
3956 ULONG tolerance = get_ulong( &args );
3958 return NtUserSetTimer( hwnd, id, timeout, proc, tolerance );
3961 NTSTATUS WINAPI wow64_NtUserSetWinEventHook( UINT *args )
3963 DWORD event_min = get_ulong( &args );
3964 DWORD event_max = get_ulong( &args );
3965 HMODULE inst = get_ptr( &args );
3966 UNICODE_STRING32 *module32 = get_ptr( &args );
3967 WINEVENTPROC proc = get_ptr(&args );
3968 DWORD pid = get_ulong( &args );
3969 DWORD tid = get_ulong( &args );
3970 DWORD flags = get_ulong( &args );
3971 UNICODE_STRING module;
3972 HWINEVENTHOOK ret;
3974 ret = NtUserSetWinEventHook( event_min, event_max, inst,
3975 unicode_str_32to64( &module, module32 ),
3976 proc, pid, tid, flags );
3977 return HandleToUlong( ret );
3980 NTSTATUS WINAPI wow64_NtUserSetWindowLong( UINT *args )
3982 HWND hwnd = get_handle( &args );
3983 INT offset = get_ulong( &args );
3984 LONG newval = get_ulong( &args );
3985 BOOL ansi = get_ulong( &args );
3987 switch (offset)
3989 case GWLP_HINSTANCE:
3990 case GWLP_WNDPROC:
3991 return NtUserSetWindowLongPtr( hwnd, offset, (ULONG)newval, ansi );
3994 return NtUserSetWindowLong( hwnd, offset, newval, ansi );
3997 NTSTATUS WINAPI wow64_NtUserSetWindowLongPtr( UINT *args )
3999 HWND hwnd = get_handle( &args );
4000 INT offset = get_ulong( &args );
4001 LONG_PTR newval = get_ulong( &args );
4002 BOOL ansi = get_ulong( &args );
4004 return NtUserSetWindowLongPtr( hwnd, offset, newval, ansi );
4007 NTSTATUS WINAPI wow64_NtUserSetWindowPlacement( UINT *args )
4009 HWND hwnd = get_handle( &args );
4010 const WINDOWPLACEMENT *wpl = get_ptr( &args );
4012 return NtUserSetWindowPlacement( hwnd, wpl );
4015 NTSTATUS WINAPI wow64_NtUserSetWindowPos( UINT *args )
4017 HWND hwnd = get_handle( &args );
4018 HWND after = get_handle( &args );
4019 INT x = get_ulong( &args );
4020 INT y = get_ulong( &args );
4021 INT cx = get_ulong( &args );
4022 INT cy = get_ulong( &args );
4023 UINT flags = get_ulong( &args );
4025 return NtUserSetWindowPos( hwnd, after, x, y, cx, cy, flags );
4028 NTSTATUS WINAPI wow64_NtUserSetWindowRgn( UINT *args )
4030 HWND hwnd = get_handle( &args );
4031 HRGN hrgn = get_handle( &args );
4032 BOOL redraw = get_ulong( &args );
4034 return NtUserSetWindowRgn( hwnd, hrgn, redraw );
4037 NTSTATUS WINAPI wow64_NtUserSetWindowWord( UINT *args )
4039 HWND hwnd = get_handle( &args );
4040 INT offset = get_ulong( &args );
4041 WORD newval = get_ulong( &args );
4043 return NtUserSetWindowWord( hwnd, offset, newval );
4046 NTSTATUS WINAPI wow64_NtUserSetWindowsHookEx( UINT *args )
4048 HINSTANCE inst = get_ptr( &args );
4049 UNICODE_STRING32 *module32 = get_ptr( &args );
4050 DWORD tid = get_ulong( &args );
4051 INT id = get_ulong( &args );
4052 HOOKPROC proc = get_ptr( &args );
4053 BOOL ansi = get_ulong( &args );
4054 UNICODE_STRING module;
4055 HHOOK ret;
4057 ret = NtUserSetWindowsHookEx( inst, unicode_str_32to64( &module, module32 ),
4058 tid, id, proc, ansi );
4059 return HandleToUlong( ret );
4062 NTSTATUS WINAPI wow64_NtUserShowCaret( UINT *args )
4064 HWND hwnd = get_handle( &args );
4066 return NtUserShowCaret( hwnd );
4069 NTSTATUS WINAPI wow64_NtUserShowCursor( UINT *args )
4071 BOOL show = get_ulong( &args );
4073 return NtUserShowCursor( show );
4076 NTSTATUS WINAPI wow64_NtUserShowScrollBar( UINT *args )
4078 HWND hwnd = get_handle( &args );
4079 INT bar = get_ulong( &args );
4080 BOOL show = get_ulong( &args );
4082 return NtUserShowScrollBar( hwnd, bar, show );
4085 NTSTATUS WINAPI wow64_NtUserShowWindow( UINT *args )
4087 HWND hwnd = get_handle( &args );
4088 INT cmd = get_ulong( &args );
4090 return NtUserShowWindow( hwnd, cmd );
4093 NTSTATUS WINAPI wow64_NtUserShowWindowAsync( UINT *args )
4095 HWND hwnd = get_handle( &args );
4096 INT cmd = get_ulong( &args );
4098 return NtUserShowWindowAsync( hwnd, cmd );
4101 NTSTATUS WINAPI wow64_NtUserSystemParametersInfo( UINT *args )
4103 UINT action = get_ulong( &args );
4104 UINT val = get_ulong( &args );
4105 void *ptr = get_ptr( &args );
4106 UINT winini = get_ulong( &args );
4108 switch (action)
4110 case SPI_GETSERIALKEYS:
4111 if (ptr)
4113 struct
4115 UINT cbSize;
4116 DWORD dwFlags;
4117 ULONG lpszActivePort;
4118 ULONG lpszPort;
4119 UINT iBaudRate;
4120 UINT iPortState;
4121 UINT iActive;
4122 } *keys32 = ptr;
4123 SERIALKEYSW keys;
4125 if (keys32->cbSize != sizeof(*keys32)) return FALSE;
4126 keys.cbSize = sizeof(keys);
4127 if (!NtUserSystemParametersInfo( action, val, &keys, winini )) return FALSE;
4128 keys32->dwFlags = keys.dwFlags;
4129 keys32->lpszActivePort = PtrToUlong( keys.lpszActivePort );
4130 keys32->lpszPort = PtrToUlong( keys.lpszPort );
4131 keys32->iBaudRate = keys.iBaudRate;
4132 keys32->iPortState = keys.iPortState;
4133 keys32->iActive = keys.iActive;
4134 return TRUE;
4136 break;
4138 case SPI_GETSOUNDSENTRY:
4139 if (ptr)
4141 struct
4143 UINT cbSize;
4144 DWORD dwFlags;
4145 DWORD iFSTextEffect;
4146 DWORD iFSTextEffectMSec;
4147 DWORD iFSTextEffectColorBits;
4148 DWORD iFSGrafEffect;
4149 DWORD iFSGrafEffectMSec;
4150 DWORD iFSGrafEffectColor;
4151 DWORD iWindowsEffect;
4152 DWORD iWindowsEffectMSec;
4153 ULONG lpszWindowsEffectDLL;
4154 DWORD iWindowsEffectOrdinal;
4155 } *entry32 = ptr;
4156 SOUNDSENTRYW entry;
4158 if (entry32->cbSize != sizeof(*entry32)) return FALSE;
4159 entry.cbSize = sizeof(entry);
4160 if (!NtUserSystemParametersInfo( action, val, &entry, winini )) return FALSE;
4161 entry32->dwFlags = entry.dwFlags;
4162 entry32->iFSTextEffect = entry.iFSTextEffect;
4163 entry32->iFSTextEffectMSec = entry.iFSTextEffectMSec;
4164 entry32->iFSTextEffectColorBits = entry.iFSTextEffectColorBits;
4165 entry32->iFSGrafEffect = entry.iFSGrafEffect;
4166 entry32->iFSGrafEffectMSec = entry.iFSGrafEffectMSec;
4167 entry32->iFSGrafEffectColor = entry.iFSGrafEffectColor;
4168 entry32->iWindowsEffect = entry.iWindowsEffect;
4169 entry32->iWindowsEffectMSec = entry.iWindowsEffectMSec;
4170 entry32->lpszWindowsEffectDLL = PtrToUlong( entry.lpszWindowsEffectDLL );
4171 entry32->iWindowsEffectOrdinal = entry.iWindowsEffectOrdinal;
4172 return TRUE;
4174 break;
4176 case SPI_GETHIGHCONTRAST:
4177 if (ptr)
4179 struct
4181 UINT cbSize;
4182 DWORD dwFlags;
4183 ULONG lpszDefaultScheme;
4184 } *info32 = ptr;
4185 HIGHCONTRASTW info;
4187 if (info32->cbSize != sizeof(*info32)) return FALSE;
4188 info.cbSize = sizeof(info);
4189 if (!NtUserSystemParametersInfo( action, val, &info, winini )) return FALSE;
4190 info32->dwFlags = info.dwFlags;
4191 info32->lpszDefaultScheme = PtrToUlong( info.lpszDefaultScheme );
4192 return TRUE;
4194 break;
4197 return NtUserSystemParametersInfo( action, val, ptr, winini );
4200 NTSTATUS WINAPI wow64_NtUserSystemParametersInfoForDpi( UINT *args )
4202 UINT action = get_ulong( &args );
4203 UINT val = get_ulong( &args );
4204 void *ptr = get_ptr( &args );
4205 UINT winini = get_ulong( &args );
4206 UINT dpi = get_ulong( &args );
4208 return NtUserSystemParametersInfoForDpi( action, val, ptr, winini, dpi );
4211 NTSTATUS WINAPI wow64_NtUserThunkedMenuInfo( UINT *args )
4213 HMENU menu = get_handle( &args );
4214 MENUINFO32 *info32 = get_ptr( &args );
4215 MENUINFO info;
4217 if (info32)
4219 info.cbSize = sizeof(info);
4220 info.fMask = info32->fMask;
4221 info.dwStyle = info32->dwStyle;
4222 info.cyMax = info32->cyMax;
4223 info.hbrBack = UlongToHandle( info32->hbrBack );
4224 info.dwContextHelpID = info32->dwContextHelpID;
4225 info.dwMenuData = info32->dwMenuData;
4228 return NtUserThunkedMenuInfo( menu, info32 ? &info : NULL );
4231 NTSTATUS WINAPI wow64_NtUserThunkedMenuItemInfo( UINT *args )
4233 HMENU handle = get_handle( &args );
4234 UINT pos = get_ulong( &args );
4235 UINT flags = get_ulong( &args );
4236 UINT method = get_ulong( &args );
4237 MENUITEMINFOW32 *info32 = get_ptr( &args );
4238 UNICODE_STRING32 *str32 = get_ptr( &args );
4239 MENUITEMINFOW info = { sizeof(info) }, *info_ptr;
4240 UNICODE_STRING str;
4241 UINT ret;
4243 if (info32)
4245 info.cbSize = sizeof(info);
4246 info.fMask = info32->fMask;
4247 switch (method)
4249 case NtUserSetMenuItemInfo:
4250 case NtUserInsertMenuItem:
4251 info.fType = info32->fType;
4252 info.fState = info32->fState;
4253 info.wID = info32->wID;
4254 info.hSubMenu = LongToHandle( info32->hSubMenu );
4255 info.hbmpChecked = UlongToHandle( info32->hbmpChecked );
4256 info.hbmpUnchecked = UlongToHandle( info32->hbmpUnchecked );
4257 info.dwItemData = info32->dwItemData;
4258 info.dwTypeData = UlongToPtr( info32->dwTypeData );
4259 info.cch = info32->cch;
4260 info.hbmpItem = UlongToHandle( info32->hbmpItem );
4261 break;
4262 case NtUserCheckMenuRadioItem:
4263 info.cch = info32->cch;
4264 break;
4265 case NtUserGetMenuItemInfoA:
4266 case NtUserGetMenuItemInfoW:
4267 info.dwTypeData = UlongToPtr( info32->dwTypeData );
4268 info.cch = info32->cch;
4269 break;
4271 info_ptr = &info;
4273 else info_ptr = NULL;
4275 ret = NtUserThunkedMenuItemInfo( handle, pos, flags, method, info_ptr,
4276 unicode_str_32to64( &str, str32 ));
4278 if (info_ptr)
4280 switch (method)
4282 case NtUserGetMenuItemInfoA:
4283 case NtUserGetMenuItemInfoW:
4284 if (info.fMask & (MIIM_TYPE | MIIM_STRING | MIIM_FTYPE))
4285 info32->fType = info.fType;
4286 if (info.fMask & (MIIM_TYPE | MIIM_BITMAP))
4287 info32->hbmpItem = HandleToUlong( info.hbmpItem );
4288 if (info.fMask & (MIIM_TYPE | MIIM_STRING))
4290 info32->dwTypeData = (UINT_PTR)info.dwTypeData;
4291 info32->cch = info.cch;
4293 if (info.fMask & MIIM_STATE) info32->fState = info.fState;
4294 if (info.fMask & MIIM_ID) info32->wID = info.wID;
4295 info32->hSubMenu = HandleToUlong( info.hSubMenu );
4296 if (info.fMask & MIIM_CHECKMARKS)
4298 info32->hbmpChecked = HandleToUlong( info.hbmpChecked );
4299 info32->hbmpUnchecked = HandleToUlong( info.hbmpUnchecked );
4301 if (info.fMask & MIIM_DATA) info32->dwItemData = info.dwItemData;
4302 break;
4306 return ret;
4309 NTSTATUS WINAPI wow64_NtUserToUnicodeEx( UINT *args )
4311 UINT virt = get_ulong( &args );
4312 UINT scan = get_ulong( &args );
4313 const BYTE *state = get_ptr( &args );
4314 WCHAR *str = get_ptr( &args );
4315 int size = get_ulong( &args );
4316 UINT flags = get_ulong( &args );
4317 HKL layout = get_handle( &args );
4319 return NtUserToUnicodeEx( virt, scan, state, str, size, flags, layout );
4322 NTSTATUS WINAPI wow64_NtUserTrackMouseEvent( UINT *args )
4324 struct
4326 DWORD cbSize;
4327 DWORD dwFlags;
4328 UINT32 hwndTrack;
4329 DWORD dwHoverTime;
4330 } *info32 = get_ptr( &args );
4331 TRACKMOUSEEVENT info;
4332 BOOL ret;
4334 if (info32->cbSize != sizeof(*info32))
4336 set_last_error32( ERROR_INVALID_PARAMETER );
4337 return FALSE;
4340 info.cbSize = sizeof(info);
4341 info.dwFlags = info32->dwFlags;
4342 info.hwndTrack = LongToHandle( info32->hwndTrack );
4343 info.dwHoverTime = info32->dwHoverTime;
4344 ret = NtUserTrackMouseEvent( &info );
4345 info32->dwFlags = info.dwFlags;
4346 info32->hwndTrack = HandleToUlong( info.hwndTrack );
4347 info32->dwHoverTime = info.dwHoverTime;
4348 return ret;
4351 NTSTATUS WINAPI wow64_NtUserTrackPopupMenuEx( UINT *args )
4353 HMENU handle = get_handle( &args );
4354 UINT flags = get_ulong( &args );
4355 int x = get_ulong( &args );
4356 int y = get_ulong( &args );
4357 HWND hwnd = get_handle( &args );
4358 TPMPARAMS *params = get_ptr( &args );
4360 return NtUserTrackPopupMenuEx( handle, flags, x, y, hwnd, params );
4363 NTSTATUS WINAPI wow64_NtUserTranslateAccelerator( UINT *args )
4365 HWND hwnd = get_handle( &args );
4366 HACCEL accel = get_handle( &args );
4367 MSG32 *msg32 = get_ptr( &args );
4369 MSG msg;
4371 return NtUserTranslateAccelerator( hwnd, accel, msg_32to64( &msg, msg32 ));
4374 NTSTATUS WINAPI wow64_NtUserTranslateMessage( UINT *args )
4376 const MSG32 *msg32 = get_ptr( &args );
4377 UINT flags = get_ulong( &args );
4378 MSG msg;
4380 return NtUserTranslateMessage( msg_32to64( &msg, msg32 ), flags );
4383 NTSTATUS WINAPI wow64_NtUserUnhookWinEvent( UINT *args )
4385 HWINEVENTHOOK handle = get_handle( &args );
4387 return NtUserUnhookWinEvent( handle );
4390 NTSTATUS WINAPI wow64_NtUserUnhookWindowsHookEx( UINT *args )
4392 HHOOK handle = get_handle( &args );
4394 return NtUserUnhookWindowsHookEx( handle );
4397 NTSTATUS WINAPI wow64_NtUserUnregisterClass( UINT *args )
4399 UNICODE_STRING32 *name32 = get_ptr( &args );
4400 HINSTANCE instance = get_ptr( &args );
4401 struct client_menu_name32 *menu_name32 = get_ptr( &args );
4403 UNICODE_STRING name;
4404 struct client_menu_name menu_name;
4405 BOOL ret;
4407 ret = NtUserUnregisterClass( unicode_str_32to64( &name, name32 ), instance, &menu_name );
4408 if (ret) client_menu_name_64to32( &menu_name, menu_name32 );
4409 return ret;
4412 NTSTATUS WINAPI wow64_NtUserUnregisterHotKey( UINT *args )
4414 HWND hwnd = get_handle( &args );
4415 int id = get_ulong( &args );
4417 return NtUserUnregisterHotKey( hwnd, id );
4420 NTSTATUS WINAPI wow64_NtUserUpdateInputContext( UINT *args )
4422 HIMC handle = get_handle( &args );
4423 UINT attr = get_ulong( &args );
4424 UINT_PTR value = get_ulong( &args );
4426 return NtUserUpdateInputContext( handle, attr, value );
4429 NTSTATUS WINAPI wow64_NtUserUpdateLayeredWindow( UINT *args )
4431 HWND hwnd = get_handle( &args );
4432 HDC hdc_dst = get_handle( &args );
4433 const POINT *pts_dst = get_ptr( &args );
4434 const SIZE *size = get_ptr( &args );
4435 HDC hdc_src = get_handle( &args );
4436 const POINT *pts_src = get_ptr( &args );
4437 COLORREF key = get_ulong( &args );
4438 const BLENDFUNCTION *blend = get_ptr( &args );
4439 DWORD flags = get_ulong( &args );
4440 const RECT *dirty = get_ptr( &args );
4442 return NtUserUpdateLayeredWindow( hwnd, hdc_dst, pts_dst, size, hdc_src, pts_src,
4443 key, blend, flags, dirty );
4446 NTSTATUS WINAPI wow64_NtUserValidateRect( UINT *args )
4448 HWND hwnd = get_handle( &args );
4449 const RECT *rect = get_ptr( &args );
4451 return NtUserValidateRect( hwnd, rect );
4454 NTSTATUS WINAPI wow64_NtUserVkKeyScanEx( UINT *args )
4456 WCHAR chr = get_ulong( &args );
4457 HKL layout = get_handle( &args );
4459 return NtUserVkKeyScanEx( chr, layout );
4462 NTSTATUS WINAPI wow64_NtUserWaitForInputIdle( UINT *args )
4464 HANDLE process = get_handle( &args );
4465 DWORD timeout = get_ulong( &args );
4466 BOOL wow = get_ulong( &args );
4468 return NtUserWaitForInputIdle( process, timeout, wow );
4471 NTSTATUS WINAPI wow64_NtUserWaitMessage( UINT *args )
4473 return NtUserWaitMessage();
4476 NTSTATUS WINAPI wow64_NtUserWindowFromDC( UINT *args )
4478 HDC hdc = get_handle( &args );
4480 return HandleToUlong( NtUserWindowFromDC( hdc ));
4483 NTSTATUS WINAPI wow64_NtUserWindowFromPoint( UINT *args )
4485 LONG x = get_ulong( &args );
4486 LONG y = get_ulong( &args );
4488 return HandleToUlong( NtUserWindowFromPoint( x, y ));
4491 NTSTATUS WINAPI wow64_NtUserDisplayConfigGetDeviceInfo( UINT *args )
4493 DISPLAYCONFIG_DEVICE_INFO_HEADER *packet = get_ptr( &args );
4495 return NtUserDisplayConfigGetDeviceInfo( packet );
4498 NTSTATUS WINAPI wow64___wine_send_input( UINT *args )
4500 ERR( "not supported\n" );
4501 return 0;