3d5a5425d91e044612b512b637acd75ec5a0bd76
[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_GETCURSORPOSITION:
264 {
265 BOOL ret = TRUE;
266
267 _SEH2_TRY
268 {
269 ProbeForWrite((POINT*)Param,sizeof(POINT),1);
270 RtlCopyMemory((POINT*)Param,&gpsi->ptCursor,sizeof(POINT));
271 }
272 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
273 {
274 SetLastNtError(_SEH2_GetExceptionCode());
275 ret = FALSE;
276 }
277 _SEH2_END;
278
279 RETURN (ret);
280 }
281
282 case ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING:
283 {
284 BOOL Enable;
285 PPROCESSINFO Process = PsGetCurrentProcessWin32Process();
286
287 if(Process != NULL)
288 {
289 Enable = (BOOL)(Param != 0);
290
291 if(Enable)
292 {
293 Process->W32PF_flags &= ~W32PF_NOWINDOWGHOSTING;
294 }
295 else
296 {
297 Process->W32PF_flags |= W32PF_NOWINDOWGHOSTING;
298 }
299
300 RETURN( TRUE);
301 }
302
303 RETURN( FALSE);
304 }
305
306 case ONEPARAM_ROUTINE_GETINPUTEVENT:
307 RETURN( (DWORD_PTR)IntMsqSetWakeMask(Param));
308
309 case ONEPARAM_ROUTINE_GETKEYBOARDTYPE:
310 RETURN( UserGetKeyboardType(Param));
311
312 case ONEPARAM_ROUTINE_GETKEYBOARDLAYOUT:
313 RETURN( (DWORD_PTR)UserGetKeyboardLayout(Param));
314
315 case ONEPARAM_ROUTINE_RELEASEDC:
316 RETURN (UserReleaseDC(NULL, (HDC) Param, FALSE));
317
318 case ONEPARAM_ROUTINE_REALIZEPALETTE:
319 RETURN (UserRealizePalette((HDC) Param));
320
321 case ONEPARAM_ROUTINE_GETQUEUESTATUS:
322 {
323 RETURN (IntGetQueueStatus((DWORD)Param));
324 }
325 case ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS:
326 /* FIXME: Should use UserEnterShared */
327 RETURN(UserEnumClipboardFormats(Param));
328
329 case ONEPARAM_ROUTINE_CSRSS_GUICHECK:
330 IntUserManualGuiCheck(Param);
331 RETURN(TRUE);
332
333 case ONEPARAM_ROUTINE_GETCURSORPOS:
334 {
335 BOOL Ret = TRUE;
336 PPOINTL pptl;
337 PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
338 if (pti->hdesk != InputDesktopHandle) RETURN(FALSE);
339 _SEH2_TRY
340 {
341 pptl = (PPOINTL)Param;
342 *pptl = gpsi->ptCursor;
343 }
344 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
345 {
346 Ret = FALSE;
347 }
348 _SEH2_END;
349 RETURN(Ret);
350 }
351 case ONEPARAM_ROUTINE_SETPROCDEFLAYOUT:
352 {
353 PPROCESSINFO ppi;
354 if (Param & LAYOUT_ORIENTATIONMASK)
355 {
356 ppi = PsGetCurrentProcessWin32Process();
357 ppi->dwLayout = Param;
358 RETURN(TRUE);
359 }
360 EngSetLastError(ERROR_INVALID_PARAMETER);
361 RETURN(FALSE);
362 }
363 case ONEPARAM_ROUTINE_GETPROCDEFLAYOUT:
364 {
365 BOOL Ret = TRUE;
366 PPROCESSINFO ppi;
367 PDWORD pdwLayout;
368 if ( PsGetCurrentProcess() == CsrProcess)
369 {
370 EngSetLastError(ERROR_INVALID_ACCESS);
371 RETURN(FALSE);
372 }
373 ppi = PsGetCurrentProcessWin32Process();
374 _SEH2_TRY
375 {
376 pdwLayout = (PDWORD)Param;
377 *pdwLayout = ppi->dwLayout;
378 }
379 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
380 {
381 SetLastNtError(_SEH2_GetExceptionCode());
382 Ret = FALSE;
383 }
384 _SEH2_END;
385 RETURN(Ret);
386 }
387 case ONEPARAM_ROUTINE_REPLYMESSAGE:
388 RETURN (co_MsqReplyMessage((LRESULT) Param));
389 case ONEPARAM_ROUTINE_MESSAGEBEEP:
390 RETURN ( UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_MESSAGE_BEEP, Param) );
391 /* TODO: Implement sound sentry */
392 case ONEPARAM_ROUTINE_CREATESYSTEMTHREADS:
393 RETURN(CreateSystemThreads(Param));
394 case ONEPARAM_ROUTINE_LOCKFOREGNDWINDOW:
395 RETURN( (DWORD_PTR)IntLockSetForegroundWindow(Param));
396 case ONEPARAM_ROUTINE_ALLOWSETFOREGND:
397 RETURN( (DWORD_PTR)IntAllowSetForegroundWindow(Param));
398 }
399 ERR("Calling invalid routine number 0x%x in NtUserCallOneParam(), Param=0x%x\n",
400 Routine, Param);
401 EngSetLastError(ERROR_INVALID_PARAMETER);
402 RETURN( 0);
403
404 CLEANUP:
405 TRACE("Leave NtUserCallOneParam, ret=%p\n", (PVOID)_ret_);
406 UserLeave();
407 END_CLEANUP;
408 }
409
410
411 /*
412 * @implemented
413 */
414 DWORD_PTR
415 APIENTRY
416 NtUserCallTwoParam(
417 DWORD_PTR Param1,
418 DWORD_PTR Param2,
419 DWORD Routine)
420 {
421 PWND Window;
422 DECLARE_RETURN(DWORD_PTR);
423
424 TRACE("Enter NtUserCallTwoParam\n");
425 UserEnterExclusive();
426
427 switch(Routine)
428 {
429 case TWOPARAM_ROUTINE_SETMENUBARHEIGHT:
430 {
431 DWORD_PTR Ret;
432 PMENU_OBJECT MenuObject = IntGetMenuObject((HMENU)Param1);
433 if(!MenuObject)
434 RETURN( 0);
435
436 if(Param2 > 0)
437 {
438 Ret = (MenuObject->MenuInfo.Height == (int)Param2);
439 MenuObject->MenuInfo.Height = (int)Param2;
440 }
441 else
442 Ret = (DWORD_PTR)MenuObject->MenuInfo.Height;
443 IntReleaseMenuObject(MenuObject);
444 RETURN( Ret);
445 }
446
447 case TWOPARAM_ROUTINE_SETGUITHRDHANDLE:
448 {
449 PUSER_MESSAGE_QUEUE MsgQueue = ((PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread)->MessageQueue;
450
451 ASSERT(MsgQueue);
452 RETURN( (DWORD_PTR)MsqSetStateWindow(MsgQueue, (ULONG)Param1, (HWND)Param2));
453 }
454
455 case TWOPARAM_ROUTINE_ENABLEWINDOW:
456 RETURN( IntEnableWindow((HWND)Param1, (BOOL)Param2));
457
458 case TWOPARAM_ROUTINE_SHOWOWNEDPOPUPS:
459 {
460 Window = UserGetWindowObject((HWND)Param1);
461 if (!Window) RETURN(0);
462
463 RETURN( (DWORD_PTR)IntShowOwnedPopups(Window, (BOOL) Param2));
464 }
465
466 case TWOPARAM_ROUTINE_ROS_UPDATEUISTATE:
467 {
468 WPARAM wParam;
469 Window = UserGetWindowObject((HWND)Param1);
470 if (!Window) RETURN(0);
471
472 /* Unpack wParam */
473 wParam = MAKEWPARAM((Param2 >> 3) & 0x3,
474 Param2 & (UISF_HIDEFOCUS | UISF_HIDEACCEL | UISF_ACTIVE));
475
476 RETURN( UserUpdateUiState(Window, wParam) );
477 }
478
479 case TWOPARAM_ROUTINE_SWITCHTOTHISWINDOW:
480 STUB
481 RETURN( 0);
482
483
484 case TWOPARAM_ROUTINE_SETCARETPOS:
485 RETURN( (DWORD_PTR)co_IntSetCaretPos((int)Param1, (int)Param2));
486
487 case TWOPARAM_ROUTINE_REGISTERLOGONPROCESS:
488 RETURN( (DWORD_PTR)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
489
490 case TWOPARAM_ROUTINE_SETCURSORPOS:
491 RETURN( (DWORD_PTR)UserSetCursorPos((int)Param1, (int)Param2, 0, 0, FALSE));
492
493 case TWOPARAM_ROUTINE_UNHOOKWINDOWSHOOK:
494 RETURN( IntUnhookWindowsHook((int)Param1, (HOOKPROC)Param2));
495 }
496 ERR("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
497 Routine, Param1, Param2);
498 EngSetLastError(ERROR_INVALID_PARAMETER);
499 RETURN( 0);
500
501 CLEANUP:
502 TRACE("Leave NtUserCallTwoParam, ret=%p\n", (PVOID)_ret_);
503 UserLeave();
504 END_CLEANUP;
505 }
506
507
508 /*
509 * @unimplemented
510 */
511 BOOL
512 APIENTRY
513 NtUserCallHwndLock(
514 HWND hWnd,
515 DWORD Routine)
516 {
517 BOOL Ret = 0;
518 PWND Window;
519 USER_REFERENCE_ENTRY Ref;
520 DECLARE_RETURN(BOOLEAN);
521
522 TRACE("Enter NtUserCallHwndLock\n");
523 UserEnterExclusive();
524
525 if (!(Window = UserGetWindowObject(hWnd)))
526 {
527 RETURN( FALSE);
528 }
529 UserRefObjectCo(Window, &Ref);
530
531 /* FIXME: Routine can be 0x53 - 0x5E */
532 switch (Routine)
533 {
534 case HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS:
535 co_WinPosArrangeIconicWindows(Window);
536 break;
537
538 case HWNDLOCK_ROUTINE_DRAWMENUBAR:
539 {
540 TRACE("HWNDLOCK_ROUTINE_DRAWMENUBAR\n");
541 Ret = TRUE;
542 if ((Window->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
543 co_WinPosSetWindowPos( Window,
544 HWND_DESKTOP,
545 0,0,0,0,
546 SWP_NOSIZE|
547 SWP_NOMOVE|
548 SWP_NOZORDER|
549 SWP_NOACTIVATE|
550 SWP_FRAMECHANGED );
551 break;
552 }
553
554 case HWNDLOCK_ROUTINE_REDRAWFRAME:
555 co_WinPosSetWindowPos( Window,
556 HWND_DESKTOP,
557 0,0,0,0,
558 SWP_NOSIZE|
559 SWP_NOMOVE|
560 SWP_NOZORDER|
561 SWP_NOACTIVATE|
562 SWP_FRAMECHANGED );
563 Ret = TRUE;
564 break;
565
566 case HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK:
567 co_WinPosSetWindowPos( Window,
568 HWND_DESKTOP,
569 0,0,0,0,
570 SWP_NOSIZE|
571 SWP_NOMOVE|
572 SWP_NOZORDER|
573 SWP_NOACTIVATE|
574 SWP_FRAMECHANGED );
575 if (!Window->spwndOwner && !IntGetParent(Window))
576 {
577 co_IntShellHookNotify(HSHELL_REDRAW, (WPARAM) hWnd, FALSE); // FIXME Flashing?
578 }
579 Ret = TRUE;
580 break;
581
582 case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOW:
583 TRACE("co_IntSetForegroundWindow 1 %p\n",hWnd);
584 Ret = co_IntSetForegroundWindow(Window);
585 TRACE("co_IntSetForegroundWindow 2 \n");
586 break;
587
588 case HWNDLOCK_ROUTINE_UPDATEWINDOW:
589 Ret = co_UserRedrawWindow( Window, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN);
590 break;
591 }
592
593 UserDerefObjectCo(Window);
594
595 RETURN( Ret);
596
597 CLEANUP:
598 TRACE("Leave NtUserCallHwndLock, ret=%u\n",_ret_);
599 UserLeave();
600 END_CLEANUP;
601 }
602
603 /*
604 * @unimplemented
605 */
606 HWND
607 APIENTRY
608 NtUserCallHwndOpt(
609 HWND hWnd,
610 DWORD Routine)
611 {
612 switch (Routine)
613 {
614 case HWNDOPT_ROUTINE_SETPROGMANWINDOW:
615 GetW32ThreadInfo()->pDeskInfo->hProgmanWindow = hWnd;
616 break;
617
618 case HWNDOPT_ROUTINE_SETTASKMANWINDOW:
619 GetW32ThreadInfo()->pDeskInfo->hTaskManWindow = hWnd;
620 break;
621 }
622
623 return hWnd;
624 }
625
626 DWORD
627 APIENTRY
628 NtUserCallHwnd(
629 HWND hWnd,
630 DWORD Routine)
631 {
632 switch (Routine)
633 {
634 case HWND_ROUTINE_GETWNDCONTEXTHLPID:
635 {
636 PWND Window;
637 PPROPERTY HelpId;
638 USER_REFERENCE_ENTRY Ref;
639
640 UserEnterExclusive();
641
642 if (!(Window = UserGetWindowObject(hWnd)))
643 {
644 UserLeave();
645 return 0;
646 }
647 UserRefObjectCo(Window, &Ref);
648
649 HelpId = IntGetProp(Window, gpsi->atomContextHelpIdProp);
650
651 UserDerefObjectCo(Window);
652 UserLeave();
653 return (DWORD)HelpId->Data;
654 }
655 case HWND_ROUTINE_REGISTERSHELLHOOKWINDOW:
656 if (IntIsWindow(hWnd))
657 return IntRegisterShellHookWindow(hWnd);
658 return FALSE;
659 break;
660 case HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW:
661 if (IntIsWindow(hWnd))
662 return IntDeRegisterShellHookWindow(hWnd);
663 return FALSE;
664 case HWND_ROUTINE_SETMSGBOX:
665 {
666 PWND Window;
667 UserEnterExclusive();
668 if ((Window = UserGetWindowObject(hWnd)))
669 {
670 Window->state |= WNDS_MSGBOX;
671 }
672 UserLeave();
673 return FALSE;
674 }
675 }
676 STUB;
677
678 return 0;
679 }
680
681 DWORD
682 APIENTRY
683 NtUserCallHwndParam(
684 HWND hWnd,
685 DWORD Param,
686 DWORD Routine)
687 {
688
689 switch (Routine)
690 {
691 case HWNDPARAM_ROUTINE_KILLSYSTEMTIMER:
692 return IntKillTimer(UserGetWindowObject(hWnd), (UINT_PTR)Param, TRUE);
693
694 case HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID:
695 {
696 PWND Window;
697
698 UserEnterExclusive();
699 if(!(Window = UserGetWindowObject(hWnd)))
700 {
701 UserLeave();
702 return FALSE;
703 }
704
705 if ( Param )
706 IntSetProp(Window, gpsi->atomContextHelpIdProp, (HANDLE)Param);
707 else
708 IntRemoveProp(Window, gpsi->atomContextHelpIdProp);
709
710 UserLeave();
711 return TRUE;
712 }
713
714 case HWNDPARAM_ROUTINE_SETDIALOGPOINTER:
715 {
716 PWND pWnd;
717 USER_REFERENCE_ENTRY Ref;
718
719 UserEnterExclusive();
720
721 if (!(pWnd = UserGetWindowObject(hWnd)))
722 {
723 UserLeave();
724 return 0;
725 }
726 UserRefObjectCo(pWnd, &Ref);
727
728 if (pWnd->head.pti->ppi == PsGetCurrentProcessWin32Process() &&
729 pWnd->cbwndExtra == DLGWINDOWEXTRA &&
730 !(pWnd->state & WNDS_SERVERSIDEWINDOWPROC))
731 {
732 if (Param)
733 {
734 if (!pWnd->fnid) pWnd->fnid = FNID_DIALOG;
735 pWnd->state |= WNDS_DIALOGWINDOW;
736 }
737 else
738 {
739 pWnd->fnid |= FNID_DESTROY;
740 pWnd->state &= ~WNDS_DIALOGWINDOW;
741 }
742 }
743
744 UserDerefObjectCo(pWnd);
745 UserLeave();
746 return 0;
747 }
748
749 case HWNDPARAM_ROUTINE_ROS_NOTIFYWINEVENT:
750 {
751 PWND pWnd;
752 PNOTIFYEVENT pne;
753 UserEnterExclusive();
754 pne = (PNOTIFYEVENT)Param;
755 if (hWnd)
756 pWnd = UserGetWindowObject(hWnd);
757 else
758 pWnd = NULL;
759 IntNotifyWinEvent(pne->event, pWnd, pne->idObject, pne->idChild, pne->flags);
760 UserLeave();
761 return 0;
762 }
763 case HWNDPARAM_ROUTINE_CLEARWINDOWSTATE:
764 {
765 PWND pWnd;
766 UserEnterExclusive();
767 pWnd = UserGetWindowObject(hWnd);
768 if (pWnd) IntClearWindowState(pWnd, (UINT)Param);
769 UserLeave();
770 return 0;
771 }
772 case HWNDPARAM_ROUTINE_SETWINDOWSTATE:
773 {
774 PWND pWnd;
775 UserEnterExclusive();
776 pWnd = UserGetWindowObject(hWnd);
777 if (pWnd) IntSetWindowState(pWnd, (UINT)Param);
778 UserLeave();
779 return 0;
780 }
781 }
782
783 STUB;
784
785 return 0;
786 }
787
788 DWORD
789 APIENTRY
790 NtUserCallHwndParamLock(
791 HWND hWnd,
792 DWORD Param,
793 DWORD Routine)
794 {
795 DWORD Ret = 0;
796 PWND Window;
797 USER_REFERENCE_ENTRY Ref;
798 DECLARE_RETURN(DWORD);
799
800 TRACE("Enter NtUserCallHwndParamLock\n");
801 UserEnterExclusive();
802
803 if (!(Window = UserGetWindowObject(hWnd)))
804 {
805 RETURN( FALSE);
806 }
807 UserRefObjectCo(Window, &Ref);
808
809 switch (Routine)
810 {
811 case TWOPARAM_ROUTINE_VALIDATERGN:
812 Ret = (DWORD)co_UserRedrawWindow( Window, NULL, (HRGN)Param, RDW_VALIDATE);
813 break;
814 }
815
816 UserDerefObjectCo(Window);
817
818 RETURN( Ret);
819
820 CLEANUP:
821 TRACE("Leave NtUserCallHwndParamLock, ret=%lu\n",_ret_);
822 UserLeave();
823 END_CLEANUP;
824
825 }
826
827 /* EOF */