Mariusz Pluciński : shell32/tests: Add tests for SHGet /SetKnownFolderPath utilities.

Alexandre Julliard julliard at winehq.org
Tue Jun 14 11:57:49 CDT 2011


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

Author: Mariusz Pluciński <vshader at gmail.com>
Date:   Tue Jun 14 13:09:31 2011 +0200

shell32/tests: Add tests for SHGet/SetKnownFolderPath utilities.

---

 dlls/shell32/tests/shellpath.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c
index 5e27c9e..ee38e4e 100644
--- a/dlls/shell32/tests/shellpath.c
+++ b/dlls/shell32/tests/shellpath.c
@@ -95,6 +95,7 @@ static int (WINAPI *pSHFileOperationA)(LPSHFILEOPSTRUCTA);
 static HRESULT (WINAPI *pSHGetMalloc)(LPMALLOC *);
 static UINT (WINAPI *pGetSystemWow64DirectoryA)(LPSTR,UINT);
 static HRESULT (WINAPI *pSHGetKnownFolderPath)(REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR *);
+static HRESULT (WINAPI *pSHSetKnownFolderPath)(REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR);
 static HRESULT (WINAPI *pSHGetFolderPathEx)(REFKNOWNFOLDERID, DWORD, HANDLE, LPWSTR, DWORD);
 
 static DLLVERSIONINFO shellVersion = { 0 };
@@ -194,6 +195,7 @@ static void loadShell32(void)
     GET_PROC(SHGetFolderPathEx)
     GET_PROC(SHGetFolderLocation)
     GET_PROC(SHGetKnownFolderPath)
+    GET_PROC(SHSetKnownFolderPath)
     GET_PROC(SHGetSpecialFolderPathA)
     GET_PROC(SHGetSpecialFolderLocation)
     GET_PROC(ILFindLastID)
@@ -1214,6 +1216,28 @@ static void test_knownFolders(void)
                     ok(lstrcmpiW(folderPath, sExamplePath)==0, "invalid known folder path retreived: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath), wine_dbgstr_w(sExamplePath));
                     CoTaskMemFree(folderPath);
 
+                    /* check shell utility functions */
+                    if(!pSHGetKnownFolderPath || !pSHSetKnownFolderPath)
+                        todo_wine
+                        win_skip("cannot get SHGet/SetKnownFolderPath routines\n");
+                    else
+                    {
+                        /* check shell utility functions */
+                        /* try to get current known folder path */
+                        hr = pSHGetKnownFolderPath(&newFolderId, 0, NULL, &folderPath);
+                        ok(hr==S_OK, "cannot get known folder path: hr=0x%0x\n", hr);
+                        ok(lstrcmpW(folderPath, sExamplePath)==0, "invalid path returned: %s\n", wine_dbgstr_w(folderPath));
+
+                        /* set it to new value */
+                        hr = pSHSetKnownFolderPath(&newFolderId, 0, NULL, sExample2Path);
+                        ok(hr==S_OK, "cannot set known folder path: hr=0x%0x\n", hr);
+
+                        /* check if it changed */
+                        hr = pSHGetKnownFolderPath(&newFolderId, 0, NULL, &folderPath);
+                        ok(hr==S_OK, "cannot get known folder path: hr=0x%0x\n", hr);
+                        ok(lstrcmpW(folderPath, sExample2Path)==0, "invalid path returned: %s\n", wine_dbgstr_w(folderPath));
+                    }
+
                     hr = IKnownFolder_Release(folder);
                     ok(hr == S_OK, "failed to release KnownFolder instance: 0x%08x\n", hr);
                 }




More information about the wine-cvs mailing list