dxgi: Create d3d11 swapchain textures directly from d3d11_swapchain_init().
[wine.git] / dlls / wow64win / user.c
blobe1ce2dd8321dba2653bb1168fc17da3c644f94a7
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 LONG lResult;
159 LONG lParam;
160 LONG wParam;
161 DWORD message;
162 ULONG hwnd;
163 } CWPRETSTRUCT32;
165 typedef struct
167 ULONG hwnd;
168 ULONG hwndInsertAfter;
169 INT x;
170 INT y;
171 INT cx;
172 INT cy;
173 UINT flags;
174 } WINDOWPOS32;
176 typedef struct
178 UINT CtlType;
179 UINT CtlID;
180 UINT itemID;
181 UINT itemWidth;
182 UINT itemHeight;
183 ULONG itemData;
184 } MEASUREITEMSTRUCT32;
186 typedef struct
188 UINT CtlType;
189 UINT CtlID;
190 UINT itemID;
191 UINT itemAction;
192 UINT itemState;
193 ULONG hwndItem;
194 ULONG hDC;
195 RECT rcItem;
196 ULONG itemData;
197 } DRAWITEMSTRUCT32;
199 typedef struct
201 ULONG lParam;
202 ULONG wParam;
203 UINT message;
204 ULONG hwnd;
205 } CWPSTRUCT32;
207 typedef struct
209 POINT pt;
210 ULONG hwnd;
211 UINT wHitTestCode;
212 ULONG dwExtraInfo;
213 DWORD mouseData;
214 } MOUSEHOOKSTRUCTEX32;
216 typedef struct
218 POINT pt;
219 DWORD mouseData;
220 DWORD flags;
221 DWORD time;
222 ULONG dwExtraInfo;
223 } MSLLHOOKSTRUCT32;
225 typedef struct
227 DWORD vkCode;
228 DWORD scanCode;
229 DWORD flags;
230 DWORD time;
231 ULONG dwExtraInfo;
232 } KBDLLHOOKSTRUCT32;
234 typedef struct
236 UINT message;
237 UINT paramL;
238 UINT paramH;
239 DWORD time;
240 ULONG hwnd;
241 } EVENTMSG32;
243 typedef struct
245 BOOL fMouse;
246 ULONG hWndActive;
247 } CBTACTIVATESTRUCT32;
249 typedef struct
251 UINT CtlType;
252 UINT CtlID;
253 UINT itemID;
254 ULONG hwndItem;
255 ULONG itemData;
256 } DELETEITEMSTRUCT32;
258 typedef struct
260 UINT cbSize;
261 UINT style;
262 ULONG lpfnWndProc;
263 INT cbClsExtra;
264 INT cbWndExtra;
265 ULONG hInstance;
266 ULONG hIcon;
267 ULONG hCursor;
268 ULONG hbrBackground;
269 ULONG lpszMenuName;
270 ULONG lpszClassName;
271 ULONG hIconSm;
272 } WNDCLASSEXW32;
274 struct client_menu_name32
276 ULONG nameA;
277 ULONG nameW;
278 ULONG nameUS;
281 struct win_proc_params32
283 ULONG func;
284 ULONG hwnd;
285 UINT msg;
286 ULONG wparam;
287 ULONG lparam;
288 ULONG result;
289 BOOL ansi;
290 BOOL ansi_dst;
291 BOOL needs_unpack;
292 enum wm_char_mapping mapping;
293 ULONG dpi_awareness;
294 ULONG procA;
295 ULONG procW;
298 struct win_event_hook_params32
300 DWORD event;
301 ULONG hwnd;
302 LONG object_id;
303 LONG child_id;
304 ULONG handle;
305 DWORD tid;
306 DWORD time;
307 ULONG proc;
308 WCHAR module[MAX_PATH];
311 struct draw_text_params32
313 ULONG hdc;
314 int count;
315 RECT rect;
316 ULONG ret_rect;
317 UINT flags;
318 WCHAR str[1];
321 struct unpack_dde_message_params32
323 ULONG result;
324 ULONG hwnd;
325 UINT message;
326 LONG wparam;
327 LONG lparam;
328 char data[1];
331 static MSG *msg_32to64( MSG *msg, const MSG32 *msg32 )
333 if (!msg32) return NULL;
335 msg->hwnd = LongToHandle( msg32->hwnd );
336 msg->message = msg32->message;
337 msg->wParam = msg32->wParam;
338 msg->lParam = msg32->lParam;
339 msg->time = msg32->time;
340 msg->pt = msg32->pt;
341 return msg;
344 static MSG32 *msg_64to32( const MSG *msg, MSG32 *msg32 )
346 if (!msg32) return NULL;
348 msg32->hwnd = HandleToUlong( msg->hwnd );
349 msg32->message = msg->message;
350 msg32->wParam = msg->wParam;
351 msg32->lParam = msg->lParam;
352 msg32->time = msg->time;
353 msg32->pt = msg->pt;
354 return msg32;
357 static struct client_menu_name *client_menu_name_32to64( struct client_menu_name *name,
358 const struct client_menu_name32 *name32 )
360 if (!name32) return NULL;
361 name->nameA = UlongToPtr( name32->nameA );
362 name->nameW = UlongToPtr( name32->nameW );
363 name->nameUS = UlongToPtr( name32->nameUS );
364 return name;
367 static struct client_menu_name32 *client_menu_name_64to32( const struct client_menu_name *name,
368 struct client_menu_name32 *name32 )
370 if (name32)
372 name32->nameA = PtrToUlong( name->nameA );
373 name32->nameW = PtrToUlong( name->nameW );
374 name32->nameUS = PtrToUlong( name->nameUS );
376 return name32;
379 static void win_proc_params_64to32( const struct win_proc_params *src, struct win_proc_params32 *dst,
380 ULONG *result )
382 dst->func = PtrToUlong( src->func );
383 dst->hwnd = HandleToUlong( src->hwnd );
384 dst->msg = src->msg;
385 dst->wparam = src->wparam;
386 dst->lparam = src->lparam;
387 dst->result = PtrToUlong( result );
388 dst->ansi = src->ansi;
389 dst->ansi_dst = src->ansi_dst;
390 dst->needs_unpack = src->needs_unpack;
391 dst->mapping = src->mapping;
392 dst->dpi_awareness = HandleToUlong( src->dpi_awareness );
393 dst->procA = PtrToUlong( src->procA );
394 dst->procW = PtrToUlong( src->procW );
397 static void createstruct_32to64( const CREATESTRUCT32 *from, CREATESTRUCTW *to )
400 to->lpCreateParams = UlongToPtr( from->lpCreateParams );
401 to->hInstance = UlongToPtr( from->hInstance );
402 to->hMenu = LongToHandle( from->hMenu );
403 to->hwndParent = LongToHandle( from->hwndParent );
404 to->cy = from->cy;
405 to->cx = from->cx;
406 to->y = from->y;
407 to->x = from->x;
408 to->style = from->style;
409 to->dwExStyle = from->dwExStyle;
410 to->lpszName = UlongToPtr( from->lpszName );
411 to->lpszClass = UlongToPtr( from->lpszClass );
414 static void createstruct_64to32( const CREATESTRUCTW *from, CREATESTRUCT32 *to )
416 to->lpCreateParams = PtrToUlong( from->lpCreateParams );
417 to->hInstance = PtrToUlong( from->hInstance );
418 to->hMenu = HandleToUlong( from->hMenu );
419 to->hwndParent = HandleToUlong( from->hwndParent );
420 to->cy = from->cy;
421 to->cx = from->cx;
422 to->y = from->y;
423 to->x = from->x;
424 to->style = from->style;
425 to->dwExStyle = from->dwExStyle;
428 static void winpos_32to64( WINDOWPOS *dst, const WINDOWPOS32 *src )
430 dst->hwnd = LongToHandle( src->hwnd );
431 dst->hwndInsertAfter = LongToHandle( src->hwndInsertAfter );
432 dst->x = src->x;
433 dst->y = src->y;
434 dst->cx = src->cx;
435 dst->cy = src->cy;
436 dst->flags = src->flags;
439 static void winpos_64to32( const WINDOWPOS *src, WINDOWPOS32 *dst )
441 dst->hwnd = HandleToUlong( src->hwnd );
442 dst->hwndInsertAfter = HandleToUlong( src->hwndInsertAfter );
443 dst->x = src->x;
444 dst->y = src->y;
445 dst->cx = src->cx;
446 dst->cy = src->cy;
447 dst->flags = src->flags;
450 static PAINTSTRUCT *paintstruct_32to64( PAINTSTRUCT *ps, const PAINTSTRUCT32 *ps32 )
452 if (!ps32) return NULL;
453 ps->hdc = ULongToHandle( ps32->hdc );
454 ps->fErase = ps32->fErase;
455 ps->rcPaint = ps32->rcPaint;
456 ps->fRestore = ps32->fRestore;
457 ps->fIncUpdate = ps32->fIncUpdate;
458 return ps;
461 static MOUSEHOOKSTRUCTEX32 *mousehookstruct_64to32( const MOUSEHOOKSTRUCTEX *hook,
462 MOUSEHOOKSTRUCTEX32 *hook32 )
464 if (!hook) return NULL;
466 hook32->pt = hook->pt;
467 hook32->hwnd = HandleToUlong( hook->hwnd );
468 hook32->wHitTestCode = hook->wHitTestCode;
469 hook32->dwExtraInfo = hook->dwExtraInfo;
470 hook32->mouseData = hook->mouseData;
471 return hook32;
474 static NTSTATUS dispatch_callback( ULONG id, void *args, ULONG len )
476 void *ret_ptr;
477 ULONG ret_len;
478 NTSTATUS status = Wow64KiUserCallbackDispatcher( id, args, len, &ret_ptr, &ret_len );
479 return NtCallbackReturn( ret_ptr, ret_len, status );
482 static NTSTATUS WINAPI wow64_NtUserCallEnumDisplayMonitor( void *arg, ULONG size )
484 struct enum_display_monitor_params *params = arg;
485 struct
487 ULONG proc;
488 ULONG monitor;
489 ULONG hdc;
490 RECT rect;
491 ULONG lparam;
492 } params32;
494 params32.proc = PtrToUlong( params->proc );
495 params32.monitor = HandleToUlong( params->monitor );
496 params32.hdc = HandleToUlong( params->hdc );
497 params32.rect = params->rect;
498 params32.lparam = params->lparam;
499 return dispatch_callback( NtUserCallEnumDisplayMonitor, &params32, sizeof(params32) );
502 static NTSTATUS WINAPI wow64_NtUserCallSendAsyncCallback( void *arg, ULONG size )
504 struct send_async_params *params = arg;
505 struct
507 ULONG callback;
508 ULONG hwnd;
509 UINT msg;
510 ULONG data;
511 ULONG result;
512 } params32;
514 params32.callback = PtrToUlong( params->callback );
515 params32.hwnd = HandleToUlong( params->hwnd );
516 params32.msg = params->msg;
517 params32.data = params->data;
518 params32.result = params->result;
519 return dispatch_callback( NtUserCallSendAsyncCallback, &params32, sizeof(params32) );
522 static NTSTATUS WINAPI wow64_NtUserCallWinEventHook( void *arg, ULONG size )
524 struct win_event_hook_params *params = arg;
525 struct win_event_hook_params32 params32;
527 params32.event = params->event;
528 params32.hwnd = HandleToUlong( params->hwnd );
529 params32.object_id = params->object_id;
530 params32.child_id = params->child_id;
531 params32.handle = HandleToUlong( params->handle );
532 params32.tid = params->tid;
533 params32.time = params->time;
534 params32.proc = PtrToUlong( params->proc );
536 size -= FIELD_OFFSET( struct win_event_hook_params, module );
537 if (size) memcpy( params32.module, params->module, size );
538 return dispatch_callback( NtUserCallWinEventHook, &params32,
539 FIELD_OFFSET( struct win_event_hook_params32, module ) + size);
542 static NTSTATUS WINAPI wow64_NtUserCallWinProc( void *arg, ULONG size )
544 struct win_proc_params *params = arg;
545 struct win_proc_params32 params32_buf, *params32 = &params32_buf;
546 LONG result32 = 0;
547 LRESULT result;
548 void *ret_ptr;
549 ULONG ret_len;
550 NTSTATUS status;
552 if (size > sizeof(*params))
554 if (!(params32 = Wow64AllocateTemp( size - sizeof(*params) + sizeof(*params32) )))
555 return 0;
556 memcpy( params32 + 1, params + 1, size - sizeof(*params) );
558 win_proc_params_64to32( params, params32, NULL );
560 status = Wow64KiUserCallbackDispatcher( NtUserCallWinProc, params32,
561 size - sizeof(*params) + sizeof(*params32),
562 &ret_ptr, &ret_len );
563 if (ret_len == sizeof(result32)) result32 = *(LONG *)ret_ptr;
564 result = result32;
566 if (params->result)
568 *params->result = result;
569 return status;
571 return NtCallbackReturn( &result, sizeof(result), status );
574 static UINT hook_lparam_64to32( struct win_hook_params *params, const void *lp, void *lp32 )
576 if (!params->lparam_size) return 0;
578 switch (params->id)
580 case WH_SYSMSGFILTER:
581 case WH_MSGFILTER:
582 case WH_GETMESSAGE:
583 msg_64to32( lp, lp32 );
584 return sizeof(MSG32);
586 case WH_CBT:
587 switch (params->code)
589 case HCBT_CREATEWND:
590 if (lp)
592 const CREATESTRUCTW *cs = lp;
593 CREATESTRUCT32 *cs32 = lp32;
594 createstruct_64to32( cs, cs32 );
595 cs32->lpszName = PtrToUlong( cs->lpszName );
596 cs32->lpszClass = PtrToUlong( cs->lpszClass );
598 return sizeof(CREATESTRUCT32);
600 case HCBT_ACTIVATE:
601 if (lp)
603 const CBTACTIVATESTRUCT *cbt = lp;
604 CBTACTIVATESTRUCT32 *cbt32 = lp32;
605 cbt32->fMouse = cbt->fMouse;
606 cbt32->hWndActive = HandleToUlong( cbt->hWndActive );
608 return sizeof(CBTACTIVATESTRUCT32);
610 case HCBT_CLICKSKIPPED:
611 mousehookstruct_64to32( lp, lp32 );
612 return sizeof(MOUSEHOOKSTRUCTEX32);
614 break;
616 case WH_CALLWNDPROC:
617 if (lp)
619 const CWPSTRUCT *cwp = lp;
620 CWPSTRUCT32 *cwp32 = lp32;
621 cwp32->lParam = cwp->lParam;
622 cwp32->wParam = cwp->wParam;
623 cwp32->message = cwp->message;
624 cwp32->hwnd = HandleToUlong( cwp->hwnd );
626 return sizeof(CWPSTRUCT32);
628 case WH_CALLWNDPROCRET:
629 if (lp)
631 const CWPRETSTRUCT *cwpret = lp;
632 CWPRETSTRUCT32 *cwpret32 = lp32;
633 cwpret32->lResult = cwpret->lResult;
634 cwpret32->lParam = cwpret->lParam;
635 cwpret32->wParam = cwpret->wParam;
636 cwpret32->message = cwpret->message;
637 cwpret32->hwnd = HandleToUlong( cwpret->hwnd );
639 return sizeof(CWPRETSTRUCT32);
641 case WH_MOUSE:
642 mousehookstruct_64to32( lp, lp32 );
643 return sizeof(MOUSEHOOKSTRUCTEX32);
645 case WH_MOUSE_LL:
646 if (lp)
648 const MSLLHOOKSTRUCT *hook = lp;
649 MSLLHOOKSTRUCT32 *hook32 = lp32;
650 hook32->pt = hook->pt;
651 hook32->mouseData = hook->mouseData;
652 hook32->flags = hook->flags;
653 hook32->time = hook->time;
654 hook32->dwExtraInfo = hook->dwExtraInfo;
656 return sizeof(MSLLHOOKSTRUCT32);
658 case WH_KEYBOARD_LL:
659 if (lp)
661 const KBDLLHOOKSTRUCT *hook = lp;
662 KBDLLHOOKSTRUCT32 *hook32 = lp32;
663 hook32->vkCode = hook->vkCode;
664 hook32->scanCode = hook->scanCode;
665 hook32->flags = hook->flags;
666 hook32->time = hook->time;
667 hook32->dwExtraInfo = hook->dwExtraInfo;
669 return sizeof(KBDLLHOOKSTRUCT32);
671 case WH_JOURNALRECORD:
672 if (lp)
674 const EVENTMSG *event = lp;
675 EVENTMSG32 *event32 = lp32;
677 event32->message = event->message;
678 event32->paramL = event->paramL;
679 event32->paramH = event->paramH;
680 event32->time = event->time;
681 event32->hwnd = HandleToUlong( event->hwnd );
683 return sizeof(EVENTMSG32);
686 if (lp) memcpy( lp32, lp, params->lparam_size );
687 return params->lparam_size;
690 static NTSTATUS WINAPI wow64_NtUserCallWindowsHook( void *arg, ULONG size )
692 struct win_hook_params *params = arg;
693 struct
695 ULONG proc;
696 ULONG handle;
697 DWORD pid;
698 DWORD tid;
699 int id;
700 int code;
701 ULONG wparam;
702 ULONG lparam;
703 UINT lparam_size;
704 BOOL prev_unicode;
705 BOOL next_unicode;
706 } *params32;
707 void *ret_lparam = (void *)params->lparam;
708 UINT lparam32_size = 0, module_size, size32;
709 void *ret_ptr;
710 ULONG ret_len;
711 NTSTATUS ret;
713 lparam32_size = hook_lparam_64to32( params, NULL, NULL );
714 module_size = size - params->lparam_size - sizeof(*params);
716 size32 = sizeof(*params32) + lparam32_size + module_size;
717 if (!(params32 = Wow64AllocateTemp( size32 ))) return 0;
718 params32->proc = (UINT_PTR)params->proc;
719 params32->handle = HandleToUlong( params->handle );
720 params32->pid = params->pid;
721 params32->tid = params->tid;
722 params32->id = params->id;
723 params32->code = params->code;
724 params32->wparam = params->wparam;
725 params32->lparam = params->lparam_size ? 0 : params->lparam;
726 params32->lparam_size = lparam32_size;
727 params32->prev_unicode = params->prev_unicode;
728 params32->next_unicode = params->next_unicode;
729 if (lparam32_size) hook_lparam_64to32( params, params + 1, params32 + 1 );
730 if (module_size)
731 memcpy( (char *)(params32 + 1) + params32->lparam_size,
732 (const char *)params + size - module_size, module_size );
734 ret = Wow64KiUserCallbackDispatcher( NtUserCallWindowsHook, params32, size32, &ret_ptr, &ret_len );
736 switch (params->id)
738 case WH_SYSMSGFILTER:
739 case WH_MSGFILTER:
740 case WH_GETMESSAGE:
741 msg_32to64( (MSG *)(params + 1), (const MSG32 *)(params32 + 1) );
742 if (ret_lparam)
744 memcpy( ret_lparam, params + 1, params->lparam_size );
745 return ret;
747 return NtCallbackReturn( params + 1, params->lparam_size, ret );
750 return ret;
753 static NTSTATUS WINAPI wow64_NtUserCopyImage( void *arg, ULONG size )
755 struct copy_image_params *params = arg;
756 struct
758 ULONG hwnd;
759 UINT type;
760 INT dx;
761 INT dy;
762 UINT flags;
763 } params32;
765 params32.hwnd = HandleToUlong( params->hwnd );
766 params32.type = params->type;
767 params32.dx = params->dx;
768 params32.dy = params->dy;
769 params32.flags = params->flags;
770 return dispatch_callback( NtUserCopyImage, &params32, sizeof(params32) );
773 static NTSTATUS WINAPI wow64_NtUserDrawNonClientButton( void *arg, ULONG size )
775 struct draw_non_client_button_params *params = arg;
776 struct
778 ULONG hwnd;
779 ULONG hdc;
780 enum NONCLIENT_BUTTON_TYPE type;
781 RECT rect;
782 BOOL down;
783 BOOL grayed;
784 } params32;
786 params32.hwnd = HandleToUlong( params->hwnd );
787 params32.hdc = HandleToUlong( params->hdc );
788 params32.type = params->type;
789 params32.rect = params->rect;
790 params32.down = params->down;
791 params32.grayed = params->grayed;
792 return dispatch_callback( NtUserDrawNonClientButton, &params32, sizeof(params32) );
795 static NTSTATUS WINAPI wow64_NtUserDrawScrollBar( void *arg, ULONG size )
797 struct draw_scroll_bar_params *params = arg;
798 struct
800 ULONG hwnd;
801 ULONG hdc;
802 INT bar;
803 UINT hit_test;
804 struct
806 ULONG win;
807 INT bar;
808 INT thumb_pos;
809 INT thumb_val;
810 BOOL vertical;
811 enum SCROLL_HITTEST hit_test;
812 } tracking_info;
813 BOOL arrows;
814 BOOL interior;
815 RECT rect;
816 UINT enable_flags;
817 INT arrow_size;
818 INT thumb_pos;
819 INT thumb_size;
820 BOOL vertical;
821 } params32;
823 params32.hwnd = HandleToUlong( params->hwnd );
824 params32.hdc = HandleToUlong( params->hdc );
825 params32.bar = params->bar;
826 params32.hit_test = params->hit_test;
827 params32.tracking_info.win = HandleToUlong( params->tracking_info.win );
828 params32.tracking_info.bar = params->tracking_info.bar;
829 params32.tracking_info.thumb_pos = params->tracking_info.thumb_pos;
830 params32.tracking_info.thumb_val = params->tracking_info.thumb_val;
831 params32.tracking_info.vertical = params->tracking_info.vertical;
832 params32.tracking_info.hit_test = params->tracking_info.hit_test;
833 params32.arrows = params->arrows;
834 params32.interior = params->interior;
835 params32.rect = params->rect;
836 params32.enable_flags = params->enable_flags;
837 params32.arrow_size = params->arrow_size;
838 params32.thumb_pos = params->thumb_pos;
839 params32.thumb_size = params->thumb_size;
840 params32.vertical = params->vertical;
841 return dispatch_callback( NtUserDrawScrollBar, &params32, sizeof(params32) );
844 static NTSTATUS WINAPI wow64_NtUserDrawText( void *arg, ULONG size )
846 struct draw_text_params *params = arg;
847 struct draw_text_params32 *params32;
848 RECT *rect_ptr = params->ret_rect;
849 ULONG ret_len;
850 void *ret_ptr;
851 NTSTATUS ret;
853 params32 = (struct draw_text_params32 *)(params + 1) - 1;
854 params32->flags = params->flags;
855 params32->ret_rect = 0;
856 params32->rect = params->rect;
857 params32->count = params->count;
858 params32->hdc = HandleToUlong( params->hdc );
860 ret = Wow64KiUserCallbackDispatcher( NtUserDrawText, params32,
861 size - sizeof(*params) + sizeof(*params32), &ret_ptr, &ret_len );
862 if (ret_len == sizeof(RECT) && rect_ptr)
864 *rect_ptr = *(const RECT *)ret_ptr;
865 return ret;
867 return NtCallbackReturn( ret_ptr, ret_len, ret );
870 static NTSTATUS WINAPI wow64_NtUserFreeCachedClipboardData( void *arg, ULONG size )
872 struct free_cached_data_params *params = arg;
873 struct
875 UINT format;
876 ULONG handle;
877 } params32;
879 params32.format = params->format;
880 params32.handle = HandleToUlong( params->handle );
881 return dispatch_callback( NtUserFreeCachedClipboardData, &params32, sizeof(params32) );
884 static NTSTATUS WINAPI wow64_NtUserImmProcessKey( void *arg, ULONG size )
886 struct imm_process_key_params *params = arg;
887 struct
889 ULONG hwnd;
890 ULONG hkl;
891 UINT vkey;
892 ULONG key_data;
893 } params32;
895 params32.hwnd = HandleToUlong( params->hwnd );
896 params32.hkl = HandleToUlong( params->hkl );
897 params32.vkey = params->vkey;
898 params32.key_data = params->key_data;
899 return dispatch_callback( NtUserImmProcessKey, &params32, sizeof(params32) );
902 static NTSTATUS WINAPI wow64_NtUserImmTranslateMessage( void *arg, ULONG size )
904 FIXME( "\n" );
905 return 0;
908 static NTSTATUS WINAPI wow64_NtUserInitBuiltinClasses( void *arg, ULONG size )
910 return dispatch_callback( NtUserInitBuiltinClasses, arg, size );
913 static NTSTATUS WINAPI wow64_NtUserLoadDriver( void *arg, ULONG size )
915 return dispatch_callback( NtUserLoadDriver, arg, size );
918 static NTSTATUS WINAPI wow64_NtUserLoadImage( void *arg, ULONG size )
920 struct load_image_params *params = arg;
921 struct
923 ULONG hinst;
924 ULONG name;
925 UINT type;
926 INT dx;
927 INT dy;
928 UINT flags;
929 } params32;
931 params32.hinst = PtrToUlong( params->hinst );
932 params32.name = PtrToUlong( params->name );
933 params32.type = params->type;
934 params32.dx = params->dx;
935 params32.dy = params->dy;
936 params32.flags = params->flags;
937 return dispatch_callback( NtUserLoadImage, &params32, sizeof(params32) );
940 static NTSTATUS WINAPI wow64_NtUserLoadSysMenu( void *arg, ULONG size )
942 return dispatch_callback( NtUserLoadSysMenu, arg, size );
945 static NTSTATUS WINAPI wow64_NtUserPostDDEMessage( void *arg, ULONG size )
947 struct post_dde_message_params *params = arg;
948 struct
950 ULONG hwnd;
951 UINT msg;
952 LONG wparam;
953 LONG lparam;
954 DWORD dest_tid;
955 DWORD type;
956 } params32;
958 params32.hwnd = HandleToUlong( params->hwnd );
959 params32.msg = params->msg;
960 params32.wparam = params->wparam;
961 params32.lparam = params->lparam;
962 params32.dest_tid = params->dest_tid;
963 params32.type = params->type;
964 return dispatch_callback( NtUserPostDDEMessage, &params32, sizeof(params32) );
967 static NTSTATUS WINAPI wow64_NtUserRenderSynthesizedFormat( void *arg, ULONG size )
969 return dispatch_callback( NtUserRenderSynthesizedFormat, arg, size );
972 static NTSTATUS WINAPI wow64_NtUserUnpackDDEMessage( void *arg, ULONG size )
974 struct unpack_dde_message_params *params = arg;
975 struct unpack_dde_message_params32 *params32;
976 struct unpack_dde_message_result result;
977 struct
979 LONG wparam;
980 LONG lparam;
981 } *result32;
982 void *ret_ptr;
983 ULONG ret_len;
985 size -= FIELD_OFFSET( struct unpack_dde_message_params, data );
986 if (!(params32 = Wow64AllocateTemp( FIELD_OFFSET( struct unpack_dde_message_params32, data[size] ))))
987 return 0;
989 params32->result = 0;
990 params32->hwnd = HandleToUlong( params->hwnd );
991 params32->message = params->message;
992 params32->wparam = params->wparam;
993 params32->lparam = params->lparam;
994 if (size) memcpy( params32->data, params->data, size );
995 size = FIELD_OFFSET( struct unpack_dde_message_params32, data[size] );
997 if (!Wow64KiUserCallbackDispatcher( NtUserUnpackDDEMessage, params32, size, &ret_ptr, &ret_len ))
998 return FALSE;
999 if (ret_len == sizeof(*result32))
1001 result32 = ret_ptr;
1002 result.wparam = result32->wparam;
1003 result.lparam = result32->lparam;
1006 if (!params->result) NtCallbackReturn( &result, sizeof(result), TRUE );
1007 *params->result = result;
1008 return TRUE;
1011 static NTSTATUS WINAPI wow64_NtUserCallFreeIcon( void *arg, ULONG size )
1013 return dispatch_callback( NtUserCallFreeIcon, arg, size );
1016 static NTSTATUS WINAPI wow64_NtUserThunkLock( void *arg, ULONG size )
1018 return dispatch_callback( NtUserThunkLock, arg, size );
1021 static NTSTATUS WINAPI wow64_NtUserCallVulkanDebugReportCallback( void *arg, ULONG size )
1023 FIXME( "\n" );
1024 return 0;
1027 static NTSTATUS WINAPI wow64_NtUserCallVulkanDebugUtilsCallback( void *arg, ULONG size )
1029 FIXME( "\n" );
1030 return 0;
1033 static NTSTATUS WINAPI wow64_NtUserCallOpenGLDebugMessageCallback( void *arg, ULONG size )
1035 FIXME( "\n" );
1036 return 0;
1039 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst0( void *arg, ULONG size )
1041 return dispatch_callback( NtUserDriverCallbackFirst + 0, arg, size );
1044 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst1( void *arg, ULONG size )
1046 return dispatch_callback( NtUserDriverCallbackFirst + 1, arg, size );
1049 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst2( void *arg, ULONG size )
1051 return dispatch_callback( NtUserDriverCallbackFirst + 2, arg, size );
1054 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst3( void *arg, ULONG size )
1056 return dispatch_callback( NtUserDriverCallbackFirst + 3, arg, size );
1059 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst4( void *arg, ULONG size )
1061 return dispatch_callback( NtUserDriverCallbackFirst + 4, arg, size );
1064 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst5( void *arg, ULONG size )
1066 return dispatch_callback( NtUserDriverCallbackFirst + 5, arg, size );
1069 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst6( void *arg, ULONG size )
1071 return dispatch_callback( NtUserDriverCallbackFirst + 6, arg, size );
1074 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst7( void *arg, ULONG size )
1076 return dispatch_callback( NtUserDriverCallbackFirst + 7, arg, size );
1079 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst8( void *arg, ULONG size )
1081 return dispatch_callback( NtUserDriverCallbackFirst + 8, arg, size );
1084 static NTSTATUS WINAPI wow64_NtUserDriverCallbackFirst9( void *arg, ULONG size )
1086 return dispatch_callback( NtUserDriverCallbackFirst + 9, arg, size );
1089 user_callback user_callbacks[] =
1091 /* user32 callbacks */
1092 wow64_NtUserCallEnumDisplayMonitor,
1093 wow64_NtUserCallSendAsyncCallback,
1094 wow64_NtUserCallWinEventHook,
1095 wow64_NtUserCallWinProc,
1096 wow64_NtUserCallWindowsHook,
1097 wow64_NtUserCopyImage,
1098 wow64_NtUserDrawNonClientButton,
1099 wow64_NtUserDrawScrollBar,
1100 wow64_NtUserDrawText,
1101 wow64_NtUserFreeCachedClipboardData,
1102 wow64_NtUserImmProcessKey,
1103 wow64_NtUserImmTranslateMessage,
1104 wow64_NtUserInitBuiltinClasses,
1105 wow64_NtUserLoadDriver,
1106 wow64_NtUserLoadImage,
1107 wow64_NtUserLoadSysMenu,
1108 wow64_NtUserPostDDEMessage,
1109 wow64_NtUserRenderSynthesizedFormat,
1110 wow64_NtUserUnpackDDEMessage,
1111 /* win16 hooks */
1112 wow64_NtUserCallFreeIcon,
1113 wow64_NtUserThunkLock,
1114 /* Vulkan support */
1115 wow64_NtUserCallVulkanDebugReportCallback,
1116 wow64_NtUserCallVulkanDebugUtilsCallback,
1117 /* OpenGL support */
1118 wow64_NtUserCallOpenGLDebugMessageCallback,
1119 /* Driver-specific callbacks */
1120 wow64_NtUserDriverCallbackFirst0,
1121 wow64_NtUserDriverCallbackFirst1,
1122 wow64_NtUserDriverCallbackFirst2,
1123 wow64_NtUserDriverCallbackFirst3,
1124 wow64_NtUserDriverCallbackFirst4,
1125 wow64_NtUserDriverCallbackFirst5,
1126 wow64_NtUserDriverCallbackFirst6,
1127 wow64_NtUserDriverCallbackFirst7,
1128 wow64_NtUserDriverCallbackFirst8,
1129 wow64_NtUserDriverCallbackFirst9,
1132 C_ASSERT( ARRAYSIZE(user_callbacks) == NtUserCallCount );
1134 NTSTATUS WINAPI wow64_NtUserActivateKeyboardLayout( UINT *args )
1136 HKL layout = get_handle( &args );
1137 UINT flags = get_ulong( &args );
1139 return HandleToUlong( NtUserActivateKeyboardLayout( layout, flags ));
1142 NTSTATUS WINAPI wow64_NtUserAddClipboardFormatListener( UINT *args )
1144 HWND hwnd = get_handle( &args );
1146 return NtUserAddClipboardFormatListener( hwnd );
1149 NTSTATUS WINAPI wow64_NtUserAssociateInputContext( UINT *args )
1151 HWND hwnd = get_handle( &args );
1152 HIMC ctx = get_handle( &args );
1153 ULONG flags = get_ulong( &args );
1155 return NtUserAssociateInputContext( hwnd, ctx, flags );
1158 NTSTATUS WINAPI wow64_NtUserAttachThreadInput( UINT *args )
1160 DWORD from = get_ulong( &args );
1161 DWORD to = get_ulong( &args );
1162 BOOL attach = get_ulong( &args );
1164 return NtUserAttachThreadInput( from, to, attach );
1167 NTSTATUS WINAPI wow64_NtUserBeginPaint( UINT *args )
1169 HWND hwnd = get_handle( &args );
1170 PAINTSTRUCT32 *ps32 = get_ptr( &args );
1172 PAINTSTRUCT ps;
1173 HDC ret;
1175 ret = NtUserBeginPaint( hwnd, ps32 ? & ps : NULL );
1176 if (ret && ps32)
1178 ps32->hdc = HandleToUlong( ps.hdc );
1179 ps32->fErase = ps.fErase;
1180 ps32->rcPaint = ps.rcPaint;
1182 return HandleToUlong( ret );
1185 NTSTATUS WINAPI wow64_NtUserBuildHimcList( UINT *args )
1187 ULONG thread_id = get_ulong( &args );
1188 ULONG count = get_ulong( &args );
1189 UINT32 *buffer32 = get_ptr( &args );
1190 UINT *size = get_ptr( &args );
1192 HIMC *buffer;
1193 ULONG i;
1194 NTSTATUS status;
1196 if (!(buffer = Wow64AllocateTemp( count * sizeof(*buffer) ))) return STATUS_NO_MEMORY;
1198 if ((status = NtUserBuildHimcList( thread_id, count, buffer, size ))) return status;
1200 for (i = 0; i < *size; i++) buffer32[i] = HandleToUlong( buffer[i] );
1201 return status;
1204 NTSTATUS WINAPI wow64_NtUserBuildHwndList( UINT *args )
1206 HDESK desktop = get_handle( &args );
1207 ULONG unk2 = get_ulong( &args );
1208 ULONG unk3 = get_ulong( &args );
1209 ULONG unk4 = get_ulong( &args );
1210 ULONG thread_id = get_ulong( &args );
1211 ULONG count = get_ulong( &args );
1212 UINT32 *buffer32 = get_ptr( &args );
1213 ULONG *size = get_ptr( &args );
1215 HWND *buffer;
1216 ULONG i;
1217 NTSTATUS status;
1219 if (!(buffer = Wow64AllocateTemp( count * sizeof(*buffer) ))) return STATUS_NO_MEMORY;
1221 if ((status = NtUserBuildHwndList( desktop, unk2, unk3, unk4, thread_id, count, buffer, size )))
1222 return status;
1224 for (i = 0; i < *size; i++)
1225 buffer32[i] = HandleToUlong( buffer[i] );
1226 return status;
1229 NTSTATUS WINAPI wow64_NtUserCallHwnd( UINT *args )
1231 HWND hwnd = get_handle( &args );
1232 DWORD code = get_ulong( &args );
1234 return NtUserCallHwnd( hwnd, code );
1237 NTSTATUS WINAPI wow64_NtUserCallHwndParam( UINT *args )
1239 HWND hwnd = get_handle( &args );
1240 DWORD_PTR param = get_ulong( &args );
1241 DWORD code = get_ulong( &args );
1243 switch (code)
1245 case NtUserCallHwndParam_GetScrollInfo:
1247 struct
1249 int bar;
1250 ULONG info;
1251 } *info32 = UlongToPtr( param );
1252 struct get_scroll_info_params info;
1254 info.bar = info32->bar;
1255 info.info = UlongToPtr( info32->info );
1256 return NtUserCallHwndParam( hwnd, (UINT_PTR)&info, code );
1259 case NtUserCallHwndParam_MapWindowPoints:
1261 struct
1263 ULONG hwnd_to;
1264 ULONG points;
1265 UINT count;
1266 } *params32 = UlongToPtr( param );
1267 struct map_window_points_params params;
1269 params.hwnd_to = LongToHandle( params32->hwnd_to );
1270 params.points = UlongToPtr( params32->points );
1271 params.count = params32->count;
1272 return NtUserCallHwndParam( hwnd, (UINT_PTR)&params, code );
1275 default:
1276 return NtUserCallHwndParam( hwnd, param, code );
1280 NTSTATUS WINAPI wow64_NtUserCallMsgFilter( UINT *args )
1282 MSG32 *msg32 = get_ptr( &args );
1283 INT code = get_ulong( &args );
1284 MSG msg;
1285 BOOL ret;
1287 ret = NtUserCallMsgFilter( msg_32to64( &msg, msg32 ), code );
1288 msg_64to32( &msg, msg32 );
1289 return ret;
1292 NTSTATUS WINAPI wow64_NtUserCallNextHookEx( UINT *args )
1294 HHOOK hhook = get_handle( &args );
1295 INT code = get_ulong( &args );
1296 WPARAM wparam = get_ulong( &args );
1297 LPARAM lparam = get_ulong( &args );
1299 return NtUserCallNextHookEx( hhook, code, wparam, lparam );
1302 NTSTATUS WINAPI wow64_NtUserCallNoParam( UINT *args )
1304 ULONG code = get_ulong( &args );
1306 return NtUserCallNoParam( code );
1309 NTSTATUS WINAPI wow64_NtUserCallOneParam( UINT *args )
1311 ULONG_PTR arg = get_ulong( &args );
1312 ULONG code = get_ulong( &args );
1314 return NtUserCallOneParam( arg, code );
1317 NTSTATUS WINAPI wow64_NtUserCallTwoParam( UINT *args )
1319 ULONG_PTR arg1 = get_ulong( &args );
1320 ULONG_PTR arg2 = get_ulong( &args );
1321 ULONG code = get_ulong( &args );
1323 switch (code)
1325 case NtUserCallTwoParam_GetMenuInfo:
1327 MENUINFO32 *info32 = UlongToPtr( arg2 );
1328 MENUINFO info;
1330 if (!info32 || info32->cbSize != sizeof(*info32))
1332 set_last_error32( ERROR_INVALID_PARAMETER );
1333 return FALSE;
1336 info.cbSize = sizeof(info);
1337 info.fMask = info32->fMask;
1338 if (!NtUserCallTwoParam( arg1, (UINT_PTR)&info, code )) return FALSE;
1339 if (info.fMask & MIM_BACKGROUND) info32->hbrBack = HandleToUlong( info.hbrBack );
1340 if (info.fMask & MIM_HELPID) info32->dwContextHelpID = info.dwContextHelpID;
1341 if (info.fMask & MIM_MAXHEIGHT) info32->cyMax = info.cyMax;
1342 if (info.fMask & MIM_MENUDATA) info32->dwMenuData = info.dwMenuData;
1343 if (info.fMask & MIM_STYLE) info32->dwStyle = info.dwStyle;
1344 return TRUE;
1347 default:
1348 return NtUserCallTwoParam( arg1, arg2, code );
1352 NTSTATUS WINAPI wow64_NtUserChangeClipboardChain( UINT *args )
1354 HWND hwnd = get_handle( &args );
1355 HWND next = get_handle( &args );
1357 return NtUserChangeClipboardChain( hwnd, next );
1360 NTSTATUS WINAPI wow64_NtUserChangeDisplaySettings( UINT *args )
1362 UNICODE_STRING32 *devname32 = get_ptr( &args );
1363 DEVMODEW *devmode = get_ptr( &args );
1364 HWND hwnd = get_handle( &args );
1365 DWORD flags = get_ulong( &args );
1366 void *lparam = get_ptr( &args );
1368 UNICODE_STRING devname;
1370 return NtUserChangeDisplaySettings( unicode_str_32to64( &devname, devname32 ),
1371 devmode, hwnd, flags, lparam );
1374 NTSTATUS WINAPI wow64_NtUserCheckMenuItem( UINT *args )
1376 HMENU handle = get_handle( &args );
1377 UINT id = get_ulong( &args );
1378 UINT flags = get_ulong( &args );
1380 return NtUserCheckMenuItem( handle, id, flags );
1383 NTSTATUS WINAPI wow64_NtUserChildWindowFromPointEx( UINT *args )
1385 HWND parent = get_handle( &args );
1386 LONG x = get_ulong( &args );
1387 LONG y = get_ulong( &args );
1388 UINT flags = get_ulong( &args );
1390 return HandleToUlong( NtUserChildWindowFromPointEx( parent, x, y, flags ));
1393 NTSTATUS WINAPI wow64_NtUserClipCursor( UINT *args )
1395 const RECT *rect = get_ptr( &args );
1397 return NtUserClipCursor( rect );
1400 NTSTATUS WINAPI wow64_NtUserCloseClipboard( UINT *args )
1402 return NtUserCloseClipboard();
1405 NTSTATUS WINAPI wow64_NtUserCloseDesktop( UINT *args )
1407 HDESK handle = get_handle( &args );
1409 return NtUserCloseDesktop( handle );
1412 NTSTATUS WINAPI wow64_NtUserCloseWindowStation( UINT *args )
1414 HWINSTA handle = get_handle( &args );
1416 return NtUserCloseWindowStation( handle );
1419 NTSTATUS WINAPI wow64_NtUserCopyAcceleratorTable( UINT *args )
1421 HACCEL src = get_handle( &args );
1422 ACCEL *dst = get_ptr( &args );
1423 INT count = get_ulong( &args );
1425 return NtUserCopyAcceleratorTable( src, dst, count );
1428 NTSTATUS WINAPI wow64_NtUserCountClipboardFormats( UINT *args )
1430 return NtUserCountClipboardFormats();
1433 NTSTATUS WINAPI wow64_NtUserCreateAcceleratorTable( UINT *args )
1435 ACCEL *table = get_ptr( &args );
1436 INT count = get_ulong( &args );
1438 return HandleToUlong( NtUserCreateAcceleratorTable( table, count ));
1441 NTSTATUS WINAPI wow64_NtUserCreateCaret( UINT *args )
1443 HWND hwnd = get_handle( &args );
1444 HBITMAP bitmap = get_handle( &args );
1445 int width = get_ulong( &args );
1446 int height = get_ulong( &args );
1448 return NtUserCreateCaret( hwnd, bitmap, width, height );
1451 NTSTATUS WINAPI wow64_NtUserCreateDesktopEx( UINT *args )
1453 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
1454 UNICODE_STRING32 *device32 = get_ptr( &args );
1455 DEVMODEW *devmode = get_ptr( &args );
1456 DWORD flags = get_ulong( &args );
1457 ACCESS_MASK access = get_ulong( &args );
1458 ULONG heap_size = get_ulong( &args );
1460 struct object_attr64 attr;
1461 UNICODE_STRING device;
1462 HANDLE ret;
1464 ret = NtUserCreateDesktopEx( objattr_32to64( &attr, attr32 ),
1465 unicode_str_32to64( &device, device32 ),
1466 devmode, flags, access, heap_size );
1467 return HandleToUlong( ret );
1470 NTSTATUS WINAPI wow64_NtUserCreateInputContext( UINT *args )
1472 UINT_PTR client_ptr = get_ulong( &args );
1474 return HandleToUlong( NtUserCreateInputContext( client_ptr ));
1477 NTSTATUS WINAPI wow64_NtUserCreateWindowEx( UINT *args )
1479 DWORD ex_style = get_ulong( &args );
1480 UNICODE_STRING32 *class_name32 = get_ptr( &args );
1481 UNICODE_STRING32 *version32 = get_ptr( &args );
1482 UNICODE_STRING32 *window_name32 = get_ptr( &args );
1483 DWORD style = get_ulong( &args );
1484 int x = get_ulong( &args );
1485 int y = get_ulong( &args );
1486 int width = get_ulong( &args );
1487 int height = get_ulong( &args );
1488 HWND parent = get_handle( &args );
1489 HMENU menu = get_handle( &args );
1490 HINSTANCE instance = get_handle( &args );
1491 void *params = get_ptr( &args );
1492 DWORD flags = get_ulong( &args );
1493 HINSTANCE client_instance = get_handle( &args );
1494 DWORD unk = get_ulong( &args );
1495 BOOL ansi = get_ulong( &args );
1497 UNICODE_STRING class_name, version, window_name;
1498 HWND ret;
1500 ret = NtUserCreateWindowEx( ex_style,
1501 unicode_str_32to64( &class_name, class_name32),
1502 unicode_str_32to64( &version, version32 ),
1503 unicode_str_32to64( &window_name, window_name32 ),
1504 style, x, y, width, height, parent, menu,
1505 instance, params, flags, client_instance, unk, ansi );
1506 return HandleToUlong( ret );
1509 NTSTATUS WINAPI wow64_NtUserCreateWindowStation( UINT *args )
1511 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
1512 ACCESS_MASK access = get_ulong( &args );
1513 ULONG arg3 = get_ulong( &args );
1514 ULONG arg4 = get_ulong( &args );
1515 ULONG arg5 = get_ulong( &args );
1516 ULONG arg6 = get_ulong( &args );
1517 ULONG arg7 = get_ulong( &args );
1519 struct object_attr64 attr;
1521 return HandleToUlong( NtUserCreateWindowStation( objattr_32to64( &attr, attr32 ), access,
1522 arg3, arg4, arg5, arg6, arg7 ));
1525 NTSTATUS WINAPI wow64_NtUserDeferWindowPosAndBand( UINT *args )
1527 HDWP hdwp = get_handle( &args );
1528 HWND hwnd = get_handle( &args );
1529 HWND after = get_handle( &args );
1530 INT x = get_ulong( &args );
1531 INT y = get_ulong( &args );
1532 INT cx = get_ulong( &args );
1533 INT cy = get_ulong( &args );
1534 UINT flags = get_ulong( &args );
1535 UINT unk1 = get_ulong( &args );
1536 UINT unk2 = get_ulong( &args );
1538 HDWP ret = NtUserDeferWindowPosAndBand( hdwp, hwnd, after, x, y, cx, cy, flags, unk1, unk2 );
1539 return HandleToUlong( ret );
1542 NTSTATUS WINAPI wow64_NtUserDeleteMenu( UINT *args )
1544 HMENU menu = get_handle( &args );
1545 UINT id = get_ulong( &args );
1546 UINT flags = get_ulong( &args );
1548 return NtUserDeleteMenu( menu, id, flags );
1551 NTSTATUS WINAPI wow64_NtUserDestroyAcceleratorTable( UINT *args )
1553 HACCEL handle = get_handle( &args );
1555 return NtUserDestroyAcceleratorTable( handle );
1558 NTSTATUS WINAPI wow64_NtUserDestroyCursor( UINT *args )
1560 HCURSOR cursor = get_handle( &args );
1561 ULONG arg = get_ulong( &args );
1563 return NtUserDestroyCursor( cursor, arg );
1566 NTSTATUS WINAPI wow64_NtUserDestroyInputContext( UINT *args )
1568 HIMC handle = get_handle( &args );
1570 return NtUserDestroyInputContext( handle );
1573 NTSTATUS WINAPI wow64_NtUserDestroyMenu( UINT *args )
1575 HMENU handle = get_handle( &args );
1577 return NtUserDestroyMenu( handle );
1580 NTSTATUS WINAPI wow64_NtUserDestroyWindow( UINT *args )
1582 HWND hwnd = get_handle( &args );
1584 return NtUserDestroyWindow( hwnd );
1587 NTSTATUS WINAPI wow64_NtUserDisableThreadIme( UINT *args )
1589 DWORD thread_id = get_ulong( &args );
1591 return NtUserDisableThreadIme( thread_id );
1594 NTSTATUS WINAPI wow64_NtUserDispatchMessage( UINT *args )
1596 const MSG32 *msg32 = get_ptr( &args );
1597 MSG msg;
1599 return NtUserDispatchMessage( msg_32to64( &msg, msg32 ));
1602 NTSTATUS WINAPI wow64_NtUserDragDetect( UINT *args )
1604 HWND hwnd = get_handle( &args );
1605 int x = get_ulong( &args );
1606 int y = get_ulong( &args );
1608 return NtUserDragDetect( hwnd, x, y );
1611 NTSTATUS WINAPI wow64_NtUserDragObject( UINT *args )
1613 HWND parent = get_handle( &args );
1614 HWND hwnd = get_handle( &args );
1615 UINT fmt = get_ulong( &args );
1616 ULONG_PTR data = get_ulong( &args );
1617 HCURSOR hcursor = get_handle( &args );
1619 return NtUserDragObject( parent, hwnd, fmt, data, hcursor );
1622 NTSTATUS WINAPI wow64_NtUserDrawIconEx( UINT *args )
1624 HDC hdc = get_handle( &args );
1625 int x0 = get_ulong( &args );
1626 int y0 = get_ulong( &args );
1627 HICON icon = get_handle( &args );
1628 int width = get_ulong( &args );
1629 int height = get_ulong( &args );
1630 UINT istep = get_ulong( &args );
1631 HBRUSH hbr = get_handle( &args );
1632 UINT flags = get_ulong( &args );
1634 return NtUserDrawIconEx( hdc, x0, y0, icon, width, height, istep, hbr, flags );
1637 NTSTATUS WINAPI wow64_NtUserEmptyClipboard( UINT *args )
1639 return NtUserEmptyClipboard();
1642 NTSTATUS WINAPI wow64_NtUserEnableMenuItem( UINT *args )
1644 HMENU handle = get_handle( &args );
1645 UINT id = get_ulong( &args );
1646 UINT flags = get_ulong( &args );
1648 return NtUserEnableMenuItem( handle, id, flags );
1651 NTSTATUS WINAPI wow64_NtUserEnableMouseInPointer( UINT *args )
1653 UINT enable = get_ulong( &args );
1655 return NtUserEnableMouseInPointer( enable );
1658 NTSTATUS WINAPI wow64_NtUserEnableScrollBar( UINT *args )
1660 HWND hwnd = get_handle( &args );
1661 UINT bar = get_ulong( &args );
1662 UINT flags = get_ulong( &args );
1664 return NtUserEnableScrollBar( hwnd, bar, flags );
1667 NTSTATUS WINAPI wow64_NtUserEndDeferWindowPosEx( UINT *args )
1669 HDWP hdwp = get_handle( &args );
1670 BOOL async = get_ulong( &args );
1672 return NtUserEndDeferWindowPosEx( hdwp, async );
1675 NTSTATUS WINAPI wow64_NtUserEndMenu( UINT *args )
1677 return NtUserEndMenu();
1680 NTSTATUS WINAPI wow64_NtUserEnumDisplayDevices( UINT *args )
1682 UNICODE_STRING32 *device32 = get_ptr( &args );
1683 DWORD index = get_ulong( &args );
1684 DISPLAY_DEVICEW *info = get_ptr( &args );
1685 DWORD flags = get_ulong( &args );
1687 UNICODE_STRING device;
1689 return NtUserEnumDisplayDevices( unicode_str_32to64( &device, device32 ), index, info, flags );
1692 NTSTATUS WINAPI wow64_NtUserEnumDisplayMonitors( UINT *args )
1694 HDC hdc = get_handle( &args );
1695 RECT *rect = get_ptr( &args );
1696 MONITORENUMPROC proc = get_ptr( &args );
1697 LPARAM lp = get_ulong( &args );
1699 return NtUserEnumDisplayMonitors( hdc, rect, proc, lp );
1702 NTSTATUS WINAPI wow64_NtUserEnumDisplaySettings( UINT *args )
1704 UNICODE_STRING32 *device32 = get_ptr( &args );
1705 DWORD mode = get_ulong( &args );
1706 DEVMODEW *dev_mode = get_ptr( &args );
1707 DWORD flags = get_ulong( &args );
1709 UNICODE_STRING device;
1711 return NtUserEnumDisplaySettings( unicode_str_32to64( &device, device32 ),
1712 mode, dev_mode, flags );
1715 NTSTATUS WINAPI wow64_NtUserFindExistingCursorIcon( UINT *args )
1717 UNICODE_STRING32 *module32 = get_ptr( &args );
1718 UNICODE_STRING32 *res_name32 = get_ptr( &args );
1719 void *desc = get_ptr( &args );
1721 UNICODE_STRING module;
1722 UNICODE_STRING res_name;
1723 HICON ret;
1725 ret = NtUserFindExistingCursorIcon( unicode_str_32to64( &module, module32 ),
1726 unicode_str_32to64( &res_name, res_name32 ), desc );
1727 return HandleToUlong( ret );
1730 NTSTATUS WINAPI wow64_NtUserFindWindowEx( UINT *args )
1732 HWND parent = get_handle( &args );
1733 HWND child = get_handle( &args );
1734 UNICODE_STRING32 *class32 = get_ptr( &args );
1735 UNICODE_STRING32 *title32 = get_ptr( &args );
1736 ULONG unk = get_ulong( &args );
1738 UNICODE_STRING class, title;
1739 HWND ret;
1741 ret = NtUserFindWindowEx( parent, child, unicode_str_32to64( &class, class32 ),
1742 unicode_str_32to64( &title, title32 ), unk );
1743 return HandleToUlong( ret );
1746 NTSTATUS WINAPI wow64_NtUserFlashWindowEx( UINT *args )
1748 struct
1750 UINT cbSize;
1751 ULONG hwnd;
1752 DWORD dwFlags;
1753 UINT uCount;
1754 DWORD dwTimeout;
1755 } *info32 = get_ptr( &args );
1757 FLASHWINFO info;
1759 if (!info32)
1761 set_last_error32( ERROR_NOACCESS );
1762 return FALSE;
1765 if (info32->cbSize != sizeof(*info32))
1767 set_last_error32( ERROR_INVALID_PARAMETER );
1768 return FALSE;
1771 info.cbSize = sizeof(info);
1772 info.hwnd = LongToHandle( info32->hwnd );
1773 info.dwFlags = info32->dwFlags;
1774 info.uCount = info32->uCount;
1775 info.dwTimeout = info32->dwTimeout;
1776 return NtUserFlashWindowEx( &info );
1779 NTSTATUS WINAPI wow64_NtUserGetAncestor( UINT *args )
1781 HWND hwnd = get_handle( &args );
1782 UINT type = get_ulong( &args );
1784 return HandleToUlong( NtUserGetAncestor( hwnd, type ));
1787 NTSTATUS WINAPI wow64_NtUserGetAsyncKeyState( UINT *args )
1789 INT key = get_ulong( &args );
1791 return NtUserGetAsyncKeyState( key );
1794 NTSTATUS WINAPI wow64_NtUserGetAtomName( UINT *args )
1796 ATOM atom = get_ulong( &args );
1797 UNICODE_STRING32 *str32 = get_ptr( &args );
1799 UNICODE_STRING str;
1801 return NtUserGetAtomName( atom, unicode_str_32to64( &str, str32 ));
1804 NTSTATUS WINAPI wow64_NtUserGetCaretBlinkTime( UINT *args )
1806 return NtUserGetCaretBlinkTime();
1809 NTSTATUS WINAPI wow64_NtUserGetCaretPos( UINT *args )
1811 POINT *pt = get_ptr( &args );
1813 return NtUserGetCaretPos( pt );
1816 NTSTATUS WINAPI wow64_NtUserGetClassInfoEx( UINT *args )
1818 HINSTANCE instance = get_ptr( &args );
1819 UNICODE_STRING32 *name32 = get_ptr( &args );
1820 WNDCLASSEXW32 *wc32 = get_ptr( &args );
1821 struct client_menu_name32 *client_name32 = get_ptr( &args );
1822 BOOL ansi = get_ulong( &args );
1824 struct client_menu_name client_name;
1825 UNICODE_STRING name;
1826 WNDCLASSEXW wc;
1827 ATOM ret;
1829 wc.cbSize = sizeof(wc);
1830 if (!(ret = NtUserGetClassInfoEx( instance, unicode_str_32to64( &name, name32 ), &wc,
1831 &client_name, ansi )))
1832 return 0;
1834 wc32->style = wc.style;
1835 wc32->lpfnWndProc = PtrToUlong( wc.lpfnWndProc );
1836 wc32->cbClsExtra = wc.cbClsExtra;
1837 wc32->cbWndExtra = wc.cbWndExtra;
1838 wc32->hInstance = HandleToUlong( wc.hInstance );
1839 wc32->hIcon = HandleToUlong( wc.hIcon );
1840 wc32->hCursor = HandleToUlong( wc.hCursor );
1841 wc32->hbrBackground = HandleToUlong( wc.hbrBackground );
1842 wc32->lpszMenuName = PtrToUlong( wc.lpszMenuName );
1843 wc32->lpszClassName = PtrToUlong( wc.lpszClassName );
1844 wc32->hIconSm = HandleToUlong( wc.hIconSm );
1845 client_menu_name_64to32( &client_name, client_name32 );
1846 return ret;
1849 NTSTATUS WINAPI wow64_NtUserGetClassName( UINT *args )
1851 HWND hwnd = get_handle( &args );
1852 BOOL real = get_ulong( &args );
1853 UNICODE_STRING32 *str32 = get_ptr( &args );
1855 UNICODE_STRING str;
1857 return NtUserGetClassName( hwnd, real, unicode_str_32to64( &str, str32 ));
1860 NTSTATUS WINAPI wow64_NtUserGetClipboardData( UINT *args )
1862 UINT format = get_ulong( &args );
1863 struct
1865 UINT32 data;
1866 UINT32 size;
1867 UINT32 data_size;
1868 UINT seqno;
1869 BOOL data_only;
1870 } *params32 = get_ptr( &args );
1872 struct get_clipboard_params params;
1873 HANDLE ret;
1875 params.data = UlongToPtr( params32->data );
1876 params.size = params32->size;
1877 params.data_size = params32->data_size;
1878 params.data_only = params32->data_only;
1880 ret = NtUserGetClipboardData( format, &params );
1882 params32->size = params.size;
1883 params32->data_size = params.data_size;
1884 params32->seqno = params.seqno;
1885 return HandleToUlong( ret );
1888 NTSTATUS WINAPI wow64_NtUserGetClipboardFormatName( UINT *args )
1890 UINT format = get_ulong( &args );
1891 WCHAR *buffer = get_ptr( &args );
1892 INT maxlen = get_ulong( &args );
1894 return NtUserGetClipboardFormatName( format, buffer, maxlen );
1897 NTSTATUS WINAPI wow64_NtUserGetClipboardOwner( UINT *args )
1899 return HandleToUlong( NtUserGetClipboardOwner() );
1902 NTSTATUS WINAPI wow64_NtUserGetClipboardSequenceNumber( UINT *args )
1904 return NtUserGetClipboardSequenceNumber();
1907 NTSTATUS WINAPI wow64_NtUserGetClipboardViewer( UINT *args )
1909 return HandleToUlong( NtUserGetClipboardViewer() );
1912 NTSTATUS WINAPI wow64_NtUserGetCursor( UINT *args )
1914 return HandleToUlong( NtUserGetCursor() );
1917 NTSTATUS WINAPI wow64_NtUserGetCursorFrameInfo( UINT *args )
1919 HCURSOR cursor = get_ptr( &args );
1920 DWORD istep = get_ulong( &args );
1921 DWORD *rate_jiffies = get_ptr( &args );
1922 DWORD *num_steps = get_ptr( &args );
1924 return HandleToUlong( NtUserGetCursorFrameInfo( cursor, istep, rate_jiffies, num_steps ));
1927 NTSTATUS WINAPI wow64_NtUserGetCursorInfo( UINT *args )
1929 struct
1931 DWORD cbSize;
1932 DWORD flags;
1933 ULONG hCursor;
1934 POINT ptScreenPos;
1935 } *info32 = get_ptr( &args );
1936 CURSORINFO info;
1938 if (!info32) return FALSE;
1939 info.cbSize = sizeof(info);
1940 if (!NtUserGetCursorInfo( &info )) return FALSE;
1941 info32->flags = info.flags;
1942 info32->hCursor = HandleToUlong( info.hCursor );
1943 info32->ptScreenPos = info.ptScreenPos;
1944 return TRUE;
1947 NTSTATUS WINAPI wow64_NtUserGetDC( UINT *args )
1949 HWND hwnd = get_handle( &args );
1951 return HandleToUlong( NtUserGetDC( hwnd ));
1954 NTSTATUS WINAPI wow64_NtUserGetDCEx( UINT *args )
1956 HWND hwnd = get_handle( &args );
1957 HRGN clip_rgn = get_handle( &args );
1958 DWORD flags = get_ulong( &args );
1960 return HandleToUlong( NtUserGetDCEx( hwnd, clip_rgn, flags ));
1963 NTSTATUS WINAPI wow64_NtUserGetDisplayConfigBufferSizes( UINT *args )
1965 UINT32 flags = get_ulong( &args );
1966 UINT32 *num_path_info = get_ptr( &args );
1967 UINT32 *num_mode_info = get_ptr( &args );
1969 return NtUserGetDisplayConfigBufferSizes( flags, num_path_info, num_mode_info );
1972 NTSTATUS WINAPI wow64_NtUserGetDoubleClickTime( UINT *args )
1974 return NtUserGetDoubleClickTime();
1977 NTSTATUS WINAPI wow64_NtUserGetDpiForMonitor( UINT *args )
1979 HMONITOR monitor = get_handle( &args );
1980 UINT type = get_ulong( &args );
1981 UINT *x = get_ptr( &args );
1982 UINT *y = get_ptr( &args );
1984 return NtUserGetDpiForMonitor( monitor, type, x, y );
1987 NTSTATUS WINAPI wow64_NtUserGetForegroundWindow( UINT *args )
1989 return HandleToUlong( NtUserGetForegroundWindow() );
1992 NTSTATUS WINAPI wow64_NtUserGetGUIThreadInfo( UINT *args )
1994 DWORD id = get_ulong( &args );
1995 struct
1997 DWORD cbSize;
1998 DWORD flags;
1999 ULONG hwndActive;
2000 ULONG hwndFocus;
2001 ULONG hwndCapture;
2002 ULONG hwndMenuOwner;
2003 ULONG hwndMoveSize;
2004 ULONG hwndCaret;
2005 RECT rcCaret;
2006 } *info32 = get_ptr( &args );
2007 GUITHREADINFO info;
2009 if (info32->cbSize != sizeof(*info32))
2011 set_last_error32( ERROR_INVALID_PARAMETER );
2012 return FALSE;
2015 info.cbSize = sizeof(info);
2016 if (!NtUserGetGUIThreadInfo( id, &info )) return FALSE;
2017 info32->flags = info.flags;
2018 info32->hwndActive = HandleToUlong( info.hwndActive );
2019 info32->hwndFocus = HandleToUlong( info.hwndFocus );
2020 info32->hwndCapture = HandleToUlong( info.hwndCapture );
2021 info32->hwndMenuOwner = HandleToUlong( info.hwndMenuOwner );
2022 info32->hwndMoveSize = HandleToUlong( info.hwndMoveSize );
2023 info32->hwndCaret = HandleToUlong( info.hwndCaret );
2024 info32->rcCaret = info.rcCaret;
2025 return TRUE;
2028 NTSTATUS WINAPI wow64_NtUserGetIconInfo( UINT *args )
2030 HICON icon = get_handle( &args );
2031 struct
2033 BOOL fIcon;
2034 DWORD xHotspot;
2035 DWORD yHotspot;
2036 UINT32 hbmMask;
2037 UINT32 hbmColor;
2038 } *info32 = get_ptr( &args );
2039 UNICODE_STRING32 *module32 = get_ptr( &args );
2040 UNICODE_STRING32 *res_name32 = get_ptr( &args );
2041 DWORD *bpp = get_ptr( &args );
2042 LONG unk = get_ulong( &args );
2044 ICONINFO info;
2045 UNICODE_STRING module, res_name;
2047 if (!NtUserGetIconInfo( icon, &info, unicode_str_32to64( &module, module32 ),
2048 unicode_str_32to64( &res_name, res_name32 ), bpp, unk ))
2049 return FALSE;
2051 info32->fIcon = info.fIcon;
2052 info32->xHotspot = info.xHotspot;
2053 info32->yHotspot = info.yHotspot;
2054 info32->hbmMask = HandleToUlong( info.hbmMask );
2055 info32->hbmColor = HandleToUlong( info.hbmColor );
2056 if (module32)
2058 module32->Buffer = PtrToUlong( module.Buffer );
2059 module32->Length = module.Length;
2061 if (res_name32)
2063 res_name32->Buffer = PtrToUlong( res_name.Buffer );
2064 res_name32->Length = res_name.Length;
2066 return TRUE;
2069 NTSTATUS WINAPI wow64_NtUserGetIconSize( UINT *args )
2071 HICON handle = get_handle( &args );
2072 UINT step = get_ulong( &args );
2073 LONG *width = get_ptr( &args );
2074 LONG *height = get_ptr( &args );
2076 return NtUserGetIconSize( handle, step, width, height );
2079 NTSTATUS WINAPI wow64_NtUserGetInternalWindowPos( UINT *args )
2081 HWND hwnd = get_handle( &args );
2082 RECT *rect = get_ptr( &args );
2083 POINT *pt = get_ptr( &args );
2085 return NtUserGetInternalWindowPos( hwnd, rect, pt );
2088 NTSTATUS WINAPI wow64_NtUserGetKeyNameText( UINT *args )
2090 LONG lparam = get_ulong( &args );
2091 WCHAR *buffer = get_ptr( &args );
2092 INT size = get_ulong( &args );
2094 return NtUserGetKeyNameText( lparam, buffer, size );
2097 NTSTATUS WINAPI wow64_NtUserGetKeyState( UINT *args )
2099 INT vkey = get_ulong( &args );
2101 return NtUserGetKeyState( vkey );
2104 NTSTATUS WINAPI wow64_NtUserGetKeyboardLayout( UINT *args )
2106 DWORD tid = get_ulong( &args );
2108 return HandleToUlong( NtUserGetKeyboardLayout( tid ));
2111 NTSTATUS WINAPI wow64_NtUserGetKeyboardLayoutList( UINT *args )
2113 INT size = get_ulong( &args );
2114 UINT32 *layouts32 = get_ptr( &args );
2115 HKL *layouts = NULL;
2116 UINT ret, i;
2118 if (layouts32 && size && !(layouts = Wow64AllocateTemp( size * sizeof(*layouts) )))
2119 return 0;
2121 ret = NtUserGetKeyboardLayoutList( size, layouts );
2122 if (layouts)
2123 for (i = 0; i < ret; i++) layouts32[i] = HandleToUlong( layouts[i] );
2124 return ret;
2127 NTSTATUS WINAPI wow64_NtUserGetKeyboardLayoutName( UINT *args )
2129 WCHAR *name = get_ptr( &args );
2131 return NtUserGetKeyboardLayoutName( name );
2134 NTSTATUS WINAPI wow64_NtUserGetKeyboardState( UINT *args )
2136 BYTE *state = get_ptr( &args );
2138 return NtUserGetKeyboardState( state );
2141 NTSTATUS WINAPI wow64_NtUserGetLayeredWindowAttributes( UINT *args )
2143 HWND hwnd = get_handle( &args );
2144 COLORREF *key = get_ptr( &args );
2145 BYTE *alpha = get_ptr( &args );
2146 DWORD *flags = get_ptr( &args );
2148 return NtUserGetLayeredWindowAttributes( hwnd, key, alpha, flags );
2151 NTSTATUS WINAPI wow64_NtUserGetMenuBarInfo( UINT *args )
2153 HWND hwnd = get_handle( &args );
2154 LONG id = get_ulong( &args );
2155 LONG item = get_ulong( &args );
2156 struct
2158 DWORD cbSize;
2159 RECT rcBar;
2160 ULONG hMenu;
2161 ULONG hwndMenu;
2162 BOOL fBarFocused:1;
2163 BOOL fFocused:1;
2164 } *info32 = get_ptr( &args );
2166 MENUBARINFO info;
2168 if (info32->cbSize != sizeof(*info32))
2170 set_last_error32( ERROR_INVALID_PARAMETER );
2171 return FALSE;
2174 info.cbSize = sizeof(info);
2175 if (!NtUserGetMenuBarInfo( hwnd, id, item, &info )) return FALSE;
2176 info32->rcBar = info.rcBar;
2177 info32->hMenu = HandleToUlong( info.hMenu );
2178 info32->hwndMenu = HandleToUlong( info.hwndMenu );
2179 info32->fBarFocused = info.fBarFocused;
2180 info32->fFocused = info.fFocused;
2181 return TRUE;
2184 NTSTATUS WINAPI wow64_NtUserGetMenuItemRect( UINT *args )
2186 HWND hwnd = get_handle( &args );
2187 HMENU handle = get_handle( &args );
2188 UINT item = get_ulong( &args );
2189 RECT *rect = get_ptr( &args );
2191 return NtUserGetMenuItemRect( hwnd, handle, item, rect );
2194 NTSTATUS WINAPI wow64_NtUserGetMessage( UINT *args )
2196 MSG32 *msg32 = get_ptr( &args );
2197 HWND hwnd = get_handle( &args );
2198 UINT first = get_ulong( &args );
2199 UINT last = get_ulong( &args );
2200 MSG msg;
2201 int ret;
2203 ret = NtUserGetMessage( &msg, hwnd, first, last );
2204 if (ret != -1) msg_64to32( &msg, msg32 );
2205 return ret;
2208 NTSTATUS WINAPI wow64_NtUserGetMouseMovePointsEx( UINT *args )
2210 UINT size = get_ulong( &args );
2211 MOUSEMOVEPOINT32 *ptin32 = get_ptr( &args );
2212 MOUSEMOVEPOINT32 *ptout32 = get_ptr( &args );
2213 int count = get_ulong( &args );
2214 DWORD resolution = get_ulong( &args );
2216 MOUSEMOVEPOINT ptin[64], ptout[64];
2217 int ret, i;
2219 if (size != sizeof(MOUSEMOVEPOINT32) || count < 0 || count > ARRAYSIZE( ptin ))
2221 set_last_error32( ERROR_INVALID_PARAMETER );
2222 return -1;
2225 if (!ptin32 || (!ptout32 && count))
2227 set_last_error32( ERROR_NOACCESS );
2228 return -1;
2231 for (i = 0; i < count; i++)
2233 ptin[i].x = ptin32[i].x;
2234 ptin[i].y = ptin32[i].y;
2235 ptin[i].time = ptin32[i].time;
2236 ptin[i].dwExtraInfo = ptin32[i].dwExtraInfo;
2239 ret = NtUserGetMouseMovePointsEx( sizeof(MOUSEMOVEPOINT), ptin, ptout, count, resolution );
2241 for (i = 0; i < ret; i++)
2243 ptout32[i].x = ptout[i].x;
2244 ptout32[i].y = ptout[i].y;
2245 ptout32[i].time = ptout[i].time;
2246 ptout32[i].dwExtraInfo = ptout[i].dwExtraInfo;
2249 return ret;
2252 NTSTATUS WINAPI wow64_NtUserGetObjectInformation( UINT *args )
2254 HANDLE handle = get_handle( &args );
2255 INT index = get_ulong( &args );
2256 void *info = get_ptr( &args );
2257 DWORD len = get_ulong( &args );
2258 DWORD *needed = get_ptr( &args );
2260 return NtUserGetObjectInformation( handle, index, info, len, needed );
2263 NTSTATUS WINAPI wow64_NtUserGetOpenClipboardWindow( UINT *args )
2265 return HandleToUlong( NtUserGetOpenClipboardWindow() );
2268 NTSTATUS WINAPI wow64_NtUserGetPointerInfoList( UINT *args )
2270 UINT id = get_ulong( &args );
2271 UINT type = get_ulong( &args );
2272 UINT unk0 = get_ulong( &args );
2273 UINT unk1 = get_ulong( &args );
2274 UINT size = get_ulong( &args );
2275 void *entry_count = get_ptr( &args );
2276 void *pointer_count = get_ptr( &args );
2277 void *pointer_info = get_ptr( &args );
2279 return NtUserGetPointerInfoList( id, type, unk0, unk1, size, entry_count, pointer_count, pointer_info );
2282 NTSTATUS WINAPI wow64_NtUserGetPriorityClipboardFormat( UINT *args )
2284 UINT *list = get_ptr( &args );
2285 INT count = get_ulong( &args );
2287 return NtUserGetPriorityClipboardFormat( list, count );
2290 NTSTATUS WINAPI wow64_NtUserGetProcessDpiAwarenessContext( UINT *args )
2292 HANDLE process = get_handle( &args );
2294 return NtUserGetProcessDpiAwarenessContext( process );
2297 NTSTATUS WINAPI wow64_NtUserGetProcessWindowStation( UINT *args )
2299 return HandleToUlong( NtUserGetProcessWindowStation() );
2302 NTSTATUS WINAPI wow64_NtUserGetProp( UINT *args )
2304 HWND hwnd = get_handle( &args );
2305 const WCHAR *str = get_ptr( &args );
2307 return HandleToUlong( NtUserGetProp( hwnd, str ));
2310 NTSTATUS WINAPI wow64_NtUserGetQueueStatus( UINT *args )
2312 UINT flags = get_ulong( &args );
2314 return NtUserGetQueueStatus( flags );
2317 NTSTATUS WINAPI wow64_NtUserGetRawInputBuffer( UINT *args )
2319 RAWINPUT *data = get_ptr( &args );
2320 UINT *data_size = get_ptr( &args );
2321 UINT header_size = get_ulong( &args );
2323 if (header_size != sizeof(RAWINPUTHEADER32))
2325 set_last_error32( ERROR_INVALID_PARAMETER );
2326 return ~0u;
2329 /* RAWINPUT has different sizes on 32-bit and 64-bit, but no translation is
2330 * done. The function actually returns different structures depending on
2331 * whether it's operating under WoW64 or not. */
2332 return NtUserGetRawInputBuffer( data, data_size, sizeof(RAWINPUTHEADER) );
2335 NTSTATUS WINAPI wow64_NtUserGetRawInputData( UINT *args )
2337 HRAWINPUT handle = get_handle( &args );
2338 UINT command = get_ulong( &args );
2339 void *data = get_ptr( &args );
2340 UINT *data_size = get_ptr( &args );
2341 UINT header_size = get_ulong( &args );
2343 if (header_size != sizeof(RAWINPUTHEADER32))
2345 set_last_error32( ERROR_INVALID_PARAMETER );
2346 return ~0u;
2349 switch (command)
2351 case RID_INPUT:
2352 if (data)
2354 UINT data_size64, body_size, ret;
2355 RAWINPUTHEADER32 *data32 = data;
2356 RAWINPUTHEADER *data64 = NULL;
2358 data_size64 = *data_size + sizeof(RAWINPUTHEADER);
2359 if (!(data64 = Wow64AllocateTemp( data_size64 )))
2361 set_last_error32( STATUS_NO_MEMORY );
2362 return ~0u;
2365 ret = NtUserGetRawInputData( handle, command, data64, &data_size64, sizeof(RAWINPUTHEADER) );
2366 if (ret == ~0u) return ret;
2368 body_size = ret - sizeof(RAWINPUTHEADER);
2369 if (*data_size < sizeof(RAWINPUTHEADER32) + body_size)
2371 set_last_error32( ERROR_INSUFFICIENT_BUFFER );
2372 return ~0u;
2375 data32->dwType = data64->dwType;
2376 data32->dwSize = sizeof(RAWINPUTHEADER32) + body_size;
2377 data32->hDevice = (UINT_PTR)data64->hDevice;
2378 data32->wParam = data64->wParam;
2379 memcpy( data32 + 1, data64 + 1, body_size );
2380 return sizeof(RAWINPUTHEADER32) + body_size;
2382 else
2384 UINT data_size64, ret;
2386 ret = NtUserGetRawInputData( handle, command, NULL, &data_size64, sizeof(RAWINPUTHEADER) );
2387 if (ret == ~0u) return ret;
2388 *data_size = data_size64 - sizeof(RAWINPUTHEADER) + sizeof(RAWINPUTHEADER32);
2389 return 0;
2392 case RID_HEADER:
2394 UINT data_size64 = sizeof(RAWINPUTHEADER);
2395 RAWINPUTHEADER32 *data32 = data;
2396 RAWINPUTHEADER data64;
2397 UINT ret;
2399 if (!data)
2401 *data_size = sizeof(RAWINPUTHEADER32);
2402 return 0;
2405 if (*data_size < sizeof(RAWINPUTHEADER32))
2407 set_last_error32( ERROR_INSUFFICIENT_BUFFER );
2408 return ~0u;
2411 ret = NtUserGetRawInputData( handle, command, &data64, &data_size64, sizeof(RAWINPUTHEADER) );
2412 if (ret == ~0u) return ret;
2413 data32->dwType = data64.dwType;
2414 data32->dwSize = data64.dwSize - sizeof(RAWINPUTHEADER) + sizeof(RAWINPUTHEADER32);
2415 data32->hDevice = (UINT_PTR)data64.hDevice;
2416 data32->wParam = data64.wParam;
2417 return sizeof(RAWINPUTHEADER32);
2420 default:
2421 set_last_error32( ERROR_INVALID_PARAMETER );
2422 return ~0u;
2426 NTSTATUS WINAPI wow64_NtUserGetRawInputDeviceInfo( UINT *args )
2428 HANDLE handle = get_handle( &args );
2429 UINT command = get_ulong( &args );
2430 void *data = get_ptr( &args );
2431 UINT *data_size = get_ptr( &args );
2433 return NtUserGetRawInputDeviceInfo( handle, command, data, data_size );
2436 NTSTATUS WINAPI wow64_NtUserGetRawInputDeviceList( UINT *args )
2438 RAWINPUTDEVICELIST32 *devices32 = get_ptr( &args );
2439 UINT *count = get_ptr( &args );
2440 UINT size = get_ulong( &args );
2442 if (size != sizeof(RAWINPUTDEVICELIST32))
2444 set_last_error32( ERROR_INVALID_PARAMETER );
2445 return ~0u;
2448 if (devices32)
2450 RAWINPUTDEVICELIST *devices64;
2451 unsigned int ret, i;
2453 if (!(devices64 = Wow64AllocateTemp( (*count) * sizeof(*devices64) )))
2455 set_last_error32( ERROR_NOT_ENOUGH_MEMORY );
2456 return ~0u;
2459 ret = NtUserGetRawInputDeviceList( devices64, count, sizeof(RAWINPUTDEVICELIST) );
2460 if (ret == ~0u) return ret;
2462 for (i = 0; i < *count; ++i)
2464 devices32[i].hDevice = (UINT_PTR)devices64[i].hDevice;
2465 devices32[i].dwType = devices64[i].dwType;
2467 return ret;
2469 else
2471 return NtUserGetRawInputDeviceList( NULL, count, sizeof(RAWINPUTDEVICELIST) );
2475 NTSTATUS WINAPI wow64_NtUserRealChildWindowFromPoint( UINT *args )
2477 HWND parent = get_handle( &args );
2478 LONG x = get_ulong( &args );
2479 LONG y = get_ulong( &args );
2481 return HandleToUlong( NtUserRealChildWindowFromPoint( parent, x, y ));
2484 NTSTATUS WINAPI wow64_NtUserRegisterClassExWOW( UINT *args )
2486 const WNDCLASSEXW32 *wc32 = get_ptr( &args );
2487 UNICODE_STRING32 *name32 = get_ptr( &args );
2488 UNICODE_STRING32 *version32 = get_ptr( &args );
2489 struct client_menu_name32 *client_name32 = get_ptr( &args );
2490 DWORD fnid = get_ulong( &args );
2491 DWORD flags = get_ulong( &args );
2492 DWORD *wow = get_ptr( &args );
2494 struct client_menu_name client_name;
2495 UNICODE_STRING name, version;
2496 WNDCLASSEXW wc;
2498 if (wc32->cbSize != sizeof(*wc32))
2500 set_last_error32( ERROR_INVALID_PARAMETER );
2501 return 0;
2504 wc.cbSize = sizeof(wc);
2505 wc.style = wc32->style;
2506 wc.lpfnWndProc = UlongToPtr( wc32->lpfnWndProc );
2507 wc.cbClsExtra = wc32->cbClsExtra;
2508 wc.cbWndExtra = wc32->cbWndExtra;
2509 wc.hInstance = UlongToPtr( wc32->hInstance );
2510 wc.hIcon = LongToHandle( wc32->hIcon );
2511 wc.hCursor = LongToHandle( wc32->hCursor );
2512 wc.hbrBackground = UlongToHandle( wc32->hbrBackground );
2513 wc.lpszMenuName = UlongToPtr( wc32->lpszMenuName );
2514 wc.lpszClassName = UlongToPtr( wc32->lpszClassName );
2515 wc.hIconSm = LongToHandle( wc32->hIconSm );
2517 return NtUserRegisterClassExWOW( &wc,
2518 unicode_str_32to64( &name, name32 ),
2519 unicode_str_32to64( &version, version32 ),
2520 client_menu_name_32to64( &client_name, client_name32 ),
2521 fnid, flags, wow );
2524 NTSTATUS WINAPI wow64_NtUserGetRegisteredRawInputDevices( UINT *args )
2526 RAWINPUTDEVICE32 *devices32 = get_ptr( &args );
2527 UINT *count = get_ptr( &args );
2528 UINT size = get_ulong( &args );
2530 if (size != sizeof(RAWINPUTDEVICE32))
2532 set_last_error32( ERROR_INVALID_PARAMETER );
2533 return ~0u;
2536 if (devices32)
2538 RAWINPUTDEVICE *devices64;
2539 unsigned int ret, i;
2541 if (!(devices64 = Wow64AllocateTemp( (*count) * sizeof(*devices64) )))
2543 set_last_error32( ERROR_NOT_ENOUGH_MEMORY );
2544 return ~0u;
2547 ret = NtUserGetRegisteredRawInputDevices( devices64, count, sizeof(RAWINPUTDEVICE) );
2548 if (ret == ~0u) return ret;
2550 for (i = 0; i < *count; ++i)
2552 devices32[i].usUsagePage = devices64[i].usUsagePage;
2553 devices32[i].usUsage = devices64[i].usUsage;
2554 devices32[i].dwFlags = devices64[i].dwFlags;
2555 devices32[i].hwndTarget = (ULONG_PTR)devices64[i].hwndTarget;
2557 return ret;
2559 else
2561 return NtUserGetRegisteredRawInputDevices( NULL, count, sizeof(RAWINPUTDEVICE) );
2565 NTSTATUS WINAPI wow64_NtUserGetScrollBarInfo( UINT *args )
2567 HWND hwnd = get_handle( &args );
2568 LONG id = get_ulong( &args );
2569 SCROLLBARINFO *info = get_ptr( &args );
2571 return NtUserGetScrollBarInfo( hwnd, id, info );
2574 NTSTATUS WINAPI wow64_NtUserGetSystemDpiForProcess( UINT *args )
2576 HANDLE process = get_handle( &args );
2578 return NtUserGetSystemDpiForProcess( process );
2581 NTSTATUS WINAPI wow64_NtUserGetSystemMenu( UINT *args )
2583 HWND hwnd = get_handle( &args );
2584 BOOL revert = get_ulong( &args );
2586 return HandleToUlong( NtUserGetSystemMenu( hwnd, revert ));
2589 NTSTATUS WINAPI wow64_NtUserGetThreadDesktop( UINT *args )
2591 DWORD thread = get_ulong( &args );
2593 return HandleToUlong( NtUserGetThreadDesktop( thread ));
2596 NTSTATUS WINAPI wow64_NtUserGetTitleBarInfo( UINT *args )
2598 HWND hwnd = get_handle( &args );
2599 TITLEBARINFO *info = get_ptr( &args );
2601 return NtUserGetTitleBarInfo( hwnd, info );
2604 NTSTATUS WINAPI wow64_NtUserGetUpdateRect( UINT *args )
2606 HWND hwnd = get_handle( &args );
2607 RECT *rect = get_ptr( &args );
2608 BOOL erase = get_ulong( &args );
2610 return NtUserGetUpdateRect( hwnd, rect, erase );
2613 NTSTATUS WINAPI wow64_NtUserGetUpdateRgn( UINT *args )
2615 HWND hwnd = get_handle( &args );
2616 HRGN hrgn = get_handle( &args );
2617 BOOL erase = get_ulong( &args );
2619 return NtUserGetUpdateRgn( hwnd, hrgn, erase );
2622 NTSTATUS WINAPI wow64_NtUserGetUpdatedClipboardFormats( UINT *args )
2624 UINT *formats = get_ptr( &args );
2625 UINT size = get_ulong( &args );
2626 UINT *out_size = get_ptr( &args );
2628 return NtUserGetUpdatedClipboardFormats( formats, size, out_size );
2631 NTSTATUS WINAPI wow64_NtUserGetWindowDC( UINT *args )
2633 HWND hwnd = get_handle( &args );
2635 return HandleToUlong( NtUserGetWindowDC( hwnd ));
2638 NTSTATUS WINAPI wow64_NtUserGetWindowPlacement( UINT *args )
2640 HWND hwnd = get_handle( &args );
2641 WINDOWPLACEMENT *placement = get_ptr( &args );
2643 return NtUserGetWindowPlacement( hwnd, placement );
2646 NTSTATUS WINAPI wow64_NtUserGetWindowRgnEx( UINT *args )
2648 HWND hwnd = get_handle( &args );
2649 HRGN hrgn = get_handle( &args );
2650 UINT unk = get_ulong( &args );
2652 return NtUserGetWindowRgnEx( hwnd, hrgn, unk );
2655 NTSTATUS WINAPI wow64_NtUserHideCaret( UINT *args )
2657 HWND hwnd = get_handle( &args );
2659 return NtUserHideCaret( hwnd );
2662 NTSTATUS WINAPI wow64_NtUserHiliteMenuItem( UINT *args )
2664 HWND hwnd = get_handle( &args );
2665 HMENU handle = get_handle( &args );
2666 UINT item = get_ulong( &args );
2667 UINT hilite = get_ulong( &args );
2669 return NtUserHiliteMenuItem( hwnd, handle, item, hilite );
2672 struct user_client_procs32
2674 ULONG pButtonWndProc;
2675 ULONG pComboWndProc;
2676 ULONG pDefWindowProc;
2677 ULONG pDefDlgProc;
2678 ULONG pEditWndProc;
2679 ULONG pListBoxWndProc;
2680 ULONG pMDIClientWndProc;
2681 ULONG pScrollBarWndProc;
2682 ULONG pStaticWndProc;
2683 ULONG pImeWndProc;
2684 ULONG pDesktopWndProc;
2685 ULONG pIconTitleWndProc;
2686 ULONG pPopupMenuWndProc;
2687 ULONG pMessageWndProc;
2690 static struct user_client_procs *user_client_procs_32to64( struct user_client_procs *procs,
2691 const struct user_client_procs32 *procs32 )
2693 if (!procs32) return NULL;
2695 procs->pButtonWndProc = UlongToPtr( procs32->pButtonWndProc );
2696 procs->pComboWndProc = UlongToPtr( procs32->pComboWndProc );
2697 procs->pDefWindowProc = UlongToPtr( procs32->pDefWindowProc );
2698 procs->pDefDlgProc = UlongToPtr( procs32->pDefDlgProc );
2699 procs->pEditWndProc = UlongToPtr( procs32->pEditWndProc );
2700 procs->pListBoxWndProc = UlongToPtr( procs32->pListBoxWndProc );
2701 procs->pMDIClientWndProc = UlongToPtr( procs32->pMDIClientWndProc );
2702 procs->pScrollBarWndProc = UlongToPtr( procs32->pScrollBarWndProc );
2703 procs->pStaticWndProc = UlongToPtr( procs32->pStaticWndProc );
2704 procs->pImeWndProc = UlongToPtr( procs32->pImeWndProc );
2705 procs->pDesktopWndProc = UlongToPtr( procs32->pDesktopWndProc );
2706 procs->pIconTitleWndProc = UlongToPtr( procs32->pIconTitleWndProc );
2707 procs->pPopupMenuWndProc = UlongToPtr( procs32->pPopupMenuWndProc );
2708 procs->pMessageWndProc = UlongToPtr( procs32->pMessageWndProc );
2709 return procs;
2712 NTSTATUS WINAPI wow64_NtUserInitializeClientPfnArrays( UINT *args )
2714 const struct user_client_procs32 *procsA32 = get_ptr( &args );
2715 const struct user_client_procs32 *procsW32 = get_ptr( &args );
2716 void *workers = get_ptr( &args );
2717 HINSTANCE user_module = get_ptr( &args );
2719 struct user_client_procs procsA, procsW;
2720 return NtUserInitializeClientPfnArrays( user_client_procs_32to64( &procsA, procsA32 ),
2721 user_client_procs_32to64( &procsW, procsW32 ),
2722 workers, user_module );
2725 NTSTATUS WINAPI wow64_NtUserInternalGetWindowIcon( UINT *args )
2727 HWND hwnd = get_handle( &args );
2728 UINT type = get_ulong( &args );
2730 return HandleToUlong( NtUserInternalGetWindowIcon( hwnd, type ));
2733 NTSTATUS WINAPI wow64_NtUserInternalGetWindowText( UINT *args )
2735 HWND hwnd = get_handle( &args );
2736 WCHAR *text = get_ptr( &args );
2737 INT count = get_ulong( &args );
2739 return NtUserInternalGetWindowText( hwnd, text, count );
2742 NTSTATUS WINAPI wow64_NtUserInvalidateRect( UINT *args )
2744 HWND hwnd = get_handle( &args );
2745 const RECT *rect = get_ptr( &args );
2746 BOOL erase = get_ulong( &args );
2748 return NtUserInvalidateRect( hwnd, rect, erase );
2751 NTSTATUS WINAPI wow64_NtUserInvalidateRgn( UINT *args )
2753 HWND hwnd = get_handle( &args );
2754 HRGN hrgn = get_handle( &args );
2755 BOOL erase = get_ulong( &args );
2757 return NtUserInvalidateRgn( hwnd, hrgn, erase );
2760 NTSTATUS WINAPI wow64_NtUserIsClipboardFormatAvailable( UINT *args )
2762 UINT format = get_ulong( &args );
2764 return NtUserIsClipboardFormatAvailable( format );
2767 NTSTATUS WINAPI wow64_NtUserIsMouseInPointerEnabled( UINT *args )
2769 return NtUserIsMouseInPointerEnabled();
2772 NTSTATUS WINAPI wow64_NtUserKillTimer( UINT *args )
2774 HWND hwnd = get_handle( &args );
2775 UINT_PTR id = get_ulong( &args );
2777 return NtUserKillTimer( hwnd, id );
2780 NTSTATUS WINAPI wow64_NtUserLockWindowUpdate( UINT *args )
2782 HWND hwnd = get_handle( &args );
2784 return NtUserLockWindowUpdate( hwnd );
2787 NTSTATUS WINAPI wow64_NtUserLogicalToPerMonitorDPIPhysicalPoint( UINT *args )
2789 HWND hwnd = get_handle( &args );
2790 POINT *pt = get_ptr( &args );
2792 return NtUserLogicalToPerMonitorDPIPhysicalPoint( hwnd, pt );
2795 NTSTATUS WINAPI wow64_NtUserMapVirtualKeyEx( UINT *args )
2797 UINT code = get_ulong( &args );
2798 UINT type = get_ulong( &args );
2799 HKL layout = get_handle( &args );
2801 return NtUserMapVirtualKeyEx( code, type, layout );
2804 NTSTATUS WINAPI wow64_NtUserMenuItemFromPoint( UINT *args )
2806 HWND hwnd = get_handle( &args );
2807 HMENU handle = get_handle( &args );
2808 int x = get_ulong( &args );
2809 int y = get_ulong( &args );
2811 return NtUserMenuItemFromPoint( hwnd, handle, x, y );
2814 static LRESULT message_call_32to64( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
2815 void *result_info, DWORD type, BOOL ansi )
2817 LRESULT ret = 0;
2819 switch (msg)
2821 case WM_NCCREATE:
2822 case WM_CREATE:
2824 CREATESTRUCT32 *cs32 = (void *)lparam;
2825 CREATESTRUCTW cs;
2827 createstruct_32to64( cs32, &cs );
2828 ret = NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&cs, result_info, type, ansi );
2829 createstruct_64to32( &cs, cs32 );
2830 return ret;
2833 case WM_MDICREATE:
2835 struct
2837 ULONG szClass;
2838 ULONG szTitle;
2839 ULONG hOwner;
2840 INT x;
2841 INT y;
2842 INT cx;
2843 INT cy;
2844 DWORD style;
2845 ULONG lParam;
2846 } *cs32 = (void *)lparam;
2847 MDICREATESTRUCTW cs;
2849 cs.szClass = UlongToPtr( cs32->szClass );
2850 cs.szTitle = UlongToPtr( cs32->szTitle );
2851 cs.hOwner = LongToHandle( cs32->hOwner );
2852 cs.x = cs32->x;
2853 cs.y = cs32->y;
2854 cs.cx = cs32->cx;
2855 cs.cy = cs32->cy;
2856 cs.style = cs32->style;
2857 cs.lParam = cs32->lParam;
2859 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&cs, result_info, type, ansi );
2862 case WM_WINDOWPOSCHANGING:
2863 case WM_WINDOWPOSCHANGED:
2865 WINDOWPOS32 *winpos32 = (void *)lparam;
2866 WINDOWPOS winpos;
2868 winpos_32to64( &winpos, winpos32 );
2869 ret = NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&winpos, result_info, type, ansi );
2870 winpos_64to32( &winpos, winpos32 );
2871 return ret;
2874 case WM_NCCALCSIZE:
2875 if (wparam)
2877 struct
2879 RECT rgrc[3];
2880 ULONG lppos;
2881 } *params32 = (void *)lparam;
2882 NCCALCSIZE_PARAMS params;
2883 WINDOWPOS winpos;
2885 params.rgrc[0] = params32->rgrc[0];
2886 params.rgrc[1] = params32->rgrc[1];
2887 params.rgrc[2] = params32->rgrc[2];
2888 params.lppos = &winpos;
2889 winpos_32to64( &winpos, UlongToPtr( params32->lppos ));
2890 ret = NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&params, result_info, type, ansi );
2891 params32->rgrc[0] = params.rgrc[0];
2892 params32->rgrc[1] = params.rgrc[1];
2893 params32->rgrc[2] = params.rgrc[2];
2894 winpos_64to32( &winpos, UlongToPtr( params32->lppos ));
2895 return ret;
2897 return NtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi );
2899 case WM_COMPAREITEM:
2901 struct
2903 UINT CtlType;
2904 UINT CtlID;
2905 ULONG hwndItem;
2906 UINT itemID1;
2907 ULONG itemData1;
2908 UINT itemID2;
2909 ULONG itemData2;
2910 DWORD dwLocaleId;
2911 } *cis32 = (void *)lparam;
2912 COMPAREITEMSTRUCT cis;
2914 cis.CtlType = cis32->CtlType;
2915 cis.CtlID = cis32->CtlID;
2916 cis.hwndItem = LongToHandle( cis32->hwndItem );
2917 cis.itemID1 = cis32->itemID1;
2918 cis.itemData1 = cis32->itemData1;
2919 cis.itemID2 = cis32->itemID2;
2920 cis.itemData2 = cis32->itemData2;
2921 cis.dwLocaleId = cis32->dwLocaleId;
2922 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&cis, result_info, type, ansi );
2925 case WM_DELETEITEM:
2927 DELETEITEMSTRUCT32 *dis32 = (void *)lparam;
2928 DELETEITEMSTRUCT dis;
2930 dis.CtlType = dis32->CtlType;
2931 dis.CtlID = dis32->CtlID;
2932 dis.hwndItem = LongToHandle( dis32->hwndItem );
2933 dis.itemData = dis32->itemData;
2934 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&dis, result_info, type, ansi );
2937 case WM_MEASUREITEM:
2939 MEASUREITEMSTRUCT32 *mis32 = (void *)lparam;
2940 MEASUREITEMSTRUCT mis;
2942 mis.CtlType = mis32->CtlType;
2943 mis.CtlID = mis32->CtlID;
2944 mis.itemID = mis32->itemID;
2945 mis.itemWidth = mis32->itemWidth;
2946 mis.itemHeight = mis32->itemHeight;
2947 mis.itemData = mis32->itemData;
2948 ret = NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&mis, result_info, type, ansi );
2949 mis32->itemWidth = mis.itemWidth;
2950 mis32->itemHeight = mis.itemHeight;
2951 return ret;
2954 case WM_DRAWITEM:
2956 DRAWITEMSTRUCT32 *dis32 = (void *)lparam;
2957 DRAWITEMSTRUCT dis;
2959 dis.CtlType = dis32->CtlType;
2960 dis.CtlID = dis32->CtlID;
2961 dis.itemID = dis32->itemID;
2962 dis.itemAction = dis32->itemAction;
2963 dis.itemState = dis32->itemState;
2964 dis.hwndItem = LongToHandle( dis32->hwndItem );
2965 dis.hDC = LongToHandle( dis32->hDC );
2966 dis.itemData = dis32->itemData;
2967 dis.rcItem.left = dis32->rcItem.left;
2968 dis.rcItem.top = dis32->rcItem.top;
2969 dis.rcItem.right = dis32->rcItem.right;
2970 dis.rcItem.bottom = dis32->rcItem.bottom;
2971 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&dis, result_info, type, ansi );
2974 case WM_COPYDATA:
2976 struct
2978 ULONG dwData;
2979 DWORD cbData;
2980 ULONG lpData;
2981 } *cds32 = (void *)lparam;
2982 COPYDATASTRUCT cds;
2984 cds.dwData = cds32->dwData;
2985 cds.cbData = cds32->cbData;
2986 cds.lpData = UlongToPtr( cds32->lpData );
2987 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&cds, result_info, type, ansi );
2990 case WM_GETDLGCODE:
2991 if (lparam)
2993 MSG32 *msg32 = (MSG32 *)lparam;
2994 MSG msg64;
2996 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)msg_32to64( &msg64, msg32 ),
2997 result_info, type, ansi );
2999 return NtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi );
3001 case WM_NEXTMENU:
3003 struct
3005 ULONG hmenuIn;
3006 ULONG hmenuNext;
3007 ULONG hwndNext;
3008 } *next32 = (void *)lparam;
3009 MDINEXTMENU next;
3011 next.hmenuIn = LongToHandle( next32->hmenuIn );
3012 next.hmenuNext = LongToHandle( next32->hmenuNext );
3013 next.hwndNext = LongToHandle( next32->hwndNext );
3014 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&next, result_info, type, ansi );
3017 case WM_PAINTCLIPBOARD:
3019 PAINTSTRUCT ps;
3021 paintstruct_32to64( &ps, (PAINTSTRUCT32 *)lparam );
3022 return NtUserMessageCall( hwnd, msg, wparam, (LPARAM)&ps, result_info, type, ansi );
3025 default:
3026 return NtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi );
3030 NTSTATUS WINAPI wow64_NtUserMessageCall( UINT *args )
3032 HWND hwnd = get_handle( &args );
3033 UINT msg = get_ulong( &args );
3034 LONG wparam = get_ulong( &args );
3035 LONG lparam = get_ulong( &args );
3036 void *result_info = get_ptr( &args );
3037 UINT type = get_ulong ( &args );
3038 BOOL ansi = get_ulong( &args );
3040 switch (type)
3042 case NtUserGetDispatchParams:
3043 case NtUserCallWindowProc:
3045 struct win_proc_params32 *params32 = result_info;
3046 struct win_proc_params params;
3047 ULONG *result32;
3049 result32 = UlongToPtr( params32->result );
3050 if (type == NtUserCallWindowProc) params.func = UlongToPtr( params32->func );
3052 if (!NtUserMessageCall( hwnd, msg, wparam, lparam, &params, type, ansi ))
3053 return FALSE;
3055 win_proc_params_64to32( &params, params32, result32 );
3056 return TRUE;
3059 case NtUserSendMessage:
3061 struct win_proc_params32 *params32 = result_info;
3063 if (params32)
3065 struct win_proc_params params;
3066 NTSTATUS ret;
3068 params.hwnd = 0;
3069 ret = message_call_32to64( hwnd, msg, wparam, lparam, &params, type, ansi );
3070 if (params.hwnd) win_proc_params_64to32( &params, params32, NULL );
3071 return ret;
3074 return message_call_32to64( hwnd, msg, wparam, lparam, result_info, type, ansi );
3077 case NtUserSendMessageTimeout:
3079 struct
3081 UINT flags;
3082 UINT timeout;
3083 DWORD result;
3084 } *params32 = result_info;
3085 struct send_message_timeout_params params;
3086 LRESULT ret;
3088 params.flags = params32->flags;
3089 params.timeout = params32->timeout;
3090 ret = message_call_32to64( hwnd, msg, wparam, lparam, &params, type, ansi );
3091 params32->result = params.result;
3092 return ret;
3095 case NtUserSendMessageCallback:
3097 struct
3099 ULONG callback;
3100 ULONG data;
3101 } *params32 = result_info;
3102 struct send_message_callback_params params;
3104 params.callback = UlongToPtr( params32->callback );
3105 params.data = params32->data;
3106 return message_call_32to64( hwnd, msg, wparam, lparam, &params, type, ansi );
3109 case NtUserSpyGetMsgName:
3110 /* no argument conversion */
3111 return NtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi );
3113 case NtUserWinProcResult:
3115 LONG result32 = PtrToLong( result_info );
3116 return message_call_32to64( hwnd, msg, wparam, lparam,
3117 LongToPtr( result32 ), type, ansi );
3121 return message_call_32to64( hwnd, msg, wparam, lparam, result_info, type, ansi );
3124 NTSTATUS WINAPI wow64_NtUserMoveWindow( UINT *args )
3126 HWND hwnd = get_handle( &args );
3127 INT x = get_ulong( &args );
3128 INT y = get_ulong( &args );
3129 INT cx = get_ulong( &args );
3130 INT cy = get_ulong( &args );
3131 BOOL repaint = get_ulong( &args );
3133 return NtUserMoveWindow( hwnd, x, y, cx, cy, repaint );
3136 NTSTATUS WINAPI wow64_NtUserMsgWaitForMultipleObjectsEx( UINT *args )
3138 DWORD count = get_ulong( &args );
3139 const ULONG *handles32 = get_ptr( &args );
3140 DWORD timeout = get_ulong( &args );
3141 DWORD mask = get_ulong( &args );
3142 DWORD flags = get_ulong( &args );
3144 HANDLE handles[MAXIMUM_WAIT_OBJECTS];
3145 unsigned int i;
3147 if (count > ARRAYSIZE(handles))
3149 set_last_error32( ERROR_INVALID_PARAMETER );
3150 return WAIT_FAILED;
3152 for (i = 0; i < count; i++) handles[i] = LongToHandle( handles32[i] );
3154 return NtUserMsgWaitForMultipleObjectsEx( count, handles, timeout, mask, flags );
3157 NTSTATUS WINAPI wow64_NtUserNotifyWinEvent( UINT *args )
3159 DWORD event = get_ulong( &args );
3160 HWND hwnd = get_handle( &args );
3161 LONG object_id = get_ulong( &args );
3162 LONG child_id = get_ulong( &args );
3164 NtUserNotifyWinEvent( event, hwnd, object_id, child_id );
3165 return 0;
3168 NTSTATUS WINAPI wow64_NtUserOpenClipboard( UINT *args )
3170 HWND hwnd = get_handle( &args );
3171 ULONG unk = get_ulong( &args );
3173 return NtUserOpenClipboard( hwnd, unk );
3176 NTSTATUS WINAPI wow64_NtUserOpenDesktop( UINT *args )
3178 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
3179 DWORD flags = get_ulong( &args );
3180 ACCESS_MASK access = get_ulong( &args );
3182 struct object_attr64 attr;
3183 HANDLE ret;
3185 ret = NtUserOpenDesktop( objattr_32to64( &attr, attr32 ), flags, access );
3186 return HandleToUlong( ret );
3189 NTSTATUS WINAPI wow64_NtUserOpenInputDesktop( UINT *args )
3191 DWORD flags = get_ulong( &args );
3192 BOOL inherit = get_ulong( &args );
3193 ACCESS_MASK access = get_ulong( &args );
3195 return HandleToUlong( NtUserOpenInputDesktop( flags, inherit, access ));
3198 NTSTATUS WINAPI wow64_NtUserOpenWindowStation( UINT *args )
3200 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
3201 ACCESS_MASK access = get_ulong( &args );
3203 struct object_attr64 attr;
3205 return HandleToUlong( NtUserOpenWindowStation( objattr_32to64( &attr, attr32 ), access ));
3208 NTSTATUS WINAPI wow64_NtUserPeekMessage( UINT *args )
3210 MSG32 *msg32 = get_ptr( &args );
3211 HWND hwnd = get_handle( &args );
3212 UINT first = get_ulong( &args );
3213 UINT last = get_ulong( &args );
3214 UINT flags = get_ulong( &args );
3215 MSG msg;
3217 if (!NtUserPeekMessage( msg32 ? &msg : NULL, hwnd, first, last, flags )) return FALSE;
3218 msg_64to32( &msg, msg32 );
3219 return TRUE;
3222 NTSTATUS WINAPI wow64_NtUserPerMonitorDPIPhysicalToLogicalPoint( UINT *args )
3224 HWND hwnd = get_handle( &args );
3225 POINT *pt = get_ptr( &args );
3227 return NtUserPerMonitorDPIPhysicalToLogicalPoint( hwnd, pt );
3230 NTSTATUS WINAPI wow64_NtUserPostMessage( UINT *args )
3232 HWND hwnd = get_handle( &args );
3233 UINT msg = get_ulong( &args );
3234 WPARAM wparam = get_ulong( &args );
3235 LPARAM lparam = get_ulong( &args );
3237 return NtUserPostMessage( hwnd, msg, wparam, lparam );
3240 NTSTATUS WINAPI wow64_NtUserPostThreadMessage( UINT *args )
3242 DWORD thread = get_ulong( &args );
3243 UINT msg = get_ulong( &args );
3244 WPARAM wparam = get_ulong( &args );
3245 LPARAM lparam = get_ulong( &args );
3247 return NtUserPostThreadMessage( thread, msg, wparam, lparam );
3250 NTSTATUS WINAPI wow64_NtUserPrintWindow( UINT *args )
3252 HWND hwnd = get_handle( &args );
3253 HDC hdc = get_handle( &args );
3254 UINT flags = get_ulong( &args );
3256 return NtUserPrintWindow( hwnd, hdc, flags );
3259 NTSTATUS WINAPI wow64_NtUserQueryInputContext( UINT *args )
3261 HIMC handle = get_handle( &args );
3262 UINT attr = get_ulong( &args );
3264 return NtUserQueryInputContext( handle, attr );
3267 NTSTATUS WINAPI wow64_NtUserRedrawWindow( UINT *args )
3269 HWND hwnd = get_handle( &args );
3270 const RECT *rect = get_ptr( &args );
3271 HRGN hrgn = get_handle( &args );
3272 UINT flags = get_ulong( &args );
3274 return NtUserRedrawWindow( hwnd, rect, hrgn, flags );
3277 NTSTATUS WINAPI wow64_NtUserRegisterHotKey( UINT *args )
3279 HWND hwnd = get_handle( &args );
3280 INT id = get_ulong( &args );
3281 UINT modifiers = get_ulong( &args );
3282 UINT vk = get_ulong( &args );
3284 return NtUserRegisterHotKey( hwnd, id, modifiers, vk );
3287 NTSTATUS WINAPI wow64_NtUserRegisterRawInputDevices( UINT *args )
3289 const RAWINPUTDEVICE32 *devices32 = get_ptr( &args );
3290 UINT count = get_ulong( &args );
3291 UINT size = get_ulong( &args );
3293 RAWINPUTDEVICE *devices64;
3294 unsigned int i;
3296 if (size != sizeof(RAWINPUTDEVICE32))
3298 set_last_error32( ERROR_INVALID_PARAMETER );
3299 return FALSE;
3302 if (!(devices64 = Wow64AllocateTemp( count * sizeof(*devices64) )))
3304 set_last_error32( ERROR_NOT_ENOUGH_MEMORY );
3305 return FALSE;
3308 for (i = 0; i < count; ++i)
3310 devices64[i].usUsagePage = devices32[i].usUsagePage;
3311 devices64[i].usUsage = devices32[i].usUsage;
3312 devices64[i].dwFlags = devices32[i].dwFlags;
3313 devices64[i].hwndTarget = UlongToPtr( devices32[i].hwndTarget );
3316 return NtUserRegisterRawInputDevices( devices64, count, sizeof(*devices64) );
3319 NTSTATUS WINAPI wow64_NtUserRemoveClipboardFormatListener( UINT *args )
3321 HWND hwnd = get_handle( &args );
3323 return NtUserRemoveClipboardFormatListener( hwnd );
3326 NTSTATUS WINAPI wow64_NtUserRemoveMenu( UINT *args )
3328 HMENU handle = get_handle( &args );
3329 UINT id = get_ulong( &args );
3330 UINT flags = get_ulong( &args );
3332 return NtUserRemoveMenu( handle, id, flags );
3335 NTSTATUS WINAPI wow64_NtUserRemoveProp( UINT *args )
3337 HWND hwnd = get_handle( &args );
3338 const WCHAR *str = get_ptr( &args );
3340 return HandleToUlong( NtUserRemoveProp( hwnd, str ));
3343 NTSTATUS WINAPI wow64_NtUserScrollWindowEx( UINT *args )
3345 HWND hwnd = get_handle( &args );
3346 INT dx = get_ulong( &args );
3347 INT dy = get_ulong( &args );
3348 const RECT *rect = get_ptr( &args );
3349 const RECT *clip_rect = get_ptr( &args );
3350 HRGN update_rgn = get_handle( &args );
3351 RECT *update_rect = get_ptr( &args );
3352 UINT flags = get_ulong( &args );
3354 return NtUserScrollWindowEx( hwnd, dx, dy, rect, clip_rect, update_rgn, update_rect, flags );
3357 NTSTATUS WINAPI wow64_NtUserSendInput( UINT *args )
3359 UINT count = get_ulong( &args );
3360 INPUT32 *inputs32 = get_ptr( &args );
3361 int size = get_ulong( &args );
3363 INPUT *inputs = NULL;
3364 unsigned int i;
3366 if (size != sizeof(*inputs32) || !count)
3368 set_last_error32( ERROR_INVALID_PARAMETER );
3369 return 0;
3372 if (!inputs32)
3374 set_last_error32( ERROR_NOACCESS );
3375 return 0;
3378 if (count && !(inputs = Wow64AllocateTemp( count * sizeof(*inputs) )))
3379 return 0;
3381 for (i = 0; i < count; i++)
3383 inputs[i].type = inputs32[i].type;
3384 switch (inputs[i].type)
3386 case INPUT_MOUSE:
3387 inputs[i].mi.dx = inputs32[i].mi.dx;
3388 inputs[i].mi.dy = inputs32[i].mi.dy;
3389 inputs[i].mi.mouseData = inputs32[i].mi.mouseData;
3390 inputs[i].mi.dwFlags = inputs32[i].mi.dwFlags;
3391 inputs[i].mi.time = inputs32[i].mi.time;
3392 inputs[i].mi.dwExtraInfo = inputs32[i].mi.dwExtraInfo;
3393 break;
3394 case INPUT_KEYBOARD:
3395 inputs[i].ki.wVk = inputs32[i].ki.wVk;
3396 inputs[i].ki.wScan = inputs32[i].ki.wScan;
3397 inputs[i].ki.dwFlags = inputs32[i].ki.dwFlags;
3398 inputs[i].ki.time = inputs32[i].ki.time;
3399 inputs[i].ki.dwExtraInfo = inputs32[i].ki.dwExtraInfo;
3400 break;
3401 case INPUT_HARDWARE:
3402 inputs[i].hi = inputs32[i].hi;
3403 break;
3407 return NtUserSendInput( count, inputs, sizeof(*inputs) );
3410 NTSTATUS WINAPI wow64_NtUserSetActiveWindow( UINT *args )
3412 HWND hwnd = get_handle( &args );
3414 return HandleToUlong( NtUserSetActiveWindow( hwnd ));
3417 NTSTATUS WINAPI wow64_NtUserSetCapture( UINT *args )
3419 HWND hwnd = get_handle( &args );
3421 return HandleToUlong( NtUserSetCapture( hwnd ));
3424 NTSTATUS WINAPI wow64_NtUserSetClassLong( UINT *args )
3426 HWND hwnd = get_handle( &args );
3427 INT offset = get_ulong( &args );
3428 LONG newval = get_ulong( &args );
3429 BOOL ansi = get_ulong( &args );
3431 return NtUserSetClassLong( hwnd, offset, newval, ansi );
3434 NTSTATUS WINAPI wow64_NtUserSetClassLongPtr( UINT *args )
3436 HWND hwnd = get_handle( &args );
3437 INT offset = get_ulong( &args );
3438 LONG_PTR newval = get_ulong( &args );
3439 BOOL ansi = get_ulong( &args );
3441 if (offset == GCLP_MENUNAME)
3443 struct client_menu_name menu_name;
3444 struct client_menu_name32 *menu_name32 = UlongToPtr( newval );
3445 NtUserSetClassLong( hwnd, offset,
3446 (UINT_PTR)client_menu_name_32to64( &menu_name, menu_name32 ), ansi );
3447 client_menu_name_64to32( &menu_name, menu_name32 );
3448 return 0;
3451 return NtUserSetClassLongPtr( hwnd, offset, newval, ansi );
3454 NTSTATUS WINAPI wow64_NtUserSetClassWord( UINT *args )
3456 HWND hwnd = get_handle( &args );
3457 INT offset = get_ulong( &args );
3458 WORD newval = get_ulong( &args );
3460 return NtUserSetClassWord( hwnd, offset, newval );
3463 NTSTATUS WINAPI wow64_NtUserSetClipboardData( UINT *args )
3465 UINT format = get_ulong( &args );
3466 HANDLE handle = get_handle( &args );
3467 struct
3469 UINT32 data;
3470 UINT32 size;
3471 BOOL cache_only;
3472 UINT seqno;
3473 } *params32 = get_ptr( &args );
3475 struct set_clipboard_params params;
3476 params.data = UlongToPtr( params32->data );
3477 params.size = params32->size;
3478 params.cache_only = params32->cache_only;
3479 params.seqno = params32->seqno;
3481 return NtUserSetClipboardData( format, handle, &params );
3484 NTSTATUS WINAPI wow64_NtUserSetClipboardViewer( UINT *args )
3486 HWND hwnd = get_handle( &args );
3488 return HandleToUlong( NtUserSetClipboardViewer( hwnd ));
3491 NTSTATUS WINAPI wow64_NtUserSetCursor( UINT *args )
3493 HCURSOR cursor = get_handle( &args );
3495 return HandleToUlong( NtUserSetCursor( cursor ));
3498 NTSTATUS WINAPI wow64_NtUserSetCursorIconData( UINT *args )
3500 HCURSOR cursor = get_handle( &args );
3501 UNICODE_STRING32 *module32 = get_ptr( &args );
3502 UNICODE_STRING32 *res_name32 = get_ptr( &args );
3503 struct
3505 UINT flags;
3506 UINT num_steps;
3507 UINT num_frames;
3508 UINT delay;
3509 ULONG frames;
3510 ULONG frame_seq;
3511 ULONG frame_rates;
3512 ULONG rsrc;
3513 } *desc32 = get_ptr( &args );
3514 struct
3516 UINT width;
3517 UINT height;
3518 ULONG color;
3519 ULONG alpha;
3520 ULONG mask;
3521 POINT hotspot;
3522 } *frames32 = UlongToPtr( desc32->frames );
3524 UNICODE_STRING module, res_name;
3525 struct cursoricon_desc desc;
3526 UINT i, num_frames;
3528 num_frames = max( desc32->num_frames, 1 );
3529 if (!(desc.frames = Wow64AllocateTemp( num_frames * sizeof(*desc.frames) ))) return FALSE;
3530 desc.flags = desc32->flags;
3531 desc.num_steps = desc32->num_steps;
3532 desc.num_frames = desc32->num_frames;
3533 desc.delay = desc32->delay;
3534 desc.frame_seq = UlongToPtr( desc32->frame_seq );
3535 desc.frame_rates = UlongToPtr( desc32->frame_rates );
3536 desc.rsrc = UlongToPtr( desc32->rsrc );
3538 for (i = 0; i < num_frames; i++)
3540 desc.frames[i].width = frames32[i].width;
3541 desc.frames[i].height = frames32[i].height;
3542 desc.frames[i].color = UlongToHandle( frames32[i].color );
3543 desc.frames[i].alpha = UlongToHandle( frames32[i].alpha );
3544 desc.frames[i].mask = UlongToHandle( frames32[i].mask );
3545 desc.frames[i].hotspot = frames32[i].hotspot;
3548 return NtUserSetCursorIconData( cursor, unicode_str_32to64( &module, module32 ),
3549 unicode_str_32to64( &res_name, res_name32), &desc );
3552 NTSTATUS WINAPI wow64_NtUserSetCursorPos( UINT *args )
3554 INT x = get_ulong( &args );
3555 INT y = get_ulong( &args );
3557 return NtUserSetCursorPos( x, y );
3560 NTSTATUS WINAPI wow64_NtUserSetFocus( UINT *args )
3562 HWND hwnd = get_handle( &args );
3564 return HandleToUlong( NtUserSetFocus( hwnd ));
3567 NTSTATUS WINAPI wow64_NtUserSetInternalWindowPos( UINT *args )
3569 HWND hwnd = get_handle( &args );
3570 UINT cmd = get_ulong( &args );
3571 RECT *rect = get_ptr( &args );
3572 POINT *pt = get_ptr( &args );
3574 NtUserSetInternalWindowPos( hwnd, cmd, rect, pt );
3575 return 0;
3578 NTSTATUS WINAPI wow64_NtUserSetKeyboardState( UINT *args )
3580 BYTE *state = get_ptr( &args );
3582 return NtUserSetKeyboardState( state );
3585 NTSTATUS WINAPI wow64_NtUserSetLayeredWindowAttributes( UINT *args )
3587 HWND hwnd = get_handle( &args );
3588 COLORREF key = get_ulong( &args );
3589 BYTE alpha = get_ulong( &args );
3590 DWORD flags = get_ulong( &args );
3592 return NtUserSetLayeredWindowAttributes( hwnd, key, alpha, flags );
3595 NTSTATUS WINAPI wow64_NtUserSetMenu( UINT *args )
3597 HWND hwnd = get_handle( &args );
3598 HMENU menu = get_handle( &args );
3600 return NtUserSetMenu( hwnd, menu );
3603 NTSTATUS WINAPI wow64_NtUserSetMenuContextHelpId( UINT *args )
3605 HMENU menu = get_handle( &args );
3606 DWORD id = get_ulong( &args );
3608 return NtUserSetMenuContextHelpId( menu, id );
3611 NTSTATUS WINAPI wow64_NtUserSetMenuDefaultItem( UINT *args )
3613 HMENU handle = get_handle( &args );
3614 UINT item = get_ulong( &args );
3615 UINT bypos = get_ulong( &args );
3617 return NtUserSetMenuDefaultItem( handle, item, bypos );
3620 NTSTATUS WINAPI wow64_NtUserSetObjectInformation( UINT *args )
3622 HANDLE handle = get_handle( &args );
3623 INT index = get_ulong( &args );
3624 void *info = get_ptr( &args );
3625 DWORD len = get_ulong( &args );
3627 return NtUserSetObjectInformation( handle, index, info, len );
3630 NTSTATUS WINAPI wow64_NtUserSetParent( UINT *args )
3632 HWND hwnd = get_handle( &args );
3633 HWND parent = get_handle( &args );
3635 return HandleToUlong( NtUserSetParent( hwnd, parent ));
3638 NTSTATUS WINAPI wow64_NtUserSetProcessDpiAwarenessContext( UINT *args )
3640 ULONG awareness = get_ulong( &args );
3641 ULONG unknown = get_ulong( &args );
3643 return NtUserSetProcessDpiAwarenessContext( awareness, unknown );
3646 NTSTATUS WINAPI wow64_NtUserSetProcessWindowStation( UINT *args )
3648 HWINSTA handle = get_handle( &args );
3650 return NtUserSetProcessWindowStation( handle );
3653 NTSTATUS WINAPI wow64_NtUserSetProp( UINT *args )
3655 HWND hwnd = get_handle( &args );
3656 const WCHAR *str = get_ptr( &args );
3657 HANDLE handle = get_handle( &args );
3659 return NtUserSetProp( hwnd, str, handle );
3662 NTSTATUS WINAPI wow64_NtUserSetScrollInfo( UINT *args )
3664 HWND hwnd = get_handle( &args );
3665 INT bar = get_ulong( &args );
3666 const SCROLLINFO *info = get_ptr( &args );
3667 BOOL redraw = get_ulong( &args );
3669 return NtUserSetScrollInfo( hwnd, bar, info, redraw );
3672 NTSTATUS WINAPI wow64_NtUserSetShellWindowEx( UINT *args )
3674 HWND shell = get_handle( &args );
3675 HWND list_view = get_handle( &args );
3677 return NtUserSetShellWindowEx( shell, list_view );
3680 NTSTATUS WINAPI wow64_NtUserSetSysColors( UINT *args )
3682 INT count = get_ulong( &args );
3683 const INT *colors = get_ptr( &args );
3684 const COLORREF *values = get_ptr( &args );
3686 return NtUserSetSysColors( count, colors, values );
3689 NTSTATUS WINAPI wow64_NtUserSetSystemMenu( UINT *args )
3691 HWND hwnd = get_handle( &args );
3692 HMENU menu = get_handle( &args );
3694 return NtUserSetSystemMenu( hwnd, menu );
3697 NTSTATUS WINAPI wow64_NtUserSetSystemTimer( UINT *args )
3699 HWND hwnd = get_handle( &args );
3700 UINT_PTR id = get_ulong( &args );
3701 UINT timeout = get_ulong( &args );
3703 return NtUserSetSystemTimer( hwnd, id, timeout );
3706 NTSTATUS WINAPI wow64_NtUserSetThreadDesktop( UINT *args )
3708 HDESK handle = get_handle( &args );
3710 return NtUserSetThreadDesktop( handle );
3713 NTSTATUS WINAPI wow64_NtUserSetTimer( UINT *args )
3715 HWND hwnd = get_handle( &args );
3716 UINT_PTR id = get_ulong( &args );
3717 UINT timeout = get_ulong( &args );
3718 TIMERPROC proc = get_ptr( &args );
3719 ULONG tolerance = get_ulong( &args );
3721 return NtUserSetTimer( hwnd, id, timeout, proc, tolerance );
3724 NTSTATUS WINAPI wow64_NtUserSetWinEventHook( UINT *args )
3726 DWORD event_min = get_ulong( &args );
3727 DWORD event_max = get_ulong( &args );
3728 HMODULE inst = get_handle( &args );
3729 UNICODE_STRING32 *module32 = get_ptr( &args );
3730 WINEVENTPROC proc = get_ptr(&args );
3731 DWORD pid = get_ulong( &args );
3732 DWORD tid = get_ulong( &args );
3733 DWORD flags = get_ulong( &args );
3734 UNICODE_STRING module;
3735 HWINEVENTHOOK ret;
3737 ret = NtUserSetWinEventHook( event_min, event_max, inst,
3738 unicode_str_32to64( &module, module32 ),
3739 proc, pid, tid, flags );
3740 return HandleToUlong( ret );
3743 NTSTATUS WINAPI wow64_NtUserSetWindowLong( UINT *args )
3745 HWND hwnd = get_handle( &args );
3746 INT offset = get_ulong( &args );
3747 LONG newval = get_ulong( &args );
3748 BOOL ansi = get_ulong( &args );
3750 return NtUserSetWindowLong( hwnd, offset, newval, ansi );
3753 NTSTATUS WINAPI wow64_NtUserSetWindowLongPtr( UINT *args )
3755 HWND hwnd = get_handle( &args );
3756 INT offset = get_ulong( &args );
3757 LONG_PTR newval = get_ulong( &args );
3758 BOOL ansi = get_ulong( &args );
3760 return NtUserSetWindowLongPtr( hwnd, offset, newval, ansi );
3763 NTSTATUS WINAPI wow64_NtUserSetWindowPlacement( UINT *args )
3765 HWND hwnd = get_handle( &args );
3766 const WINDOWPLACEMENT *wpl = get_ptr( &args );
3768 return NtUserSetWindowPlacement( hwnd, wpl );
3771 NTSTATUS WINAPI wow64_NtUserSetWindowPos( UINT *args )
3773 HWND hwnd = get_handle( &args );
3774 HWND after = get_handle( &args );
3775 INT x = get_ulong( &args );
3776 INT y = get_ulong( &args );
3777 INT cx = get_ulong( &args );
3778 INT cy = get_ulong( &args );
3779 UINT flags = get_ulong( &args );
3781 return NtUserSetWindowPos( hwnd, after, x, y, cx, cy, flags );
3784 NTSTATUS WINAPI wow64_NtUserSetWindowRgn( UINT *args )
3786 HWND hwnd = get_handle( &args );
3787 HRGN hrgn = get_handle( &args );
3788 BOOL redraw = get_ulong( &args );
3790 return NtUserSetWindowRgn( hwnd, hrgn, redraw );
3793 NTSTATUS WINAPI wow64_NtUserSetWindowWord( UINT *args )
3795 HWND hwnd = get_handle( &args );
3796 INT offset = get_ulong( &args );
3797 WORD newval = get_ulong( &args );
3799 return NtUserSetWindowWord( hwnd, offset, newval );
3802 NTSTATUS WINAPI wow64_NtUserSetWindowsHookEx( UINT *args )
3804 HINSTANCE inst = get_handle( &args );
3805 UNICODE_STRING32 *module32 = get_ptr( &args );
3806 DWORD tid = get_ulong( &args );
3807 INT id = get_ulong( &args );
3808 HOOKPROC proc = get_ptr( &args );
3809 BOOL ansi = get_ulong( &args );
3810 UNICODE_STRING module;
3811 HHOOK ret;
3813 ret = NtUserSetWindowsHookEx( inst, unicode_str_32to64( &module, module32 ),
3814 tid, id, proc, ansi );
3815 return HandleToUlong( ret );
3818 NTSTATUS WINAPI wow64_NtUserShowCaret( UINT *args )
3820 HWND hwnd = get_handle( &args );
3822 return NtUserShowCaret( hwnd );
3825 NTSTATUS WINAPI wow64_NtUserShowCursor( UINT *args )
3827 BOOL show = get_ulong( &args );
3829 return NtUserShowCursor( show );
3832 NTSTATUS WINAPI wow64_NtUserShowScrollBar( UINT *args )
3834 HWND hwnd = get_handle( &args );
3835 INT bar = get_ulong( &args );
3836 BOOL show = get_ulong( &args );
3838 return NtUserShowScrollBar( hwnd, bar, show );
3841 NTSTATUS WINAPI wow64_NtUserShowWindow( UINT *args )
3843 HWND hwnd = get_handle( &args );
3844 INT cmd = get_ulong( &args );
3846 return NtUserShowWindow( hwnd, cmd );
3849 NTSTATUS WINAPI wow64_NtUserShowWindowAsync( UINT *args )
3851 HWND hwnd = get_handle( &args );
3852 INT cmd = get_ulong( &args );
3854 return NtUserShowWindowAsync( hwnd, cmd );
3857 NTSTATUS WINAPI wow64_NtUserSystemParametersInfo( UINT *args )
3859 UINT action = get_ulong( &args );
3860 UINT val = get_ulong( &args );
3861 void *ptr = get_ptr( &args );
3862 UINT winini = get_ulong( &args );
3864 switch (action)
3866 case SPI_GETSERIALKEYS:
3867 if (ptr)
3869 struct
3871 UINT cbSize;
3872 DWORD dwFlags;
3873 ULONG lpszActivePort;
3874 ULONG lpszPort;
3875 UINT iBaudRate;
3876 UINT iPortState;
3877 UINT iActive;
3878 } *keys32 = ptr;
3879 SERIALKEYSW keys;
3881 if (keys32->cbSize != sizeof(*keys32)) return FALSE;
3882 keys.cbSize = sizeof(keys);
3883 if (!NtUserSystemParametersInfo( action, val, &keys, winini )) return FALSE;
3884 keys32->dwFlags = keys.dwFlags;
3885 keys32->lpszActivePort = PtrToUlong( keys.lpszActivePort );
3886 keys32->lpszPort = PtrToUlong( keys.lpszPort );
3887 keys32->iBaudRate = keys.iBaudRate;
3888 keys32->iPortState = keys.iPortState;
3889 keys32->iActive = keys.iActive;
3890 return TRUE;
3892 break;
3894 case SPI_GETSOUNDSENTRY:
3895 if (ptr)
3897 struct
3899 UINT cbSize;
3900 DWORD dwFlags;
3901 DWORD iFSTextEffect;
3902 DWORD iFSTextEffectMSec;
3903 DWORD iFSTextEffectColorBits;
3904 DWORD iFSGrafEffect;
3905 DWORD iFSGrafEffectMSec;
3906 DWORD iFSGrafEffectColor;
3907 DWORD iWindowsEffect;
3908 DWORD iWindowsEffectMSec;
3909 ULONG lpszWindowsEffectDLL;
3910 DWORD iWindowsEffectOrdinal;
3911 } *entry32 = ptr;
3912 SOUNDSENTRYW entry;
3914 if (entry32->cbSize != sizeof(*entry32)) return FALSE;
3915 entry.cbSize = sizeof(entry);
3916 if (!NtUserSystemParametersInfo( action, val, &entry, winini )) return FALSE;
3917 entry32->dwFlags = entry.dwFlags;
3918 entry32->iFSTextEffect = entry.iFSTextEffect;
3919 entry32->iFSTextEffectMSec = entry.iFSTextEffectMSec;
3920 entry32->iFSTextEffectColorBits = entry.iFSTextEffectColorBits;
3921 entry32->iFSGrafEffect = entry.iFSGrafEffect;
3922 entry32->iFSGrafEffectMSec = entry.iFSGrafEffectMSec;
3923 entry32->iFSGrafEffectColor = entry.iFSGrafEffectColor;
3924 entry32->iWindowsEffect = entry.iWindowsEffect;
3925 entry32->iWindowsEffectMSec = entry.iWindowsEffectMSec;
3926 entry32->lpszWindowsEffectDLL = PtrToUlong( entry.lpszWindowsEffectDLL );
3927 entry32->iWindowsEffectOrdinal = entry.iWindowsEffectOrdinal;
3928 return TRUE;
3930 break;
3932 case SPI_GETHIGHCONTRAST:
3933 if (ptr)
3935 struct
3937 UINT cbSize;
3938 DWORD dwFlags;
3939 ULONG lpszDefaultScheme;
3940 } *info32 = ptr;
3941 HIGHCONTRASTW info;
3943 if (info32->cbSize != sizeof(*info32)) return FALSE;
3944 info.cbSize = sizeof(info);
3945 if (!NtUserSystemParametersInfo( action, val, &info, winini )) return FALSE;
3946 info32->dwFlags = info.dwFlags;
3947 info32->lpszDefaultScheme = PtrToUlong( info.lpszDefaultScheme );
3948 return TRUE;
3950 break;
3953 return NtUserSystemParametersInfo( action, val, ptr, winini );
3956 NTSTATUS WINAPI wow64_NtUserSystemParametersInfoForDpi( UINT *args )
3958 UINT action = get_ulong( &args );
3959 UINT val = get_ulong( &args );
3960 void *ptr = get_ptr( &args );
3961 UINT winini = get_ulong( &args );
3962 UINT dpi = get_ulong( &args );
3964 return NtUserSystemParametersInfoForDpi( action, val, ptr, winini, dpi );
3967 NTSTATUS WINAPI wow64_NtUserThunkedMenuInfo( UINT *args )
3969 HMENU menu = get_handle( &args );
3970 MENUINFO32 *info32 = get_ptr( &args );
3971 MENUINFO info;
3973 if (info32)
3975 info.cbSize = sizeof(info);
3976 info.fMask = info32->fMask;
3977 info.dwStyle = info32->dwStyle;
3978 info.cyMax = info32->cyMax;
3979 info.hbrBack = UlongToHandle( info32->hbrBack );
3980 info.dwContextHelpID = info32->dwContextHelpID;
3981 info.dwMenuData = info32->dwMenuData;
3984 return NtUserThunkedMenuInfo( menu, info32 ? &info : NULL );
3987 NTSTATUS WINAPI wow64_NtUserThunkedMenuItemInfo( UINT *args )
3989 HMENU handle = get_handle( &args );
3990 UINT pos = get_ulong( &args );
3991 UINT flags = get_ulong( &args );
3992 UINT method = get_ulong( &args );
3993 MENUITEMINFOW32 *info32 = get_ptr( &args );
3994 UNICODE_STRING32 *str32 = get_ptr( &args );
3995 MENUITEMINFOW info = { sizeof(info) }, *info_ptr;
3996 UNICODE_STRING str;
3997 UINT ret;
3999 if (info32)
4001 info.cbSize = sizeof(info);
4002 info.fMask = info32->fMask;
4003 switch (method)
4005 case NtUserSetMenuItemInfo:
4006 case NtUserInsertMenuItem:
4007 info.fType = info32->fType;
4008 info.fState = info32->fState;
4009 info.wID = info32->wID;
4010 info.hSubMenu = LongToHandle( info32->hSubMenu );
4011 info.hbmpChecked = UlongToHandle( info32->hbmpChecked );
4012 info.hbmpUnchecked = UlongToHandle( info32->hbmpUnchecked );
4013 info.dwItemData = info32->dwItemData;
4014 info.dwTypeData = UlongToPtr( info32->dwTypeData );
4015 info.cch = info32->cch;
4016 info.hbmpItem = UlongToHandle( info32->hbmpItem );
4017 break;
4018 case NtUserCheckMenuRadioItem:
4019 info.cch = info32->cch;
4020 break;
4021 case NtUserGetMenuItemInfoA:
4022 case NtUserGetMenuItemInfoW:
4023 info.dwTypeData = UlongToPtr( info32->dwTypeData );
4024 info.cch = info32->cch;
4025 break;
4027 info_ptr = &info;
4029 else info_ptr = NULL;
4031 ret = NtUserThunkedMenuItemInfo( handle, pos, flags, method, info_ptr,
4032 unicode_str_32to64( &str, str32 ));
4034 if (info_ptr)
4036 switch (method)
4038 case NtUserGetMenuItemInfoA:
4039 case NtUserGetMenuItemInfoW:
4040 if (info.fMask & (MIIM_TYPE | MIIM_STRING | MIIM_FTYPE))
4041 info32->fType = info.fType;
4042 if (info.fMask & (MIIM_TYPE | MIIM_BITMAP))
4043 info32->hbmpItem = HandleToUlong( info.hbmpItem );
4044 if (info.fMask & (MIIM_TYPE | MIIM_STRING))
4046 info32->dwTypeData = (UINT_PTR)info.dwTypeData;
4047 info32->cch = info.cch;
4049 if (info.fMask & MIIM_STATE) info32->fState = info.fState;
4050 if (info.fMask & MIIM_ID) info32->wID = info.wID;
4051 info32->hSubMenu = HandleToUlong( info.hSubMenu );
4052 if (info.fMask & MIIM_CHECKMARKS)
4054 info32->hbmpChecked = HandleToUlong( info.hbmpChecked );
4055 info32->hbmpUnchecked = HandleToUlong( info.hbmpUnchecked );
4057 if (info.fMask & MIIM_DATA) info32->dwItemData = info.dwItemData;
4058 break;
4062 return ret;
4065 NTSTATUS WINAPI wow64_NtUserToUnicodeEx( UINT *args )
4067 UINT virt = get_ulong( &args );
4068 UINT scan = get_ulong( &args );
4069 const BYTE *state = get_ptr( &args );
4070 WCHAR *str = get_ptr( &args );
4071 int size = get_ulong( &args );
4072 UINT flags = get_ulong( &args );
4073 HKL layout = get_handle( &args );
4075 return NtUserToUnicodeEx( virt, scan, state, str, size, flags, layout );
4078 NTSTATUS WINAPI wow64_NtUserTrackMouseEvent( UINT *args )
4080 struct
4082 DWORD cbSize;
4083 DWORD dwFlags;
4084 UINT32 hwndTrack;
4085 DWORD dwHoverTime;
4086 } *info32 = get_ptr( &args );
4087 TRACKMOUSEEVENT info;
4088 BOOL ret;
4090 if (info32->cbSize != sizeof(*info32))
4092 set_last_error32( ERROR_INVALID_PARAMETER );
4093 return FALSE;
4096 info.cbSize = sizeof(info);
4097 info.dwFlags = info32->dwFlags;
4098 info.hwndTrack = LongToHandle( info32->hwndTrack );
4099 info.dwHoverTime = info32->dwHoverTime;
4100 ret = NtUserTrackMouseEvent( &info );
4101 info32->dwFlags = info.dwFlags;
4102 info32->hwndTrack = HandleToUlong( info.hwndTrack );
4103 info32->dwHoverTime = info.dwHoverTime;
4104 return ret;
4107 NTSTATUS WINAPI wow64_NtUserTrackPopupMenuEx( UINT *args )
4109 HMENU handle = get_handle( &args );
4110 UINT flags = get_ulong( &args );
4111 int x = get_ulong( &args );
4112 int y = get_ulong( &args );
4113 HWND hwnd = get_handle( &args );
4114 TPMPARAMS *params = get_ptr( &args );
4116 return NtUserTrackPopupMenuEx( handle, flags, x, y, hwnd, params );
4119 NTSTATUS WINAPI wow64_NtUserTranslateAccelerator( UINT *args )
4121 HWND hwnd = get_handle( &args );
4122 HACCEL accel = get_handle( &args );
4123 MSG32 *msg32 = get_ptr( &args );
4125 MSG msg;
4127 return NtUserTranslateAccelerator( hwnd, accel, msg_32to64( &msg, msg32 ));
4130 NTSTATUS WINAPI wow64_NtUserTranslateMessage( UINT *args )
4132 const MSG32 *msg32 = get_ptr( &args );
4133 UINT flags = get_ulong( &args );
4134 MSG msg;
4136 return NtUserTranslateMessage( msg_32to64( &msg, msg32 ), flags );
4139 NTSTATUS WINAPI wow64_NtUserUnhookWinEvent( UINT *args )
4141 HWINEVENTHOOK handle = get_handle( &args );
4143 return NtUserUnhookWinEvent( handle );
4146 NTSTATUS WINAPI wow64_NtUserUnhookWindowsHookEx( UINT *args )
4148 HHOOK handle = get_handle( &args );
4150 return NtUserUnhookWindowsHookEx( handle );
4153 NTSTATUS WINAPI wow64_NtUserUnregisterClass( UINT *args )
4155 UNICODE_STRING32 *name32 = get_ptr( &args );
4156 HINSTANCE instance = get_ptr( &args );
4157 struct client_menu_name32 *menu_name32 = get_ptr( &args );
4159 UNICODE_STRING name;
4160 struct client_menu_name menu_name;
4161 BOOL ret;
4163 ret = NtUserUnregisterClass( unicode_str_32to64( &name, name32 ), instance, &menu_name );
4164 if (ret) client_menu_name_64to32( &menu_name, menu_name32 );
4165 return ret;
4168 NTSTATUS WINAPI wow64_NtUserUnregisterHotKey( UINT *args )
4170 HWND hwnd = get_handle( &args );
4171 int id = get_ulong( &args );
4173 return NtUserUnregisterHotKey( hwnd, id );
4176 NTSTATUS WINAPI wow64_NtUserUpdateInputContext( UINT *args )
4178 HIMC handle = get_handle( &args );
4179 UINT attr = get_ulong( &args );
4180 UINT_PTR value = get_ulong( &args );
4182 return NtUserUpdateInputContext( handle, attr, value );
4185 NTSTATUS WINAPI wow64_NtUserValidateRect( UINT *args )
4187 HWND hwnd = get_handle( &args );
4188 const RECT *rect = get_ptr( &args );
4190 return NtUserValidateRect( hwnd, rect );
4193 NTSTATUS WINAPI wow64_NtUserVkKeyScanEx( UINT *args )
4195 WCHAR chr = get_ulong( &args );
4196 HKL layout = get_handle( &args );
4198 return NtUserVkKeyScanEx( chr, layout );
4201 NTSTATUS WINAPI wow64_NtUserWaitForInputIdle( UINT *args )
4203 HANDLE process = get_handle( &args );
4204 DWORD timeout = get_ulong( &args );
4205 BOOL wow = get_ulong( &args );
4207 return NtUserWaitForInputIdle( process, timeout, wow );
4210 NTSTATUS WINAPI wow64_NtUserWaitMessage( UINT *args )
4212 return NtUserWaitMessage();
4215 NTSTATUS WINAPI wow64_NtUserWindowFromDC( UINT *args )
4217 HDC hdc = get_handle( &args );
4219 return HandleToUlong( NtUserWindowFromDC( hdc ));
4222 NTSTATUS WINAPI wow64_NtUserWindowFromPoint( UINT *args )
4224 LONG x = get_ulong( &args );
4225 LONG y = get_ulong( &args );
4227 return HandleToUlong( NtUserWindowFromPoint( x, y ));
4230 NTSTATUS WINAPI wow64_NtUserDisplayConfigGetDeviceInfo( UINT *args )
4232 DISPLAYCONFIG_DEVICE_INFO_HEADER *packet = get_ptr( &args );
4234 return NtUserDisplayConfigGetDeviceInfo( packet );