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
);
181 DPRINT("Enter NtUserCallOneParam\n");
184 if (Routine
== ONEPARAM_ROUTINE_SHOWCURSOR
)
186 PWINSTATION_OBJECT WinSta
= PsGetWin32Thread()->Desktop
->WindowStation
;
187 PSYSTEM_CURSORINFO CurInfo
;
192 BITMAPOBJ
*BitmapObj
;
197 if(!(Screen
= IntGetScreenDC()))
199 return showpointer
; /* No mouse */
202 dc
= DC_LockDc(Screen
);
206 return showpointer
; /* No mouse */
209 dcbmp
= dc
->w
.hBitmap
;
212 BitmapObj
= BITMAPOBJ_LockBitmap(dcbmp
);
215 BITMAPOBJ_UnlockBitmap(BitmapObj
);
216 return showpointer
; /* No Mouse */
219 SurfObj
= &BitmapObj
->SurfObj
;
222 BITMAPOBJ_UnlockBitmap(BitmapObj
);
223 return showpointer
; /* No mouse */
226 ppdev
= GDIDEV(SurfObj
);
230 BITMAPOBJ_UnlockBitmap(BitmapObj
);
231 return showpointer
; /* No mouse */
234 pgp
= &ppdev
->Pointer
;
236 CurInfo
= IntGetSysCursorInfo(WinSta
);
241 showpointer
= pgp
->ShowPointer
;
243 if (showpointer
>= 0)
245 //ppdev->SafetyRemoveCount = 1;
246 //ppdev->SafetyRemoveLevel = 1;
247 EngMovePointer(SurfObj
,-1,-1,NULL
);
248 CurInfo
->ShowingCursor
= 0;
255 showpointer
= pgp
->ShowPointer
;
260 //ppdev->SafetyRemoveCount = 0;
261 //ppdev->SafetyRemoveLevel = 0;
262 EngMovePointer(SurfObj
,-1,-1,NULL
);
263 CurInfo
->ShowingCursor
= CURSOR_SHOWING
;
267 BITMAPOBJ_UnlockBitmap(BitmapObj
);
272 UserEnterExclusive();
276 case ONEPARAM_ROUTINE_GETMENU
:
278 PWINDOW_OBJECT Window
;
281 if(!(Window
= UserGetWindowObject((HWND
)Param
)))
286 Result
= (DWORD
)Window
->IDMenu
;
291 case ONEPARAM_ROUTINE_ISWINDOWUNICODE
:
293 PWINDOW_OBJECT Window
;
296 Window
= UserGetWindowObject((HWND
)Param
);
301 Result
= Window
->Unicode
;
305 case ONEPARAM_ROUTINE_WINDOWFROMDC
:
306 RETURN( (DWORD
)IntWindowFromDC((HDC
)Param
));
308 case ONEPARAM_ROUTINE_GETWNDCONTEXTHLPID
:
310 PWINDOW_OBJECT Window
;
313 Window
= UserGetWindowObject((HWND
)Param
);
319 Result
= Window
->ContextHelpId
;
324 case ONEPARAM_ROUTINE_SWAPMOUSEBUTTON
:
326 PWINSTATION_OBJECT WinSta
;
330 Status
= IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation
,
334 if (!NT_SUCCESS(Status
))
335 RETURN( (DWORD
)FALSE
);
338 Result = (DWORD)IntSwapMouseButton(WinStaObject, (BOOL)Param); */
341 ObDereferenceObject(WinSta
);
345 case ONEPARAM_ROUTINE_SWITCHCARETSHOWING
:
346 RETURN( (DWORD
)IntSwitchCaretShowing((PVOID
)Param
));
348 case ONEPARAM_ROUTINE_SETCARETBLINKTIME
:
349 RETURN( (DWORD
)IntSetCaretBlinkTime((UINT
)Param
));
351 case ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS
:
352 RETURN( (DWORD
)IntEnumClipboardFormats((UINT
)Param
));
354 case ONEPARAM_ROUTINE_GETWINDOWINSTANCE
:
356 PWINDOW_OBJECT Window
;
359 if(!(Window
= UserGetWindowObject((HWND
)Param
)))
364 Result
= (DWORD
)Window
->Instance
;
368 case ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO
:
369 RETURN( (DWORD
)MsqSetMessageExtraInfo((LPARAM
)Param
));
371 case ONEPARAM_ROUTINE_GETCURSORPOSITION
:
373 PWINSTATION_OBJECT WinSta
;
378 RETURN( (DWORD
)FALSE
);
379 Status
= IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation
,
383 if (!NT_SUCCESS(Status
))
384 RETURN( (DWORD
)FALSE
);
386 /* FIXME - check if process has WINSTA_READATTRIBUTES */
387 IntGetCursorLocation(WinSta
, &Pos
);
389 Status
= MmCopyToCaller((PPOINT
)Param
, &Pos
, sizeof(POINT
));
390 if(!NT_SUCCESS(Status
))
392 ObDereferenceObject(WinSta
);
393 SetLastNtError(Status
);
397 ObDereferenceObject(WinSta
);
399 RETURN( (DWORD
)TRUE
);
402 case ONEPARAM_ROUTINE_ISWINDOWINDESTROY
:
404 PWINDOW_OBJECT Window
;
407 if(!(Window
= UserGetWindowObject((HWND
)Param
)))
412 Result
= (DWORD
)IntIsWindowInDestroy(Window
);
417 case ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING
:
420 PW32PROCESS Process
= PsGetWin32Process();
424 Enable
= (BOOL
)(Param
!= 0);
428 Process
->Flags
&= ~W32PF_NOWINDOWGHOSTING
;
432 Process
->Flags
|= W32PF_NOWINDOWGHOSTING
;
441 case ONEPARAM_ROUTINE_MSQSETWAKEMASK
:
442 RETURN( (DWORD
)IntMsqSetWakeMask(Param
));
444 case ONEPARAM_ROUTINE_GETKEYBOARDTYPE
:
445 RETURN( UserGetKeyboardType(Param
));
447 case ONEPARAM_ROUTINE_GETKEYBOARDLAYOUT
:
448 RETURN( (DWORD
)UserGetKeyboardLayout(Param
));
450 DPRINT1("Calling invalid routine number 0x%x in NtUserCallOneParam(), Param=0x%x\n",
452 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
456 DPRINT("Leave NtUserCallOneParam, ret=%i\n",_ret_
);
473 PWINDOW_OBJECT Window
;
474 DECLARE_RETURN(DWORD
);
476 DPRINT("Enter NtUserCallTwoParam\n");
477 UserEnterExclusive();
481 case TWOPARAM_ROUTINE_SETDCPENCOLOR
:
483 RETURN( (DWORD
)IntSetDCColor((HDC
)Param1
, OBJ_PEN
, (COLORREF
)Param2
));
485 case TWOPARAM_ROUTINE_SETDCBRUSHCOLOR
:
487 RETURN( (DWORD
)IntSetDCColor((HDC
)Param1
, OBJ_BRUSH
, (COLORREF
)Param2
));
489 case TWOPARAM_ROUTINE_GETDCCOLOR
:
491 RETURN( (DWORD
)IntGetDCColor((HDC
)Param1
, (ULONG
)Param2
));
493 case TWOPARAM_ROUTINE_GETWINDOWRGNBOX
:
497 PWINDOW_OBJECT Window
= UserGetWindowObject((HWND
)Param1
);
498 if (!Window
) RETURN(ERROR
);
500 Ret
= (DWORD
)IntGetWindowRgnBox(Window
, &rcRect
);
501 Status
= MmCopyToCaller((PVOID
)Param2
, &rcRect
, sizeof(RECT
));
502 if(!NT_SUCCESS(Status
))
504 SetLastNtError(Status
);
509 case TWOPARAM_ROUTINE_GETWINDOWRGN
:
511 PWINDOW_OBJECT Window
= UserGetWindowObject((HWND
)Param1
);
512 if (!Window
) RETURN(ERROR
);
514 RETURN( (DWORD
)IntGetWindowRgn(Window
, (HRGN
)Param2
));
516 case TWOPARAM_ROUTINE_SETMENUBARHEIGHT
:
519 PMENU_OBJECT MenuObject
= IntGetMenuObject((HMENU
)Param1
);
525 Ret
= (MenuObject
->MenuInfo
.Height
== (int)Param2
);
526 MenuObject
->MenuInfo
.Height
= (int)Param2
;
529 Ret
= (DWORD
)MenuObject
->MenuInfo
.Height
;
530 IntReleaseMenuObject(MenuObject
);
533 case TWOPARAM_ROUTINE_SETMENUITEMRECT
:
536 SETMENUITEMRECT smir
;
537 PMENU_OBJECT MenuObject
= IntGetMenuObject((HMENU
)Param1
);
541 if(!NT_SUCCESS(MmCopyFromCaller(&smir
, (PVOID
)Param2
, sizeof(SETMENUITEMRECT
))))
543 IntReleaseMenuObject(MenuObject
);
547 Ret
= IntSetMenuItemRect(MenuObject
, smir
.uItem
, smir
.fByPosition
, &smir
.rcRect
);
549 IntReleaseMenuObject(MenuObject
);
553 case TWOPARAM_ROUTINE_SETGUITHRDHANDLE
:
555 PUSER_MESSAGE_QUEUE MsgQueue
= ((PW32THREAD
)PsGetCurrentThread()->Tcb
.Win32Thread
)->MessageQueue
;
558 RETURN( (DWORD
)MsqSetStateWindow(MsgQueue
, (ULONG
)Param1
, (HWND
)Param2
));
561 case TWOPARAM_ROUTINE_ENABLEWINDOW
:
565 case TWOPARAM_ROUTINE_UNKNOWN
:
569 case TWOPARAM_ROUTINE_SHOWOWNEDPOPUPS
:
571 PWINDOW_OBJECT Window
= UserGetWindowObject((HWND
)Param1
);
572 if (!Window
) RETURN(0);
574 RETURN( (DWORD
)IntShowOwnedPopups(Window
, (BOOL
) Param2
));
577 case TWOPARAM_ROUTINE_ROS_SHOWWINDOW
:
579 #define WIN_NEEDS_SHOW_OWNEDPOPUP (0x00000040)
580 PWINDOW_OBJECT Window
;
581 DPRINT1("ROS_SHOWWINDOW\n");
583 if (!(Window
= UserGetWindowObject((HWND
)Param1
)))
590 if (!(Window
->Flags
& WIN_NEEDS_SHOW_OWNEDPOPUP
))
594 Window
->Flags
&= ~WIN_NEEDS_SHOW_OWNEDPOPUP
;
597 Window
->Flags
|= WIN_NEEDS_SHOW_OWNEDPOPUP
;
599 DPRINT1("ROS_SHOWWINDOW ---> 0x%x\n",Window
->Flags
);
602 case TWOPARAM_ROUTINE_SWITCHTOTHISWINDOW
:
606 case TWOPARAM_ROUTINE_SETWNDCONTEXTHLPID
:
608 if(!(Window
= UserGetWindowObject((HWND
)Param1
)))
610 RETURN( (DWORD
)FALSE
);
613 Window
->ContextHelpId
= Param2
;
615 RETURN( (DWORD
)TRUE
);
617 case TWOPARAM_ROUTINE_SETCARETPOS
:
618 RETURN( (DWORD
)co_IntSetCaretPos((int)Param1
, (int)Param2
));
620 case TWOPARAM_ROUTINE_GETWINDOWINFO
:
625 if(!(Window
= UserGetWindowObject((HWND
)Param1
)))
632 * According to WINE, Windows' doesn't check the cbSize field
635 Status
= MmCopyFromCaller(&wi
.cbSize
, (PVOID
)Param2
, sizeof(wi
.cbSize
));
636 if(!NT_SUCCESS(Status
))
638 SetLastNtError(Status
);
642 if(wi
.cbSize
!= sizeof(WINDOWINFO
))
644 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
649 if((Ret
= (DWORD
)IntGetWindowInfo(Window
, &wi
)))
651 Status
= MmCopyToCaller((PVOID
)Param2
, &wi
, sizeof(WINDOWINFO
));
652 if(!NT_SUCCESS(Status
))
654 SetLastNtError(Status
);
662 case TWOPARAM_ROUTINE_REGISTERLOGONPROC
:
663 RETURN( (DWORD
)co_IntRegisterLogonProcess((HANDLE
)Param1
, (BOOL
)Param2
));
665 case TWOPARAM_ROUTINE_SETSYSCOLORS
:
676 /* FIXME - we should make use of SEH here... */
678 Status
= MmCopyFromCaller(&ChangeSysColors
, (PVOID
)Param1
, sizeof(ChangeSysColors
));
679 if(!NT_SUCCESS(Status
))
681 SetLastNtError(Status
);
685 Buffer
= ExAllocatePool(PagedPool
, (Param2
* sizeof(INT
)) + (Param2
* sizeof(COLORREF
)));
688 INT
*Elements
= (INT
*)Buffer
;
689 COLORREF
*Colors
= (COLORREF
*)Buffer
+ Param2
;
691 Status
= MmCopyFromCaller(Elements
, ChangeSysColors
.Elements
, Param2
* sizeof(INT
));
692 if(NT_SUCCESS(Status
))
694 Status
= MmCopyFromCaller(Colors
, ChangeSysColors
.Colors
, Param2
* sizeof(COLORREF
));
695 if(NT_SUCCESS(Status
))
697 Ret
= (DWORD
)IntSetSysColors((UINT
)Param2
, Elements
, Colors
);
700 SetLastNtError(Status
);
703 SetLastNtError(Status
);
712 case TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES
:
713 case TWOPARAM_ROUTINE_GETSYSCOLORPENS
:
714 case TWOPARAM_ROUTINE_GETSYSCOLORS
:
725 /* FIXME - we should make use of SEH here... */
727 Buffer
.Pointer
= ExAllocatePool(PagedPool
, Param2
* sizeof(HANDLE
));
728 if(Buffer
.Pointer
!= NULL
)
732 case TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES
:
733 Ret
= (DWORD
)IntGetSysColorBrushes(Buffer
.Brushes
, (UINT
)Param2
);
735 case TWOPARAM_ROUTINE_GETSYSCOLORPENS
:
736 Ret
= (DWORD
)IntGetSysColorPens(Buffer
.Pens
, (UINT
)Param2
);
738 case TWOPARAM_ROUTINE_GETSYSCOLORS
:
739 Ret
= (DWORD
)IntGetSysColors(Buffer
.Colors
, (UINT
)Param2
);
748 Status
= MmCopyToCaller((PVOID
)Param1
, Buffer
.Pointer
, Param2
* sizeof(HANDLE
));
749 if(!NT_SUCCESS(Status
))
751 SetLastNtError(Status
);
756 ExFreePool(Buffer
.Pointer
);
762 DPRINT1("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
763 Routine
, Param1
, Param2
);
764 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
768 DPRINT("Leave NtUserCallTwoParam, ret=%i\n",_ret_
);
784 PWINDOW_OBJECT Window
;
785 USER_REFERENCE_ENTRY Ref
;
786 DECLARE_RETURN(BOOLEAN
);
788 DPRINT("Enter NtUserCallHwndLock\n");
789 UserEnterExclusive();
791 if (!(Window
= UserGetWindowObject(hWnd
)))
795 UserRefObjectCo(Window
, &Ref
);
797 /* FIXME: Routine can be 0x53 - 0x5E */
800 case HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS
:
801 co_WinPosArrangeIconicWindows(Window
);
804 case HWNDLOCK_ROUTINE_DRAWMENUBAR
:
807 DPRINT("HWNDLOCK_ROUTINE_DRAWMENUBAR\n");
809 if (!((Window
->Style
& (WS_CHILD
| WS_POPUP
)) != WS_CHILD
))
812 if(!(Menu
= UserGetMenuObject((HMENU
) Window
->IDMenu
)))
815 Menu
->MenuInfo
.WndOwner
= hWnd
;
816 Menu
->MenuInfo
.Height
= 0;
818 co_WinPosSetWindowPos(Window
, 0, 0, 0, 0, 0, SWP_NOSIZE
| SWP_NOMOVE
|
819 SWP_NOACTIVATE
| SWP_NOZORDER
| SWP_FRAMECHANGED
);
825 case HWNDLOCK_ROUTINE_REDRAWFRAME
:
829 case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOW
:
830 Ret
= co_IntSetForegroundWindow(Window
);
833 case HWNDLOCK_ROUTINE_UPDATEWINDOW
:
838 UserDerefObjectCo(Window
);
843 DPRINT("Leave NtUserCallHwndLock, ret=%i\n",_ret_
);
859 case HWNDOPT_ROUTINE_SETPROGMANWINDOW
:
862 * Nothing too hard...validate the hWnd and save it in the Desktop Info
864 DPRINT1("HWNDOPT_ROUTINE_SETPROGMANWINDOW UNIMPLEMENTED\n");
867 case HWNDOPT_ROUTINE_SETTASKMANWINDOW
:
870 * Nothing too hard...validate the hWnd and save it in the Desktop Info
872 DPRINT1("HWNDOPT_ROUTINE_SETTASKMANWINDOW UNIMPLEMENTED\n");
883 NtUserGetThreadState(
886 DECLARE_RETURN(DWORD
);
888 DPRINT("Enter NtUserGetThreadState\n");
894 RETURN( (DWORD
)IntGetThreadFocusWindow());
899 DPRINT("Leave NtUserGetThreadState, ret=%i\n",_ret_
);
905 IntGetFontMetricSetting(LPWSTR lpValueName
, PLOGFONTW font
)
907 RTL_QUERY_REGISTRY_TABLE QueryTable
[2];
909 /* Firefox 1.0.7 depends on the lfHeight value being negative */
910 static LOGFONTW DefaultFont
= {
911 -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
912 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
,
913 L
"Bitstream Vera Sans"
916 RtlZeroMemory(&QueryTable
, sizeof(QueryTable
));
918 QueryTable
[0].Name
= lpValueName
;
919 QueryTable
[0].Flags
= RTL_QUERY_REGISTRY_DIRECT
| RTL_QUERY_REGISTRY_REQUIRED
;
920 QueryTable
[0].EntryContext
= font
;
922 Status
= RtlQueryRegistryValues(
924 L
"Control Panel\\Desktop\\WindowMetrics",
929 if (!NT_SUCCESS(Status
))
931 RtlCopyMemory(font
, &DefaultFont
, sizeof(LOGFONTW
));
936 IntSystemParametersInfo(
942 PWINSTATION_OBJECT WinStaObject
;
945 static BOOL bInitialized
= FALSE
;
946 static LOGFONTW IconFont
;
947 static NONCLIENTMETRICSW pMetrics
;
948 static BOOL GradientCaptions
= TRUE
;
949 static UINT FocusBorderHeight
= 1;
950 static UINT FocusBorderWidth
= 1;
954 RtlZeroMemory(&IconFont
, sizeof(LOGFONTW
));
955 RtlZeroMemory(&pMetrics
, sizeof(NONCLIENTMETRICSW
));
957 IntGetFontMetricSetting(L
"CaptionFont", &pMetrics
.lfCaptionFont
);
958 IntGetFontMetricSetting(L
"SmCaptionFont", &pMetrics
.lfSmCaptionFont
);
959 IntGetFontMetricSetting(L
"MenuFont", &pMetrics
.lfMenuFont
);
960 IntGetFontMetricSetting(L
"StatusFont", &pMetrics
.lfStatusFont
);
961 IntGetFontMetricSetting(L
"MessageFont", &pMetrics
.lfMessageFont
);
962 IntGetFontMetricSetting(L
"IconFont", &IconFont
);
964 pMetrics
.iBorderWidth
= 1;
965 pMetrics
.iScrollWidth
= UserGetSystemMetrics(SM_CXVSCROLL
);
966 pMetrics
.iScrollHeight
= UserGetSystemMetrics(SM_CYHSCROLL
);
967 pMetrics
.iCaptionWidth
= UserGetSystemMetrics(SM_CXSIZE
);
968 pMetrics
.iCaptionHeight
= UserGetSystemMetrics(SM_CYSIZE
);
969 pMetrics
.iSmCaptionWidth
= UserGetSystemMetrics(SM_CXSMSIZE
);
970 pMetrics
.iSmCaptionHeight
= UserGetSystemMetrics(SM_CYSMSIZE
);
971 pMetrics
.iMenuWidth
= UserGetSystemMetrics(SM_CXMENUSIZE
);
972 pMetrics
.iMenuHeight
= UserGetSystemMetrics(SM_CYMENUSIZE
);
973 pMetrics
.cbSize
= sizeof(NONCLIENTMETRICSW
);
980 case SPI_SETDOUBLECLKWIDTH
:
981 case SPI_SETDOUBLECLKHEIGHT
:
982 case SPI_SETDOUBLECLICKTIME
:
983 case SPI_SETDESKWALLPAPER
:
984 case SPI_GETDESKWALLPAPER
:
986 PSYSTEM_CURSORINFO CurInfo
;
988 Status
= IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation
,
992 if(!NT_SUCCESS(Status
))
994 SetLastNtError(Status
);
1000 case SPI_SETDOUBLECLKWIDTH
:
1001 CurInfo
= IntGetSysCursorInfo(WinStaObject
);
1002 /* FIXME limit the maximum value? */
1003 CurInfo
->DblClickWidth
= uiParam
;
1005 case SPI_SETDOUBLECLKHEIGHT
:
1006 CurInfo
= IntGetSysCursorInfo(WinStaObject
);
1007 /* FIXME limit the maximum value? */
1008 CurInfo
->DblClickHeight
= uiParam
;
1010 case SPI_SETDOUBLECLICKTIME
:
1011 CurInfo
= IntGetSysCursorInfo(WinStaObject
);
1012 /* FIXME limit the maximum time to 1000 ms? */
1013 CurInfo
->DblClickSpeed
= uiParam
;
1015 case SPI_SETDESKWALLPAPER
:
1017 /* This function expects different parameters than the user mode version!
1019 We let the user mode code load the bitmap, it passed the handle to
1020 the bitmap. We'll change it's ownership to system and replace it with
1021 the current wallpaper bitmap */
1022 HBITMAP hOldBitmap
, hNewBitmap
;
1023 UNICODE_STRING Key
= RTL_CONSTANT_STRING(L
"Control Panel\\Desktop");
1024 UNICODE_STRING Tile
= RTL_CONSTANT_STRING(L
"TileWallpaper");
1025 UNICODE_STRING Style
= RTL_CONSTANT_STRING(L
"WallpaperStyle");
1026 UNICODE_STRING KeyPath
;
1027 OBJECT_ATTRIBUTES KeyAttributes
;
1028 OBJECT_ATTRIBUTES ObjectAttributes
;
1030 HANDLE CurrentUserKey
= NULL
;
1031 HANDLE KeyHandle
= NULL
;
1032 PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo
;
1034 ULONG ResLength
= 0;
1039 hNewBitmap
= *(HBITMAP
*)pvParam
;
1040 if(hNewBitmap
!= NULL
)
1043 /* try to get the size of the wallpaper */
1044 if(!(bmp
= BITMAPOBJ_LockBitmap(hNewBitmap
)))
1046 ObDereferenceObject(WinStaObject
);
1049 WinStaObject
->cxWallpaper
= bmp
->SurfObj
.sizlBitmap
.cx
;
1050 WinStaObject
->cyWallpaper
= bmp
->SurfObj
.sizlBitmap
.cy
;
1052 BITMAPOBJ_UnlockBitmap(bmp
);
1054 /* change the bitmap's ownership */
1055 GDIOBJ_SetOwnership(GdiHandleTable
, hNewBitmap
, NULL
);
1057 hOldBitmap
= (HBITMAP
)InterlockedExchange((LONG
*)&WinStaObject
->hbmWallpaper
, (LONG
)hNewBitmap
);
1058 if(hOldBitmap
!= NULL
)
1060 /* delete the old wallpaper */
1061 NtGdiDeleteObject(hOldBitmap
);
1066 /*default value is center */
1067 WinStaObject
->WallpaperMode
= wmCenter
;
1071 /* Get a handle to the current users settings */
1072 RtlFormatCurrentUserKeyPath(&KeyPath
);
1073 InitializeObjectAttributes(&ObjectAttributes
,&KeyPath
,OBJ_CASE_INSENSITIVE
,NULL
,NULL
);
1074 ZwOpenKey(&CurrentUserKey
, KEY_READ
, &ObjectAttributes
);
1075 RtlFreeUnicodeString(&KeyPath
);
1077 /* open up the settings to read the values */
1078 InitializeObjectAttributes(&KeyAttributes
, &Key
, OBJ_CASE_INSENSITIVE
,
1079 CurrentUserKey
, NULL
);
1080 ZwOpenKey(&KeyHandle
, KEY_READ
, &KeyAttributes
);
1081 ZwClose(CurrentUserKey
);
1083 /* read the tile value in the registry */
1084 Status
= ZwQueryValueKey(KeyHandle
, &Tile
, KeyValuePartialInformation
,
1087 /* fall back to .DEFAULT if we didnt find values */
1088 if(Status
== STATUS_INVALID_HANDLE
)
1090 RtlInitUnicodeString (&KeyPath
,L
"\\Registry\\User\\.Default\\Control Panel\\Desktop");
1091 InitializeObjectAttributes(&KeyAttributes
, &KeyPath
, OBJ_CASE_INSENSITIVE
,
1093 ZwOpenKey(&KeyHandle
, KEY_READ
, &KeyAttributes
);
1094 ZwQueryValueKey(KeyHandle
, &Tile
, KeyValuePartialInformation
,
1098 ResLength
+= sizeof(KEY_VALUE_PARTIAL_INFORMATION
);
1099 KeyValuePartialInfo
= ExAllocatePoolWithTag(PagedPool
, ResLength
, TAG_STRING
);
1102 if(!KeyValuePartialInfo
)
1108 Status
= ZwQueryValueKey(KeyHandle
, &Tile
, KeyValuePartialInformation
,
1109 (PVOID
)KeyValuePartialInfo
, Length
, &ResLength
);
1110 if(!NT_SUCCESS(Status
) || (KeyValuePartialInfo
->Type
!= REG_SZ
))
1113 ExFreePool(KeyValuePartialInfo
);
1117 Tile
.Length
= KeyValuePartialInfo
->DataLength
;
1118 Tile
.MaximumLength
= KeyValuePartialInfo
->DataLength
;
1119 Tile
.Buffer
= (PWSTR
)KeyValuePartialInfo
->Data
;
1121 Status
= RtlUnicodeStringToInteger(&Tile
, 0, &TileNum
);
1122 if(!NT_SUCCESS(Status
))
1126 ExFreePool(KeyValuePartialInfo
);
1128 /* start over again and look for the style*/
1130 Status
= ZwQueryValueKey(KeyHandle
, &Style
, KeyValuePartialInformation
,
1133 ResLength
+= sizeof(KEY_VALUE_PARTIAL_INFORMATION
);
1134 KeyValuePartialInfo
= ExAllocatePoolWithTag(PagedPool
, ResLength
, TAG_STRING
);
1137 if(!KeyValuePartialInfo
)
1143 Status
= ZwQueryValueKey(KeyHandle
, &Style
, KeyValuePartialInformation
,
1144 (PVOID
)KeyValuePartialInfo
, Length
, &ResLength
);
1145 if(!NT_SUCCESS(Status
) || (KeyValuePartialInfo
->Type
!= REG_SZ
))
1148 ExFreePool(KeyValuePartialInfo
);
1152 Style
.Length
= KeyValuePartialInfo
->DataLength
;
1153 Style
.MaximumLength
= KeyValuePartialInfo
->DataLength
;
1154 Style
.Buffer
= (PWSTR
)KeyValuePartialInfo
->Data
;
1156 Status
= RtlUnicodeStringToInteger(&Style
, 0, &StyleNum
);
1157 if(!NT_SUCCESS(Status
))
1161 ExFreePool(KeyValuePartialInfo
);
1163 /* Check the values we found in the registry */
1164 if(TileNum
&& !StyleNum
)
1166 WinStaObject
->WallpaperMode
= wmTile
;
1168 else if(!TileNum
&& StyleNum
== 2)
1170 WinStaObject
->WallpaperMode
= wmStretch
;
1176 case SPI_GETDESKWALLPAPER
:
1177 /* This function expects different parameters than the user mode version!
1179 We basically return the current wallpaper handle - if any. The user
1180 mode version should load the string from the registry and return it
1181 without calling this function */
1183 *(HBITMAP
*)pvParam
= (HBITMAP
)WinStaObject
->hbmWallpaper
;
1187 /* FIXME save the value to the registry */
1189 ObDereferenceObject(WinStaObject
);
1192 case SPI_SETWORKAREA
:
1195 PDESKTOP_OBJECT Desktop
= PsGetWin32Thread()->Desktop
;
1199 /* FIXME - Set last error */
1204 rc
= (RECT
*)pvParam
;
1205 Desktop
->WorkArea
= *rc
;
1209 case SPI_GETWORKAREA
:
1211 PDESKTOP_OBJECT Desktop
= PsGetWin32Thread()->Desktop
;
1215 /* FIXME - Set last error */
1220 IntGetDesktopWorkArea(Desktop
, (PRECT
)pvParam
);
1224 case SPI_SETGRADIENTCAPTIONS
:
1226 GradientCaptions
= (pvParam
!= NULL
);
1227 /* FIXME - should be checked if the color depth is higher than 8bpp? */
1230 case SPI_GETGRADIENTCAPTIONS
:
1233 BOOL Ret
= GradientCaptions
;
1235 hDC
= IntGetScreenDC();
1238 Ret
= (NtGdiGetDeviceCaps(hDC
, BITSPIXEL
) > 8) && Ret
;
1241 *((PBOOL
)pvParam
) = Ret
;
1246 case SPI_SETFONTSMOOTHING
:
1248 IntEnableFontRendering(uiParam
!= 0);
1251 case SPI_GETFONTSMOOTHING
:
1254 *((BOOL
*)pvParam
) = IntIsFontRenderingEnabled();
1257 case SPI_GETICONTITLELOGFONT
:
1260 *((LOGFONTW
*)pvParam
) = IconFont
;
1263 case SPI_GETNONCLIENTMETRICS
:
1266 *((NONCLIENTMETRICSW
*)pvParam
) = pMetrics
;
1269 case SPI_GETFOCUSBORDERHEIGHT
:
1272 *((UINT
*)pvParam
) = FocusBorderHeight
;
1275 case SPI_GETFOCUSBORDERWIDTH
:
1278 *((UINT
*)pvParam
) = FocusBorderWidth
;
1281 case SPI_SETFOCUSBORDERHEIGHT
:
1283 FocusBorderHeight
= (UINT
)pvParam
;
1286 case SPI_SETFOCUSBORDERWIDTH
:
1288 FocusBorderWidth
= (UINT
)pvParam
;
1294 DPRINT1("SystemParametersInfo: Unsupported Action 0x%x (uiParam: 0x%x, pvParam: 0x%x, fWinIni: 0x%x)\n",
1295 uiAction
, uiParam
, pvParam
, fWinIni
);
1306 UserSystemParametersInfo(
1316 case SPI_SETDOUBLECLKWIDTH
:
1317 case SPI_SETDOUBLECLKHEIGHT
:
1318 case SPI_SETDOUBLECLICKTIME
:
1319 case SPI_SETGRADIENTCAPTIONS
:
1320 case SPI_SETFONTSMOOTHING
:
1321 case SPI_SETFOCUSBORDERHEIGHT
:
1322 case SPI_SETFOCUSBORDERWIDTH
:
1324 return (DWORD
)IntSystemParametersInfo(uiAction
, uiParam
, pvParam
, fWinIni
);
1326 case SPI_SETWORKAREA
:
1329 Status
= MmCopyFromCaller(&rc
, (PRECT
)pvParam
, sizeof(RECT
));
1330 if(!NT_SUCCESS(Status
))
1332 SetLastNtError(Status
);
1335 return( (DWORD
)IntSystemParametersInfo(uiAction
, uiParam
, &rc
, fWinIni
));
1337 case SPI_GETWORKAREA
:
1341 if(!IntSystemParametersInfo(uiAction
, uiParam
, &rc
, fWinIni
))
1346 Status
= MmCopyToCaller((PRECT
)pvParam
, &rc
, sizeof(RECT
));
1347 if(!NT_SUCCESS(Status
))
1349 SetLastNtError(Status
);
1354 case SPI_GETFONTSMOOTHING
:
1355 case SPI_GETGRADIENTCAPTIONS
:
1356 case SPI_GETFOCUSBORDERHEIGHT
:
1357 case SPI_GETFOCUSBORDERWIDTH
:
1361 if(!IntSystemParametersInfo(uiAction
, uiParam
, &Ret
, fWinIni
))
1366 Status
= MmCopyToCaller(pvParam
, &Ret
, sizeof(BOOL
));
1367 if(!NT_SUCCESS(Status
))
1369 SetLastNtError(Status
);
1374 case SPI_SETDESKWALLPAPER
:
1376 /* !!! As opposed to the user mode version this version accepts a handle
1378 HBITMAP hbmWallpaper
;
1380 Status
= MmCopyFromCaller(&hbmWallpaper
, pvParam
, sizeof(HBITMAP
));
1381 if(!NT_SUCCESS(Status
))
1383 SetLastNtError(Status
);
1386 return( IntSystemParametersInfo(SPI_SETDESKWALLPAPER
, 0, &hbmWallpaper
, fWinIni
));
1388 case SPI_GETDESKWALLPAPER
:
1390 /* !!! As opposed to the user mode version this version returns a handle
1392 HBITMAP hbmWallpaper
;
1395 Ret
= IntSystemParametersInfo(SPI_GETDESKWALLPAPER
, 0, &hbmWallpaper
, fWinIni
);
1397 Status
= MmCopyToCaller(pvParam
, &hbmWallpaper
, sizeof(HBITMAP
));
1398 if(!NT_SUCCESS(Status
))
1400 SetLastNtError(Status
);
1405 case SPI_GETICONTITLELOGFONT
:
1409 if(!IntSystemParametersInfo(uiAction
, uiParam
, &IconFont
, fWinIni
))
1414 Status
= MmCopyToCaller(pvParam
, &IconFont
, sizeof(LOGFONTW
));
1415 if(!NT_SUCCESS(Status
))
1417 SetLastNtError(Status
);
1422 case SPI_GETNONCLIENTMETRICS
:
1424 NONCLIENTMETRICSW metrics
;
1426 Status
= MmCopyFromCaller(&metrics
.cbSize
, pvParam
, sizeof(UINT
));
1427 if(!NT_SUCCESS(Status
))
1429 SetLastNtError(Status
);
1432 if(metrics
.cbSize
!= sizeof(NONCLIENTMETRICSW
))
1434 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
1438 if(!IntSystemParametersInfo(uiAction
, uiParam
, &metrics
, fWinIni
))
1443 Status
= MmCopyToCaller(pvParam
, &metrics
.cbSize
, sizeof(NONCLIENTMETRICSW
));
1444 if(!NT_SUCCESS(Status
))
1446 SetLastNtError(Status
);
1463 NtUserSystemParametersInfo(
1469 DECLARE_RETURN(BOOLEAN
);
1471 DPRINT("Enter NtUserSystemParametersInfo\n");
1472 UserEnterExclusive();
1474 RETURN( UserSystemParametersInfo(uiAction
, uiParam
, pvParam
, fWinIni
));
1477 DPRINT("Leave NtUserSystemParametersInfo, ret=%i\n",_ret_
);
1486 NtUserGetDoubleClickTime(VOID
)
1490 PWINSTATION_OBJECT WinStaObject
;
1491 PSYSTEM_CURSORINFO CurInfo
;
1492 DECLARE_RETURN(UINT
);
1494 DPRINT("Enter NtUserGetDoubleClickTime\n");
1497 Status
= IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation
,
1501 if (!NT_SUCCESS(Status
))
1502 RETURN( (DWORD
)FALSE
);
1504 CurInfo
= IntGetSysCursorInfo(WinStaObject
);
1505 Result
= CurInfo
->DblClickSpeed
;
1507 ObDereferenceObject(WinStaObject
);
1511 DPRINT("Leave NtUserGetDoubleClickTime, ret=%i\n",_ret_
);
1518 NtUserGetGUIThreadInfo(
1519 DWORD idThread
, /* if NULL use foreground thread */
1520 LPGUITHREADINFO lpgui
)
1523 PTHRDCARETINFO CaretInfo
;
1524 GUITHREADINFO SafeGui
;
1525 PDESKTOP_OBJECT Desktop
;
1526 PUSER_MESSAGE_QUEUE MsgQueue
;
1527 PETHREAD Thread
= NULL
;
1528 DECLARE_RETURN(BOOLEAN
);
1530 DPRINT("Enter NtUserGetGUIThreadInfo\n");
1533 Status
= MmCopyFromCaller(&SafeGui
, lpgui
, sizeof(DWORD
));
1534 if(!NT_SUCCESS(Status
))
1536 SetLastNtError(Status
);
1540 if(SafeGui
.cbSize
!= sizeof(GUITHREADINFO
))
1542 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
1548 Status
= PsLookupThreadByThreadId((HANDLE
)idThread
, &Thread
);
1549 if(!NT_SUCCESS(Status
))
1551 SetLastWin32Error(ERROR_ACCESS_DENIED
);
1554 Desktop
= ((PW32THREAD
)Thread
->Tcb
.Win32Thread
)->Desktop
;
1558 /* get the foreground thread */
1559 PW32THREAD W32Thread
= (PW32THREAD
)PsGetCurrentThread()->Tcb
.Win32Thread
;
1560 Desktop
= W32Thread
->Desktop
;
1563 MsgQueue
= Desktop
->ActiveMessageQueue
;
1566 Thread
= MsgQueue
->Thread
;
1571 if(!Thread
|| !Desktop
)
1573 if(idThread
&& Thread
)
1574 ObDereferenceObject(Thread
);
1575 SetLastWin32Error(ERROR_ACCESS_DENIED
);
1579 MsgQueue
= (PUSER_MESSAGE_QUEUE
)Desktop
->ActiveMessageQueue
;
1580 CaretInfo
= MsgQueue
->CaretInfo
;
1582 SafeGui
.flags
= (CaretInfo
->Visible
? GUI_CARETBLINKING
: 0);
1583 if(MsgQueue
->MenuOwner
)
1584 SafeGui
.flags
|= GUI_INMENUMODE
| MsgQueue
->MenuState
;
1585 if(MsgQueue
->MoveSize
)
1586 SafeGui
.flags
|= GUI_INMOVESIZE
;
1588 /* FIXME add flag GUI_16BITTASK */
1590 SafeGui
.hwndActive
= MsgQueue
->ActiveWindow
;
1591 SafeGui
.hwndFocus
= MsgQueue
->FocusWindow
;
1592 SafeGui
.hwndCapture
= MsgQueue
->CaptureWindow
;
1593 SafeGui
.hwndMenuOwner
= MsgQueue
->MenuOwner
;
1594 SafeGui
.hwndMoveSize
= MsgQueue
->MoveSize
;
1595 SafeGui
.hwndCaret
= CaretInfo
->hWnd
;
1597 SafeGui
.rcCaret
.left
= CaretInfo
->Pos
.x
;
1598 SafeGui
.rcCaret
.top
= CaretInfo
->Pos
.y
;
1599 SafeGui
.rcCaret
.right
= SafeGui
.rcCaret
.left
+ CaretInfo
->Size
.cx
;
1600 SafeGui
.rcCaret
.bottom
= SafeGui
.rcCaret
.top
+ CaretInfo
->Size
.cy
;
1603 ObDereferenceObject(Thread
);
1605 Status
= MmCopyToCaller(lpgui
, &SafeGui
, sizeof(GUITHREADINFO
));
1606 if(!NT_SUCCESS(Status
))
1608 SetLastNtError(Status
);
1615 DPRINT("Leave NtUserGetGUIThreadInfo, ret=%i\n",_ret_
);
1623 NtUserGetGuiResources(
1628 PW32PROCESS W32Process
;
1631 DECLARE_RETURN(DWORD
);
1633 DPRINT("Enter NtUserGetGuiResources\n");
1636 Status
= ObReferenceObjectByHandle(hProcess
,
1637 PROCESS_QUERY_INFORMATION
,
1639 ExGetPreviousMode(),
1643 if(!NT_SUCCESS(Status
))
1645 SetLastNtError(Status
);
1649 W32Process
= (PW32PROCESS
)Process
->Win32Process
;
1652 ObDereferenceObject(Process
);
1653 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
1661 Ret
= (DWORD
)W32Process
->GDIObjects
;
1664 case GR_USEROBJECTS
:
1666 Ret
= (DWORD
)W32Process
->UserObjects
;
1671 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
1676 ObDereferenceObject(Process
);
1681 DPRINT("Leave NtUserGetGuiResources, ret=%i\n",_ret_
);
1687 IntSafeCopyUnicodeString(PUNICODE_STRING Dest
,
1688 PUNICODE_STRING Source
)
1693 Status
= MmCopyFromCaller(Dest
, Source
, sizeof(UNICODE_STRING
));
1694 if(!NT_SUCCESS(Status
))
1699 if(Dest
->Length
> 0x4000)
1701 return STATUS_UNSUCCESSFUL
;
1705 Dest
->Buffer
= NULL
;
1707 if(Dest
->Length
> 0 && Src
)
1709 Dest
->MaximumLength
= Dest
->Length
;
1710 Dest
->Buffer
= ExAllocatePoolWithTag(PagedPool
, Dest
->MaximumLength
, TAG_STRING
);
1713 return STATUS_NO_MEMORY
;
1716 Status
= MmCopyFromCaller(Dest
->Buffer
, Src
, Dest
->Length
);
1717 if(!NT_SUCCESS(Status
))
1719 ExFreePool(Dest
->Buffer
);
1720 Dest
->Buffer
= NULL
;
1725 return STATUS_SUCCESS
;
1728 /* string is empty */
1729 return STATUS_SUCCESS
;
1733 IntSafeCopyUnicodeStringTerminateNULL(PUNICODE_STRING Dest
,
1734 PUNICODE_STRING Source
)
1739 Status
= MmCopyFromCaller(Dest
, Source
, sizeof(UNICODE_STRING
));
1740 if(!NT_SUCCESS(Status
))
1745 if(Dest
->Length
> 0x4000)
1747 return STATUS_UNSUCCESSFUL
;
1751 Dest
->Buffer
= NULL
;
1753 if(Dest
->Length
> 0 && Src
)
1755 Dest
->MaximumLength
= Dest
->Length
+ sizeof(WCHAR
);
1756 Dest
->Buffer
= ExAllocatePoolWithTag(PagedPool
, Dest
->MaximumLength
, TAG_STRING
);
1759 return STATUS_NO_MEMORY
;
1762 Status
= MmCopyFromCaller(Dest
->Buffer
, Src
, Dest
->Length
);
1763 if(!NT_SUCCESS(Status
))
1765 ExFreePool(Dest
->Buffer
);
1766 Dest
->Buffer
= NULL
;
1770 /* make sure the string is null-terminated */
1771 Src
= (PWSTR
)((PBYTE
)Dest
->Buffer
+ Dest
->Length
);
1774 return STATUS_SUCCESS
;
1777 /* string is empty */
1778 return STATUS_SUCCESS
;
1782 IntUnicodeStringToNULLTerminated(PWSTR
*Dest
, PUNICODE_STRING Src
)
1784 if (Src
->Length
+ sizeof(WCHAR
) <= Src
->MaximumLength
1785 && L
'\0' == Src
->Buffer
[Src
->Length
/ sizeof(WCHAR
)])
1787 /* The unicode_string is already nul terminated. Just reuse it. */
1788 *Dest
= Src
->Buffer
;
1789 return STATUS_SUCCESS
;
1792 *Dest
= ExAllocatePoolWithTag(PagedPool
, Src
->Length
+ sizeof(WCHAR
), TAG_STRING
);
1795 return STATUS_NO_MEMORY
;
1797 RtlCopyMemory(*Dest
, Src
->Buffer
, Src
->Length
);
1798 (*Dest
)[Src
->Length
/ 2] = L
'\0';
1800 return STATUS_SUCCESS
;
1804 IntFreeNULLTerminatedFromUnicodeString(PWSTR NullTerminated
, PUNICODE_STRING UnicodeString
)
1806 if (NullTerminated
!= UnicodeString
->Buffer
)
1808 ExFreePool(NullTerminated
);
1813 NtUserUpdatePerUserSystemParameters(
1818 DECLARE_RETURN(BOOLEAN
);
1820 DPRINT("Enter NtUserUpdatePerUserSystemParameters\n");
1821 UserEnterExclusive();
1823 Result
&= IntDesktopUpdatePerUserSettings(bEnable
);
1827 DPRINT("Leave NtUserUpdatePerUserSystemParameters, ret=%i\n",_ret_
);