Index: base/applications/mscutils/eventvwr/eventvwr.c
===================================================================
--- base/applications/mscutils/eventvwr/eventvwr.c	(revision 67563)
+++ base/applications/mscutils/eventvwr/eventvwr.c	(working copy)
@@ -228,7 +228,7 @@
                          KEY_READ,
                          &hSourceKey) == ERROR_SUCCESS)
         {
-            dwSize = MAX_PATH;
+            dwSize = sizeof(szModuleName);
             if (RegQueryValueExW(hSourceKey,
                                 EntryName,
                                 NULL,
Index: base/applications/mstsc/connectdialog.c
===================================================================
--- base/applications/mstsc/connectdialog.c	(revision 67563)
+++ base/applications/mstsc/connectdialog.c	(working copy)
@@ -138,7 +138,7 @@
                 if(RegOpenKeyExW(hKey, szName, 0, KEY_READ, &hSubKey) != ERROR_SUCCESS)
                     break;
 
-                dwSize = MAXVALUE;
+                dwSize = MAXVALUE * sizeof(WCHAR);
 
                 if(RegQueryValueExW(hKey, L"UsernameHint", 0,  NULL, (LPBYTE)szValue, &dwSize) == ERROR_SUCCESS)
                 {
@@ -185,7 +185,7 @@
                                 NULL);
             if (ret == ERROR_SUCCESS)
             {
-                size = MAX_KEY_NAME;
+                size = MAX_KEY_NAME * sizeof(WCHAR);
                 if (RegQueryValueExW(hKey,
                                      Name,
                                      0,
Index: base/applications/rapps/installed.c
===================================================================
--- base/applications/rapps/installed.c	(revision 67563)
+++ base/applications/rapps/installed.c	(working copy)
@@ -11,7 +11,7 @@
 BOOL
 GetApplicationString(HKEY hKey, LPWSTR lpKeyName, LPWSTR lpString)
 {
-    DWORD dwSize = MAX_PATH;
+    DWORD dwSize = MAX_PATH * sizeof(WCHAR);
 
     if (RegQueryValueExW(hKey,
                          lpKeyName,
@@ -50,7 +50,7 @@
         if (RegOpenKeyW(hKey, szName, &hSubKey) == ERROR_SUCCESS)
         {
             dwType = REG_SZ;
-            dwSize = MAX_PATH;
+            dwSize = sizeof(szDisplayName);
             if (RegQueryValueExW(hSubKey,
                                  L"DisplayName",
                                  NULL,
@@ -118,7 +118,7 @@
     hKey = ItemInfo->hSubKey;
 
     dwType = REG_SZ;
-    dwSize = MAX_PATH;
+    dwSize = sizeof(szPath);
     if (RegQueryValueExW(hKey,
                          bModify ? szModify : szUninstall,
                          NULL,
@@ -254,7 +254,7 @@
             }
 
             dwType = REG_SZ;
-            dwSize = MAX_PATH;
+            dwSize = sizeof(pszParentKeyName);
             bIsUpdate = (RegQueryValueExW(Info.hSubKey,
                                           L"ParentKeyName",
                                           NULL,
@@ -262,7 +262,7 @@
                                           (LPBYTE)pszParentKeyName,
                                           &dwSize) == ERROR_SUCCESS);
 
-            dwSize = MAX_PATH;
+            dwSize = sizeof(pszDisplayName);
             if (RegQueryValueExW(Info.hSubKey,
                                  L"DisplayName",
                                  NULL,
Index: base/applications/rapps_new/installed.cpp
===================================================================
--- base/applications/rapps_new/installed.cpp	(revision 67563)
+++ base/applications/rapps_new/installed.cpp	(working copy)
@@ -11,7 +11,7 @@
 BOOL
 GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR lpString)
 {
-    DWORD dwSize = MAX_PATH;
+    DWORD dwSize = MAX_PATH * sizeof(WCHAR);
 
     if (RegQueryValueExW(hKey,
                          lpKeyName,
@@ -50,7 +50,7 @@
         if (RegOpenKeyW(hKey, szName, &hSubKey) == ERROR_SUCCESS)
         {
             dwType = REG_SZ;
-            dwSize = MAX_PATH;
+            dwSize = sizeof(szDisplayName);
             if (RegQueryValueExW(hSubKey,
                                  L"DisplayName",
                                  NULL,
@@ -118,7 +118,7 @@
     hKey = ItemInfo->hSubKey;
 
     dwType = REG_SZ;
-    dwSize = MAX_PATH;
+    dwSize = sizeof(szPath);
     if (RegQueryValueExW(hKey,
                          bModify ? szModify : szUninstall,
                          NULL,
@@ -254,7 +254,7 @@
             }
 
             dwType = REG_SZ;
-            dwSize = MAX_PATH;
+            dwSize = sizeof(pszParentKeyName);
             bIsUpdate = (RegQueryValueExW(Info.hSubKey,
                                           L"ParentKeyName",
                                           NULL,
@@ -262,7 +262,7 @@
                                           (LPBYTE)pszParentKeyName,
                                           &dwSize) == ERROR_SUCCESS);
 
-            dwSize = MAX_PATH;
+            dwSize = sizeof(pszDisplayName);
             if (RegQueryValueExW(Info.hSubKey,
                                  L"DisplayName",
                                  NULL,
Index: base/applications/regedit/framewnd.c
===================================================================
--- base/applications/regedit/framewnd.c	(revision 67563)
+++ base/applications/regedit/framewnd.c	(working copy)
@@ -774,7 +774,7 @@
     if (RegOpenKeyExW(HKEY_CURRENT_USER, s_szFavoritesRegKey, 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
         goto done;
 
-    cbData = (sizeof(szFavoritePath) / sizeof(szFavoritePath[0])) - 1;
+    cbData = sizeof(szFavoritePath);
     memset(szFavoritePath, 0, sizeof(szFavoritePath));
     if (RegQueryValueExW(hKey, pszFavorite, NULL, &dwType, (LPBYTE) szFavoritePath, &cbData) != ERROR_SUCCESS)
         goto done;
Index: base/applications/taskmgr/debug.c
===================================================================
--- base/applications/taskmgr/debug.c	(revision 67563)
+++ base/applications/taskmgr/debug.c	(working copy)
@@ -61,7 +61,7 @@
         return;
     }
 
-    dwDebuggerSize = 260;
+    dwDebuggerSize = sizeof(strDebugger);
     if (RegQueryValueExW(hKey, L"Debugger", NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) != ERROR_SUCCESS)
     {
         GetLastErrorText(strErrorText, 260);
Index: base/applications/taskmgr/procpage.c
===================================================================
--- base/applications/taskmgr/procpage.c	(revision 67563)
+++ base/applications/taskmgr/procpage.c	(working copy)
@@ -390,7 +390,7 @@
 
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
     {
-        dwDebuggerSize = 260;
+        dwDebuggerSize = sizeof(strDebugger);
         if (RegQueryValueExW(hKey, L"Debugger", NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS)
         {
             CharUpper(strDebugger);
Index: base/system/services/rpcserver.c
===================================================================
--- base/system/services/rpcserver.c	(revision 67563)
+++ base/system/services/rpcserver.c	(working copy)
@@ -856,7 +856,7 @@
         if (dwError != ERROR_SUCCESS)
             return dwError;
 
-        dwSize = MAX_PATH;
+        dwSize = MAX_PATH * sizeof(WCHAR);
 
         /* Check for the DependOnService Value */
         dwError = RegQueryValueExW(hServiceEnumKey,
Index: base/system/winlogon/setup.c
===================================================================
--- base/system/winlogon/setup.c	(revision 67563)
+++ base/system/winlogon/setup.c	(working copy)
@@ -80,7 +80,7 @@
         return FALSE;
 
     /* Read key */
-    dwSize = (sizeof(Shell) / sizeof(Shell[0])) - 1;
+    dwSize = sizeof(Shell);
     dwError = RegQueryValueExW(hKey,
                                L"CmdLine",
                                NULL,
Index: dll/cpl/timedate/timezone.c
===================================================================
--- dll/cpl/timedate/timezone.c	(revision 67563)
+++ dll/cpl/timedate/timezone.c	(working copy)
@@ -106,7 +106,7 @@
             break;
         }
 
-        dwValueSize = 64 * sizeof(WCHAR);
+        dwValueSize = sizeof(Entry->Description);
         lError = RegQueryValueExW(hZoneKey,
                              L"Display",
                              NULL,
@@ -121,7 +121,7 @@
             continue;
         }
 
-        dwValueSize = 33 * sizeof(WCHAR);
+        dwValueSize = sizeof(Entry->StandardName);
         if (RegQueryValueExW(hZoneKey,
                              L"Std",
                              NULL,
Index: dll/cpl/wined3dcfg/general.c
===================================================================
--- dll/cpl/wined3dcfg/general.c	(revision 67563)
+++ dll/cpl/wined3dcfg/general.c	(working copy)
@@ -51,7 +51,7 @@
 void InitControl(HWND hWndDlg, HKEY hKey, PWCHAR szKey, PWINED3D_SETTINGS pSettings, INT iControlId, INT iCount)
 {
     WCHAR szBuffer[MAX_KEY_LENGTH];
-    DWORD dwSize = MAX_KEY_LENGTH;
+    DWORD dwSize = sizeof(szBuffer);
     DWORD dwType = 0;
     INT iCurrent;
     INT iActive = 0;
Index: dll/win32/advpack/advpack.c
===================================================================
--- dll/win32/advpack/advpack.c	(revision 67563)
+++ dll/win32/advpack/advpack.c	(working copy)
@@ -899,7 +899,7 @@
 {
     HKEY setup, guid;
     WCHAR stub[MAX_PATH];
-    DWORD size = MAX_PATH;
+    DWORD size = sizeof(stub);
     HRESULT hr = S_OK;
     BOOL res;
 
Index: dll/win32/avicap32/avicap32.c
===================================================================
--- dll/win32/avicap32/avicap32.c	(revision 67563)
+++ dll/win32/avicap32/avicap32.c	(working copy)
@@ -179,7 +179,7 @@
     {
         if (RegOpenKeyW(hKey, szDriver, &hSubKey) == ERROR_SUCCESS)
         {
-            dwSize = sizeof(szFileName) / sizeof(WCHAR);
+            dwSize = sizeof(szFileName);
 
             if (RegQueryValueExW(hSubKey,
                                  L"Driver",
@@ -188,7 +188,7 @@
                                  (LPBYTE)&szFileName,
                                  &dwSize) == ERROR_SUCCESS)
             {
-                dwSize = sizeof(szDriverName) / sizeof(WCHAR);
+                dwSize = sizeof(szDriverName);
 
                 if (RegQueryValueExW(hSubKey,
                                      L"FriendlyName",
Index: dll/win32/mscoree/metahost.c
===================================================================
--- dll/win32/mscoree/metahost.c	(revision 67563)
+++ dll/win32/mscoree/metahost.c	(working copy)
@@ -377,7 +377,7 @@
     if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, dotnet_key, 0, KEY_READ, &key))
         return FALSE;
 
-    len = MAX_PATH;
+    len = MAX_PATH * sizeof(WCHAR);
     if (RegQueryValueExW(key, install_root, 0, NULL, (LPBYTE)install_dir, &len))
     {
         RegCloseKey(key);
Index: dll/win32/netcfgx/tcpipconf_notify.c
===================================================================
--- dll/win32/netcfgx/tcpipconf_notify.c	(revision 67563)
+++ dll/win32/netcfgx/tcpipconf_notify.c	(working copy)
@@ -2666,7 +2666,7 @@
         RegQueryValueExW(hKey, L"RegisterAdapterName", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegisterAdapterName, &dwSize);
         RegQueryValueExW(hKey, L"RegistrationEnabled", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegistrationEnabled, &dwSize);
 
-        dwSize = sizeof(This->pCurrentConfig->pDNS->szDomain) / sizeof(WCHAR);
+        dwSize = sizeof(szBuffer);
         RegQueryValueExW(hKey, L"Domain", NULL, NULL, (LPBYTE)szBuffer, &dwSize);
 
         RegCloseKey(hKey);
Index: dll/win32/powrprof/powrprof.c
===================================================================
--- dll/win32/powrprof/powrprof.c	(revision 67563)
+++ dll/win32/powrprof/powrprof.c	(working copy)
@@ -299,7 +299,7 @@
         return FALSE;
     }
 
-    dwSize = MAX_PATH;
+    dwSize = MAX_PATH * sizeof(WCHAR);
     Err = RegQueryValueExW(hKey, L"CurrentPowerPolicy",
                            NULL, NULL,
                            (LPBYTE)&szBuf, &dwSize);
Index: dll/win32/secur32/sspi.c
===================================================================
--- dll/win32/secur32/sspi.c	(revision 67563)
+++ dll/win32/secur32/sspi.c	(working copy)
@@ -737,7 +737,7 @@
     if (apiRet == ERROR_SUCCESS)
     {
         WCHAR securityPkgNames[MAX_PATH]; /* arbitrary len */
-        DWORD size = sizeof(securityPkgNames) / sizeof(WCHAR), type;
+        DWORD size = sizeof(securityPkgNames), type;
 
         apiRet = RegQueryValueExW(key, securityProvidersW, NULL, &type,
          (PBYTE)securityPkgNames, &size);
Index: dll/win32/setupapi/install.c
===================================================================
--- dll/win32/setupapi/install.c	(revision 67563)
+++ dll/win32/setupapi/install.c	(working copy)
@@ -228,7 +228,8 @@
     if (RegQueryValueExW( hkey, value, NULL, &type, NULL, &size )) return;
     if (type != REG_MULTI_SZ) return;
 
-    if (!(buffer = HeapAlloc( GetProcessHeap(), 0, (size + str_size) * sizeof(WCHAR) ))) return;
+    size = size + str_size * sizeof(WCHAR) ;
+    if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size))) return;
     if (RegQueryValueExW( hkey, value, NULL, NULL, (BYTE *)buffer, &size )) goto done;
 
     /* compare each string against all the existing ones */
@@ -271,7 +272,7 @@
     if (RegQueryValueExW( hkey, value, NULL, &type, NULL, &size )) return;
     if (type != REG_MULTI_SZ) return;
     /* allocate double the size, one for value before and one for after */
-    if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size * 2 * sizeof(WCHAR) ))) return;
+    if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size * 2))) return;
     if (RegQueryValueExW( hkey, value, NULL, NULL, (BYTE *)buffer, &size )) goto done;
     src = buffer;
     dst = buffer + size;
Index: dll/win32/setupapi/interface.c
===================================================================
--- dll/win32/setupapi/interface.c	(revision 67563)
+++ dll/win32/setupapi/interface.c	(working copy)
@@ -232,7 +232,7 @@
 
             /* Step 2. Create an interface list for this element */
             HeapFree(GetProcessHeap(), 0, pSymbolicLink);
-            pSymbolicLink = HeapAlloc(GetProcessHeap(), 0, (dwLength + 1) * sizeof(WCHAR));
+            pSymbolicLink = HeapAlloc(GetProcessHeap(), 0, dwLength + 1);
             if (!pSymbolicLink)
             {
                 rc = ERROR_NOT_ENOUGH_MEMORY;
Index: dll/win32/shell32/wine/shellpath.c
===================================================================
--- dll/win32/shell32/wine/shellpath.c	(revision 67563)
+++ dll/win32/shell32/wine/shellpath.c	(working copy)
@@ -1375,7 +1375,7 @@
     HRESULT hr;
     WCHAR shellFolderPath[MAX_PATH], userShellFolderPath[MAX_PATH];
     LPCWSTR pShellFolderPath, pUserShellFolderPath;
-    DWORD dwType, dwPathLen = MAX_PATH;
+    DWORD dwType, dwPathLen = MAX_PATH * sizeof(WCHAR);
     HKEY userShellFolderKey, shellFolderKey;
 
     TRACE("%p,%s,%s,%p\n",rootKey, debugstr_w(userPrefix), debugstr_w(value),
Index: dll/win32/shlwapi/ordinal.c
===================================================================
--- dll/win32/shlwapi/ordinal.c	(revision 67563)
+++ dll/win32/shlwapi/ordinal.c	(working copy)
@@ -4042,7 +4042,7 @@
  */
 HRESULT WINAPI SHLoadRegUIStringW(HKEY hkey, LPCWSTR value, LPWSTR buf, DWORD size)
 {
-    DWORD type, sz = size;
+    DWORD type, sz = size * sizeof(WCHAR);
 
     if(RegQueryValueExW(hkey, value, NULL, &type, (LPBYTE)buf, &sz) != ERROR_SUCCESS)
         return E_FAIL;
Index: dll/win32/uxtheme/system.c
===================================================================
--- dll/win32/uxtheme/system.c	(revision 67563)
+++ dll/win32/uxtheme/system.c	(working copy)
@@ -81,7 +81,7 @@
 static DWORD query_reg_path (HKEY hKey, LPCWSTR lpszValue,
                              LPVOID pvData)
 {
-  DWORD dwRet, dwType, dwUnExpDataLen = MAX_PATH, dwExpDataLen;
+  DWORD dwRet, dwType, dwUnExpDataLen = MAX_PATH * sizeof(WCHAR), dwExpDataLen;
 
   TRACE("(hkey=%p,%s,%p)\n", hKey, debugstr_w(lpszValue),
         pvData);
@@ -194,7 +194,7 @@
         /* Get current theme configuration */
         if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
             TRACE("Loading theme config\n");
-            buffsize = sizeof(tmp)/sizeof(tmp[0]);
+            buffsize = sizeof(tmp);
             if(!RegQueryValueExW(hKey, szThemeActive, NULL, NULL, (LPBYTE)tmp, &buffsize)) {
                 bThemeActive = (tmp[0] != '0');
             }
@@ -202,10 +202,10 @@
                 bThemeActive = FALSE;
                 TRACE("Failed to get ThemeActive: %d\n", GetLastError());
             }
-            buffsize = sizeof(szCurrentColor)/sizeof(szCurrentColor[0]);
+            buffsize = sizeof(szCurrentColor);
             if(RegQueryValueExW(hKey, szColorName, NULL, NULL, (LPBYTE)szCurrentColor, &buffsize))
                 szCurrentColor[0] = '\0';
-            buffsize = sizeof(szCurrentSize)/sizeof(szCurrentSize[0]);
+            buffsize = sizeof(szCurrentSize);
             if(RegQueryValueExW(hKey, szSizeName, NULL, NULL, (LPBYTE)szCurrentSize, &buffsize))
                 szCurrentSize[0] = '\0';
             if (query_reg_path (hKey, szDllName, szCurrentTheme))
@@ -618,7 +618,7 @@
     Result = RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey);
     if (Result == ERROR_SUCCESS)
     {
-        buffsize = sizeof(tmp)/sizeof(tmp[0]);
+        buffsize = sizeof(tmp);
         if (!RegQueryValueExW(hKey, szThemeActive, NULL, NULL, (LPBYTE)tmp, &buffsize)) 
             bActive = (tmp[0] != '0');
         RegCloseKey(hKey);
Index: dll/win32/winmm/playsound.c
===================================================================
--- dll/win32/winmm/playsound.c	(revision 67563)
+++ dll/win32/winmm/playsound.c	(working copy)
@@ -130,7 +130,7 @@
         if (err != 0)
             goto none;
     }
-    count = sizeof(str)/sizeof(str[0]);
+    count = sizeof(str);
     err = RegQueryValueExW(hSnd, NULL, 0, &type, (LPBYTE)str, &count);
     RegCloseKey(hSnd);
     if (err != 0 || !*str) goto none;
Index: dll/win32/ws2_32_new/src/nscatent.c
===================================================================
--- dll/win32/ws2_32_new/src/nscatent.c	(revision 67563)
+++ dll/win32/ws2_32_new/src/nscatent.c	(working copy)
@@ -67,7 +67,7 @@
     CHAR CatalogEntryName[13];
     HKEY EntryKey;
     ULONG RegType = REG_SZ;
-    ULONG RegSize = MAX_PATH;
+    ULONG RegSize = MAX_PATH * sizeof(WCHAR);
 
     /* Convert to a 00000xxx string */
     sprintf(CatalogEntryName, "%0""12""i", (int)UniqueId);
