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