Mariusz Pluciński : shell32: IKnownFolder:: SetPath modified to use redirection instead of overwriting original path.

Alexandre Julliard julliard at winehq.org
Fri Jul 1 14:11:04 CDT 2011


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

Author: Mariusz Pluciński <vshader at gmail.com>
Date:   Thu Jun 30 14:58:53 2011 +0200

shell32: IKnownFolder::SetPath modified to use redirection instead of overwriting original path.

---

 dlls/shell32/shellpath.c       |   19 +------------------
 dlls/shell32/tests/shellpath.c |    7 -------
 2 files changed, 1 insertions(+), 25 deletions(-)

diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index 66c376e..598122f 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -3459,8 +3459,6 @@ static HRESULT WINAPI knownfolder_SetPath(
 {
     struct knownfolder *knownfolder = impl_from_IKnownFolder( iface );
     HRESULT hr = S_OK;
-    HKEY hKey;
-    WCHAR szPath[MAX_PATH];
 
     TRACE("(%p, 0x%08x, %p)\n", knownfolder, dwFlags, debugstr_w(pszPath));
 
@@ -3469,22 +3467,7 @@ static HRESULT WINAPI knownfolder_SetPath(
         hr = E_FAIL;
 
     if(SUCCEEDED(hr))
-    {
-        if(dwFlags & KF_FLAG_DONT_UNEXPAND)
-            lstrcpyW(szPath, pszPath);
-        else
-            hr = ( ExpandEnvironmentStringsW(pszPath, szPath, sizeof(szPath)/sizeof(szPath[0]))!=0 ? S_OK : HRESULT_FROM_WIN32(GetLastError()));
-    }
-
-    if(SUCCEEDED(hr))
-        hr = HRESULT_FROM_WIN32(RegOpenKeyExW(HKEY_LOCAL_MACHINE, knownfolder->registryPath, 0, KEY_SET_VALUE, &hKey));
-
-    if(SUCCEEDED(hr))
-    {
-        hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, szRelativePath, 0, REG_SZ, (LPBYTE)pszPath, (lstrlenW(pszPath)+1)*sizeof(WCHAR)));
-
-        RegCloseKey(hKey);
-    }
+        hr = redirect_known_folder(&knownfolder->id, NULL, 0, pszPath, 0, NULL, NULL);
 
     return hr;
 }
diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c
index 9387ff9..932aa0e 100644
--- a/dlls/shell32/tests/shellpath.c
+++ b/dlls/shell32/tests/shellpath.c
@@ -1256,7 +1256,6 @@ static void test_knownFolders(void)
                             /* verify */
                             hr = IKnownFolder_GetPath(folder, 0, &folderPath);
                             ok(hr == S_OK, "failed to get known folder path: 0x%08x\n", hr);
-                            todo_wine
                             ok(lstrcmpiW(folderPath, sExamplePath)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath), wine_dbgstr_w(sExamplePath));
                             CoTaskMemFree(folderPath);
 
@@ -1292,14 +1291,12 @@ static void test_knownFolders(void)
                             /* verify */
                             hr = IKnownFolder_GetPath(folder, 0, &folderPath);
                             ok(hr == S_OK, "failed to get known folder path: 0x%08x\n", hr);
-                            todo_wine
                             ok(lstrcmpiW(folderPath, sExamplePath)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath), wine_dbgstr_w(sExamplePath));
                             CoTaskMemFree(folderPath);
 
                             /* verify sub folder */
                             hr = IKnownFolder_GetPath(subFolder, 0, &folderPath);
                             ok(hr == S_OK, "failed to get known folder path: 0x%08x\n", hr);
-                            todo_wine
                             ok(lstrcmpiW(folderPath, sSubFolderPath)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath), wine_dbgstr_w(sSubFolderPath));
                             CoTaskMemFree(folderPath);
 
@@ -1335,14 +1332,12 @@ static void test_knownFolders(void)
                             /* verify */
                             hr = IKnownFolder_GetPath(folder, 0, &folderPath);
                             ok(hr == S_OK, "failed to get known folder path: 0x%08x\n", hr);
-                            todo_wine
                             ok(lstrcmpiW(folderPath, sExamplePath)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath), wine_dbgstr_w(sExamplePath));
                             CoTaskMemFree(folderPath);
 
                             /* verify sub folder */
                             hr = IKnownFolder_GetPath(subFolder, 0, &folderPath);
                             ok(hr == S_OK, "failed to get known folder path: 0x%08x\n", hr);
-                            todo_wine
                             ok(lstrcmpiW(folderPath, sSubFolderPath)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath), wine_dbgstr_w(sSubFolderPath));
                             CoTaskMemFree(folderPath);
 
@@ -1374,14 +1369,12 @@ static void test_knownFolders(void)
                             /* verify */
                             hr = IKnownFolder_GetPath(folder, 0, &folderPath);
                             ok(hr == S_OK, "failed to get known folder path: 0x%08x\n", hr);
-                            todo_wine
                             ok(lstrcmpiW(folderPath, sExamplePath)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath), wine_dbgstr_w(sExamplePath));
                             CoTaskMemFree(folderPath);
 
                             /* verify sub folder */
                             hr = IKnownFolder_GetPath(subFolder, 0, &folderPath);
                             ok(hr == S_OK, "failed to get known folder path: 0x%08x\n", hr);
-                            todo_wine
                             ok(lstrcmpiW(folderPath, sSubFolderPath)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath), wine_dbgstr_w(sSubFolderPath));
                             CoTaskMemFree(folderPath);
 




More information about the wine-cvs mailing list