2 * Unit tests for shell32 SHGet{Special}Folder{Path|Location} functions.
4 * Copyright 2004 Juan Lang
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 * This is a test program for the SHGet{Special}Folder{Path|Location} functions
20 * of shell32, that get either a filesystem path or a LPITEMIDLIST (shell
21 * namespace) path for a given folder (CSIDL value).
33 #include "knownfolders.h"
35 #include "wine/test.h"
39 /* CSIDL_MYDOCUMENTS is now the same as CSIDL_PERSONAL, but what we want
40 * here is its original value.
42 #define OLD_CSIDL_MYDOCUMENTS 0x000c
44 DEFINE_GUID(GUID_NULL
,0,0,0,0,0,0,0,0,0,0,0);
47 #define ARRAY_SIZE(x) ( sizeof(x) / sizeof((x)[0]) )
50 /* from pidl.h, not included here: */
51 #ifndef PT_CPL /* Guess, Win7 uses this for CSIDL_CONTROLS */
52 #define PT_CPL 0x01 /* no path */
55 #define PT_GUID 0x1f /* no path */
58 #define PT_DRIVE 0x23 /* has path */
61 #define PT_DRIVE2 0x25 /* has path */
64 #define PT_SHELLEXT 0x2e /* no path */
67 #define PT_FOLDER 0x31 /* has path */
70 #define PT_FOLDERW 0x35 /* has path */
73 #define PT_WORKGRP 0x41 /* no path */
76 #define PT_YAGUID 0x70 /* no path */
78 /* FIXME: this is used for history/favorites folders; what's a better name? */
80 #define PT_IESPECIAL2 0xb1 /* has path */
83 static GUID CLSID_CommonDocuments
= { 0x0000000c, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x1a } };
85 struct shellExpectedValues
{
91 static HRESULT (WINAPI
*pDllGetVersion
)(DLLVERSIONINFO
*);
92 static HRESULT (WINAPI
*pSHGetFolderPathA
)(HWND
, int, HANDLE
, DWORD
, LPSTR
);
93 static HRESULT (WINAPI
*pSHGetFolderLocation
)(HWND
, int, HANDLE
, DWORD
,
95 static BOOL (WINAPI
*pSHGetSpecialFolderPathA
)(HWND
, LPSTR
, int, BOOL
);
96 static HRESULT (WINAPI
*pSHGetSpecialFolderLocation
)(HWND
, int, LPITEMIDLIST
*);
97 static LPITEMIDLIST (WINAPI
*pILFindLastID
)(LPCITEMIDLIST
);
98 static int (WINAPI
*pSHFileOperationA
)(LPSHFILEOPSTRUCTA
);
99 static HRESULT (WINAPI
*pSHGetMalloc
)(LPMALLOC
*);
100 static UINT (WINAPI
*pGetSystemWow64DirectoryA
)(LPSTR
,UINT
);
101 static HRESULT (WINAPI
*pSHGetKnownFolderPath
)(REFKNOWNFOLDERID
, DWORD
, HANDLE
, PWSTR
*);
102 static HRESULT (WINAPI
*pSHSetKnownFolderPath
)(REFKNOWNFOLDERID
, DWORD
, HANDLE
, PWSTR
);
103 static HRESULT (WINAPI
*pSHGetFolderPathEx
)(REFKNOWNFOLDERID
, DWORD
, HANDLE
, LPWSTR
, DWORD
);
104 static BOOL (WINAPI
*pPathYetAnotherMakeUniqueName
)(PWSTR
, PCWSTR
, PCWSTR
, PCWSTR
);
106 static DLLVERSIONINFO shellVersion
= { 0 };
107 static LPMALLOC pMalloc
;
108 static const BYTE guidType
[] = { PT_GUID
};
109 static const BYTE controlPanelType
[] = { PT_SHELLEXT
, PT_GUID
, PT_CPL
};
110 static const BYTE folderType
[] = { PT_FOLDER
, PT_FOLDERW
};
111 static const BYTE favoritesType
[] = { PT_FOLDER
, PT_FOLDERW
, 0, PT_IESPECIAL2
/* Win98 */ };
112 static const BYTE folderOrSpecialType
[] = { PT_FOLDER
, PT_IESPECIAL2
};
113 static const BYTE personalType
[] = { PT_FOLDER
, PT_GUID
, PT_DRIVE
, 0xff /* Win9x */,
114 PT_IESPECIAL2
/* Win98 */, 0 /* Vista */ };
115 /* FIXME: don't know the type of 0x71 returned by Vista/2008 for printers */
116 static const BYTE printersType
[] = { PT_YAGUID
, PT_SHELLEXT
, 0x71 };
117 static const BYTE ieSpecialType
[] = { PT_IESPECIAL2
};
118 static const BYTE shellExtType
[] = { PT_SHELLEXT
};
119 static const BYTE workgroupType
[] = { PT_WORKGRP
};
120 #define DECLARE_TYPE(x, y) { x, sizeof(y) / sizeof(y[0]), y }
121 static const struct shellExpectedValues requiredShellValues
[] = {
122 DECLARE_TYPE(CSIDL_BITBUCKET
, guidType
),
123 DECLARE_TYPE(CSIDL_CONTROLS
, controlPanelType
),
124 DECLARE_TYPE(CSIDL_COOKIES
, folderType
),
125 DECLARE_TYPE(CSIDL_DESKTOPDIRECTORY
, folderType
),
126 DECLARE_TYPE(CSIDL_DRIVES
, guidType
),
127 DECLARE_TYPE(CSIDL_FAVORITES
, favoritesType
),
128 DECLARE_TYPE(CSIDL_FONTS
, folderOrSpecialType
),
129 /* FIXME: the following fails in Wine, returns type PT_FOLDER
130 DECLARE_TYPE(CSIDL_HISTORY, ieSpecialType),
132 DECLARE_TYPE(CSIDL_INTERNET
, guidType
),
133 DECLARE_TYPE(CSIDL_NETHOOD
, folderType
),
134 DECLARE_TYPE(CSIDL_NETWORK
, guidType
),
135 DECLARE_TYPE(CSIDL_PERSONAL
, personalType
),
136 DECLARE_TYPE(CSIDL_PRINTERS
, printersType
),
137 DECLARE_TYPE(CSIDL_PRINTHOOD
, folderType
),
138 DECLARE_TYPE(CSIDL_PROGRAMS
, folderType
),
139 DECLARE_TYPE(CSIDL_RECENT
, folderOrSpecialType
),
140 DECLARE_TYPE(CSIDL_SENDTO
, folderType
),
141 DECLARE_TYPE(CSIDL_STARTMENU
, folderType
),
142 DECLARE_TYPE(CSIDL_STARTUP
, folderType
),
143 DECLARE_TYPE(CSIDL_TEMPLATES
, folderType
),
145 static const struct shellExpectedValues optionalShellValues
[] = {
146 /* FIXME: the following only semi-succeed; they return NULL PIDLs on XP.. hmm.
147 DECLARE_TYPE(CSIDL_ALTSTARTUP, folderType),
148 DECLARE_TYPE(CSIDL_COMMON_ALTSTARTUP, folderType),
149 DECLARE_TYPE(CSIDL_COMMON_OEM_LINKS, folderType),
151 /* Windows NT-only: */
152 DECLARE_TYPE(CSIDL_COMMON_DESKTOPDIRECTORY
, folderType
),
153 DECLARE_TYPE(CSIDL_COMMON_DOCUMENTS
, shellExtType
),
154 DECLARE_TYPE(CSIDL_COMMON_FAVORITES
, folderType
),
155 DECLARE_TYPE(CSIDL_COMMON_PROGRAMS
, folderType
),
156 DECLARE_TYPE(CSIDL_COMMON_STARTMENU
, folderType
),
157 DECLARE_TYPE(CSIDL_COMMON_STARTUP
, folderType
),
158 DECLARE_TYPE(CSIDL_COMMON_TEMPLATES
, folderType
),
159 /* first appearing in shell32 version 4.71: */
160 DECLARE_TYPE(CSIDL_APPDATA
, folderType
),
161 /* first appearing in shell32 version 4.72: */
162 DECLARE_TYPE(CSIDL_INTERNET_CACHE
, ieSpecialType
),
163 /* first appearing in shell32 version 5.0: */
164 DECLARE_TYPE(CSIDL_ADMINTOOLS
, folderType
),
165 DECLARE_TYPE(CSIDL_COMMON_APPDATA
, folderType
),
166 DECLARE_TYPE(CSIDL_LOCAL_APPDATA
, folderType
),
167 DECLARE_TYPE(OLD_CSIDL_MYDOCUMENTS
, folderType
),
168 DECLARE_TYPE(CSIDL_MYMUSIC
, folderType
),
169 DECLARE_TYPE(CSIDL_MYPICTURES
, folderType
),
170 DECLARE_TYPE(CSIDL_MYVIDEO
, folderType
),
171 DECLARE_TYPE(CSIDL_PROFILE
, folderType
),
172 DECLARE_TYPE(CSIDL_PROGRAM_FILES
, folderType
),
173 DECLARE_TYPE(CSIDL_PROGRAM_FILESX86
, folderType
),
174 DECLARE_TYPE(CSIDL_PROGRAM_FILES_COMMON
, folderType
),
175 DECLARE_TYPE(CSIDL_PROGRAM_FILES_COMMONX86
, folderType
),
176 DECLARE_TYPE(CSIDL_SYSTEM
, folderType
),
177 DECLARE_TYPE(CSIDL_WINDOWS
, folderType
),
178 /* first appearing in shell32 6.0: */
179 DECLARE_TYPE(CSIDL_CDBURN_AREA
, folderType
),
180 DECLARE_TYPE(CSIDL_COMMON_MUSIC
, folderType
),
181 DECLARE_TYPE(CSIDL_COMMON_PICTURES
, folderType
),
182 DECLARE_TYPE(CSIDL_COMMON_VIDEO
, folderType
),
183 DECLARE_TYPE(CSIDL_COMPUTERSNEARME
, workgroupType
),
184 DECLARE_TYPE(CSIDL_RESOURCES
, folderType
),
185 DECLARE_TYPE(CSIDL_RESOURCES_LOCALIZED
, folderType
),
189 static void loadShell32(void)
191 HMODULE hShell32
= GetModuleHandleA("shell32");
193 #define GET_PROC(func) \
194 p ## func = (void*)GetProcAddress(hShell32, #func); \
196 trace("GetProcAddress(%s) failed\n", #func);
198 GET_PROC(DllGetVersion
)
199 GET_PROC(SHGetFolderPathA
)
200 GET_PROC(SHGetFolderPathEx
)
201 GET_PROC(SHGetFolderLocation
)
202 GET_PROC(SHGetKnownFolderPath
)
203 GET_PROC(SHSetKnownFolderPath
)
204 GET_PROC(SHGetSpecialFolderPathA
)
205 GET_PROC(SHGetSpecialFolderLocation
)
206 GET_PROC(ILFindLastID
)
208 pILFindLastID
= (void *)GetProcAddress(hShell32
, (LPCSTR
)16);
209 GET_PROC(SHFileOperationA
)
210 GET_PROC(SHGetMalloc
)
211 GET_PROC(PathYetAnotherMakeUniqueName
)
213 ok(pSHGetMalloc
!= NULL
, "shell32 is missing SHGetMalloc\n");
216 HRESULT hr
= pSHGetMalloc(&pMalloc
);
218 ok(hr
== S_OK
, "SHGetMalloc failed: 0x%08x\n", hr
);
219 ok(pMalloc
!= NULL
, "SHGetMalloc returned a NULL IMalloc\n");
224 shellVersion
.cbSize
= sizeof(shellVersion
);
225 pDllGetVersion(&shellVersion
);
226 trace("shell32 version is %d.%d\n",
227 shellVersion
.dwMajorVersion
, shellVersion
.dwMinorVersion
);
232 #ifndef CSIDL_PROFILES
233 #define CSIDL_PROFILES 0x003e
236 /* A couple utility printing functions */
237 static const char *getFolderName(int folder
)
239 static char unknown
[32];
241 #define CSIDL_TO_STR(x) case x: return#x;
244 CSIDL_TO_STR(CSIDL_DESKTOP
);
245 CSIDL_TO_STR(CSIDL_INTERNET
);
246 CSIDL_TO_STR(CSIDL_PROGRAMS
);
247 CSIDL_TO_STR(CSIDL_CONTROLS
);
248 CSIDL_TO_STR(CSIDL_PRINTERS
);
249 CSIDL_TO_STR(CSIDL_PERSONAL
);
250 CSIDL_TO_STR(CSIDL_FAVORITES
);
251 CSIDL_TO_STR(CSIDL_STARTUP
);
252 CSIDL_TO_STR(CSIDL_RECENT
);
253 CSIDL_TO_STR(CSIDL_SENDTO
);
254 CSIDL_TO_STR(CSIDL_BITBUCKET
);
255 CSIDL_TO_STR(CSIDL_STARTMENU
);
256 CSIDL_TO_STR(OLD_CSIDL_MYDOCUMENTS
);
257 CSIDL_TO_STR(CSIDL_MYMUSIC
);
258 CSIDL_TO_STR(CSIDL_MYVIDEO
);
259 CSIDL_TO_STR(CSIDL_DESKTOPDIRECTORY
);
260 CSIDL_TO_STR(CSIDL_DRIVES
);
261 CSIDL_TO_STR(CSIDL_NETWORK
);
262 CSIDL_TO_STR(CSIDL_NETHOOD
);
263 CSIDL_TO_STR(CSIDL_FONTS
);
264 CSIDL_TO_STR(CSIDL_TEMPLATES
);
265 CSIDL_TO_STR(CSIDL_COMMON_STARTMENU
);
266 CSIDL_TO_STR(CSIDL_COMMON_PROGRAMS
);
267 CSIDL_TO_STR(CSIDL_COMMON_STARTUP
);
268 CSIDL_TO_STR(CSIDL_COMMON_DESKTOPDIRECTORY
);
269 CSIDL_TO_STR(CSIDL_APPDATA
);
270 CSIDL_TO_STR(CSIDL_PRINTHOOD
);
271 CSIDL_TO_STR(CSIDL_LOCAL_APPDATA
);
272 CSIDL_TO_STR(CSIDL_ALTSTARTUP
);
273 CSIDL_TO_STR(CSIDL_COMMON_ALTSTARTUP
);
274 CSIDL_TO_STR(CSIDL_COMMON_FAVORITES
);
275 CSIDL_TO_STR(CSIDL_INTERNET_CACHE
);
276 CSIDL_TO_STR(CSIDL_COOKIES
);
277 CSIDL_TO_STR(CSIDL_HISTORY
);
278 CSIDL_TO_STR(CSIDL_COMMON_APPDATA
);
279 CSIDL_TO_STR(CSIDL_WINDOWS
);
280 CSIDL_TO_STR(CSIDL_SYSTEM
);
281 CSIDL_TO_STR(CSIDL_PROGRAM_FILES
);
282 CSIDL_TO_STR(CSIDL_MYPICTURES
);
283 CSIDL_TO_STR(CSIDL_PROFILE
);
284 CSIDL_TO_STR(CSIDL_SYSTEMX86
);
285 CSIDL_TO_STR(CSIDL_PROGRAM_FILESX86
);
286 CSIDL_TO_STR(CSIDL_PROGRAM_FILES_COMMON
);
287 CSIDL_TO_STR(CSIDL_PROGRAM_FILES_COMMONX86
);
288 CSIDL_TO_STR(CSIDL_COMMON_TEMPLATES
);
289 CSIDL_TO_STR(CSIDL_COMMON_DOCUMENTS
);
290 CSIDL_TO_STR(CSIDL_COMMON_ADMINTOOLS
);
291 CSIDL_TO_STR(CSIDL_ADMINTOOLS
);
292 CSIDL_TO_STR(CSIDL_CONNECTIONS
);
293 CSIDL_TO_STR(CSIDL_PROFILES
);
294 CSIDL_TO_STR(CSIDL_COMMON_MUSIC
);
295 CSIDL_TO_STR(CSIDL_COMMON_PICTURES
);
296 CSIDL_TO_STR(CSIDL_COMMON_VIDEO
);
297 CSIDL_TO_STR(CSIDL_RESOURCES
);
298 CSIDL_TO_STR(CSIDL_RESOURCES_LOCALIZED
);
299 CSIDL_TO_STR(CSIDL_COMMON_OEM_LINKS
);
300 CSIDL_TO_STR(CSIDL_CDBURN_AREA
);
301 CSIDL_TO_STR(CSIDL_COMPUTERSNEARME
);
304 sprintf(unknown
, "unknown (0x%04x)", folder
);
309 static void test_parameters(void)
311 LPITEMIDLIST pidl
= NULL
;
315 if (pSHGetFolderLocation
)
317 /* check a bogus CSIDL: */
319 hr
= pSHGetFolderLocation(NULL
, 0xeeee, NULL
, 0, &pidl
);
320 ok(hr
== E_INVALIDARG
, "got 0x%08x, expected E_INVALIDARG\n", hr
);
321 if (hr
== S_OK
) IMalloc_Free(pMalloc
, pidl
);
323 /* check a bogus user token: */
325 hr
= pSHGetFolderLocation(NULL
, CSIDL_FAVORITES
, (HANDLE
)2, 0, &pidl
);
326 ok(hr
== E_FAIL
|| hr
== E_HANDLE
, "got 0x%08x, expected E_FAIL or E_HANDLE\n", hr
);
327 if (hr
== S_OK
) IMalloc_Free(pMalloc
, pidl
);
329 /* a NULL pidl pointer crashes, so don't test it */
332 if (pSHGetSpecialFolderLocation
)
336 SHGetSpecialFolderLocation(NULL
, 0, NULL
);
338 hr
= pSHGetSpecialFolderLocation(NULL
, 0xeeee, &pidl
);
339 ok(hr
== E_INVALIDARG
, "got returned 0x%08x\n", hr
);
342 if (pSHGetFolderPathA
)
344 /* expect 2's a bogus handle, especially since we didn't open it */
345 hr
= pSHGetFolderPathA(NULL
, CSIDL_DESKTOP
, (HANDLE
)2, SHGFP_TYPE_DEFAULT
, path
);
346 ok(hr
== E_FAIL
|| hr
== E_HANDLE
|| /* Vista and 2k8 */
347 broken(hr
== S_OK
), /* W2k and Me */ "got 0x%08x, expected E_FAIL\n", hr
);
349 hr
= pSHGetFolderPathA(NULL
, 0xeeee, NULL
, SHGFP_TYPE_DEFAULT
, path
);
350 ok(hr
== E_INVALIDARG
, "got 0x%08x, expected E_INVALIDARG\n", hr
);
353 if (pSHGetSpecialFolderPathA
)
358 pSHGetSpecialFolderPathA(NULL
, NULL
, CSIDL_BITBUCKET
, FALSE
);
360 /* odd but true: calling with a NULL path still succeeds if it's a real
361 * dir (on some windows platform). on winME it generates exception.
363 ret
= pSHGetSpecialFolderPathA(NULL
, path
, CSIDL_PROGRAMS
, FALSE
);
364 ok(ret
, "got %d\n", ret
);
366 ret
= pSHGetSpecialFolderPathA(NULL
, path
, 0xeeee, FALSE
);
367 ok(!ret
, "got %d\n", ret
);
371 /* Returns the folder's PIDL type, or 0xff if one can't be found. */
372 static BYTE
testSHGetFolderLocation(int folder
)
378 /* treat absence of function as success */
379 if (!pSHGetFolderLocation
) return TRUE
;
382 hr
= pSHGetFolderLocation(NULL
, folder
, NULL
, 0, &pidl
);
387 LPITEMIDLIST pidlLast
= pILFindLastID(pidl
);
389 ok(pidlLast
!= NULL
, "%s: ILFindLastID failed\n",
390 getFolderName(folder
));
392 ret
= pidlLast
->mkid
.abID
[0];
393 IMalloc_Free(pMalloc
, pidl
);
399 /* Returns the folder's PIDL type, or 0xff if one can't be found. */
400 static BYTE
testSHGetSpecialFolderLocation(int folder
)
406 /* treat absence of function as success */
407 if (!pSHGetSpecialFolderLocation
) return TRUE
;
410 hr
= pSHGetSpecialFolderLocation(NULL
, folder
, &pidl
);
415 LPITEMIDLIST pidlLast
= pILFindLastID(pidl
);
418 "%s: ILFindLastID failed\n", getFolderName(folder
));
420 ret
= pidlLast
->mkid
.abID
[0];
421 IMalloc_Free(pMalloc
, pidl
);
427 static void test_SHGetFolderPath(BOOL optional
, int folder
)
432 if (!pSHGetFolderPathA
) return;
434 hr
= pSHGetFolderPathA(NULL
, folder
, NULL
, SHGFP_TYPE_CURRENT
, path
);
435 ok(hr
== S_OK
|| optional
,
436 "SHGetFolderPathA(NULL, %s, NULL, SHGFP_TYPE_CURRENT, path) failed: 0x%08x\n", getFolderName(folder
), hr
);
439 static void test_SHGetSpecialFolderPath(BOOL optional
, int folder
)
444 if (!pSHGetSpecialFolderPathA
) return;
446 ret
= pSHGetSpecialFolderPathA(NULL
, path
, folder
, FALSE
);
447 if (ret
&& winetest_interactive
)
448 printf("%s: %s\n", getFolderName(folder
), path
);
450 "SHGetSpecialFolderPathA(NULL, path, %s, FALSE) failed\n",
451 getFolderName(folder
));
454 static void test_ShellValues(const struct shellExpectedValues testEntries
[],
455 int numEntries
, BOOL optional
)
459 for (i
= 0; i
< numEntries
; i
++)
463 BOOL foundTypeMatch
= FALSE
;
465 if (pSHGetFolderLocation
)
467 type
= testSHGetFolderLocation(testEntries
[i
].folder
);
468 for (j
= 0; !foundTypeMatch
&& j
< testEntries
[i
].numTypes
; j
++)
469 if (testEntries
[i
].types
[j
] == type
)
470 foundTypeMatch
= TRUE
;
471 ok(foundTypeMatch
|| optional
|| broken(type
== 0xff) /* Win9x */,
472 "%s has unexpected type %d (0x%02x)\n",
473 getFolderName(testEntries
[i
].folder
), type
, type
);
475 type
= testSHGetSpecialFolderLocation(testEntries
[i
].folder
);
476 for (j
= 0, foundTypeMatch
= FALSE
; !foundTypeMatch
&&
477 j
< testEntries
[i
].numTypes
; j
++)
478 if (testEntries
[i
].types
[j
] == type
)
479 foundTypeMatch
= TRUE
;
480 ok(foundTypeMatch
|| optional
|| broken(type
== 0xff) /* Win9x */,
481 "%s has unexpected type %d (0x%02x)\n",
482 getFolderName(testEntries
[i
].folder
), type
, type
);
489 test_SHGetFolderPath(optional
, testEntries
[i
].folder
);
490 test_SHGetSpecialFolderPath(optional
, testEntries
[i
].folder
);
496 /* Attempts to verify that the folder path corresponding to the folder CSIDL
497 * value has the same value as the environment variable with name envVar.
498 * Doesn't mind if SHGetSpecialFolderPath fails for folder or if envVar isn't
499 * set in this environment; different OS and shell version behave differently.
500 * However, if both are present, fails if envVar's value is not the same
501 * (byte-for-byte) as what SHGetSpecialFolderPath returns.
503 static void matchSpecialFolderPathToEnv(int folder
, const char *envVar
)
507 if (!pSHGetSpecialFolderPathA
) return;
509 if (pSHGetSpecialFolderPathA(NULL
, path
, folder
, FALSE
))
511 char *envVal
= getenv(envVar
);
513 ok(!envVal
|| !lstrcmpiA(envVal
, path
),
514 "%%%s%% does not match SHGetSpecialFolderPath:\n"
515 "%%%s%% is %s\nSHGetSpecialFolderPath returns %s\n",
516 envVar
, envVar
, envVal
, path
);
520 /* Attempts to match the GUID returned by SHGetFolderLocation for folder with
521 * GUID. Assumes the type of the returned PIDL is in fact a GUID, but doesn't
522 * fail if it isn't--that check should already have been done.
523 * Fails if the returned PIDL is a GUID whose value does not match guid.
525 static void matchGUID(int folder
, const GUID
*guid
, const GUID
*guid_alt
)
530 if (!pSHGetFolderLocation
) return;
534 hr
= pSHGetFolderLocation(NULL
, folder
, NULL
, 0, &pidl
);
537 LPITEMIDLIST pidlLast
= pILFindLastID(pidl
);
539 if (pidlLast
&& (pidlLast
->mkid
.abID
[0] == PT_SHELLEXT
||
540 pidlLast
->mkid
.abID
[0] == PT_GUID
))
542 GUID
*shellGuid
= (GUID
*)(pidlLast
->mkid
.abID
+ 2);
545 ok(IsEqualIID(shellGuid
, guid
),
546 "%s: got GUID %s, expected %s\n", getFolderName(folder
),
547 wine_dbgstr_guid(shellGuid
), wine_dbgstr_guid(guid
));
549 ok(IsEqualIID(shellGuid
, guid
) ||
550 IsEqualIID(shellGuid
, guid_alt
),
551 "%s: got GUID %s, expected %s or %s\n", getFolderName(folder
),
552 wine_dbgstr_guid(shellGuid
), wine_dbgstr_guid(guid
), wine_dbgstr_guid(guid_alt
));
554 IMalloc_Free(pMalloc
, pidl
);
558 /* Checks the PIDL type of all the known values. */
559 static void test_PidlTypes(void)
562 test_SHGetFolderPath(FALSE
, CSIDL_DESKTOP
);
563 test_SHGetSpecialFolderPath(FALSE
, CSIDL_DESKTOP
);
565 test_ShellValues(requiredShellValues
, ARRAY_SIZE(requiredShellValues
), FALSE
);
566 test_ShellValues(optionalShellValues
, ARRAY_SIZE(optionalShellValues
), TRUE
);
569 /* FIXME: Should be in shobjidl.idl */
570 DEFINE_GUID(CLSID_NetworkExplorerFolder
, 0xF02C1A0D, 0xBE21, 0x4350, 0x88, 0xB0, 0x73, 0x67, 0xFC, 0x96, 0xEF, 0x3C);
572 /* Verifies various shell virtual folders have the correct well-known GUIDs. */
573 static void test_GUIDs(void)
575 matchGUID(CSIDL_BITBUCKET
, &CLSID_RecycleBin
, NULL
);
576 matchGUID(CSIDL_CONTROLS
, &CLSID_ControlPanel
, NULL
);
577 matchGUID(CSIDL_DRIVES
, &CLSID_MyComputer
, NULL
);
578 matchGUID(CSIDL_INTERNET
, &CLSID_Internet
, NULL
);
579 matchGUID(CSIDL_NETWORK
, &CLSID_NetworkPlaces
, &CLSID_NetworkExplorerFolder
); /* Vista and higher */
580 matchGUID(CSIDL_PERSONAL
, &CLSID_MyDocuments
, NULL
);
581 matchGUID(CSIDL_COMMON_DOCUMENTS
, &CLSID_CommonDocuments
, NULL
);
582 matchGUID(CSIDL_PRINTERS
, &CLSID_Printers
, NULL
);
585 /* Verifies various shell paths match the environment variables to which they
588 static void test_EnvVars(void)
590 matchSpecialFolderPathToEnv(CSIDL_PROGRAM_FILES
, "ProgramFiles");
591 matchSpecialFolderPathToEnv(CSIDL_APPDATA
, "APPDATA");
592 matchSpecialFolderPathToEnv(CSIDL_PROFILE
, "USERPROFILE");
593 matchSpecialFolderPathToEnv(CSIDL_WINDOWS
, "SystemRoot");
594 matchSpecialFolderPathToEnv(CSIDL_WINDOWS
, "windir");
595 matchSpecialFolderPathToEnv(CSIDL_PROGRAM_FILES_COMMON
, "CommonProgramFiles");
596 /* this is only set on Wine, but can't hurt to verify it: */
597 matchSpecialFolderPathToEnv(CSIDL_SYSTEM
, "winsysdir");
600 /* Loosely based on PathRemoveBackslashA from dlls/shlwapi/path.c */
601 static BOOL
myPathIsRootA(LPCSTR lpszPath
)
603 if (lpszPath
&& *lpszPath
&&
604 lpszPath
[1] == ':' && lpszPath
[2] == '\\' && lpszPath
[3] == '\0')
605 return TRUE
; /* X:\ */
608 static LPSTR
myPathRemoveBackslashA( LPSTR lpszPath
)
614 szTemp
= CharPrevA(lpszPath
, lpszPath
+ strlen(lpszPath
));
615 if (!myPathIsRootA(lpszPath
) && *szTemp
== '\\')
621 /* Verifies the shell path for CSIDL_WINDOWS matches the return from
622 * GetWindowsDirectory. If SHGetSpecialFolderPath fails, no harm, no foul--not
623 * every shell32 version supports CSIDL_WINDOWS.
625 static void testWinDir(void)
627 char windowsShellPath
[MAX_PATH
], windowsDir
[MAX_PATH
] = { 0 };
629 if (!pSHGetSpecialFolderPathA
) return;
631 if (pSHGetSpecialFolderPathA(NULL
, windowsShellPath
, CSIDL_WINDOWS
, FALSE
))
633 myPathRemoveBackslashA(windowsShellPath
);
634 GetWindowsDirectoryA(windowsDir
, sizeof(windowsDir
));
635 myPathRemoveBackslashA(windowsDir
);
636 ok(!lstrcmpiA(windowsDir
, windowsShellPath
),
637 "GetWindowsDirectory returns %s SHGetSpecialFolderPath returns %s\n",
638 windowsDir
, windowsShellPath
);
642 /* Verifies the shell path for CSIDL_SYSTEM matches the return from
643 * GetSystemDirectory. If SHGetSpecialFolderPath fails, no harm,
644 * no foul--not every shell32 version supports CSIDL_SYSTEM.
646 static void testSystemDir(void)
648 char systemShellPath
[MAX_PATH
], systemDir
[MAX_PATH
], systemDirx86
[MAX_PATH
];
650 if (!pSHGetSpecialFolderPathA
) return;
652 GetSystemDirectoryA(systemDir
, sizeof(systemDir
));
653 myPathRemoveBackslashA(systemDir
);
654 if (pSHGetSpecialFolderPathA(NULL
, systemShellPath
, CSIDL_SYSTEM
, FALSE
))
656 myPathRemoveBackslashA(systemShellPath
);
657 ok(!lstrcmpiA(systemDir
, systemShellPath
),
658 "GetSystemDirectory returns %s SHGetSpecialFolderPath returns %s\n",
659 systemDir
, systemShellPath
);
662 if (!pGetSystemWow64DirectoryA
|| !pGetSystemWow64DirectoryA(systemDirx86
, sizeof(systemDirx86
)))
663 GetSystemDirectoryA(systemDirx86
, sizeof(systemDirx86
));
664 myPathRemoveBackslashA(systemDirx86
);
665 if (pSHGetSpecialFolderPathA(NULL
, systemShellPath
, CSIDL_SYSTEMX86
, FALSE
))
667 myPathRemoveBackslashA(systemShellPath
);
668 ok(!lstrcmpiA(systemDirx86
, systemShellPath
) || broken(!lstrcmpiA(systemDir
, systemShellPath
)),
669 "GetSystemDirectory returns %s SHGetSpecialFolderPath returns %s\n",
670 systemDir
, systemShellPath
);
674 /* Globals used by subprocesses */
676 static char **myARGV
;
677 static char base
[MAX_PATH
];
678 static char selfname
[MAX_PATH
];
680 static BOOL
init(void)
682 myARGC
= winetest_get_mainargs(&myARGV
);
683 if (!GetCurrentDirectoryA(sizeof(base
), base
)) return FALSE
;
684 strcpy(selfname
, myARGV
[0]);
688 static void doChild(const char *arg
)
698 /* test what happens when CSIDL_FAVORITES is set to a nonexistent directory */
700 /* test some failure cases first: */
701 hr
= pSHGetFolderPathA(NULL
, CSIDL_FAVORITES
, NULL
, SHGFP_TYPE_CURRENT
, path
);
702 ok(hr
== HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
),
703 "SHGetFolderPath returned 0x%08x, expected 0x80070002\n", hr
);
706 hr
= pSHGetFolderLocation(NULL
, CSIDL_FAVORITES
, NULL
, 0, &pidl
);
707 ok(hr
== E_FAIL
|| hr
== HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
),
708 "SHGetFolderLocation returned 0x%08x\n", hr
);
709 if (hr
== S_OK
&& pidl
) IMalloc_Free(pMalloc
, pidl
);
711 ok(!pSHGetSpecialFolderPathA(NULL
, path
, CSIDL_FAVORITES
, FALSE
),
712 "SHGetSpecialFolderPath succeeded, expected failure\n");
715 hr
= pSHGetSpecialFolderLocation(NULL
, CSIDL_FAVORITES
, &pidl
);
716 ok(hr
== E_FAIL
|| hr
== HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
),
717 "SHGetFolderLocation returned 0x%08x\n", hr
);
719 if (hr
== S_OK
&& pidl
) IMalloc_Free(pMalloc
, pidl
);
721 /* now test success: */
722 hr
= pSHGetFolderPathA(NULL
, CSIDL_FAVORITES
| CSIDL_FLAG_CREATE
, NULL
,
723 SHGFP_TYPE_CURRENT
, path
);
724 ok (hr
== S_OK
, "got 0x%08x\n", hr
);
729 trace("CSIDL_FAVORITES was changed to %s\n", path
);
730 ret
= CreateDirectoryA(path
, NULL
);
731 ok(!ret
, "expected failure with ERROR_ALREADY_EXISTS\n");
733 ok(GetLastError() == ERROR_ALREADY_EXISTS
,
734 "got %d, expected ERROR_ALREADY_EXISTS\n", GetLastError());
736 p
= path
+ strlen(path
);
737 strcpy(p
, "\\desktop.ini");
740 SetFileAttributesA( path
, FILE_ATTRIBUTE_NORMAL
);
741 ret
= RemoveDirectoryA(path
);
742 ok( ret
, "failed to remove %s error %u\n", path
, GetLastError() );
745 else if (arg
[0] == '2')
747 /* make sure SHGetFolderPath still succeeds when the
748 original value of CSIDL_FAVORITES is restored. */
749 hr
= pSHGetFolderPathA(NULL
, CSIDL_FAVORITES
| CSIDL_FLAG_CREATE
, NULL
,
750 SHGFP_TYPE_CURRENT
, path
);
751 ok(hr
== S_OK
, "SHGetFolderPath failed: 0x%08x\n", hr
);
755 /* Tests the return values from the various shell functions both with and
756 * without the use of the CSIDL_FLAG_CREATE flag. This flag only appeared in
757 * version 5 of the shell, so don't test unless it's at least version 5.
758 * The test reads a value from the registry, modifies it, calls
759 * SHGetFolderPath once with the CSIDL_FLAG_CREATE flag, and immediately
760 * afterward without it. Then it restores the registry and deletes the folder
762 * One oddity with respect to restoration: shell32 caches somehow, so it needs
763 * to be reloaded in order to see the correct (restored) value.
764 * Some APIs unrelated to the ones under test may fail, but I expect they're
765 * covered by other unit tests; I just print out something about failure to
766 * help trace what's going on.
768 static void test_NonExistentPath(void)
770 static const char userShellFolders
[] =
771 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders";
772 char originalPath
[MAX_PATH
], modifiedPath
[MAX_PATH
];
775 if (!pSHGetFolderPathA
) return;
776 if (!pSHGetFolderLocation
) return;
777 if (!pSHGetSpecialFolderPathA
) return;
778 if (!pSHGetSpecialFolderLocation
) return;
779 if (!pSHFileOperationA
) return;
780 if (shellVersion
.dwMajorVersion
< 5) return;
782 if (!RegOpenKeyExA(HKEY_CURRENT_USER
, userShellFolders
, 0, KEY_ALL_ACCESS
,
787 len
= sizeof(originalPath
);
788 if (!RegQueryValueExA(key
, "Favorites", NULL
, &type
,
789 (LPBYTE
)&originalPath
, &len
))
791 size_t len
= strlen(originalPath
);
793 memcpy(modifiedPath
, originalPath
, len
);
794 modifiedPath
[len
++] = '2';
795 modifiedPath
[len
++] = '\0';
796 trace("Changing CSIDL_FAVORITES to %s\n", modifiedPath
);
797 if (!RegSetValueExA(key
, "Favorites", 0, type
,
798 (LPBYTE
)modifiedPath
, len
))
800 char buffer
[MAX_PATH
+20];
801 STARTUPINFOA startup
;
802 PROCESS_INFORMATION info
;
804 sprintf(buffer
, "%s tests/shellpath.c 1", selfname
);
805 memset(&startup
, 0, sizeof(startup
));
806 startup
.cb
= sizeof(startup
);
807 startup
.dwFlags
= STARTF_USESHOWWINDOW
;
808 startup
.dwFlags
= SW_SHOWNORMAL
;
809 CreateProcessA(NULL
, buffer
, NULL
, NULL
, FALSE
, 0L, NULL
, NULL
,
811 winetest_wait_child_process( info
.hProcess
);
813 /* restore original values: */
814 trace("Restoring CSIDL_FAVORITES to %s\n", originalPath
);
815 RegSetValueExA(key
, "Favorites", 0, type
, (LPBYTE
) originalPath
,
816 strlen(originalPath
) + 1);
819 sprintf(buffer
, "%s tests/shellpath.c 2", selfname
);
820 memset(&startup
, 0, sizeof(startup
));
821 startup
.cb
= sizeof(startup
);
822 startup
.dwFlags
= STARTF_USESHOWWINDOW
;
823 startup
.dwFlags
= SW_SHOWNORMAL
;
824 CreateProcessA(NULL
, buffer
, NULL
, NULL
, FALSE
, 0L, NULL
, NULL
,
826 ok(WaitForSingleObject(info
.hProcess
, 30000) == WAIT_OBJECT_0
,
827 "child process termination\n");
830 else skip("RegQueryValueExA(key, Favorites, ...) failed\n");
834 else skip("RegOpenKeyExA(HKEY_CURRENT_USER, %s, ...) failed\n", userShellFolders
);
837 static void test_SHGetFolderPathEx(void)
840 WCHAR buffer
[MAX_PATH
], *path
;
843 if (!pSHGetKnownFolderPath
|| !pSHGetFolderPathEx
)
845 win_skip("SHGetKnownFolderPath or SHGetFolderPathEx not available\n");
849 if (0) { /* crashes */
850 hr
= pSHGetKnownFolderPath(&FOLDERID_Desktop
, 0, NULL
, NULL
);
851 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
853 /* non-existent folder id */
854 path
= (void *)0xdeadbeef;
855 hr
= pSHGetKnownFolderPath(&IID_IOleObject
, 0, NULL
, &path
);
856 ok(hr
== HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
), "got 0x%08x\n", hr
);
857 ok(path
== NULL
, "got %p\n", path
);
860 hr
= pSHGetKnownFolderPath(&FOLDERID_Desktop
, 0, NULL
, &path
);
861 ok(hr
== S_OK
, "expected S_OK, got 0x%08x\n", hr
);
862 ok(path
!= NULL
, "expected path != NULL\n");
864 hr
= pSHGetFolderPathEx(&FOLDERID_Desktop
, 0, NULL
, buffer
, MAX_PATH
);
865 ok(hr
== S_OK
, "expected S_OK, got 0x%08x\n", hr
);
866 ok(!lstrcmpiW(path
, buffer
), "expected equal paths\n");
867 len
= lstrlenW(buffer
);
870 hr
= pSHGetFolderPathEx(&FOLDERID_Desktop
, 0, NULL
, buffer
, 0);
871 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
873 if (0) { /* crashes */
874 hr
= pSHGetFolderPathEx(&FOLDERID_Desktop
, 0, NULL
, NULL
, len
+ 1);
875 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
877 hr
= pSHGetFolderPathEx(NULL
, 0, NULL
, buffer
, MAX_PATH
);
878 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got 0x%08x\n", hr
);
880 hr
= pSHGetFolderPathEx(&FOLDERID_Desktop
, 0, NULL
, buffer
, len
);
881 ok(hr
== E_NOT_SUFFICIENT_BUFFER
, "expected E_NOT_SUFFICIENT_BUFFER, got 0x%08x\n", hr
);
883 hr
= pSHGetFolderPathEx(&FOLDERID_Desktop
, 0, NULL
, buffer
, len
+ 1);
884 ok(hr
== S_OK
, "expected S_OK, got 0x%08x\n", hr
);
887 /* Standard CSIDL values (and their flags) uses only two less-significant bytes */
888 #define NO_CSIDL 0x10000
889 #define CSIDL_TODO_WINE 0x20000
890 #define KNOWN_FOLDER(id, csidl, name, category, parent, relative_path, parsing_name, attributes, definitionFlags) \
891 { &id, # id, csidl, # csidl, name, category, &parent, # parent, relative_path, parsing_name, attributes, definitionFlags, __LINE__ }
893 /* non-published known folders test */
894 static const GUID _FOLDERID_CryptoKeys
= {0xB88F4DAA, 0xE7BD, 0x49A9, {0xB7, 0x4D, 0x02, 0x88, 0x5A, 0x5D, 0xC7, 0x65} };
895 static const GUID _FOLDERID_DpapiKeys
= {0x10C07CD0, 0xEF91, 0x4567, {0xB8, 0x50, 0x44, 0x8B, 0x77, 0xCB, 0x37, 0xF9} };
896 static const GUID _FOLDERID_SystemCertificates
= {0x54EED2E0, 0xE7CA, 0x4FDB, {0x91, 0x48, 0x0F, 0x42, 0x47, 0x29, 0x1C, 0xFA} };
897 static const GUID _FOLDERID_CredentialManager
= {0x915221FB, 0x9EFE, 0x4BDA, {0x8F, 0xD7, 0xF7, 0x8D, 0xCA, 0x77, 0x4F, 0x87} };
899 struct knownFolderDef
{
900 const KNOWNFOLDERID
*folderId
;
901 const char *sFolderId
;
905 const KF_CATEGORY category
;
906 const KNOWNFOLDERID
*fidParent
;
908 const char *sRelativePath
;
909 const char *sParsingName
;
910 const DWORD attributes
;
911 const KF_DEFINITION_FLAGS definitionFlags
;
915 /* Note: content of parsing name may vary between Windows versions.
916 * As a base, values from 6.0 (Vista) were used. Some entries may contain
917 * alternative values. In that case, Windows version where the value was
920 * The list of values for parsing name was encoded as a number of null-
921 * terminated strings placed one by one (separated by null byte only).
922 * End of list is marked by two consecutive null bytes.
924 static const struct knownFolderDef known_folders
[] = {
925 KNOWN_FOLDER(FOLDERID_AddNewPrograms
,
927 "AddNewProgramsFolder",
931 "::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{15eae92e-f17a-4431-9f28-805e482dafd4}\0"
932 "shell:::{26EE0668-A00A-44D7-9371-BEB064C98683}\\0\\::{15eae92e-f17a-4431-9f28-805e482dafd4}\0\0" /* 6.1 */,
935 KNOWN_FOLDER(FOLDERID_AdminTools
,
937 "Administrative Tools",
940 "Administrative Tools",
942 FILE_ATTRIBUTE_READONLY
,
944 KNOWN_FOLDER(FOLDERID_AppUpdates
,
950 "::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{7b81be6a-ce2b-4676-a29e-eb907a5126c5}\\::{d450a8a1-9568-45c7-9c0e-b4f9fb4537bd}\0"
951 "::{26EE0668-A00A-44D7-9371-BEB064C98683}\\0\\::{7b81be6a-ce2b-4676-a29e-eb907a5126c5}\\::{d450a8a1-9568-45c7-9c0e-b4f9fb4537bd}\0\0" /* 6.1 */,
954 KNOWN_FOLDER(FOLDERID_CDBurning
,
958 FOLDERID_LocalAppData
,
959 "Microsoft\\Windows\\Burn\\Burn",
961 FILE_ATTRIBUTE_READONLY
,
962 KFDF_LOCAL_REDIRECT_ONLY
),
963 KNOWN_FOLDER(FOLDERID_ChangeRemovePrograms
,
965 "ChangeRemoveProgramsFolder",
969 "::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{7b81be6a-ce2b-4676-a29e-eb907a5126c5}\0"
970 "::{26EE0668-A00A-44D7-9371-BEB064C98683}\\0\\::{7b81be6a-ce2b-4676-a29e-eb907a5126c5}\0\0" /* 6.1 */,
973 KNOWN_FOLDER(FOLDERID_CommonAdminTools
,
974 CSIDL_COMMON_ADMINTOOLS
,
975 "Common Administrative Tools",
977 FOLDERID_CommonPrograms
,
978 "Administrative Tools",
980 FILE_ATTRIBUTE_READONLY
,
982 KNOWN_FOLDER(FOLDERID_CommonOEMLinks
,
983 CSIDL_COMMON_OEM_LINKS
,"OEM Links",
985 FOLDERID_ProgramData
,
990 KNOWN_FOLDER(FOLDERID_CommonPrograms
,
991 CSIDL_COMMON_PROGRAMS
,
994 FOLDERID_CommonStartMenu
,
997 FILE_ATTRIBUTE_READONLY
,
999 KNOWN_FOLDER(FOLDERID_CommonStartMenu
,
1000 CSIDL_COMMON_STARTMENU
,
1001 "Common Start Menu",
1003 FOLDERID_ProgramData
,
1004 "Microsoft\\Windows\\Start Menu",
1006 FILE_ATTRIBUTE_READONLY
,
1008 KNOWN_FOLDER(FOLDERID_CommonStartup
,
1009 CSIDL_COMMON_STARTUP
,
1012 FOLDERID_CommonPrograms
,
1015 FILE_ATTRIBUTE_READONLY
,
1017 KNOWN_FOLDER(FOLDERID_CommonTemplates
,
1018 CSIDL_COMMON_TEMPLATES
,
1021 FOLDERID_ProgramData
,
1022 "Microsoft\\Windows\\Templates",
1026 KNOWN_FOLDER(FOLDERID_ComputerFolder
,
1029 KF_CATEGORY_VIRTUAL
,
1032 "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\0\0",
1035 KNOWN_FOLDER(FOLDERID_ConflictFolder
,
1038 KF_CATEGORY_VIRTUAL
,
1041 "::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF}\\::{E413D040-6788-4C22-957E-175D1C513A34},\0"
1042 "::{26EE0668-A00A-44D7-9371-BEB064C98683}\\0\\::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF}\\::{E413D040-6788-4C22-957E-175D1C513A34},\0\0" /* 6.1 */,
1045 KNOWN_FOLDER(FOLDERID_ConnectionsFolder
,
1047 "ConnectionsFolder",
1048 KF_CATEGORY_VIRTUAL
,
1051 "::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}\0"
1052 "::{26EE0668-A00A-44D7-9371-BEB064C98683}\\0\\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}\0\0" /* 6.1 */,
1055 KNOWN_FOLDER(FOLDERID_Contacts
,
1058 KF_CATEGORY_PERUSER
,
1061 "::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{56784854-C6CB-462B-8169-88E350ACB882}\0\0",
1062 FILE_ATTRIBUTE_READONLY
,
1063 KFDF_ROAMABLE
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
),
1064 KNOWN_FOLDER(FOLDERID_ControlPanelFolder
,
1066 "ControlPanelFolder",
1067 KF_CATEGORY_VIRTUAL
,
1070 "::{21EC2020-3AEA-1069-A2DD-08002B30309D}\0"
1071 "::{26EE0668-A00A-44D7-9371-BEB064C98683}\\0\0\0" /* 6.1 */,
1074 KNOWN_FOLDER(FOLDERID_Cookies
,
1077 KF_CATEGORY_PERUSER
,
1078 FOLDERID_RoamingAppData
,
1079 "Microsoft\\Windows\\Cookies",
1083 KNOWN_FOLDER(FOLDERID_Desktop
,
1086 KF_CATEGORY_PERUSER
,
1090 FILE_ATTRIBUTE_READONLY
,
1091 KFDF_ROAMABLE
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
),
1092 KNOWN_FOLDER(FOLDERID_DeviceMetadataStore
,
1094 "Device Metadata Store",
1096 FOLDERID_ProgramData
,
1097 "Microsoft\\Windows\\DeviceMetadataStore",
1101 KNOWN_FOLDER(FOLDERID_Documents
,
1104 KF_CATEGORY_PERUSER
,
1107 "::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{FDD39AD0-238F-46AF-ADB4-6C85480369C7}\0\0",
1108 FILE_ATTRIBUTE_READONLY
,
1109 KFDF_ROAMABLE
| KFDF_PRECREATE
),
1110 KNOWN_FOLDER(FOLDERID_DocumentsLibrary
,
1113 KF_CATEGORY_PERUSER
,
1115 "Documents.library-ms",
1116 "::{031E4825-7B94-4dc3-B131-E946B44C8DD5}\\{7b0db17d-9cd2-4a93-9733-46cc89022e7c}\0\0",
1118 KFDF_PRECREATE
| KFDF_STREAM
),
1119 KNOWN_FOLDER(FOLDERID_Downloads
,
1122 KF_CATEGORY_PERUSER
,
1126 FILE_ATTRIBUTE_READONLY
,
1127 KFDF_ROAMABLE
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
),
1128 KNOWN_FOLDER(FOLDERID_Favorites
,
1131 KF_CATEGORY_PERUSER
,
1135 FILE_ATTRIBUTE_READONLY
,
1136 KFDF_ROAMABLE
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
),
1137 KNOWN_FOLDER(FOLDERID_Fonts
,
1146 KNOWN_FOLDER(FOLDERID_Games
,
1149 KF_CATEGORY_VIRTUAL
,
1152 "::{ED228FDF-9EA8-4870-83b1-96b02CFE0D52}\0\0",
1155 KNOWN_FOLDER(FOLDERID_GameTasks
,
1158 KF_CATEGORY_PERUSER
,
1159 FOLDERID_LocalAppData
,
1160 "Microsoft\\Windows\\GameExplorer",
1163 KFDF_LOCAL_REDIRECT_ONLY
),
1164 KNOWN_FOLDER(FOLDERID_History
,
1167 KF_CATEGORY_PERUSER
,
1168 FOLDERID_LocalAppData
,
1169 "Microsoft\\Windows\\History",
1172 KFDF_LOCAL_REDIRECT_ONLY
),
1173 KNOWN_FOLDER(FOLDERID_HomeGroup
,
1176 KF_CATEGORY_VIRTUAL
,
1179 "::{B4FB3F98-C1EA-428d-A78A-D1F5659CBA93}\0\0",
1182 KNOWN_FOLDER(FOLDERID_ImplicitAppShortcuts
,
1184 "ImplicitAppShortcuts",
1185 KF_CATEGORY_PERUSER
,
1186 FOLDERID_UserPinned
,
1187 "ImplicitAppShortcuts",
1191 KNOWN_FOLDER(FOLDERID_InternetCache
,
1192 CSIDL_INTERNET_CACHE
,
1194 KF_CATEGORY_PERUSER
,
1195 FOLDERID_LocalAppData
,
1196 "Microsoft\\Windows\\Temporary Internet Files",
1199 KFDF_LOCAL_REDIRECT_ONLY
),
1200 KNOWN_FOLDER(FOLDERID_InternetFolder
,
1203 KF_CATEGORY_VIRTUAL
,
1206 "::{871C5380-42A0-1069-A2EA-08002B30309D}\0\0",
1209 KNOWN_FOLDER(FOLDERID_Libraries
,
1212 KF_CATEGORY_PERUSER
,
1213 FOLDERID_RoamingAppData
,
1214 "Microsoft\\Windows\\Libraries",
1217 KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
),
1218 KNOWN_FOLDER(FOLDERID_Links
,
1221 KF_CATEGORY_PERUSER
,
1224 "::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{bfb9d5e0-c6a9-404c-b2b2-ae6db6af4968}\0\0",
1225 FILE_ATTRIBUTE_READONLY
,
1226 KFDF_ROAMABLE
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
),
1227 KNOWN_FOLDER(FOLDERID_LocalAppData
,
1228 CSIDL_LOCAL_APPDATA
,
1230 KF_CATEGORY_PERUSER
,
1235 KFDF_LOCAL_REDIRECT_ONLY
| KFDF_PUBLISHEXPANDEDPATH
),
1236 KNOWN_FOLDER(FOLDERID_LocalAppDataLow
,
1239 KF_CATEGORY_PERUSER
,
1241 "AppData\\LocalLow",
1243 FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
,
1244 KFDF_LOCAL_REDIRECT_ONLY
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
),
1245 KNOWN_FOLDER(FOLDERID_LocalizedResourcesDir
,
1246 CSIDL_RESOURCES_LOCALIZED
,
1247 "LocalizedResourcesDir",
1254 KNOWN_FOLDER(FOLDERID_Music
,
1257 KF_CATEGORY_PERUSER
,
1260 "::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{4BD8D571-6D19-48D3-BE97-422220080E43}\0\0",
1261 FILE_ATTRIBUTE_READONLY
,
1262 KFDF_ROAMABLE
| KFDF_PRECREATE
),
1263 KNOWN_FOLDER(FOLDERID_MusicLibrary
,
1266 KF_CATEGORY_PERUSER
,
1269 "::{031E4825-7B94-4dc3-B131-E946B44C8DD5}\\{2112AB0A-C86A-4ffe-A368-0DE96E47012E}\0\0",
1271 KFDF_PRECREATE
| KFDF_STREAM
),
1272 KNOWN_FOLDER(FOLDERID_NetHood
,
1275 KF_CATEGORY_PERUSER
,
1276 FOLDERID_RoamingAppData
,
1277 "Microsoft\\Windows\\Network Shortcuts",
1281 KNOWN_FOLDER(FOLDERID_NetworkFolder
,
1283 "NetworkPlacesFolder",
1284 KF_CATEGORY_VIRTUAL
,
1287 "::{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}\0\0",
1290 KNOWN_FOLDER(FOLDERID_OriginalImages
,
1293 KF_CATEGORY_PERUSER
,
1294 FOLDERID_LocalAppData
,
1295 "Microsoft\\Windows Photo Gallery\\Original Images",
1299 KNOWN_FOLDER(FOLDERID_PhotoAlbums
,
1302 KF_CATEGORY_PERUSER
,
1306 FILE_ATTRIBUTE_READONLY
,
1308 KNOWN_FOLDER(FOLDERID_Pictures
,
1311 KF_CATEGORY_PERUSER
,
1314 "::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{33E28130-4E1E-4676-835A-98395C3BC3BB}\0\0",
1315 FILE_ATTRIBUTE_READONLY
,
1316 KFDF_ROAMABLE
| KFDF_PRECREATE
),
1317 KNOWN_FOLDER(FOLDERID_PicturesLibrary
,
1320 KF_CATEGORY_PERUSER
,
1322 "Pictures.library-ms",
1323 "::{031E4825-7B94-4dc3-B131-E946B44C8DD5}\\{A990AE9F-A03B-4e80-94BC-9912D7504104}\0\0",
1325 KFDF_PRECREATE
| KFDF_STREAM
),
1326 KNOWN_FOLDER(FOLDERID_Playlists
,
1329 KF_CATEGORY_PERUSER
,
1333 FILE_ATTRIBUTE_READONLY
,
1335 KNOWN_FOLDER(FOLDERID_PrintersFolder
,
1338 KF_CATEGORY_VIRTUAL
,
1341 "::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}\0\0",
1344 KNOWN_FOLDER(FOLDERID_PrintHood
,
1347 KF_CATEGORY_PERUSER
,
1348 FOLDERID_RoamingAppData
,
1349 "Microsoft\\Windows\\Printer Shortcuts",
1353 KNOWN_FOLDER(FOLDERID_Profile
,
1362 KNOWN_FOLDER(FOLDERID_ProgramData
,
1363 CSIDL_COMMON_APPDATA
,
1371 KNOWN_FOLDER(FOLDERID_ProgramFiles
,
1372 CSIDL_PROGRAM_FILES
,
1378 FILE_ATTRIBUTE_READONLY
,
1381 KNOWN_FOLDER(FOLDERID_ProgramFilesCommon
,
1382 CSIDL_PROGRAM_FILES_COMMON
,
1383 "ProgramFilesCommon",
1390 KNOWN_FOLDER(FOLDERID_ProgramFilesCommonX64
,
1392 "ProgramFilesCommonX64",
1399 KNOWN_FOLDER(FOLDERID_ProgramFilesCommonX86
,
1401 "ProgramFilesCommonX86",
1408 KNOWN_FOLDER(FOLDERID_ProgramFilesX64
,
1417 KNOWN_FOLDER(FOLDERID_ProgramFilesX86
,
1418 CSIDL_PROGRAM_FILESX86
,
1424 FILE_ATTRIBUTE_READONLY
,
1426 KNOWN_FOLDER(FOLDERID_Programs
,
1429 KF_CATEGORY_PERUSER
,
1433 FILE_ATTRIBUTE_READONLY
,
1435 KNOWN_FOLDER(FOLDERID_Public
,
1441 "::{4336a54d-038b-4685-ab02-99bb52d3fb8b}\0"
1442 "(null)\0\0" /* 6.1 */,
1443 FILE_ATTRIBUTE_READONLY
,
1445 KNOWN_FOLDER(FOLDERID_PublicDesktop
,
1446 CSIDL_COMMON_DESKTOPDIRECTORY
,
1452 FILE_ATTRIBUTE_READONLY
| FILE_ATTRIBUTE_HIDDEN
,
1454 KNOWN_FOLDER(FOLDERID_PublicDocuments
,
1455 CSIDL_COMMON_DOCUMENTS
,
1461 FILE_ATTRIBUTE_READONLY
,
1463 KNOWN_FOLDER(FOLDERID_PublicDownloads
,
1470 FILE_ATTRIBUTE_READONLY
,
1472 KNOWN_FOLDER(FOLDERID_PublicGameTasks
,
1476 FOLDERID_ProgramData
,
1477 "Microsoft\\Windows\\GameExplorer",
1480 KFDF_LOCAL_REDIRECT_ONLY
),
1481 KNOWN_FOLDER(FOLDERID_PublicLibraries
,
1488 FILE_ATTRIBUTE_READONLY
| FILE_ATTRIBUTE_HIDDEN
,
1490 KNOWN_FOLDER(FOLDERID_PublicMusic
,
1497 FILE_ATTRIBUTE_READONLY
,
1499 KNOWN_FOLDER(FOLDERID_PublicPictures
,
1500 CSIDL_COMMON_PICTURES
,
1506 FILE_ATTRIBUTE_READONLY
,
1508 KNOWN_FOLDER(FOLDERID_PublicRingtones
,
1512 FOLDERID_ProgramData
,
1513 "Microsoft\\Windows\\Ringtones",
1517 KNOWN_FOLDER(FOLDERID_PublicVideos
,
1524 FILE_ATTRIBUTE_READONLY
,
1526 KNOWN_FOLDER(FOLDERID_QuickLaunch
,
1529 KF_CATEGORY_PERUSER
,
1530 FOLDERID_RoamingAppData
,
1531 "Microsoft\\Internet Explorer\\Quick Launch",
1535 KNOWN_FOLDER(FOLDERID_Recent
,
1538 KF_CATEGORY_PERUSER
,
1539 FOLDERID_RoamingAppData
,
1540 "Microsoft\\Windows\\Recent",
1542 FILE_ATTRIBUTE_READONLY
,
1544 KNOWN_FOLDER(FOLDERID_RecordedTVLibrary
,
1546 "RecordedTVLibrary",
1548 FOLDERID_PublicLibraries
,
1549 "RecordedTV.library-ms",
1552 KFDF_PRECREATE
| KFDF_STREAM
),
1553 KNOWN_FOLDER(FOLDERID_RecycleBinFolder
,
1556 KF_CATEGORY_VIRTUAL
,
1559 "::{645FF040-5081-101B-9F08-00AA002F954E}\0\0",
1562 KNOWN_FOLDER(FOLDERID_ResourceDir
,
1571 KNOWN_FOLDER(FOLDERID_Ringtones
,
1574 KF_CATEGORY_PERUSER
,
1575 FOLDERID_LocalAppData
,
1576 "Microsoft\\Windows\\Ringtones",
1580 KNOWN_FOLDER(FOLDERID_RoamingAppData
,
1583 KF_CATEGORY_PERUSER
,
1589 KNOWN_FOLDER(FOLDERID_SampleMusic
,
1593 FOLDERID_PublicMusic
,
1596 FILE_ATTRIBUTE_READONLY
,
1598 KNOWN_FOLDER(FOLDERID_SamplePictures
,
1602 FOLDERID_PublicPictures
,
1605 FILE_ATTRIBUTE_READONLY
,
1607 KNOWN_FOLDER(FOLDERID_SamplePlaylists
,
1611 FOLDERID_PublicMusic
,
1614 FILE_ATTRIBUTE_READONLY
,
1616 KNOWN_FOLDER(FOLDERID_SampleVideos
,
1620 FOLDERID_PublicVideos
,
1623 FILE_ATTRIBUTE_READONLY
,
1625 KNOWN_FOLDER(FOLDERID_SavedGames
,
1628 KF_CATEGORY_PERUSER
,
1631 "::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}\0\0",
1632 FILE_ATTRIBUTE_READONLY
,
1633 KFDF_ROAMABLE
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
),
1634 KNOWN_FOLDER(FOLDERID_SavedSearches
,
1637 KF_CATEGORY_PERUSER
,
1640 "::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{7d1d3a04-debb-4115-95cf-2f29da2920da}\0\0",
1641 FILE_ATTRIBUTE_READONLY
,
1642 KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
),
1643 KNOWN_FOLDER(FOLDERID_SEARCH_CSC
,
1646 KF_CATEGORY_VIRTUAL
,
1649 "shell:::{BD7A2E7B-21CB-41b2-A086-B309680C6B7E}\\*\0\0",
1652 KNOWN_FOLDER(FOLDERID_SearchHome
,
1655 KF_CATEGORY_VIRTUAL
,
1658 "::{9343812e-1c37-4a49-a12e-4b2d810d956b}\0\0",
1661 KNOWN_FOLDER(FOLDERID_SEARCH_MAPI
,
1664 KF_CATEGORY_VIRTUAL
,
1667 "shell:::{89D83576-6BD1-4C86-9454-BEB04E94C819}\\*\0\0",
1670 KNOWN_FOLDER(FOLDERID_SendTo
,
1673 KF_CATEGORY_PERUSER
,
1674 FOLDERID_RoamingAppData
,
1675 "Microsoft\\Windows\\SendTo",
1679 KNOWN_FOLDER(FOLDERID_SidebarDefaultParts
,
1683 FOLDERID_ProgramFiles
,
1684 "Windows Sidebar\\Gadgets",
1688 KNOWN_FOLDER(FOLDERID_SidebarParts
,
1691 KF_CATEGORY_PERUSER
,
1692 FOLDERID_LocalAppData
,
1693 "Microsoft\\Windows Sidebar\\Gadgets",
1697 KNOWN_FOLDER(FOLDERID_StartMenu
,
1700 KF_CATEGORY_PERUSER
,
1701 FOLDERID_RoamingAppData
,
1702 "Microsoft\\Windows\\Start Menu",
1704 FILE_ATTRIBUTE_READONLY
,
1706 KNOWN_FOLDER(FOLDERID_Startup
,
1709 KF_CATEGORY_PERUSER
,
1713 FILE_ATTRIBUTE_READONLY
,
1715 KNOWN_FOLDER(FOLDERID_SyncManagerFolder
,
1718 KF_CATEGORY_VIRTUAL
,
1721 "::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF}\0"
1722 "::{26EE0668-A00A-44D7-9371-BEB064C98683}\\0\\::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF}\0\0" /* 6.1 */,
1725 KNOWN_FOLDER(FOLDERID_SyncResultsFolder
,
1727 "SyncResultsFolder",
1728 KF_CATEGORY_VIRTUAL
,
1731 "::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF}\\::{BC48B32F-5910-47F5-8570-5074A8A5636A},\0"
1732 "::{26EE0668-A00A-44D7-9371-BEB064C98683}\\0\\::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF}\\::{BC48B32F-5910-47F5-8570-5074A8A5636A},\0\0",
1735 KNOWN_FOLDER(FOLDERID_SyncSetupFolder
,
1738 KF_CATEGORY_VIRTUAL
,
1741 "::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF}\\::{F1390A9A-A3F4-4E5D-9C5F-98F3BD8D935C},\0"
1742 "::{26EE0668-A00A-44D7-9371-BEB064C98683}\\0\\::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF}\\::{F1390A9A-A3F4-4E5D-9C5F-98F3BD8D935C},\0\0" /* 6.1 */,
1745 KNOWN_FOLDER(FOLDERID_System
,
1754 KNOWN_FOLDER(FOLDERID_SystemX86
,
1763 KNOWN_FOLDER(FOLDERID_Templates
,
1766 KF_CATEGORY_PERUSER
,
1767 FOLDERID_RoamingAppData
,
1768 "Microsoft\\Windows\\Templates",
1772 KNOWN_FOLDER(FOLDERID_UserPinned
,
1775 KF_CATEGORY_PERUSER
,
1776 FOLDERID_QuickLaunch
,
1779 FILE_ATTRIBUTE_HIDDEN
,
1781 KNOWN_FOLDER(FOLDERID_UserProfiles
,
1788 FILE_ATTRIBUTE_READONLY
,
1790 KNOWN_FOLDER(FOLDERID_UserProgramFiles
,
1793 KF_CATEGORY_PERUSER
,
1794 FOLDERID_LocalAppData
,
1799 KNOWN_FOLDER(FOLDERID_UserProgramFilesCommon
,
1801 "UserProgramFilesCommon",
1802 KF_CATEGORY_PERUSER
,
1803 FOLDERID_UserProgramFiles
,
1808 KNOWN_FOLDER(FOLDERID_UsersFiles
,
1811 KF_CATEGORY_VIRTUAL
,
1814 "::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\0\0",
1817 KNOWN_FOLDER(FOLDERID_UsersLibraries
,
1819 "UsersLibrariesFolder",
1820 KF_CATEGORY_VIRTUAL
,
1823 "::{031E4825-7B94-4dc3-B131-E946B44C8DD5}\0\0",
1826 KNOWN_FOLDER(FOLDERID_Videos
,
1829 KF_CATEGORY_PERUSER
,
1832 "::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{18989B1D-99B5-455B-841C-AB7C74E4DDFC}\0\0",
1833 FILE_ATTRIBUTE_READONLY
,
1834 KFDF_ROAMABLE
| KFDF_PRECREATE
),
1835 KNOWN_FOLDER(FOLDERID_VideosLibrary
,
1838 KF_CATEGORY_PERUSER
,
1840 "Videos.library-ms",
1841 "::{031E4825-7B94-4dc3-B131-E946B44C8DD5}\\{491E922F-5643-4af4-A7EB-4E7A138D8174}\0\0",
1843 KFDF_PRECREATE
| KFDF_STREAM
),
1844 KNOWN_FOLDER(FOLDERID_Windows
,
1853 KNOWN_FOLDER(_FOLDERID_CredentialManager
,
1855 "CredentialManager",
1862 KNOWN_FOLDER(_FOLDERID_CryptoKeys
,
1871 KNOWN_FOLDER(_FOLDERID_DpapiKeys
,
1880 KNOWN_FOLDER(_FOLDERID_SystemCertificates
,
1882 "SystemCertificates",
1889 { NULL
, NULL
, 0, NULL
, NULL
, 0, 0 }
1892 BOOL known_folder_found
[sizeof(known_folders
)/sizeof(known_folders
[0])-1];
1894 static void check_known_folder(IKnownFolderManager
*mgr
, KNOWNFOLDERID
*folderId
)
1897 const struct knownFolderDef
*known_folder
= &known_folders
[0];
1898 int csidl
, expectedCsidl
, ret
;
1899 KNOWNFOLDER_DEFINITION kfd
;
1900 IKnownFolder
*folder
;
1901 WCHAR sName
[1024], sRelativePath
[MAX_PATH
], sParsingName
[MAX_PATH
];
1903 BOOL
*current_known_folder_found
= &known_folder_found
[0];
1905 const char *srcParsingName
;
1907 while(known_folder
->folderId
!= NULL
)
1909 if(IsEqualGUID(known_folder
->folderId
, folderId
))
1911 *current_known_folder_found
= TRUE
;
1914 if(known_folder
->csidl
!= NO_CSIDL
)
1916 expectedCsidl
= known_folder
->csidl
& (~CSIDL_TODO_WINE
);
1918 hr
= IKnownFolderManager_FolderIdToCsidl(mgr
, folderId
, &csidl
);
1919 ok_(__FILE__
, known_folder
->line
)(hr
== S_OK
, "cannot retrieve CSIDL for folder %s\n", known_folder
->sFolderId
);
1921 if(known_folder
->csidl
& CSIDL_TODO_WINE
)
1922 todo_wine
ok_(__FILE__
, known_folder
->line
)(csidl
== expectedCsidl
, "invalid CSIDL retrieved for folder %s. %d (%s) expected, but %d found\n", known_folder
->sFolderId
, expectedCsidl
, known_folder
->sCsidl
, csidl
);
1924 ok_(__FILE__
, known_folder
->line
)(csidl
== expectedCsidl
, "invalid CSIDL retrieved for folder %s. %d (%s) expected, but %d found\n", known_folder
->sFolderId
, expectedCsidl
, known_folder
->sCsidl
, csidl
);
1927 hr
= IKnownFolderManager_GetFolder(mgr
, folderId
, &folder
);
1928 ok_(__FILE__
, known_folder
->line
)(hr
== S_OK
, "cannot get known folder for %s\n", known_folder
->sFolderId
);
1931 hr
= IKnownFolder_GetFolderDefinition(folder
, &kfd
);
1933 ok_(__FILE__
, known_folder
->line
)(hr
== S_OK
, "cannot get known folder definition for %s\n", known_folder
->sFolderId
);
1936 ret
= MultiByteToWideChar(CP_ACP
, 0, known_folder
->sName
, -1, sName
, sizeof(sName
)/sizeof(sName
[0]));
1937 ok_(__FILE__
, known_folder
->line
)(ret
!= 0, "cannot convert known folder name \"%s\" to wide characters\n", known_folder
->sName
);
1940 ok_(__FILE__
, known_folder
->line
)(lstrcmpW(kfd
.pszName
, sName
)==0, "invalid known folder name returned for %s: %s expected, but %s retrieved\n", known_folder
->sFolderId
, wine_dbgstr_w(sName
), wine_dbgstr_w(kfd
.pszName
));
1942 ok_(__FILE__
, known_folder
->line
)(kfd
.category
== known_folder
->category
, "invalid known folder category for %s: %d expected, but %d retrieved\n", known_folder
->sFolderId
, known_folder
->category
, kfd
.category
);
1944 ok_(__FILE__
, known_folder
->line
)(IsEqualGUID(known_folder
->fidParent
, &kfd
.fidParent
),
1945 "invalid known folder parent for %s: %s expected, but %s retrieved\n",
1946 known_folder
->sFolderId
, known_folder
->sParent
, wine_dbgstr_guid(&kfd
.fidParent
));
1948 if(!known_folder
->sRelativePath
)
1949 validPath
= (kfd
.pszRelativePath
==NULL
);
1952 ret
= MultiByteToWideChar(CP_ACP
, 0, known_folder
->sRelativePath
, -1, sRelativePath
, sizeof(sRelativePath
)/sizeof(sRelativePath
[0]));
1953 ok_(__FILE__
, known_folder
->line
)(ret
!= 0, "cannot convert known folder path \"%s\" to wide characters\n", known_folder
->sRelativePath
);
1955 validPath
= (lstrcmpW(kfd
.pszRelativePath
, sRelativePath
)==0);
1958 ok_(__FILE__
, known_folder
->line
)(validPath
, "invalid known folder relative path returned for %s: %s expected, but %s retrieved\n", known_folder
->sFolderId
, known_folder
->sRelativePath
, wine_dbgstr_w(kfd
.pszRelativePath
));
1960 /* to check parsing name, we need to iterate list */
1961 srcParsingName
= known_folder
->sParsingName
;
1963 /* if we expect NULL, then we don't even check the list */
1964 validPath
= (srcParsingName
==NULL
) && (kfd
.pszParsingName
==NULL
);
1967 while(*srcParsingName
&& !validPath
)
1969 /* when NULL is only one of possible value, we mark path as valid */
1970 validPath
= (strcmp(srcParsingName
, "(null)")==0) && (kfd
.pszParsingName
==NULL
);
1972 /* in the other case, we compare string from list with retrieved value */
1975 ret
= MultiByteToWideChar(CP_ACP
, 0, srcParsingName
, -1, sParsingName
, sizeof(sParsingName
)/sizeof(sParsingName
[0]));
1976 ok_(__FILE__
, known_folder
->line
)(ret
!= 0, "cannot convert known folder path \"%s\" to wide characters\n", srcParsingName
);
1978 validPath
= (lstrcmpW(kfd
.pszParsingName
, sParsingName
)==0);
1981 srcParsingName
+= strlen(srcParsingName
)+1;
1984 ok_(__FILE__
, known_folder
->line
)(validPath
, "invalid known folder parsing name returned for %s: %s retrieved\n", known_folder
->sFolderId
, wine_dbgstr_w(kfd
.pszParsingName
));
1986 ok_(__FILE__
, known_folder
->line
)(known_folder
->attributes
== kfd
.dwAttributes
, "invalid known folder attributes for %s: 0x%08x expected, but 0x%08x retrieved\n", known_folder
->sFolderId
, known_folder
->attributes
, kfd
.dwAttributes
);
1988 ok_(__FILE__
, known_folder
->line
)(!(kfd
.kfdFlags
& (~known_folder
->definitionFlags
)), "invalid known folder flags for %s: 0x%08x expected, but 0x%08x retrieved\n", known_folder
->sFolderId
, known_folder
->definitionFlags
, kfd
.kfdFlags
);
1990 FreeKnownFolderDefinitionFields(&kfd
);
1993 IKnownFolder_Release(folder
);
1999 current_known_folder_found
++;
2004 trace("unknown known folder found: %s\n", wine_dbgstr_guid(folderId
));
2006 hr
= IKnownFolderManager_GetFolder(mgr
, folderId
, &folder
);
2007 ok(hr
== S_OK
, "cannot get known folder for %s\n", wine_dbgstr_guid(folderId
));
2010 hr
= IKnownFolder_GetFolderDefinition(folder
, &kfd
);
2012 ok(hr
== S_OK
, "cannot get known folder definition for %s\n", wine_dbgstr_guid(folderId
));
2015 trace(" category: %d\n", kfd
.category
);
2016 trace(" name: %s\n", wine_dbgstr_w(kfd
.pszName
));
2017 trace(" description: %s\n", wine_dbgstr_w(kfd
.pszDescription
));
2018 trace(" parent: %s\n", wine_dbgstr_guid(&kfd
.fidParent
));
2019 trace(" relative path: %s\n", wine_dbgstr_w(kfd
.pszRelativePath
));
2020 trace(" parsing name: %s\n", wine_dbgstr_w(kfd
.pszParsingName
));
2021 trace(" tooltip: %s\n", wine_dbgstr_w(kfd
.pszTooltip
));
2022 trace(" localized name: %s\n", wine_dbgstr_w(kfd
.pszLocalizedName
));
2023 trace(" icon: %s\n", wine_dbgstr_w(kfd
.pszIcon
));
2024 trace(" security: %s\n", wine_dbgstr_w(kfd
.pszSecurity
));
2025 trace(" attributes: 0x%08x\n", kfd
.dwAttributes
);
2026 trace(" flags: 0x%08x\n", kfd
.kfdFlags
);
2027 trace(" type: %s\n", wine_dbgstr_guid(&kfd
.ftidType
));
2028 FreeKnownFolderDefinitionFields(&kfd
);
2031 IKnownFolder_Release(folder
);
2036 #undef CSIDL_TODO_WINE
2038 static void test_knownFolders(void)
2040 static const WCHAR sWindows
[] = {'W','i','n','d','o','w','s',0};
2041 static const WCHAR sExample
[] = {'E','x','a','m','p','l','e',0};
2042 static const WCHAR sExample2
[] = {'E','x','a','m','p','l','e','2',0};
2043 static const WCHAR sSubFolder
[] = {'S','u','b','F','o','l','d','e','r',0};
2044 static const WCHAR sBackslash
[] = {'\\',0};
2045 static const KNOWNFOLDERID newFolderId
= {0x01234567, 0x89AB, 0xCDEF, {0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x01} };
2046 static const KNOWNFOLDERID subFolderId
= {0xFEDCBA98, 0x7654, 0x3210, {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF} };
2048 IKnownFolderManager
*mgr
= NULL
;
2049 IKnownFolder
*folder
= NULL
, *subFolder
= NULL
;
2050 KNOWNFOLDERID folderId
, *folders
;
2051 KF_CATEGORY cat
= 0;
2052 KNOWNFOLDER_DEFINITION kfDefinition
, kfSubDefinition
;
2055 LPWSTR folderPath
, errorMsg
;
2056 KF_REDIRECTION_CAPABILITIES redirectionCapabilities
= 1;
2057 WCHAR sWinDir
[MAX_PATH
], sExamplePath
[MAX_PATH
], sExample2Path
[MAX_PATH
], sSubFolderPath
[MAX_PATH
], sSubFolder2Path
[MAX_PATH
];
2061 GetWindowsDirectoryW( sWinDir
, MAX_PATH
);
2063 GetTempPathW(sizeof(sExamplePath
)/sizeof(sExamplePath
[0]), sExamplePath
);
2064 lstrcatW(sExamplePath
, sExample
);
2066 GetTempPathW(sizeof(sExample2Path
)/sizeof(sExample2Path
[0]), sExample2Path
);
2067 lstrcatW(sExample2Path
, sExample2
);
2069 lstrcpyW(sSubFolderPath
, sExamplePath
);
2070 lstrcatW(sSubFolderPath
, sBackslash
);
2071 lstrcatW(sSubFolderPath
, sSubFolder
);
2073 lstrcpyW(sSubFolder2Path
, sExample2Path
);
2074 lstrcatW(sSubFolder2Path
, sBackslash
);
2075 lstrcatW(sSubFolder2Path
, sSubFolder
);
2079 hr
= CoCreateInstance(&CLSID_KnownFolderManager
, NULL
, CLSCTX_INPROC_SERVER
,
2080 &IID_IKnownFolderManager
, (LPVOID
*)&mgr
);
2081 if(hr
== REGDB_E_CLASSNOTREG
)
2082 win_skip("IKnownFolderManager unavailable\n");
2085 ok(hr
== S_OK
, "failed to create KnownFolderManager instance: 0x%08x\n", hr
);
2087 hr
= IKnownFolderManager_FolderIdFromCsidl(mgr
, CSIDL_WINDOWS
, &folderId
);
2088 ok(hr
== S_OK
, "failed to convert CSIDL to KNOWNFOLDERID: 0x%08x\n", hr
);
2089 ok(IsEqualGUID(&folderId
, &FOLDERID_Windows
)==TRUE
, "invalid KNOWNFOLDERID returned\n");
2091 hr
= IKnownFolderManager_FolderIdToCsidl(mgr
, &FOLDERID_Windows
, &csidl
);
2092 ok(hr
== S_OK
, "failed to convert CSIDL to KNOWNFOLDERID: 0x%08x\n", hr
);
2093 ok(csidl
== CSIDL_WINDOWS
, "invalid CSIDL returned\n");
2095 hr
= IKnownFolderManager_GetFolder(mgr
, &FOLDERID_Windows
, &folder
);
2096 ok(hr
== S_OK
, "failed to get known folder: 0x%08x\n", hr
);
2099 hr
= IKnownFolder_GetCategory(folder
, &cat
);
2101 ok(hr
== S_OK
, "failed to get folder category: 0x%08x\n", hr
);
2103 ok(cat
==KF_CATEGORY_FIXED
, "invalid folder category: %d\n", cat
);
2105 hr
= IKnownFolder_GetId(folder
, &folderId
);
2106 ok(hr
== S_OK
, "failed to get folder id: 0x%08x\n", hr
);
2107 ok(IsEqualGUID(&folderId
, &FOLDERID_Windows
)==TRUE
, "invalid KNOWNFOLDERID returned\n");
2109 hr
= IKnownFolder_GetPath(folder
, 0, &folderPath
);
2110 ok(lstrcmpiW(sWinDir
, folderPath
)==0, "invalid path returned: \"%s\", expected: \"%s\"\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sWinDir
));
2111 CoTaskMemFree(folderPath
);
2113 hr
= IKnownFolder_GetRedirectionCapabilities(folder
, &redirectionCapabilities
);
2115 ok(hr
== S_OK
, "failed to get redirection capabilities: 0x%08x\n", hr
);
2117 ok(redirectionCapabilities
==0, "invalid redirection capabilities returned: %d\n", redirectionCapabilities
);
2119 hr
= IKnownFolder_SetPath(folder
, 0, sWinDir
);
2121 ok(hr
== E_INVALIDARG
, "unexpected value from SetPath: 0x%08x\n", hr
);
2123 hr
= IKnownFolder_GetFolderDefinition(folder
, &kfDefinition
);
2125 ok(hr
== S_OK
, "failed to get folder definition: 0x%08x\n", hr
);
2129 ok(kfDefinition
.category
==KF_CATEGORY_FIXED
, "invalid folder category: 0x%08x\n", kfDefinition
.category
);
2131 ok(lstrcmpW(kfDefinition
.pszName
, sWindows
)==0, "invalid folder name: %s\n", wine_dbgstr_w(kfDefinition
.pszName
));
2133 ok(kfDefinition
.dwAttributes
==0, "invalid folder attributes: %d\n", kfDefinition
.dwAttributes
);
2134 FreeKnownFolderDefinitionFields(&kfDefinition
);
2137 hr
= IKnownFolder_Release(folder
);
2138 ok(hr
== S_OK
, "failed to release KnownFolder instance: 0x%08x\n", hr
);
2141 hr
= IKnownFolderManager_GetFolderByName(mgr
, sWindows
, &folder
);
2143 ok(hr
== S_OK
, "failed to get known folder: 0x%08x\n", hr
);
2146 hr
= IKnownFolder_GetId(folder
, &folderId
);
2147 ok(hr
== S_OK
, "failed to get folder id: 0x%08x\n", hr
);
2148 ok(IsEqualGUID(&folderId
, &FOLDERID_Windows
)==TRUE
, "invalid KNOWNFOLDERID returned\n");
2150 hr
= IKnownFolder_Release(folder
);
2151 ok(hr
== S_OK
, "failed to release KnownFolder instance: 0x%08x\n", hr
);
2154 for(i
=0; i
<sizeof(known_folder_found
)/sizeof(known_folder_found
[0]); ++i
)
2155 known_folder_found
[i
] = FALSE
;
2157 hr
= IKnownFolderManager_GetFolderIds(mgr
, &folders
, &nCount
);
2158 ok(hr
== S_OK
, "failed to get known folders: 0x%08x\n", hr
);
2159 for(i
=0;i
<nCount
;++i
)
2160 check_known_folder(mgr
, &folders
[i
]);
2162 for(i
=0; i
<sizeof(known_folder_found
)/sizeof(known_folder_found
[0]); ++i
)
2163 if(!known_folder_found
[i
])
2164 trace("Known folder %s not found on current platform\n", known_folders
[i
].sFolderId
);
2166 CoTaskMemFree(folders
);
2168 /* test of registering new known folders */
2169 bRes
= CreateDirectoryW(sExamplePath
, NULL
);
2170 ok(bRes
, "cannot create example directory: %s\n", wine_dbgstr_w(sExamplePath
));
2171 bRes
= CreateDirectoryW(sExample2Path
, NULL
);
2172 ok(bRes
, "cannot create example directory: %s\n", wine_dbgstr_w(sExample2Path
));
2173 bRes
= CreateDirectoryW(sSubFolderPath
, NULL
);
2174 ok(bRes
, "cannot create example directory: %s\n", wine_dbgstr_w(sSubFolderPath
));
2176 ZeroMemory(&kfDefinition
, sizeof(kfDefinition
));
2177 kfDefinition
.category
= KF_CATEGORY_PERUSER
;
2178 kfDefinition
.pszName
= CoTaskMemAlloc(sizeof(sExample
));
2179 lstrcpyW(kfDefinition
.pszName
, sExample
);
2180 kfDefinition
.pszDescription
= CoTaskMemAlloc(sizeof(sExample
));
2181 lstrcpyW(kfDefinition
.pszDescription
, sExample
);
2182 kfDefinition
.pszRelativePath
= CoTaskMemAlloc(sizeof(sExamplePath
));
2183 lstrcpyW(kfDefinition
.pszRelativePath
, sExamplePath
);
2185 hr
= IKnownFolderManager_RegisterFolder(mgr
, &newFolderId
, &kfDefinition
);
2186 if(hr
== HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED
))
2187 win_skip("No permissions required to register custom known folder\n");
2190 ok(hr
== S_OK
, "failed to register known folder: 0x%08x\n", hr
);
2193 hr
= IKnownFolderManager_GetFolder(mgr
, &newFolderId
, &folder
);
2194 ok(hr
== S_OK
, "failed to get known folder: 0x%08x\n", hr
);
2197 hr
= IKnownFolder_GetCategory(folder
, &cat
);
2198 ok(hr
== S_OK
, "failed to get folder category: hr=0x%0x\n", hr
);
2199 ok(cat
== KF_CATEGORY_PERUSER
, "invalid category returned: %d, while %d (KF_CATEGORY_PERUSER) expected\n", cat
, KF_CATEGORY_PERUSER
);
2201 hr
= IKnownFolder_GetId(folder
, &folderId
);
2202 ok(hr
== S_OK
, "failed to get folder id: 0x%08x\n", hr
);
2203 ok(IsEqualGUID(&folderId
, &newFolderId
)==TRUE
, "invalid KNOWNFOLDERID returned\n");
2205 /* current path should be Temp\Example */
2206 hr
= IKnownFolder_GetPath(folder
, 0, &folderPath
);
2207 ok(hr
== S_OK
, "failed to get path from known folder: 0x%08x\n", hr
);
2208 ok(lstrcmpiW(folderPath
, sExamplePath
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sExamplePath
));
2209 CoTaskMemFree(folderPath
);
2211 /* register sub-folder and mark it as child of Example folder */
2212 ZeroMemory(&kfSubDefinition
, sizeof(kfSubDefinition
));
2213 kfSubDefinition
.category
= KF_CATEGORY_PERUSER
;
2214 kfSubDefinition
.pszName
= CoTaskMemAlloc(sizeof(sSubFolder
));
2215 lstrcpyW(kfSubDefinition
.pszName
, sSubFolder
);
2216 kfSubDefinition
.pszDescription
= CoTaskMemAlloc(sizeof(sSubFolder
));
2217 lstrcpyW(kfSubDefinition
.pszDescription
, sSubFolder
);
2218 kfSubDefinition
.pszRelativePath
= CoTaskMemAlloc(sizeof(sSubFolder
));
2219 lstrcpyW(kfSubDefinition
.pszRelativePath
, sSubFolder
);
2220 kfSubDefinition
.fidParent
= newFolderId
;
2222 hr
= IKnownFolderManager_RegisterFolder(mgr
, &subFolderId
, &kfSubDefinition
);
2223 ok(hr
== S_OK
, "failed to register known folder: 0x%08x\n", hr
);
2227 hr
= IKnownFolderManager_GetFolder(mgr
, &subFolderId
, &subFolder
);
2228 ok(hr
== S_OK
, "failed to get known folder: 0x%08x\n", hr
);
2231 /* check sub folder path */
2232 hr
= IKnownFolder_GetPath(subFolder
, 0, &folderPath
);
2233 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2234 ok(lstrcmpiW(folderPath
, sSubFolderPath
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sSubFolderPath
));
2235 CoTaskMemFree(folderPath
);
2238 /* try to redirect Example to Temp\Example2 */
2239 hr
= IKnownFolderManager_Redirect(mgr
, &newFolderId
, NULL
, 0, sExample2Path
, 0, NULL
, &errorMsg
);
2240 ok(hr
== S_OK
, "failed to redirect known folder: 0x%08x, errorMsg: %s\n", hr
, wine_dbgstr_w(errorMsg
));
2243 hr
= IKnownFolder_GetPath(folder
, 0, &folderPath
);
2244 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2245 ok(lstrcmpiW(folderPath
, sExample2Path
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sExample2Path
));
2246 CoTaskMemFree(folderPath
);
2248 /* verify sub folder - it should fail now, as we redirected its parent folder, but we have no sub folder in new location */
2249 hr
= IKnownFolder_GetPath(subFolder
, 0, &folderPath
);
2250 ok(hr
== HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
), "unexpected value from GetPath(): 0x%08x\n", hr
);
2251 ok(folderPath
==NULL
, "invalid known folder path retrieved: \"%s\" when NULL pointer was expected\n", wine_dbgstr_w(folderPath
));
2252 CoTaskMemFree(folderPath
);
2255 /* set Example path to original. Using SetPath() is valid here, as it also uses redirection internally */
2256 hr
= IKnownFolder_SetPath(folder
, 0, sExamplePath
);
2257 ok(hr
== S_OK
, "SetPath() failed: 0x%08x\n", hr
);
2260 hr
= IKnownFolder_GetPath(folder
, 0, &folderPath
);
2261 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2262 ok(lstrcmpiW(folderPath
, sExamplePath
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sExamplePath
));
2263 CoTaskMemFree(folderPath
);
2266 /* create sub folder in Temp\Example2 */
2267 bRes
= CreateDirectoryW(sSubFolder2Path
, NULL
);
2268 ok(bRes
, "cannot create example directory: %s\n", wine_dbgstr_w(sSubFolder2Path
));
2270 /* again perform that same redirection */
2271 hr
= IKnownFolderManager_Redirect(mgr
, &newFolderId
, NULL
, 0, sExample2Path
, 0, NULL
, &errorMsg
);
2272 ok(hr
== S_OK
, "failed to redirect known folder: 0x%08x, errorMsg: %s\n", hr
, wine_dbgstr_w(errorMsg
));
2274 /* verify sub folder. It should succeed now, as the required sub folder exists */
2275 hr
= IKnownFolder_GetPath(subFolder
, 0, &folderPath
);
2276 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2277 ok(lstrcmpiW(folderPath
, sSubFolder2Path
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sSubFolder2Path
));
2278 CoTaskMemFree(folderPath
);
2280 /* remove newly created directory */
2281 RemoveDirectoryW(sSubFolder2Path
);
2283 /* verify sub folder. It still succeedes, so Windows does not check folder presence each time */
2284 hr
= IKnownFolder_GetPath(subFolder
, 0, &folderPath
);
2286 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2288 ok(lstrcmpiW(folderPath
, sSubFolder2Path
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sSubFolder2Path
));
2289 CoTaskMemFree(folderPath
);
2292 /* set Example path to original */
2293 hr
= IKnownFolder_SetPath(folder
, 0, sExamplePath
);
2294 ok(hr
== S_OK
, "SetPath() failed: 0x%08x\n", hr
);
2297 hr
= IKnownFolder_GetPath(folder
, 0, &folderPath
);
2298 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2299 ok(lstrcmpiW(folderPath
, sExamplePath
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sExamplePath
));
2300 CoTaskMemFree(folderPath
);
2302 /* verify sub folder */
2303 hr
= IKnownFolder_GetPath(subFolder
, 0, &folderPath
);
2304 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2305 ok(lstrcmpiW(folderPath
, sSubFolderPath
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sSubFolderPath
));
2306 CoTaskMemFree(folderPath
);
2309 /* create sub folder in Temp\Example2 */
2310 bRes
= CreateDirectoryW(sSubFolder2Path
, NULL
);
2311 ok(bRes
, "cannot create example directory: %s\n", wine_dbgstr_w(sSubFolder2Path
));
2313 /* do that same redirection, but try to exclude sub-folder */
2314 hr
= IKnownFolderManager_Redirect(mgr
, &newFolderId
, NULL
, 0, sExample2Path
, 1, &subFolderId
, &errorMsg
);
2315 ok(hr
== S_OK
, "failed to redirect known folder: 0x%08x, errorMsg: %s\n", hr
, wine_dbgstr_w(errorMsg
));
2318 hr
= IKnownFolder_GetPath(folder
, 0, &folderPath
);
2319 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2320 ok(lstrcmpiW(folderPath
, sExample2Path
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sExample2Path
));
2321 CoTaskMemFree(folderPath
);
2323 /* verify sub folder. Unexpectedly, this path was also changed. So, exclusion seems to be ignored (Windows bug)? This test however will let us know, if this behavior is changed */
2324 hr
= IKnownFolder_GetPath(subFolder
, 0, &folderPath
);
2325 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2326 ok(lstrcmpiW(folderPath
, sSubFolder2Path
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sSubFolder2Path
));
2327 CoTaskMemFree(folderPath
);
2329 /* remove newly created directory */
2330 RemoveDirectoryW(sSubFolder2Path
);
2333 /* set Example path to original */
2334 hr
= IKnownFolder_SetPath(folder
, 0, sExamplePath
);
2335 ok(hr
== S_OK
, "SetPath() failed: 0x%08x\n", hr
);
2338 hr
= IKnownFolder_GetPath(folder
, 0, &folderPath
);
2339 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2340 ok(lstrcmpiW(folderPath
, sExamplePath
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sExamplePath
));
2341 CoTaskMemFree(folderPath
);
2343 /* verify sub folder */
2344 hr
= IKnownFolder_GetPath(subFolder
, 0, &folderPath
);
2345 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2346 ok(lstrcmpiW(folderPath
, sSubFolderPath
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sSubFolderPath
));
2347 CoTaskMemFree(folderPath
);
2350 /* do that same redirection again, but set it to copy content. It should also copy the sub folder, so checking it would succeed now */
2351 hr
= IKnownFolderManager_Redirect(mgr
, &newFolderId
, NULL
, KF_REDIRECT_COPY_CONTENTS
, sExample2Path
, 0, NULL
, &errorMsg
);
2352 ok(hr
== S_OK
, "failed to redirect known folder: 0x%08x, errorMsg: %s\n", hr
, wine_dbgstr_w(errorMsg
));
2355 hr
= IKnownFolder_GetPath(folder
, 0, &folderPath
);
2356 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2357 ok(lstrcmpiW(folderPath
, sExample2Path
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sExample2Path
));
2358 CoTaskMemFree(folderPath
);
2360 /* verify sub folder */
2361 hr
= IKnownFolder_GetPath(subFolder
, 0, &folderPath
);
2362 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2363 ok(lstrcmpiW(folderPath
, sSubFolder2Path
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sSubFolder2Path
));
2364 CoTaskMemFree(folderPath
);
2366 /* remove copied directory */
2367 RemoveDirectoryW(sSubFolder2Path
);
2370 /* set Example path to original */
2371 hr
= IKnownFolder_SetPath(folder
, 0, sExamplePath
);
2372 ok(hr
== S_OK
, "SetPath() failed: 0x%08x\n", hr
);
2375 hr
= IKnownFolder_GetPath(folder
, 0, &folderPath
);
2376 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2377 ok(lstrcmpiW(folderPath
, sExamplePath
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sExamplePath
));
2378 CoTaskMemFree(folderPath
);
2380 /* verify sub folder */
2381 hr
= IKnownFolder_GetPath(subFolder
, 0, &folderPath
);
2382 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2383 ok(lstrcmpiW(folderPath
, sSubFolderPath
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sSubFolderPath
));
2384 CoTaskMemFree(folderPath
);
2387 /* redirect again, set it to copy content and remove originals */
2388 hr
= IKnownFolderManager_Redirect(mgr
, &newFolderId
, NULL
, KF_REDIRECT_COPY_CONTENTS
| KF_REDIRECT_DEL_SOURCE_CONTENTS
, sExample2Path
, 0, NULL
, &errorMsg
);
2389 ok(hr
== S_OK
, "failed to redirect known folder: 0x%08x, errorMsg: %s\n", hr
, wine_dbgstr_w(errorMsg
));
2392 hr
= IKnownFolder_GetPath(folder
, 0, &folderPath
);
2393 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2394 ok(lstrcmpiW(folderPath
, sExample2Path
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sExample2Path
));
2395 CoTaskMemFree(folderPath
);
2397 /* verify sub folder */
2398 hr
= IKnownFolder_GetPath(subFolder
, 0, &folderPath
);
2399 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2400 ok(lstrcmpiW(folderPath
, sSubFolder2Path
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sSubFolder2Path
));
2401 CoTaskMemFree(folderPath
);
2403 /* check if original directory was really removed */
2404 dwAttributes
= GetFileAttributesW(sExamplePath
);
2405 ok(dwAttributes
==INVALID_FILE_ATTRIBUTES
, "directory should not exist, but has attributes: 0x%08x\n", dwAttributes
);
2408 /* redirect (with copy) to original path */
2409 hr
= IKnownFolderManager_Redirect(mgr
, &newFolderId
, NULL
, KF_REDIRECT_COPY_CONTENTS
, sExamplePath
, 0, NULL
, &errorMsg
);
2410 ok(hr
== S_OK
, "failed to redirect known folder: 0x%08x, errorMsg: %s\n", hr
, wine_dbgstr_w(errorMsg
));
2413 hr
= IKnownFolder_GetPath(folder
, 0, &folderPath
);
2414 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2415 ok(lstrcmpiW(folderPath
, sExamplePath
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sExamplePath
));
2416 CoTaskMemFree(folderPath
);
2418 /* verify sub folder */
2419 hr
= IKnownFolder_GetPath(subFolder
, 0, &folderPath
);
2420 ok(hr
== S_OK
, "failed to get known folder path: 0x%08x\n", hr
);
2421 ok(lstrcmpiW(folderPath
, sSubFolderPath
)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath
), wine_dbgstr_w(sSubFolderPath
));
2422 CoTaskMemFree(folderPath
);
2424 /* check shell utility functions */
2425 if(!pSHGetKnownFolderPath
|| !pSHSetKnownFolderPath
)
2427 win_skip("cannot get SHGet/SetKnownFolderPath routines\n");
2430 /* try to get current known folder path */
2431 hr
= pSHGetKnownFolderPath(&newFolderId
, 0, NULL
, &folderPath
);
2433 ok(hr
==S_OK
, "cannot get known folder path: hr=0x%0x\n", hr
);
2435 ok(lstrcmpW(folderPath
, sExamplePath
)==0, "invalid path returned: %s\n", wine_dbgstr_w(folderPath
));
2437 /* set it to new value */
2438 hr
= pSHSetKnownFolderPath(&newFolderId
, 0, NULL
, sExample2Path
);
2440 ok(hr
==S_OK
, "cannot set known folder path: hr=0x%0x\n", hr
);
2442 /* check if it changed */
2443 hr
= pSHGetKnownFolderPath(&newFolderId
, 0, NULL
, &folderPath
);
2445 ok(hr
==S_OK
, "cannot get known folder path: hr=0x%0x\n", hr
);
2447 ok(lstrcmpW(folderPath
, sExample2Path
)==0, "invalid path returned: %s\n", wine_dbgstr_w(folderPath
));
2450 hr
= pSHSetKnownFolderPath(&newFolderId
, 0, NULL
, sExamplePath
);
2452 ok(hr
==S_OK
, "cannot set known folder path: hr=0x%0x\n", hr
);
2455 IKnownFolder_Release(subFolder
);
2458 hr
= IKnownFolderManager_UnregisterFolder(mgr
, &subFolderId
);
2459 ok(hr
== S_OK
, "failed to unregister folder: 0x%08x\n", hr
);
2462 FreeKnownFolderDefinitionFields(&kfSubDefinition
);
2464 hr
= IKnownFolder_Release(folder
);
2465 ok(hr
== S_OK
, "failed to release KnownFolder instance: 0x%08x\n", hr
);
2468 hr
= IKnownFolderManager_UnregisterFolder(mgr
, &newFolderId
);
2469 ok(hr
== S_OK
, "failed to unregister folder: 0x%08x\n", hr
);
2472 FreeKnownFolderDefinitionFields(&kfDefinition
);
2474 RemoveDirectoryW(sSubFolder2Path
);
2475 RemoveDirectoryW(sSubFolderPath
);
2476 RemoveDirectoryW(sExamplePath
);
2477 RemoveDirectoryW(sExample2Path
);
2479 hr
= IKnownFolderManager_Release(mgr
);
2480 ok(hr
== S_OK
, "failed to release KnownFolderManager instance: 0x%08x\n", hr
);
2486 static void test_DoEnvironmentSubst(void)
2488 WCHAR expectedW
[MAX_PATH
];
2489 WCHAR bufferW
[MAX_PATH
];
2490 CHAR expectedA
[MAX_PATH
];
2491 CHAR bufferA
[MAX_PATH
];
2496 static const WCHAR does_not_existW
[] = {'%','D','O','E','S','_','N','O','T','_','E','X','I','S','T','%',0};
2497 static const CHAR does_not_existA
[] = "%DOES_NOT_EXIST%";
2498 static const CHAR
*names
[] = {
2499 /* interactive apps and services (works on all windows versions) */
2500 "%ALLUSERSPROFILE%", "%APPDATA%", "%LOCALAPPDATA%",
2501 "%NUMBER_OF_PROCESSORS%", "%OS%", "%PROCESSOR_ARCHITECTURE%",
2502 "%PROCESSOR_IDENTIFIER%", "%PROCESSOR_LEVEL%", "%PROCESSOR_REVISION%",
2503 "%ProgramFiles%", "%SystemDrive%",
2504 "%SystemRoot%", "%USERPROFILE%", "%windir%",
2505 /* todo_wine: "%COMPUTERNAME%", "%ProgramData%", "%PUBLIC%", */
2507 /* replace more than one var is allowed */
2508 "%HOMEDRIVE%%HOMEPATH%",
2509 "%OS% %windir%"}; /* always the last entry in the table */
2511 for (i
= 0; i
< (sizeof(names
)/sizeof(LPSTR
)); i
++)
2513 memset(bufferA
, '#', MAX_PATH
- 1);
2514 bufferA
[MAX_PATH
- 1] = 0;
2515 lstrcpyA(bufferA
, names
[i
]);
2516 MultiByteToWideChar(CP_ACP
, 0, bufferA
, MAX_PATH
, bufferW
, sizeof(bufferW
)/sizeof(WCHAR
));
2518 res2
= ExpandEnvironmentStringsA(names
[i
], expectedA
, MAX_PATH
);
2519 res
= DoEnvironmentSubstA(bufferA
, MAX_PATH
);
2521 /* is the space for the terminating 0 included? */
2522 if (!i
&& HIWORD(res
) && (LOWORD(res
) == (lstrlenA(bufferA
))))
2524 win_skip("DoEnvironmentSubstA/W are broken on NT 4\n");
2527 ok(HIWORD(res
) && (LOWORD(res
) == res2
),
2528 "%d: got %d/%d (expected TRUE/%d)\n", i
, HIWORD(res
), LOWORD(res
), res2
);
2529 ok(!lstrcmpA(bufferA
, expectedA
),
2530 "%d: got %s (expected %s)\n", i
, bufferA
, expectedA
);
2532 res2
= ExpandEnvironmentStringsW(bufferW
, expectedW
, MAX_PATH
);
2533 res
= DoEnvironmentSubstW(bufferW
, MAX_PATH
);
2534 ok(HIWORD(res
) && (LOWORD(res
) == res2
),
2535 "%d: got %d/%d (expected TRUE/%d)\n", i
, HIWORD(res
), LOWORD(res
), res2
);
2536 ok(!lstrcmpW(bufferW
, expectedW
),
2537 "%d: got %s (expected %s)\n", i
, wine_dbgstr_w(bufferW
), wine_dbgstr_w(expectedW
));
2540 i
--; /* reuse data in the last table entry */
2541 len
= LOWORD(res
); /* needed length */
2543 /* one character extra is fine */
2544 memset(bufferA
, '#', MAX_PATH
- 1);
2545 bufferA
[len
+ 2] = 0;
2546 lstrcpyA(bufferA
, names
[i
]);
2547 MultiByteToWideChar(CP_ACP
, 0, bufferA
, MAX_PATH
, bufferW
, sizeof(bufferW
)/sizeof(WCHAR
));
2549 res2
= ExpandEnvironmentStringsA(bufferA
, expectedA
, MAX_PATH
);
2550 res
= DoEnvironmentSubstA(bufferA
, len
+ 1);
2551 ok(HIWORD(res
) && (LOWORD(res
) == res2
),
2552 "+1: got %d/%d (expected TRUE/%d)\n", HIWORD(res
), LOWORD(res
), res2
);
2553 ok(!lstrcmpA(bufferA
, expectedA
),
2554 "+1: got %s (expected %s)\n", bufferA
, expectedA
);
2556 res2
= ExpandEnvironmentStringsW(bufferW
, expectedW
, MAX_PATH
);
2557 res
= DoEnvironmentSubstW(bufferW
, len
+ 1);
2558 ok(HIWORD(res
) && (LOWORD(res
) == res2
),
2559 "+1: got %d/%d (expected TRUE/%d)\n", HIWORD(res
), LOWORD(res
), res2
);
2560 ok(!lstrcmpW(bufferW
, expectedW
),
2561 "+1: got %s (expected %s)\n", wine_dbgstr_w(bufferW
), wine_dbgstr_w(expectedW
));
2564 /* minimal buffer length (result string and terminating 0) */
2565 memset(bufferA
, '#', MAX_PATH
- 1);
2566 bufferA
[len
+ 2] = 0;
2567 lstrcpyA(bufferA
, names
[i
]);
2568 MultiByteToWideChar(CP_ACP
, 0, bufferA
, MAX_PATH
, bufferW
, sizeof(bufferW
)/sizeof(WCHAR
));
2570 /* ANSI version failed without an extra byte, as documented on msdn */
2571 res
= DoEnvironmentSubstA(bufferA
, len
);
2572 ok(!HIWORD(res
) && (LOWORD(res
) == len
),
2573 " 0: got %d/%d (expected FALSE/%d)\n", HIWORD(res
), LOWORD(res
), len
);
2574 ok(!lstrcmpA(bufferA
, names
[i
]),
2575 " 0: got %s (expected %s)\n", bufferA
, names
[i
]);
2577 /* DoEnvironmentSubstW works as expected */
2578 res2
= ExpandEnvironmentStringsW(bufferW
, expectedW
, MAX_PATH
);
2579 res
= DoEnvironmentSubstW(bufferW
, len
);
2580 ok(HIWORD(res
) && (LOWORD(res
) == res2
),
2581 " 0: got %d/%d (expected TRUE/%d)\n", HIWORD(res
), LOWORD(res
), res2
);
2582 ok(!lstrcmpW(bufferW
, expectedW
),
2583 " 0: got %s (expected %s)\n", wine_dbgstr_w(bufferW
), wine_dbgstr_w(expectedW
));
2586 /* Buffer too small */
2587 /* result: FALSE / provided buffer length / the buffer is untouched */
2588 memset(bufferA
, '#', MAX_PATH
- 1);
2589 bufferA
[len
+ 2] = 0;
2590 lstrcpyA(bufferA
, names
[i
]);
2591 MultiByteToWideChar(CP_ACP
, 0, bufferA
, MAX_PATH
, bufferW
, sizeof(bufferW
)/sizeof(WCHAR
));
2593 res
= DoEnvironmentSubstA(bufferA
, len
- 1);
2594 ok(!HIWORD(res
) && (LOWORD(res
) == (len
- 1)),
2595 "-1: got %d/%d (expected FALSE/%d)\n", HIWORD(res
), LOWORD(res
), len
- 1);
2596 ok(!lstrcmpA(bufferA
, names
[i
]),
2597 "-1: got %s (expected %s)\n", bufferA
, names
[i
]);
2599 lstrcpyW(expectedW
, bufferW
);
2600 res
= DoEnvironmentSubstW(bufferW
, len
- 1);
2601 ok(!HIWORD(res
) && (LOWORD(res
) == (len
- 1)),
2602 "-1: got %d/%d (expected FALSE/%d)\n", HIWORD(res
), LOWORD(res
), len
- 1);
2603 ok(!lstrcmpW(bufferW
, expectedW
),
2604 "-1: got %s (expected %s)\n", wine_dbgstr_w(bufferW
), wine_dbgstr_w(expectedW
));
2607 /* unknown variable */
2608 /* result: TRUE / string length including terminating 0 / the buffer is untouched */
2609 memset(bufferA
, '#', MAX_PATH
- 1);
2610 bufferA
[MAX_PATH
- 1] = 0;
2611 lstrcpyA(bufferA
, does_not_existA
);
2612 MultiByteToWideChar(CP_ACP
, 0, bufferA
, MAX_PATH
, bufferW
, sizeof(bufferW
)/sizeof(WCHAR
));
2614 res2
= lstrlenA(does_not_existA
) + 1;
2615 res
= DoEnvironmentSubstA(bufferA
, MAX_PATH
);
2616 ok(HIWORD(res
) && (LOWORD(res
) == res2
),
2617 "%d: got %d/%d (expected TRUE/%d)\n", i
, HIWORD(res
), LOWORD(res
), res2
);
2618 ok(!lstrcmpA(bufferA
, does_not_existA
),
2619 "%d: got %s (expected %s)\n", i
, bufferA
, does_not_existA
);
2621 res
= DoEnvironmentSubstW(bufferW
, MAX_PATH
);
2622 ok(HIWORD(res
) && (LOWORD(res
) == res2
),
2623 "%d: got %d/%d (expected TRUE/%d)\n", i
, HIWORD(res
), LOWORD(res
), res2
);
2624 ok(!lstrcmpW(bufferW
, does_not_existW
),
2625 "%d: got %s (expected %s)\n", i
, wine_dbgstr_w(bufferW
), wine_dbgstr_w(does_not_existW
));
2630 /* NULL crashes on windows */
2631 res
= DoEnvironmentSubstA(NULL
, MAX_PATH
);
2632 res
= DoEnvironmentSubstW(NULL
, MAX_PATH
);
2636 static void test_PathYetAnotherMakeUniqueName(void)
2638 static const WCHAR shortW
[] = {'f','i','l','e','.','t','s','t',0};
2639 static const WCHAR short2W
[] = {'f','i','l','e',' ','(','2',')','.','t','s','t',0};
2640 static const WCHAR tmpW
[] = {'t','m','p',0};
2641 static const WCHAR longW
[] = {'n','a','m','e',0};
2642 static const WCHAR long2W
[] = {'n','a','m','e',' ','(','2',')',0};
2643 WCHAR nameW
[MAX_PATH
], buffW
[MAX_PATH
], pathW
[MAX_PATH
];
2647 if (!pPathYetAnotherMakeUniqueName
)
2649 win_skip("PathYetAnotherMakeUniqueName() is not available.\n");
2655 /* crashes on Windows */
2656 ret
= pPathYetAnotherMakeUniqueName(NULL
, NULL
, NULL
, NULL
);
2657 ok(!ret
, "got %d\n", ret
);
2659 ret
= pPathYetAnotherMakeUniqueName(nameW
, NULL
, NULL
, NULL
);
2660 ok(!ret
, "got %d\n", ret
);
2663 GetTempPathW(sizeof(pathW
)/sizeof(WCHAR
), pathW
);
2665 /* Using short name only first */
2667 ret
= pPathYetAnotherMakeUniqueName(nameW
, pathW
, shortW
, NULL
);
2668 ok(ret
, "got %d\n", ret
);
2669 lstrcpyW(buffW
, pathW
);
2670 lstrcatW(buffW
, shortW
);
2671 ok(!lstrcmpW(nameW
, buffW
), "got %s, expected %s\n", wine_dbgstr_w(nameW
), wine_dbgstr_w(buffW
));
2673 /* now create a file with this name and get next name */
2674 file
= CreateFileW(nameW
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, FILE_FLAG_DELETE_ON_CLOSE
, NULL
);
2675 ok(file
!= NULL
, "got %p\n", file
);
2678 ret
= pPathYetAnotherMakeUniqueName(nameW
, pathW
, shortW
, NULL
);
2679 ok(ret
, "got %d\n", ret
);
2680 lstrcpyW(buffW
, pathW
);
2681 lstrcatW(buffW
, short2W
);
2682 ok(!lstrcmpW(nameW
, buffW
), "got %s, expected %s\n", wine_dbgstr_w(nameW
), wine_dbgstr_w(buffW
));
2686 /* Using short and long */
2688 ret
= pPathYetAnotherMakeUniqueName(nameW
, pathW
, tmpW
, longW
);
2689 ok(ret
, "got %d\n", ret
);
2690 lstrcpyW(buffW
, pathW
);
2691 lstrcatW(buffW
, longW
);
2692 ok(!lstrcmpW(nameW
, buffW
), "got %s, expected %s\n", wine_dbgstr_w(nameW
), wine_dbgstr_w(buffW
));
2694 file
= CreateFileW(nameW
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, FILE_FLAG_DELETE_ON_CLOSE
, NULL
);
2695 ok(file
!= NULL
, "got %p\n", file
);
2698 ret
= pPathYetAnotherMakeUniqueName(nameW
, pathW
, tmpW
, longW
);
2699 ok(ret
, "got %d\n", ret
);
2700 lstrcpyW(buffW
, pathW
);
2701 lstrcatW(buffW
, long2W
);
2702 ok(!lstrcmpW(nameW
, buffW
), "got %s, expected %s\n", wine_dbgstr_w(nameW
), wine_dbgstr_w(buffW
));
2706 /* Using long only */
2708 ret
= pPathYetAnotherMakeUniqueName(nameW
, pathW
, NULL
, longW
);
2709 ok(ret
, "got %d\n", ret
);
2710 lstrcpyW(buffW
, pathW
);
2711 lstrcatW(buffW
, longW
);
2712 ok(!lstrcmpW(nameW
, buffW
), "got %s, expected %s\n", wine_dbgstr_w(nameW
), wine_dbgstr_w(buffW
));
2715 START_TEST(shellpath
)
2717 if (!init()) return;
2720 pGetSystemWow64DirectoryA
= (void *)GetProcAddress( GetModuleHandleA("kernel32.dll"),
2721 "GetSystemWow64DirectoryA" );
2726 /* Report missing functions once */
2727 if (!pSHGetFolderLocation
)
2728 win_skip("SHGetFolderLocation is not available\n");
2730 /* first test various combinations of parameters: */
2733 /* check known values: */
2739 test_NonExistentPath();
2740 test_SHGetFolderPathEx();
2741 test_knownFolders();
2742 test_DoEnvironmentSubst();
2743 test_PathYetAnotherMakeUniqueName();