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