mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 05:26:58 +00:00
[USER32] Improve CliGetPreloadKeyboardLayouts
CORE-11700
This commit is contained in:
parent
10acb335fa
commit
21feb529fe
|
@ -369,7 +369,7 @@ BOOL FASTCALL CliGetImeHotKeysFromRegistry(VOID)
|
||||||
|
|
||||||
VOID APIENTRY CliGetPreloadKeyboardLayouts(PBYTE pbFlags)
|
VOID APIENTRY CliGetPreloadKeyboardLayouts(PBYTE pbFlags)
|
||||||
{
|
{
|
||||||
WCHAR szValueName[8], szValue[16];
|
WCHAR szValueName[12], szValue[16];
|
||||||
UNICODE_STRING ustrValue;
|
UNICODE_STRING ustrValue;
|
||||||
DWORD dwKL, cbValue, dwType;
|
DWORD dwKL, cbValue, dwType;
|
||||||
UINT iNumber;
|
UINT iNumber;
|
||||||
|
@ -382,14 +382,17 @@ VOID APIENTRY CliGetPreloadKeyboardLayouts(PBYTE pbFlags)
|
||||||
|
|
||||||
for (iNumber = 1; iNumber < 1000; ++iNumber)
|
for (iNumber = 1; iNumber < 1000; ++iNumber)
|
||||||
{
|
{
|
||||||
StringCchPrintfW(szValueName, _countof(szValueName), L"%u", iNumber);
|
RtlIntegerToUnicode(iNumber, 10, sizeof(szValueName), szValueName);
|
||||||
|
|
||||||
cbValue = sizeof(szValue);
|
cbValue = sizeof(szValue);
|
||||||
error = RegQueryValueExW(hKey, szValueName, NULL, &dwType, (LPBYTE)szValue, &cbValue);
|
error = RegQueryValueExW(hKey, szValueName, NULL, &dwType, (LPBYTE)szValue, &cbValue);
|
||||||
if (error != ERROR_SUCCESS || dwType != REG_SZ)
|
if (error != ERROR_SUCCESS)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
szValue[_countof(szValue) - 1] = 0;
|
if (dwType != REG_SZ)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
szValue[_countof(szValue) - 1] = 0; /* Avoid stack overrun */
|
||||||
|
|
||||||
RtlInitUnicodeString(&ustrValue, szValue);
|
RtlInitUnicodeString(&ustrValue, szValue);
|
||||||
RtlUnicodeStringToInteger(&ustrValue, 16, &dwKL);
|
RtlUnicodeStringToInteger(&ustrValue, 16, &dwKL);
|
||||||
|
|
Loading…
Reference in a new issue