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