Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shell32/shellpath.c | 15 ++++++++++++++- dlls/shell32/tests/shellpath.c | 13 +++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 7bfa504a62f..2f1573f8221 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -3529,11 +3529,24 @@ HRESULT WINAPI SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE t return HRESULT_FROM_WIN32( ERROR_FILE_NOT_FOUND );
if (flags & ~(KF_FLAG_CREATE|KF_FLAG_SIMPLE_IDLIST|KF_FLAG_DONT_UNEXPAND| - KF_FLAG_DONT_VERIFY|KF_FLAG_NO_ALIAS|KF_FLAG_INIT|KF_FLAG_DEFAULT_PATH)) + KF_FLAG_DONT_VERIFY|KF_FLAG_NO_ALIAS|KF_FLAG_INIT|KF_FLAG_DEFAULT_PATH|KF_FLAG_NOT_PARENT_RELATIVE)) { FIXME("flags 0x%08x not supported\n", flags); return E_INVALIDARG; } + + if ((flags & (KF_FLAG_DEFAULT_PATH | KF_FLAG_NOT_PARENT_RELATIVE)) == KF_FLAG_NOT_PARENT_RELATIVE) + { + WARN("Invalid flags mask %#x.\n", flags); + return E_INVALIDARG; + } + + if (flags & KF_FLAG_NOT_PARENT_RELATIVE) + { + FIXME("Ignoring KF_FLAG_NOT_PARENT_RELATIVE.\n"); + flags &= ~KF_FLAG_NOT_PARENT_RELATIVE; + } + folder |= flags & CSIDL_FLAG_MASK; shgfp_flags = flags & KF_FLAG_DEFAULT_PATH ? SHGFP_TYPE_DEFAULT : SHGFP_TYPE_CURRENT;
diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index 0ba3734c518..7d0f725158a 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -1910,6 +1910,19 @@ if (0) { /* crashes */ ok(!lstrcmpiW(path, path2), "expected equal paths: %s, %s\n", wine_dbgstr_w(path), wine_dbgstr_w(path2)); CoTaskMemFree(path2);
+ hr = pSHGetKnownFolderPath(folder_id, KF_FLAG_DEFAULT_PATH, NULL, &path2); + ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); + ok(path2 != NULL, "expected path != NULL\n"); + CoTaskMemFree(path2); + + hr = pSHGetKnownFolderPath(folder_id, KF_FLAG_NOT_PARENT_RELATIVE, NULL, &path2); + ok(hr == E_INVALIDARG, "expected S_OK, got 0x%08x\n", hr); + + hr = pSHGetKnownFolderPath(folder_id, KF_FLAG_DEFAULT_PATH | KF_FLAG_NOT_PARENT_RELATIVE, NULL, &path2); + ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); + ok(path2 != NULL, "expected path != NULL\n"); + CoTaskMemFree(path2); + CoTaskMemFree(path); }