[FORMATTING] Fix indentation, no functional changes.
[reactos.git] / win32ss / user / ntuser / simplecall.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * PURPOSE: NtUserCallXxx call stubs
5 * FILE: win32ss/user/ntuser/simplecall.c
6 * PROGRAMER: Ge van Geldorp (ge@gse.nl)
7 */
8
9 #include <win32k.h>
10
11 DBG_DEFAULT_CHANNEL(UserMisc);
12
13 /* Registered logon process ID */
14 HANDLE gpidLogon = 0;
15
16 BOOL FASTCALL
17 co_IntRegisterLogonProcess(HANDLE ProcessId, BOOL Register)
18 {
19 NTSTATUS Status;
20 PEPROCESS Process;
21
22 Status = PsLookupProcessByProcessId(ProcessId, &Process);
23 if (!NT_SUCCESS(Status))
24 {
25 EngSetLastError(RtlNtStatusToDosError(Status));
26 return FALSE;
27 }
28
29 ProcessId = Process->UniqueProcessId;
30
31 ObDereferenceObject(Process);
32
33 if (Register)
34 {
35 /* Register the logon process */
36 if (gpidLogon != 0)
37 return FALSE;
38
39 gpidLogon = ProcessId;
40 }
41 else
42 {
43 /* Deregister the logon process */
44 if (gpidLogon != ProcessId)
45 return FALSE;
46
47 gpidLogon = 0;
48 }
49
50 return TRUE;
51 }
52
53 /*
54 * @unimplemented
55 */
56 DWORD_PTR
57 APIENTRY
58 NtUserCallNoParam(DWORD Routine)
59 {
60 DWORD_PTR Result = 0;
61 DECLARE_RETURN(DWORD_PTR);
62
63 TRACE("Enter NtUserCallNoParam\n");
64 UserEnterExclusive();
65
66 switch (Routine)
67 {
68 case NOPARAM_ROUTINE_CREATEMENU:
69 Result = (DWORD_PTR)UserCreateMenu(GetW32ThreadInfo()->rpdesk, FALSE);
70 break;
71
72 case NOPARAM_ROUTINE_CREATEMENUPOPUP:
73 Result = (DWORD_PTR)UserCreateMenu(GetW32ThreadInfo()->rpdesk, TRUE);
74 break;
75
76 case NOPARAM_ROUTINE_DESTROY_CARET:
77 Result = (DWORD_PTR)co_IntDestroyCaret(PsGetCurrentThread()->Tcb.Win32Thread);
78 break;
79
80 case NOPARAM_ROUTINE_INIT_MESSAGE_PUMP:
81 Result = (DWORD_PTR)IntInitMessagePumpHook();
82 break;
83
84 case NOPARAM_ROUTINE_UNINIT_MESSAGE_PUMP:
85 Result = (DWORD_PTR)IntUninitMessagePumpHook();
86 break;
87
88 case NOPARAM_ROUTINE_MSQCLEARWAKEMASK:
89 RETURN((DWORD_PTR)IntMsqClearWakeMask());
90
91 case NOPARAM_ROUTINE_GETMSESSAGEPOS:
92 {
93 PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
94 RETURN((DWORD_PTR)MAKELONG(pti->ptLast.x, pti->ptLast.y));
95 }
96
97 case NOPARAM_ROUTINE_RELEASECAPTURE:
98 RETURN((DWORD_PTR)IntReleaseCapture());
99
100 case NOPARAM_ROUTINE_LOADUSERAPIHOOK:
101 RETURN(UserLoadApiHook());
102
103 case NOPARAM_ROUTINE_ZAPACTIVEANDFOUS:
104 {
105 PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
106 TRACE("Zapping the Active and Focus window out of the Queue!\n");
107 pti->MessageQueue->spwndFocus = NULL;
108 pti->MessageQueue->spwndActive = NULL;
109 RETURN(0);
110 }
111
112 /* this is a ReactOS only case and is needed for gui-on-demand */
113 case NOPARAM_ROUTINE_ISCONSOLEMODE:
114 RETURN(ScreenDeviceContext == NULL);
115
116 case NOPARAM_ROUTINE_UPDATEPERUSERIMMENABLING:
117 gpsi->dwSRVIFlags |= SRVINFO_IMM32; // Always set.
118 RETURN(1); // Always return TRUE.
119
120 default:
121 ERR("Calling invalid routine number 0x%x in NtUserCallNoParam\n", Routine);
122 EngSetLastError(ERROR_INVALID_PARAMETER);
123 break;
124 }
125 RETURN(Result);
126
127 CLEANUP:
128 TRACE("Leave NtUserCallNoParam, ret=%p\n", (PVOID)_ret_);
129 UserLeave();
130 END_CLEANUP;
131 }
132
133
134 /*
135 * @implemented
136 */
137 DWORD_PTR
138 APIENTRY
139 NtUserCallOneParam(
140 DWORD_PTR Param,
141 DWORD Routine)
142 {
143 DECLARE_RETURN(DWORD_PTR);
144
145 TRACE("Enter NtUserCallOneParam\n");
146
147 UserEnterExclusive();
148
149 switch (Routine)
150 {
151 case ONEPARAM_ROUTINE_POSTQUITMESSAGE:
152 {
153 PTHREADINFO pti;
154 pti = PsGetCurrentThreadWin32Thread();
155 MsqPostQuitMessage(pti, Param);
156 RETURN(TRUE);
157 }
158
159 case ONEPARAM_ROUTINE_BEGINDEFERWNDPOS:
160 {
161 PSMWP psmwp;
162 HDWP hDwp = NULL;
163 INT count = (INT)Param;
164
165 if (count < 0)
166 {
167 EngSetLastError(ERROR_INVALID_PARAMETER);
168 RETURN(0);
169 }
170
171 /* Windows allows zero count, in which case it allocates context for 8 moves */
172 if (count == 0) count = 8;
173
174 psmwp = (PSMWP)UserCreateObject(gHandleTable,
175 NULL,
176 NULL,
177 (PHANDLE)&hDwp,
178 TYPE_SETWINDOWPOS,
179 sizeof(SMWP));
180 if (!psmwp) RETURN(0);
181
182 psmwp->acvr = ExAllocatePoolWithTag(PagedPool, count * sizeof(CVR), USERTAG_SWP);
183 if (!psmwp->acvr)
184 {
185 UserDeleteObject(hDwp, TYPE_SETWINDOWPOS);
186 RETURN(0);
187 }
188
189 RtlZeroMemory(psmwp->acvr, count * sizeof(CVR));
190 psmwp->bHandle = TRUE;
191 psmwp->ccvr = 0; // actualCount
192 psmwp->ccvrAlloc = count; // suggestedCount
193 RETURN((DWORD_PTR)hDwp);
194 }
195
196 case ONEPARAM_ROUTINE_SHOWCURSOR:
197 RETURN((DWORD_PTR)UserShowCursor((BOOL)Param));
198
199 case ONEPARAM_ROUTINE_GETDESKTOPMAPPING:
200 {
201 PTHREADINFO ti;
202 ti = GetW32ThreadInfo();
203 if (ti != NULL)
204 {
205 /* Try convert the pointer to a user mode pointer if the desktop is
206 mapped into the process */
207 RETURN((DWORD_PTR)DesktopHeapAddressToUser((PVOID)Param));
208 }
209 else
210 {
211 RETURN(0);
212 }
213 }
214
215 case ONEPARAM_ROUTINE_WINDOWFROMDC:
216 RETURN((DWORD_PTR)IntWindowFromDC((HDC)Param));
217
218 case ONEPARAM_ROUTINE_SWAPMOUSEBUTTON:
219 {
220 DWORD_PTR Result;
221
222 Result = gspv.bMouseBtnSwap;
223 gspv.bMouseBtnSwap = Param ? TRUE : FALSE;
224 gpsi->aiSysMet[SM_SWAPBUTTON] = gspv.bMouseBtnSwap;
225 RETURN(Result);
226 }
227
228 case ONEPARAM_ROUTINE_SETCARETBLINKTIME:
229 RETURN((DWORD_PTR)IntSetCaretBlinkTime((UINT)Param));
230
231 case ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO:
232 RETURN((DWORD_PTR)MsqSetMessageExtraInfo((LPARAM)Param));
233
234 case ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT:
235 {
236 DWORD_PTR Result;
237
238 if (!(Result = (DWORD_PTR)IntCreateCurIconHandle((DWORD)Param)))
239 {
240 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
241 RETURN(0);
242 }
243 RETURN(Result);
244 }
245
246 case ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING:
247 {
248 BOOL Enable;
249 PPROCESSINFO Process = PsGetCurrentProcessWin32Process();
250
251 if (Process != NULL)
252 {
253 Enable = (BOOL)(Param != 0);
254
255 if (Enable)
256 {
257 Process->W32PF_flags &= ~W32PF_NOWINDOWGHOSTING;
258 }
259 else
260 {
261 Process->W32PF_flags |= W32PF_NOWINDOWGHOSTING;
262 }
263
264 RETURN(TRUE);
265 }
266
267 RETURN(FALSE);
268 }
269
270 case ONEPARAM_ROUTINE_GETINPUTEVENT:
271 RETURN((DWORD_PTR)IntMsqSetWakeMask(Param));
272
273 case ONEPARAM_ROUTINE_GETKEYBOARDTYPE:
274 RETURN(UserGetKeyboardType(Param));
275
276 case ONEPARAM_ROUTINE_GETKEYBOARDLAYOUT:
277 RETURN((DWORD_PTR)UserGetKeyboardLayout(Param));
278
279 case ONEPARAM_ROUTINE_RELEASEDC:
280 RETURN(UserReleaseDC(NULL, (HDC)Param, FALSE));
281
282 case ONEPARAM_ROUTINE_REALIZEPALETTE:
283 RETURN(UserRealizePalette((HDC)Param));
284
285 case ONEPARAM_ROUTINE_GETQUEUESTATUS:
286 {
287 RETURN(IntGetQueueStatus((DWORD)Param));
288 }
289
290 case ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS:
291 /* FIXME: Should use UserEnterShared */
292 RETURN(UserEnumClipboardFormats(Param));
293
294 case ONEPARAM_ROUTINE_GETCURSORPOS:
295 {
296 BOOL Ret = TRUE;
297 PPOINTL pptl;
298 PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
299 if (pti->rpdesk != IntGetActiveDesktop()) RETURN(FALSE);
300 _SEH2_TRY
301 {
302 ProbeForWrite((POINT*)Param,sizeof(POINT),1);
303 pptl = (PPOINTL)Param;
304 *pptl = gpsi->ptCursor;
305 }
306 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
307 {
308 Ret = FALSE;
309 }
310 _SEH2_END;
311 RETURN(Ret);
312 }
313
314 case ONEPARAM_ROUTINE_SETPROCDEFLAYOUT:
315 {
316 PPROCESSINFO ppi;
317 if (Param & LAYOUT_ORIENTATIONMASK)
318 {
319 ppi = PsGetCurrentProcessWin32Process();
320 ppi->dwLayout = Param;
321 RETURN(TRUE);
322 }
323 EngSetLastError(ERROR_INVALID_PARAMETER);
324 RETURN(FALSE);
325 }
326
327 case ONEPARAM_ROUTINE_GETPROCDEFLAYOUT:
328 {
329 BOOL Ret = TRUE;
330 PPROCESSINFO ppi;
331 PDWORD pdwLayout;
332 if (PsGetCurrentProcess() == gpepCSRSS)
333 {
334 EngSetLastError(ERROR_INVALID_ACCESS);
335 RETURN(FALSE);
336 }
337 ppi = PsGetCurrentProcessWin32Process();
338 _SEH2_TRY
339 {
340 pdwLayout = (PDWORD)Param;
341 *pdwLayout = ppi->dwLayout;
342 }
343 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
344 {
345 SetLastNtError(_SEH2_GetExceptionCode());
346 Ret = FALSE;
347 }
348 _SEH2_END;
349 RETURN(Ret);
350 }
351
352 case ONEPARAM_ROUTINE_REPLYMESSAGE:
353 RETURN(co_MsqReplyMessage((LRESULT)Param));
354
355 case ONEPARAM_ROUTINE_MESSAGEBEEP:
356 /* TODO: Implement sound sentry */
357 RETURN(UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_MESSAGE_BEEP, Param));
358
359 case ONEPARAM_ROUTINE_CREATESYSTEMTHREADS:
360 RETURN(CreateSystemThreads(Param));
361
362 case ONEPARAM_ROUTINE_LOCKFOREGNDWINDOW:
363 RETURN((DWORD_PTR)IntLockSetForegroundWindow(Param));
364
365 case ONEPARAM_ROUTINE_ALLOWSETFOREGND:
366
367 RETURN((DWORD_PTR)IntAllowSetForegroundWindow(Param));
368 }
369
370 ERR("Calling invalid routine number 0x%x in NtUserCallOneParam(), Param=0x%x\n",
371 Routine, Param);
372 EngSetLastError(ERROR_INVALID_PARAMETER);
373 RETURN(0);
374
375 CLEANUP:
376 TRACE("Leave NtUserCallOneParam, ret=%p\n", (PVOID)_ret_);
377 UserLeave();
378 END_CLEANUP;
379 }
380
381
382 /*
383 * @implemented
384 */
385 DWORD_PTR
386 APIENTRY
387 NtUserCallTwoParam(
388 DWORD_PTR Param1,
389 DWORD_PTR Param2,
390 DWORD Routine)
391 {
392 PWND Window;
393 DECLARE_RETURN(DWORD_PTR);
394
395 TRACE("Enter NtUserCallTwoParam\n");
396 UserEnterExclusive();
397
398 switch (Routine)
399 {
400 case TWOPARAM_ROUTINE_REDRAWTITLE:
401 {
402 DWORD_PTR Ret;
403 Window = UserGetWindowObject((HWND)Param1);
404 Ret = (DWORD_PTR)UserPaintCaption(Window, (INT)Param2);
405 RETURN(Ret);
406 }
407
408 case TWOPARAM_ROUTINE_SETMENUBARHEIGHT:
409 {
410 DWORD_PTR Ret;
411 PMENU MenuObject = IntGetMenuObject((HMENU)Param1);
412 if (!MenuObject)
413 RETURN(0);
414
415 if (Param2 > 0)
416 {
417 Ret = (MenuObject->cyMenu == (int)Param2);
418 MenuObject->cyMenu = (int)Param2;
419 }
420 else
421 Ret = (DWORD_PTR)MenuObject->cyMenu;
422 IntReleaseMenuObject(MenuObject);
423 RETURN(Ret);
424 }
425
426 case TWOPARAM_ROUTINE_SETGUITHRDHANDLE:
427 {
428 PTHREADINFO pti = (PTHREADINFO)PsGetCurrentThreadWin32Thread();
429 ASSERT(pti->MessageQueue);
430 RETURN((DWORD_PTR)MsqSetStateWindow(pti, (ULONG)Param1, (HWND)Param2));
431 }
432
433 case TWOPARAM_ROUTINE_ENABLEWINDOW:
434 RETURN(IntEnableWindow((HWND)Param1, (BOOL)Param2));
435
436 case TWOPARAM_ROUTINE_SHOWOWNEDPOPUPS:
437 {
438 Window = UserGetWindowObject((HWND)Param1);
439 if (!Window) RETURN(0);
440
441 RETURN((DWORD_PTR)IntShowOwnedPopups(Window, (BOOL)Param2));
442 }
443
444 case TWOPARAM_ROUTINE_ROS_UPDATEUISTATE:
445 {
446 WPARAM wParam;
447 Window = UserGetWindowObject((HWND)Param1);
448 if (!Window) RETURN(0);
449
450 /* Unpack wParam */
451 wParam = MAKEWPARAM((Param2 >> 3) & 0x3,
452 Param2 & (UISF_HIDEFOCUS | UISF_HIDEACCEL | UISF_ACTIVE));
453
454 RETURN(UserUpdateUiState(Window, wParam));
455 }
456
457 case TWOPARAM_ROUTINE_SWITCHTOTHISWINDOW:
458 STUB
459 RETURN(0);
460
461 case TWOPARAM_ROUTINE_SETCARETPOS:
462 RETURN((DWORD_PTR)co_IntSetCaretPos((int)Param1, (int)Param2));
463
464 case TWOPARAM_ROUTINE_REGISTERLOGONPROCESS:
465 RETURN((DWORD_PTR)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
466
467 case TWOPARAM_ROUTINE_SETCURSORPOS:
468 RETURN((DWORD_PTR)UserSetCursorPos((int)Param1, (int)Param2, 0, 0, FALSE));
469
470 case TWOPARAM_ROUTINE_UNHOOKWINDOWSHOOK:
471 RETURN(IntUnhookWindowsHook((int)Param1, (HOOKPROC)Param2));
472 }
473
474 ERR("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
475 Routine, Param1, Param2);
476 EngSetLastError(ERROR_INVALID_PARAMETER);
477 RETURN(0);
478
479 CLEANUP:
480 TRACE("Leave NtUserCallTwoParam, ret=%p\n", (PVOID)_ret_);
481 UserLeave();
482 END_CLEANUP;
483 }
484
485
486 /*
487 * @unimplemented
488 */
489 BOOL
490 APIENTRY
491 NtUserCallHwndLock(
492 HWND hWnd,
493 DWORD Routine)
494 {
495 BOOL Ret = 0;
496 PWND Window;
497 USER_REFERENCE_ENTRY Ref;
498 DECLARE_RETURN(BOOLEAN);
499
500 TRACE("Enter NtUserCallHwndLock\n");
501 UserEnterExclusive();
502
503 if (!(Window = UserGetWindowObject(hWnd)))
504 {
505 RETURN(FALSE);
506 }
507
508 UserRefObjectCo(Window, &Ref);
509
510 /* FIXME: Routine can be 0x53 - 0x5E */
511 switch (Routine)
512 {
513 case HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS:
514 co_WinPosArrangeIconicWindows(Window);
515 break;
516
517 case HWNDLOCK_ROUTINE_DRAWMENUBAR:
518 {
519 TRACE("HWNDLOCK_ROUTINE_DRAWMENUBAR\n");
520 Ret = TRUE;
521 if ((Window->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
522 co_WinPosSetWindowPos(Window,
523 HWND_DESKTOP,
524 0, 0, 0, 0,
525 SWP_NOSIZE |
526 SWP_NOMOVE |
527 SWP_NOZORDER |
528 SWP_NOACTIVATE |
529 SWP_FRAMECHANGED);
530 break;
531 }
532
533 case HWNDLOCK_ROUTINE_REDRAWFRAME:
534 co_WinPosSetWindowPos(Window,
535 HWND_DESKTOP,
536 0, 0, 0, 0,
537 SWP_NOSIZE |
538 SWP_NOMOVE |
539 SWP_NOZORDER |
540 SWP_NOACTIVATE |
541 SWP_FRAMECHANGED);
542 Ret = TRUE;
543 break;
544
545 case HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK:
546 co_WinPosSetWindowPos(Window,
547 HWND_DESKTOP,
548 0, 0, 0, 0,
549 SWP_NOSIZE |
550 SWP_NOMOVE |
551 SWP_NOZORDER |
552 SWP_NOACTIVATE |
553 SWP_FRAMECHANGED);
554 if (!Window->spwndOwner && !IntGetParent(Window))
555 {
556 co_IntShellHookNotify(HSHELL_REDRAW, (WPARAM)hWnd, FALSE); // FIXME Flashing?
557 }
558 Ret = TRUE;
559 break;
560
561 case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOW:
562 TRACE("co_IntSetForegroundWindow 1 0x%p\n", hWnd);
563 Ret = co_IntSetForegroundWindow(Window);
564 TRACE("co_IntSetForegroundWindow 2 0x%p\n", hWnd);
565 break;
566
567 case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE:
568 TRACE("co_IntSetForegroundWindow M 1 0x%p\n", hWnd);
569 Ret = co_IntSetForegroundWindowMouse(Window);
570 TRACE("co_IntSetForegroundWindow M 2 0x%p\n", hWnd);
571 break;
572
573 case HWNDLOCK_ROUTINE_UPDATEWINDOW:
574 co_IntUpdateWindows(Window, RDW_ALLCHILDREN, FALSE);
575 Ret = TRUE;
576 break;
577 }
578
579 UserDerefObjectCo(Window);
580
581 RETURN(Ret);
582
583 CLEANUP:
584 TRACE("Leave NtUserCallHwndLock, ret=%u\n", _ret_);
585 UserLeave();
586 END_CLEANUP;
587 }
588
589 /*
590 * @unimplemented
591 */
592 HWND
593 APIENTRY
594 NtUserCallHwndOpt(
595 HWND hWnd,
596 DWORD Routine)
597 {
598 switch (Routine)
599 {
600 case HWNDOPT_ROUTINE_SETPROGMANWINDOW:
601 GetW32ThreadInfo()->pDeskInfo->hProgmanWindow = hWnd;
602 break;
603
604 case HWNDOPT_ROUTINE_SETTASKMANWINDOW:
605 GetW32ThreadInfo()->pDeskInfo->hTaskManWindow = hWnd;
606 break;
607 }
608
609 return hWnd;
610 }
611
612 DWORD
613 APIENTRY
614 NtUserCallHwnd(
615 HWND hWnd,
616 DWORD Routine)
617 {
618 switch (Routine)
619 {
620 case HWND_ROUTINE_GETWNDCONTEXTHLPID:
621 {
622 PWND Window;
623 DWORD HelpId;
624
625 UserEnterShared();
626
627 if (!(Window = UserGetWindowObject(hWnd)))
628 {
629 UserLeave();
630 return 0;
631 }
632
633 HelpId = (DWORD)(DWORD_PTR)UserGetProp(Window, gpsi->atomContextHelpIdProp, TRUE);
634
635 UserLeave();
636 return HelpId;
637 }
638
639 case HWND_ROUTINE_REGISTERSHELLHOOKWINDOW:
640 if (IntIsWindow(hWnd))
641 return IntRegisterShellHookWindow(hWnd);
642 return FALSE;
643 break;
644
645 case HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW:
646 if (IntIsWindow(hWnd))
647 return IntDeRegisterShellHookWindow(hWnd);
648 return FALSE;
649
650 case HWND_ROUTINE_SETMSGBOX:
651 {
652 PWND Window;
653 UserEnterExclusive();
654 if ((Window = UserGetWindowObject(hWnd)))
655 {
656 Window->state |= WNDS_MSGBOX;
657 }
658 UserLeave();
659 return FALSE;
660 }
661 }
662
663 STUB;
664
665 return 0;
666 }
667
668 DWORD
669 APIENTRY
670 NtUserCallHwndParam(
671 HWND hWnd,
672 DWORD Param,
673 DWORD Routine)
674 {
675
676 switch (Routine)
677 {
678 case HWNDPARAM_ROUTINE_KILLSYSTEMTIMER:
679 return IntKillTimer(UserGetWindowObject(hWnd), (UINT_PTR)Param, TRUE);
680
681 case HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID:
682 {
683 PWND Window;
684
685 UserEnterExclusive();
686 if (!(Window = UserGetWindowObject(hWnd)))
687 {
688 UserLeave();
689 return FALSE;
690 }
691
692 if (Param)
693 UserSetProp(Window, gpsi->atomContextHelpIdProp, (HANDLE)Param, TRUE);
694 else
695 UserRemoveProp(Window, gpsi->atomContextHelpIdProp, TRUE);
696
697 UserLeave();
698 return TRUE;
699 }
700
701 case HWNDPARAM_ROUTINE_SETDIALOGPOINTER:
702 {
703 PWND pWnd;
704 USER_REFERENCE_ENTRY Ref;
705
706 UserEnterExclusive();
707
708 if (!(pWnd = UserGetWindowObject(hWnd)))
709 {
710 UserLeave();
711 return 0;
712 }
713 UserRefObjectCo(pWnd, &Ref);
714
715 if (pWnd->head.pti->ppi == PsGetCurrentProcessWin32Process() &&
716 pWnd->cbwndExtra == DLGWINDOWEXTRA &&
717 !(pWnd->state & WNDS_SERVERSIDEWINDOWPROC))
718 {
719 if (Param)
720 {
721 if (!pWnd->fnid) pWnd->fnid = FNID_DIALOG;
722 pWnd->state |= WNDS_DIALOGWINDOW;
723 }
724 else
725 {
726 pWnd->fnid |= FNID_DESTROY;
727 pWnd->state &= ~WNDS_DIALOGWINDOW;
728 }
729 }
730
731 UserDerefObjectCo(pWnd);
732 UserLeave();
733 return 0;
734 }
735
736 case HWNDPARAM_ROUTINE_ROS_NOTIFYWINEVENT:
737 {
738 PWND pWnd;
739 PNOTIFYEVENT pne;
740 UserEnterExclusive();
741 pne = (PNOTIFYEVENT)Param;
742 if (hWnd)
743 pWnd = UserGetWindowObject(hWnd);
744 else
745 pWnd = NULL;
746 IntNotifyWinEvent(pne->event, pWnd, pne->idObject, pne->idChild, pne->flags);
747 UserLeave();
748 return 0;
749 }
750
751 case HWNDPARAM_ROUTINE_CLEARWINDOWSTATE:
752 {
753 PWND pWnd;
754 UserEnterExclusive();
755 pWnd = UserGetWindowObject(hWnd);
756 if (pWnd) IntClearWindowState(pWnd, (UINT)Param);
757 UserLeave();
758 return 0;
759 }
760
761 case HWNDPARAM_ROUTINE_SETWINDOWSTATE:
762 {
763 PWND pWnd;
764 UserEnterExclusive();
765 pWnd = UserGetWindowObject(hWnd);
766 if (pWnd) IntSetWindowState(pWnd, (UINT)Param);
767 UserLeave();
768 return 0;
769 }
770 }
771
772 STUB;
773
774 return 0;
775 }
776
777 DWORD
778 APIENTRY
779 NtUserCallHwndParamLock(
780 HWND hWnd,
781 DWORD Param,
782 DWORD Routine)
783 {
784 DWORD Ret = 0;
785 PWND Window;
786 USER_REFERENCE_ENTRY Ref;
787 DECLARE_RETURN(DWORD);
788
789 TRACE("Enter NtUserCallHwndParamLock\n");
790 UserEnterExclusive();
791
792 if (!(Window = UserGetWindowObject(hWnd)))
793 {
794 RETURN(FALSE);
795 }
796 UserRefObjectCo(Window, &Ref);
797
798 switch (Routine)
799 {
800 case TWOPARAM_ROUTINE_VALIDATERGN:
801 {
802 PREGION Rgn = REGION_LockRgn((HRGN)Param);
803 Ret = (DWORD)co_UserRedrawWindow(Window, NULL, Rgn, RDW_VALIDATE);
804 if (Rgn) REGION_UnlockRgn(Rgn);
805 break;
806 }
807 }
808
809 UserDerefObjectCo(Window);
810
811 RETURN(Ret);
812
813 CLEANUP:
814 TRACE("Leave NtUserCallHwndParamLock, ret=%lu\n", _ret_);
815 UserLeave();
816 END_CLEANUP;
817
818 }
819
820 /* EOF */