From: Stefan Leichter Subject: shell32: Create Links folder in user profile folder to make SHGetKnownFolderPath working for KNOWNFOLDERID_Links (with test) (try2) Message-Id: <201407292223.05049.Stefan.Leichter@camline.com> Date: Tue, 29 Jul 2014 22:23:04 +0200 --- dlls/shell32/shellpath.c | 4 ++++ dlls/shell32/tests/shellpath.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 158b1d1..431ff78 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -2747,6 +2747,10 @@ static HRESULT create_extra_folders(void) HKEY hkey; DWORD type, size, ret; + hr = SHGetFolderPathAndSubDirW( 0, CSIDL_PROFILE | CSIDL_FLAG_CREATE, NULL, + SHGFP_TYPE_DEFAULT, LinksW, path ); + if (FAILED(hr)) return hr; + ret = RegCreateKeyW( HKEY_CURRENT_USER, environW, &hkey ); if (ret) return HRESULT_FROM_WIN32( ret ); diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index efdfbbd..36674b3 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -857,6 +857,12 @@ if (0) { /* crashes */ ok(path == NULL, "got %p\n", path); path = NULL; + hr = pSHGetKnownFolderPath(&FOLDERID_Links, 0, INVALID_HANDLE_VALUE, &path); + ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); + ok(path != NULL, "expected path != NULL\n"); + CoTaskMemFree(path); + + path = NULL; hr = pSHGetKnownFolderPath(&FOLDERID_Desktop, 0, NULL, &path); ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(path != NULL, "expected path != NULL\n");