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