From 7c9151c1e630b3f6fdec00a41ba67c9546b5119c Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 17 Mar 2015 10:03:13 -0500 Subject: [PATCH] shell32: Allow updating knownfolder definitions. --- dlls/shell32/shellpath.c | 3 --- dlls/shell32/tests/shellpath.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 84e663b4e62..56ead5fb776 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -3931,9 +3931,6 @@ static HRESULT WINAPI foldermanager_RegisterFolder( if(SUCCEEDED(hr)) { - if(dwDisp == REG_OPENED_EXISTING_KEY) - hr = E_FAIL; - if(SUCCEEDED(hr)) hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, szCategory, 0, REG_DWORD, (LPBYTE)&pKFD->category, sizeof(pKFD->category))); diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index 3b18760435d..7b042387d74 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -2458,6 +2458,26 @@ static void test_knownFolders(void) hr = IKnownFolder_Release(folder); ok(hr == S_OK, "failed to release KnownFolder instance: 0x%08x\n", hr); + + /* update the folder */ + CoTaskMemFree(kfDefinition.pszName); + kfDefinition.pszName = CoTaskMemAlloc(sizeof(sExample2)); + lstrcpyW(kfDefinition.pszName, sExample2); + hr = IKnownFolderManager_RegisterFolder(mgr, &newFolderId, &kfDefinition); + ok(hr == S_OK, "failed to re-register known folder: 0x%08x\n", hr); + + hr = IKnownFolderManager_GetFolder(mgr, &newFolderId, &folder); + ok(hr == S_OK, "failed to get known folder: 0x%08x\n", hr); + + hr = IKnownFolder_GetFolderDefinition(folder, &kfSubDefinition); + ok(hr == S_OK, "failed to get folder definition: 0x%08x\n", hr); + ok(!memcmp(kfDefinition.pszName, kfSubDefinition.pszName, sizeof(sExample2)), + "Got wrong updated name: %s\n", wine_dbgstr_w(kfSubDefinition.pszName)); + + FreeKnownFolderDefinitionFields(&kfSubDefinition); + + hr = IKnownFolder_Release(folder); + ok(hr == S_OK, "failed to release KnownFolder instance: 0x%08x\n", hr); } hr = IKnownFolderManager_UnregisterFolder(mgr, &newFolderId);