From a423f34284f8da630fcb707400f0fddbf46436fc Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 5 Feb 2012 20:21:22 +0000 Subject: [PATCH] [win32k] - load gpsi->dtCaretBlink and g_PaintDesktopVersion in sysparams.c - Rename IntGdiGetLanguageID to UserGetLanguageID - Remove some unused functions and definitions svn path=/trunk/; revision=55439 --- .../subsystems/win32/win32k/include/desktop.h | 5 - .../subsystems/win32/win32k/include/hotkey.h | 2 - .../subsystems/win32/win32k/include/misc.h | 2 +- .../subsystems/win32/win32k/include/ntuser.h | 1 + .../win32/win32k/include/sysparams.h | 1 + .../subsystems/win32/win32k/include/winsta.h | 7 -- .../subsystems/win32/win32k/main/dllmain.c | 38 +----- .../subsystems/win32/win32k/ntuser/caret.c | 115 +----------------- .../subsystems/win32/win32k/ntuser/desktop.c | 44 ------- .../subsystems/win32/win32k/ntuser/hotkey.c | 14 --- .../subsystems/win32/win32k/ntuser/input.c | 3 - reactos/subsystems/win32/win32k/ntuser/misc.c | 2 +- .../subsystems/win32/win32k/ntuser/ntuser.c | 2 +- .../win32/win32k/ntuser/sysparams.c | 9 +- .../subsystems/win32/win32k/ntuser/winsta.c | 6 - 15 files changed, 20 insertions(+), 231 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/desktop.h b/reactos/subsystems/win32/win32k/include/desktop.h index 92635b05bc4..0a9f6ae2010 100644 --- a/reactos/subsystems/win32/win32k/include/desktop.h +++ b/reactos/subsystems/win32/win32k/include/desktop.h @@ -43,7 +43,6 @@ extern PDESKTOP InputDesktop; extern HDESK InputDesktopHandle; extern PCLS DesktopWindowClass; extern HDC ScreenDeviceContext; -extern BOOL g_PaintDesktopVersion; typedef struct _SHELL_HOOK_WINDOW { @@ -56,9 +55,6 @@ NTSTATUS NTAPI InitDesktopImpl(VOID); -NTSTATUS FASTCALL -CleanupDesktopImpl(VOID); - NTSTATUS APIENTRY IntDesktopObjectParse(IN PVOID ParseObject, @@ -121,7 +117,6 @@ IntParseDesktopPath(PEPROCESS Process, HWINSTA *hWinSta, HDESK *hDesktop); -BOOL FASTCALL IntDesktopUpdatePerUserSettings(BOOL bEnable); VOID APIENTRY UserRedrawDesktop(VOID); BOOL IntRegisterShellHookWindow(HWND hWnd); BOOL IntDeRegisterShellHookWindow(HWND hWnd); diff --git a/reactos/subsystems/win32/win32k/include/hotkey.h b/reactos/subsystems/win32/win32k/include/hotkey.h index 44107ab789f..89fa7d002a5 100644 --- a/reactos/subsystems/win32/win32k/include/hotkey.h +++ b/reactos/subsystems/win32/win32k/include/hotkey.h @@ -16,8 +16,6 @@ typedef struct _HOT_KEY #define IDHK_WINKEY -7 #define IDHK_REACTOS -8 -INIT_FUNCTION NTSTATUS NTAPI InitHotkeyImpl(VOID); - VOID FASTCALL UnregisterWindowHotKeys(PWND Window); VOID FASTCALL UnregisterThreadHotKeys(struct _ETHREAD *pThread); BOOL NTAPI co_UserProcessHotKeys(WORD wVk, BOOL bIsDown); diff --git a/reactos/subsystems/win32/win32k/include/misc.h b/reactos/subsystems/win32/win32k/include/misc.h index e5be2bde9b4..addd2591806 100644 --- a/reactos/subsystems/win32/win32k/include/misc.h +++ b/reactos/subsystems/win32/win32k/include/misc.h @@ -23,7 +23,7 @@ extern BOOL APIENTRY IntEngLeave(PINTENG_ENTER_LEAVE EnterLeave); extern HGDIOBJ StockObjects[]; extern SHORT gusLanguageID; -SHORT FASTCALL IntGdiGetLanguageID(VOID); +SHORT FASTCALL UserGetLanguageID(VOID); VOID FASTCALL IntUserManualGuiCheck(LONG Check); PVOID APIENTRY HackSecureVirtualMemory(IN PVOID,IN SIZE_T,IN ULONG,OUT PVOID *); VOID APIENTRY HackUnsecureVirtualMemory(IN PVOID); diff --git a/reactos/subsystems/win32/win32k/include/ntuser.h b/reactos/subsystems/win32/win32k/include/ntuser.h index e932d3f760d..b0f0b043ad6 100644 --- a/reactos/subsystems/win32/win32k/include/ntuser.h +++ b/reactos/subsystems/win32/win32k/include/ntuser.h @@ -11,6 +11,7 @@ extern PSERVERINFO gpsi; extern PTHREADINFO gptiCurrent; +extern PPROCESSINFO ppiScrnSaver; INIT_FUNCTION NTSTATUS NTAPI InitUserImpl(VOID); VOID FASTCALL CleanupUserImpl(VOID); diff --git a/reactos/subsystems/win32/win32k/include/sysparams.h b/reactos/subsystems/win32/win32k/include/sysparams.h index abd7d59acc1..665c75ca3c1 100644 --- a/reactos/subsystems/win32/win32k/include/sysparams.h +++ b/reactos/subsystems/win32/win32k/include/sysparams.h @@ -175,6 +175,7 @@ typedef union _SPIBUFFER } SPIBUFFER; extern SPIVALUES gspv; +extern BOOL g_PaintDesktopVersion; BOOL InitSysParams(); diff --git a/reactos/subsystems/win32/win32k/include/winsta.h b/reactos/subsystems/win32/win32k/include/winsta.h index d536f965a29..7fda4ab0f39 100644 --- a/reactos/subsystems/win32/win32k/include/winsta.h +++ b/reactos/subsystems/win32/win32k/include/winsta.h @@ -74,13 +74,6 @@ NTSTATUS NTAPI InitWindowStationImpl(VOID); -NTSTATUS FASTCALL -CleanupWindowStationImpl(VOID); - -NTSTATUS -APIENTRY -IntWinStaObjectOpen(PWIN32_OPENMETHOD_PARAMETERS Parameters); - VOID APIENTRY IntWinStaObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters); diff --git a/reactos/subsystems/win32/win32k/main/dllmain.c b/reactos/subsystems/win32/win32k/main/dllmain.c index b67a92d0117..0c7fff08457 100644 --- a/reactos/subsystems/win32/win32k/main/dllmain.c +++ b/reactos/subsystems/win32/win32k/main/dllmain.c @@ -454,41 +454,6 @@ leave: return Status; } -NTSTATUS -Win32kInitWin32Thread(PETHREAD Thread) -{ - PEPROCESS Process; - - Process = Thread->ThreadsProcess; - - if (Process->Win32Process == NULL) - { - /* FIXME: Lock the process */ - Process->Win32Process = ExAllocatePoolWithTag(NonPagedPool, sizeof(PROCESSINFO), USERTAG_PROCESSINFO); - - if (Process->Win32Process == NULL) - return STATUS_NO_MEMORY; - - RtlZeroMemory(Process->Win32Process, sizeof(PROCESSINFO)); - /* FIXME: Unlock the process */ - - Win32kProcessCallback(Process, TRUE); - } - - if (Thread->Tcb.Win32Thread == NULL) - { - Thread->Tcb.Win32Thread = ExAllocatePoolWithTag(NonPagedPool, sizeof(THREADINFO), USERTAG_THREADINFO); - if (Thread->Tcb.Win32Thread == NULL) - return STATUS_NO_MEMORY; - - RtlZeroMemory(Thread->Tcb.Win32Thread, sizeof(THREADINFO)); - - Win32kThreadCallback(Thread, PsW32ThreadCalloutInitialize); - } - - return(STATUS_SUCCESS); -} - #ifdef _M_IX86 C_ASSERT(sizeof(SERVERINFO) <= PAGE_SIZE); #endif @@ -588,7 +553,6 @@ DriverEntry( NT_ROF(InitDeviceImpl()); NT_ROF(InitDcImpl()); NT_ROF(InitUserImpl()); - NT_ROF(InitHotkeyImpl()); NT_ROF(InitWindowStationImpl()); NT_ROF(InitDesktopImpl()); NT_ROF(InitInputImpl()); @@ -603,7 +567,7 @@ DriverEntry( return Status; } - gusLanguageID = IntGdiGetLanguageID(); + gusLanguageID = UserGetLanguageID(); return STATUS_SUCCESS; } diff --git a/reactos/subsystems/win32/win32k/ntuser/caret.c b/reactos/subsystems/win32/win32k/ntuser/caret.c index 10a84336404..7ab4db11503 100644 --- a/reactos/subsystems/win32/win32k/ntuser/caret.c +++ b/reactos/subsystems/win32/win32k/ntuser/caret.c @@ -13,9 +13,6 @@ DBG_DEFAULT_CHANNEL(UserCaret); #define MIN_CARETBLINKRATE 100 #define MAX_CARETBLINKRATE 10000 -#define DEFAULT_CARETBLINKRATE 530 -#define CARET_REGKEY L"\\Registry\\User\\.Default\\Control Panel\\Desktop" -#define CARET_VALUENAME L"CursorBlinkRate" /* FUNCTIONS *****************************************************************/ @@ -60,117 +57,19 @@ BOOL FASTCALL IntSetCaretBlinkTime(UINT uMSeconds) { /* Don't save the new value to the registry! */ - PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PWINSTATION_OBJECT WinStaObject = pti->rpdesk->rpwinstaParent; /* Windows doesn't do this check */ if((uMSeconds < MIN_CARETBLINKRATE) || (uMSeconds > MAX_CARETBLINKRATE)) { EngSetLastError(ERROR_INVALID_PARAMETER); - ObDereferenceObject(WinStaObject); return FALSE; } - WinStaObject->CaretBlinkRate = uMSeconds; gpsi->dtCaretBlink = uMSeconds; return TRUE; } -static -UINT FASTCALL -IntQueryCaretBlinkRate(VOID) -{ - UNICODE_STRING KeyName = RTL_CONSTANT_STRING(CARET_REGKEY); - UNICODE_STRING ValueName = RTL_CONSTANT_STRING(CARET_VALUENAME); - NTSTATUS Status; - HANDLE KeyHandle = NULL; - OBJECT_ATTRIBUTES KeyAttributes; - PKEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInfo; - ULONG Length = 0; - ULONG ResLength = 0; - ULONG Val = 0; - - InitializeObjectAttributes(&KeyAttributes, &KeyName, OBJ_CASE_INSENSITIVE, - NULL, NULL); - - Status = ZwOpenKey(&KeyHandle, KEY_READ, &KeyAttributes); - if(!NT_SUCCESS(Status)) - { - return 0; - } - - Status = ZwQueryValueKey(KeyHandle, &ValueName, KeyValuePartialInformation, - 0, 0, &ResLength); - if((Status != STATUS_BUFFER_TOO_SMALL)) - { - NtClose(KeyHandle); - return 0; - } - - ResLength += sizeof(KEY_VALUE_PARTIAL_INFORMATION); - KeyValuePartialInfo = ExAllocatePoolWithTag(PagedPool, ResLength, TAG_STRING); - Length = ResLength; - - if(!KeyValuePartialInfo) - { - NtClose(KeyHandle); - return 0; - } - - Status = ZwQueryValueKey(KeyHandle, &ValueName, KeyValuePartialInformation, - (PVOID)KeyValuePartialInfo, Length, &ResLength); - if(!NT_SUCCESS(Status) || (KeyValuePartialInfo->Type != REG_SZ)) - { - NtClose(KeyHandle); - ExFreePoolWithTag(KeyValuePartialInfo, TAG_STRING); - return 0; - } - - ValueName.Length = KeyValuePartialInfo->DataLength; - ValueName.MaximumLength = KeyValuePartialInfo->DataLength; - ValueName.Buffer = (PWSTR)KeyValuePartialInfo->Data; - - Status = RtlUnicodeStringToInteger(&ValueName, 0, &Val); - if(!NT_SUCCESS(Status)) - { - Val = 0; - } - - ExFreePoolWithTag(KeyValuePartialInfo, TAG_STRING); - NtClose(KeyHandle); - - return (UINT)Val; -} - -static -UINT FASTCALL -IntGetCaretBlinkTime(VOID) -{ - PTHREADINFO pti; - PWINSTATION_OBJECT WinStaObject; - UINT Ret; - - pti = PsGetCurrentThreadWin32Thread(); - WinStaObject = pti->rpdesk->rpwinstaParent; - - Ret = WinStaObject->CaretBlinkRate; - if(!Ret) - { - /* Load it from the registry the first call only! */ - Ret = WinStaObject->CaretBlinkRate = IntQueryCaretBlinkRate(); - } - - /* Windows doesn't do this check */ - if((Ret < MIN_CARETBLINKRATE) || (Ret > MAX_CARETBLINKRATE)) - { - Ret = DEFAULT_CARETBLINKRATE; - } - - return Ret; -} - - BOOL FASTCALL co_IntSetCaretPos(int X, int Y) { @@ -191,7 +90,7 @@ co_IntSetCaretPos(int X, int Y) ThreadQueue->CaretInfo->Pos.x = X; ThreadQueue->CaretInfo->Pos.y = Y; co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0); - IntSetTimer(UserGetWindowObject(ThreadQueue->CaretInfo->hWnd), IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TMRF_SYSTEM); + IntSetTimer(UserGetWindowObject(ThreadQueue->CaretInfo->hWnd), IDCARETTIMER, gpsi->dtCaretBlink, NULL, TMRF_SYSTEM); IntNotifyWinEvent(EVENT_OBJECT_LOCATIONCHANGE, pWnd, OBJID_CARET, CHILDID_SELF, 0); } return TRUE; @@ -308,7 +207,7 @@ BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL) co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0); IntNotifyWinEvent(EVENT_OBJECT_SHOW, pWnd, OBJID_CARET, OBJID_CARET, 0); } - IntSetTimer(UserGetWindowObject(ThreadQueue->CaretInfo->hWnd), IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TMRF_SYSTEM); + IntSetTimer(UserGetWindowObject(ThreadQueue->CaretInfo->hWnd), IDCARETTIMER, gpsi->dtCaretBlink, NULL, TMRF_SYSTEM); } return TRUE; } @@ -387,17 +286,15 @@ UINT APIENTRY NtUserGetCaretBlinkTime(VOID) { - DECLARE_RETURN(UINT); + UINT ret; - TRACE("Enter NtUserGetCaretBlinkTime\n"); UserEnterShared(); - RETURN(IntGetCaretBlinkTime()); + ret = gpsi->dtCaretBlink; -CLEANUP: - TRACE("Leave NtUserGetCaretBlinkTime, ret=%i\n",_ret_); UserLeave(); - END_CLEANUP; + + return ret; } BOOL diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c index b699287e39f..55dd8f83294 100644 --- a/reactos/subsystems/win32/win32k/ntuser/desktop.c +++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c @@ -23,7 +23,6 @@ IntFreeDesktopHeap( PDESKTOP InputDesktop = NULL; HDESK InputDesktopHandle = NULL; HDC ScreenDeviceContext = NULL; -BOOL g_PaintDesktopVersion = FALSE; GENERIC_MAPPING IntDesktopMapping = { @@ -197,13 +196,6 @@ InitDesktopImpl(VOID) return STATUS_SUCCESS; } -NTSTATUS -FASTCALL -CleanupDesktopImpl(VOID) -{ - return STATUS_SUCCESS; -} - static int GetSystemVersionString(LPWSTR buffer) { RTL_OSVERSIONINFOEXW versionInfo; @@ -569,42 +561,6 @@ HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID) return pdo->DesktopWindow; } -BOOL FASTCALL IntDesktopUpdatePerUserSettings(BOOL bEnable) -{ - if (bEnable) - { - RTL_QUERY_REGISTRY_TABLE QueryTable[2]; - NTSTATUS Status; - - RtlZeroMemory(QueryTable, sizeof(QueryTable)); - - QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT; - QueryTable[0].Name = L"PaintDesktopVersion"; - QueryTable[0].EntryContext = &g_PaintDesktopVersion; - - /* Query the "PaintDesktopVersion" flag in the "Control Panel\Desktop" key */ - Status = RtlQueryRegistryValues(RTL_REGISTRY_USER, - L"Control Panel\\Desktop", - QueryTable, NULL, NULL); - if (!NT_SUCCESS(Status)) - { - TRACE("RtlQueryRegistryValues failed for PaintDesktopVersion (%x)\n", - Status); - g_PaintDesktopVersion = FALSE; - return FALSE; - } - - TRACE("PaintDesktopVersion = %d\n", g_PaintDesktopVersion); - - return TRUE; - } - else - { - g_PaintDesktopVersion = FALSE; - return TRUE; - } -} - /* PUBLIC FUNCTIONS ***********************************************************/ HDC FASTCALL diff --git a/reactos/subsystems/win32/win32k/ntuser/hotkey.c b/reactos/subsystems/win32/win32k/ntuser/hotkey.c index ff9e7430c75..e86ea0ae691 100644 --- a/reactos/subsystems/win32/win32k/ntuser/hotkey.c +++ b/reactos/subsystems/win32/win32k/ntuser/hotkey.c @@ -28,20 +28,6 @@ PHOT_KEY gphkFirst = &hkWinKey; /* FUNCTIONS *****************************************************************/ -INIT_FUNCTION -NTSTATUS -NTAPI -InitHotkeyImpl(VOID) -{ - return STATUS_SUCCESS; -} - -/*NTSTATUS FASTCALL -CleanupHotKeys(VOID) -{ - return STATUS_SUCCESS; -}*/ - /* * IntGetModifiers * diff --git a/reactos/subsystems/win32/win32k/ntuser/input.c b/reactos/subsystems/win32/win32k/ntuser/input.c index 25a9429f5d0..8ad738cc295 100644 --- a/reactos/subsystems/win32/win32k/ntuser/input.c +++ b/reactos/subsystems/win32/win32k/ntuser/input.c @@ -10,9 +10,6 @@ #include DBG_DEFAULT_CHANNEL(UserInput); -extern NTSTATUS Win32kInitWin32Thread(PETHREAD Thread); -extern PPROCESSINFO ppiScrnSaver; - /* GLOBALS *******************************************************************/ PTHREADINFO ptiRawInput; diff --git a/reactos/subsystems/win32/win32k/ntuser/misc.c b/reactos/subsystems/win32/win32k/ntuser/misc.c index bd5caf8db8d..56449425c0c 100644 --- a/reactos/subsystems/win32/win32k/ntuser/misc.c +++ b/reactos/subsystems/win32/win32k/ntuser/misc.c @@ -11,7 +11,7 @@ DBG_DEFAULT_CHANNEL(UserMisc); SHORT FASTCALL -IntGdiGetLanguageID(VOID) +UserGetLanguageID(VOID) { HANDLE KeyHandle; OBJECT_ATTRIBUTES ObAttr; diff --git a/reactos/subsystems/win32/win32k/ntuser/ntuser.c b/reactos/subsystems/win32/win32k/ntuser/ntuser.c index ac602a25253..39d22439c97 100644 --- a/reactos/subsystems/win32/win32k/ntuser/ntuser.c +++ b/reactos/subsystems/win32/win32k/ntuser/ntuser.c @@ -178,7 +178,7 @@ NtUserInitialize( // InitializeGreCSRSS(); // { // Startup DxGraphics. -// calls ** IntGdiGetLanguageID() and sets it **. +// calls ** UserGetLanguageID() and sets it **. // Enables Fonts drivers, Initialize Font table & Stock Fonts. // } diff --git a/reactos/subsystems/win32/win32k/ntuser/sysparams.c b/reactos/subsystems/win32/win32k/ntuser/sysparams.c index c878b3e47e3..52773fd26f2 100644 --- a/reactos/subsystems/win32/win32k/ntuser/sysparams.c +++ b/reactos/subsystems/win32/win32k/ntuser/sysparams.c @@ -17,6 +17,7 @@ DBG_DEFAULT_CHANNEL(UserSysparams); SPIVALUES gspv; BOOL gbSpiInitialized = FALSE; PWINSTATION_OBJECT gpwinstaCurrent = NULL; +BOOL g_PaintDesktopVersion = FALSE; // HACK! We initialize SPI before we have a proper surface to get this from. #define dpi 96 @@ -58,6 +59,8 @@ static const WCHAR* VAL_DRAGWIDTH = L"DragWidth"; static const WCHAR* VAL_FNTSMOOTH = L"FontSmoothing"; static const WCHAR* VAL_SCRLLLINES = L"WheelScrollLines"; static const WCHAR* VAL_CLICKLOCKTIME = L"ClickLockTime"; +static const WCHAR* VAL_PAINTDESKVER = L"PaintDesktopVersion"; +static const WCHAR* VAL_CARETRATE = L"CursorBlinkRate"; #if (_WIN32_WINNT >= 0x0600) static const WCHAR* VAL_SCRLLCHARS = L"WheelScrollChars"; #endif @@ -267,6 +270,7 @@ SpiUpdatePerUserSystemParameters() gspv.bDragFullWindows = SpiLoadInt(KEY_DESKTOP, VAL_DRAG, 0); gspv.iWheelScrollLines = SpiLoadInt(KEY_DESKTOP, VAL_SCRLLLINES, 3); gspv.dwMouseClickLockTime = SpiLoadDWord(KEY_DESKTOP, VAL_CLICKLOCKTIME, 1200); + gpsi->dtCaretBlink = SpiLoadInt(KEY_DESKTOP, VAL_CARETRATE, 530); gspv.dwUserPrefMask = SpiLoadUserPrefMask(UPM_DEFAULT); gspv.bMouseClickLock = (gspv.dwUserPrefMask & UPM_CLICKLOCK) != 0; gspv.bMouseCursorShadow = (gspv.dwUserPrefMask & UPM_CURSORSHADOW) != 0; @@ -320,7 +324,10 @@ NtUserUpdatePerUserSystemParameters( UserEnterExclusive(); SpiUpdatePerUserSystemParameters(); - bResult = IntDesktopUpdatePerUserSettings(bEnable); + if(bEnable) + g_PaintDesktopVersion = SpiLoadDWord(KEY_DESKTOP, VAL_PAINTDESKVER, 0); + else + g_PaintDesktopVersion = FALSE; TRACE("Leave NtUserUpdatePerUserSystemParameters, returning %d\n", bResult); UserLeave(); diff --git a/reactos/subsystems/win32/win32k/ntuser/winsta.c b/reactos/subsystems/win32/win32k/ntuser/winsta.c index eec529ef6ee..51aa4890df4 100644 --- a/reactos/subsystems/win32/win32k/ntuser/winsta.c +++ b/reactos/subsystems/win32/win32k/ntuser/winsta.c @@ -66,12 +66,6 @@ InitWindowStationImpl(VOID) return STATUS_SUCCESS; } -NTSTATUS FASTCALL -CleanupWindowStationImpl(VOID) -{ - return STATUS_SUCCESS; -} - /* OBJECT CALLBACKS **********************************************************/ VOID APIENTRY