From cc3b668fcd3121f53500b571694cbee43c40ef94 Mon Sep 17 00:00:00 2001 From: Jose Carlos Jesus Date: Sun, 17 Apr 2022 00:50:23 +0100 Subject: [PATCH] CaretWidth --- win32ss/user/ntuser/caret.c | 9 +-------- win32ss/user/ntuser/sysparams.c | 7 ++++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/win32ss/user/ntuser/caret.c b/win32ss/user/ntuser/caret.c index 24fadf6e16e..b6a7100deee 100644 --- a/win32ss/user/ntuser/caret.c +++ b/win32ss/user/ntuser/caret.c @@ -351,14 +351,7 @@ NtUserCreateCaret( } else { - if (nWidth == 0) - { - nWidth = UserGetSystemMetrics(SM_CXBORDER); - } - if (nHeight == 0) - { - nHeight = UserGetSystemMetrics(SM_CYBORDER); - } + NtUserSystemParametersInfo(SPI_GETCARETWIDTH, 0, &nWidth, 0); ThreadQueue->CaretInfo.Bitmap = (HBITMAP)0; ThreadQueue->CaretInfo.Size.cx = nWidth; ThreadQueue->CaretInfo.Size.cy = nHeight; diff --git a/win32ss/user/ntuser/sysparams.c b/win32ss/user/ntuser/sysparams.c index 0e68f25ced0..5c0d49712aa 100644 --- a/win32ss/user/ntuser/sysparams.c +++ b/win32ss/user/ntuser/sysparams.c @@ -12,6 +12,7 @@ // - Save appropriate text metrics. #include + DBG_DEFAULT_CHANNEL(UserSysparams); SPIVALUES gspv; @@ -1740,7 +1741,7 @@ SpiGetSet(UINT uiAction, UINT uiParam, PVOID pvParam, FLONG fl) return SpiGetInt(pvParam, &gspv.dwCaretWidth, fl); case SPI_SETCARETWIDTH: - return SpiSetInt(&gspv.dwCaretWidth, uiParam, KEY_MOUSE, L"", fl); + return SpiSetDWord(&gspv.dwCaretWidth, PtrToUlong(pvParam), KEY_DESKTOP, VAL_CARETWIDTH, fl); case SPI_GETMOUSECLICKLOCKTIME: return SpiGetInt(pvParam, &gspv.dwMouseClickLockTime, fl); @@ -2061,7 +2062,6 @@ SpiGetSetProbeBuffer(UINT uiAction, UINT uiParam, PVOID pvParam) bToUser = FALSE; break; } - if (cbSize) { _SEH2_TRY @@ -2163,7 +2163,8 @@ NtUserSystemParametersInfo( // FIXME: Get rid of the flags and only use this from um. kernel can access data directly. /* Set UM memory protection flag */ - fWinIni |= SPIF_PROTECT; + if ((ULONG_PTR)pvParam < MmUserProbeAddress) + fWinIni |= SPIF_PROTECT; /* Call internal function */ bResult = UserSystemParametersInfo(uiAction, uiParam, pvParam, fWinIni); -- 2.21.0.windows.1