4be533a8fbd0ae711cafa029d1484b7b59ad996a
[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 /* Windows allows zero count, in which case it allocates context for 8 moves */
171 if (count == 0) count = 8;
172
173 psmwp = (PSMWP) UserCreateObject( gHandleTable,
174 NULL,
175 NULL,
176 (PHANDLE)&hDwp,
177 TYPE_SETWINDOWPOS,
178 sizeof(SMWP));
179 if (!psmwp) RETURN(0);
180 psmwp->acvr = ExAllocatePoolWithTag(PagedPool, count * sizeof(CVR), USERTAG_SWP);
181 if (!psmwp->acvr)
182 {
183 UserDeleteObject(hDwp, TYPE_SETWINDOWPOS);
184 RETURN(0);
185 }
186 RtlZeroMemory(psmwp->acvr, count * sizeof(CVR));
187 psmwp->bHandle = TRUE;
188 psmwp->ccvr = 0; // actualCount
189 psmwp->ccvrAlloc = count; // suggestedCount
190 RETURN((DWORD_PTR)hDwp);
191 }
192
193 case ONEPARAM_ROUTINE_SHOWCURSOR:
194 RETURN( (DWORD_PTR)UserShowCursor((BOOL)Param) );
195
196 case ONEPARAM_ROUTINE_GETDESKTOPMAPPING:
197 {
198 PTHREADINFO ti;
199 ti = GetW32ThreadInfo();
200 if (ti != NULL)
201 {
202 /* Try convert the pointer to a user mode pointer if the desktop is
203 mapped into the process */
204 RETURN((DWORD_PTR)DesktopHeapAddressToUser((PVOID)Param));
205 }
206 else
207 {
208 RETURN(0);
209 }
210 }
211
212 case ONEPARAM_ROUTINE_WINDOWFROMDC:
213 RETURN( (DWORD_PTR)IntWindowFromDC((HDC)Param));
214
215 case ONEPARAM_ROUTINE_SWAPMOUSEBUTTON:
216 {
217 DWORD_PTR Result;
218
219 Result = gspv.bMouseBtnSwap;
220 gspv.bMouseBtnSwap = Param ? TRUE : FALSE;
221 gpsi->aiSysMet[SM_SWAPBUTTON] = gspv.bMouseBtnSwap;
222 RETURN(Result);
223 }
224
225 case ONEPARAM_ROUTINE_SETCARETBLINKTIME:
226 RETURN( (DWORD_PTR)IntSetCaretBlinkTime((UINT)Param));
227
228 case ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO:
229 RETURN( (DWORD_PTR)MsqSetMessageExtraInfo((LPARAM)Param));
230
231 case ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT:
232 {
233 DWORD_PTR Result ;
234
235 if (!(Result = (DWORD_PTR)IntCreateCurIconHandle((DWORD)Param)))
236 {
237 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
238 RETURN(0);
239 }
240 RETURN(Result);
241 }
242
243 case ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING:
244 {
245 BOOL Enable;
246 PPROCESSINFO Process = PsGetCurrentProcessWin32Process();
247
248 if(Process != NULL)
249 {
250 Enable = (BOOL)(Param != 0);
251
252 if(Enable)
253 {
254 Process->W32PF_flags &= ~W32PF_NOWINDOWGHOSTING;
255 }
256 else
257 {
258 Process->W32PF_flags |= W32PF_NOWINDOWGHOSTING;
259 }
260
261 RETURN( TRUE);
262 }
263
264 RETURN( FALSE);
265 }
266
267 case ONEPARAM_ROUTINE_GETINPUTEVENT:
268 RETURN( (DWORD_PTR)IntMsqSetWakeMask(Param));
269
270 case ONEPARAM_ROUTINE_GETKEYBOARDTYPE:
271 RETURN( UserGetKeyboardType(Param));
272
273 case ONEPARAM_ROUTINE_GETKEYBOARDLAYOUT:
274 RETURN( (DWORD_PTR)UserGetKeyboardLayout(Param));
275
276 case ONEPARAM_ROUTINE_RELEASEDC:
277 RETURN (UserReleaseDC(NULL, (HDC) Param, FALSE));
278
279 case ONEPARAM_ROUTINE_REALIZEPALETTE:
280 RETURN (UserRealizePalette((HDC) Param));
281
282 case ONEPARAM_ROUTINE_GETQUEUESTATUS:
283 {
284 RETURN (IntGetQueueStatus((DWORD)Param));
285 }
286 case ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS:
287 /* FIXME: Should use UserEnterShared */
288 RETURN(UserEnumClipboardFormats(Param));
289
290 case ONEPARAM_ROUTINE_GETCURSORPOS:
291 {
292 BOOL Ret = TRUE;
293 PPOINTL pptl;
294 PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
295 if (pti->rpdesk != IntGetActiveDesktop()) RETURN(FALSE);
296 _SEH2_TRY
297 {
298 ProbeForWrite((POINT*)Param,sizeof(POINT),1);
299 pptl = (PPOINTL)Param;
300 *pptl = gpsi->ptCursor;
301 }
302 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
303 {
304 Ret = FALSE;
305 }
306 _SEH2_END;
307 RETURN(Ret);
308 }
309 case ONEPARAM_ROUTINE_SETPROCDEFLAYOUT:
310 {
311 PPROCESSINFO ppi;
312 if (Param & LAYOUT_ORIENTATIONMASK)
313 {
314 ppi = PsGetCurrentProcessWin32Process();
315 ppi->dwLayout = Param;
316 RETURN(TRUE);
317 }
318 EngSetLastError(ERROR_INVALID_PARAMETER);
319 RETURN(FALSE);
320 }
321 case ONEPARAM_ROUTINE_GETPROCDEFLAYOUT:
322 {
323 BOOL Ret = TRUE;
324 PPROCESSINFO ppi;
325 PDWORD pdwLayout;
326 if ( PsGetCurrentProcess() == gpepCSRSS)
327 {
328 EngSetLastError(ERROR_INVALID_ACCESS);
329 RETURN(FALSE);
330 }
331 ppi = PsGetCurrentProcessWin32Process();
332 _SEH2_TRY
333 {
334 pdwLayout = (PDWORD)Param;
335 *pdwLayout = ppi->dwLayout;
336 }
337 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
338 {
339 SetLastNtError(_SEH2_GetExceptionCode());
340 Ret = FALSE;
341 }
342 _SEH2_END;
343 RETURN(Ret);
344 }
345 case ONEPARAM_ROUTINE_REPLYMESSAGE:
346 RETURN (co_MsqReplyMessage((LRESULT) Param));
347 case ONEPARAM_ROUTINE_MESSAGEBEEP:
348 /* TODO: Implement sound sentry */
349 RETURN ( UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_MESSAGE_BEEP, Param) );
350 case ONEPARAM_ROUTINE_CREATESYSTEMTHREADS:
351 RETURN(CreateSystemThreads(Param));
352 case ONEPARAM_ROUTINE_LOCKFOREGNDWINDOW:
353 RETURN( (DWORD_PTR)IntLockSetForegroundWindow(Param));
354 case ONEPARAM_ROUTINE_ALLOWSETFOREGND:
355 RETURN( (DWORD_PTR)IntAllowSetForegroundWindow(Param));
356 }
357 ERR("Calling invalid routine number 0x%x in NtUserCallOneParam(), Param=0x%x\n",
358 Routine, Param);
359 EngSetLastError(ERROR_INVALID_PARAMETER);
360 RETURN( 0);
361
362 CLEANUP:
363 TRACE("Leave NtUserCallOneParam, ret=%p\n", (PVOID)_ret_);
364 UserLeave();
365 END_CLEANUP;
366 }
367
368
369 /*
370 * @implemented
371 */
372 DWORD_PTR
373 APIENTRY
374 NtUserCallTwoParam(
375 DWORD_PTR Param1,
376 DWORD_PTR Param2,
377 DWORD Routine)
378 {
379 PWND Window;
380 DECLARE_RETURN(DWORD_PTR);
381
382 TRACE("Enter NtUserCallTwoParam\n");
383 UserEnterExclusive();
384
385 switch(Routine)
386 {
387 case TWOPARAM_ROUTINE_REDRAWTITLE:
388 {
389 DWORD_PTR Ret;
390 Window = UserGetWindowObject((HWND)Param1);
391 Ret = (DWORD_PTR)UserPaintCaption(Window, (INT)Param2);
392 RETURN(Ret);
393 }
394 case TWOPARAM_ROUTINE_SETMENUBARHEIGHT:
395 {
396 DWORD_PTR Ret;
397 PMENU MenuObject = IntGetMenuObject((HMENU)Param1);
398 if(!MenuObject)
399 RETURN( 0);
400
401 if(Param2 > 0)
402 {
403 Ret = (MenuObject->cyMenu == (int)Param2);
404 MenuObject->cyMenu = (int)Param2;
405 }
406 else
407 Ret = (DWORD_PTR)MenuObject->cyMenu;
408 IntReleaseMenuObject(MenuObject);
409 RETURN( Ret);
410 }
411
412 case TWOPARAM_ROUTINE_SETGUITHRDHANDLE:
413 {
414 PTHREADINFO pti = (PTHREADINFO)PsGetCurrentThreadWin32Thread();
415 ASSERT(pti->MessageQueue);
416 RETURN( (DWORD_PTR)MsqSetStateWindow(pti, (ULONG)Param1, (HWND)Param2));
417 }
418
419 case TWOPARAM_ROUTINE_ENABLEWINDOW:
420 RETURN( IntEnableWindow((HWND)Param1, (BOOL)Param2));
421
422 case TWOPARAM_ROUTINE_SHOWOWNEDPOPUPS:
423 {
424 Window = UserGetWindowObject((HWND)Param1);
425 if (!Window) RETURN(0);
426
427 RETURN( (DWORD_PTR)IntShowOwnedPopups(Window, (BOOL) Param2));
428 }
429
430 case TWOPARAM_ROUTINE_ROS_UPDATEUISTATE:
431 {
432 WPARAM wParam;
433 Window = UserGetWindowObject((HWND)Param1);
434 if (!Window) RETURN(0);
435
436 /* Unpack wParam */
437 wParam = MAKEWPARAM((Param2 >> 3) & 0x3,
438 Param2 & (UISF_HIDEFOCUS | UISF_HIDEACCEL | UISF_ACTIVE));
439
440 RETURN( UserUpdateUiState(Window, wParam) );
441 }
442
443 case TWOPARAM_ROUTINE_SWITCHTOTHISWINDOW:
444 STUB
445 RETURN( 0);
446
447 case TWOPARAM_ROUTINE_SETCARETPOS:
448 RETURN( (DWORD_PTR)co_IntSetCaretPos((int)Param1, (int)Param2));
449
450 case TWOPARAM_ROUTINE_REGISTERLOGONPROCESS:
451 RETURN( (DWORD_PTR)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
452
453 case TWOPARAM_ROUTINE_SETCURSORPOS:
454 RETURN( (DWORD_PTR)UserSetCursorPos((int)Param1, (int)Param2, 0, 0, FALSE));
455
456 case TWOPARAM_ROUTINE_UNHOOKWINDOWSHOOK:
457 RETURN( IntUnhookWindowsHook((int)Param1, (HOOKPROC)Param2));
458 }
459 ERR("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
460 Routine, Param1, Param2);
461 EngSetLastError(ERROR_INVALID_PARAMETER);
462 RETURN( 0);
463
464 CLEANUP:
465 TRACE("Leave NtUserCallTwoParam, ret=%p\n", (PVOID)_ret_);
466 UserLeave();
467 END_CLEANUP;
468 }
469
470
471 /*
472 * @unimplemented
473 */
474 BOOL
475 APIENTRY
476 NtUserCallHwndLock(
477 HWND hWnd,
478 DWORD Routine)
479 {
480 BOOL Ret = 0;
481 PWND Window;
482 USER_REFERENCE_ENTRY Ref;
483 DECLARE_RETURN(BOOLEAN);
484
485 TRACE("Enter NtUserCallHwndLock\n");
486 UserEnterExclusive();
487
488 if (!(Window = UserGetWindowObject(hWnd)))
489 {
490 RETURN( FALSE);
491 }
492 UserRefObjectCo(Window, &Ref);
493
494 /* FIXME: Routine can be 0x53 - 0x5E */
495 switch (Routine)
496 {
497 case HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS:
498 co_WinPosArrangeIconicWindows(Window);
499 break;
500
501 case HWNDLOCK_ROUTINE_DRAWMENUBAR:
502 {
503 TRACE("HWNDLOCK_ROUTINE_DRAWMENUBAR\n");
504 Ret = TRUE;
505 if ((Window->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
506 co_WinPosSetWindowPos( Window,
507 HWND_DESKTOP,
508 0,0,0,0,
509 SWP_NOSIZE|
510 SWP_NOMOVE|
511 SWP_NOZORDER|
512 SWP_NOACTIVATE|
513 SWP_FRAMECHANGED );
514 break;
515 }
516
517 case HWNDLOCK_ROUTINE_REDRAWFRAME:
518 co_WinPosSetWindowPos( Window,
519 HWND_DESKTOP,
520 0,0,0,0,
521 SWP_NOSIZE|
522 SWP_NOMOVE|
523 SWP_NOZORDER|
524 SWP_NOACTIVATE|
525 SWP_FRAMECHANGED );
526 Ret = TRUE;
527 break;
528
529 case HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK:
530 co_WinPosSetWindowPos( Window,
531 HWND_DESKTOP,
532 0,0,0,0,
533 SWP_NOSIZE|
534 SWP_NOMOVE|
535 SWP_NOZORDER|
536 SWP_NOACTIVATE|
537 SWP_FRAMECHANGED );
538 if (!Window->spwndOwner && !IntGetParent(Window))
539 {
540 co_IntShellHookNotify(HSHELL_REDRAW, (WPARAM) hWnd, FALSE); // FIXME Flashing?
541 }
542 Ret = TRUE;
543 break;
544
545 case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOW:
546 TRACE("co_IntSetForegroundWindow 1 0x%p\n",hWnd);
547 Ret = co_IntSetForegroundWindow(Window);
548 TRACE("co_IntSetForegroundWindow 2 0x%p\n",hWnd);
549 break;
550
551 case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE:
552 TRACE("co_IntSetForegroundWindow M 1 0x%p\n",hWnd);
553 Ret = co_IntSetForegroundWindowMouse(Window);
554 TRACE("co_IntSetForegroundWindow M 2 0x%p\n",hWnd);
555 break;
556
557 case HWNDLOCK_ROUTINE_UPDATEWINDOW:
558 co_IntUpdateWindows(Window, RDW_ALLCHILDREN, FALSE);
559 Ret = TRUE;
560 break;
561 }
562
563 UserDerefObjectCo(Window);
564
565 RETURN( Ret);
566
567 CLEANUP:
568 TRACE("Leave NtUserCallHwndLock, ret=%u\n",_ret_);
569 UserLeave();
570 END_CLEANUP;
571 }
572
573 /*
574 * @unimplemented
575 */
576 HWND
577 APIENTRY
578 NtUserCallHwndOpt(
579 HWND hWnd,
580 DWORD Routine)
581 {
582 switch (Routine)
583 {
584 case HWNDOPT_ROUTINE_SETPROGMANWINDOW:
585 GetW32ThreadInfo()->pDeskInfo->hProgmanWindow = hWnd;
586 break;
587
588 case HWNDOPT_ROUTINE_SETTASKMANWINDOW:
589 GetW32ThreadInfo()->pDeskInfo->hTaskManWindow = hWnd;
590 break;
591 }
592
593 return hWnd;
594 }
595
596 DWORD
597 APIENTRY
598 NtUserCallHwnd(
599 HWND hWnd,
600 DWORD Routine)
601 {
602 switch (Routine)
603 {
604 case HWND_ROUTINE_GETWNDCONTEXTHLPID:
605 {
606 PWND Window;
607 DWORD HelpId;
608
609 UserEnterShared();
610
611 if (!(Window = UserGetWindowObject(hWnd)))
612 {
613 UserLeave();
614 return 0;
615 }
616
617 HelpId = (DWORD)(DWORD_PTR)UserGetProp(Window, gpsi->atomContextHelpIdProp, TRUE);
618
619 UserLeave();
620 return HelpId;
621 }
622 case HWND_ROUTINE_REGISTERSHELLHOOKWINDOW:
623 if (IntIsWindow(hWnd))
624 return IntRegisterShellHookWindow(hWnd);
625 return FALSE;
626 break;
627 case HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW:
628 if (IntIsWindow(hWnd))
629 return IntDeRegisterShellHookWindow(hWnd);
630 return FALSE;
631 case HWND_ROUTINE_SETMSGBOX:
632 {
633 PWND Window;
634 UserEnterExclusive();
635 if ((Window = UserGetWindowObject(hWnd)))
636 {
637 Window->state |= WNDS_MSGBOX;
638 }
639 UserLeave();
640 return FALSE;
641 }
642 }
643 STUB;
644
645 return 0;
646 }
647
648 DWORD
649 APIENTRY
650 NtUserCallHwndParam(
651 HWND hWnd,
652 DWORD Param,
653 DWORD Routine)
654 {
655
656 switch (Routine)
657 {
658 case HWNDPARAM_ROUTINE_KILLSYSTEMTIMER:
659 return IntKillTimer(UserGetWindowObject(hWnd), (UINT_PTR)Param, TRUE);
660
661 case HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID:
662 {
663 PWND Window;
664
665 UserEnterExclusive();
666 if(!(Window = UserGetWindowObject(hWnd)))
667 {
668 UserLeave();
669 return FALSE;
670 }
671
672 if ( Param )
673 UserSetProp(Window, gpsi->atomContextHelpIdProp, (HANDLE)Param, TRUE);
674 else
675 UserRemoveProp(Window, gpsi->atomContextHelpIdProp, TRUE);
676
677 UserLeave();
678 return TRUE;
679 }
680
681 case HWNDPARAM_ROUTINE_SETDIALOGPOINTER:
682 {
683 PWND pWnd;
684 USER_REFERENCE_ENTRY Ref;
685
686 UserEnterExclusive();
687
688 if (!(pWnd = UserGetWindowObject(hWnd)))
689 {
690 UserLeave();
691 return 0;
692 }
693 UserRefObjectCo(pWnd, &Ref);
694
695 if (pWnd->head.pti->ppi == PsGetCurrentProcessWin32Process() &&
696 pWnd->cbwndExtra == DLGWINDOWEXTRA &&
697 !(pWnd->state & WNDS_SERVERSIDEWINDOWPROC))
698 {
699 if (Param)
700 {
701 if (!pWnd->fnid) pWnd->fnid = FNID_DIALOG;
702 pWnd->state |= WNDS_DIALOGWINDOW;
703 }
704 else
705 {
706 pWnd->fnid |= FNID_DESTROY;
707 pWnd->state &= ~WNDS_DIALOGWINDOW;
708 }
709 }
710
711 UserDerefObjectCo(pWnd);
712 UserLeave();
713 return 0;
714 }
715
716 case HWNDPARAM_ROUTINE_ROS_NOTIFYWINEVENT:
717 {
718 PWND pWnd;
719 PNOTIFYEVENT pne;
720 UserEnterExclusive();
721 pne = (PNOTIFYEVENT)Param;
722 if (hWnd)
723 pWnd = UserGetWindowObject(hWnd);
724 else
725 pWnd = NULL;
726 IntNotifyWinEvent(pne->event, pWnd, pne->idObject, pne->idChild, pne->flags);
727 UserLeave();
728 return 0;
729 }
730 case HWNDPARAM_ROUTINE_CLEARWINDOWSTATE:
731 {
732 PWND pWnd;
733 UserEnterExclusive();
734 pWnd = UserGetWindowObject(hWnd);
735 if (pWnd) IntClearWindowState(pWnd, (UINT)Param);
736 UserLeave();
737 return 0;
738 }
739 case HWNDPARAM_ROUTINE_SETWINDOWSTATE:
740 {
741 PWND pWnd;
742 UserEnterExclusive();
743 pWnd = UserGetWindowObject(hWnd);
744 if (pWnd) IntSetWindowState(pWnd, (UINT)Param);
745 UserLeave();
746 return 0;
747 }
748 }
749
750 STUB;
751
752 return 0;
753 }
754
755 DWORD
756 APIENTRY
757 NtUserCallHwndParamLock(
758 HWND hWnd,
759 DWORD Param,
760 DWORD Routine)
761 {
762 DWORD Ret = 0;
763 PWND Window;
764 USER_REFERENCE_ENTRY Ref;
765 DECLARE_RETURN(DWORD);
766
767 TRACE("Enter NtUserCallHwndParamLock\n");
768 UserEnterExclusive();
769
770 if (!(Window = UserGetWindowObject(hWnd)))
771 {
772 RETURN( FALSE);
773 }
774 UserRefObjectCo(Window, &Ref);
775
776 switch (Routine)
777 {
778 case TWOPARAM_ROUTINE_VALIDATERGN:
779 {
780 PREGION Rgn = REGION_LockRgn((HRGN)Param);
781 Ret = (DWORD)co_UserRedrawWindow( Window, NULL, Rgn, RDW_VALIDATE);
782 if (Rgn) REGION_UnlockRgn(Rgn);
783 break;
784 }
785 }
786
787 UserDerefObjectCo(Window);
788
789 RETURN( Ret);
790
791 CLEANUP:
792 TRACE("Leave NtUserCallHwndParamLock, ret=%lu\n",_ret_);
793 UserLeave();
794 END_CLEANUP;
795
796 }
797
798 /* EOF */