Add patch to implement KF_FLAG_DEFAULT_PATH for SHGetKnownFolderPath.

This commit is contained in:
Sebastian Lackner
2014-08-23 01:40:17 +02:00
parent e2f3ff5808
commit 0f9f7dc428
4 changed files with 77 additions and 1 deletions

View File

@@ -0,0 +1,52 @@
From 12199f1bcc3fabab52034df4362a5b3c4e93337d Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 23 Aug 2014 01:34:38 +0200
Subject: shell32: Implement KF_FLAG_DEFAULT_PATH flag for
SHGetKnownFolderPath.
---
dlls/shell32/shellpath.c | 6 ++++--
dlls/shell32/tests/shellpath.c | 5 +++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index e361483..600e002 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -3104,13 +3104,15 @@ 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, (flags & KF_FLAG_DEFAULT_PATH) ?
+ SHGFP_TYPE_DEFAULT : SHGFP_TYPE_CURRENT, 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.7.9.5

View File

@@ -0,0 +1,4 @@
Author: Sebastian Lackner
Subject: Implement KF_FLAG_DEFAULT_PATH flag for SHGetKnownFolderPath.
Revision: 1
Fixes: [30385] Support for KF_FLAG_DEFAULT_PATH in SHGetKnownFolderPath