From: CzBiX Subject: shell32: Implemented KF_FLAG_DEFAULT_PATH for SHGetKnownFolderPath. (try 2) Message-Id: Date: Sun, 24 Aug 2014 13:29:40 +0800 Fixes http://bugs.winehq.org/show_bug.cgi?id=30385 This patch supersedes patch ​ ​ 105969 try 2: correct author name Rgd, VRan
Fixes http://bugs.winehq.org/show_bug.cgi?id=30385

This patch supersedes patch
​ ​
105969

try 2:
correct author name

Rgd,
VRan
From d8e846ffcf34b6db5722d44b74f7d547c667d059 Mon Sep 17 00:00:00 2001 From: VRan Liu Date: Mon, 11 Aug 2014 15:00:53 +0800 Subject: shell32: Implemented KF_FLAG_DEFAULT_PATH for SHGetKnownFolderPath. --- dlls/shell32/shellpath.c | 7 +++++-- dlls/shell32/tests/shellpath.c | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index e361483..ff8527b 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -3084,6 +3084,8 @@ HRESULT WINAPI SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE t HRESULT hr; WCHAR folder[MAX_PATH]; int index = csidl_from_id( rfid ); + SHGFP_TYPE type = (flags & KF_FLAG_DEFAULT_PATH) + ? SHGFP_TYPE_DEFAULT : SHGFP_TYPE_CURRENT; TRACE("%s, 0x%08x, %p, %p\n", debugstr_guid(rfid), flags, token, path); @@ -3104,13 +3106,14 @@ HRESULT WINAPI SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE t if (flags & KF_FLAG_INIT) index |= CSIDL_FLAG_PER_USER_INIT; - if (flags & ~(KF_FLAG_CREATE|KF_FLAG_DONT_VERIFY|KF_FLAG_NO_ALIAS|KF_FLAG_INIT)) + if (flags & ~(KF_FLAG_CREATE|KF_FLAG_DONT_VERIFY|KF_FLAG_NO_ALIAS + |KF_FLAG_INIT|KF_FLAG_DEFAULT_PATH)) { FIXME("flags 0x%08x not supported\n", flags); return E_INVALIDARG; } - hr = SHGetFolderPathW( NULL, index, token, 0, folder ); + hr = SHGetFolderPathW( NULL, index, token, type, folder ); if (SUCCEEDED(hr)) { *path = CoTaskMemAlloc( (strlenW( folder ) + 1) * sizeof(WCHAR) ); diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index efdfbbd..f518a7a 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -861,6 +861,11 @@ if (0) { /* crashes */ ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(path != NULL, "expected path != NULL\n"); + path = NULL; + hr = pSHGetKnownFolderPath(&FOLDERID_Desktop, KF_FLAG_DEFAULT_PATH, NULL, &path); + ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); + ok(path != NULL, "expected path != NULL\n"); + hr = pSHGetFolderPathEx(&FOLDERID_Desktop, 0, NULL, buffer, MAX_PATH); ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(!lstrcmpiW(path, buffer), "expected equal paths\n"); -- 1.9.1