Nikolay Sivov : shell32: Pass correct buffer length to RegQueryValueExW().

Alexandre Julliard julliard at winehq.org
Wed Feb 8 15:52:11 CST 2017


Module: wine
Branch: master
Commit: 0bfb97dcba29552b51d8609fcc6e7bbc04bb8320
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0bfb97dcba29552b51d8609fcc6e7bbc04bb8320

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Feb  8 14:55:57 2017 +0300

shell32: Pass correct buffer length to RegQueryValueExW().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shell32/shellpath.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index 9230623..8569b53 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -3209,8 +3209,8 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix,
     HRESULT hr;
     WCHAR shellFolderPath[MAX_PATH], userShellFolderPath[MAX_PATH];
     LPCWSTR pShellFolderPath, pUserShellFolderPath;
-    DWORD dwType, dwPathLen = MAX_PATH;
     HKEY userShellFolderKey, shellFolderKey;
+    DWORD dwType, dwPathLen;
 
     TRACE("%p,%s,%s,%p\n",rootKey, debugstr_w(userPrefix), debugstr_w(value),
      path);
@@ -3245,6 +3245,7 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix,
         return E_FAIL;
     }
 
+    dwPathLen = MAX_PATH * sizeof(WCHAR);
     if (!RegQueryValueExW(userShellFolderKey, value, NULL, &dwType,
      (LPBYTE)path, &dwPathLen) && (dwType == REG_EXPAND_SZ || dwType == REG_SZ))
     {




More information about the wine-cvs mailing list