[INPUT.CPL]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Fri, 21 Apr 2017 00:22:39 +0000 (00:22 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Fri, 21 Apr 2017 00:22:39 +0000 (00:22 +0000)
- 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

reactos/dll/cpl/input/input.h
reactos/dll/cpl/input/key_settings_dialog.c
reactos/dll/cpl/input/layout_list.c
reactos/dll/cpl/input/locale_list.c

index eda9db9..2ddd82f 100644 (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"
 
index d62d97c..7a1076c 100644 (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",
index f082068..3541a81 100644 (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;
     }
 
index 4c415af..9d8b00c 100644 (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;
 }