shell32: Implemented KF_FLAG_DEFAULT_PATH for SHGetKnownFolderPath.
CzBiX
gliuwr at gmail.com
Mon Aug 11 02:32:40 CDT 2014
Fixes http://bugs.winehq.org/show_bug.cgi?id=30385
Rgd,
CzBiX
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20140811/08cc9333/attachment.html>
-------------- next part --------------
From d6d1ba39f0ecd1178ad4a59a40d4a7ff80da3ffe Mon Sep 17 00:00:00 2001
From: CzBiX <gliuwr at gmail.com>
Date: Mon, 11 Aug 2014 15:00:53 +0800
Subject: shell32: Implemented KF_FLAG_DEFAULT_PATH for SHGetKnownFolderPath.
---
dlls/shell32/shellpath.c | 8 ++++++--
dlls/shell32/tests/shellpath.c | 5 +++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index e361483..3ef4901 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -3104,13 +3104,17 @@ 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))
+ SHGFP_TYPE type = (flags & KF_FLAG_DEFAULT_PATH)
+ ? SHGFP_TYPE_DEFAULT : SHGFP_TYPE_CURRENT;
+
+ 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
More information about the wine-patches
mailing list