Mariusz Pluciński : shell32: Check if known folder' s relative path was passed to function.

Alexandre Julliard julliard at winehq.org
Thu Aug 4 12:22:13 CDT 2011


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

Author: Mariusz Pluciński <vshader at gmail.com>
Date:   Thu Aug  4 16:26:33 2011 +0200

shell32: Check if known folder's relative path was passed to function.

All non-virtual known folders must have set relative path field.

---

 dlls/shell32/shellpath.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index 8336479..9898bc2 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -3846,9 +3846,18 @@ static HRESULT WINAPI foldermanager_RegisterFolder(
         }
 
         if(SUCCEEDED(hr) && pKFD->category != KF_CATEGORY_VIRTUAL)
-            hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, szRelativePath, 0, REG_SZ, (LPBYTE)pKFD->pszRelativePath, (lstrlenW(pKFD->pszRelativePath)+1)*sizeof(WCHAR) ));
+        {
+            if(!pKFD->pszRelativePath)
+                hr = E_INVALIDARG;
+
+            if(SUCCEEDED(hr))
+                hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, szRelativePath, 0, REG_SZ, (LPBYTE)pKFD->pszRelativePath, (lstrlenW(pKFD->pszRelativePath)+1)*sizeof(WCHAR) ));
+        }
 
         RegCloseKey(hKey);
+
+        if(FAILED(hr))
+            SHDeleteKeyW(HKEY_LOCAL_MACHINE, registryPath);
     }
 
     HeapFree(GetProcessHeap(), 0, registryPath);




More information about the wine-cvs mailing list