ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2022
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
11 participants
86 discussions
Start a n
N
ew thread
[reactos] 01/01: [USER32] Fix HKL keyboard list values (Retrial)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0aa9d9fdb711702e4fb10…
commit 0aa9d9fdb711702e4fb1099764b37357fc026a12 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Aug 28 09:08:12 2022 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Sun Aug 28 09:08:12 2022 +0900 [USER32] Fix HKL keyboard list values (Retrial) CORE-18338 --- win32ss/user/ntuser/kbdlayout.c | 2 ++ win32ss/user/user32/windows/input.c | 32 +++++++++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/win32ss/user/ntuser/kbdlayout.c b/win32ss/user/ntuser/kbdlayout.c index 6a742b27377..83d89d9632a 100644 --- a/win32ss/user/ntuser/kbdlayout.c +++ b/win32ss/user/ntuser/kbdlayout.c @@ -999,6 +999,8 @@ cleanup: * NtUserLoadKeyboardLayoutEx * * Loads keyboard layout with given locale id + * + * NOTE: We adopt a different design from Microsoft's one for security reason. */ HKL APIENTRY diff --git a/win32ss/user/user32/windows/input.c b/win32ss/user/user32/windows/input.c index 8d4d3ad8732..cad4930de28 100644 --- a/win32ss/user/user32/windows/input.c +++ b/win32ss/user/user32/windows/input.c @@ -640,6 +640,8 @@ LoadKeyboardLayoutA(LPCSTR pszKLID, /* * @unimplemented + * + * NOTE: We adopt a different design from Microsoft's one for security reason. */ /* Win: LoadKeyboardLayoutWorker */ HKL APIENTRY @@ -654,12 +656,27 @@ IntLoadKeyboardLayout( UNICODE_STRING ustrKbdName; UNICODE_STRING ustrKLID; WCHAR wszRegKey[256] = L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\"; - WCHAR wszLayoutId[10], wszNewKLID[10]; + WCHAR wszLayoutId[10], wszNewKLID[10], szImeFileName[80]; HKEY hKey; HKL hNewKL; + BOOL bIsIME; - /* LOWORD of dwhkl is Locale Identifier */ - dwhkl = LOWORD(wcstoul(pwszKLID, NULL, 16)); + dwhkl = wcstoul(pwszKLID, NULL, 16); + bIsIME = IS_IME_HKL(UlongToHandle(dwhkl)); + if (bIsIME) /* IME? */ + { + /* Check "IME File" value */ + dwSize = sizeof(szImeFileName); + if (RegQueryValueExW(hKey, L"IME File", NULL, &dwType, (LPBYTE)szImeFileName, + &dwSize) != ERROR_SUCCESS) + { + dwhkl = LOWORD(dwhkl); + } + } + else + { + dwhkl = LOWORD(dwhkl); /* LOWORD of dwhkl is language identifier */ + } if (Flags & KLF_SUBSTITUTE_OK) { @@ -692,10 +709,9 @@ IntLoadKeyboardLayout( /* If Layout Id is specified, use this value | f000 as HIWORD */ /* FIXME: Microsoft Office expects this value to be something specific * for Japanese and Korean Windows with an IME the value is 0xe001 - * We should probably check to see if an IME exists and if so then - * set this word properly. */ - dwhkl |= (0xf000 | wcstol(wszLayoutId, NULL, 16)) << 16; + if (!bIsIME) + dwhkl |= (0xf000 | wcstol(wszLayoutId, NULL, 16)) << 16; } /* Close the key now */ @@ -713,9 +729,7 @@ IntLoadKeyboardLayout( ZeroMemory(&ustrKbdName, sizeof(ustrKbdName)); RtlInitUnicodeString(&ustrKLID, pwszKLID); - hNewKL = NtUserLoadKeyboardLayoutEx(NULL, 0, &ustrKbdName, - NULL, &ustrKLID, - dwhkl, Flags); + hNewKL = NtUserLoadKeyboardLayoutEx(NULL, 0, &ustrKbdName, NULL, &ustrKLID, dwhkl, Flags); CliImmInitializeHotKeys(SETIMEHOTKEY_ADD, hNewKL); return hNewKL; }
2 years, 3 months
1
0
0
0
[reactos] 01/01: Revert "[USER32] Fix HKL value in IntLoadKeyboardLayout (#4632)" (#4637)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5d123ce5f1dbe9ac678cf…
commit 5d123ce5f1dbe9ac678cf80389e98cc5b93d03dd Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Aug 28 08:11:01 2022 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Aug 28 08:11:01 2022 +0900 Revert "[USER32] Fix HKL value in IntLoadKeyboardLayout (#4632)" (#4637) This reverts commit ea2d32b9eb1683c8e197daaa0bab40cb45a7eb54. --- win32ss/user/ntuser/kbdlayout.c | 2 -- win32ss/user/user32/windows/input.c | 61 ++++++++++--------------------------- 2 files changed, 16 insertions(+), 47 deletions(-) diff --git a/win32ss/user/ntuser/kbdlayout.c b/win32ss/user/ntuser/kbdlayout.c index 83d89d9632a..6a742b27377 100644 --- a/win32ss/user/ntuser/kbdlayout.c +++ b/win32ss/user/ntuser/kbdlayout.c @@ -999,8 +999,6 @@ cleanup: * NtUserLoadKeyboardLayoutEx * * Loads keyboard layout with given locale id - * - * NOTE: We adopt a different design from Microsoft's one for security reason. */ HKL APIENTRY diff --git a/win32ss/user/user32/windows/input.c b/win32ss/user/user32/windows/input.c index 474306ebb81..8d4d3ad8732 100644 --- a/win32ss/user/user32/windows/input.c +++ b/win32ss/user/user32/windows/input.c @@ -640,8 +640,6 @@ LoadKeyboardLayoutA(LPCSTR pszKLID, /* * @unimplemented - * - * NOTE: We adopt a different design from Microsoft's one for security reason. */ /* Win: LoadKeyboardLayoutWorker */ HKL APIENTRY @@ -652,25 +650,16 @@ IntLoadKeyboardLayout( _In_ UINT Flags, _In_ BOOL unknown5) { - DWORD dwHKL, dwType, dwSize; - WORD wKeybdLangID, wLayoutID; + DWORD dwhkl, dwType, dwSize; UNICODE_STRING ustrKbdName; UNICODE_STRING ustrKLID; WCHAR wszRegKey[256] = L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\"; - WCHAR wszLayoutId[10], wszNewKLID[10], szImeFileName[80]; - WCHAR *endptr; + WCHAR wszLayoutId[10], wszNewKLID[10]; HKEY hKey; - HKL hInputKL, hNewKL; - - hInputKL = (HKL)UlongToHandle(wcstoul(pwszKLID, &endptr, 16)); - if ((endptr - pwszKLID) != 8) - { - ERR("pwszKLID: '%S'\n", pwszKLID); - return NULL; - } + HKL hNewKL; - wKeybdLangID = LOWORD(hInputKL); /* language identifier */ - wLayoutID = HIWORD(hInputKL); /* layout identifier */ + /* LOWORD of dwhkl is Locale Identifier */ + dwhkl = LOWORD(wcstoul(pwszKLID, NULL, 16)); if (Flags & KLF_SUBSTITUTE_OK) { @@ -694,32 +683,19 @@ IntLoadKeyboardLayout( StringCbCatW(wszRegKey, sizeof(wszRegKey), pwszKLID); /* Open layout registry key for read */ - if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszRegKey, 0, KEY_READ, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszRegKey, 0, + KEY_READ, &hKey) == ERROR_SUCCESS) { - /* Check "Layout Id" value */ dwSize = sizeof(wszLayoutId); if (RegQueryValueExW(hKey, L"Layout Id", NULL, &dwType, (LPBYTE)wszLayoutId, &dwSize) == ERROR_SUCCESS) { /* If Layout Id is specified, use this value | f000 as HIWORD */ /* FIXME: Microsoft Office expects this value to be something specific * for Japanese and Korean Windows with an IME the value is 0xe001 + * We should probably check to see if an IME exists and if so then + * set this word properly. */ - wLayoutID = 0xF000 | LOWORD(wcstol(wszLayoutId, NULL, 16)); - } - - if (IS_IME_HKL(hInputKL)) /* IME? */ - { - /* Check "IME File" value */ - dwSize = sizeof(szImeFileName); - if (RegQueryValueExW(hKey, L"IME File", NULL, &dwType, (LPBYTE)szImeFileName, - &dwSize) != ERROR_SUCCESS) - { - /* - * FIXME: We should probably check to see if an IME exists and if so then - * set this word properly. - */ - wLayoutID = 0; - } + dwhkl |= (0xf000 | wcstol(wszLayoutId, NULL, 16)) << 16; } /* Close the key now */ @@ -731,20 +707,15 @@ IntLoadKeyboardLayout( return NULL; } - if (IS_IME_HKL(hInputKL) && wLayoutID) /* IME? */ - { - dwHKL = HandleToUlong(hInputKL); - } - else - { - if (!wLayoutID) - wLayoutID = wKeybdLangID; - dwHKL = MAKELONG(wKeybdLangID, wLayoutID); - } + /* If Layout Id is not given HIWORD == LOWORD (for dwhkl) */ + if (!HIWORD(dwhkl)) + dwhkl |= dwhkl << 16; ZeroMemory(&ustrKbdName, sizeof(ustrKbdName)); RtlInitUnicodeString(&ustrKLID, pwszKLID); - hNewKL = NtUserLoadKeyboardLayoutEx(NULL, 0, &ustrKbdName, NULL, &ustrKLID, dwHKL, Flags); + hNewKL = NtUserLoadKeyboardLayoutEx(NULL, 0, &ustrKbdName, + NULL, &ustrKLID, + dwhkl, Flags); CliImmInitializeHotKeys(SETIMEHOTKEY_ADD, hNewKL); return hNewKL; }
2 years, 3 months
1
0
0
0
[reactos] 01/01: [CPL] Use MAKEINTRESOURCE instead of LoadString (#4631)
by Thamatip Chitpong
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0c324e350eb016102e0b9…
commit 0c324e350eb016102e0b9db4c7965431f42010a2 Author: Thamatip Chitpong <tangaming123456(a)outlook.com> AuthorDate: Sat Aug 27 21:01:55 2022 +0700 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Aug 27 16:01:55 2022 +0200 [CPL] Use MAKEINTRESOURCE instead of LoadString (#4631) Fixes for ACCESS, DESK, INTL, MAIN, MMSYS, OPENGLCFG, POWERCFG, TIMEDATE, USRMGR, and WINED3DCFG. --- dll/cpl/access/access.c | 5 +---- dll/cpl/desk/desk.c | 5 +---- dll/cpl/intl/generalp.c | 5 +---- dll/cpl/intl/intl.c | 5 +---- dll/cpl/main/keyboard.c | 5 +---- dll/cpl/main/mouse.c | 5 +---- dll/cpl/mmsys/mmsys.c | 15 +++------------ dll/cpl/mmsys/speakervolume.c | 8 +++----- dll/cpl/openglcfg/openglcfg.c | 5 +---- dll/cpl/powercfg/powercfg.c | 6 +----- dll/cpl/timedate/timedate.c | 5 +---- dll/cpl/usrmgr/usrmgr.c | 5 +---- dll/cpl/wined3dcfg/wined3dcfg.c | 5 +---- 13 files changed, 17 insertions(+), 62 deletions(-) diff --git a/dll/cpl/access/access.c b/dll/cpl/access/access.c index 4f71945d6ef..d840adfe99e 100644 --- a/dll/cpl/access/access.c +++ b/dll/cpl/access/access.c @@ -189,15 +189,12 @@ SystemApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) PGLOBAL_DATA pGlobalData; PROPSHEETPAGE psp[5]; PROPSHEETHEADER psh; - TCHAR Caption[1024]; INT nPage = 0; INT ret; if (uMsg == CPL_STARTWPARMSW && lParam != 0) nPage = _wtoi((PWSTR)lParam); - LoadString(hApplet, IDS_CPLSYSTEMNAME, Caption, sizeof(Caption) / sizeof(TCHAR)); - pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLOBAL_DATA)); if (pGlobalData == NULL) return 0; @@ -214,7 +211,7 @@ SystemApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) psh.hwndParent = hwnd; psh.hInstance = hApplet; psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLACCESS); - psh.pszCaption = Caption; + psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLSYSTEMNAME); psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nStartPage = 0; psh.ppsp = psp; diff --git a/dll/cpl/desk/desk.c b/dll/cpl/desk/desk.c index f2690aae5c5..213ec6c8ff9 100644 --- a/dll/cpl/desk/desk.c +++ b/dll/cpl/desk/desk.c @@ -144,7 +144,6 @@ DisplayApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) HPROPSHEETPAGE hpsp[MAX_DESK_PAGES]; PROPSHEETHEADER psh; HPSXA hpsxa = NULL; - TCHAR Caption[1024]; UINT i; LPWSTR *argv = NULL; LPCWSTR pwszSelectedTab = NULL; @@ -198,15 +197,13 @@ DisplayApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) g_GlobalData.pwszAction = pwszAction; g_GlobalData.desktop_color = GetSysColor(COLOR_DESKTOP); - LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR)); - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_USECALLBACK | PSH_PROPTITLE | PSH_USEICONID; psh.hwndParent = hCPLWindow; psh.hInstance = hApplet; psh.pszIcon = MAKEINTRESOURCEW(IDC_DESK_ICON); - psh.pszCaption = Caption; + psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME); psh.nPages = 0; psh.nStartPage = 0; psh.phpage = hpsp; diff --git a/dll/cpl/intl/generalp.c b/dll/cpl/intl/generalp.c index 76beeb0370a..911cc724d8e 100644 --- a/dll/cpl/intl/generalp.c +++ b/dll/cpl/intl/generalp.c @@ -1349,9 +1349,6 @@ CustomizeLocalePropertySheet( { PROPSHEETPAGEW PsPage[NUM_SHEETS + 1]; PROPSHEETHEADERW psh; - WCHAR Caption[MAX_STR_SIZE]; - - LoadStringW(hApplet, IDS_CUSTOMIZE_TITLE, Caption, sizeof(Caption) / sizeof(TCHAR)); ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); psh.dwSize = sizeof(PROPSHEETHEADER); @@ -1359,7 +1356,7 @@ CustomizeLocalePropertySheet( psh.hwndParent = hwndDlg; psh.hInstance = hApplet; psh.pszIcon = MAKEINTRESOURCE(IDC_CPLICON); - psh.pszCaption = Caption; + psh.pszCaption = MAKEINTRESOURCE(IDS_CUSTOMIZE_TITLE); psh.nPages = (sizeof(PsPage) / sizeof(PROPSHEETPAGE)) - 1; psh.nStartPage = 0; psh.ppsp = PsPage; diff --git a/dll/cpl/intl/intl.c b/dll/cpl/intl/intl.c index 0b775a734d6..054a8f1e674 100644 --- a/dll/cpl/intl/intl.c +++ b/dll/cpl/intl/intl.c @@ -168,7 +168,6 @@ PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam) static LONG APIENTRY Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) { - TCHAR Caption[BUFFERSIZE]; PROPSHEETPAGE psp[3]; PROPSHEETHEADER psh; PGLOBALDATA pGlobalData; @@ -190,15 +189,13 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) pGlobalData->SystemLCID = GetSystemDefaultLCID(); pGlobalData->bIsUserAdmin = IsUserAdmin(); - LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR)); - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK; psh.hwndParent = hwnd; psh.hInstance = hApplet; psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON); - psh.pszCaption = Caption; + psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME); psh.nPages = 0; psh.nStartPage = 0; psh.ppsp = psp; diff --git a/dll/cpl/main/keyboard.c b/dll/cpl/main/keyboard.c index 29e839bbc5c..813c9996863 100644 --- a/dll/cpl/main/keyboard.c +++ b/dll/cpl/main/keyboard.c @@ -305,7 +305,6 @@ KeyboardApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) HPROPSHEETPAGE hpsp[MAX_CPL_PAGES]; PROPSHEETHEADER psh; HPSXA hpsxa; - TCHAR szCaption[256]; INT nPage = 0; LONG ret; @@ -317,15 +316,13 @@ KeyboardApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) if (uMsg == CPL_STARTWPARMSW && lParam != 0) nPage = _wtoi((PWSTR)lParam); - LoadString(hApplet, IDS_CPLNAME_2, szCaption, sizeof(szCaption) / sizeof(TCHAR)); - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK; psh.hwndParent = hwnd; psh.hInstance = hApplet; psh.pszIcon = MAKEINTRESOURCE(IDC_CPLICON_2); - psh.pszCaption = szCaption; + psh.pszCaption = MAKEINTRESOURCE(IDS_CPLNAME_2); psh.nStartPage = 0; psh.phpage = hpsp; psh.pfnCallback = PropSheetProc; diff --git a/dll/cpl/main/mouse.c b/dll/cpl/main/mouse.c index 89d4bbbdeb4..022515c61e9 100644 --- a/dll/cpl/main/mouse.c +++ b/dll/cpl/main/mouse.c @@ -1831,7 +1831,6 @@ MouseApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2) HPROPSHEETPAGE hpsp[MAX_CPL_PAGES]; PROPSHEETHEADER psh; HPSXA hpsxa; - TCHAR Caption[256]; UINT i; INT nPage = 0; LONG ret; @@ -1844,15 +1843,13 @@ MouseApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2) if (uMsg == CPL_STARTWPARMSW && lParam2 != 0) nPage = _wtoi((PWSTR)lParam2); - LoadString(hApplet, IDS_CPLNAME_1, Caption, sizeof(Caption) / sizeof(TCHAR)); - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK; psh.hwndParent = hwnd; psh.hInstance = hApplet; psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON_1); - psh.pszCaption = Caption; + psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME_1); psh.nStartPage = 0; psh.phpage = hpsp; psh.pfnCallback = PropSheetProc; diff --git a/dll/cpl/mmsys/mmsys.c b/dll/cpl/mmsys/mmsys.c index 9662476b686..325604db4a1 100644 --- a/dll/cpl/mmsys/mmsys.c +++ b/dll/cpl/mmsys/mmsys.c @@ -696,7 +696,6 @@ MmSysApplet(HWND hwnd, { PROPSHEETPAGE psp[5]; PROPSHEETHEADER psh; // = { 0 }; - TCHAR Caption[256]; INT nPage = 0; UNREFERENCED_PARAMETER(lParam); @@ -706,14 +705,12 @@ MmSysApplet(HWND hwnd, if (uMsg == CPL_STARTWPARMSW && lParam != 0) nPage = _wtoi((PWSTR)lParam); - LoadString(hApplet, IDS_CPLNAME, Caption, _countof(Caption)); - psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK; psh.hwndParent = hwnd; psh.hInstance = hApplet; psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON); - psh.pszCaption = Caption; + psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME); psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nStartPage = 0; psh.ppsp = psp; @@ -797,18 +794,15 @@ ShowAudioPropertySheet(HWND hwnd, { PROPSHEETPAGE psp[1]; PROPSHEETHEADER psh; - TCHAR Caption[256]; DPRINT("ShowAudioPropertySheet()\n"); - LoadString(hApplet, IDS_CPLNAME, Caption, _countof(Caption)); - psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK; psh.hwndParent = hwnd; psh.hInstance = hInstance; psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON); - psh.pszCaption = Caption; + psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME); psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nStartPage = 0; psh.ppsp = psp; @@ -827,18 +821,15 @@ ShowFullControlPanel(HWND hwnd, { PROPSHEETPAGE psp[5]; PROPSHEETHEADER psh; - TCHAR Caption[256]; DPRINT("ShowFullControlPanel()\n"); - LoadString(hApplet, IDS_CPLNAME, Caption, _countof(Caption)); - psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK; psh.hwndParent = hwnd; psh.hInstance = hInstance; psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON); - psh.pszCaption = Caption; + psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME); psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nStartPage = 0; psh.ppsp = psp; diff --git a/dll/cpl/mmsys/speakervolume.c b/dll/cpl/mmsys/speakervolume.c index 3b8b2cfc81d..8b887fdc6a7 100644 --- a/dll/cpl/mmsys/speakervolume.c +++ b/dll/cpl/mmsys/speakervolume.c @@ -308,23 +308,21 @@ SpeakerVolume( { PROPSHEETPAGE psp[1]; PROPSHEETHEADER psh; - TCHAR Caption[256]; - - LoadString(hApplet, IDS_SPEAKER_VOLUME, Caption, _countof(Caption)); ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPSHEETPAGE; psh.hwndParent = hwndDlg; psh.hInstance = hApplet; - psh.pszCaption = Caption; + psh.pszCaption = MAKEINTRESOURCE(IDS_SPEAKER_VOLUME); psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nStartPage = 0; psh.ppsp = psp; InitPropSheetPage(&psp[0], IDD_MULTICHANNEL, SpeakerVolumeDlgProc); psp[0].dwFlags |= PSP_USETITLE; - psp[0].pszTitle = Caption; + psp[0].hInstance = hApplet; + psp[0].pszTitle = MAKEINTRESOURCE(IDS_SPEAKER_VOLUME); return (LONG)(PropertySheet(&psh) != -1); } diff --git a/dll/cpl/openglcfg/openglcfg.c b/dll/cpl/openglcfg/openglcfg.c index 281d1b23ec1..9eff298e6b7 100644 --- a/dll/cpl/openglcfg/openglcfg.c +++ b/dll/cpl/openglcfg/openglcfg.c @@ -25,9 +25,6 @@ LONG CALLBACK AppletInit(HWND hWnd) { PROPSHEETPAGEW psp; PROPSHEETHEADERW psh; - WCHAR szCaption[1024]; - - LoadStringW(hApplet, IDS_CPLNAME, szCaption, sizeof(szCaption) / sizeof(WCHAR)); ZeroMemory(&psp, sizeof(PROPSHEETPAGE)); psp.dwSize = sizeof(PROPSHEETPAGE); @@ -42,7 +39,7 @@ LONG CALLBACK AppletInit(HWND hWnd) psh.hwndParent = hWnd; psh.hInstance = hApplet; psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON); - psh.pszCaption = szCaption; + psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME); psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nStartPage = 0; psh.ppsp = &psp; diff --git a/dll/cpl/powercfg/powercfg.c b/dll/cpl/powercfg/powercfg.c index 565f45b3bbe..4e5e1c17220 100644 --- a/dll/cpl/powercfg/powercfg.c +++ b/dll/cpl/powercfg/powercfg.c @@ -92,7 +92,6 @@ Applet1(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) HPROPSHEETPAGE hpsp[MAX_POWER_PAGES]; PROPSHEETHEADER psh; HPSXA hpsxa = NULL; - TCHAR Caption[1024]; SYSTEM_POWER_CAPABILITIES spc; LONG ret; @@ -100,16 +99,13 @@ Applet1(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(lParam); - memset(Caption, 0x0, sizeof(Caption)); - LoadString(hApplet, IDS_CPLNAME_1, Caption, sizeof(Caption) / sizeof(TCHAR)); - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK; psh.hwndParent = hwnd; psh.hInstance = hApplet; psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON_1); - psh.pszCaption = Caption; + psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME_1); psh.nPages = 0; psh.nStartPage = 0; psh.phpage = hpsp; diff --git a/dll/cpl/timedate/timedate.c b/dll/cpl/timedate/timedate.c index 5557a95f5b9..9e1baaa3eca 100644 --- a/dll/cpl/timedate/timedate.c +++ b/dll/cpl/timedate/timedate.c @@ -89,7 +89,6 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) { PROPSHEETHEADER psh; PROPSHEETPAGEW psp[3]; - WCHAR Caption[256]; LONG Ret = 0; UNREFERENCED_PARAMETER(uMsg); @@ -99,15 +98,13 @@ Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) if (RegisterMonthCalControl(hApplet) && RegisterClockControl()) { - LoadStringW(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(WCHAR)); - ZeroMemory(&psh, sizeof(PROPSHEETHEADERW)); psh.dwSize = sizeof(PROPSHEETHEADERW); psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK; psh.hwndParent = hwnd; psh.hInstance = hApplet; psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON); - psh.pszCaption = Caption; + psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME); psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGEW); psh.nStartPage = 0; psh.ppsp = psp; diff --git a/dll/cpl/usrmgr/usrmgr.c b/dll/cpl/usrmgr/usrmgr.c index 508e6594e4e..7aea9731796 100644 --- a/dll/cpl/usrmgr/usrmgr.c +++ b/dll/cpl/usrmgr/usrmgr.c @@ -61,21 +61,18 @@ UsrmgrApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) { PROPSHEETPAGE psp[2]; PROPSHEETHEADER psh; - TCHAR Caption[1024]; UNREFERENCED_PARAMETER(lParam); UNREFERENCED_PARAMETER(wParam); UNREFERENCED_PARAMETER(uMsg); - LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR)); - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK; psh.hwndParent = hwnd; psh.hInstance = hApplet; psh.pszIcon = MAKEINTRESOURCEW(IDI_USRMGR_ICON); - psh.pszCaption = Caption; + psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME); psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nStartPage = 0; psh.ppsp = psp; diff --git a/dll/cpl/wined3dcfg/wined3dcfg.c b/dll/cpl/wined3dcfg/wined3dcfg.c index 8046bb2a3e3..055b111ab3c 100644 --- a/dll/cpl/wined3dcfg/wined3dcfg.c +++ b/dll/cpl/wined3dcfg/wined3dcfg.c @@ -25,9 +25,6 @@ LONG CALLBACK AppletInit(HWND hWnd) { PROPSHEETPAGEW psp; PROPSHEETHEADERW psh; - WCHAR szCaption[1024]; - - LoadStringW(hApplet, IDS_CPLNAME, szCaption, sizeof(szCaption) / sizeof(WCHAR)); ZeroMemory(&psp, sizeof(PROPSHEETPAGE)); psp.dwSize = sizeof(PROPSHEETPAGE); @@ -42,7 +39,7 @@ LONG CALLBACK AppletInit(HWND hWnd) psh.hwndParent = hWnd; psh.hInstance = hApplet; psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLICON); - psh.pszCaption = szCaption; + psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME); psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nStartPage = 0; psh.ppsp = &psp;
2 years, 4 months
1
0
0
0
[reactos] 01/01: [NTOS:MM] kdbg.c: Fix Argv[n] copypastas (#4634)
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=730b13daacfd94f848302…
commit 730b13daacfd94f848302acab70bae22af34ba3e Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com> AuthorDate: Sat Aug 27 15:58:54 2022 +0200 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Aug 27 15:58:54 2022 +0200 [NTOS:MM] kdbg.c: Fix Argv[n] copypastas (#4634) --- ntoskrnl/mm/ARM3/kdbg.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ntoskrnl/mm/ARM3/kdbg.c b/ntoskrnl/mm/ARM3/kdbg.c index 92fe6af47dd..d568c42b45f 100644 --- a/ntoskrnl/mm/ARM3/kdbg.c +++ b/ntoskrnl/mm/ARM3/kdbg.c @@ -60,17 +60,17 @@ ExpKdbgExtPool( /* Get address */ if (!KdbpGetHexNumber(Argv[1], &Address)) { - KdbpPrint("Invalid parameter: %s\n", Argv[0]); + KdbpPrint("Invalid parameter: %s\n", Argv[1]); return TRUE; } } if (Argc > 2) { - /* Get address */ - if (!KdbpGetHexNumber(Argv[1], &Flags)) + /* Get flags */ + if (!KdbpGetHexNumber(Argv[2], &Flags)) { - KdbpPrint("Invalid parameter: %s\n", Argv[0]); + KdbpPrint("Invalid parameter: %s\n", Argv[2]); return TRUE; } } @@ -185,14 +185,14 @@ ExpKdbgExtPoolUsed( ExpKdbgExtPoolUsedGetTag(Argv[2], &Tag, &Mask); if (!KdbpGetHexNumber(Argv[1], &Flags)) { - KdbpPrint("Invalid parameter: %s\n", Argv[0]); + KdbpPrint("Invalid parameter: %s\n", Argv[1]); } } else { /* Otherwise, try to find out whether that's flags */ if (strlen(Argv[1]) == 1 || - (strlen(Argv[1]) == 3 && Argv[1][0] == '0' && Argv[1][1] == 'x')) + (strlen(Argv[1]) == 3 && Argv[1][0] == '0' && (Argv[1][1] == 'x' || Argv[1][1] == 'X'))) { /* Fallback: if reading flags failed, assume it's a tag */ if (!KdbpGetHexNumber(Argv[1], &Flags)) @@ -568,7 +568,7 @@ ExpKdbgExtIrpFind( { if (!KdbpGetHexNumber(Argv[2], &FindCtxt.RestartAddress)) { - KdbpPrint("Invalid parameter: %s\n", Argv[0]); + KdbpPrint("Invalid parameter: %s\n", Argv[2]); FindCtxt.RestartAddress = 0; } }
2 years, 4 months
1
0
0
0
[reactos] 01/01: [USER32] Fix HKL value in IntLoadKeyboardLayout (#4632)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ea2d32b9eb1683c8e197d…
commit ea2d32b9eb1683c8e197daaa0bab40cb45a7eb54 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Aug 27 07:42:37 2022 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Aug 27 07:42:37 2022 +0900 [USER32] Fix HKL value in IntLoadKeyboardLayout (#4632) The loaded HKL values were wrong. CORE-11700 --- win32ss/user/ntuser/kbdlayout.c | 2 ++ win32ss/user/user32/windows/input.c | 61 +++++++++++++++++++++++++++---------- 2 files changed, 47 insertions(+), 16 deletions(-) diff --git a/win32ss/user/ntuser/kbdlayout.c b/win32ss/user/ntuser/kbdlayout.c index 6a742b27377..83d89d9632a 100644 --- a/win32ss/user/ntuser/kbdlayout.c +++ b/win32ss/user/ntuser/kbdlayout.c @@ -999,6 +999,8 @@ cleanup: * NtUserLoadKeyboardLayoutEx * * Loads keyboard layout with given locale id + * + * NOTE: We adopt a different design from Microsoft's one for security reason. */ HKL APIENTRY diff --git a/win32ss/user/user32/windows/input.c b/win32ss/user/user32/windows/input.c index 8d4d3ad8732..474306ebb81 100644 --- a/win32ss/user/user32/windows/input.c +++ b/win32ss/user/user32/windows/input.c @@ -640,6 +640,8 @@ LoadKeyboardLayoutA(LPCSTR pszKLID, /* * @unimplemented + * + * NOTE: We adopt a different design from Microsoft's one for security reason. */ /* Win: LoadKeyboardLayoutWorker */ HKL APIENTRY @@ -650,16 +652,25 @@ IntLoadKeyboardLayout( _In_ UINT Flags, _In_ BOOL unknown5) { - DWORD dwhkl, dwType, dwSize; + DWORD dwHKL, dwType, dwSize; + WORD wKeybdLangID, wLayoutID; UNICODE_STRING ustrKbdName; UNICODE_STRING ustrKLID; WCHAR wszRegKey[256] = L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\"; - WCHAR wszLayoutId[10], wszNewKLID[10]; + WCHAR wszLayoutId[10], wszNewKLID[10], szImeFileName[80]; + WCHAR *endptr; HKEY hKey; - HKL hNewKL; + HKL hInputKL, hNewKL; + + hInputKL = (HKL)UlongToHandle(wcstoul(pwszKLID, &endptr, 16)); + if ((endptr - pwszKLID) != 8) + { + ERR("pwszKLID: '%S'\n", pwszKLID); + return NULL; + } - /* LOWORD of dwhkl is Locale Identifier */ - dwhkl = LOWORD(wcstoul(pwszKLID, NULL, 16)); + wKeybdLangID = LOWORD(hInputKL); /* language identifier */ + wLayoutID = HIWORD(hInputKL); /* layout identifier */ if (Flags & KLF_SUBSTITUTE_OK) { @@ -683,19 +694,32 @@ IntLoadKeyboardLayout( StringCbCatW(wszRegKey, sizeof(wszRegKey), pwszKLID); /* Open layout registry key for read */ - if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszRegKey, 0, - KEY_READ, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszRegKey, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { + /* Check "Layout Id" value */ dwSize = sizeof(wszLayoutId); if (RegQueryValueExW(hKey, L"Layout Id", NULL, &dwType, (LPBYTE)wszLayoutId, &dwSize) == ERROR_SUCCESS) { /* If Layout Id is specified, use this value | f000 as HIWORD */ /* FIXME: Microsoft Office expects this value to be something specific * for Japanese and Korean Windows with an IME the value is 0xe001 - * We should probably check to see if an IME exists and if so then - * set this word properly. */ - dwhkl |= (0xf000 | wcstol(wszLayoutId, NULL, 16)) << 16; + wLayoutID = 0xF000 | LOWORD(wcstol(wszLayoutId, NULL, 16)); + } + + if (IS_IME_HKL(hInputKL)) /* IME? */ + { + /* Check "IME File" value */ + dwSize = sizeof(szImeFileName); + if (RegQueryValueExW(hKey, L"IME File", NULL, &dwType, (LPBYTE)szImeFileName, + &dwSize) != ERROR_SUCCESS) + { + /* + * FIXME: We should probably check to see if an IME exists and if so then + * set this word properly. + */ + wLayoutID = 0; + } } /* Close the key now */ @@ -707,15 +731,20 @@ IntLoadKeyboardLayout( return NULL; } - /* If Layout Id is not given HIWORD == LOWORD (for dwhkl) */ - if (!HIWORD(dwhkl)) - dwhkl |= dwhkl << 16; + if (IS_IME_HKL(hInputKL) && wLayoutID) /* IME? */ + { + dwHKL = HandleToUlong(hInputKL); + } + else + { + if (!wLayoutID) + wLayoutID = wKeybdLangID; + dwHKL = MAKELONG(wKeybdLangID, wLayoutID); + } ZeroMemory(&ustrKbdName, sizeof(ustrKbdName)); RtlInitUnicodeString(&ustrKLID, pwszKLID); - hNewKL = NtUserLoadKeyboardLayoutEx(NULL, 0, &ustrKbdName, - NULL, &ustrKLID, - dwhkl, Flags); + hNewKL = NtUserLoadKeyboardLayoutEx(NULL, 0, &ustrKbdName, NULL, &ustrKLID, dwHKL, Flags); CliImmInitializeHotKeys(SETIMEHOTKEY_ADD, hNewKL); return hNewKL; }
2 years, 4 months
1
0
0
0
[reactos] 01/01: [EXPLORER] Do WM_MOUSEACTIVATE.MA_NOACTIVATE on notification area
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=83442919e4df0067a7bc7…
commit 83442919e4df0067a7bc72f351fefed667c1737a Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Aug 26 08:07:54 2022 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Fri Aug 26 08:07:54 2022 +0900 [EXPLORER] Do WM_MOUSEACTIVATE.MA_NOACTIVATE on notification area Don't activate taskbar when clicked the notification area. CORE-10667 --- base/shell/explorer/trayntfy.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/base/shell/explorer/trayntfy.cpp b/base/shell/explorer/trayntfy.cpp index 9a279240f3c..94dd369103b 100644 --- a/base/shell/explorer/trayntfy.cpp +++ b/base/shell/explorer/trayntfy.cpp @@ -124,6 +124,11 @@ public: return TRUE; } + LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + return MA_NOACTIVATE; + } + BOOL GetMinimumSize(IN OUT PSIZE pSize) { SIZE szClock = { 0, 0 }; @@ -345,6 +350,7 @@ public: BEGIN_MSG_MAP(CTrayNotifyWnd) MESSAGE_HANDLER(WM_CREATE, OnCreate) + MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_SIZE, OnSize)
2 years, 4 months
1
0
0
0
[reactos] 02/02: [CRT] Implement portable ceil/floor
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3aa3b3af560859ef97e1d…
commit 3aa3b3af560859ef97e1dfb24d1a2c1d88f3af1b Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Sat May 29 19:40:30 2021 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Fri Aug 26 00:44:46 2022 +0200 [CRT] Implement portable ceil/floor --- sdk/lib/crt/math/amd64/ceil.S | 55 ------------------------------- sdk/lib/crt/math/amd64/ceilf.S | 51 ----------------------------- sdk/lib/crt/math/amd64/floor.S | 41 ------------------------ sdk/lib/crt/math/amd64/floorf.S | 41 ------------------------ sdk/lib/crt/math/ceil.c | 65 +++++++++++++++++++++++++++++++++++++ sdk/lib/crt/math/floor.c | 71 +++++++++++++++++++++++++++++++++++++++++ sdk/lib/crt/math/math.cmake | 7 ++-- 7 files changed, 139 insertions(+), 192 deletions(-) diff --git a/sdk/lib/crt/math/amd64/ceil.S b/sdk/lib/crt/math/amd64/ceil.S deleted file mode 100644 index f88403e241c..00000000000 --- a/sdk/lib/crt/math/amd64/ceil.S +++ /dev/null @@ -1,55 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of ceil - * FILE: lib/sdk/crt/math/amd64/ceil.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer(a)reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include <asm.inc> -#include <ksamd64.inc> - -/* CODE **********************************************************************/ -.code64 - -/* ceil(x) = - floor(-x) - */ -PUBLIC ceil -.PROC ceil - sub rsp, 16 - .ENDPROLOG - - /* Duplicate the bits into rax */ - movd rax, xmm0 - - /* Invert the sign bit */ - rol rax, 1 - xor al, 1 - ror rax, 1 - - /* Copy back to xmm0 */ - movd xmm0, rax - - /* Truncate xmm0 to integer (double precision) */ - cvttsd2si rcx, xmm0 - - /* Shift all bits to the right, keeping the sign bit */ - shr rax, 63 - - /* Substract the sign bit from the truncated value, so that - we get the correct result for negative values. */ - sub rcx, rax - - /* Now compensate for the previous negation */ - neg rcx - - /* Convert the result back to xmm0 (double precision) */ - cvtsi2sd xmm0, rcx - - add rsp, 16 - ret -.ENDP - -END diff --git a/sdk/lib/crt/math/amd64/ceilf.S b/sdk/lib/crt/math/amd64/ceilf.S deleted file mode 100644 index 6063ddb1d5e..00000000000 --- a/sdk/lib/crt/math/amd64/ceilf.S +++ /dev/null @@ -1,51 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of tan - * FILE: lib/sdk/crt/math/amd64/ceilf.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer(a)reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include <asm.inc> -#include <ksamd64.inc> - -/* CODE **********************************************************************/ -.code64 - -PUBLIC ceilf -FUNC ceilf - sub rsp, 16 - .ENDPROLOG - - /* Duplicate the bits into eax (zero exteneded to rax) */ - movd eax, xmm0 - - /* Invert the sign bit */ - xor eax, HEX(80000000) - - /* Copy back to xmm0 */ - movd xmm0, eax - - /* Truncate xmm0 to integer (single precision) */ - cvttss2si rcx, xmm0 - - /* Shift all bits to the right, keeping the sign bit */ - shr rax, 31 - - /* Add the sign bit from the truncated value, so that - we get the correct result for negative values. */ - add rcx, rax - - /* Now compensate for the previous negation */ - neg ecx - - /* Convert the result back to xmm0 (single precision) */ - cvtsi2ss xmm0, rcx - - add rsp, 16 - ret -ENDFUNC - -END diff --git a/sdk/lib/crt/math/amd64/floor.S b/sdk/lib/crt/math/amd64/floor.S deleted file mode 100644 index 95724686824..00000000000 --- a/sdk/lib/crt/math/amd64/floor.S +++ /dev/null @@ -1,41 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of floor - * FILE: lib/sdk/crt/math/amd64/floor.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer(a)reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include <asm.inc> - -/* CODE **********************************************************************/ -.code64 - -PUBLIC floor -FUNC floor - sub rsp, 16 - .ENDPROLOG - - /* Truncate xmm0 to integer (double precision) */ - cvttsd2si rcx, xmm0 - - /* Duplicate the bits into rax */ - movd rax, xmm0 - - /* Shift all bits to the right, keeping the sign bit */ - shr rax, 63 - - /* Substract the sign bit from the truncated value, so that - we get the correct result for negative values. */ - sub rcx, rax - - /* Convert the result back to xmm0 (double precision) */ - cvtsi2sd xmm0, rcx - - add rsp, 16 - ret -ENDFUNC - -END diff --git a/sdk/lib/crt/math/amd64/floorf.S b/sdk/lib/crt/math/amd64/floorf.S deleted file mode 100644 index 176c481ba4f..00000000000 --- a/sdk/lib/crt/math/amd64/floorf.S +++ /dev/null @@ -1,41 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of floorf - * FILE: lib/sdk/crt/math/amd64/floorf.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer(a)reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include <asm.inc> - -/* CODE **********************************************************************/ -.code64 - -PUBLIC floorf -FUNC floorf - sub rsp, 16 - .ENDPROLOG - - /* Truncate xmm0 to integer (single precision) */ - cvttss2si rcx, xmm0 - - /* Duplicate the bits into rax */ - movd eax, xmm0 - - /* Shift all bits to the right, keeping the sign bit */ - shr rax, 31 - - /* Substract the sign bit from the truncated value, so that - we get the correct result for negative values. */ - sub rcx, rax - - /* Convert the result back to xmm0 (single precision) */ - cvtsi2ss xmm0, rcx - - add rsp, 16 - ret -ENDFUNC - -END diff --git a/sdk/lib/crt/math/ceil.c b/sdk/lib/crt/math/ceil.c new file mode 100644 index 00000000000..f1b6ff8665d --- /dev/null +++ b/sdk/lib/crt/math/ceil.c @@ -0,0 +1,65 @@ +/* + * PROJECT: ReactOS CRT library + * LICENSE: MIT (
https://spdx.org/licenses/MIT
) + * PURPOSE: Portable implementation of ceil + * COPYRIGHT: Copyright 2021 Timo Kreuzer <timo.kreuzer(a)reactos.org> + */ + +#define _USE_MATH_DEFINES +#include <math.h> +#include <limits.h> + +#ifdef _MSC_VER +#pragma function(ceil) +#endif + +double +__cdecl +ceil(double x) +{ + /* Load the value as uint64 */ + unsigned long long u64 = *(unsigned long long*)&x; + + /* Check for NAN */ + if ((u64 & ~(1ULL << 63)) > 0x7FF0000000000000ull) + { + /* Set error bit */ + u64 |= 0x0008000000000000ull; + return *(double*)&u64; + } + + /* Check if x is positive */ + if ((u64 & (1ULL << 63)) == 0) + { + /* Check if it fits into an int64 */ + if (x < (double)_I64_MAX) + { + /* Cast to int64 to truncate towards 0. If this matches the + input, return it as is, otherwise add 1 */ + double y = (double)(long long)x; + return (x > y) ? y + 1 : y; + } + else + { + /* The exponent is larger than the fraction bits. + This means the number is already an integer. */ + return x; + } + } + else + { + /* Check if it fits into an int64 */ + if (x > (double)_I64_MIN) + { + /* Cast to int64 to truncate towards 0. */ + x = (double)(long long)x; + return (x == 0.) ? -0.0 : x; + } + else + { + /* The exponent is larger than the fraction bits. + This means the number is already an integer. */ + return x; + } + } +} diff --git a/sdk/lib/crt/math/floor.c b/sdk/lib/crt/math/floor.c new file mode 100644 index 00000000000..883105117d4 --- /dev/null +++ b/sdk/lib/crt/math/floor.c @@ -0,0 +1,71 @@ +/* + * PROJECT: ReactOS CRT library + * LICENSE: MIT (
https://spdx.org/licenses/MIT
) + * PURPOSE: Implementation of floor + * COPYRIGHT: Copyright 2021 Timo Kreuzer <timo.kreuzer(a)reactos.org> + */ + +#define _USE_MATH_DEFINES +#include <math.h> +#include <limits.h> + +#ifdef _MSC_VER +#pragma function(floor) +#endif + +double +__cdecl +floor(double x) +{ + /* Load the value as uint64 */ + unsigned long long u64 = *(unsigned long long*)&x; + + /* Check for NAN */ + if ((u64 & ~(1ULL << 63)) > 0x7FF0000000000000ull) + { + /* Set error bit */ + u64 |= 0x0008000000000000ull; + return *(double*)&u64; + } + + /* Check if x is positive */ + if ((u64 & (1ULL << 63)) == 0) + { + /* Check if it fits into an int64 */ + if (x < (double)_I64_MAX) + { + /* Just cast to int64, which will truncate towards 0, + which is what we want here.*/ + return (double)(long long)x; + } + else + { + /* The exponent is larger than the fraction bits. + This means the number is already an integer. */ + return x; + } + } + else + { + /* Check if it fits into an int64 */ + if (x > (double)_I64_MIN) + { + /* Check if it is -0 */ + if (x == -0.) + { + return -0.; + } + + /* Cast to int64 to truncate towards 0. If this matches the + input, return it as is, otherwise subtract 1 */ + double y = (double)(long long)x; + return (x == y) ? y : y - 1; + } + else + { + /* The exponent is larger than the fraction bits. + This means the number is already an integer. */ + return x; + } + } +} diff --git a/sdk/lib/crt/math/math.cmake b/sdk/lib/crt/math/math.cmake index 1f4a4d5da2a..7cc7a795447 100644 --- a/sdk/lib/crt/math/math.cmake +++ b/sdk/lib/crt/math/math.cmake @@ -53,18 +53,17 @@ if(ARCH STREQUAL "i386") ) elseif(ARCH STREQUAL "amd64") list(APPEND LIBCNTPR_MATH_SOURCE + math/ceil.c math/cos.c math/sin.c + math/floor.c ) list(APPEND LIBCNTPR_MATH_ASM_SOURCE math/amd64/atan.S math/amd64/atan2.S - math/amd64/ceil.S math/amd64/exp.S math/amd64/fabs.S math/amd64/fabsf.S - math/amd64/floor.S - math/amd64/floorf.S math/amd64/fmod.S math/amd64/ldexp.S math/amd64/log.S @@ -78,7 +77,6 @@ elseif(ARCH STREQUAL "arm") math/cos.c math/fabs.c math/fabsf.c - math/floorf.c math/sin.c math/sqrt.c math/arm/__rt_sdiv.c @@ -131,6 +129,7 @@ if(NOT ARCH STREQUAL "i386") math/cos.c math/coshf.c math/expf.c + math/floorf.c math/fmodf.c math/log10f.c math/modff.c
2 years, 4 months
1
0
0
0
[reactos] 01/02: [CRT_APITEST] Add tests for ceil/floor
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2943ea2cfebfceba6de71…
commit 2943ea2cfebfceba6de71f09dfa3eda4a1a452dc Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Fri Aug 6 00:10:44 2021 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Fri Aug 26 00:44:46 2022 +0200 [CRT_APITEST] Add tests for ceil/floor --- modules/rostests/apitests/crt/ceil.c | 109 ++++++++++++++++++++ modules/rostests/apitests/crt/fabs.c | 4 +- modules/rostests/apitests/crt/floor.c | 111 +++++++++++++++++++++ .../rostests/apitests/crt/msvcrt_crt_apitest.cmake | 4 +- .../rostests/apitests/crt/static_crt_apitest.cmake | 4 +- modules/rostests/apitests/crt/testlist.c | 8 +- 6 files changed, 233 insertions(+), 7 deletions(-) diff --git a/modules/rostests/apitests/crt/ceil.c b/modules/rostests/apitests/crt/ceil.c new file mode 100644 index 00000000000..b63d5097949 --- /dev/null +++ b/modules/rostests/apitests/crt/ceil.c @@ -0,0 +1,109 @@ +/* + * PROJECT: ReactOS API tests + * LICENSE: MIT (
https://spdx.org/licenses/MIT
) + * PURPOSE: Tests for ceil / ceilf + * COPYRIGHT: Copyright 2021 Timo Kreuzer <timo.kreuzer(a)reactos.org> + */ + +#if !defined(_CRTBLD) && !defined(_M_IX86) +#define _CRTBLD // we don't want inline ceilf! +#endif +#include "math_helpers.h" + +#ifdef _MSC_VER +#pragma function(ceil) +// ceilf is not available as an intrinsic +#endif + +static TESTENTRY_DBL s_ceil_tests[] = +{ + /* Special values */ + { 0x0000000000000000 /* 0.000000000000000e+000 */, 0x0000000000000000 /* 0.000000000000000e+000 */ }, + { 0x8000000000000000 /* -0.000000000000000e+000 */, 0x8000000000000000 /* 0.000000000000000e+000 */ }, + { 0x7ff0000000000000 /* 1.#INF00000000000e+000 */, 0x7ff0000000000000 /* 1.#INF00000000000e+000 */ }, + { 0x7ff0000000000001 /* 1.#QNAN0000000000e+000 */, 0x7ff8000000000001 /* 1.#QNAN0000000000e+000 */ }, + { 0x7ff7ffffffffffff /* 1.#QNAN0000000000e+000 */, 0x7fffffffffffffff /* 1.#QNAN0000000000e+000 */ }, + { 0x7ff8000000000000 /* 1.#QNAN0000000000e+000 */, 0x7ff8000000000000 /* 1.#QNAN0000000000e+000 */ }, + { 0x7ff8000000000001 /* 1.#QNAN0000000000e+000 */, 0x7ff8000000000001 /* 1.#QNAN0000000000e+000 */ }, + { 0x7fffffffffffffff /* 1.#QNAN0000000000e+000 */, 0x7fffffffffffffff /* 1.#QNAN0000000000e+000 */ }, + { 0xfff0000000000000 /* -1.#INF00000000000e+000 */, 0xfff0000000000000 /* -1.#INF00000000000e+000 */ }, + { 0xfff0000000000001 /* -1.#QNAN0000000000e+000 */, 0xfff8000000000001 /* -1.#QNAN0000000000e+000 */ }, + { 0xfff7ffffffffffff /* -1.#QNAN0000000000e+000 */, 0xffffffffffffffff /* -1.#QNAN0000000000e+000 */ }, + { 0xfff8000000000000 /* -1.#IND00000000000e+000 */, 0xfff8000000000000 /* -1.#IND00000000000e+000 */ }, + { 0xfff8000000000001 /* -1.#QNAN0000000000e+000 */, 0xfff8000000000001 /* -1.#QNAN0000000000e+000 */ }, + { 0xffffffffffffffff /* -1.#QNAN0000000000e+000 */, 0xffffffffffffffff /* -1.#QNAN0000000000e+000 */ }, + + /* Some random floats */ + { 0x84be2329aed66ce1 /* -7.916792434840887e-286 */, 0x8000000000000000 /* -0.000000000000000e+000 */ }, + { 0xf1499052ebe9bbf1 /* -5.202012813127544e+237 */, 0xf1499052ebe9bbf1 /* -5.202012813127544e+237 */ }, + { 0x3cdba6b3993e0c87 /* 1.534948721304537e-015 */, 0x3ff0000000000000 /* 1.000000000000000e+000 */ }, + { 0x1c0d5e24de47b706 /* 1.484236768428990e-173 */, 0x3ff0000000000000 /* 1.000000000000000e+000 */ }, + { 0xc84d12b3a68bbb43 /* -1.978609508743937e+040 */, 0xc84d12b3a68bbb43 /* -1.978609508743937e+040 */ }, + { 0x7d5a031f1f253809 /* 6.645271626742043e+295 */, 0x7d5a031f1f253809 /* 6.645271626742043e+295 */ }, + { 0xfccbd45d3b45f596 /* -1.388583322422121e+293 */, 0xfccbd45d3b45f596 /* -1.388583322422121e+293 */ }, + { 0x0a890d1332aedb1c /* 6.517185427488806e-258 */, 0x3ff0000000000000 /* 1.000000000000000e+000 */ }, + { 0xee509a20fd367840 /* -2.400484647490954e+223 */, 0xee509a20fd367840 /* -2.400484647490954e+223 */ }, + { 0xf6324912dc497d9e /* -2.249167320514119e+261 */, 0xf6324912dc497d9e /* -2.249167320514119e+261 */ }, +}; + + +void Test_ceil(void) +{ + int i; + + for (i = 0; i < _countof(s_ceil_tests); i++) + { + double x = u64_to_dbl(s_ceil_tests[i].x); + double z = ceil(x); + ok_eq_dbl_exact("ceil", s_ceil_tests[i].x, z, s_ceil_tests[i].result); + } +} + +static TESTENTRY_FLT s_ceilf_tests[] = +{ + /* Special values */ + { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x80000000 /* -0.000000e+000 */, 0x80000000 /* 0.000000e+000 */ }, + { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x00000001 /* 1.401298e-045 */, 0x3f800000 /* 1.000000e+000 */ }, + { 0xffffffff /* -1.#QNAN0e+000 */, 0xffffffff /* -1.#QNAN0e+000 */ }, + { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x00000001 /* 1.401298e-045 */, 0x3f800000 /* 1.000000e+000 */ }, + { 0xffffffff /* -1.#QNAN0e+000 */, 0xffffffff /* -1.#QNAN0e+000 */ }, + { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x00000001 /* 1.401298e-045 */, 0x3f800000 /* 1.000000e+000 */ }, + { 0xffffffff /* -1.#QNAN0e+000 */, 0xffffffff /* -1.#QNAN0e+000 */ }, + { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x00000001 /* 1.401298e-045 */, 0x3f800000 /* 1.000000e+000 */ }, + { 0xffffffff /* -1.#QNAN0e+000 */, 0xffffffff /* -1.#QNAN0e+000 */ }, + + /* Some random floats */ + { 0xf2144fad /* -2.937607e+030 */, 0xf2144fad /* -2.937607e+030 */ }, + { 0xd0664044 /* -1.545189e+010 */, 0xd0664044 /* -1.545189e+010 */ }, + { 0xb730c46b /* -1.053615e-005 */, 0x80000000 /* -0.000000e+000 */ }, + { 0x22a13b32 /* 4.370181e-018 */, 0x3f800000 /* 1.000000e+000 */ }, + { 0x9d9122f6 /* -3.841733e-021 */, 0x80000000 /* -0.000000e+000 */ }, + { 0xda1f8be1 /* -1.122708e+016 */, 0xda1f8be1 /* -1.122708e+016 */ }, + { 0x0299cab0 /* 2.259767e-037 */, 0x3f800000 /* 1.000000e+000 */ }, + { 0x499d72b9 /* 1.289815e+006 */, 0x499d72c0 /* 1.289816e+006 */ }, + { 0xc57e802c /* -4.072011e+003 */, 0xc57e8000 /* -4.072000e+003 */ }, + { 0x80e9d599 /* -2.147430e-038 */, 0x80000000 /* -0.000000e+000 */ }, +}; + +void Test_ceilf(void) +{ + int i; + + for (i = 0; i < _countof(s_ceilf_tests); i++) + { + float x = u32_to_flt(s_ceilf_tests[i].x); + float z = ceilf(x); + ok_eq_flt_exact("ceilf", s_ceilf_tests[i].x, z, s_ceilf_tests[i].result); + } +} + +START_TEST(ceil) +{ + Test_ceil(); + Test_ceilf(); +} diff --git a/modules/rostests/apitests/crt/fabs.c b/modules/rostests/apitests/crt/fabs.c index eec1f761757..d4b2c8f51d9 100644 --- a/modules/rostests/apitests/crt/fabs.c +++ b/modules/rostests/apitests/crt/fabs.c @@ -5,8 +5,8 @@ * COPYRIGHT: Copyright 2021 Timo Kreuzer <timo.kreuzer(a)reactos.org> */ -/* Don't use the inline ceilf, unless required */ -#if defined(TEST_STATIC_CRT) || defined(_M_ARM) +/* Don't use the inline fabsf, unless required */ +#if !defined(_CRTBLD) && defined(_M_ARM) #define _CRTBLD #endif #include "math_helpers.h" diff --git a/modules/rostests/apitests/crt/floor.c b/modules/rostests/apitests/crt/floor.c new file mode 100644 index 00000000000..beb6cb9ec7c --- /dev/null +++ b/modules/rostests/apitests/crt/floor.c @@ -0,0 +1,111 @@ +/* + * PROJECT: ReactOS API tests + * LICENSE: MIT (
https://spdx.org/licenses/MIT
) + * PURPOSE: Tests for floor / floorf + * COPYRIGHT: Copyright 2021 Timo Kreuzer <timo.kreuzer(a)reactos.org> + */ + +#if !defined(_CRTBLD) && !defined(_M_IX86) +#define _CRTBLD // we don't want inline floorf! +#endif +#include "math_helpers.h" + +#ifdef _MSC_VER +#pragma function(floor) +#ifdef _M_AMD64 +#pragma function(floorf) +#endif +#endif + +static TESTENTRY_DBL s_floor_tests[] = +{ + /* Special values */ + { 0x0000000000000000 /* 0.000000000000000e+000 */, 0x0000000000000000 /* 0.000000000000000e+000 */ }, + { 0x8000000000000000 /* -0.000000000000000e+000 */, 0x8000000000000000 /* -0.000000000000000e+000 */ }, + { 0x7ff0000000000000 /* 1.#INF00000000000e+000 */, 0x7ff0000000000000 /* 1.#INF00000000000e+000 */ }, + { 0x7ff0000000000001 /* 1.#QNAN0000000000e+000 */, 0x7ff8000000000001 /* 1.#QNAN0000000000e+000 */ }, + { 0x7ff7ffffffffffff /* 1.#QNAN0000000000e+000 */, 0x7fffffffffffffff /* 1.#QNAN0000000000e+000 */ }, + { 0x7ff8000000000000 /* 1.#QNAN0000000000e+000 */, 0x7ff8000000000000 /* 1.#QNAN0000000000e+000 */ }, + { 0x7ff8000000000001 /* 1.#QNAN0000000000e+000 */, 0x7ff8000000000001 /* 1.#QNAN0000000000e+000 */ }, + { 0x7fffffffffffffff /* 1.#QNAN0000000000e+000 */, 0x7fffffffffffffff /* 1.#QNAN0000000000e+000 */ }, + { 0xfff0000000000000 /* -1.#INF00000000000e+000 */, 0xfff0000000000000 /* -1.#INF00000000000e+000 */ }, + { 0xfff0000000000001 /* -1.#QNAN0000000000e+000 */, 0xfff8000000000001 /* -1.#QNAN0000000000e+000 */ }, + { 0xfff7ffffffffffff /* -1.#QNAN0000000000e+000 */, 0xffffffffffffffff /* -1.#QNAN0000000000e+000 */ }, + { 0xfff8000000000000 /* -1.#IND00000000000e+000 */, 0xfff8000000000000 /* -1.#IND00000000000e+000 */ }, + { 0xfff8000000000001 /* -1.#QNAN0000000000e+000 */, 0xfff8000000000001 /* -1.#QNAN0000000000e+000 */ }, + { 0xffffffffffffffff /* -1.#QNAN0000000000e+000 */, 0xffffffffffffffff /* -1.#QNAN0000000000e+000 */ }, + + /* Some random doubles */ + { 0x386580c747a3402b /* 5.055340589883462e-037 */, 0x0000000000000000 /* 0.000000000000000e+000 */ }, + { 0xb74298e6627fb9ed /* -1.667860443847725e-042 */, 0xbff0000000000000 /* -1.000000000000000e+000 */ }, + { 0x0ef25f06e414aa2d /* 1.128498317470960e-236 */, 0x0000000000000000 /* 0.000000000000000e+000 */ }, + { 0x24002a37167638b5 /* 2.780001692929186e-135 */, 0x0000000000000000 /* 0.000000000000000e+000 */ }, + { 0x44258d1be62a0d22 /* 1.987747995999515e+020 */, 0x44258d1be62a0d22 /* 1.987747995999515e+020 */ }, + { 0x9ed4e46a65aad464 /* -3.715074250469020e-160 */, 0xbff0000000000000 /* -1.000000000000000e+000 */ }, + { 0xc5afcd6f4ae4bf41 /* -4.921195330852160e+027 */, 0xc5afcd6f4ae4bf41 /* -4.921195330852160e+027 */ }, + { 0x330fac896cbb01d2 /* 9.624395081137827e-063 */, 0x0000000000000000 /* 0.000000000000000e+000 */ }, + { 0xc18026ab4c845405 /* -3.387120956461338e+007 */, 0xc18026ab50000000 /* -3.387121000000000e+007 */ }, + { 0x2f42a7dc898a741a /* 4.916804395045249e-081 */, 0x0000000000000000 /* 0.000000000000000e+000 */ }, +}; + + +void Test_floor(void) +{ + int i; + + for (i = 0; i < _countof(s_floor_tests); i++) + { + double x = u64_to_dbl(s_floor_tests[i].x); + double z = floor(x); + ok_eq_dbl_exact("floor", s_floor_tests[i].x, z, s_floor_tests[i].result); + } +} + +static TESTENTRY_FLT s_floorf_tests[] = +{ + /* Special values */ + { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x00000001 /* 1.401298e-045 */, 0x00000000 /* 0.000000e+000 */ }, + { 0xffffffff /* -1.#QNAN0e+000 */, 0xffffffff /* -1.#QNAN0e+000 */ }, + { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x00000001 /* 1.401298e-045 */, 0x00000000 /* 0.000000e+000 */ }, + { 0xffffffff /* -1.#QNAN0e+000 */, 0xffffffff /* -1.#QNAN0e+000 */ }, + { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x00000001 /* 1.401298e-045 */, 0x00000000 /* 0.000000e+000 */ }, + { 0xffffffff /* -1.#QNAN0e+000 */, 0xffffffff /* -1.#QNAN0e+000 */ }, + { 0x00000000 /* 0.000000e+000 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x00000001 /* 1.401298e-045 */, 0x00000000 /* 0.000000e+000 */ }, + { 0xffffffff /* -1.#QNAN0e+000 */, 0xffffffff /* -1.#QNAN0e+000 */ }, + + /* Some random floats */ + { 0x386580c7 /* 5.471779e-005 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x47a3402b /* 8.358434e+004 */, 0x47a34000 /* 8.358400e+004 */ }, + { 0xb74298e6 /* -1.159890e-005 */, 0xbf800000 /* -1.000000e+000 */ }, + { 0x627fb9ed /* 1.179329e+021 */, 0x627fb9ed /* 1.179329e+021 */ }, + { 0x0ef25f06 /* 5.974911e-030 */, 0x00000000 /* 0.000000e+000 */ }, + { 0xe414aa2d /* -1.096952e+022 */, 0xe414aa2d /* -1.096952e+022 */ }, + { 0x24002a37 /* 2.779133e-017 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x167638b5 /* 1.988962e-025 */, 0x00000000 /* 0.000000e+000 */ }, + { 0x44258d1b /* 6.622048e+002 */, 0x44258000 /* 6.620000e+002 */ }, + { 0xe62a0d22 /* -2.007611e+023 */, 0xe62a0d22 /* -2.007611e+023 */ }, +}; + +void Test_floorf(void) +{ + int i; + + for (i = 0; i < _countof(s_floorf_tests); i++) + { + float x = u32_to_flt(s_floorf_tests[i].x); + float z = floorf(x); + ok_eq_flt_exact("floorf", s_floorf_tests[i].x, z, s_floorf_tests[i].result); + } +} + +START_TEST(floor) +{ + Test_floor(); + Test_floorf(); +} diff --git a/modules/rostests/apitests/crt/msvcrt_crt_apitest.cmake b/modules/rostests/apitests/crt/msvcrt_crt_apitest.cmake index 87fe0a611a2..4677f90fbfa 100644 --- a/modules/rostests/apitests/crt/msvcrt_crt_apitest.cmake +++ b/modules/rostests/apitests/crt/msvcrt_crt_apitest.cmake @@ -1017,7 +1017,7 @@ list(APPEND SOURCE_MSVCRT # bsearch_s # btowc.c # calloc.c -# ceil.c + ceil.c # clearerr.c # clearerr_s # clock.c @@ -1038,7 +1038,7 @@ list(APPEND SOURCE_MSVCRT # fgets.c # fgetwc.c # fgetws.c -# floor.c + floor.c # fmod.c # fopen.c # fopen_s.c diff --git a/modules/rostests/apitests/crt/static_crt_apitest.cmake b/modules/rostests/apitests/crt/static_crt_apitest.cmake index a6c905d9396..eb84fd5b145 100644 --- a/modules/rostests/apitests/crt/static_crt_apitest.cmake +++ b/modules/rostests/apitests/crt/static_crt_apitest.cmake @@ -7,7 +7,9 @@ list(APPEND SOURCE_STATIC _vsnprintf.c _vsnwprintf.c atexit.c + ceil.c fabs.c + floor.c fpcontrol.c mbstowcs.c mbtowc.c @@ -37,7 +39,7 @@ elseif(ARCH STREQUAL "arm") endif() add_executable(static_crt_apitest EXCLUDE_FROM_ALL testlist.c ${SOURCE_STATIC}) -target_compile_definitions(static_crt_apitest PRIVATE TEST_STATIC_CRT wine_dbgstr_an=wine_dbgstr_an_ wine_dbgstr_wn=wine_dbgstr_wn_) +target_compile_definitions(static_crt_apitest PRIVATE TEST_STATIC_CRT _CRTBLD wine_dbgstr_an=wine_dbgstr_an_ wine_dbgstr_wn=wine_dbgstr_wn_) target_link_libraries(static_crt_apitest crt wine ${PSEH_LIB}) set_module_type(static_crt_apitest win32cui) add_importlibs(static_crt_apitest kernel32 ntdll) diff --git a/modules/rostests/apitests/crt/testlist.c b/modules/rostests/apitests/crt/testlist.c index e85222f671c..fd746d39011 100644 --- a/modules/rostests/apitests/crt/testlist.c +++ b/modules/rostests/apitests/crt/testlist.c @@ -18,8 +18,10 @@ extern void func___64tof(void); #if defined(TEST_NTDLL) extern void func__vscwprintf(void); #endif -extern void func_fpcontrol(void); +extern void func_ceil(void); extern void func_fabs(void); +extern void func_floor(void); +extern void func_fpcontrol(void); extern void func_fputc(void); extern void func_fputwc(void); extern void func__snprintf(void); @@ -62,10 +64,12 @@ const struct test winetest_testlist[] = // ... #endif #if defined(TEST_STATIC_CRT) || defined(TEST_MSVCRT) + { "ceil", func_ceil }, + { "fabs", func_fabs }, + { "floor", func_floor }, #ifdef _M_AMD64 // x86 / arm need fixing { "fpcontrol", func_fpcontrol }, #endif - { "fabs", func_fabs }, #if defined(_M_ARM) { "__rt_div", func___rt_div }, { "__fto64", func___fto64 },
2 years, 4 months
1
0
0
0
[reactos] 01/01: [KBSWITCH] Fix GetNextLayout for three or more languages (#4629)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e8b830d6bfdf2786df197…
commit e8b830d6bfdf2786df197a803b7c6babc8a2430b Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Aug 26 06:33:39 2022 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Fri Aug 26 06:33:39 2022 +0900 [KBSWITCH] Fix GetNextLayout for three or more languages (#4629) Typing Alt+Shift should work cyclically. CORE-11737 --- base/applications/kbswitch/kbswitch.c | 62 ++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/base/applications/kbswitch/kbswitch.c b/base/applications/kbswitch/kbswitch.c index c931aee98f5..aac2c895d9a 100644 --- a/base/applications/kbswitch/kbswitch.c +++ b/base/applications/kbswitch/kbswitch.c @@ -296,7 +296,8 @@ ActivateLayout(HWND hwnd, ULONG uLayoutNum) TCHAR szLayoutNum[CCH_ULONG_DEC + 1], szLCID[CCH_LAYOUT_ID + 1], szLangName[MAX_PATH]; LANGID LangID; - if (uLayoutNum == (ULONG)-1 || uLayoutNum > 0xFF) /* Invalid */ + /* The layout number starts from one. Zero is invalid */ + if (uLayoutNum == 0 || uLayoutNum > 0xFF) /* Invalid */ return; _ultot(uLayoutNum, szLayoutNum, 10); @@ -349,6 +350,40 @@ BuildLeftPopupMenu(VOID) return hMenu; } +static ULONG +GetMaxLayoutNum(VOID) +{ + HKEY hKey; + ULONG dwIndex, dwSize, uLayoutNum, uMaxLayoutNum = 0; + TCHAR szLayoutNum[CCH_ULONG_DEC + 1], szLayoutID[CCH_LAYOUT_ID + 1]; + + /* Get the maximum layout number in the Preload key */ + if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0, + KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) + { + for (dwIndex = 0; ; dwIndex++) + { + dwSize = sizeof(szLayoutNum); + if (RegEnumValue(hKey, dwIndex, szLayoutNum, &dwSize, NULL, NULL, + NULL, NULL) != ERROR_SUCCESS) + { + break; + } + + if (GetLayoutID(szLayoutNum, szLayoutID, ARRAYSIZE(szLayoutID))) + { + uLayoutNum = _ttoi(szLayoutNum); + if (uMaxLayoutNum < uLayoutNum) + uMaxLayoutNum = uLayoutNum; + } + } + + RegCloseKey(hKey); + } + + return uMaxLayoutNum; +} + BOOL SetHooks(VOID) { @@ -380,26 +415,21 @@ ULONG GetNextLayout(VOID) { TCHAR szLayoutNum[3 + 1], szLayoutID[CCH_LAYOUT_ID + 1]; - ULONG Ret = ulCurrentLayoutNum; + ULONG uLayoutNum, uMaxNum = GetMaxLayoutNum(); - _ultot(ulCurrentLayoutNum, szLayoutNum, 10); - if (!GetLayoutID(szLayoutNum, szLayoutID, ARRAYSIZE(szLayoutID))) + for (uLayoutNum = ulCurrentLayoutNum + 1; ; ++uLayoutNum) { - return -1; - } - - _ultot(Ret + 1, szLayoutNum, 10); + if (uLayoutNum > uMaxNum) + uLayoutNum = 1; + if (uLayoutNum == ulCurrentLayoutNum) + break; - if (GetLayoutID(szLayoutNum, szLayoutID, ARRAYSIZE(szLayoutID))) - { - return (Ret + 1); + _ultot(uLayoutNum, szLayoutNum, 10); + if (GetLayoutID(szLayoutNum, szLayoutID, ARRAYSIZE(szLayoutID))) + return uLayoutNum; } - _ultot(Ret - 1, szLayoutNum, 10); - if (GetLayoutID(szLayoutNum, szLayoutID, ARRAYSIZE(szLayoutID))) - return (Ret - 1); - - return -1; + return ulCurrentLayoutNum; } LRESULT
2 years, 4 months
1
0
0
0
[reactos] 01/01: [RAPPS] Really update progress bar text (#4633)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b4114030a225c39b67b92…
commit b4114030a225c39b67b922ff7bb0581559f933df Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Aug 26 06:29:19 2022 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Fri Aug 26 06:29:19 2022 +0900 [RAPPS] Really update progress bar text (#4633) - Invalidate rectangle at CDownloaderProgress::OnSetText. - Unsubclass the progress bar if necessary. - Set zero to the progress for each download beginning. CORE-14686 --- base/applications/rapps/loaddlg.cpp | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/base/applications/rapps/loaddlg.cpp b/base/applications/rapps/loaddlg.cpp index de35ef65aa0..e3f2c7129d6 100644 --- a/base/applications/rapps/loaddlg.cpp +++ b/base/applications/rapps/loaddlg.cpp @@ -177,6 +177,11 @@ public: SetWindowText(ProgressText.GetString()); } + LRESULT OnEraseBkgnd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) + { + return TRUE; + } + LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { PAINTSTRUCT ps; @@ -207,7 +212,7 @@ public: &myRect, DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE, GetSysColor(COLOR_CAPTIONTEXT), - GetSysColor(COLOR_3DSHADOW), + GetSysColor(COLOR_3DDKSHADOW), 1, 1); /* transfer the off-screen DC to the screen */ @@ -224,15 +229,28 @@ public: LRESULT OnSetText(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { - if (lParam) + PCWSTR pszText = (PCWSTR)lParam; + if (pszText) { - m_szProgressText = (PCWSTR) lParam; + if (m_szProgressText != pszText) + { + m_szProgressText = pszText; + InvalidateRect(NULL, TRUE); + } } - return 0; + else + { + if (!m_szProgressText.IsEmpty()) + { + m_szProgressText.Empty(); + InvalidateRect(NULL, TRUE); + } + } + return TRUE; } BEGIN_MSG_MAP(CDownloaderProgress) - MESSAGE_HANDLER(WM_ERASEBKGND, OnPaint) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_SETTEXT, OnSetText) END_MSG_MAP() @@ -431,6 +449,8 @@ INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM w ProgressBar.SubclassWindow(Item); ProgressBar.SendMessage(PBM_SETRANGE, 0, MAKELPARAM(0, 100)); ProgressBar.SendMessage(PBM_SETPOS, 0, 0); + if (AppsDownloadList.GetSize() > 0) + ProgressBar.SetProgress(0, AppsDownloadList[0].SizeInBytes); } // Add a ListView @@ -474,6 +494,8 @@ INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM w return FALSE; case WM_CLOSE: + if (ProgressBar) + ProgressBar.UnsubclassWindow(TRUE); if (CDownloadManager::bModal) { ::EndDialog(Dlg, 0); @@ -597,8 +619,8 @@ unsigned int WINAPI CDownloadManager::ThreadFunc(LPVOID param) if (Item) { ProgressBar.SetMarquee(FALSE); - ProgressBar.SetWindowText(L""); ProgressBar.SendMessage(PBM_SETPOS, 0, 0); + ProgressBar.SetProgress(0, InfoArray[iAppId].SizeInBytes); } // is this URL an update package for RAPPS? if so store it in a different place
2 years, 4 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
Results per page:
10
25
50
100
200