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