[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
#define _INPUT_H
#include <stdarg.h>
#include <stdlib.h>
#include <wchar.h>
#define WIN32_NO_STATUS
#include <windef.h>
@ -13,9 +14,7 @@
#include <commctrl.h>
#include <windowsx.h>
#include <setupapi.h>
#include <wchar.h>
#include <strsafe.h>
#include <stdlib.h>
#include "resource.h"

View file

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

View file

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

View file

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