3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * PURPOSE: Misc User funcs
6 * FILE: subsys/win32k/ntuser/misc.c
7 * PROGRAMER: Ge van Geldorp (ge@gse.nl)
18 /* registered Logon process */
19 PW32PROCESS LogonProcess
= NULL
;
21 VOID
W32kRegisterPrimitiveMessageQueue(VOID
)
23 extern PUSER_MESSAGE_QUEUE pmPrimitiveMessageQueue
;
24 if( !pmPrimitiveMessageQueue
)
27 pThread
= PsGetWin32Thread();
28 if( pThread
&& pThread
->MessageQueue
)
30 pmPrimitiveMessageQueue
= pThread
->MessageQueue
;
31 IntReferenceMessageQueue(pmPrimitiveMessageQueue
);
32 DPRINT( "Installed primitive input queue.\n" );
37 DPRINT1( "Alert! Someone is trying to steal the primitive queue.\n" );
41 VOID
W32kUnregisterPrimitiveMessageQueue(VOID
)
43 extern PUSER_MESSAGE_QUEUE pmPrimitiveMessageQueue
;
44 IntDereferenceMessageQueue(pmPrimitiveMessageQueue
);
45 pmPrimitiveMessageQueue
= NULL
;
48 PUSER_MESSAGE_QUEUE
W32kGetPrimitiveMessageQueue()
50 extern PUSER_MESSAGE_QUEUE pmPrimitiveMessageQueue
;
51 return pmPrimitiveMessageQueue
;
55 co_IntRegisterLogonProcess(HANDLE ProcessId
, BOOL Register
)
59 CSR_API_MESSAGE Request
;
61 Status
= PsLookupProcessByProcessId(ProcessId
,
63 if (!NT_SUCCESS(Status
))
65 SetLastWin32Error(RtlNtStatusToDosError(Status
));
71 /* Register the logon process */
72 if (LogonProcess
!= NULL
)
74 ObDereferenceObject(Process
);
78 LogonProcess
= (PW32PROCESS
)Process
->Win32Process
;
82 /* Deregister the logon process */
83 if (LogonProcess
!= (PW32PROCESS
)Process
->Win32Process
)
85 ObDereferenceObject(Process
);
92 ObDereferenceObject(Process
);
94 Request
.Type
= MAKE_CSR_API(REGISTER_LOGON_PROCESS
, CSR_GUI
);
95 Request
.Data
.RegisterLogonProcessRequest
.ProcessId
= ProcessId
;
96 Request
.Data
.RegisterLogonProcessRequest
.Register
= Register
;
98 Status
= co_CsrNotify(&Request
);
99 if (! NT_SUCCESS(Status
))
101 DPRINT1("Failed to register logon process with CSRSS\n");
113 NtUserCallNoParam(DWORD Routine
)
116 DECLARE_RETURN(DWORD
);
118 DPRINT("Enter NtUserCallNoParam\n");
119 UserEnterExclusive();
123 case NOPARAM_ROUTINE_REGISTER_PRIMITIVE
:
124 W32kRegisterPrimitiveMessageQueue();
125 Result
= (DWORD
)TRUE
;
128 case NOPARAM_ROUTINE_DESTROY_CARET
:
129 Result
= (DWORD
)co_IntDestroyCaret(PsGetCurrentThread()->Tcb
.Win32Thread
);
132 case NOPARAM_ROUTINE_INIT_MESSAGE_PUMP
:
133 Result
= (DWORD
)IntInitMessagePumpHook();
136 case NOPARAM_ROUTINE_UNINIT_MESSAGE_PUMP
:
137 Result
= (DWORD
)IntUninitMessagePumpHook();
140 case NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO
:
141 Result
= (DWORD
)MsqGetMessageExtraInfo();
144 case NOPARAM_ROUTINE_ANYPOPUP
:
145 Result
= (DWORD
)IntAnyPopup();
148 case NOPARAM_ROUTINE_CSRSS_INITIALIZED
:
149 Result
= (DWORD
)CsrInit();
152 case NOPARAM_ROUTINE_MSQCLEARWAKEMASK
:
153 RETURN( (DWORD
)IntMsqClearWakeMask());
156 DPRINT1("Calling invalid routine number 0x%x in NtUserCallNoParam\n", Routine
);
157 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
163 DPRINT("Leave NtUserCallNoParam, ret=%i\n",_ret_
);
178 DECLARE_RETURN(DWORD
);
180 DPRINT("Enter NtUserCallOneParam\n");
183 if (Routine
== ONEPARAM_ROUTINE_SHOWCURSOR
)
185 PWINSTATION_OBJECT WinSta
= PsGetWin32Thread()->Desktop
->WindowStation
;
186 PSYSTEM_CURSORINFO CurInfo
;
191 BITMAPOBJ
*BitmapObj
;
195 if(!(Screen
= IntGetScreenDC()))
197 return 1; /* No mouse */
200 PDC dc
= DC_LockDc(Screen
);
204 return 1; /* No mouse */
207 dcbmp
= dc
->w
.hBitmap
;
210 BitmapObj
= BITMAPOBJ_LockBitmap(dcbmp
);
213 BITMAPOBJ_UnlockBitmap(BitmapObj
);
214 return 1; /* No Mouse */
217 SurfObj
= &BitmapObj
->SurfObj
;
220 BITMAPOBJ_UnlockBitmap(BitmapObj
);
221 return 1; /* No mouse */
224 ppdev
= GDIDEV(SurfObj
);
228 BITMAPOBJ_UnlockBitmap(BitmapObj
);
229 return 1; /* No mouse */
232 pgp
= &ppdev
->Pointer
;
234 CurInfo
= IntGetSysCursorInfo(WinSta
);
238 if (CurInfo
->ShowingCursor
!= 0)
240 pgp
->ShowPointer
= 1;
241 //ppdev->SafetyRemoveCount = 1;
242 //ppdev->SafetyRemoveLevel = 1;
243 EngMovePointer(SurfObj
,-1,-1,NULL
);
244 CurInfo
->ShowingCursor
= 0;
251 pgp
->ShowPointer
= 0;
252 //ppdev->SafetyRemoveCount = 0;
253 //ppdev->SafetyRemoveLevel = 0;
254 EngMovePointer(SurfObj
,-1,-1,NULL
);
255 CurInfo
->ShowingCursor
= CURSOR_SHOWING
;
258 BITMAPOBJ_UnlockBitmap(BitmapObj
);
263 UserEnterExclusive();
267 case ONEPARAM_ROUTINE_GETMENU
:
269 PWINDOW_OBJECT Window
;
272 if(!(Window
= UserGetWindowObject((HWND
)Param
)))
277 Result
= (DWORD
)Window
->IDMenu
;
282 case ONEPARAM_ROUTINE_ISWINDOWUNICODE
:
284 PWINDOW_OBJECT Window
;
287 Window
= UserGetWindowObject((HWND
)Param
);
292 Result
= Window
->Unicode
;
296 case ONEPARAM_ROUTINE_WINDOWFROMDC
:
297 RETURN( (DWORD
)IntWindowFromDC((HDC
)Param
));
299 case ONEPARAM_ROUTINE_GETWNDCONTEXTHLPID
:
301 PWINDOW_OBJECT Window
;
304 Window
= UserGetWindowObject((HWND
)Param
);
310 Result
= Window
->ContextHelpId
;
315 case ONEPARAM_ROUTINE_SWAPMOUSEBUTTON
:
317 PWINSTATION_OBJECT WinSta
;
321 Status
= IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation
,
325 if (!NT_SUCCESS(Status
))
326 RETURN( (DWORD
)FALSE
);
329 Result = (DWORD)IntSwapMouseButton(WinStaObject, (BOOL)Param); */
332 ObDereferenceObject(WinSta
);
336 case ONEPARAM_ROUTINE_SWITCHCARETSHOWING
:
337 RETURN( (DWORD
)IntSwitchCaretShowing((PVOID
)Param
));
339 case ONEPARAM_ROUTINE_SETCARETBLINKTIME
:
340 RETURN( (DWORD
)IntSetCaretBlinkTime((UINT
)Param
));
342 case ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS
:
343 RETURN( (DWORD
)IntEnumClipboardFormats((UINT
)Param
));
345 case ONEPARAM_ROUTINE_GETWINDOWINSTANCE
:
347 PWINDOW_OBJECT Window
;
350 if(!(Window
= UserGetWindowObject((HWND
)Param
)))
355 Result
= (DWORD
)Window
->Instance
;
359 case ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO
:
360 RETURN( (DWORD
)MsqSetMessageExtraInfo((LPARAM
)Param
));
362 case ONEPARAM_ROUTINE_GETCURSORPOSITION
:
364 PWINSTATION_OBJECT WinSta
;
369 RETURN( (DWORD
)FALSE
);
370 Status
= IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation
,
374 if (!NT_SUCCESS(Status
))
375 RETURN( (DWORD
)FALSE
);
377 /* FIXME - check if process has WINSTA_READATTRIBUTES */
378 IntGetCursorLocation(WinSta
, &Pos
);
380 Status
= MmCopyToCaller((PPOINT
)Param
, &Pos
, sizeof(POINT
));
381 if(!NT_SUCCESS(Status
))
383 ObDereferenceObject(WinSta
);
384 SetLastNtError(Status
);
388 ObDereferenceObject(WinSta
);
390 RETURN( (DWORD
)TRUE
);
393 case ONEPARAM_ROUTINE_ISWINDOWINDESTROY
:
395 PWINDOW_OBJECT Window
;
398 if(!(Window
= UserGetWindowObject((HWND
)Param
)))
403 Result
= (DWORD
)IntIsWindowInDestroy(Window
);
408 case ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING
:
411 PW32PROCESS Process
= PsGetWin32Process();
415 Enable
= (BOOL
)(Param
!= 0);
419 Process
->Flags
&= ~W32PF_NOWINDOWGHOSTING
;
423 Process
->Flags
|= W32PF_NOWINDOWGHOSTING
;
432 case ONEPARAM_ROUTINE_MSQSETWAKEMASK
:
433 RETURN( (DWORD
)IntMsqSetWakeMask(Param
));
435 case ONEPARAM_ROUTINE_GETKEYBOARDTYPE
:
436 RETURN( UserGetKeyboardType(Param
));
438 case ONEPARAM_ROUTINE_GETKEYBOARDLAYOUT
:
439 RETURN( (DWORD
)UserGetKeyboardLayout(Param
));
441 DPRINT1("Calling invalid routine number 0x%x in NtUserCallOneParam(), Param=0x%x\n",
443 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
447 DPRINT("Leave NtUserCallOneParam, ret=%i\n",_ret_
);
464 PWINDOW_OBJECT Window
;
465 DECLARE_RETURN(DWORD
);
467 DPRINT("Enter NtUserCallTwoParam\n");
468 UserEnterExclusive();
472 case TWOPARAM_ROUTINE_SETDCPENCOLOR
:
474 RETURN( (DWORD
)IntSetDCColor((HDC
)Param1
, OBJ_PEN
, (COLORREF
)Param2
));
476 case TWOPARAM_ROUTINE_SETDCBRUSHCOLOR
:
478 RETURN( (DWORD
)IntSetDCColor((HDC
)Param1
, OBJ_BRUSH
, (COLORREF
)Param2
));
480 case TWOPARAM_ROUTINE_GETDCCOLOR
:
482 RETURN( (DWORD
)IntGetDCColor((HDC
)Param1
, (ULONG
)Param2
));
484 case TWOPARAM_ROUTINE_GETWINDOWRGNBOX
:
488 PWINDOW_OBJECT Window
= UserGetWindowObject((HWND
)Param1
);
489 if (!Window
) RETURN(ERROR
);
491 Ret
= (DWORD
)IntGetWindowRgnBox(Window
, &rcRect
);
492 Status
= MmCopyToCaller((PVOID
)Param2
, &rcRect
, sizeof(RECT
));
493 if(!NT_SUCCESS(Status
))
495 SetLastNtError(Status
);
500 case TWOPARAM_ROUTINE_GETWINDOWRGN
:
502 PWINDOW_OBJECT Window
= UserGetWindowObject((HWND
)Param1
);
503 if (!Window
) RETURN(ERROR
);
505 RETURN( (DWORD
)IntGetWindowRgn(Window
, (HRGN
)Param2
));
507 case TWOPARAM_ROUTINE_SETMENUBARHEIGHT
:
510 PMENU_OBJECT MenuObject
= IntGetMenuObject((HMENU
)Param1
);
516 Ret
= (MenuObject
->MenuInfo
.Height
== (int)Param2
);
517 MenuObject
->MenuInfo
.Height
= (int)Param2
;
520 Ret
= (DWORD
)MenuObject
->MenuInfo
.Height
;
521 IntReleaseMenuObject(MenuObject
);
524 case TWOPARAM_ROUTINE_SETMENUITEMRECT
:
527 SETMENUITEMRECT smir
;
528 PMENU_OBJECT MenuObject
= IntGetMenuObject((HMENU
)Param1
);
532 if(!NT_SUCCESS(MmCopyFromCaller(&smir
, (PVOID
)Param2
, sizeof(SETMENUITEMRECT
))))
534 IntReleaseMenuObject(MenuObject
);
538 Ret
= IntSetMenuItemRect(MenuObject
, smir
.uItem
, smir
.fByPosition
, &smir
.rcRect
);
540 IntReleaseMenuObject(MenuObject
);
544 case TWOPARAM_ROUTINE_SETGUITHRDHANDLE
:
546 PUSER_MESSAGE_QUEUE MsgQueue
= ((PW32THREAD
)PsGetCurrentThread()->Tcb
.Win32Thread
)->MessageQueue
;
549 RETURN( (DWORD
)MsqSetStateWindow(MsgQueue
, (ULONG
)Param1
, (HWND
)Param2
));
552 case TWOPARAM_ROUTINE_ENABLEWINDOW
:
556 case TWOPARAM_ROUTINE_UNKNOWN
:
560 case TWOPARAM_ROUTINE_SHOWOWNEDPOPUPS
:
562 PWINDOW_OBJECT Window
= UserGetWindowObject((HWND
)Param1
);
563 if (!Window
) RETURN(0);
565 RETURN( (DWORD
)IntShowOwnedPopups(Window
, (BOOL
) Param2
));
568 case TWOPARAM_ROUTINE_ROS_SHOWWINDOW
:
570 #define WIN_NEEDS_SHOW_OWNEDPOPUP (0x00000040)
571 PWINDOW_OBJECT Window
;
572 DPRINT1("ROS_SHOWWINDOW\n");
574 if (!(Window
= UserGetWindowObject((HWND
)Param1
)))
581 if (!(Window
->Flags
& WIN_NEEDS_SHOW_OWNEDPOPUP
))
585 Window
->Flags
&= ~WIN_NEEDS_SHOW_OWNEDPOPUP
;
588 Window
->Flags
|= WIN_NEEDS_SHOW_OWNEDPOPUP
;
590 DPRINT1("ROS_SHOWWINDOW ---> 0x%x\n",Window
->Flags
);
593 case TWOPARAM_ROUTINE_SWITCHTOTHISWINDOW
:
597 case TWOPARAM_ROUTINE_SETWNDCONTEXTHLPID
:
599 if(!(Window
= UserGetWindowObject((HWND
)Param1
)))
601 RETURN( (DWORD
)FALSE
);
604 Window
->ContextHelpId
= Param2
;
606 RETURN( (DWORD
)TRUE
);
608 case TWOPARAM_ROUTINE_SETCARETPOS
:
609 RETURN( (DWORD
)co_IntSetCaretPos((int)Param1
, (int)Param2
));
611 case TWOPARAM_ROUTINE_GETWINDOWINFO
:
616 if(!(Window
= UserGetWindowObject((HWND
)Param1
)))
623 * According to WINE, Windows' doesn't check the cbSize field
626 Status
= MmCopyFromCaller(&wi
.cbSize
, (PVOID
)Param2
, sizeof(wi
.cbSize
));
627 if(!NT_SUCCESS(Status
))
629 SetLastNtError(Status
);
633 if(wi
.cbSize
!= sizeof(WINDOWINFO
))
635 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
640 if((Ret
= (DWORD
)IntGetWindowInfo(Window
, &wi
)))
642 Status
= MmCopyToCaller((PVOID
)Param2
, &wi
, sizeof(WINDOWINFO
));
643 if(!NT_SUCCESS(Status
))
645 SetLastNtError(Status
);
653 case TWOPARAM_ROUTINE_REGISTERLOGONPROC
:
654 RETURN( (DWORD
)co_IntRegisterLogonProcess((HANDLE
)Param1
, (BOOL
)Param2
));
656 case TWOPARAM_ROUTINE_SETSYSCOLORS
:
667 /* FIXME - we should make use of SEH here... */
669 Status
= MmCopyFromCaller(&ChangeSysColors
, (PVOID
)Param1
, sizeof(ChangeSysColors
));
670 if(!NT_SUCCESS(Status
))
672 SetLastNtError(Status
);
676 Buffer
= ExAllocatePool(PagedPool
, (Param2
* sizeof(INT
)) + (Param2
* sizeof(COLORREF
)));
679 INT
*Elements
= (INT
*)Buffer
;
680 COLORREF
*Colors
= (COLORREF
*)Buffer
+ Param2
;
682 Status
= MmCopyFromCaller(Elements
, ChangeSysColors
.Elements
, Param2
* sizeof(INT
));
683 if(NT_SUCCESS(Status
))
685 Status
= MmCopyFromCaller(Colors
, ChangeSysColors
.Colors
, Param2
* sizeof(COLORREF
));
686 if(NT_SUCCESS(Status
))
688 Ret
= (DWORD
)IntSetSysColors((UINT
)Param2
, Elements
, Colors
);
691 SetLastNtError(Status
);
694 SetLastNtError(Status
);
703 case TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES
:
704 case TWOPARAM_ROUTINE_GETSYSCOLORPENS
:
705 case TWOPARAM_ROUTINE_GETSYSCOLORS
:
716 /* FIXME - we should make use of SEH here... */
718 Buffer
.Pointer
= ExAllocatePool(PagedPool
, Param2
* sizeof(HANDLE
));
719 if(Buffer
.Pointer
!= NULL
)
723 case TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES
:
724 Ret
= (DWORD
)IntGetSysColorBrushes(Buffer
.Brushes
, (UINT
)Param2
);
726 case TWOPARAM_ROUTINE_GETSYSCOLORPENS
:
727 Ret
= (DWORD
)IntGetSysColorPens(Buffer
.Pens
, (UINT
)Param2
);
729 case TWOPARAM_ROUTINE_GETSYSCOLORS
:
730 Ret
= (DWORD
)IntGetSysColors(Buffer
.Colors
, (UINT
)Param2
);
739 Status
= MmCopyToCaller((PVOID
)Param1
, Buffer
.Pointer
, Param2
* sizeof(HANDLE
));
740 if(!NT_SUCCESS(Status
))
742 SetLastNtError(Status
);
747 ExFreePool(Buffer
.Pointer
);
753 DPRINT1("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
754 Routine
, Param1
, Param2
);
755 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
759 DPRINT("Leave NtUserCallTwoParam, ret=%i\n",_ret_
);
775 PWINDOW_OBJECT Window
;
776 USER_REFERENCE_ENTRY Ref
;
777 DECLARE_RETURN(BOOLEAN
);
779 DPRINT("Enter NtUserCallHwndLock\n");
780 UserEnterExclusive();
782 if (!(Window
= UserGetWindowObject(hWnd
)))
786 UserRefObjectCo(Window
, &Ref
);
788 /* FIXME: Routine can be 0x53 - 0x5E */
791 case HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS
:
792 co_WinPosArrangeIconicWindows(Window
);
795 case HWNDLOCK_ROUTINE_DRAWMENUBAR
:
798 DPRINT("HWNDLOCK_ROUTINE_DRAWMENUBAR\n");
800 if (!((Window
->Style
& (WS_CHILD
| WS_POPUP
)) != WS_CHILD
))
803 if(!(Menu
= UserGetMenuObject((HMENU
) Window
->IDMenu
)))
806 Menu
->MenuInfo
.WndOwner
= hWnd
;
807 Menu
->MenuInfo
.Height
= 0;
809 co_WinPosSetWindowPos(Window
, 0, 0, 0, 0, 0, SWP_NOSIZE
| SWP_NOMOVE
|
810 SWP_NOACTIVATE
| SWP_NOZORDER
| SWP_FRAMECHANGED
);
816 case HWNDLOCK_ROUTINE_REDRAWFRAME
:
820 case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOW
:
821 Ret
= co_IntSetForegroundWindow(Window
);
824 case HWNDLOCK_ROUTINE_UPDATEWINDOW
:
829 UserDerefObjectCo(Window
);
834 DPRINT("Leave NtUserCallHwndLock, ret=%i\n",_ret_
);
850 case HWNDOPT_ROUTINE_SETPROGMANWINDOW
:
853 * Nothing too hard...validate the hWnd and save it in the Desktop Info
855 DPRINT1("HWNDOPT_ROUTINE_SETPROGMANWINDOW UNIMPLEMENTED\n");
858 case HWNDOPT_ROUTINE_SETTASKMANWINDOW
:
861 * Nothing too hard...validate the hWnd and save it in the Desktop Info
863 DPRINT1("HWNDOPT_ROUTINE_SETTASKMANWINDOW UNIMPLEMENTED\n");
874 NtUserGetThreadState(
877 DECLARE_RETURN(DWORD
);
879 DPRINT("Enter NtUserGetThreadState\n");
885 RETURN( (DWORD
)IntGetThreadFocusWindow());
890 DPRINT("Leave NtUserGetThreadState, ret=%i\n",_ret_
);
896 IntGetFontMetricSetting(LPWSTR lpValueName
, PLOGFONTW font
)
898 RTL_QUERY_REGISTRY_TABLE QueryTable
[2];
900 /* Firefox 1.0.7 depends on the lfHeight value being negative */
901 static LOGFONTW DefaultFont
= {
902 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
903 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
904 L
"Bitstream Vera Sans"
907 RtlZeroMemory(&QueryTable
, sizeof(QueryTable
));
909 QueryTable
[0].Name
= lpValueName
;
910 QueryTable
[0].Flags
= RTL_QUERY_REGISTRY_DIRECT
| RTL_QUERY_REGISTRY_REQUIRED
;
911 QueryTable
[0].EntryContext
= font
;
913 Status
= RtlQueryRegistryValues(
915 L
"Control Panel\\Desktop\\WindowMetrics",
920 if (!NT_SUCCESS(Status
))
922 RtlCopyMemory(font
, &DefaultFont
, sizeof(LOGFONTW
));
927 IntSystemParametersInfo(
933 PWINSTATION_OBJECT WinStaObject
;
936 static BOOL bInitialized
= FALSE
;
937 static LOGFONTW IconFont
;
938 static NONCLIENTMETRICSW pMetrics
;
939 static BOOL GradientCaptions
= TRUE
;
940 static UINT FocusBorderHeight
= 1;
941 static UINT FocusBorderWidth
= 1;
945 RtlZeroMemory(&IconFont
, sizeof(LOGFONTW
));
946 RtlZeroMemory(&pMetrics
, sizeof(NONCLIENTMETRICSW
));
948 IntGetFontMetricSetting(L
"CaptionFont", &pMetrics
.lfCaptionFont
);
949 IntGetFontMetricSetting(L
"SmCaptionFont", &pMetrics
.lfSmCaptionFont
);
950 IntGetFontMetricSetting(L
"MenuFont", &pMetrics
.lfMenuFont
);
951 IntGetFontMetricSetting(L
"StatusFont", &pMetrics
.lfStatusFont
);
952 IntGetFontMetricSetting(L
"MessageFont", &pMetrics
.lfMessageFont
);
953 IntGetFontMetricSetting(L
"IconFont", &IconFont
);
955 pMetrics
.iBorderWidth
= 1;
956 pMetrics
.iScrollWidth
= UserGetSystemMetrics(SM_CXVSCROLL
);
957 pMetrics
.iScrollHeight
= UserGetSystemMetrics(SM_CYHSCROLL
);
958 pMetrics
.iCaptionWidth
= UserGetSystemMetrics(SM_CXSIZE
);
959 pMetrics
.iCaptionHeight
= UserGetSystemMetrics(SM_CYSIZE
);
960 pMetrics
.iSmCaptionWidth
= UserGetSystemMetrics(SM_CXSMSIZE
);
961 pMetrics
.iSmCaptionHeight
= UserGetSystemMetrics(SM_CYSMSIZE
);
962 pMetrics
.iMenuWidth
= UserGetSystemMetrics(SM_CXMENUSIZE
);
963 pMetrics
.iMenuHeight
= UserGetSystemMetrics(SM_CYMENUSIZE
);
964 pMetrics
.cbSize
= sizeof(NONCLIENTMETRICSW
);
971 case SPI_SETDOUBLECLKWIDTH
:
972 case SPI_SETDOUBLECLKHEIGHT
:
973 case SPI_SETDOUBLECLICKTIME
:
974 case SPI_SETDESKWALLPAPER
:
975 case SPI_GETDESKWALLPAPER
:
977 PSYSTEM_CURSORINFO CurInfo
;
979 Status
= IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation
,
983 if(!NT_SUCCESS(Status
))
985 SetLastNtError(Status
);
991 case SPI_SETDOUBLECLKWIDTH
:
992 CurInfo
= IntGetSysCursorInfo(WinStaObject
);
993 /* FIXME limit the maximum value? */
994 CurInfo
->DblClickWidth
= uiParam
;
996 case SPI_SETDOUBLECLKHEIGHT
:
997 CurInfo
= IntGetSysCursorInfo(WinStaObject
);
998 /* FIXME limit the maximum value? */
999 CurInfo
->DblClickHeight
= uiParam
;
1001 case SPI_SETDOUBLECLICKTIME
:
1002 CurInfo
= IntGetSysCursorInfo(WinStaObject
);
1003 /* FIXME limit the maximum time to 1000 ms? */
1004 CurInfo
->DblClickSpeed
= uiParam
;
1006 case SPI_SETDESKWALLPAPER
:
1008 /* This function expects different parameters than the user mode version!
1010 We let the user mode code load the bitmap, it passed the handle to
1011 the bitmap. We'll change it's ownership to system and replace it with
1012 the current wallpaper bitmap */
1013 HBITMAP hOldBitmap
, hNewBitmap
;
1015 UNICODE_STRING Key
= RTL_CONSTANT_STRING(L
"Control Panel\\Desktop");
1016 UNICODE_STRING Tile
= RTL_CONSTANT_STRING(L
"TileWallpaper");
1017 UNICODE_STRING Style
= RTL_CONSTANT_STRING(L
"WallpaperStyle");
1018 UNICODE_STRING KeyPath
;
1019 OBJECT_ATTRIBUTES KeyAttributes
;
1020 OBJECT_ATTRIBUTES ObjectAttributes
;
1022 HANDLE CurrentUserKey
= NULL
;
1023 HANDLE KeyHandle
= NULL
;
1024 PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo
;
1026 ULONG ResLength
= 0;
1030 hNewBitmap
= *(HBITMAP
*)pvParam
;
1031 if(hNewBitmap
!= NULL
)
1034 /* try to get the size of the wallpaper */
1035 if(!(bmp
= BITMAPOBJ_LockBitmap(hNewBitmap
)))
1037 ObDereferenceObject(WinStaObject
);
1040 WinStaObject
->cxWallpaper
= bmp
->SurfObj
.sizlBitmap
.cx
;
1041 WinStaObject
->cyWallpaper
= bmp
->SurfObj
.sizlBitmap
.cy
;
1043 BITMAPOBJ_UnlockBitmap(bmp
);
1045 /* change the bitmap's ownership */
1046 GDIOBJ_SetOwnership(hNewBitmap
, NULL
);
1048 hOldBitmap
= (HBITMAP
)InterlockedExchange((LONG
*)&WinStaObject
->hbmWallpaper
, (LONG
)hNewBitmap
);
1049 if(hOldBitmap
!= NULL
)
1051 /* delete the old wallpaper */
1052 NtGdiDeleteObject(hOldBitmap
);
1057 /*default value is center */
1058 WinStaObject
->WallpaperMode
= wmCenter
;
1062 /* Get a handle to the current users settings */
1063 RtlFormatCurrentUserKeyPath(&KeyPath
);
1064 InitializeObjectAttributes(&ObjectAttributes
,&KeyPath
,OBJ_CASE_INSENSITIVE
,NULL
,NULL
);
1065 ZwOpenKey(&CurrentUserKey
, KEY_READ
, &ObjectAttributes
);
1066 RtlFreeUnicodeString(&KeyPath
);
1068 /* open up the settings to read the values */
1069 InitializeObjectAttributes(&KeyAttributes
, &Key
, OBJ_CASE_INSENSITIVE
,
1070 CurrentUserKey
, NULL
);
1071 ZwOpenKey(&KeyHandle
, KEY_READ
, &KeyAttributes
);
1072 ZwClose(CurrentUserKey
);
1074 /* read the tile value in the registry */
1075 Status
= ZwQueryValueKey(KeyHandle
, &Tile
, KeyValuePartialInformation
,
1078 /* fall back to .DEFAULT if we didnt find values */
1079 if(Status
== STATUS_INVALID_HANDLE
)
1081 RtlInitUnicodeString (&KeyPath
,L
"\\Registry\\User\\.Default\\Control Panel\\Desktop");
1082 InitializeObjectAttributes(&KeyAttributes
, &KeyPath
, OBJ_CASE_INSENSITIVE
,
1084 ZwOpenKey(&KeyHandle
, KEY_READ
, &KeyAttributes
);
1085 ZwQueryValueKey(KeyHandle
, &Tile
, KeyValuePartialInformation
,
1089 ResLength
+= sizeof(KEY_VALUE_PARTIAL_INFORMATION
);
1090 KeyValuePartialInfo
= ExAllocatePoolWithTag(PagedPool
, ResLength
, TAG_STRING
);
1093 if(!KeyValuePartialInfo
)
1099 Status
= ZwQueryValueKey(KeyHandle
, &Tile
, KeyValuePartialInformation
,
1100 (PVOID
)KeyValuePartialInfo
, Length
, &ResLength
);
1101 if(!NT_SUCCESS(Status
) || (KeyValuePartialInfo
->Type
!= REG_SZ
))
1104 ExFreePool(KeyValuePartialInfo
);
1108 Tile
.Length
= KeyValuePartialInfo
->DataLength
;
1109 Tile
.MaximumLength
= KeyValuePartialInfo
->DataLength
;
1110 Tile
.Buffer
= (PWSTR
)KeyValuePartialInfo
->Data
;
1112 Status
= RtlUnicodeStringToInteger(&Tile
, 0, &TileNum
);
1113 if(!NT_SUCCESS(Status
))
1117 ExFreePool(KeyValuePartialInfo
);
1119 /* start over again and look for the style*/
1121 Status
= ZwQueryValueKey(KeyHandle
, &Style
, KeyValuePartialInformation
,
1124 ResLength
+= sizeof(KEY_VALUE_PARTIAL_INFORMATION
);
1125 KeyValuePartialInfo
= ExAllocatePoolWithTag(PagedPool
, ResLength
, TAG_STRING
);
1128 if(!KeyValuePartialInfo
)
1134 Status
= ZwQueryValueKey(KeyHandle
, &Style
, KeyValuePartialInformation
,
1135 (PVOID
)KeyValuePartialInfo
, Length
, &ResLength
);
1136 if(!NT_SUCCESS(Status
) || (KeyValuePartialInfo
->Type
!= REG_SZ
))
1139 ExFreePool(KeyValuePartialInfo
);
1143 Style
.Length
= KeyValuePartialInfo
->DataLength
;
1144 Style
.MaximumLength
= KeyValuePartialInfo
->DataLength
;
1145 Style
.Buffer
= (PWSTR
)KeyValuePartialInfo
->Data
;
1147 Status
= RtlUnicodeStringToInteger(&Style
, 0, &StyleNum
);
1148 if(!NT_SUCCESS(Status
))
1152 ExFreePool(KeyValuePartialInfo
);
1154 /* Check the values we found in the registry */
1155 if(TileNum
&& !StyleNum
)
1157 WinStaObject
->WallpaperMode
= wmTile
;
1159 else if(!TileNum
&& StyleNum
== 2)
1161 WinStaObject
->WallpaperMode
= wmStretch
;
1167 case SPI_GETDESKWALLPAPER
:
1168 /* This function expects different parameters than the user mode version!
1170 We basically return the current wallpaper handle - if any. The user
1171 mode version should load the string from the registry and return it
1172 without calling this function */
1174 *(HBITMAP
*)pvParam
= (HBITMAP
)WinStaObject
->hbmWallpaper
;
1178 /* FIXME save the value to the registry */
1180 ObDereferenceObject(WinStaObject
);
1183 case SPI_SETWORKAREA
:
1186 PDESKTOP_OBJECT Desktop
= PsGetWin32Thread()->Desktop
;
1190 /* FIXME - Set last error */
1195 rc
= (RECT
*)pvParam
;
1196 Desktop
->WorkArea
= *rc
;
1200 case SPI_GETWORKAREA
:
1202 PDESKTOP_OBJECT Desktop
= PsGetWin32Thread()->Desktop
;
1206 /* FIXME - Set last error */
1211 IntGetDesktopWorkArea(Desktop
, (PRECT
)pvParam
);
1215 case SPI_SETGRADIENTCAPTIONS
:
1217 GradientCaptions
= (pvParam
!= NULL
);
1218 /* FIXME - should be checked if the color depth is higher than 8bpp? */
1221 case SPI_GETGRADIENTCAPTIONS
:
1224 BOOL Ret
= GradientCaptions
;
1226 hDC
= IntGetScreenDC();
1229 Ret
= (NtGdiGetDeviceCaps(hDC
, BITSPIXEL
) > 8) && Ret
;
1232 *((PBOOL
)pvParam
) = Ret
;
1237 case SPI_SETFONTSMOOTHING
:
1239 IntEnableFontRendering(uiParam
!= 0);
1242 case SPI_GETFONTSMOOTHING
:
1245 *((BOOL
*)pvParam
) = IntIsFontRenderingEnabled();
1248 case SPI_GETICONTITLELOGFONT
:
1251 *((LOGFONTW
*)pvParam
) = IconFont
;
1254 case SPI_GETNONCLIENTMETRICS
:
1257 *((NONCLIENTMETRICSW
*)pvParam
) = pMetrics
;
1260 case SPI_GETFOCUSBORDERHEIGHT
:
1263 *((UINT
*)pvParam
) = FocusBorderHeight
;
1266 case SPI_GETFOCUSBORDERWIDTH
:
1269 *((UINT
*)pvParam
) = FocusBorderWidth
;
1272 case SPI_SETFOCUSBORDERHEIGHT
:
1274 FocusBorderHeight
= (UINT
)pvParam
;
1277 case SPI_SETFOCUSBORDERWIDTH
:
1279 FocusBorderWidth
= (UINT
)pvParam
;
1285 DPRINT1("SystemParametersInfo: Unsupported Action 0x%x (uiParam: 0x%x, pvParam: 0x%x, fWinIni: 0x%x)\n",
1286 uiAction
, uiParam
, pvParam
, fWinIni
);
1297 UserSystemParametersInfo(
1307 case SPI_SETDOUBLECLKWIDTH
:
1308 case SPI_SETDOUBLECLKHEIGHT
:
1309 case SPI_SETDOUBLECLICKTIME
:
1310 case SPI_SETGRADIENTCAPTIONS
:
1311 case SPI_SETFONTSMOOTHING
:
1312 case SPI_SETFOCUSBORDERHEIGHT
:
1313 case SPI_SETFOCUSBORDERWIDTH
:
1315 return (DWORD
)IntSystemParametersInfo(uiAction
, uiParam
, pvParam
, fWinIni
);
1317 case SPI_SETWORKAREA
:
1320 Status
= MmCopyFromCaller(&rc
, (PRECT
)pvParam
, sizeof(RECT
));
1321 if(!NT_SUCCESS(Status
))
1323 SetLastNtError(Status
);
1326 return( (DWORD
)IntSystemParametersInfo(uiAction
, uiParam
, &rc
, fWinIni
));
1328 case SPI_GETWORKAREA
:
1332 if(!IntSystemParametersInfo(uiAction
, uiParam
, &rc
, fWinIni
))
1337 Status
= MmCopyToCaller((PRECT
)pvParam
, &rc
, sizeof(RECT
));
1338 if(!NT_SUCCESS(Status
))
1340 SetLastNtError(Status
);
1345 case SPI_GETFONTSMOOTHING
:
1346 case SPI_GETGRADIENTCAPTIONS
:
1347 case SPI_GETFOCUSBORDERHEIGHT
:
1348 case SPI_GETFOCUSBORDERWIDTH
:
1352 if(!IntSystemParametersInfo(uiAction
, uiParam
, &Ret
, fWinIni
))
1357 Status
= MmCopyToCaller(pvParam
, &Ret
, sizeof(BOOL
));
1358 if(!NT_SUCCESS(Status
))
1360 SetLastNtError(Status
);
1365 case SPI_SETDESKWALLPAPER
:
1367 /* !!! As opposed to the user mode version this version accepts a handle
1369 HBITMAP hbmWallpaper
;
1371 Status
= MmCopyFromCaller(&hbmWallpaper
, pvParam
, sizeof(HBITMAP
));
1372 if(!NT_SUCCESS(Status
))
1374 SetLastNtError(Status
);
1377 return( IntSystemParametersInfo(SPI_SETDESKWALLPAPER
, 0, &hbmWallpaper
, fWinIni
));
1379 case SPI_GETDESKWALLPAPER
:
1381 /* !!! As opposed to the user mode version this version returns a handle
1383 HBITMAP hbmWallpaper
;
1386 Ret
= IntSystemParametersInfo(SPI_GETDESKWALLPAPER
, 0, &hbmWallpaper
, fWinIni
);
1388 Status
= MmCopyToCaller(pvParam
, &hbmWallpaper
, sizeof(HBITMAP
));
1389 if(!NT_SUCCESS(Status
))
1391 SetLastNtError(Status
);
1396 case SPI_GETICONTITLELOGFONT
:
1400 if(!IntSystemParametersInfo(uiAction
, uiParam
, &IconFont
, fWinIni
))
1405 Status
= MmCopyToCaller(pvParam
, &IconFont
, sizeof(LOGFONTW
));
1406 if(!NT_SUCCESS(Status
))
1408 SetLastNtError(Status
);
1413 case SPI_GETNONCLIENTMETRICS
:
1415 NONCLIENTMETRICSW metrics
;
1417 Status
= MmCopyFromCaller(&metrics
.cbSize
, pvParam
, sizeof(UINT
));
1418 if(!NT_SUCCESS(Status
))
1420 SetLastNtError(Status
);
1423 if(metrics
.cbSize
!= sizeof(NONCLIENTMETRICSW
))
1425 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
1429 if(!IntSystemParametersInfo(uiAction
, uiParam
, &metrics
, fWinIni
))
1434 Status
= MmCopyToCaller(pvParam
, &metrics
.cbSize
, sizeof(NONCLIENTMETRICSW
));
1435 if(!NT_SUCCESS(Status
))
1437 SetLastNtError(Status
);
1454 NtUserSystemParametersInfo(
1460 DECLARE_RETURN(BOOLEAN
);
1462 DPRINT("Enter NtUserSystemParametersInfo\n");
1463 UserEnterExclusive();
1465 RETURN( UserSystemParametersInfo(uiAction
, uiParam
, pvParam
, fWinIni
));
1468 DPRINT("Leave NtUserSystemParametersInfo, ret=%i\n",_ret_
);
1477 NtUserGetDoubleClickTime(VOID
)
1481 PWINSTATION_OBJECT WinStaObject
;
1482 PSYSTEM_CURSORINFO CurInfo
;
1483 DECLARE_RETURN(UINT
);
1485 DPRINT("Enter NtUserGetDoubleClickTime\n");
1488 Status
= IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation
,
1492 if (!NT_SUCCESS(Status
))
1493 RETURN( (DWORD
)FALSE
);
1495 CurInfo
= IntGetSysCursorInfo(WinStaObject
);
1496 Result
= CurInfo
->DblClickSpeed
;
1498 ObDereferenceObject(WinStaObject
);
1502 DPRINT("Leave NtUserGetDoubleClickTime, ret=%i\n",_ret_
);
1509 NtUserGetGUIThreadInfo(
1510 DWORD idThread
, /* if NULL use foreground thread */
1511 LPGUITHREADINFO lpgui
)
1514 PTHRDCARETINFO CaretInfo
;
1515 GUITHREADINFO SafeGui
;
1516 PDESKTOP_OBJECT Desktop
;
1517 PUSER_MESSAGE_QUEUE MsgQueue
;
1518 PETHREAD Thread
= NULL
;
1519 DECLARE_RETURN(BOOLEAN
);
1521 DPRINT("Enter NtUserGetGUIThreadInfo\n");
1524 Status
= MmCopyFromCaller(&SafeGui
, lpgui
, sizeof(DWORD
));
1525 if(!NT_SUCCESS(Status
))
1527 SetLastNtError(Status
);
1531 if(SafeGui
.cbSize
!= sizeof(GUITHREADINFO
))
1533 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
1539 Status
= PsLookupThreadByThreadId((HANDLE
)idThread
, &Thread
);
1540 if(!NT_SUCCESS(Status
))
1542 SetLastWin32Error(ERROR_ACCESS_DENIED
);
1545 Desktop
= ((PW32THREAD
)Thread
->Tcb
.Win32Thread
)->Desktop
;
1549 /* get the foreground thread */
1550 PW32THREAD W32Thread
= (PW32THREAD
)PsGetCurrentThread()->Tcb
.Win32Thread
;
1551 Desktop
= W32Thread
->Desktop
;
1554 MsgQueue
= Desktop
->ActiveMessageQueue
;
1557 Thread
= MsgQueue
->Thread
;
1562 if(!Thread
|| !Desktop
)
1564 if(idThread
&& Thread
)
1565 ObDereferenceObject(Thread
);
1566 SetLastWin32Error(ERROR_ACCESS_DENIED
);
1570 MsgQueue
= (PUSER_MESSAGE_QUEUE
)Desktop
->ActiveMessageQueue
;
1571 CaretInfo
= MsgQueue
->CaretInfo
;
1573 SafeGui
.flags
= (CaretInfo
->Visible
? GUI_CARETBLINKING
: 0);
1574 if(MsgQueue
->MenuOwner
)
1575 SafeGui
.flags
|= GUI_INMENUMODE
| MsgQueue
->MenuState
;
1576 if(MsgQueue
->MoveSize
)
1577 SafeGui
.flags
|= GUI_INMOVESIZE
;
1579 /* FIXME add flag GUI_16BITTASK */
1581 SafeGui
.hwndActive
= MsgQueue
->ActiveWindow
;
1582 SafeGui
.hwndFocus
= MsgQueue
->FocusWindow
;
1583 SafeGui
.hwndCapture
= MsgQueue
->CaptureWindow
;
1584 SafeGui
.hwndMenuOwner
= MsgQueue
->MenuOwner
;
1585 SafeGui
.hwndMoveSize
= MsgQueue
->MoveSize
;
1586 SafeGui
.hwndCaret
= CaretInfo
->hWnd
;
1588 SafeGui
.rcCaret
.left
= CaretInfo
->Pos
.x
;
1589 SafeGui
.rcCaret
.top
= CaretInfo
->Pos
.y
;
1590 SafeGui
.rcCaret
.right
= SafeGui
.rcCaret
.left
+ CaretInfo
->Size
.cx
;
1591 SafeGui
.rcCaret
.bottom
= SafeGui
.rcCaret
.top
+ CaretInfo
->Size
.cy
;
1594 ObDereferenceObject(Thread
);
1596 Status
= MmCopyToCaller(lpgui
, &SafeGui
, sizeof(GUITHREADINFO
));
1597 if(!NT_SUCCESS(Status
))
1599 SetLastNtError(Status
);
1606 DPRINT("Leave NtUserGetGUIThreadInfo, ret=%i\n",_ret_
);
1614 NtUserGetGuiResources(
1619 PW32PROCESS W32Process
;
1622 DECLARE_RETURN(DWORD
);
1624 DPRINT("Enter NtUserGetGuiResources\n");
1627 Status
= ObReferenceObjectByHandle(hProcess
,
1628 PROCESS_QUERY_INFORMATION
,
1630 ExGetPreviousMode(),
1634 if(!NT_SUCCESS(Status
))
1636 SetLastNtError(Status
);
1640 W32Process
= (PW32PROCESS
)Process
->Win32Process
;
1643 ObDereferenceObject(Process
);
1644 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
1652 Ret
= (DWORD
)W32Process
->GDIObjects
;
1655 case GR_USEROBJECTS
:
1657 Ret
= (DWORD
)W32Process
->UserObjects
;
1662 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
1667 ObDereferenceObject(Process
);
1672 DPRINT("Leave NtUserGetGuiResources, ret=%i\n",_ret_
);
1678 IntSafeCopyUnicodeString(PUNICODE_STRING Dest
,
1679 PUNICODE_STRING Source
)
1684 Status
= MmCopyFromCaller(Dest
, Source
, sizeof(UNICODE_STRING
));
1685 if(!NT_SUCCESS(Status
))
1690 if(Dest
->Length
> 0x4000)
1692 return STATUS_UNSUCCESSFUL
;
1696 Dest
->Buffer
= NULL
;
1698 if(Dest
->Length
> 0 && Src
)
1700 Dest
->MaximumLength
= Dest
->Length
;
1701 Dest
->Buffer
= ExAllocatePoolWithTag(PagedPool
, Dest
->MaximumLength
, TAG_STRING
);
1704 return STATUS_NO_MEMORY
;
1707 Status
= MmCopyFromCaller(Dest
->Buffer
, Src
, Dest
->Length
);
1708 if(!NT_SUCCESS(Status
))
1710 ExFreePool(Dest
->Buffer
);
1711 Dest
->Buffer
= NULL
;
1716 return STATUS_SUCCESS
;
1719 /* string is empty */
1720 return STATUS_SUCCESS
;
1724 IntSafeCopyUnicodeStringTerminateNULL(PUNICODE_STRING Dest
,
1725 PUNICODE_STRING Source
)
1730 Status
= MmCopyFromCaller(Dest
, Source
, sizeof(UNICODE_STRING
));
1731 if(!NT_SUCCESS(Status
))
1736 if(Dest
->Length
> 0x4000)
1738 return STATUS_UNSUCCESSFUL
;
1742 Dest
->Buffer
= NULL
;
1744 if(Dest
->Length
> 0 && Src
)
1746 Dest
->MaximumLength
= Dest
->Length
+ sizeof(WCHAR
);
1747 Dest
->Buffer
= ExAllocatePoolWithTag(PagedPool
, Dest
->MaximumLength
, TAG_STRING
);
1750 return STATUS_NO_MEMORY
;
1753 Status
= MmCopyFromCaller(Dest
->Buffer
, Src
, Dest
->Length
);
1754 if(!NT_SUCCESS(Status
))
1756 ExFreePool(Dest
->Buffer
);
1757 Dest
->Buffer
= NULL
;
1761 /* make sure the string is null-terminated */
1762 Src
= (PWSTR
)((PBYTE
)Dest
->Buffer
+ Dest
->Length
);
1765 return STATUS_SUCCESS
;
1768 /* string is empty */
1769 return STATUS_SUCCESS
;
1773 IntUnicodeStringToNULLTerminated(PWSTR
*Dest
, PUNICODE_STRING Src
)
1775 if (Src
->Length
+ sizeof(WCHAR
) <= Src
->MaximumLength
1776 && L
'\0' == Src
->Buffer
[Src
->Length
/ sizeof(WCHAR
)])
1778 /* The unicode_string is already nul terminated. Just reuse it. */
1779 *Dest
= Src
->Buffer
;
1780 return STATUS_SUCCESS
;
1783 *Dest
= ExAllocatePoolWithTag(PagedPool
, Src
->Length
+ sizeof(WCHAR
), TAG_STRING
);
1786 return STATUS_NO_MEMORY
;
1788 RtlCopyMemory(*Dest
, Src
->Buffer
, Src
->Length
);
1789 (*Dest
)[Src
->Length
/ 2] = L
'\0';
1791 return STATUS_SUCCESS
;
1795 IntFreeNULLTerminatedFromUnicodeString(PWSTR NullTerminated
, PUNICODE_STRING UnicodeString
)
1797 if (NullTerminated
!= UnicodeString
->Buffer
)
1799 ExFreePool(NullTerminated
);
1804 NtUserUpdatePerUserSystemParameters(
1809 DECLARE_RETURN(BOOLEAN
);
1811 DPRINT("Enter NtUserUpdatePerUserSystemParameters\n");
1812 UserEnterExclusive();
1814 Result
&= IntDesktopUpdatePerUserSettings(bEnable
);
1818 DPRINT("Leave NtUserUpdatePerUserSystemParameters, ret=%i\n",_ret_
);