[INPUT.CPL]

- Remove an unneeded header inclusion;
- Fix a sizeof invocation;
- RegEnumKeyExW and RegEnumValueW take their fourth parameter (size of key / value name, resp.) as a size in number of *characters* (and not in number of bytes);
- Add a missing RegCloseKey call in LocaleList_Create.

svn path=/trunk/; revision=74385
This commit is contained in:
Hermès Bélusca-Maïto 2017-04-21 00:22:39 +00:00
parent 1836858f0a
commit e21e3e4e03
4 changed files with 9 additions and 10 deletions

View file

@ -1,7 +1,8 @@
#ifndef _INPUT_H #ifndef _INPUT_H
#define _INPUT_H #define _INPUT_H
#include <stdarg.h> #include <stdlib.h>
#include <wchar.h>
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#include <windef.h> #include <windef.h>
@ -13,9 +14,7 @@
#include <commctrl.h> #include <commctrl.h>
#include <windowsx.h> #include <windowsx.h>
#include <setupapi.h> #include <setupapi.h>
#include <wchar.h>
#include <strsafe.h> #include <strsafe.h>
#include <stdlib.h>
#include "resource.h" #include "resource.h"

View file

@ -22,9 +22,7 @@ ReadAttributes(VOID)
KEY_QUERY_VALUE, KEY_QUERY_VALUE,
&hKey) == ERROR_SUCCESS) &hKey) == ERROR_SUCCESS)
{ {
DWORD dwSize; DWORD dwSize = sizeof(dwAttributes);
dwSize = sizeof(dwSize);
RegQueryValueExW(hKey, RegQueryValueExW(hKey,
L"Attributes", L"Attributes",

View file

@ -104,7 +104,7 @@ LayoutList_Create(VOID)
return; return;
} }
dwSize = sizeof(szLayoutId); dwSize = ARRAYSIZE(szLayoutId);
while (RegEnumKeyExW(hKey, dwIndex, szLayoutId, &dwSize, while (RegEnumKeyExW(hKey, dwIndex, szLayoutId, &dwSize,
NULL, NULL, NULL, NULL) == ERROR_SUCCESS) NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
@ -230,7 +230,7 @@ NotTranslated:
RegCloseKey(hLayoutKey); RegCloseKey(hLayoutKey);
} }
dwSize = sizeof(szLayoutId); dwSize = ARRAYSIZE(szLayoutId);
++dwIndex; ++dwIndex;
} }

View file

@ -97,7 +97,7 @@ LocaleList_Create(VOID)
return NULL; return NULL;
} }
dwSize = sizeof(szValue); dwSize = ARRAYSIZE(szValue);
dwIndex = 0; dwIndex = 0;
while (RegEnumValueW(hKey, dwIndex, szValue, &dwSize, while (RegEnumValueW(hKey, dwIndex, szValue, &dwSize,
@ -115,10 +115,12 @@ LocaleList_Create(VOID)
LocaleList_Append(dwId, szName); LocaleList_Append(dwId, szName);
} }
dwSize = sizeof(szValue); dwSize = ARRAYSIZE(szValue);
++dwIndex; ++dwIndex;
} }
RegCloseKey(hKey);
return _LocaleList; return _LocaleList;
} }