4 * Copyright 1998, 1999, 2000 Juergen Schmied
5 * Copyright 2004 Juan Lang
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 * Many of these functions are in SHLWAPI.DLL also
30 #include "wine/port.h"
36 #include "wine/debug.h"
47 #include "shell32_main.h"
48 #include "undocshell.h"
50 #include "wine/unicode.h"
54 #include "knownfolders.h"
58 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
60 static const BOOL is_win64
= sizeof(void *) > sizeof(int);
63 ########## Combining and Constructing paths ##########
66 /*************************************************************************
67 * PathAppend [SHELL32.36]
69 BOOL WINAPI
PathAppendAW(
73 if (SHELL_OsIsUnicode())
74 return PathAppendW(lpszPath1
, lpszPath2
);
75 return PathAppendA(lpszPath1
, lpszPath2
);
78 /*************************************************************************
79 * PathCombine [SHELL32.37]
81 LPVOID WINAPI
PathCombineAW(
86 if (SHELL_OsIsUnicode())
87 return PathCombineW( szDest
, lpszDir
, lpszFile
);
88 return PathCombineA( szDest
, lpszDir
, lpszFile
);
91 /*************************************************************************
92 * PathAddBackslash [SHELL32.32]
94 LPVOID WINAPI
PathAddBackslashAW(LPVOID lpszPath
)
96 if(SHELL_OsIsUnicode())
97 return PathAddBackslashW(lpszPath
);
98 return PathAddBackslashA(lpszPath
);
101 /*************************************************************************
102 * PathBuildRoot [SHELL32.30]
104 LPVOID WINAPI
PathBuildRootAW(LPVOID lpszPath
, int drive
)
106 if(SHELL_OsIsUnicode())
107 return PathBuildRootW(lpszPath
, drive
);
108 return PathBuildRootA(lpszPath
, drive
);
112 Extracting Component Parts
115 /*************************************************************************
116 * PathFindFileName [SHELL32.34]
118 LPVOID WINAPI
PathFindFileNameAW(LPCVOID lpszPath
)
120 if(SHELL_OsIsUnicode())
121 return PathFindFileNameW(lpszPath
);
122 return PathFindFileNameA(lpszPath
);
125 /*************************************************************************
126 * PathFindExtension [SHELL32.31]
128 LPVOID WINAPI
PathFindExtensionAW(LPCVOID lpszPath
)
130 if (SHELL_OsIsUnicode())
131 return PathFindExtensionW(lpszPath
);
132 return PathFindExtensionA(lpszPath
);
136 /*************************************************************************
137 * PathGetExtensionA [internal]
140 * exported by ordinal
141 * return value points to the first char after the dot
143 static LPSTR
PathGetExtensionA(LPCSTR lpszPath
)
145 TRACE("(%s)\n",lpszPath
);
147 lpszPath
= PathFindExtensionA(lpszPath
);
148 return (LPSTR
)(*lpszPath
?(lpszPath
+1):lpszPath
);
151 /*************************************************************************
152 * PathGetExtensionW [internal]
154 static LPWSTR
PathGetExtensionW(LPCWSTR lpszPath
)
156 TRACE("(%s)\n",debugstr_w(lpszPath
));
158 lpszPath
= PathFindExtensionW(lpszPath
);
159 return (LPWSTR
)(*lpszPath
?(lpszPath
+1):lpszPath
);
162 /*************************************************************************
163 * PathGetExtension [SHELL32.158]
165 LPVOID WINAPI
PathGetExtensionAW(LPCVOID lpszPath
,DWORD void1
, DWORD void2
)
167 if (SHELL_OsIsUnicode())
168 return PathGetExtensionW(lpszPath
);
169 return PathGetExtensionA(lpszPath
);
172 /*************************************************************************
173 * PathGetArgs [SHELL32.52]
175 LPVOID WINAPI
PathGetArgsAW(LPVOID lpszPath
)
177 if (SHELL_OsIsUnicode())
178 return PathGetArgsW(lpszPath
);
179 return PathGetArgsA(lpszPath
);
182 /*************************************************************************
183 * PathGetDriveNumber [SHELL32.57]
185 int WINAPI
PathGetDriveNumberAW(LPVOID lpszPath
)
187 if (SHELL_OsIsUnicode())
188 return PathGetDriveNumberW(lpszPath
);
189 return PathGetDriveNumberA(lpszPath
);
192 /*************************************************************************
193 * PathRemoveFileSpec [SHELL32.35]
195 BOOL WINAPI
PathRemoveFileSpecAW(LPVOID lpszPath
)
197 if (SHELL_OsIsUnicode())
198 return PathRemoveFileSpecW(lpszPath
);
199 return PathRemoveFileSpecA(lpszPath
);
202 /*************************************************************************
203 * PathStripPath [SHELL32.38]
205 void WINAPI
PathStripPathAW(LPVOID lpszPath
)
207 if (SHELL_OsIsUnicode())
208 PathStripPathW(lpszPath
);
210 PathStripPathA(lpszPath
);
213 /*************************************************************************
214 * PathStripToRoot [SHELL32.50]
216 BOOL WINAPI
PathStripToRootAW(LPVOID lpszPath
)
218 if (SHELL_OsIsUnicode())
219 return PathStripToRootW(lpszPath
);
220 return PathStripToRootA(lpszPath
);
223 /*************************************************************************
224 * PathRemoveArgs [SHELL32.251]
226 void WINAPI
PathRemoveArgsAW(LPVOID lpszPath
)
228 if (SHELL_OsIsUnicode())
229 PathRemoveArgsW(lpszPath
);
231 PathRemoveArgsA(lpszPath
);
234 /*************************************************************************
235 * PathRemoveExtension [SHELL32.250]
237 void WINAPI
PathRemoveExtensionAW(LPVOID lpszPath
)
239 if (SHELL_OsIsUnicode())
240 PathRemoveExtensionW(lpszPath
);
242 PathRemoveExtensionA(lpszPath
);
250 /*************************************************************************
251 * PathGetShortPathA [internal]
253 static void PathGetShortPathA(LPSTR pszPath
)
257 TRACE("%s\n", pszPath
);
259 if (GetShortPathNameA(pszPath
, path
, MAX_PATH
))
261 lstrcpyA(pszPath
, path
);
265 /*************************************************************************
266 * PathGetShortPathW [internal]
268 static void PathGetShortPathW(LPWSTR pszPath
)
270 WCHAR path
[MAX_PATH
];
272 TRACE("%s\n", debugstr_w(pszPath
));
274 if (GetShortPathNameW(pszPath
, path
, MAX_PATH
))
276 lstrcpyW(pszPath
, path
);
280 /*************************************************************************
281 * PathGetShortPath [SHELL32.92]
283 VOID WINAPI
PathGetShortPathAW(LPVOID pszPath
)
285 if(SHELL_OsIsUnicode())
286 PathGetShortPathW(pszPath
);
287 PathGetShortPathA(pszPath
);
290 /*************************************************************************
291 * PathRemoveBlanks [SHELL32.33]
293 void WINAPI
PathRemoveBlanksAW(LPVOID str
)
295 if(SHELL_OsIsUnicode())
296 PathRemoveBlanksW(str
);
298 PathRemoveBlanksA(str
);
301 /*************************************************************************
302 * PathQuoteSpaces [SHELL32.55]
304 VOID WINAPI
PathQuoteSpacesAW (LPVOID lpszPath
)
306 if(SHELL_OsIsUnicode())
307 PathQuoteSpacesW(lpszPath
);
309 PathQuoteSpacesA(lpszPath
);
312 /*************************************************************************
313 * PathUnquoteSpaces [SHELL32.56]
315 VOID WINAPI
PathUnquoteSpacesAW(LPVOID str
)
317 if(SHELL_OsIsUnicode())
318 PathUnquoteSpacesW(str
);
320 PathUnquoteSpacesA(str
);
323 /*************************************************************************
324 * PathParseIconLocation [SHELL32.249]
326 int WINAPI
PathParseIconLocationAW (LPVOID lpszPath
)
328 if(SHELL_OsIsUnicode())
329 return PathParseIconLocationW(lpszPath
);
330 return PathParseIconLocationA(lpszPath
);
334 ########## Path Testing ##########
336 /*************************************************************************
337 * PathIsUNC [SHELL32.39]
339 BOOL WINAPI
PathIsUNCAW (LPCVOID lpszPath
)
341 if (SHELL_OsIsUnicode())
342 return PathIsUNCW( lpszPath
);
343 return PathIsUNCA( lpszPath
);
346 /*************************************************************************
347 * PathIsRelative [SHELL32.40]
349 BOOL WINAPI
PathIsRelativeAW (LPCVOID lpszPath
)
351 if (SHELL_OsIsUnicode())
352 return PathIsRelativeW( lpszPath
);
353 return PathIsRelativeA( lpszPath
);
356 /*************************************************************************
357 * PathIsRoot [SHELL32.29]
359 BOOL WINAPI
PathIsRootAW(LPCVOID lpszPath
)
361 if (SHELL_OsIsUnicode())
362 return PathIsRootW(lpszPath
);
363 return PathIsRootA(lpszPath
);
366 /*************************************************************************
367 * PathIsExeA [internal]
369 static BOOL
PathIsExeA (LPCSTR lpszPath
)
371 LPCSTR lpszExtension
= PathGetExtensionA(lpszPath
);
373 static const char * const lpszExtensions
[] =
374 {"exe", "com", "pif", "cmd", "bat", "scf", "scr", NULL
};
376 TRACE("path=%s\n",lpszPath
);
378 for(i
=0; lpszExtensions
[i
]; i
++)
379 if (!lstrcmpiA(lpszExtension
,lpszExtensions
[i
])) return TRUE
;
384 /*************************************************************************
385 * PathIsExeW [internal]
387 static BOOL
PathIsExeW (LPCWSTR lpszPath
)
389 LPCWSTR lpszExtension
= PathGetExtensionW(lpszPath
);
391 static const WCHAR lpszExtensions
[][4] =
392 {{'e','x','e','\0'}, {'c','o','m','\0'}, {'p','i','f','\0'},
393 {'c','m','d','\0'}, {'b','a','t','\0'}, {'s','c','f','\0'},
394 {'s','c','r','\0'}, {'\0'} };
396 TRACE("path=%s\n",debugstr_w(lpszPath
));
398 for(i
=0; lpszExtensions
[i
][0]; i
++)
399 if (!strcmpiW(lpszExtension
,lpszExtensions
[i
])) return TRUE
;
404 /*************************************************************************
405 * PathIsExe [SHELL32.43]
407 BOOL WINAPI
PathIsExeAW (LPCVOID path
)
409 if (SHELL_OsIsUnicode())
410 return PathIsExeW (path
);
411 return PathIsExeA(path
);
414 /*************************************************************************
415 * PathIsDirectory [SHELL32.159]
417 BOOL WINAPI
PathIsDirectoryAW (LPCVOID lpszPath
)
419 if (SHELL_OsIsUnicode())
420 return PathIsDirectoryW (lpszPath
);
421 return PathIsDirectoryA (lpszPath
);
424 /*************************************************************************
425 * PathFileExists [SHELL32.45]
427 BOOL WINAPI
PathFileExistsAW (LPCVOID lpszPath
)
429 if (SHELL_OsIsUnicode())
430 return PathFileExistsW (lpszPath
);
431 return PathFileExistsA (lpszPath
);
434 /*************************************************************************
435 * PathMatchSpec [SHELL32.46]
437 BOOL WINAPI
PathMatchSpecAW(LPVOID name
, LPVOID mask
)
439 if (SHELL_OsIsUnicode())
440 return PathMatchSpecW( name
, mask
);
441 return PathMatchSpecA( name
, mask
);
444 /*************************************************************************
445 * PathIsSameRoot [SHELL32.650]
447 BOOL WINAPI
PathIsSameRootAW(LPCVOID lpszPath1
, LPCVOID lpszPath2
)
449 if (SHELL_OsIsUnicode())
450 return PathIsSameRootW(lpszPath1
, lpszPath2
);
451 return PathIsSameRootA(lpszPath1
, lpszPath2
);
454 /*************************************************************************
455 * IsLFNDriveA [SHELL32.41]
457 BOOL WINAPI
IsLFNDriveA(LPCSTR lpszPath
)
461 if (!GetVolumeInformationA(lpszPath
, NULL
, 0, NULL
, &fnlen
, NULL
, NULL
, 0))
466 /*************************************************************************
467 * IsLFNDriveW [SHELL32.42]
469 BOOL WINAPI
IsLFNDriveW(LPCWSTR lpszPath
)
473 if (!GetVolumeInformationW(lpszPath
, NULL
, 0, NULL
, &fnlen
, NULL
, NULL
, 0))
478 /*************************************************************************
479 * IsLFNDrive [SHELL32.119]
481 BOOL WINAPI
IsLFNDriveAW(LPCVOID lpszPath
)
483 if (SHELL_OsIsUnicode())
484 return IsLFNDriveW(lpszPath
);
485 return IsLFNDriveA(lpszPath
);
489 ########## Creating Something Unique ##########
491 /*************************************************************************
492 * PathMakeUniqueNameA [internal]
494 static BOOL
PathMakeUniqueNameA(
497 LPCSTR lpszShortName
,
501 FIXME("%p %u %s %s %s stub\n",
502 lpszBuffer
, dwBuffSize
, debugstr_a(lpszShortName
),
503 debugstr_a(lpszLongName
), debugstr_a(lpszPathName
));
507 /*************************************************************************
508 * PathMakeUniqueNameW [internal]
510 static BOOL
PathMakeUniqueNameW(
513 LPCWSTR lpszShortName
,
514 LPCWSTR lpszLongName
,
515 LPCWSTR lpszPathName
)
517 FIXME("%p %u %s %s %s stub\n",
518 lpszBuffer
, dwBuffSize
, debugstr_w(lpszShortName
),
519 debugstr_w(lpszLongName
), debugstr_w(lpszPathName
));
523 /*************************************************************************
524 * PathMakeUniqueName [SHELL32.47]
526 BOOL WINAPI
PathMakeUniqueNameAW(
529 LPCVOID lpszShortName
,
530 LPCVOID lpszLongName
,
531 LPCVOID lpszPathName
)
533 if (SHELL_OsIsUnicode())
534 return PathMakeUniqueNameW(lpszBuffer
,dwBuffSize
, lpszShortName
,lpszLongName
,lpszPathName
);
535 return PathMakeUniqueNameA(lpszBuffer
,dwBuffSize
, lpszShortName
,lpszLongName
,lpszPathName
);
538 /*************************************************************************
539 * PathYetAnotherMakeUniqueName [SHELL32.75]
541 BOOL WINAPI
PathYetAnotherMakeUniqueName(LPWSTR buffer
, LPCWSTR path
, LPCWSTR shortname
, LPCWSTR longname
)
543 WCHAR pathW
[MAX_PATH
], retW
[MAX_PATH
];
544 const WCHAR
*file
, *ext
;
547 TRACE("(%p, %s, %s, %s)\n", buffer
, debugstr_w(path
), debugstr_w(shortname
), debugstr_w(longname
));
549 file
= longname
? longname
: shortname
;
550 PathCombineW(pathW
, path
, file
);
551 strcpyW(retW
, pathW
);
552 PathRemoveExtensionW(pathW
);
554 ext
= PathFindExtensionW(file
);
556 /* now try to make it unique */
557 while (PathFileExistsW(retW
))
559 static const WCHAR fmtW
[] = {'%','s',' ','(','%','d',')','%','s',0};
561 sprintfW(retW
, fmtW
, pathW
, i
, ext
);
565 strcpyW(buffer
, retW
);
566 TRACE("ret - %s\n", debugstr_w(buffer
));
572 ########## cleaning and resolving paths ##########
575 /*************************************************************************
576 * PathFindOnPath [SHELL32.145]
578 BOOL WINAPI
PathFindOnPathAW(LPVOID sFile
, LPCVOID
*sOtherDirs
)
580 if (SHELL_OsIsUnicode())
581 return PathFindOnPathW(sFile
, (LPCWSTR
*)sOtherDirs
);
582 return PathFindOnPathA(sFile
, (LPCSTR
*)sOtherDirs
);
585 /*************************************************************************
586 * PathCleanupSpec [SHELL32.171]
588 * lpszFile is changed in place.
590 int WINAPI
PathCleanupSpec( LPCWSTR lpszPathW
, LPWSTR lpszFileW
)
596 if (SHELL_OsIsUnicode())
598 LPWSTR p
= lpszFileW
;
600 TRACE("Cleanup %s\n",debugstr_w(lpszFileW
));
603 length
= strlenW(lpszPathW
);
607 int gct
= PathGetCharTypeW(*p
);
608 if (gct
== GCT_INVALID
|| gct
== GCT_WILD
|| gct
== GCT_SEPARATOR
)
611 rc
|= PCS_REPLACEDCHAR
;
617 if (length
+ i
== MAX_PATH
)
619 rc
|= PCS_FATAL
| PCS_PATHTOOLONG
;
627 LPSTR lpszFileA
= (LPSTR
)lpszFileW
;
628 LPCSTR lpszPathA
= (LPCSTR
)lpszPathW
;
631 TRACE("Cleanup %s\n",debugstr_a(lpszFileA
));
634 length
= strlen(lpszPathA
);
638 int gct
= PathGetCharTypeA(*p
);
639 if (gct
== GCT_INVALID
|| gct
== GCT_WILD
|| gct
== GCT_SEPARATOR
)
642 rc
|= PCS_REPLACEDCHAR
;
648 if (length
+ i
== MAX_PATH
)
650 rc
|= PCS_FATAL
| PCS_PATHTOOLONG
;
659 /*************************************************************************
660 * PathQualifyA [SHELL32]
662 static BOOL
PathQualifyA(LPCSTR pszPath
)
664 FIXME("%s\n",pszPath
);
668 /*************************************************************************
669 * PathQualifyW [SHELL32]
671 static BOOL
PathQualifyW(LPCWSTR pszPath
)
673 FIXME("%s\n",debugstr_w(pszPath
));
677 /*************************************************************************
678 * PathQualify [SHELL32.49]
680 BOOL WINAPI
PathQualifyAW(LPCVOID pszPath
)
682 if (SHELL_OsIsUnicode())
683 return PathQualifyW(pszPath
);
684 return PathQualifyA(pszPath
);
687 static BOOL
PathResolveA(LPSTR path
, LPCSTR
*paths
, DWORD flags
)
689 FIXME("(%s,%p,0x%08x),stub!\n", debugstr_a(path
), paths
, flags
);
693 static BOOL
PathResolveW(LPWSTR path
, LPCWSTR
*paths
, DWORD flags
)
695 FIXME("(%s,%p,0x%08x),stub!\n", debugstr_w(path
), paths
, flags
);
699 /*************************************************************************
700 * PathResolve [SHELL32.51]
702 BOOL WINAPI
PathResolveAW(LPVOID path
, LPCVOID
*paths
, DWORD flags
)
704 if (SHELL_OsIsUnicode())
705 return PathResolveW(path
, (LPCWSTR
*)paths
, flags
);
707 return PathResolveA(path
, (LPCSTR
*)paths
, flags
);
710 /*************************************************************************
711 * PathProcessCommandA
713 static LONG
PathProcessCommandA (
719 FIXME("%s %p 0x%04x 0x%04x stub\n",
720 lpszPath
, lpszBuff
, dwBuffSize
, dwFlags
);
721 if(!lpszPath
) return -1;
722 if(lpszBuff
) strcpy(lpszBuff
, lpszPath
);
723 return strlen(lpszPath
);
726 /*************************************************************************
727 * PathProcessCommandW
729 static LONG
PathProcessCommandW (
735 FIXME("(%s, %p, 0x%04x, 0x%04x) stub\n",
736 debugstr_w(lpszPath
), lpszBuff
, dwBuffSize
, dwFlags
);
737 if(!lpszPath
) return -1;
738 if(lpszBuff
) strcpyW(lpszBuff
, lpszPath
);
739 return strlenW(lpszPath
);
742 /*************************************************************************
743 * PathProcessCommand (SHELL32.653)
745 LONG WINAPI
PathProcessCommandAW (
751 if (SHELL_OsIsUnicode())
752 return PathProcessCommandW(lpszPath
, lpszBuff
, dwBuffSize
, dwFlags
);
753 return PathProcessCommandA(lpszPath
, lpszBuff
, dwBuffSize
, dwFlags
);
757 ########## special ##########
760 /*************************************************************************
761 * PathSetDlgItemPath (SHELL32.48)
763 VOID WINAPI
PathSetDlgItemPathAW(HWND hDlg
, int id
, LPCVOID pszPath
)
765 if (SHELL_OsIsUnicode())
766 PathSetDlgItemPathW(hDlg
, id
, pszPath
);
768 PathSetDlgItemPathA(hDlg
, id
, pszPath
);
771 static const WCHAR szCategory
[] = {'C','a','t','e','g','o','r','y',0};
772 static const WCHAR szAttributes
[] = {'A','t','t','r','i','b','u','t','e','s',0};
773 static const WCHAR szName
[] = {'N','a','m','e',0};
774 static const WCHAR szParsingName
[] = {'P','a','r','s','i','n','g','N','a','m','e',0};
775 static const WCHAR szRelativePath
[] = {'R','e','l','a','t','i','v','e','P','a','t','h',0};
776 static const WCHAR szParentFolder
[] = {'P','a','r','e','n','t','F','o','l','d','e','r',0};
778 static const WCHAR szCurrentVersion
[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\0'};
779 static const WCHAR AddNewProgramsFolderW
[] = {'A','d','d','N','e','w','P','r','o','g','r','a','m','s','F','o','l','d','e','r',0};
780 static const WCHAR AppUpdatesFolderW
[] = {'A','p','p','U','p','d','a','t','e','s','F','o','l','d','e','r',0};
781 static const WCHAR Administrative_ToolsW
[] = {'A','d','m','i','n','i','s','t','r','a','t','i','v','e',' ','T','o','o','l','s','\0'};
782 static const WCHAR AppDataW
[] = {'A','p','p','D','a','t','a','\0'};
783 static const WCHAR AppData_RoamingW
[] = {'A','p','p','D','a','t','a','\\','R','o','a','m','i','n','g','\0'};
784 static const WCHAR AppData_LocalLowW
[] = {'A','p','p','D','a','t','a','\\','L','o','c','a','l','L','o','w','\0'};
785 static const WCHAR AppData_LocalW
[] = {'A','p','p','D','a','t','a','\\','L','o','c','a','l','\0'};
786 static const WCHAR Application_DataW
[] = {'A','p','p','l','i','c','a','t','i','o','n',' ','D','a','t','a','\0'};
787 static const WCHAR CacheW
[] = {'C','a','c','h','e','\0'};
788 static const WCHAR CD_BurningW
[] = {'C','D',' ','B','u','r','n','i','n','g','\0'};
789 static const WCHAR ChangeRemoveProgramsFolderW
[] = {'C','h','a','n','g','e','R','e','m','o','v','e','P','r','o','g','r','a','m','s','F','o','l','d','e','r',0};
790 static const WCHAR CommonW
[] = {'C','o','m','m','o','n',0};
791 static const WCHAR Common_Administrative_ToolsW
[] = {'C','o','m','m','o','n',' ','A','d','m','i','n','i','s','t','r','a','t','i','v','e',' ','T','o','o','l','s','\0'};
792 static const WCHAR Common_AppDataW
[] = {'C','o','m','m','o','n',' ','A','p','p','D','a','t','a','\0'};
793 static const WCHAR Common_DesktopW
[] = {'C','o','m','m','o','n',' ','D','e','s','k','t','o','p','\0'};
794 static const WCHAR Common_DocumentsW
[] = {'C','o','m','m','o','n',' ','D','o','c','u','m','e','n','t','s','\0'};
795 static const WCHAR CommonDownloadsW
[] = {'C','o','m','m','o','n','D','o','w','n','l','o','a','d','s',0};
796 static const WCHAR Common_FavoritesW
[] = {'C','o','m','m','o','n',' ','F','a','v','o','r','i','t','e','s','\0'};
797 static const WCHAR CommonFilesDirW
[] = {'C','o','m','m','o','n','F','i','l','e','s','D','i','r','\0'};
798 static const WCHAR CommonFilesDirX86W
[] = {'C','o','m','m','o','n','F','i','l','e','s','D','i','r',' ','(','x','8','6',')','\0'};
799 static const WCHAR CommonMusicW
[] = {'C','o','m','m','o','n','M','u','s','i','c','\0'};
800 static const WCHAR CommonPicturesW
[] = {'C','o','m','m','o','n','P','i','c','t','u','r','e','s','\0'};
801 static const WCHAR Common_ProgramsW
[] = {'C','o','m','m','o','n',' ','P','r','o','g','r','a','m','s','\0'};
802 static const WCHAR CommonRingtonesW
[] = {'C','o','m','m','o','n','R','i','n','g','t','o','n','e','s',0};
803 static const WCHAR Common_StartUpW
[] = {'C','o','m','m','o','n',' ','S','t','a','r','t','U','p','\0'};
804 static const WCHAR Common_StartupW
[] = {'C','o','m','m','o','n',' ','S','t','a','r','t','u','p','\0'};
805 static const WCHAR Common_Start_MenuW
[] = {'C','o','m','m','o','n',' ','S','t','a','r','t',' ','M','e','n','u','\0'};
806 static const WCHAR Common_TemplatesW
[] = {'C','o','m','m','o','n',' ','T','e','m','p','l','a','t','e','s','\0'};
807 static const WCHAR CommonVideoW
[] = {'C','o','m','m','o','n','V','i','d','e','o','\0'};
808 static const WCHAR ConflictFolderW
[] = {'C','o','n','f','l','i','c','t','F','o','l','d','e','r',0};
809 static const WCHAR ConnectionsFolderW
[] = {'C','o','n','n','e','c','t','i','o','n','s','F','o','l','d','e','r',0};
810 static const WCHAR ContactsW
[] = {'C','o','n','t','a','c','t','s','\0'};
811 static const WCHAR ControlPanelFolderW
[] = {'C','o','n','t','r','o','l','P','a','n','e','l','F','o','l','d','e','r',0};
812 static const WCHAR CookiesW
[] = {'C','o','o','k','i','e','s','\0'};
813 static const WCHAR CSCFolderW
[] = {'C','S','C','F','o','l','d','e','r',0};
814 static const WCHAR Default_GadgetsW
[] = {'D','e','f','a','u','l','t',' ','G','a','d','g','e','t','s',0};
815 static const WCHAR DesktopW
[] = {'D','e','s','k','t','o','p','\0'};
816 static const WCHAR Device_Metadata_StoreW
[] = {'D','e','v','i','c','e',' ','M','e','t','a','d','a','t','a',' ','S','t','o','r','e',0};
817 static const WCHAR DocumentsW
[] = {'D','o','c','u','m','e','n','t','s','\0'};
818 static const WCHAR DocumentsLibraryW
[] = {'D','o','c','u','m','e','n','t','s','L','i','b','r','a','r','y','\0'};
819 static const WCHAR Documents_librarymsW
[] = {'D','o','c','u','m','e','n','t','s','.','l','i','b','r','a','r','y','-','m','s',0};
820 static const WCHAR DownloadsW
[] = {'D','o','w','n','l','o','a','d','s','\0'};
821 static const WCHAR FavoritesW
[] = {'F','a','v','o','r','i','t','e','s','\0'};
822 static const WCHAR FontsW
[] = {'F','o','n','t','s','\0'};
823 static const WCHAR GadgetsW
[] = {'G','a','d','g','e','t','s',0};
824 static const WCHAR GamesW
[] = {'G','a','m','e','s',0};
825 static const WCHAR GameTasksW
[] = {'G','a','m','e','T','a','s','k','s',0};
826 static const WCHAR HistoryW
[] = {'H','i','s','t','o','r','y','\0'};
827 static const WCHAR HomeGroupFolderW
[] = {'H','o','m','e','G','r','o','u','p','F','o','l','d','e','r',0};
828 static const WCHAR ImplicitAppShortcutsW
[] = {'I','m','p','l','i','c','i','t','A','p','p','S','h','o','r','t','c','u','t','s',0};
829 static const WCHAR InternetFolderW
[] = {'I','n','t','e','r','n','e','t','F','o','l','d','e','r',0};
830 static const WCHAR LibrariesW
[] = {'L','i','b','r','a','r','i','e','s',0};
831 static const WCHAR LinksW
[] = {'L','i','n','k','s','\0'};
832 static const WCHAR Local_AppDataW
[] = {'L','o','c','a','l',' ','A','p','p','D','a','t','a','\0'};
833 static const WCHAR Local_Settings_Application_DataW
[] = {'L','o','c','a','l',' ','S','e','t','t','i','n','g','s','\\','A','p','p','l','i','c','a','t','i','o','n',' ','D','a','t','a','\0'};
834 static const WCHAR Local_Settings_CD_BurningW
[] = {'L','o','c','a','l',' ','S','e','t','t','i','n','g','s','\\','A','p','p','l','i','c','a','t','i','o','n',' ','D','a','t','a','\\','M','i','c','r','o','s','o','f','t','\\','C','D',' ','B','u','r','n','i','n','g','\0'};
835 static const WCHAR Local_Settings_HistoryW
[] = {'L','o','c','a','l',' ','S','e','t','t','i','n','g','s','\\','H','i','s','t','o','r','y','\0'};
836 static const WCHAR Local_Settings_Temporary_Internet_FilesW
[] = {'L','o','c','a','l',' ','S','e','t','t','i','n','g','s','\\','T','e','m','p','o','r','a','r','y',' ','I','n','t','e','r','n','e','t',' ','F','i','l','e','s','\0'};
837 static const WCHAR LocalAppDataLowW
[] = {'L','o','c','a','l','A','p','p','D','a','t','a','L','o','w',0};
838 static const WCHAR LocalizedResourcesDirW
[] = {'L','o','c','a','l','i','z','e','d','R','e','s','o','u','r','c','e','s','D','i','r',0};
839 static const WCHAR MAPIFolderW
[] = {'M','A','P','I','F','o','l','d','e','r',0};
840 static const WCHAR Microsoft_Internet_Explorer_Quick_LaunchW
[] = {'M','i','c','r','o','s','o','f','t','\\','I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','\\','Q','u','i','c','k',' ','L','a','u','n','c','h',0};
841 static const WCHAR Microsoft_Windows_Burn_BurnW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','B','u','r','n','\\','B','u','r','n',0};
842 static const WCHAR Microsoft_Windows_CookiesW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','C','o','o','k','i','e','s',0};
843 static const WCHAR Microsoft_Windows_GameExplorerW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','G','a','m','e','E','x','p','l','o','r','e','r','\0'};
844 static const WCHAR Microsoft_Windows_DeviceMetadataStoreW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','D','e','v','i','c','e','M','e','t','a','d','a','t','a','S','t','o','r','e',0};
845 static const WCHAR Microsoft_Windows_HistoryW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','H','i','s','t','o','r','y',0};
846 static const WCHAR Microsoft_Windows_LibrariesW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','L','i','b','r','a','r','i','e','s','\0'};
847 static const WCHAR Microsoft_Windows_Network_ShortcutsW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','N','e','t','w','o','r','k',' ','S','h','o','r','t','c','u','t','s',0};
848 static const WCHAR Microsoft_Windows_Photo_Gallery_Original_ImagesW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s',' ','P','h','o','t','o',' ','G','a','l','l','e','r','y','\\','O','r','i','g','i','n','a','l',' ','I','m','a','g','e','s',0};
849 static const WCHAR Microsoft_Windows_Printer_ShortcutsW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','P','r','i','n','t','e','r',' ','S','h','o','r','t','c','u','t','s',0};
850 static const WCHAR Microsoft_Windows_RecentW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','R','e','c','e','n','t','\0'};
851 static const WCHAR Microsoft_Windows_RingtonesW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','R','i','n','g','t','o','n','e','s','\0'};
852 static const WCHAR Microsoft_Windows_SendToW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','S','e','n','d','T','o',0};
853 static const WCHAR Microsoft_Windows_Sidebar_GadgetsW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s',' ','S','i','d','e','b','a','r','\\','G','a','d','g','e','t','s',0};
854 static const WCHAR Microsoft_Windows_Start_MenuW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','S','t','a','r','t',' ','M','e','n','u',0};
855 static const WCHAR Microsoft_Windows_TemplatesW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','T','e','m','p','l','a','t','e','s',0};
856 static const WCHAR Microsoft_Windows_Temporary_Internet_FilesW
[] = {'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','T','e','m','p','o','r','a','r','y',' ','I','n','t','e','r','n','e','t',' ','F','i','l','e','s',0};
857 static const WCHAR MoviesW
[] = {'M','o','v','i','e','s','\0'};
858 static const WCHAR MusicW
[] = {'M','u','s','i','c','\0'};
859 static const WCHAR MusicLibraryW
[] = {'M','u','s','i','c','L','i','b','r','a','r','y',0};
860 static const WCHAR Music_librarymsW
[] = {'M','u','s','i','c','.','l','i','b','r','a','r','y','-','m','s',0};
861 static const WCHAR Music_PlaylistsW
[] = {'M','u','s','i','c','\\','P','l','a','y','l','i','s','t','s','\0'};
862 static const WCHAR Music_Sample_MusicW
[] = {'M','u','s','i','c','\\','S','a','m','p','l','e',' ','M','u','s','i','c','\0'};
863 static const WCHAR Music_Sample_PlaylistsW
[] = {'M','u','s','i','c','\\','S','a','m','p','l','e',' ','P','l','a','y','l','i','s','t','s','\0'};
864 static const WCHAR My_MusicW
[] = {'M','y',' ','M','u','s','i','c','\0'};
865 static const WCHAR My_PicturesW
[] = {'M','y',' ','P','i','c','t','u','r','e','s','\0'};
866 static const WCHAR My_VideosW
[] = {'M','y',' ','V','i','d','e','o','s','\0'};
867 static const WCHAR My_VideoW
[] = {'M','y',' ','V','i','d','e','o','\0'};
868 static const WCHAR MyComputerFolderW
[] = {'M','y','C','o','m','p','u','t','e','r','F','o','l','d','e','r',0};
869 static const WCHAR NetHoodW
[] = {'N','e','t','H','o','o','d','\0'};
870 static const WCHAR NetworkPlacesFolderW
[] = {'N','e','t','w','o','r','k','P','l','a','c','e','s','F','o','l','d','e','r',0};
871 static const WCHAR OEM_LinksW
[] = {'O','E','M',' ','L','i','n','k','s','\0'};
872 static const WCHAR Original_ImagesW
[] = {'O','r','i','g','i','n','a','l',' ','I','m','a','g','e','s',0};
873 static const WCHAR PersonalW
[] = {'P','e','r','s','o','n','a','l','\0'};
874 static const WCHAR PhotoAlbumsW
[] = {'P','h','o','t','o','A','l','b','u','m','s',0};
875 static const WCHAR PicturesW
[] = {'P','i','c','t','u','r','e','s','\0'};
876 static const WCHAR PicturesLibraryW
[] = {'P','i','c','t','u','r','e','s','L','i','b','r','a','r','y',0};
877 static const WCHAR Pictures_librarymsW
[] = {'P','i','c','t','u','r','e','s','.','l','i','b','r','a','r','y','-','m','s',0};
878 static const WCHAR Pictures_Sample_PicturesW
[] = {'P','i','c','t','u','r','e','s','\\','S','a','m','p','l','e',' ','P','i','c','t','u','r','e','s','\0'};
879 static const WCHAR Pictures_Slide_ShowsW
[] = {'P','i','c','t','u','r','e','s','\\','S','l','i','d','e',' ','S','h','o','w','s','\0'};
880 static const WCHAR PlaylistsW
[] = {'P','l','a','y','l','i','s','t','s',0};
881 static const WCHAR PrintersFolderW
[] = {'P','r','i','n','t','e','r','s','F','o','l','d','e','r',0};
882 static const WCHAR PrintHoodW
[] = {'P','r','i','n','t','H','o','o','d','\0'};
883 static const WCHAR ProfileW
[] = {'P','r','o','f','i','l','e',0};
884 static const WCHAR Program_FilesW
[] = {'P','r','o','g','r','a','m',' ','F','i','l','e','s','\0'};
885 static const WCHAR ProgramFilesW
[] = {'P','r','o','g','r','a','m','F','i','l','e','s','\0'};
886 static const WCHAR ProgramFilesX86W
[] = {'P','r','o','g','r','a','m','F','i','l','e','s','X','8','6','\0'};
887 static const WCHAR ProgramFilesX64W
[] = {'P','r','o','g','r','a','m','F','i','l','e','s','X','6','4','\0'};
888 static const WCHAR Program_Files_Common_FilesW
[] = {'P','r','o','g','r','a','m',' ','F','i','l','e','s','\\','C','o','m','m','o','n',' ','F','i','l','e','s','\0'};
889 static const WCHAR Program_Files_x86W
[] = {'P','r','o','g','r','a','m',' ','F','i','l','e','s',' ','(','x','8','6',')','\0'};
890 static const WCHAR Program_Files_x86_Common_FilesW
[] = {'P','r','o','g','r','a','m',' ','F','i','l','e','s',' ','(','x','8','6',')','\\','C','o','m','m','o','n',' ','F','i','l','e','s','\0'};
891 static const WCHAR ProgramFilesCommonW
[] = {'P','r','o','g','r','a','m','F','i','l','e','s','C','o','m','m','o','n',0};
892 static const WCHAR ProgramFilesCommonX86W
[] = {'P','r','o','g','r','a','m','F','i','l','e','s','C','o','m','m','o','n','X','8','6',0};
893 static const WCHAR ProgramFilesCommonX64W
[] = {'P','r','o','g','r','a','m','F','i','l','e','s','C','o','m','m','o','n','X','6','4',0};
894 static const WCHAR ProgramFilesDirW
[] = {'P','r','o','g','r','a','m','F','i','l','e','s','D','i','r','\0'};
895 static const WCHAR ProgramFilesDirX86W
[] = {'P','r','o','g','r','a','m','F','i','l','e','s','D','i','r',' ','(','x','8','6',')','\0'};
896 static const WCHAR ProgramsW
[] = {'P','r','o','g','r','a','m','s','\0'};
897 static const WCHAR PublicW
[] = {'P','u','b','l','i','c',0};
898 static const WCHAR PublicGameTasksW
[] = {'P','u','b','l','i','c','G','a','m','e','T','a','s','k','s',0};
899 static const WCHAR PublicLibrariesW
[] = {'P','u','b','l','i','c','L','i','b','r','a','r','i','e','s',0};
900 static const WCHAR Quick_LaunchW
[] = {'Q','u','i','c','k',' ','L','a','u','n','c','h',0};
901 static const WCHAR RecentW
[] = {'R','e','c','e','n','t','\0'};
902 static const WCHAR RecordedTVLibraryW
[] = {'R','e','c','o','r','d','e','d','T','V','L','i','b','r','a','r','y',0};
903 static const WCHAR RecordedTV_librarymsW
[] = {'R','e','c','o','r','d','e','d','T','V','.','l','i','b','r','a','r','y','-','m','s',0};
904 static const WCHAR RecycleBinFolderW
[] = {'R','e','c','y','c','l','e','B','i','n','F','o','l','d','e','r',0};
905 static const WCHAR ResourceDirW
[] = {'R','e','s','o','u','r','c','e','D','i','r','\0'};
906 static const WCHAR ResourcesW
[] = {'R','e','s','o','u','r','c','e','s','\0'};
907 static const WCHAR RingtonesW
[] = {'R','i','n','g','t','o','n','e','s',0};
908 static const WCHAR SampleMusicW
[] = {'S','a','m','p','l','e','M','u','s','i','c',0};
909 static const WCHAR Sample_MusicW
[] = {'S','a','m','p','l','e',' ','M','u','s','i','c',0};
910 static const WCHAR SamplePicturesW
[] = {'S','a','m','p','l','e','P','i','c','t','u','r','e','s',0};
911 static const WCHAR Sample_PicturesW
[] = {'S','a','m','p','l','e',' ','P','i','c','t','u','r','e','s',0};
912 static const WCHAR SamplePlaylistsW
[] = {'S','a','m','p','l','e','P','l','a','y','l','i','s','t','s',0};
913 static const WCHAR Sample_PlaylistsW
[] = {'S','a','m','p','l','e',' ','P','l','a','y','l','i','s','t','s',0};
914 static const WCHAR Sample_VideosW
[] = {'S','a','m','p','l','e',' ','V','i','d','e','o','s',0};
915 static const WCHAR SampleVideosW
[] = {'S','a','m','p','l','e','V','i','d','e','o','s',0};
916 static const WCHAR Saved_GamesW
[] = {'S','a','v','e','d',' ','G','a','m','e','s','\0'};
917 static const WCHAR SavedGamesW
[] = {'S','a','v','e','d','G','a','m','e','s','\0'};
918 static const WCHAR SearchesW
[] = {'S','e','a','r','c','h','e','s','\0'};
919 static const WCHAR SearchHomeFolderW
[] = {'S','e','a','r','c','h','H','o','m','e','F','o','l','d','e','r',0};
920 static const WCHAR SendToW
[] = {'S','e','n','d','T','o','\0'};
921 static const WCHAR Slide_ShowsW
[] = {'S','l','i','d','e',' ','S','h','o','w','s',0};
922 static const WCHAR StartUpW
[] = {'S','t','a','r','t','U','p','\0'};
923 static const WCHAR StartupW
[] = {'S','t','a','r','t','u','p','\0'};
924 static const WCHAR Start_MenuW
[] = {'S','t','a','r','t',' ','M','e','n','u','\0'};
925 static const WCHAR Start_Menu_ProgramsW
[] = {'S','t','a','r','t',' ','M','e','n','u','\\','P','r','o','g','r','a','m','s','\0'};
926 static const WCHAR Start_Menu_Admin_ToolsW
[] = {'S','t','a','r','t',' ','M','e','n','u','\\','P','r','o','g','r','a','m','s','\\','A','d','m','i','n','i','s','t','r','a','t','i','v','e',' ','T','o','o','l','s','\0'};
927 static const WCHAR Start_Menu_StartupW
[] = {'S','t','a','r','t',' ','M','e','n','u','\\','P','r','o','g','r','a','m','s','\\','S','t','a','r','t','U','p','\0'};
928 static const WCHAR SyncCenterFolderW
[] = {'S','y','n','c','C','e','n','t','e','r','F','o','l','d','e','r',0};
929 static const WCHAR SyncResultsFolderW
[] = {'S','y','n','c','R','e','s','u','l','t','s','F','o','l','d','e','r',0};
930 static const WCHAR SyncSetupFolderW
[] = {'S','y','n','c','S','e','t','u','p','F','o','l','d','e','r',0};
931 static const WCHAR SystemW
[] = {'S','y','s','t','e','m',0};
932 static const WCHAR SystemX86W
[] = {'S','y','s','t','e','m','X','8','6',0};
933 static const WCHAR TemplatesW
[] = {'T','e','m','p','l','a','t','e','s','\0'};
934 static const WCHAR User_PinnedW
[] = {'U','s','e','r',' ','P','i','n','n','e','d',0};
935 static const WCHAR UsersW
[] = {'U','s','e','r','s','\0'};
936 static const WCHAR UsersFilesFolderW
[] = {'U','s','e','r','s','F','i','l','e','s','F','o','l','d','e','r',0};
937 static const WCHAR UsersLibrariesFolderW
[] = {'U','s','e','r','s','L','i','b','r','a','r','i','e','s','F','o','l','d','e','r',0};
938 static const WCHAR UserProfilesW
[] = {'U','s','e','r','P','r','o','f','i','l','e','s',0};
939 static const WCHAR UserProgramFilesW
[] = {'U','s','e','r','P','r','o','g','r','a','m','F','i','l','e','s',0};
940 static const WCHAR UserProgramFilesCommonW
[] = {'U','s','e','r','P','r','o','g','r','a','m','F','i','l','e','s','C','o','m','m','o','n',0};
941 static const WCHAR UsersPublicW
[] = {'U','s','e','r','s','\\','P','u','b','l','i','c','\0'};
942 static const WCHAR VideosW
[] = {'V','i','d','e','o','s','\0'};
943 static const WCHAR VideosLibraryW
[] = {'V','i','d','e','o','s','L','i','b','r','a','r','y',0};
944 static const WCHAR Videos_librarymsW
[] = {'V','i','d','e','o','s','.','l','i','b','r','a','r','y','-','m','s',0};
945 static const WCHAR Videos_Sample_VideosW
[] = {'V','i','d','e','o','s','\\','S','a','m','p','l','e',' ','V','i','d','e','o','s','\0'};
946 static const WCHAR WindowsW
[] = {'W','i','n','d','o','w','s',0};
947 static const WCHAR Windows_Sidebar_GadgetsW
[] = {'W','i','n','d','o','w','s',' ','S','i','d','e','b','a','r','\\','G','a','d','g','e','t','s',0};
948 static const WCHAR DefaultW
[] = {'.','D','e','f','a','u','l','t','\0'};
949 static const WCHAR AllUsersProfileW
[] = {'%','A','L','L','U','S','E','R','S','P','R','O','F','I','L','E','%','\0'};
950 static const WCHAR UserProfileW
[] = {'%','U','S','E','R','P','R','O','F','I','L','E','%','\0'};
951 static const WCHAR SystemDriveW
[] = {'%','S','y','s','t','e','m','D','r','i','v','e','%','\0'};
952 static const WCHAR ProfileListW
[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','P','r','o','f','i','l','e','L','i','s','t',0};
953 static const WCHAR ProfilesDirectoryW
[] = {'P','r','o','f','i','l','e','s','D','i','r','e','c','t','o','r','y',0};
954 static const WCHAR AllUsersProfileValueW
[] = {'A','l','l','U','s','e','r','s','P','r','o','f','i','l','e','\0'};
955 static const WCHAR szSHFolders
[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l','o','r','e','r','\\','S','h','e','l','l',' ','F','o','l','d','e','r','s','\0'};
956 static const WCHAR szSHUserFolders
[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l','o','r','e','r','\\','U','s','e','r',' ','S','h','e','l','l',' ','F','o','l','d','e','r','s','\0'};
957 static const WCHAR szDefaultProfileDirW
[] = {'u','s','e','r','s',0};
958 static const WCHAR szKnownFolderDescriptions
[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l','o','r','e','r','\\','F','o','l','d','e','r','D','e','s','c','r','i','p','t','i','o','n','s','\0'};
959 static const WCHAR szKnownFolderRedirections
[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','E','x','p','l','o','r','e','r','\\','U','s','e','r',' ','S','h','e','l','l',' ','F','o','l','d','e','r','s',0};
960 static const WCHAR AllUsersW
[] = {'P','u','b','l','i','c',0};
962 #define CHANGEREMOVEPROGRAMS_PARSING_GUID '{','7','b','8','1','b','e','6','a','-','c','e','2','b','-','4','6','7','6','-','a','2','9','e','-','e','b','9','0','7','a','5','1','2','6','c','5','}'
963 #define SYNCMANAGER_PARSING_GUID '{','9','C','7','3','F','5','E','5','-','7','A','E','7','-','4','E','3','2','-','A','8','E','8','-','8','D','2','3','B','8','5','2','5','5','B','F','}'
964 #define SYSTEMFOLDERS_PARSING_GUID '{','2','1','E','C','2','0','2','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','D','-','0','8','0','0','2','B','3','0','3','0','9','D','}'
965 #define USERFOLDERS_PARSING_GUID '{','5','9','0','3','1','a','4','7','-','3','f','7','2','-','4','4','a','7','-','8','9','c','5','-','5','5','9','5','f','e','6','b','3','0','e','e','}'
966 #define USERSLIBRARIES_PARSING_GUID '{','0','3','1','E','4','8','2','5','-','7','B','9','4','-','4','d','c','3','-','B','1','3','1','-','E','9','4','6','B','4','4','C','8','D','D','5','}'
968 static const WCHAR ComputerFolderParsingNameW
[] = {':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}',0};
969 static const WCHAR ControlPanelFolderParsingNameW
[] = {':',':','{','2','6','E','E','0','6','6','8','-','A','0','0','A','-','4','4','D','7','-','9','3','7','1','-','B','E','B','0','6','4','C','9','8','6','8','3','}','\\','0',0};
970 static const WCHAR ControlPanelFolderRelativePathW
[] = {':',':','{','2','1','E','C','2','0','2','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','D','-','0','8','0','0','2','B','3','0','3','0','9','D','}',0};
971 static const WCHAR GamesParsingNameW
[] = {':',':','{','E','D','2','2','8','F','D','F','-','9','E','A','8','-','4','8','7','0','-','8','3','b','1','-','9','6','b','0','2','C','F','E','0','D','5','2','}',0};
972 static const WCHAR HomeGroupParsingNameW
[] = {':',':','{','B','4','F','B','3','F','9','8','-','C','1','E','A','-','4','2','8','d','-','A','7','8','A','-','D','1','F','5','6','5','9','C','B','A','9','3','}',0};
973 static const WCHAR InternetFolderParsingNameW
[] = {':',':','{','8','7','1','C','5','3','8','0','-','4','2','A','0','-','1','0','6','9','-','A','2','E','A','-','0','8','0','0','2','B','3','0','3','0','9','D','}',0};
974 static const WCHAR NetworkFolderParsingNameW
[] = {':',':','{','F','0','2','C','1','A','0','D','-','B','E','2','1','-','4','3','5','0','-','8','8','B','0','-','7','3','6','7','F','C','9','6','E','F','3','C','}',0};
975 static const WCHAR PublicParsingNameW
[] = {':',':','{','4','3','3','6','a','5','4','d','-','0','3','8','b','-','4','6','8','5','-','a','b','0','2','-','9','9','b','b','5','2','d','3','f','b','8','b','}',0};
976 static const WCHAR RecycleBinFolderParsingNameW
[] = {':',':','{','6','4','5','F','F','0','4','0','-','5','0','8','1','-','1','0','1','B','-','9','F','0','8','-','0','0','A','A','0','0','2','F','9','5','4','E','}',0};
977 static const WCHAR SearchHomeParsingNameW
[] = {':',':','{','9','3','4','3','8','1','2','e','-','1','c','3','7','-','4','a','4','9','-','a','1','2','e','-','4','b','2','d','8','1','0','d','9','5','6','b','}',0};
978 static const WCHAR SEARCH_CSCParsingNameW
[] = {'s','h','e','l','l',':',':',':','{','B','D','7','A','2','E','7','B','-','2','1','C','B','-','4','1','b','2','-','A','0','8','6','-','B','3','0','9','6','8','0','C','6','B','7','E','}','\\','*',0};
979 static const WCHAR SEARCH_MAPIParsingNameW
[] = {'s','h','e','l','l',':',':',':','{','8','9','D','8','3','5','7','6','-','6','B','D','1','-','4','C','8','6','-','9','4','5','4','-','B','E','B','0','4','E','9','4','C','8','1','9','}','\\','*',0};
980 static const WCHAR UsersFilesParsingNameW
[] = {':',':','{','5','9','0','3','1','a','4','7','-','3','f','7','2','-','4','4','a','7','-','8','9','c','5','-','5','5','9','5','f','e','6','b','3','0','e','e','}',0};
981 static const WCHAR UsersLibrariesParsingNameW
[] = {':',':','{','0','3','1','E','4','8','2','5','-','7','B','9','4','-','4','d','c','3','-','B','1','3','1','-','E','9','4','6','B','4','4','C','8','D','D','5','}',0};
982 static const WCHAR AddNewProgramsParsingNameW
[] = {':',':', SYSTEMFOLDERS_PARSING_GUID
, '\\',':',':','{','1','5','e','a','e','9','2','e','-','f','1','7','a','-','4','4','3','1','-','9','f','2','8','-','8','0','5','e','4','8','2','d','a','f','d','4','}',0};
983 static const WCHAR ConnectionsFolderParsingNameW
[] = {':',':', SYSTEMFOLDERS_PARSING_GUID
, '\\',':',':','{','7','0','0','7','A','C','C','7','-','3','2','0','2','-','1','1','D','1','-','A','A','D','2','-','0','0','8','0','5','F','C','1','2','7','0','E','}',0};
984 static const WCHAR PrintersFolderParsingNameW
[] = {':',':', SYSTEMFOLDERS_PARSING_GUID
, '\\',':',':','{','2','2','2','7','A','2','8','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','E','-','0','8','0','0','2','B','3','0','3','0','9','D','}',0};
985 static const WCHAR ChangeRemoveProgramsParsingNameW
[] = {':',':', SYSTEMFOLDERS_PARSING_GUID
, '\\',':',':', CHANGEREMOVEPROGRAMS_PARSING_GUID
, 0};
986 static const WCHAR AppUpdatesParsingNameW
[] = {':',':', SYSTEMFOLDERS_PARSING_GUID
, '\\',':',':', CHANGEREMOVEPROGRAMS_PARSING_GUID
, '\\',':',':','{','d','4','5','0','a','8','a','1','-','9','5','6','8','-','4','5','c','7','-','9','c','0','e','-','b','4','f','9','f','b','4','5','3','7','b','d','}',0};
987 static const WCHAR SyncManagerFolderParsingNameW
[] = {':',':', SYSTEMFOLDERS_PARSING_GUID
, '\\',':',':', SYNCMANAGER_PARSING_GUID
, 0};
988 static const WCHAR ConflictFolderParsingNameW
[] = {':',':', SYSTEMFOLDERS_PARSING_GUID
, '\\',':',':', SYNCMANAGER_PARSING_GUID
, '\\',':',':','{','E','4','1','3','D','0','4','0','-','6','7','8','8','-','4','C','2','2','-','9','5','7','E','-','1','7','5','D','1','C','5','1','3','A','3','4','}',',',0};
989 static const WCHAR SyncResultsFolderParsingNameW
[] = {':',':', SYSTEMFOLDERS_PARSING_GUID
, '\\',':',':', SYNCMANAGER_PARSING_GUID
, '\\',':',':','{','B','C','4','8','B','3','2','F','-','5','9','1','0','-','4','7','F','5','-','8','5','7','0','-','5','0','7','4','A','8','A','5','6','3','6','A','}',',',0};
990 static const WCHAR SyncSetupFolderParsingNameW
[] = {':',':', SYSTEMFOLDERS_PARSING_GUID
, '\\',':',':', SYNCMANAGER_PARSING_GUID
, '\\',':',':','{','F','1','3','9','0','A','9','A','-','A','3','F','4','-','4','E','5','D','-','9','C','5','F','-','9','8','F','3','B','D','8','D','9','3','5','C','}',',',0};
991 static const WCHAR ContactsParsingNameW
[] = {':',':', USERFOLDERS_PARSING_GUID
, '\\','{','5','6','7','8','4','8','5','4','-','C','6','C','B','-','4','6','2','B','-','8','1','6','9','-','8','8','E','3','5','0','A','C','B','8','8','2','}',0};
992 static const WCHAR DocumentsParsingNameW
[] = {':',':', USERFOLDERS_PARSING_GUID
, '\\','{','F','D','D','3','9','A','D','0','-','2','3','8','F','-','4','6','A','F','-','A','D','B','4','-','6','C','8','5','4','8','0','3','6','9','C','7','}',0};
993 static const WCHAR LinksParsingNameW
[] = {':',':', USERFOLDERS_PARSING_GUID
, '\\','{','b','f','b','9','d','5','e','0','-','c','6','a','9','-','4','0','4','c','-','b','2','b','2','-','a','e','6','d','b','6','a','f','4','9','6','8','}',0};
994 static const WCHAR MusicParsingNameW
[] = {':',':', USERFOLDERS_PARSING_GUID
, '\\','{','4','B','D','8','D','5','7','1','-','6','D','1','9','-','4','8','D','3','-','B','E','9','7','-','4','2','2','2','2','0','0','8','0','E','4','3','}',0};
995 static const WCHAR PicturesParsingNameW
[] = {':',':', USERFOLDERS_PARSING_GUID
, '\\','{','3','3','E','2','8','1','3','0','-','4','E','1','E','-','4','6','7','6','-','8','3','5','A','-','9','8','3','9','5','C','3','B','C','3','B','B','}',0};
996 static const WCHAR SavedGamesParsingNameW
[] = {':',':', USERFOLDERS_PARSING_GUID
, '\\','{','4','C','5','C','3','2','F','F','-','B','B','9','D','-','4','3','b','0','-','B','5','B','4','-','2','D','7','2','E','5','4','E','A','A','A','4','}',0};
997 static const WCHAR SavedSearchesParsingNameW
[] = {':',':', USERFOLDERS_PARSING_GUID
, '\\','{','7','d','1','d','3','a','0','4','-','d','e','b','b','-','4','1','1','5','-','9','5','c','f','-','2','f','2','9','d','a','2','9','2','0','d','a','}',0};
998 static const WCHAR VideosParsingNameW
[] = {':',':', USERFOLDERS_PARSING_GUID
, '\\','{','1','8','9','8','9','B','1','D','-','9','9','B','5','-','4','5','5','B','-','8','4','1','C','-','A','B','7','C','7','4','E','4','D','D','F','C','}',0};
999 static const WCHAR DocumentsLibraryParsingNameW
[] = {':',':', USERSLIBRARIES_PARSING_GUID
, '\\','{','7','b','0','d','b','1','7','d','-','9','c','d','2','-','4','a','9','3','-','9','7','3','3','-','4','6','c','c','8','9','0','2','2','e','7','c','}',0};
1000 static const WCHAR MusicLibraryParsingNameW
[] = {':',':', USERSLIBRARIES_PARSING_GUID
, '\\','{','2','1','1','2','A','B','0','A','-','C','8','6','A','-','4','f','f','e','-','A','3','6','8','-','0','D','E','9','6','E','4','7','0','1','2','E','}',0};
1001 static const WCHAR PicturesLibraryParsingNameW
[] = {':',':', USERSLIBRARIES_PARSING_GUID
, '\\','{','A','9','9','0','A','E','9','F','-','A','0','3','B','-','4','e','8','0','-','9','4','B','C','-','9','9','1','2','D','7','5','0','4','1','0','4','}',0};
1002 static const WCHAR VideosLibraryParsingNameW
[] = {':',':', USERSLIBRARIES_PARSING_GUID
, '\\','{','4','9','1','E','9','2','2','F','-','5','6','4','3','-','4','a','f','4','-','A','7','E','B','-','4','E','7','A','1','3','8','D','8','1','7','4','}',0};
1004 typedef enum _CSIDL_Type
{
1006 CSIDL_Type_AllUsers
,
1008 CSIDL_Type_Disallowed
,
1009 CSIDL_Type_NonExistent
,
1010 CSIDL_Type_WindowsPath
,
1011 CSIDL_Type_SystemPath
,
1012 CSIDL_Type_SystemX86Path
,
1015 #define CSIDL_CONTACTS 0x0043
1016 #define CSIDL_DOWNLOADS 0x0047
1017 #define CSIDL_LINKS 0x004d
1018 #define CSIDL_APPDATA_LOCALLOW 0x004e
1019 #define CSIDL_SAVED_GAMES 0x0062
1020 #define CSIDL_SEARCHES 0x0063
1024 const KNOWNFOLDERID
*id
;
1026 LPCWSTR szValueName
;
1027 LPCWSTR szDefaultPath
; /* fallback string or resource ID */
1029 /* KNOWNFOLDER_DEFINITION fields */
1030 KF_CATEGORY category
;
1031 const WCHAR
*pszName
;
1032 const WCHAR
*pszDescription
;
1033 const KNOWNFOLDERID
*fidParent
;
1034 const WCHAR
*pszRelativePath
;
1035 const WCHAR
*pszParsingName
;
1036 const WCHAR
*pszTooltip
;
1037 const WCHAR
*pszLocalizedName
;
1038 const WCHAR
*pszIcon
;
1039 const WCHAR
*pszSecurity
;
1041 KF_DEFINITION_FLAGS kfdFlags
;
1042 const FOLDERTYPEID
*ftidType
;
1045 static const CSIDL_DATA CSIDL_Data
[] =
1047 { /* 0x00 - CSIDL_DESKTOP */
1051 MAKEINTRESOURCEW(IDS_DESKTOPDIRECTORY
),
1053 KF_CATEGORY_PERUSER
, /* category */
1054 DesktopW
, /* name */
1055 NULL
, /* description */
1056 &GUID_NULL
, /* parent */
1057 DesktopW
, /* relative path */
1060 NULL
, /* localized */
1062 NULL
, /* security */
1063 FILE_ATTRIBUTE_READONLY
, /* attributes */
1065 &GUID_NULL
/* typeid */
1067 { /* 0x01 - CSIDL_INTERNET */
1068 &FOLDERID_InternetFolder
,
1069 CSIDL_Type_Disallowed
,
1073 KF_CATEGORY_VIRTUAL
, /* category */
1074 InternetFolderW
, /* name */
1075 NULL
, /* description */
1076 &GUID_NULL
, /* parent */
1077 NULL
, /* relative path */
1078 InternetFolderParsingNameW
, /* parsing */
1080 NULL
, /* localized */
1082 NULL
, /* security */
1085 &GUID_NULL
/* typeid */
1087 { /* 0x02 - CSIDL_PROGRAMS */
1091 Start_Menu_ProgramsW
,
1093 KF_CATEGORY_PERUSER
, /* category */
1094 ProgramsW
, /* name */
1095 NULL
, /* description */
1096 &GUID_NULL
, /* parent */
1097 ProgramsW
, /* relative path */
1100 NULL
, /* localized */
1102 NULL
, /* security */
1103 FILE_ATTRIBUTE_READONLY
, /* attributes */
1105 &GUID_NULL
/* typeid */
1107 { /* 0x03 - CSIDL_CONTROLS (.CPL files) */
1108 &FOLDERID_ControlPanelFolder
,
1109 CSIDL_Type_SystemPath
,
1113 KF_CATEGORY_VIRTUAL
, /* category */
1114 ControlPanelFolderW
, /* name */
1115 NULL
, /* description */
1116 &GUID_NULL
, /* parent */
1117 ControlPanelFolderRelativePathW
, /* relative path */
1118 ControlPanelFolderParsingNameW
, /* parsing */
1120 NULL
, /* localized */
1122 NULL
, /* security */
1125 &GUID_NULL
/* typeid */
1127 { /* 0x04 - CSIDL_PRINTERS */
1128 &FOLDERID_PrintersFolder
,
1129 CSIDL_Type_SystemPath
,
1133 KF_CATEGORY_VIRTUAL
, /* category */
1134 PrintersFolderW
, /* name */
1135 NULL
, /* description */
1136 &GUID_NULL
, /* parent */
1137 NULL
, /* relative path */
1138 PrintersFolderParsingNameW
, /* parsing */
1140 NULL
, /* localized */
1142 NULL
, /* security */
1145 &GUID_NULL
/* typeid */
1147 { /* 0x05 - CSIDL_PERSONAL */
1148 &FOLDERID_Documents
,
1151 MAKEINTRESOURCEW(IDS_PERSONAL
),
1153 KF_CATEGORY_PERUSER
, /* category */
1154 PersonalW
, /* name */
1155 NULL
, /* description */
1156 &GUID_NULL
, /* parent */
1157 DocumentsW
, /* relative path */
1158 DocumentsParsingNameW
, /* parsing */
1160 NULL
, /* localized */
1162 NULL
, /* security */
1163 FILE_ATTRIBUTE_READONLY
, /* attributes */
1164 KFDF_ROAMABLE
| KFDF_PRECREATE
, /* flags */
1165 &GUID_NULL
/* typeid */
1167 { /* 0x06 - CSIDL_FAVORITES */
1168 &FOLDERID_Favorites
,
1173 KF_CATEGORY_PERUSER
, /* category */
1174 FavoritesW
, /* name */
1175 NULL
, /* description */
1176 &GUID_NULL
, /* parent */
1177 FavoritesW
, /* relative path */
1180 NULL
, /* localized */
1182 NULL
, /* security */
1183 FILE_ATTRIBUTE_READONLY
, /* attributes */
1184 KFDF_ROAMABLE
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
, /* flags */
1185 &GUID_NULL
/* typeid */
1187 { /* 0x07 - CSIDL_STARTUP */
1191 Start_Menu_StartupW
,
1193 KF_CATEGORY_PERUSER
, /* category */
1194 StartupW
, /* name */
1195 NULL
, /* description */
1196 &GUID_NULL
, /* parent */
1197 StartUpW
, /* relative path */
1200 NULL
, /* localized */
1202 NULL
, /* security */
1203 FILE_ATTRIBUTE_READONLY
, /* attributes */
1204 KFDF_PRECREATE
, /* flags */
1205 &GUID_NULL
/* typeid */
1207 { /* 0x08 - CSIDL_RECENT */
1213 KF_CATEGORY_PERUSER
, /* category */
1215 NULL
, /* description */
1216 &FOLDERID_RoamingAppData
, /* parent */
1217 Microsoft_Windows_RecentW
, /* relative path */
1220 NULL
, /* localized */
1222 NULL
, /* security */
1223 FILE_ATTRIBUTE_READONLY
, /* attributes */
1224 KFDF_PRECREATE
, /* flags */
1225 &GUID_NULL
/* typeid */
1227 { /* 0x09 - CSIDL_SENDTO */
1233 KF_CATEGORY_PERUSER
, /* category */
1235 NULL
, /* description */
1236 &FOLDERID_RoamingAppData
, /* parent */
1237 Microsoft_Windows_SendToW
, /* relative path */
1240 NULL
, /* localized */
1242 NULL
, /* security */
1244 KFDF_PRECREATE
, /* flags */
1245 &GUID_NULL
/* typeid */
1247 { /* 0x0a - CSIDL_BITBUCKET - Recycle Bin */
1248 &FOLDERID_RecycleBinFolder
,
1249 CSIDL_Type_Disallowed
,
1253 KF_CATEGORY_VIRTUAL
, /* category */
1254 RecycleBinFolderW
, /* name */
1255 NULL
, /* description */
1256 &GUID_NULL
, /* parent */
1257 NULL
, /* relative path */
1258 RecycleBinFolderParsingNameW
, /* parsing */
1260 NULL
, /* localized */
1262 NULL
, /* security */
1265 &GUID_NULL
/* typeid */
1267 { /* 0x0b - CSIDL_STARTMENU */
1268 &FOLDERID_StartMenu
,
1273 KF_CATEGORY_PERUSER
, /* category */
1274 Start_MenuW
, /* name */
1275 NULL
, /* description */
1276 &FOLDERID_RoamingAppData
, /* parent */
1277 Microsoft_Windows_Start_MenuW
, /* relative path */
1280 NULL
, /* localized */
1282 NULL
, /* security */
1283 FILE_ATTRIBUTE_READONLY
, /* attributes */
1284 KFDF_PRECREATE
, /* flags */
1285 &GUID_NULL
/* typeid */
1287 { /* 0x0c - CSIDL_MYDOCUMENTS */
1289 CSIDL_Type_Disallowed
, /* matches WinXP--can't get its path */
1293 { /* 0x0d - CSIDL_MYMUSIC */
1297 MAKEINTRESOURCEW(IDS_MYMUSIC
),
1299 KF_CATEGORY_PERUSER
, /* category */
1300 My_MusicW
, /* name */
1301 NULL
, /* description */
1302 &FOLDERID_Profile
, /* parent */
1303 MusicW
, /* relative path */
1304 MusicParsingNameW
, /* parsing */
1306 NULL
, /* localized */
1308 NULL
, /* security */
1309 FILE_ATTRIBUTE_READONLY
, /* attributes */
1310 KFDF_ROAMABLE
| KFDF_PRECREATE
, /* flags */
1311 &GUID_NULL
/* typeid */
1313 { /* 0x0e - CSIDL_MYVIDEO */
1317 MAKEINTRESOURCEW(IDS_MYVIDEOS
),
1319 KF_CATEGORY_PERUSER
, /* category */
1320 My_VideoW
, /* name */
1321 NULL
, /* description */
1322 &FOLDERID_Profile
, /* parent */
1323 VideosW
, /* relative path */
1324 VideosParsingNameW
, /* parsing */
1326 NULL
, /* localized */
1328 NULL
, /* security */
1329 FILE_ATTRIBUTE_READONLY
, /* attributes */
1330 KFDF_ROAMABLE
| KFDF_PRECREATE
, /* flags */
1331 &GUID_NULL
/* typeid */
1333 { /* 0x0f - unassigned */
1335 CSIDL_Type_Disallowed
,
1339 { /* 0x10 - CSIDL_DESKTOPDIRECTORY */
1343 MAKEINTRESOURCEW(IDS_DESKTOPDIRECTORY
),
1345 KF_CATEGORY_PERUSER
, /* category */
1346 DesktopW
, /* name */
1347 NULL
, /* description */
1348 &FOLDERID_Profile
, /* parent */
1349 DesktopW
, /* relative path */
1352 NULL
, /* localized */
1354 NULL
, /* security */
1355 FILE_ATTRIBUTE_READONLY
, /* attributes */
1356 KFDF_ROAMABLE
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
, /* flags */
1357 &GUID_NULL
/* typeid */
1359 { /* 0x11 - CSIDL_DRIVES */
1360 &FOLDERID_ComputerFolder
,
1361 CSIDL_Type_Disallowed
,
1365 KF_CATEGORY_VIRTUAL
, /* category */
1366 MyComputerFolderW
, /* name */
1367 NULL
, /* description */
1368 &GUID_NULL
, /* parent */
1369 NULL
, /* relative path */
1370 ComputerFolderParsingNameW
, /* parsing */
1372 NULL
, /* localized */
1374 NULL
, /* security */
1377 &GUID_NULL
/* typeid */
1379 { /* 0x12 - CSIDL_NETWORK */
1380 &FOLDERID_NetworkFolder
,
1381 CSIDL_Type_Disallowed
,
1385 KF_CATEGORY_VIRTUAL
, /* category */
1386 NetworkPlacesFolderW
, /* name */
1387 NULL
, /* description */
1388 &GUID_NULL
, /* parent */
1389 NULL
, /* relative path */
1390 NetworkFolderParsingNameW
, /* parsing */
1392 NULL
, /* localized */
1394 NULL
, /* security */
1397 &GUID_NULL
/* typeid */
1399 { /* 0x13 - CSIDL_NETHOOD */
1405 KF_CATEGORY_PERUSER
, /* category */
1406 NetHoodW
, /* name */
1407 NULL
, /* description */
1408 &FOLDERID_RoamingAppData
, /* parent */
1409 Microsoft_Windows_Network_ShortcutsW
, /* relative path */
1412 NULL
, /* localized */
1414 NULL
, /* security */
1417 &GUID_NULL
/* typeid */
1419 { /* 0x14 - CSIDL_FONTS */
1421 CSIDL_Type_WindowsPath
,
1425 KF_CATEGORY_FIXED
, /* category */
1427 NULL
, /* description */
1428 &GUID_NULL
, /* parent */
1429 NULL
, /* relative path */
1432 NULL
, /* localized */
1434 NULL
, /* security */
1437 &FOLDERID_Windows
/* typeid */
1439 { /* 0x15 - CSIDL_TEMPLATES */
1440 &FOLDERID_Templates
,
1445 KF_CATEGORY_PERUSER
, /* category */
1446 TemplatesW
, /* name */
1447 NULL
, /* description */
1448 &FOLDERID_RoamingAppData
, /* parent */
1449 Microsoft_Windows_TemplatesW
, /* relative path */
1452 NULL
, /* localized */
1454 NULL
, /* security */
1457 &GUID_NULL
/* typeid */
1459 { /* 0x16 - CSIDL_COMMON_STARTMENU */
1460 &FOLDERID_CommonStartMenu
,
1461 CSIDL_Type_AllUsers
,
1465 KF_CATEGORY_COMMON
, /* category */
1466 Common_Start_MenuW
, /* name */
1467 NULL
, /* description */
1468 &FOLDERID_ProgramData
, /* parent */
1469 Microsoft_Windows_Start_MenuW
, /* relative path */
1472 NULL
, /* localized */
1474 NULL
, /* security */
1475 FILE_ATTRIBUTE_READONLY
, /* attributes */
1477 &GUID_NULL
/* typeid */
1479 { /* 0x17 - CSIDL_COMMON_PROGRAMS */
1480 &FOLDERID_CommonPrograms
,
1481 CSIDL_Type_AllUsers
,
1483 Start_Menu_ProgramsW
,
1485 KF_CATEGORY_COMMON
, /* category */
1486 Common_ProgramsW
, /* name */
1487 NULL
, /* description */
1488 &FOLDERID_CommonStartMenu
, /* parent */
1489 ProgramsW
, /* relative path */
1492 NULL
, /* localized */
1494 NULL
, /* security */
1495 FILE_ATTRIBUTE_READONLY
, /* attributes */
1497 &GUID_NULL
/* typeid */
1499 { /* 0x18 - CSIDL_COMMON_STARTUP */
1500 &FOLDERID_CommonStartup
,
1501 CSIDL_Type_AllUsers
,
1503 Start_Menu_StartupW
,
1505 KF_CATEGORY_COMMON
, /* category */
1506 Common_StartupW
, /* name */
1507 NULL
, /* description */
1508 &FOLDERID_CommonPrograms
, /* parent */
1509 StartUpW
, /* relative path */
1512 NULL
, /* localized */
1514 NULL
, /* security */
1515 FILE_ATTRIBUTE_READONLY
, /* attributes */
1516 KFDF_PRECREATE
, /* flags */
1517 &GUID_NULL
/* typeid */
1519 { /* 0x19 - CSIDL_COMMON_DESKTOPDIRECTORY */
1520 &FOLDERID_PublicDesktop
,
1521 CSIDL_Type_AllUsers
,
1523 MAKEINTRESOURCEW(IDS_DESKTOPDIRECTORY
),
1525 KF_CATEGORY_COMMON
, /* category */
1526 Common_DesktopW
, /* name */
1527 NULL
, /* description */
1528 &FOLDERID_Public
, /* parent */
1529 DesktopW
, /* relative path */
1532 NULL
, /* localized */
1534 NULL
, /* security */
1535 FILE_ATTRIBUTE_READONLY
| FILE_ATTRIBUTE_HIDDEN
, /* attributes */
1536 KFDF_PRECREATE
, /* flags */
1537 &GUID_NULL
/* typeid */
1539 { /* 0x1a - CSIDL_APPDATA */
1540 &FOLDERID_RoamingAppData
,
1545 KF_CATEGORY_PERUSER
, /* category */
1546 AppDataW
, /* name */
1547 NULL
, /* description */
1548 &FOLDERID_Profile
, /* parent */
1549 AppData_RoamingW
, /* relative path */
1552 NULL
, /* localized */
1554 NULL
, /* security */
1557 &GUID_NULL
/* typeid */
1559 { /* 0x1b - CSIDL_PRINTHOOD */
1560 &FOLDERID_PrintHood
,
1565 KF_CATEGORY_PERUSER
, /* category */
1566 PrintHoodW
, /* name */
1567 NULL
, /* description */
1568 &FOLDERID_RoamingAppData
, /* parent */
1569 Microsoft_Windows_Printer_ShortcutsW
, /* relative path */
1572 NULL
, /* localized */
1574 NULL
, /* security */
1577 &GUID_NULL
/* typeid */
1579 { /* 0x1c - CSIDL_LOCAL_APPDATA */
1580 &FOLDERID_LocalAppData
,
1583 Local_Settings_Application_DataW
,
1585 KF_CATEGORY_PERUSER
, /* category */
1586 Local_AppDataW
, /* name */
1587 NULL
, /* description */
1588 &FOLDERID_Profile
, /* parent */
1589 AppData_LocalW
, /* relative path */
1592 NULL
, /* localized */
1594 NULL
, /* security */
1596 KFDF_LOCAL_REDIRECT_ONLY
| KFDF_PUBLISHEXPANDEDPATH
, /* flags */
1597 &GUID_NULL
/* typeid */
1599 { /* 0x1d - CSIDL_ALTSTARTUP */
1601 CSIDL_Type_NonExistent
,
1605 { /* 0x1e - CSIDL_COMMON_ALTSTARTUP */
1607 CSIDL_Type_NonExistent
,
1611 { /* 0x1f - CSIDL_COMMON_FAVORITES */
1612 &FOLDERID_Favorites
,
1613 CSIDL_Type_AllUsers
,
1617 KF_CATEGORY_PERUSER
, /* category */
1618 FavoritesW
, /* name */
1619 NULL
, /* description */
1620 &FOLDERID_Profile
, /* parent */
1621 FavoritesW
, /* relative path */
1624 NULL
, /* localized */
1626 NULL
, /* security */
1627 FILE_ATTRIBUTE_READONLY
, /* attributes */
1628 KFDF_ROAMABLE
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
, /* flags */
1629 &GUID_NULL
/* typeid */
1631 { /* 0x20 - CSIDL_INTERNET_CACHE */
1632 &FOLDERID_InternetCache
,
1635 Local_Settings_Temporary_Internet_FilesW
,
1637 KF_CATEGORY_PERUSER
, /* category */
1639 NULL
, /* description */
1640 &FOLDERID_LocalAppData
, /* parent */
1641 Microsoft_Windows_Temporary_Internet_FilesW
, /* relative path */
1644 NULL
, /* localized */
1646 NULL
, /* security */
1648 KFDF_LOCAL_REDIRECT_ONLY
, /* flags */
1649 &GUID_NULL
/* typeid */
1651 { /* 0x21 - CSIDL_COOKIES */
1657 KF_CATEGORY_PERUSER
, /* category */
1658 CookiesW
, /* name */
1659 NULL
, /* description */
1660 &FOLDERID_RoamingAppData
, /* parent */
1661 Microsoft_Windows_CookiesW
, /* relative path */
1664 NULL
, /* localized */
1666 NULL
, /* security */
1669 &GUID_NULL
/* typeid */
1671 { /* 0x22 - CSIDL_HISTORY */
1675 Local_Settings_HistoryW
,
1677 KF_CATEGORY_PERUSER
, /* category */
1678 HistoryW
, /* name */
1679 NULL
, /* description */
1680 &FOLDERID_LocalAppData
, /* parent */
1681 Microsoft_Windows_HistoryW
, /* relative path */
1684 NULL
, /* localized */
1686 NULL
, /* security */
1688 KFDF_LOCAL_REDIRECT_ONLY
, /* flags */
1689 &GUID_NULL
/* typeid */
1691 { /* 0x23 - CSIDL_COMMON_APPDATA */
1692 &FOLDERID_ProgramData
,
1693 CSIDL_Type_AllUsers
,
1697 KF_CATEGORY_FIXED
, /* category */
1698 Common_AppDataW
, /* name */
1699 NULL
, /* description */
1700 &GUID_NULL
, /* parent */
1701 NULL
, /* relative path */
1704 NULL
, /* localized */
1706 NULL
, /* security */
1709 &GUID_NULL
/* typeid */
1711 { /* 0x24 - CSIDL_WINDOWS */
1713 CSIDL_Type_WindowsPath
,
1717 KF_CATEGORY_FIXED
, /* category */
1718 WindowsW
, /* name */
1719 NULL
, /* description */
1720 &GUID_NULL
, /* parent */
1721 NULL
, /* relative path */
1724 NULL
, /* localized */
1726 NULL
, /* security */
1729 &GUID_NULL
/* typeid */
1731 { /* 0x25 - CSIDL_SYSTEM */
1733 CSIDL_Type_SystemPath
,
1737 KF_CATEGORY_FIXED
, /* category */
1739 NULL
, /* description */
1740 &GUID_NULL
, /* parent */
1741 NULL
, /* relative path */
1744 NULL
, /* localized */
1746 NULL
, /* security */
1749 &GUID_NULL
/* typeid */
1751 { /* 0x26 - CSIDL_PROGRAM_FILES */
1752 &FOLDERID_ProgramFiles
,
1757 KF_CATEGORY_FIXED
, /* category */
1758 ProgramFilesW
, /* name */
1759 NULL
, /* description */
1760 &GUID_NULL
, /* parent */
1761 NULL
, /* relative path */
1764 NULL
, /* localized */
1766 NULL
, /* security */
1767 FILE_ATTRIBUTE_READONLY
, /* attributes */
1769 &GUID_NULL
/* typeid */
1771 { /* 0x27 - CSIDL_MYPICTURES */
1775 MAKEINTRESOURCEW(IDS_MYPICTURES
),
1777 KF_CATEGORY_PERUSER
, /* category */
1778 My_PicturesW
, /* name */
1779 NULL
, /* description */
1780 &FOLDERID_Profile
, /* parent */
1781 PicturesW
, /* relative path */
1782 PicturesParsingNameW
, /* parsing */
1784 NULL
, /* localized */
1786 NULL
, /* security */
1787 FILE_ATTRIBUTE_READONLY
, /* attributes */
1788 KFDF_ROAMABLE
| KFDF_PRECREATE
, /* flags */
1789 &GUID_NULL
/* typeid */
1791 { /* 0x28 - CSIDL_PROFILE */
1797 KF_CATEGORY_FIXED
, /* category */
1798 ProfileW
, /* name */
1799 NULL
, /* description */
1800 &GUID_NULL
, /* parent */
1801 NULL
, /* relative path */
1804 NULL
, /* localized */
1806 NULL
, /* security */
1809 &GUID_NULL
/* typeid */
1811 { /* 0x29 - CSIDL_SYSTEMX86 */
1812 &FOLDERID_SystemX86
,
1813 CSIDL_Type_SystemX86Path
,
1817 KF_CATEGORY_FIXED
, /* category */
1818 SystemX86W
, /* name */
1819 NULL
, /* description */
1820 &GUID_NULL
, /* parent */
1821 NULL
, /* relative path */
1824 NULL
, /* localized */
1826 NULL
, /* security */
1829 &GUID_NULL
/* typeid */
1831 { /* 0x2a - CSIDL_PROGRAM_FILESX86 */
1832 &FOLDERID_ProgramFilesX86
,
1834 ProgramFilesDirX86W
,
1837 KF_CATEGORY_FIXED
, /* category */
1838 ProgramFilesX86W
, /* name */
1839 NULL
, /* description */
1840 &GUID_NULL
, /* parent */
1841 NULL
, /* relative path */
1844 NULL
, /* localized */
1846 NULL
, /* security */
1847 FILE_ATTRIBUTE_READONLY
, /* attributes */
1849 &GUID_NULL
/* typeid */
1851 { /* 0x2b - CSIDL_PROGRAM_FILES_COMMON */
1852 &FOLDERID_ProgramFilesCommon
,
1855 Program_Files_Common_FilesW
,
1857 KF_CATEGORY_FIXED
, /* category */
1858 ProgramFilesCommonW
, /* name */
1859 NULL
, /* description */
1860 &GUID_NULL
, /* parent */
1861 NULL
, /* relative path */
1864 NULL
, /* localized */
1866 NULL
, /* security */
1869 &GUID_NULL
/* typeid */
1871 { /* 0x2c - CSIDL_PROGRAM_FILES_COMMONX86 */
1872 &FOLDERID_ProgramFilesCommonX86
,
1875 Program_Files_x86_Common_FilesW
,
1877 KF_CATEGORY_FIXED
, /* category */
1878 ProgramFilesCommonX86W
, /* name */
1879 NULL
, /* description */
1880 &GUID_NULL
, /* parent */
1881 NULL
, /* relative path */
1884 NULL
, /* localized */
1886 NULL
, /* security */
1889 &GUID_NULL
/* typeid */
1891 { /* 0x2d - CSIDL_COMMON_TEMPLATES */
1892 &FOLDERID_CommonTemplates
,
1893 CSIDL_Type_AllUsers
,
1897 KF_CATEGORY_COMMON
, /* category */
1898 Common_TemplatesW
, /* name */
1899 NULL
, /* description */
1900 &FOLDERID_ProgramData
, /* parent */
1901 Microsoft_Windows_TemplatesW
, /* relative path */
1904 NULL
, /* localized */
1906 NULL
, /* security */
1909 &GUID_NULL
/* typeid */
1911 { /* 0x2e - CSIDL_COMMON_DOCUMENTS */
1912 &FOLDERID_PublicDocuments
,
1913 CSIDL_Type_AllUsers
,
1917 KF_CATEGORY_COMMON
, /* category */
1918 Common_DocumentsW
, /* name */
1919 NULL
, /* description */
1920 &FOLDERID_Public
, /* parent */
1921 DocumentsW
, /* relative path */
1924 NULL
, /* localized */
1926 NULL
, /* security */
1927 FILE_ATTRIBUTE_READONLY
, /* attributes */
1928 KFDF_PRECREATE
, /* flags */
1929 &GUID_NULL
/* typeid */
1931 { /* 0x2f - CSIDL_COMMON_ADMINTOOLS */
1932 &FOLDERID_CommonAdminTools
,
1933 CSIDL_Type_AllUsers
,
1934 Common_Administrative_ToolsW
,
1935 Start_Menu_Admin_ToolsW
,
1937 KF_CATEGORY_COMMON
, /* category */
1938 Common_Administrative_ToolsW
, /* name */
1939 NULL
, /* description */
1940 &FOLDERID_CommonPrograms
, /* parent */
1941 Administrative_ToolsW
, /* relative path */
1944 NULL
, /* localized */
1946 NULL
, /* security */
1947 FILE_ATTRIBUTE_READONLY
, /* attributes */
1948 KFDF_PRECREATE
, /* flags */
1949 &GUID_NULL
/* typeid */
1951 { /* 0x30 - CSIDL_ADMINTOOLS */
1952 &FOLDERID_AdminTools
,
1954 Administrative_ToolsW
,
1955 Start_Menu_Admin_ToolsW
,
1957 KF_CATEGORY_PERUSER
, /* category */
1958 Administrative_ToolsW
, /* name */
1959 NULL
, /* description */
1960 &FOLDERID_Programs
, /* parent */
1961 Administrative_ToolsW
, /* relative path */
1964 NULL
, /* localized */
1966 NULL
, /* security */
1967 FILE_ATTRIBUTE_READONLY
, /* attributes */
1968 KFDF_PRECREATE
, /* flags */
1969 &GUID_NULL
/* typeid */
1971 { /* 0x31 - CSIDL_CONNECTIONS */
1972 &FOLDERID_ConnectionsFolder
,
1973 CSIDL_Type_Disallowed
,
1977 KF_CATEGORY_VIRTUAL
, /* category */
1978 ConnectionsFolderW
, /* name */
1979 NULL
, /* description */
1980 &GUID_NULL
, /* parent */
1981 Administrative_ToolsW
, /* relative path */
1982 ConnectionsFolderParsingNameW
, /* parsing */
1984 NULL
, /* localized */
1986 NULL
, /* security */
1989 &GUID_NULL
/* typeid */
1991 { /* 0x32 - unassigned */
1993 CSIDL_Type_Disallowed
,
1997 { /* 0x33 - unassigned */
1999 CSIDL_Type_Disallowed
,
2003 { /* 0x34 - unassigned */
2005 CSIDL_Type_Disallowed
,
2009 { /* 0x35 - CSIDL_COMMON_MUSIC */
2010 &FOLDERID_PublicMusic
,
2011 CSIDL_Type_AllUsers
,
2015 KF_CATEGORY_COMMON
, /* category */
2016 CommonMusicW
, /* name */
2017 NULL
, /* description */
2018 &FOLDERID_Public
, /* parent */
2019 MusicW
, /* relative path */
2022 NULL
, /* localized */
2024 NULL
, /* security */
2025 FILE_ATTRIBUTE_READONLY
, /* attributes */
2026 KFDF_PRECREATE
, /* flags */
2027 &GUID_NULL
/* typeid */
2029 { /* 0x36 - CSIDL_COMMON_PICTURES */
2030 &FOLDERID_PublicPictures
,
2031 CSIDL_Type_AllUsers
,
2035 KF_CATEGORY_COMMON
, /* category */
2036 CommonPicturesW
, /* name */
2037 NULL
, /* description */
2038 &FOLDERID_Public
, /* parent */
2039 PicturesW
, /* relative path */
2042 NULL
, /* localized */
2044 NULL
, /* security */
2045 FILE_ATTRIBUTE_READONLY
, /* attributes */
2046 KFDF_PRECREATE
, /* flags */
2047 &GUID_NULL
/* typeid */
2049 { /* 0x37 - CSIDL_COMMON_VIDEO */
2050 &FOLDERID_PublicVideos
,
2051 CSIDL_Type_AllUsers
,
2055 KF_CATEGORY_COMMON
, /* category */
2056 CommonVideoW
, /* name */
2057 NULL
, /* description */
2058 &FOLDERID_Public
, /* parent */
2059 VideosW
, /* relative path */
2062 NULL
, /* localized */
2064 NULL
, /* security */
2065 FILE_ATTRIBUTE_READONLY
, /* attributes */
2066 KFDF_PRECREATE
, /* flags */
2067 &GUID_NULL
/* typeid */
2069 { /* 0x38 - CSIDL_RESOURCES */
2070 &FOLDERID_ResourceDir
,
2071 CSIDL_Type_WindowsPath
,
2075 KF_CATEGORY_FIXED
, /* category */
2076 ResourceDirW
, /* name */
2077 NULL
, /* description */
2078 &GUID_NULL
, /* parent */
2079 NULL
, /* relative path */
2082 NULL
, /* localized */
2084 NULL
, /* security */
2087 &GUID_NULL
/* typeid */
2089 { /* 0x39 - CSIDL_RESOURCES_LOCALIZED */
2090 &FOLDERID_LocalizedResourcesDir
,
2091 CSIDL_Type_NonExistent
,
2095 KF_CATEGORY_FIXED
, /* category */
2096 LocalizedResourcesDirW
, /* name */
2097 NULL
, /* description */
2098 &GUID_NULL
, /* parent */
2099 NULL
, /* relative path */
2102 NULL
, /* localized */
2104 NULL
, /* security */
2107 &GUID_NULL
/* typeid */
2109 { /* 0x3a - CSIDL_COMMON_OEM_LINKS */
2110 &FOLDERID_CommonOEMLinks
,
2111 CSIDL_Type_AllUsers
,
2115 KF_CATEGORY_COMMON
, /* category */
2116 OEM_LinksW
, /* name */
2117 NULL
, /* description */
2118 &FOLDERID_ProgramData
, /* parent */
2119 OEM_LinksW
, /* relative path */
2122 NULL
, /* localized */
2124 NULL
, /* security */
2127 &GUID_NULL
/* typeid */
2129 { /* 0x3b - CSIDL_CDBURN_AREA */
2130 &FOLDERID_CDBurning
,
2133 Local_Settings_CD_BurningW
,
2135 KF_CATEGORY_PERUSER
, /* category */
2136 CD_BurningW
, /* name */
2137 NULL
, /* description */
2138 &FOLDERID_LocalAppData
, /* parent */
2139 Microsoft_Windows_Burn_BurnW
, /* relative path */
2142 NULL
, /* localized */
2144 NULL
, /* security */
2145 FILE_ATTRIBUTE_READONLY
, /* attributes */
2146 KFDF_LOCAL_REDIRECT_ONLY
, /* flags */
2147 &GUID_NULL
/* typeid */
2149 { /* 0x3c unassigned */
2151 CSIDL_Type_Disallowed
,
2155 { /* 0x3d - CSIDL_COMPUTERSNEARME */
2157 CSIDL_Type_Disallowed
, /* FIXME */
2161 { /* 0x3e - CSIDL_PROFILES */
2163 CSIDL_Type_Disallowed
, /* oddly, this matches WinXP */
2168 &FOLDERID_AddNewPrograms
,
2169 CSIDL_Type_Disallowed
,
2173 KF_CATEGORY_VIRTUAL
, /* category */
2174 AddNewProgramsFolderW
, /* name */
2175 NULL
, /* description */
2176 &GUID_NULL
, /* parent */
2177 NULL
, /* relative path */
2178 AddNewProgramsParsingNameW
, /* parsing */
2180 NULL
, /* localized */
2182 NULL
, /* security */
2185 &GUID_NULL
/* typeid */
2188 &FOLDERID_AppUpdates
,
2189 CSIDL_Type_Disallowed
,
2193 KF_CATEGORY_VIRTUAL
, /* category */
2194 AppUpdatesFolderW
, /* name */
2195 NULL
, /* description */
2196 &GUID_NULL
, /* parent */
2197 NULL
, /* relative path */
2198 AppUpdatesParsingNameW
, /* parsing */
2200 NULL
, /* localized */
2202 NULL
, /* security */
2205 &GUID_NULL
/* typeid */
2208 &FOLDERID_ChangeRemovePrograms
,
2209 CSIDL_Type_Disallowed
,
2213 KF_CATEGORY_VIRTUAL
, /* category */
2214 ChangeRemoveProgramsFolderW
, /* name */
2215 NULL
, /* description */
2216 &GUID_NULL
, /* parent */
2217 NULL
, /* relative path */
2218 ChangeRemoveProgramsParsingNameW
, /* parsing */
2220 NULL
, /* localized */
2222 NULL
, /* security */
2225 &GUID_NULL
/* typeid */
2228 &FOLDERID_ConflictFolder
,
2229 CSIDL_Type_Disallowed
,
2233 KF_CATEGORY_VIRTUAL
, /* category */
2234 ConflictFolderW
, /* name */
2235 NULL
, /* description */
2236 &GUID_NULL
, /* parent */
2237 NULL
, /* relative path */
2238 ConflictFolderParsingNameW
, /* parsing */
2240 NULL
, /* localized */
2242 NULL
, /* security */
2245 &GUID_NULL
/* typeid */
2247 { /* 0x43 - CSIDL_CONTACTS */
2253 KF_CATEGORY_PERUSER
, /* category */
2254 ContactsW
, /* name */
2255 NULL
, /* description */
2256 &FOLDERID_Profile
, /* parent */
2257 ContactsW
, /* relative path */
2258 ContactsParsingNameW
, /* parsing */
2260 NULL
, /* localized */
2262 NULL
, /* security */
2263 FILE_ATTRIBUTE_READONLY
, /* attributes */
2264 KFDF_ROAMABLE
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
, /* flags */
2265 &GUID_NULL
/* typeid */
2268 &FOLDERID_DeviceMetadataStore
,
2269 CSIDL_Type_Disallowed
, /* FIXME */
2273 KF_CATEGORY_COMMON
, /* category */
2274 Device_Metadata_StoreW
, /* name */
2275 NULL
, /* description */
2276 &FOLDERID_ProgramData
, /* parent */
2277 Microsoft_Windows_DeviceMetadataStoreW
, /* relative path */
2280 NULL
, /* localized */
2282 NULL
, /* security */
2285 &GUID_NULL
/* typeid */
2294 &FOLDERID_DocumentsLibrary
,
2295 CSIDL_Type_Disallowed
, /* FIXME */
2299 KF_CATEGORY_PERUSER
, /* category */
2300 DocumentsLibraryW
, /* name */
2301 NULL
, /* description */
2302 &FOLDERID_Libraries
, /* parent */
2303 Documents_librarymsW
, /* relative path */
2304 DocumentsLibraryParsingNameW
, /* parsing */
2306 NULL
, /* localized */
2308 NULL
, /* security */
2310 KFDF_PRECREATE
| KFDF_STREAM
, /* flags */
2311 &GUID_NULL
/* typeid */
2313 { /* 0x47 - CSIDL_DOWNLOADS */
2314 &FOLDERID_Downloads
,
2319 KF_CATEGORY_PERUSER
, /* category */
2320 DownloadsW
, /* name */
2321 NULL
, /* description */
2322 &FOLDERID_Profile
, /* parent */
2323 DownloadsW
, /* relative path */
2326 NULL
, /* localized */
2328 NULL
, /* security */
2329 FILE_ATTRIBUTE_READONLY
, /* attributes */
2330 KFDF_ROAMABLE
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
, /* flags */
2331 &GUID_NULL
/* typeid */
2335 CSIDL_Type_Disallowed
,
2339 KF_CATEGORY_VIRTUAL
, /* category */
2341 NULL
, /* description */
2342 &GUID_NULL
, /* parent */
2343 NULL
, /* relative path */
2344 GamesParsingNameW
, /* parsing */
2346 NULL
, /* localized */
2348 NULL
, /* security */
2351 &GUID_NULL
/* typeid */
2354 &FOLDERID_GameTasks
,
2355 CSIDL_Type_Disallowed
, /* FIXME */
2359 KF_CATEGORY_PERUSER
, /* category */
2360 GameTasksW
, /* name */
2361 NULL
, /* description */
2362 &FOLDERID_LocalAppData
, /* parent */
2363 Microsoft_Windows_GameExplorerW
, /* relative path */
2366 NULL
, /* localized */
2368 NULL
, /* security */
2370 KFDF_LOCAL_REDIRECT_ONLY
, /* flags */
2371 &GUID_NULL
/* typeid */
2374 &FOLDERID_HomeGroup
,
2375 CSIDL_Type_Disallowed
,
2379 KF_CATEGORY_VIRTUAL
, /* category */
2380 HomeGroupFolderW
, /* name */
2381 NULL
, /* description */
2382 &GUID_NULL
, /* parent */
2383 NULL
, /* relative path */
2384 HomeGroupParsingNameW
, /* parsing */
2386 NULL
, /* localized */
2388 NULL
, /* security */
2391 &GUID_NULL
/* typeid */
2394 &FOLDERID_ImplicitAppShortcuts
,
2395 CSIDL_Type_Disallowed
, /* FIXME */
2399 KF_CATEGORY_PERUSER
, /* category */
2400 ImplicitAppShortcutsW
, /* name */
2401 NULL
, /* description */
2402 &FOLDERID_UserPinned
, /* parent */
2403 ImplicitAppShortcutsW
, /* relative path */
2406 NULL
, /* localized */
2408 NULL
, /* security */
2410 KFDF_PRECREATE
, /* flags */
2411 &GUID_NULL
/* typeid */
2414 &FOLDERID_Libraries
,
2415 CSIDL_Type_Disallowed
, /* FIXME */
2419 KF_CATEGORY_PERUSER
, /* category */
2420 LibrariesW
, /* name */
2421 NULL
, /* description */
2422 &FOLDERID_RoamingAppData
, /* parent */
2423 Microsoft_Windows_LibrariesW
, /* relative path */
2426 NULL
, /* localized */
2428 NULL
, /* security */
2430 KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
, /* flags */
2431 &GUID_NULL
/* typeid */
2433 { /* 0x4d - CSIDL_LINKS */
2439 KF_CATEGORY_PERUSER
, /* category */
2441 NULL
, /* description */
2442 &FOLDERID_Profile
, /* parent */
2443 LinksW
, /* relative path */
2444 LinksParsingNameW
, /* parsing */
2446 NULL
, /* localized */
2448 NULL
, /* security */
2449 FILE_ATTRIBUTE_READONLY
, /* attributes */
2450 KFDF_ROAMABLE
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
, /* flags */
2451 &GUID_NULL
/* typeid */
2453 { /* 0x4e - CSIDL_APPDATA_LOCALLOW */
2454 &FOLDERID_LocalAppDataLow
,
2459 KF_CATEGORY_PERUSER
, /* category */
2460 LocalAppDataLowW
, /* name */
2461 NULL
, /* description */
2462 &FOLDERID_Profile
, /* parent */
2463 AppData_LocalLowW
, /* relative path */
2466 NULL
, /* localized */
2468 NULL
, /* security */
2469 FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
, /* attributes */
2470 KFDF_LOCAL_REDIRECT_ONLY
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
, /* flags */
2471 &GUID_NULL
/* typeid */
2474 &FOLDERID_MusicLibrary
,
2475 CSIDL_Type_Disallowed
, /* FIXME */
2479 KF_CATEGORY_PERUSER
, /* category */
2480 MusicLibraryW
, /* name */
2481 NULL
, /* description */
2482 &FOLDERID_Libraries
, /* parent */
2483 Music_librarymsW
, /* relative path */
2484 MusicLibraryParsingNameW
, /* parsing */
2486 NULL
, /* localized */
2488 NULL
, /* security */
2490 KFDF_PRECREATE
| KFDF_STREAM
, /* flags */
2491 &GUID_NULL
/* typeid */
2494 &FOLDERID_OriginalImages
,
2495 CSIDL_Type_Disallowed
, /* FIXME */
2499 KF_CATEGORY_PERUSER
, /* category */
2500 Original_ImagesW
, /* name */
2501 NULL
, /* description */
2502 &FOLDERID_LocalAppData
, /* parent */
2503 Microsoft_Windows_Photo_Gallery_Original_ImagesW
, /* relative path */
2506 NULL
, /* localized */
2508 NULL
, /* security */
2511 &GUID_NULL
/* typeid */
2514 &FOLDERID_PhotoAlbums
,
2517 Pictures_Slide_ShowsW
,
2519 KF_CATEGORY_PERUSER
, /* category */
2520 PhotoAlbumsW
, /* name */
2521 NULL
, /* description */
2522 &FOLDERID_Pictures
, /* parent */
2523 Slide_ShowsW
, /* relative path */
2526 NULL
, /* localized */
2528 NULL
, /* security */
2529 FILE_ATTRIBUTE_READONLY
, /* attributes */
2531 &GUID_NULL
/* typeid */
2534 &FOLDERID_PicturesLibrary
,
2535 CSIDL_Type_Disallowed
, /* FIXME */
2539 KF_CATEGORY_PERUSER
, /* category */
2540 PicturesLibraryW
, /* name */
2541 NULL
, /* description */
2542 &FOLDERID_Libraries
, /* parent */
2543 Pictures_librarymsW
, /* relative path */
2544 PicturesLibraryParsingNameW
, /* parsing */
2546 NULL
, /* localized */
2548 NULL
, /* security */
2550 KFDF_PRECREATE
| KFDF_STREAM
, /* flags */
2551 &GUID_NULL
/* typeid */
2554 &FOLDERID_Playlists
,
2559 KF_CATEGORY_PERUSER
, /* category */
2560 PlaylistsW
, /* name */
2561 NULL
, /* description */
2562 &FOLDERID_Music
, /* parent */
2563 PlaylistsW
, /* relative path */
2566 NULL
, /* localized */
2568 NULL
, /* security */
2569 FILE_ATTRIBUTE_READONLY
, /* attributes */
2571 &GUID_NULL
/* typeid */
2574 &FOLDERID_ProgramFilesX64
,
2575 CSIDL_Type_NonExistent
,
2579 KF_CATEGORY_FIXED
, /* category */
2580 ProgramFilesX64W
, /* name */
2581 NULL
, /* description */
2582 &GUID_NULL
, /* parent */
2583 NULL
, /* relative path */
2586 NULL
, /* localized */
2588 NULL
, /* security */
2591 &GUID_NULL
/* typeid */
2594 &FOLDERID_ProgramFilesCommonX64
,
2595 CSIDL_Type_NonExistent
,
2599 KF_CATEGORY_FIXED
, /* category */
2600 ProgramFilesCommonX64W
, /* name */
2601 NULL
, /* description */
2602 &GUID_NULL
, /* parent */
2603 NULL
, /* relative path */
2606 NULL
, /* localized */
2608 NULL
, /* security */
2611 &GUID_NULL
/* typeid */
2615 CSIDL_Type_CurrVer
, /* FIXME */
2619 KF_CATEGORY_FIXED
, /* category */
2621 NULL
, /* description */
2622 &GUID_NULL
, /* parent */
2623 NULL
, /* relative path */
2624 PublicParsingNameW
, /* parsing */
2626 NULL
, /* localized */
2628 NULL
, /* security */
2629 FILE_ATTRIBUTE_READONLY
, /* attributes */
2630 KFDF_PRECREATE
, /* flags */
2631 &GUID_NULL
/* typeid */
2634 &FOLDERID_PublicDownloads
,
2635 CSIDL_Type_AllUsers
,
2639 KF_CATEGORY_COMMON
, /* category */
2640 CommonDownloadsW
, /* name */
2641 NULL
, /* description */
2642 &FOLDERID_Public
, /* parent */
2643 DownloadsW
, /* relative path */
2646 NULL
, /* localized */
2648 NULL
, /* security */
2649 FILE_ATTRIBUTE_READONLY
, /* attributes */
2650 KFDF_PRECREATE
, /* flags */
2651 &GUID_NULL
/* typeid */
2654 &FOLDERID_PublicGameTasks
,
2655 CSIDL_Type_AllUsers
,
2657 Microsoft_Windows_GameExplorerW
,
2659 KF_CATEGORY_COMMON
, /* category */
2660 PublicGameTasksW
, /* name */
2661 NULL
, /* description */
2662 &FOLDERID_ProgramData
, /* parent */
2663 Microsoft_Windows_GameExplorerW
, /* relative path */
2666 NULL
, /* localized */
2668 NULL
, /* security */
2670 KFDF_LOCAL_REDIRECT_ONLY
, /* flags */
2671 &GUID_NULL
/* typeid */
2674 &FOLDERID_PublicLibraries
,
2675 CSIDL_Type_AllUsers
,
2677 Microsoft_Windows_LibrariesW
,
2679 KF_CATEGORY_COMMON
, /* category */
2680 PublicLibrariesW
, /* name */
2681 NULL
, /* description */
2682 &FOLDERID_Public
, /* parent */
2683 LibrariesW
, /* relative path */
2686 NULL
, /* localized */
2688 NULL
, /* security */
2689 FILE_ATTRIBUTE_READONLY
| FILE_ATTRIBUTE_HIDDEN
, /* attributes */
2690 KFDF_PRECREATE
, /* flags */
2691 &GUID_NULL
/* typeid */
2694 &FOLDERID_PublicRingtones
,
2695 CSIDL_Type_AllUsers
,
2697 Microsoft_Windows_RingtonesW
,
2699 KF_CATEGORY_COMMON
, /* category */
2700 CommonRingtonesW
, /* name */
2701 NULL
, /* description */
2702 &FOLDERID_ProgramData
, /* parent */
2703 Microsoft_Windows_RingtonesW
, /* relative path */
2706 NULL
, /* localized */
2708 NULL
, /* security */
2710 KFDF_PRECREATE
, /* flags */
2711 &GUID_NULL
/* typeid */
2714 &FOLDERID_QuickLaunch
,
2715 CSIDL_Type_Disallowed
, /* FIXME */
2719 KF_CATEGORY_PERUSER
, /* category */
2720 Quick_LaunchW
, /* name */
2721 NULL
, /* description */
2722 &FOLDERID_RoamingAppData
, /* parent */
2723 Microsoft_Internet_Explorer_Quick_LaunchW
, /* relative path */
2726 NULL
, /* localized */
2728 NULL
, /* security */
2731 &GUID_NULL
/* typeid */
2734 &FOLDERID_RecordedTVLibrary
,
2735 CSIDL_Type_Disallowed
, /* FIXME */
2739 KF_CATEGORY_COMMON
, /* category */
2740 RecordedTVLibraryW
, /* name */
2741 NULL
, /* description */
2742 &FOLDERID_PublicLibraries
, /* parent */
2743 RecordedTV_librarymsW
, /* relative path */
2746 NULL
, /* localized */
2748 NULL
, /* security */
2750 KFDF_PRECREATE
| KFDF_STREAM
, /* flags */
2751 &GUID_NULL
/* typeid */
2754 &FOLDERID_Ringtones
,
2755 CSIDL_Type_Disallowed
, /* FIXME */
2759 KF_CATEGORY_PERUSER
, /* category */
2760 RingtonesW
, /* name */
2761 NULL
, /* description */
2762 &FOLDERID_LocalAppData
, /* parent */
2763 Microsoft_Windows_RingtonesW
, /* relative path */
2766 NULL
, /* localized */
2768 NULL
, /* security */
2770 KFDF_PRECREATE
, /* flags */
2771 &GUID_NULL
/* typeid */
2774 &FOLDERID_SampleMusic
,
2775 CSIDL_Type_AllUsers
,
2777 Music_Sample_MusicW
,
2779 KF_CATEGORY_COMMON
, /* category */
2780 SampleMusicW
, /* name */
2781 NULL
, /* description */
2782 &FOLDERID_PublicMusic
, /* parent */
2783 Sample_MusicW
, /* relative path */
2786 NULL
, /* localized */
2788 NULL
, /* security */
2789 FILE_ATTRIBUTE_READONLY
, /* attributes */
2790 KFDF_PRECREATE
, /* flags */
2791 &GUID_NULL
/* typeid */
2794 &FOLDERID_SamplePictures
,
2795 CSIDL_Type_AllUsers
,
2797 Pictures_Sample_PicturesW
,
2799 KF_CATEGORY_COMMON
, /* category */
2800 SamplePicturesW
, /* name */
2801 NULL
, /* description */
2802 &FOLDERID_PublicPictures
, /* parent */
2803 Sample_PicturesW
, /* relative path */
2806 NULL
, /* localized */
2808 NULL
, /* security */
2809 FILE_ATTRIBUTE_READONLY
, /* attributes */
2810 KFDF_PRECREATE
, /* flags */
2811 &GUID_NULL
/* typeid */
2814 &FOLDERID_SamplePlaylists
,
2815 CSIDL_Type_AllUsers
,
2817 Music_Sample_PlaylistsW
,
2819 KF_CATEGORY_COMMON
, /* category */
2820 SamplePlaylistsW
, /* name */
2821 NULL
, /* description */
2822 &FOLDERID_PublicMusic
, /* parent */
2823 Sample_PlaylistsW
, /* relative path */
2826 NULL
, /* localized */
2828 NULL
, /* security */
2829 FILE_ATTRIBUTE_READONLY
, /* attributes */
2830 KFDF_PRECREATE
, /* flags */
2831 &GUID_NULL
/* typeid */
2834 &FOLDERID_SampleVideos
,
2835 CSIDL_Type_AllUsers
,
2837 Videos_Sample_VideosW
,
2839 KF_CATEGORY_COMMON
, /* category */
2840 SampleVideosW
, /* name */
2841 NULL
, /* description */
2842 &FOLDERID_PublicVideos
, /* parent */
2843 Sample_VideosW
, /* relative path */
2846 NULL
, /* localized */
2848 NULL
, /* security */
2849 FILE_ATTRIBUTE_READONLY
, /* attributes */
2850 KFDF_PRECREATE
, /* flags */
2851 &GUID_NULL
/* typeid */
2853 { /* 0x62 - CSIDL_SAVED_GAMES */
2854 &FOLDERID_SavedGames
,
2859 KF_CATEGORY_PERUSER
, /* category */
2860 SavedGamesW
, /* name */
2861 NULL
, /* description */
2862 &FOLDERID_Profile
, /* parent */
2863 Saved_GamesW
, /* relative path */
2864 SavedGamesParsingNameW
, /* parsing */
2866 NULL
, /* localized */
2868 NULL
, /* security */
2869 FILE_ATTRIBUTE_READONLY
, /* attributes */
2870 KFDF_ROAMABLE
| KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
, /* flags */
2871 &GUID_NULL
/* typeid */
2873 { /* 0x63 - CSIDL_SEARCHES */
2874 &FOLDERID_SavedSearches
,
2879 KF_CATEGORY_PERUSER
, /* category */
2880 SearchesW
, /* name */
2881 NULL
, /* description */
2882 &FOLDERID_Profile
, /* parent */
2883 SearchesW
, /* relative path */
2884 SavedSearchesParsingNameW
, /* parsing */
2886 NULL
, /* localized */
2888 NULL
, /* security */
2889 FILE_ATTRIBUTE_READONLY
, /* attributes */
2890 KFDF_PRECREATE
| KFDF_PUBLISHEXPANDEDPATH
, /* flags */
2891 &GUID_NULL
/* typeid */
2894 &FOLDERID_SEARCH_CSC
,
2895 CSIDL_Type_Disallowed
,
2899 KF_CATEGORY_VIRTUAL
, /* category */
2900 CSCFolderW
, /* name */
2901 NULL
, /* description */
2902 &GUID_NULL
, /* parent */
2903 NULL
, /* relative path */
2904 SEARCH_CSCParsingNameW
, /* parsing */
2906 NULL
, /* localized */
2908 NULL
, /* security */
2911 &GUID_NULL
/* typeid */
2914 &FOLDERID_SEARCH_MAPI
,
2915 CSIDL_Type_Disallowed
,
2919 KF_CATEGORY_VIRTUAL
, /* category */
2920 MAPIFolderW
, /* name */
2921 NULL
, /* description */
2922 &GUID_NULL
, /* parent */
2923 NULL
, /* relative path */
2924 SEARCH_MAPIParsingNameW
, /* parsing */
2926 NULL
, /* localized */
2928 NULL
, /* security */
2931 &GUID_NULL
/* typeid */
2934 &FOLDERID_SearchHome
,
2935 CSIDL_Type_Disallowed
,
2939 KF_CATEGORY_VIRTUAL
, /* category */
2940 SearchHomeFolderW
, /* name */
2941 NULL
, /* description */
2942 &GUID_NULL
, /* parent */
2943 NULL
, /* relative path */
2944 SearchHomeParsingNameW
, /* parsing */
2946 NULL
, /* localized */
2948 NULL
, /* security */
2951 &GUID_NULL
/* typeid */
2954 &FOLDERID_SidebarDefaultParts
,
2955 CSIDL_Type_Disallowed
, /* FIXME */
2959 KF_CATEGORY_COMMON
, /* category */
2960 Default_GadgetsW
, /* name */
2961 NULL
, /* description */
2962 &FOLDERID_ProgramFiles
, /* parent */
2963 Windows_Sidebar_GadgetsW
, /* relative path */
2966 NULL
, /* localized */
2968 NULL
, /* security */
2971 &GUID_NULL
/* typeid */
2974 &FOLDERID_SidebarParts
,
2975 CSIDL_Type_Disallowed
, /* FIXME */
2979 KF_CATEGORY_PERUSER
, /* category */
2980 GadgetsW
, /* name */
2981 NULL
, /* description */
2982 &FOLDERID_LocalAppData
, /* parent */
2983 Microsoft_Windows_Sidebar_GadgetsW
, /* relative path */
2986 NULL
, /* localized */
2988 NULL
, /* security */
2991 &GUID_NULL
/* typeid */
2994 &FOLDERID_SyncManagerFolder
,
2995 CSIDL_Type_Disallowed
,
2999 KF_CATEGORY_VIRTUAL
, /* category */
3000 SyncCenterFolderW
, /* name */
3001 NULL
, /* description */
3002 &GUID_NULL
, /* parent */
3003 NULL
, /* relative path */
3004 SyncManagerFolderParsingNameW
, /* parsing */
3006 NULL
, /* localized */
3008 NULL
, /* security */
3011 &GUID_NULL
/* typeid */
3014 &FOLDERID_SyncResultsFolder
,
3015 CSIDL_Type_Disallowed
,
3019 KF_CATEGORY_VIRTUAL
, /* category */
3020 SyncResultsFolderW
, /* name */
3021 NULL
, /* description */
3022 &GUID_NULL
, /* parent */
3023 NULL
, /* relative path */
3024 SyncResultsFolderParsingNameW
, /* parsing */
3026 NULL
, /* localized */
3028 NULL
, /* security */
3031 &GUID_NULL
/* typeid */
3034 &FOLDERID_SyncSetupFolder
,
3035 CSIDL_Type_Disallowed
,
3039 KF_CATEGORY_VIRTUAL
, /* category */
3040 SyncSetupFolderW
, /* name */
3041 NULL
, /* description */
3042 &GUID_NULL
, /* parent */
3043 NULL
, /* relative path */
3044 SyncSetupFolderParsingNameW
, /* parsing */
3046 NULL
, /* localized */
3048 NULL
, /* security */
3051 &GUID_NULL
/* typeid */
3054 &FOLDERID_UserPinned
,
3055 CSIDL_Type_Disallowed
, /* FIXME */
3059 KF_CATEGORY_PERUSER
, /* category */
3060 User_PinnedW
, /* name */
3061 NULL
, /* description */
3062 &FOLDERID_QuickLaunch
, /* parent */
3063 User_PinnedW
, /* relative path */
3066 NULL
, /* localized */
3068 NULL
, /* security */
3069 FILE_ATTRIBUTE_HIDDEN
, /* attributes */
3070 KFDF_PRECREATE
, /* flags */
3071 &GUID_NULL
/* typeid */
3074 &FOLDERID_UserProfiles
,
3079 KF_CATEGORY_FIXED
, /* category */
3080 UserProfilesW
, /* name */
3081 NULL
, /* description */
3082 &GUID_NULL
, /* parent */
3083 NULL
, /* relative path */
3086 NULL
, /* localized */
3088 NULL
, /* security */
3089 FILE_ATTRIBUTE_READONLY
, /* attributes */
3090 KFDF_PRECREATE
, /* flags */
3091 &GUID_NULL
/* typeid */
3094 &FOLDERID_UserProgramFiles
,
3095 CSIDL_Type_Disallowed
, /* FIXME */
3099 KF_CATEGORY_PERUSER
, /* category */
3100 UserProgramFilesW
, /* name */
3101 NULL
, /* description */
3102 &FOLDERID_LocalAppData
, /* parent */
3103 ProgramsW
, /* relative path */
3106 NULL
, /* localized */
3108 NULL
, /* security */
3111 &GUID_NULL
/* typeid */
3114 &FOLDERID_UserProgramFilesCommon
,
3115 CSIDL_Type_Disallowed
, /* FIXME */
3119 KF_CATEGORY_PERUSER
, /* category */
3120 UserProgramFilesCommonW
, /* name */
3121 NULL
, /* description */
3122 &FOLDERID_UserProgramFiles
, /* parent */
3123 CommonW
, /* relative path */
3126 NULL
, /* localized */
3128 NULL
, /* security */
3131 &GUID_NULL
/* typeid */
3134 &FOLDERID_UsersFiles
,
3135 CSIDL_Type_Disallowed
,
3139 KF_CATEGORY_VIRTUAL
, /* category */
3140 UsersFilesFolderW
, /* name */
3141 NULL
, /* description */
3142 &GUID_NULL
, /* parent */
3143 NULL
, /* relative path */
3144 UsersFilesParsingNameW
, /* parsing */
3146 NULL
, /* localized */
3148 NULL
, /* security */
3151 &GUID_NULL
/* typeid */
3154 &FOLDERID_UsersLibraries
,
3155 CSIDL_Type_Disallowed
,
3159 KF_CATEGORY_VIRTUAL
, /* category */
3160 UsersLibrariesFolderW
, /* name */
3161 NULL
, /* description */
3162 &GUID_NULL
, /* parent */
3163 NULL
, /* relative path */
3164 UsersLibrariesParsingNameW
, /* parsing */
3166 NULL
, /* localized */
3168 NULL
, /* security */
3171 &GUID_NULL
/* typeid */
3174 &FOLDERID_VideosLibrary
,
3175 CSIDL_Type_Disallowed
, /* FIXME */
3179 KF_CATEGORY_PERUSER
, /* category */
3180 VideosLibraryW
, /* name */
3181 NULL
, /* description */
3182 &GUID_NULL
, /* parent */
3183 Videos_librarymsW
, /* relative path */
3184 VideosLibraryParsingNameW
, /* parsing */
3186 NULL
, /* localized */
3188 NULL
, /* security */
3191 &GUID_NULL
/* typeid */
3195 static HRESULT
_SHExpandEnvironmentStrings(LPCWSTR szSrc
, LPWSTR szDest
);
3197 /* Gets the value named value from the registry key
3198 * rootKey\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
3199 * (or from rootKey\userPrefix\... if userPrefix is not NULL) into path, which
3200 * is assumed to be MAX_PATH WCHARs in length.
3201 * If it exists, expands the value and writes the expanded value to
3202 * rootKey\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
3203 * Returns successful error code if the value was retrieved from the registry,
3204 * and a failure otherwise.
3206 static HRESULT
_SHGetUserShellFolderPath(HKEY rootKey
, LPCWSTR userPrefix
,
3207 LPCWSTR value
, LPWSTR path
)
3210 WCHAR shellFolderPath
[MAX_PATH
], userShellFolderPath
[MAX_PATH
];
3211 LPCWSTR pShellFolderPath
, pUserShellFolderPath
;
3212 DWORD dwType
, dwPathLen
= MAX_PATH
;
3213 HKEY userShellFolderKey
, shellFolderKey
;
3215 TRACE("%p,%s,%s,%p\n",rootKey
, debugstr_w(userPrefix
), debugstr_w(value
),
3220 strcpyW(shellFolderPath
, userPrefix
);
3221 PathAddBackslashW(shellFolderPath
);
3222 strcatW(shellFolderPath
, szSHFolders
);
3223 pShellFolderPath
= shellFolderPath
;
3224 strcpyW(userShellFolderPath
, userPrefix
);
3225 PathAddBackslashW(userShellFolderPath
);
3226 strcatW(userShellFolderPath
, szSHUserFolders
);
3227 pUserShellFolderPath
= userShellFolderPath
;
3231 pUserShellFolderPath
= szSHUserFolders
;
3232 pShellFolderPath
= szSHFolders
;
3235 if (RegCreateKeyW(rootKey
, pShellFolderPath
, &shellFolderKey
))
3237 TRACE("Failed to create %s\n", debugstr_w(pShellFolderPath
));
3240 if (RegCreateKeyW(rootKey
, pUserShellFolderPath
, &userShellFolderKey
))
3242 TRACE("Failed to create %s\n",
3243 debugstr_w(pUserShellFolderPath
));
3244 RegCloseKey(shellFolderKey
);
3248 if (!RegQueryValueExW(userShellFolderKey
, value
, NULL
, &dwType
,
3249 (LPBYTE
)path
, &dwPathLen
) && (dwType
== REG_EXPAND_SZ
|| dwType
== REG_SZ
))
3253 path
[dwPathLen
/ sizeof(WCHAR
)] = '\0';
3254 if (dwType
== REG_EXPAND_SZ
&& path
[0] == '%')
3256 WCHAR szTemp
[MAX_PATH
];
3258 _SHExpandEnvironmentStrings(path
, szTemp
);
3259 lstrcpynW(path
, szTemp
, MAX_PATH
);
3261 ret
= RegSetValueExW(shellFolderKey
, value
, 0, REG_SZ
, (LPBYTE
)path
,
3262 (strlenW(path
) + 1) * sizeof(WCHAR
));
3263 if (ret
!= ERROR_SUCCESS
)
3264 hr
= HRESULT_FROM_WIN32(ret
);
3270 RegCloseKey(shellFolderKey
);
3271 RegCloseKey(userShellFolderKey
);
3272 TRACE("returning 0x%08x\n", hr
);
3276 /* Gets a 'semi-expanded' default value of the CSIDL with index folder into
3277 * pszPath, based on the entries in CSIDL_Data. By semi-expanded, I mean:
3278 * - The entry's szDefaultPath may be either a string value or an integer
3279 * resource identifier. In the latter case, the string value of the resource
3281 * - Depending on the entry's type, the path may begin with an (unexpanded)
3282 * environment variable name. The caller is responsible for expanding
3283 * environment strings if so desired.
3284 * The types that are prepended with environment variables are:
3285 * CSIDL_Type_User: %USERPROFILE%
3286 * CSIDL_Type_AllUsers: %ALLUSERSPROFILE%
3287 * CSIDL_Type_CurrVer: %SystemDrive%
3288 * (Others might make sense too, but as yet are unneeded.)
3290 static HRESULT
_SHGetDefaultValue(BYTE folder
, LPWSTR pszPath
)
3293 WCHAR resourcePath
[MAX_PATH
];
3294 LPCWSTR pDefaultPath
= NULL
;
3296 TRACE("0x%02x,%p\n", folder
, pszPath
);
3298 if (folder
>= sizeof(CSIDL_Data
) / sizeof(CSIDL_Data
[0]))
3299 return E_INVALIDARG
;
3301 return E_INVALIDARG
;
3309 case CSIDL_PROGRAM_FILES
:
3310 case CSIDL_PROGRAM_FILESX86
:
3311 IsWow64Process( GetCurrentProcess(), &is_wow64
);
3312 folder
= is_wow64
? CSIDL_PROGRAM_FILESX86
: CSIDL_PROGRAM_FILES
;
3314 case CSIDL_PROGRAM_FILES_COMMON
:
3315 case CSIDL_PROGRAM_FILES_COMMONX86
:
3316 IsWow64Process( GetCurrentProcess(), &is_wow64
);
3317 folder
= is_wow64
? CSIDL_PROGRAM_FILES_COMMONX86
: CSIDL_PROGRAM_FILES_COMMON
;
3322 if (CSIDL_Data
[folder
].szDefaultPath
&&
3323 IS_INTRESOURCE(CSIDL_Data
[folder
].szDefaultPath
))
3325 if (LoadStringW(shell32_hInstance
,
3326 LOWORD(CSIDL_Data
[folder
].szDefaultPath
), resourcePath
, MAX_PATH
))
3329 pDefaultPath
= resourcePath
;
3333 FIXME("(%d,%s), LoadString failed, missing translation?\n", folder
,
3334 debugstr_w(pszPath
));
3341 pDefaultPath
= CSIDL_Data
[folder
].szDefaultPath
;
3345 switch (CSIDL_Data
[folder
].type
)
3347 case CSIDL_Type_User
:
3348 strcpyW(pszPath
, UserProfileW
);
3350 case CSIDL_Type_AllUsers
:
3351 strcpyW(pszPath
, AllUsersProfileW
);
3353 case CSIDL_Type_CurrVer
:
3354 strcpyW(pszPath
, SystemDriveW
);
3357 ; /* no corresponding env. var, do nothing */
3361 PathAddBackslashW(pszPath
);
3362 strcatW(pszPath
, pDefaultPath
);
3365 TRACE("returning 0x%08x\n", hr
);
3369 /* Gets the (unexpanded) value of the folder with index folder into pszPath.
3370 * The folder's type is assumed to be CSIDL_Type_CurrVer. Its default value
3371 * can be overridden in the HKLM\\szCurrentVersion key.
3372 * If dwFlags has SHGFP_TYPE_DEFAULT set or if the value isn't overridden in
3373 * the registry, uses _SHGetDefaultValue to get the value.
3375 static HRESULT
_SHGetCurrentVersionPath(DWORD dwFlags
, BYTE folder
,
3380 TRACE("0x%08x,0x%02x,%p\n", dwFlags
, folder
, pszPath
);
3382 if (folder
>= sizeof(CSIDL_Data
) / sizeof(CSIDL_Data
[0]))
3383 return E_INVALIDARG
;
3384 if (CSIDL_Data
[folder
].type
!= CSIDL_Type_CurrVer
)
3385 return E_INVALIDARG
;
3387 return E_INVALIDARG
;
3389 if (dwFlags
& SHGFP_TYPE_DEFAULT
)
3390 hr
= _SHGetDefaultValue(folder
, pszPath
);
3395 if (RegCreateKeyW(HKEY_LOCAL_MACHINE
, szCurrentVersion
, &hKey
))
3399 DWORD dwType
, dwPathLen
= MAX_PATH
* sizeof(WCHAR
);
3401 if (RegQueryValueExW(hKey
, CSIDL_Data
[folder
].szValueName
, NULL
,
3402 &dwType
, (LPBYTE
)pszPath
, &dwPathLen
) ||
3403 (dwType
!= REG_SZ
&& dwType
!= REG_EXPAND_SZ
))
3405 hr
= _SHGetDefaultValue(folder
, pszPath
);
3406 dwType
= REG_EXPAND_SZ
;
3409 case CSIDL_PROGRAM_FILESX86
:
3410 case CSIDL_PROGRAM_FILES_COMMONX86
:
3411 /* these two should never be set on 32-bit setups */
3415 IsWow64Process( GetCurrentProcess(), &is_wow64
);
3416 if (!is_wow64
) break;
3420 RegSetValueExW(hKey
, CSIDL_Data
[folder
].szValueName
, 0, dwType
,
3421 (LPBYTE
)pszPath
, (strlenW(pszPath
)+1)*sizeof(WCHAR
));
3426 pszPath
[dwPathLen
/ sizeof(WCHAR
)] = '\0';
3432 TRACE("returning 0x%08x (output path is %s)\n", hr
, debugstr_w(pszPath
));
3436 static LPWSTR
_GetUserSidStringFromToken(HANDLE Token
)
3438 char InfoBuffer
[64];
3439 PTOKEN_USER UserInfo
;
3443 UserInfo
= (PTOKEN_USER
) InfoBuffer
;
3444 if (! GetTokenInformation(Token
, TokenUser
, InfoBuffer
, sizeof(InfoBuffer
),
3447 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER
)
3449 UserInfo
= HeapAlloc(GetProcessHeap(), 0, InfoSize
);
3450 if (UserInfo
== NULL
)
3452 if (! GetTokenInformation(Token
, TokenUser
, UserInfo
, InfoSize
,
3455 HeapFree(GetProcessHeap(), 0, UserInfo
);
3460 if (! ConvertSidToStringSidW(UserInfo
->User
.Sid
, &SidStr
))
3463 if (UserInfo
!= (PTOKEN_USER
) InfoBuffer
)
3464 HeapFree(GetProcessHeap(), 0, UserInfo
);
3469 /* Gets the user's path (unexpanded) for the CSIDL with index folder:
3470 * If SHGFP_TYPE_DEFAULT is set, calls _SHGetDefaultValue for it. Otherwise
3471 * calls _SHGetUserShellFolderPath for it. Where it looks depends on hToken:
3472 * - if hToken is -1, looks in HKEY_USERS\.Default
3473 * - otherwise looks first in HKEY_CURRENT_USER, followed by HKEY_LOCAL_MACHINE
3474 * if HKEY_CURRENT_USER doesn't contain any entries. If both fail, finally
3475 * calls _SHGetDefaultValue for it.
3477 static HRESULT
_SHGetUserProfilePath(HANDLE hToken
, DWORD dwFlags
, BYTE folder
,
3480 const WCHAR
*szValueName
;
3484 TRACE("%p,0x%08x,0x%02x,%p\n", hToken
, dwFlags
, folder
, pszPath
);
3486 if (folder
>= sizeof(CSIDL_Data
) / sizeof(CSIDL_Data
[0]))
3487 return E_INVALIDARG
;
3488 if (CSIDL_Data
[folder
].type
!= CSIDL_Type_User
)
3489 return E_INVALIDARG
;
3491 return E_INVALIDARG
;
3493 if (dwFlags
& SHGFP_TYPE_DEFAULT
)
3495 if (hToken
!= NULL
&& hToken
!= (HANDLE
)-1)
3497 FIXME("unsupported for user other than current or default\n");
3500 hr
= _SHGetDefaultValue(folder
, pszPath
);
3504 LPCWSTR userPrefix
= NULL
;
3507 if (hToken
== (HANDLE
)-1)
3509 hRootKey
= HKEY_USERS
;
3510 userPrefix
= DefaultW
;
3512 else if (hToken
== NULL
)
3513 hRootKey
= HKEY_CURRENT_USER
;
3516 hRootKey
= HKEY_USERS
;
3517 userPrefix
= _GetUserSidStringFromToken(hToken
);
3518 if (userPrefix
== NULL
)
3525 /* For CSIDL_Type_User we also use the GUID if no szValueName is provided */
3526 szValueName
= CSIDL_Data
[folder
].szValueName
;
3529 StringFromGUID2( CSIDL_Data
[folder
].id
, buffer
, 39 );
3530 szValueName
= &buffer
[0];
3533 hr
= _SHGetUserShellFolderPath(hRootKey
, userPrefix
, szValueName
, pszPath
);
3534 if (FAILED(hr
) && hRootKey
!= HKEY_LOCAL_MACHINE
)
3535 hr
= _SHGetUserShellFolderPath(HKEY_LOCAL_MACHINE
, NULL
, szValueName
, pszPath
);
3537 hr
= _SHGetDefaultValue(folder
, pszPath
);
3538 if (userPrefix
!= NULL
&& userPrefix
!= DefaultW
)
3539 LocalFree((HLOCAL
) userPrefix
);
3542 TRACE("returning 0x%08x (output path is %s)\n", hr
, debugstr_w(pszPath
));
3546 /* Gets the (unexpanded) path for the CSIDL with index folder. If dwFlags has
3547 * SHGFP_TYPE_DEFAULT set, calls _SHGetDefaultValue. Otherwise calls
3548 * _SHGetUserShellFolderPath for it, looking only in HKEY_LOCAL_MACHINE.
3549 * If this fails, falls back to _SHGetDefaultValue.
3551 static HRESULT
_SHGetAllUsersProfilePath(DWORD dwFlags
, BYTE folder
,
3556 TRACE("0x%08x,0x%02x,%p\n", dwFlags
, folder
, pszPath
);
3558 if (folder
>= sizeof(CSIDL_Data
) / sizeof(CSIDL_Data
[0]))
3559 return E_INVALIDARG
;
3560 if (CSIDL_Data
[folder
].type
!= CSIDL_Type_AllUsers
)
3561 return E_INVALIDARG
;
3563 return E_INVALIDARG
;
3565 if (dwFlags
& SHGFP_TYPE_DEFAULT
)
3566 hr
= _SHGetDefaultValue(folder
, pszPath
);
3569 hr
= _SHGetUserShellFolderPath(HKEY_LOCAL_MACHINE
, NULL
,
3570 CSIDL_Data
[folder
].szValueName
, pszPath
);
3572 hr
= _SHGetDefaultValue(folder
, pszPath
);
3574 TRACE("returning 0x%08x (output path is %s)\n", hr
, debugstr_w(pszPath
));
3578 static HRESULT
_SHOpenProfilesKey(PHKEY pKey
)
3583 lRet
= RegCreateKeyExW(HKEY_LOCAL_MACHINE
, ProfileListW
, 0, NULL
, 0,
3584 KEY_ALL_ACCESS
, NULL
, pKey
, &disp
);
3585 return HRESULT_FROM_WIN32(lRet
);
3588 /* Reads the value named szValueName from the key profilesKey (assumed to be
3589 * opened by _SHOpenProfilesKey) into szValue, which is assumed to be MAX_PATH
3590 * WCHARs in length. If it doesn't exist, returns szDefault (and saves
3591 * szDefault to the registry).
3593 static HRESULT
_SHGetProfilesValue(HKEY profilesKey
, LPCWSTR szValueName
,
3594 LPWSTR szValue
, LPCWSTR szDefault
)
3597 DWORD type
, dwPathLen
= MAX_PATH
* sizeof(WCHAR
);
3600 TRACE("%p,%s,%p,%s\n", profilesKey
, debugstr_w(szValueName
), szValue
,
3601 debugstr_w(szDefault
));
3602 lRet
= RegQueryValueExW(profilesKey
, szValueName
, NULL
, &type
,
3603 (LPBYTE
)szValue
, &dwPathLen
);
3604 if (!lRet
&& (type
== REG_SZ
|| type
== REG_EXPAND_SZ
) && dwPathLen
3607 dwPathLen
/= sizeof(WCHAR
);
3608 szValue
[dwPathLen
] = '\0';
3613 /* Missing or invalid value, set a default */
3614 lstrcpynW(szValue
, szDefault
, MAX_PATH
);
3615 TRACE("Setting missing value %s to %s\n", debugstr_w(szValueName
),
3616 debugstr_w(szValue
));
3617 lRet
= RegSetValueExW(profilesKey
, szValueName
, 0, REG_EXPAND_SZ
,
3619 (strlenW(szValue
) + 1) * sizeof(WCHAR
));
3621 hr
= HRESULT_FROM_WIN32(lRet
);
3625 TRACE("returning 0x%08x (output value is %s)\n", hr
, debugstr_w(szValue
));
3629 /* Attempts to expand environment variables from szSrc into szDest, which is
3630 * assumed to be MAX_PATH characters in length. Before referring to the
3631 * environment, handles a few variables directly, because the environment
3632 * variables may not be set when this is called (as during Wine's installation
3633 * when default values are being written to the registry).
3634 * The directly handled environment variables, and their source, are:
3635 * - ALLUSERSPROFILE, USERPROFILE: reads from the registry
3636 * - SystemDrive: uses GetSystemDirectoryW and uses the drive portion of its
3638 * If one of the directly handled environment variables is expanded, only
3639 * expands a single variable, and only in the beginning of szSrc.
3641 static HRESULT
_SHExpandEnvironmentStrings(LPCWSTR szSrc
, LPWSTR szDest
)
3644 WCHAR szTemp
[MAX_PATH
], szProfilesPrefix
[MAX_PATH
] = { 0 };
3647 TRACE("%s, %p\n", debugstr_w(szSrc
), szDest
);
3649 if (!szSrc
|| !szDest
) return E_INVALIDARG
;
3651 /* short-circuit if there's nothing to expand */
3652 if (szSrc
[0] != '%')
3654 strcpyW(szDest
, szSrc
);
3658 /* Get the profile prefix, we'll probably be needing it */
3659 hr
= _SHOpenProfilesKey(&key
);
3662 WCHAR def_val
[MAX_PATH
];
3664 /* get the system drive */
3665 GetSystemDirectoryW(def_val
, MAX_PATH
);
3666 if (def_val
[1] == ':') strcpyW( def_val
+ 3, szDefaultProfileDirW
);
3667 else FIXME("non-drive system paths unsupported\n");
3669 hr
= _SHGetProfilesValue(key
, ProfilesDirectoryW
, szProfilesPrefix
, def_val
);
3673 strcpyW(szTemp
, szSrc
);
3674 while (SUCCEEDED(hr
) && szTemp
[0] == '%')
3676 if (!strncmpiW(szTemp
, AllUsersProfileW
, strlenW(AllUsersProfileW
)))
3678 WCHAR szAllUsers
[MAX_PATH
];
3680 strcpyW(szDest
, szProfilesPrefix
);
3681 hr
= _SHGetProfilesValue(key
, AllUsersProfileValueW
,
3682 szAllUsers
, AllUsersW
);
3683 PathAppendW(szDest
, szAllUsers
);
3684 PathAppendW(szDest
, szTemp
+ strlenW(AllUsersProfileW
));
3686 else if (!strncmpiW(szTemp
, UserProfileW
, strlenW(UserProfileW
)))
3688 WCHAR userName
[MAX_PATH
];
3689 DWORD userLen
= MAX_PATH
;
3691 strcpyW(szDest
, szProfilesPrefix
);
3692 GetUserNameW(userName
, &userLen
);
3693 PathAppendW(szDest
, userName
);
3694 PathAppendW(szDest
, szTemp
+ strlenW(UserProfileW
));
3696 else if (!strncmpiW(szTemp
, SystemDriveW
, strlenW(SystemDriveW
)))
3698 GetSystemDirectoryW(szDest
, MAX_PATH
);
3699 if (szDest
[1] != ':')
3701 FIXME("non-drive system paths unsupported\n");
3706 strcpyW(szDest
+ 3, szTemp
+ strlenW(SystemDriveW
) + 1);
3712 DWORD ret
= ExpandEnvironmentStringsW(szSrc
, szDest
, MAX_PATH
);
3715 hr
= E_NOT_SUFFICIENT_BUFFER
;
3717 hr
= HRESULT_FROM_WIN32(GetLastError());
3721 if (SUCCEEDED(hr
) && szDest
[0] == '%')
3722 strcpyW(szTemp
, szDest
);
3725 /* terminate loop */
3732 TRACE("returning 0x%08x (input was %s, output is %s)\n", hr
,
3733 debugstr_w(szSrc
), debugstr_w(szDest
));
3737 /*************************************************************************
3738 * SHGetFolderPathW [SHELL32.@]
3740 * Convert nFolder to path.
3744 * Failure: standard HRESULT error codes.
3747 * Most values can be overridden in either
3748 * HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
3749 * or in the same location in HKLM.
3750 * The "Shell Folders" registry key was used in NT4 and earlier systems.
3751 * Beginning with Windows 2000, the "User Shell Folders" key is used, so
3752 * changes made to it are made to the former key too. This synchronization is
3753 * done on-demand: not until someone requests the value of one of these paths
3754 * (by calling one of the SHGet functions) is the value synchronized.
3755 * Furthermore, the HKCU paths take precedence over the HKLM paths.
3757 HRESULT WINAPI
SHGetFolderPathW(
3758 HWND hwndOwner
, /* [I] owner window */
3759 int nFolder
, /* [I] CSIDL identifying the folder */
3760 HANDLE hToken
, /* [I] access token */
3761 DWORD dwFlags
, /* [I] which path to return */
3762 LPWSTR pszPath
) /* [O] converted path */
3764 HRESULT hr
= SHGetFolderPathAndSubDirW(hwndOwner
, nFolder
, hToken
, dwFlags
, NULL
, pszPath
);
3765 if(HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND
) == hr
)
3766 hr
= HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
);
3770 HRESULT WINAPI
SHGetFolderPathAndSubDirA(
3771 HWND hwndOwner
, /* [I] owner window */
3772 int nFolder
, /* [I] CSIDL identifying the folder */
3773 HANDLE hToken
, /* [I] access token */
3774 DWORD dwFlags
, /* [I] which path to return */
3775 LPCSTR pszSubPath
, /* [I] sub directory of the specified folder */
3776 LPSTR pszPath
) /* [O] converted path */
3780 LPWSTR pszSubPathW
= NULL
;
3781 LPWSTR pszPathW
= NULL
;
3782 TRACE("%08x,%08x,%s\n",nFolder
, dwFlags
, debugstr_w(pszSubPathW
));
3785 pszPathW
= HeapAlloc(GetProcessHeap(), 0, MAX_PATH
* sizeof(WCHAR
));
3787 hr
= HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY
);
3791 TRACE("%08x,%08x,%s\n",nFolder
, dwFlags
, debugstr_w(pszSubPathW
));
3793 /* SHGetFolderPathAndSubDirW does not distinguish if pszSubPath isn't
3794 * set (null), or an empty string.therefore call it without the parameter set
3795 * if pszSubPath is an empty string
3797 if (pszSubPath
&& pszSubPath
[0]) {
3798 length
= MultiByteToWideChar(CP_ACP
, 0, pszSubPath
, -1, NULL
, 0);
3799 pszSubPathW
= HeapAlloc(GetProcessHeap(), 0, length
* sizeof(WCHAR
));
3801 hr
= HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY
);
3804 MultiByteToWideChar(CP_ACP
, 0, pszSubPath
, -1, pszSubPathW
, length
);
3807 hr
= SHGetFolderPathAndSubDirW(hwndOwner
, nFolder
, hToken
, dwFlags
, pszSubPathW
, pszPathW
);
3809 if (SUCCEEDED(hr
) && pszPath
)
3810 WideCharToMultiByte(CP_ACP
, 0, pszPathW
, -1, pszPath
, MAX_PATH
, NULL
, NULL
);
3813 HeapFree(GetProcessHeap(), 0, pszPathW
);
3814 HeapFree(GetProcessHeap(), 0, pszSubPathW
);
3818 /*************************************************************************
3819 * SHGetFolderPathAndSubDirW [SHELL32.@]
3821 HRESULT WINAPI
SHGetFolderPathAndSubDirW(
3822 HWND hwndOwner
, /* [I] owner window */
3823 int nFolder
, /* [I] CSIDL identifying the folder */
3824 HANDLE hToken
, /* [I] access token */
3825 DWORD dwFlags
, /* [I] which path to return */
3826 LPCWSTR pszSubPath
,/* [I] sub directory of the specified folder */
3827 LPWSTR pszPath
) /* [O] converted path */
3830 WCHAR szBuildPath
[MAX_PATH
], szTemp
[MAX_PATH
];
3831 DWORD folder
= nFolder
& CSIDL_FOLDER_MASK
;
3835 TRACE("%p,%p,nFolder=0x%04x,%s\n", hwndOwner
,pszPath
,nFolder
,debugstr_w(pszSubPath
));
3837 /* Windows always NULL-terminates the resulting path regardless of success
3838 * or failure, so do so first
3843 if (folder
>= sizeof(CSIDL_Data
) / sizeof(CSIDL_Data
[0]))
3844 return E_INVALIDARG
;
3845 if ((SHGFP_TYPE_CURRENT
!= dwFlags
) && (SHGFP_TYPE_DEFAULT
!= dwFlags
))
3846 return E_INVALIDARG
;
3848 type
= CSIDL_Data
[folder
].type
;
3851 case CSIDL_Type_Disallowed
:
3854 case CSIDL_Type_NonExistent
:
3857 case CSIDL_Type_WindowsPath
:
3858 GetWindowsDirectoryW(szTemp
, MAX_PATH
);
3859 if (CSIDL_Data
[folder
].szDefaultPath
&&
3860 !IS_INTRESOURCE(CSIDL_Data
[folder
].szDefaultPath
) &&
3861 *CSIDL_Data
[folder
].szDefaultPath
)
3863 PathAddBackslashW(szTemp
);
3864 strcatW(szTemp
, CSIDL_Data
[folder
].szDefaultPath
);
3868 case CSIDL_Type_SystemPath
:
3869 GetSystemDirectoryW(szTemp
, MAX_PATH
);
3870 if (CSIDL_Data
[folder
].szDefaultPath
&&
3871 !IS_INTRESOURCE(CSIDL_Data
[folder
].szDefaultPath
) &&
3872 *CSIDL_Data
[folder
].szDefaultPath
)
3874 PathAddBackslashW(szTemp
);
3875 strcatW(szTemp
, CSIDL_Data
[folder
].szDefaultPath
);
3879 case CSIDL_Type_SystemX86Path
:
3880 if (!GetSystemWow64DirectoryW(szTemp
, MAX_PATH
)) GetSystemDirectoryW(szTemp
, MAX_PATH
);
3881 if (CSIDL_Data
[folder
].szDefaultPath
&&
3882 !IS_INTRESOURCE(CSIDL_Data
[folder
].szDefaultPath
) &&
3883 *CSIDL_Data
[folder
].szDefaultPath
)
3885 PathAddBackslashW(szTemp
);
3886 strcatW(szTemp
, CSIDL_Data
[folder
].szDefaultPath
);
3890 case CSIDL_Type_CurrVer
:
3891 hr
= _SHGetCurrentVersionPath(dwFlags
, folder
, szTemp
);
3893 case CSIDL_Type_User
:
3894 hr
= _SHGetUserProfilePath(hToken
, dwFlags
, folder
, szTemp
);
3896 case CSIDL_Type_AllUsers
:
3897 hr
= _SHGetAllUsersProfilePath(dwFlags
, folder
, szTemp
);
3900 FIXME("bogus type %d, please fix\n", type
);
3905 /* Expand environment strings if necessary */
3907 hr
= _SHExpandEnvironmentStrings(szTemp
, szBuildPath
);
3909 strcpyW(szBuildPath
, szTemp
);
3911 if (FAILED(hr
)) goto end
;
3914 /* make sure the new path does not exceed the buffer length
3915 * and remember to backslash and terminate it */
3916 if(MAX_PATH
< (lstrlenW(szBuildPath
) + lstrlenW(pszSubPath
) + 2)) {
3917 hr
= HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE
);
3920 PathAppendW(szBuildPath
, pszSubPath
);
3921 PathRemoveBackslashW(szBuildPath
);
3923 /* Copy the path if it's available before we might return */
3924 if (SUCCEEDED(hr
) && pszPath
)
3925 strcpyW(pszPath
, szBuildPath
);
3927 /* if we don't care about existing directories we are ready */
3928 if(nFolder
& CSIDL_FLAG_DONT_VERIFY
) goto end
;
3930 if (PathFileExistsW(szBuildPath
)) goto end
;
3932 /* not existing but we are not allowed to create it. The return value
3933 * is verified against shell32 version 6.0.
3935 if (!(nFolder
& CSIDL_FLAG_CREATE
))
3937 hr
= HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND
);
3941 /* create directory/directories */
3942 ret
= SHCreateDirectoryExW(hwndOwner
, szBuildPath
, NULL
);
3943 if (ret
&& ret
!= ERROR_ALREADY_EXISTS
)
3945 ERR("Failed to create directory %s.\n", debugstr_w(szBuildPath
));
3950 TRACE("Created missing system directory %s\n", debugstr_w(szBuildPath
));
3952 TRACE("returning 0x%08x (final path is %s)\n", hr
, debugstr_w(szBuildPath
));
3956 /*************************************************************************
3957 * SHGetFolderPathA [SHELL32.@]
3959 * See SHGetFolderPathW.
3961 HRESULT WINAPI
SHGetFolderPathA(
3968 WCHAR szTemp
[MAX_PATH
];
3971 TRACE("%p,%p,nFolder=0x%04x\n",hwndOwner
,pszPath
,nFolder
);
3975 hr
= SHGetFolderPathW(hwndOwner
, nFolder
, hToken
, dwFlags
, szTemp
);
3976 if (SUCCEEDED(hr
) && pszPath
)
3977 WideCharToMultiByte(CP_ACP
, 0, szTemp
, -1, pszPath
, MAX_PATH
, NULL
,
3983 /* For each folder in folders, if its value has not been set in the registry,
3984 * calls _SHGetUserProfilePath or _SHGetAllUsersProfilePath (depending on the
3985 * folder's type) to get the unexpanded value first.
3986 * Writes the unexpanded value to User Shell Folders, and queries it with
3987 * SHGetFolderPathW to force the creation of the directory if it doesn't
3988 * already exist. SHGetFolderPathW also returns the expanded value, which
3989 * this then writes to Shell Folders.
3991 static HRESULT
_SHRegisterFolders(HKEY hRootKey
, HANDLE hToken
,
3992 LPCWSTR szUserShellFolderPath
, LPCWSTR szShellFolderPath
, const UINT folders
[],
3995 const WCHAR
*szValueName
;
3998 WCHAR path
[MAX_PATH
];
4000 HKEY hUserKey
= NULL
, hKey
= NULL
;
4001 DWORD dwType
, dwPathLen
;
4004 TRACE("%p,%p,%s,%p,%u\n", hRootKey
, hToken
,
4005 debugstr_w(szUserShellFolderPath
), folders
, foldersLen
);
4007 ret
= RegCreateKeyW(hRootKey
, szUserShellFolderPath
, &hUserKey
);
4009 hr
= HRESULT_FROM_WIN32(ret
);
4012 ret
= RegCreateKeyW(hRootKey
, szShellFolderPath
, &hKey
);
4014 hr
= HRESULT_FROM_WIN32(ret
);
4016 for (i
= 0; SUCCEEDED(hr
) && i
< foldersLen
; i
++)
4018 dwPathLen
= MAX_PATH
* sizeof(WCHAR
);
4020 /* For CSIDL_Type_User we also use the GUID if no szValueName is provided */
4021 szValueName
= CSIDL_Data
[folders
[i
]].szValueName
;
4022 if (!szValueName
&& CSIDL_Data
[folders
[i
]].type
== CSIDL_Type_User
)
4024 StringFromGUID2( CSIDL_Data
[folders
[i
]].id
, buffer
, 39 );
4025 szValueName
= &buffer
[0];
4028 if (RegQueryValueExW(hUserKey
, szValueName
, NULL
,
4029 &dwType
, (LPBYTE
)path
, &dwPathLen
) || (dwType
!= REG_SZ
&&
4030 dwType
!= REG_EXPAND_SZ
))
4033 if (CSIDL_Data
[folders
[i
]].type
== CSIDL_Type_User
)
4034 _SHGetUserProfilePath(hToken
, SHGFP_TYPE_DEFAULT
, folders
[i
],
4036 else if (CSIDL_Data
[folders
[i
]].type
== CSIDL_Type_AllUsers
)
4037 _SHGetAllUsersProfilePath(SHGFP_TYPE_DEFAULT
, folders
[i
], path
);
4038 else if (CSIDL_Data
[folders
[i
]].type
== CSIDL_Type_WindowsPath
)
4040 GetWindowsDirectoryW(path
, MAX_PATH
);
4041 if (CSIDL_Data
[folders
[i
]].szDefaultPath
&&
4042 !IS_INTRESOURCE(CSIDL_Data
[folders
[i
]].szDefaultPath
))
4044 PathAddBackslashW(path
);
4045 strcatW(path
, CSIDL_Data
[folders
[i
]].szDefaultPath
);
4052 ret
= RegSetValueExW(hUserKey
, szValueName
, 0, REG_EXPAND_SZ
,
4053 (LPBYTE
)path
, (strlenW(path
) + 1) * sizeof(WCHAR
));
4055 hr
= HRESULT_FROM_WIN32(ret
);
4058 hr
= SHGetFolderPathW(NULL
, folders
[i
] | CSIDL_FLAG_CREATE
,
4059 hToken
, SHGFP_TYPE_DEFAULT
, path
);
4060 ret
= RegSetValueExW(hKey
, szValueName
, 0, REG_SZ
,
4061 (LPBYTE
)path
, (strlenW(path
) + 1) * sizeof(WCHAR
));
4063 hr
= HRESULT_FROM_WIN32(ret
);
4069 RegCloseKey(hUserKey
);
4073 TRACE("returning 0x%08x\n", hr
);
4077 static HRESULT
_SHRegisterUserShellFolders(BOOL bDefault
)
4079 static const UINT folders
[] = {
4090 CSIDL_DESKTOPDIRECTORY
,
4094 CSIDL_LOCAL_APPDATA
,
4095 CSIDL_INTERNET_CACHE
,
4104 CSIDL_APPDATA_LOCALLOW
,
4108 WCHAR userShellFolderPath
[MAX_PATH
], shellFolderPath
[MAX_PATH
];
4109 LPCWSTR pUserShellFolderPath
, pShellFolderPath
;
4114 TRACE("%s\n", bDefault
? "TRUE" : "FALSE");
4117 hToken
= (HANDLE
)-1;
4118 hRootKey
= HKEY_USERS
;
4119 strcpyW(userShellFolderPath
, DefaultW
);
4120 PathAddBackslashW(userShellFolderPath
);
4121 strcatW(userShellFolderPath
, szSHUserFolders
);
4122 pUserShellFolderPath
= userShellFolderPath
;
4123 strcpyW(shellFolderPath
, DefaultW
);
4124 PathAddBackslashW(shellFolderPath
);
4125 strcatW(shellFolderPath
, szSHFolders
);
4126 pShellFolderPath
= shellFolderPath
;
4131 hRootKey
= HKEY_CURRENT_USER
;
4132 pUserShellFolderPath
= szSHUserFolders
;
4133 pShellFolderPath
= szSHFolders
;
4136 hr
= _SHRegisterFolders(hRootKey
, hToken
, pUserShellFolderPath
,
4137 pShellFolderPath
, folders
, sizeof(folders
) / sizeof(folders
[0]));
4138 TRACE("returning 0x%08x\n", hr
);
4142 static HRESULT
_SHRegisterCommonShellFolders(void)
4144 static const UINT folders
[] = {
4145 CSIDL_COMMON_STARTMENU
,
4146 CSIDL_COMMON_PROGRAMS
,
4147 CSIDL_COMMON_STARTUP
,
4148 CSIDL_COMMON_DESKTOPDIRECTORY
,
4149 CSIDL_COMMON_FAVORITES
,
4150 CSIDL_COMMON_APPDATA
,
4151 CSIDL_COMMON_TEMPLATES
,
4152 CSIDL_COMMON_DOCUMENTS
,
4153 CSIDL_COMMON_ADMINTOOLS
,
4155 CSIDL_COMMON_PICTURES
,
4161 hr
= _SHRegisterFolders(HKEY_LOCAL_MACHINE
, NULL
, szSHUserFolders
,
4162 szSHFolders
, folders
, sizeof(folders
) / sizeof(folders
[0]));
4163 TRACE("returning 0x%08x\n", hr
);
4167 /******************************************************************************
4168 * _SHAppendToUnixPath [Internal]
4170 * Helper function for _SHCreateSymbolicLinks. Appends pwszSubPath (or the
4171 * corresponding resource, if IS_INTRESOURCE) to the unix base path 'szBasePath'
4172 * and replaces backslashes with slashes.
4175 * szBasePath [IO] The unix base path, which will be appended to (CP_UNXICP).
4176 * pwszSubPath [I] Sub-path or resource id (use MAKEINTRESOURCEW).
4182 static inline BOOL
_SHAppendToUnixPath(char *szBasePath
, LPCWSTR pwszSubPath
) {
4183 WCHAR wszSubPath
[MAX_PATH
];
4184 int cLen
= strlen(szBasePath
);
4187 if (IS_INTRESOURCE(pwszSubPath
)) {
4188 if (!LoadStringW(shell32_hInstance
, LOWORD(pwszSubPath
), wszSubPath
, MAX_PATH
)) {
4189 /* Fall back to hard coded defaults. */
4190 switch (LOWORD(pwszSubPath
)) {
4192 lstrcpyW(wszSubPath
, DocumentsW
);
4195 lstrcpyW(wszSubPath
, My_MusicW
);
4197 case IDS_MYPICTURES
:
4198 lstrcpyW(wszSubPath
, My_PicturesW
);
4201 lstrcpyW(wszSubPath
, My_VideosW
);
4204 ERR("LoadString(%d) failed!\n", LOWORD(pwszSubPath
));
4209 lstrcpyW(wszSubPath
, pwszSubPath
);
4212 if (szBasePath
[cLen
-1] != '/') szBasePath
[cLen
++] = '/';
4214 if (!WideCharToMultiByte(CP_UNIXCP
, 0, wszSubPath
, -1, szBasePath
+ cLen
,
4215 FILENAME_MAX
- cLen
, NULL
, NULL
))
4220 pBackslash
= szBasePath
+ cLen
;
4221 while ((pBackslash
= strchr(pBackslash
, '\\'))) *pBackslash
= '/';
4226 /******************************************************************************
4227 * _SHCreateSymbolicLinks [Internal]
4229 * Sets up symbol links for various shell folders to point into the users home
4230 * directory. We do an educated guess about what the user would probably want:
4231 * - If there is a 'My Documents' directory in $HOME, the user probably wants
4232 * wine's 'My Documents' to point there. Furthermore, we imply that the user
4233 * is a Windows lover and has no problem with wine creating 'My Pictures',
4234 * 'My Music' and 'My Videos' subfolders under '$HOME/My Documents', if those
4235 * do not already exits. We put appropriate symbolic links in place for those,
4237 * - If there is no 'My Documents' directory in $HOME, we let 'My Documents'
4238 * point directly to $HOME. We assume the user to be a unix hacker who does not
4239 * want wine to create anything anywhere besides the .wine directory. So, if
4240 * there already is a 'My Music' directory in $HOME, we symlink the 'My Music'
4241 * shell folder to it. But if not, then we check XDG_MUSIC_DIR - "well known"
4242 * directory, and try to link to that. If that fails, then we symlink to
4243 * $HOME directly. The same holds fo 'My Pictures' and 'My Videos'.
4244 * - The Desktop shell folder is symlinked to XDG_DESKTOP_DIR. If that does not
4245 * exist, then we try '$HOME/Desktop'. If that does not exist, then we leave
4247 * ('My Music',... above in fact means LoadString(IDS_MYMUSIC))
4249 static void _SHCreateSymbolicLinks(void)
4251 UINT aidsMyStuff
[] = { IDS_MYPICTURES
, IDS_MYVIDEOS
, IDS_MYMUSIC
}, i
;
4252 const WCHAR
* MyOSXStuffW
[] = { PicturesW
, MoviesW
, MusicW
};
4253 int acsidlMyStuff
[] = { CSIDL_MYPICTURES
, CSIDL_MYVIDEO
, CSIDL_MYMUSIC
};
4254 static const char * const xdg_dirs
[] = { "PICTURES", "VIDEOS", "MUSIC", "DOCUMENTS", "DESKTOP" };
4255 static const unsigned int num
= sizeof(xdg_dirs
) / sizeof(xdg_dirs
[0]);
4256 WCHAR wszTempPath
[MAX_PATH
];
4257 char szPersonalTarget
[FILENAME_MAX
], *pszPersonal
;
4258 char szMyStuffTarget
[FILENAME_MAX
], *pszMyStuff
;
4259 char szDesktopTarget
[FILENAME_MAX
], *pszDesktop
;
4260 struct stat statFolder
;
4261 const char *pszHome
;
4263 char ** xdg_results
;
4264 char * xdg_desktop_dir
;
4266 /* Create all necessary profile sub-dirs up to 'My Documents' and get the unix path. */
4267 hr
= SHGetFolderPathW(NULL
, CSIDL_PERSONAL
|CSIDL_FLAG_CREATE
, NULL
,
4268 SHGFP_TYPE_DEFAULT
, wszTempPath
);
4269 if (FAILED(hr
)) return;
4270 pszPersonal
= wine_get_unix_file_name(wszTempPath
);
4271 if (!pszPersonal
) return;
4273 hr
= XDG_UserDirLookup(xdg_dirs
, num
, &xdg_results
);
4274 if (FAILED(hr
)) xdg_results
= NULL
;
4276 pszHome
= getenv("HOME");
4277 if (pszHome
&& !stat(pszHome
, &statFolder
) && S_ISDIR(statFolder
.st_mode
))
4281 /* Check if there's already a Wine-specific 'My Documents' folder */
4282 strcpy(szPersonalTarget
, pszHome
);
4283 if (_SHAppendToUnixPath(szPersonalTarget
, MAKEINTRESOURCEW(IDS_PERSONAL
)) &&
4284 !stat(szPersonalTarget
, &statFolder
) && S_ISDIR(statFolder
.st_mode
))
4286 /* '$HOME/My Documents' exists. Create 'My Pictures',
4287 * 'My Videos' and 'My Music' subfolders or fail silently if
4288 * they already exist.
4290 for (i
= 0; i
< sizeof(aidsMyStuff
)/sizeof(*aidsMyStuff
); i
++)
4292 strcpy(szMyStuffTarget
, szPersonalTarget
);
4293 if (_SHAppendToUnixPath(szMyStuffTarget
, MAKEINTRESOURCEW(aidsMyStuff
[i
])))
4294 mkdir(szMyStuffTarget
, 0777);
4299 /* Try to point to the XDG Documents folder */
4300 if (xdg_results
&& xdg_results
[num
-2] &&
4301 !stat(xdg_results
[num
-2], &statFolder
) &&
4302 S_ISDIR(statFolder
.st_mode
))
4304 strcpy(szPersonalTarget
, xdg_results
[num
-2]);
4308 /* Or the hardcoded / OS X Documents folder */
4309 strcpy(szPersonalTarget
, pszHome
);
4310 if (_SHAppendToUnixPath(szPersonalTarget
, DocumentsW
) &&
4311 !stat(szPersonalTarget
, &statFolder
) &&
4312 S_ISDIR(statFolder
.st_mode
))
4315 /* As a last resort point to $HOME. */
4316 strcpy(szPersonalTarget
, pszHome
);
4320 /* Replace 'My Documents' directory with a symlink or fail silently if not empty. */
4322 symlink(szPersonalTarget
, pszPersonal
);
4326 /* '$HOME' doesn't exist. Create 'My Pictures', 'My Videos' and 'My Music' subdirs
4327 * in '%USERPROFILE%\\My Documents' or fail silently if they already exist. */
4329 strcpy(szPersonalTarget
, pszPersonal
);
4330 for (i
= 0; i
< sizeof(aidsMyStuff
)/sizeof(aidsMyStuff
[0]); i
++) {
4331 strcpy(szMyStuffTarget
, szPersonalTarget
);
4332 if (_SHAppendToUnixPath(szMyStuffTarget
, MAKEINTRESOURCEW(aidsMyStuff
[i
])))
4333 mkdir(szMyStuffTarget
, 0777);
4337 /* Create symbolic links for 'My Pictures', 'My Videos' and 'My Music'. */
4338 for (i
=0; i
< sizeof(aidsMyStuff
)/sizeof(aidsMyStuff
[0]); i
++)
4340 /* Create the current 'My Whatever' folder and get its unix path. */
4341 hr
= SHGetFolderPathW(NULL
, acsidlMyStuff
[i
]|CSIDL_FLAG_CREATE
, NULL
,
4342 SHGFP_TYPE_DEFAULT
, wszTempPath
);
4343 if (FAILED(hr
)) continue;
4345 pszMyStuff
= wine_get_unix_file_name(wszTempPath
);
4346 if (!pszMyStuff
) continue;
4350 /* Check for the Wine-specific '$HOME/My Documents' subfolder */
4351 strcpy(szMyStuffTarget
, szPersonalTarget
);
4352 if (_SHAppendToUnixPath(szMyStuffTarget
, MAKEINTRESOURCEW(aidsMyStuff
[i
])) &&
4353 !stat(szMyStuffTarget
, &statFolder
) && S_ISDIR(statFolder
.st_mode
))
4356 /* Try the XDG_XXX_DIR folder */
4357 if (xdg_results
&& xdg_results
[i
])
4359 strcpy(szMyStuffTarget
, xdg_results
[i
]);
4363 /* Or the OS X folder (these are never localized) */
4366 strcpy(szMyStuffTarget
, pszHome
);
4367 if (_SHAppendToUnixPath(szMyStuffTarget
, MyOSXStuffW
[i
]) &&
4368 !stat(szMyStuffTarget
, &statFolder
) &&
4369 S_ISDIR(statFolder
.st_mode
))
4373 /* As a last resort point to the same location as 'My Documents' */
4374 strcpy(szMyStuffTarget
, szPersonalTarget
);
4378 symlink(szMyStuffTarget
, pszMyStuff
);
4379 HeapFree(GetProcessHeap(), 0, pszMyStuff
);
4382 /* Last but not least, the Desktop folder */
4384 strcpy(szDesktopTarget
, pszHome
);
4386 strcpy(szDesktopTarget
, pszPersonal
);
4387 HeapFree(GetProcessHeap(), 0, pszPersonal
);
4389 xdg_desktop_dir
= xdg_results
? xdg_results
[num
- 1] : NULL
;
4390 if (xdg_desktop_dir
||
4391 (_SHAppendToUnixPath(szDesktopTarget
, DesktopW
) &&
4392 !stat(szDesktopTarget
, &statFolder
) && S_ISDIR(statFolder
.st_mode
)))
4394 hr
= SHGetFolderPathW(NULL
, CSIDL_DESKTOPDIRECTORY
|CSIDL_FLAG_CREATE
, NULL
,
4395 SHGFP_TYPE_DEFAULT
, wszTempPath
);
4396 if (SUCCEEDED(hr
) && (pszDesktop
= wine_get_unix_file_name(wszTempPath
)))
4399 if (xdg_desktop_dir
)
4400 symlink(xdg_desktop_dir
, pszDesktop
);
4402 symlink(szDesktopTarget
, pszDesktop
);
4403 HeapFree(GetProcessHeap(), 0, pszDesktop
);
4407 /* Free resources allocated by XDG_UserDirLookup() */
4410 for (i
= 0; i
< num
; i
++)
4411 HeapFree(GetProcessHeap(), 0, xdg_results
[i
]);
4412 HeapFree(GetProcessHeap(), 0, xdg_results
);
4416 /******************************************************************************
4417 * create_extra_folders [Internal]
4419 * Create some extra folders that don't have a standard CSIDL definition.
4421 static HRESULT
create_extra_folders(void)
4423 static const WCHAR environW
[] = {'E','n','v','i','r','o','n','m','e','n','t',0};
4424 static const WCHAR microsoftW
[] = {'M','i','c','r','o','s','o','f','t',0};
4425 static const WCHAR TempW
[] = {'T','e','m','p',0};
4426 static const WCHAR TEMPW
[] = {'T','E','M','P',0};
4427 static const WCHAR TMPW
[] = {'T','M','P',0};
4428 WCHAR path
[MAX_PATH
+5];
4431 DWORD type
, size
, ret
;
4433 ret
= RegCreateKeyW( HKEY_CURRENT_USER
, environW
, &hkey
);
4434 if (ret
) return HRESULT_FROM_WIN32( ret
);
4436 /* FIXME: should be under AppData, but we don't want spaces in the temp path */
4437 hr
= SHGetFolderPathAndSubDirW( 0, CSIDL_PROFILE
| CSIDL_FLAG_CREATE
, NULL
,
4438 SHGFP_TYPE_DEFAULT
, TempW
, path
);
4441 size
= sizeof(path
);
4442 if (RegQueryValueExW( hkey
, TEMPW
, NULL
, &type
, (LPBYTE
)path
, &size
))
4443 RegSetValueExW( hkey
, TEMPW
, 0, REG_SZ
, (LPBYTE
)path
, (strlenW(path
) + 1) * sizeof(WCHAR
) );
4444 size
= sizeof(path
);
4445 if (RegQueryValueExW( hkey
, TMPW
, NULL
, &type
, (LPBYTE
)path
, &size
))
4446 RegSetValueExW( hkey
, TMPW
, 0, REG_SZ
, (LPBYTE
)path
, (strlenW(path
) + 1) * sizeof(WCHAR
) );
4448 RegCloseKey( hkey
);
4452 hr
= SHGetFolderPathAndSubDirW( 0, CSIDL_COMMON_APPDATA
| CSIDL_FLAG_CREATE
, NULL
,
4453 SHGFP_TYPE_DEFAULT
, microsoftW
, path
);
4459 /******************************************************************************
4460 * set_folder_attributes
4462 * Set the various folder attributes registry keys.
4464 static HRESULT
set_folder_attributes(void)
4466 static const WCHAR clsidW
[] = {'C','L','S','I','D','\\',0 };
4467 static const WCHAR shellfolderW
[] = {'\\','S','h','e','l','l','F','o','l','d','e','r', 0 };
4468 static const WCHAR wfparsingW
[] = {'W','a','n','t','s','F','O','R','P','A','R','S','I','N','G',0};
4469 static const WCHAR wfdisplayW
[] = {'W','a','n','t','s','F','O','R','D','I','S','P','L','A','Y',0};
4470 static const WCHAR hideasdeleteW
[] = {'H','i','d','e','A','s','D','e','l','e','t','e','P','e','r','U','s','e','r',0};
4471 static const WCHAR cfattributesW
[] = {'C','a','l','l','F','o','r','A','t','t','r','i','b','u','t','e','s',0};
4472 static const WCHAR emptyW
[] = {0};
4481 DWORD call_for_attr
;
4484 { &CLSID_UnixFolder
, TRUE
, FALSE
, FALSE
},
4485 { &CLSID_UnixDosFolder
, TRUE
, FALSE
, FALSE
,
4486 SFGAO_FILESYSANCESTOR
|SFGAO_FOLDER
|SFGAO_HASSUBFOLDER
, SFGAO_FILESYSTEM
},
4487 { &CLSID_FolderShortcut
, FALSE
, FALSE
, FALSE
,
4488 SFGAO_FILESYSTEM
|SFGAO_FOLDER
|SFGAO_LINK
,
4489 SFGAO_HASSUBFOLDER
|SFGAO_FILESYSTEM
|SFGAO_FOLDER
|SFGAO_FILESYSANCESTOR
},
4490 { &CLSID_MyDocuments
, TRUE
, FALSE
, FALSE
,
4491 SFGAO_FILESYSANCESTOR
|SFGAO_FOLDER
|SFGAO_HASSUBFOLDER
, SFGAO_FILESYSTEM
},
4492 { &CLSID_RecycleBin
, FALSE
, FALSE
, FALSE
,
4493 SFGAO_FOLDER
|SFGAO_DROPTARGET
|SFGAO_HASPROPSHEET
},
4494 { &CLSID_ControlPanel
, FALSE
, TRUE
, TRUE
,
4495 SFGAO_FOLDER
|SFGAO_HASSUBFOLDER
}
4499 WCHAR buffer
[39 + (sizeof(clsidW
) + sizeof(shellfolderW
)) / sizeof(WCHAR
)];
4503 for (i
= 0; i
< sizeof(folders
)/sizeof(folders
[0]); i
++)
4505 strcpyW( buffer
, clsidW
);
4506 StringFromGUID2( folders
[i
].clsid
, buffer
+ strlenW(buffer
), 39 );
4507 strcatW( buffer
, shellfolderW
);
4508 res
= RegCreateKeyExW( HKEY_CLASSES_ROOT
, buffer
, 0, NULL
, 0,
4509 KEY_READ
| KEY_WRITE
, NULL
, &hkey
, NULL
);
4510 if (res
) return HRESULT_FROM_WIN32( res
);
4511 if (folders
[i
].wfparsing
)
4512 res
= RegSetValueExW( hkey
, wfparsingW
, 0, REG_SZ
, (const BYTE
*)emptyW
, sizeof(emptyW
) );
4513 if (folders
[i
].wfdisplay
)
4514 res
= RegSetValueExW( hkey
, wfdisplayW
, 0, REG_SZ
, (const BYTE
*)emptyW
, sizeof(emptyW
) );
4515 if (folders
[i
].hideasdel
)
4516 res
= RegSetValueExW( hkey
, hideasdeleteW
, 0, REG_SZ
, (const BYTE
*)emptyW
, sizeof(emptyW
) );
4517 if (folders
[i
].attr
)
4518 res
= RegSetValueExW( hkey
, szAttributes
, 0, REG_DWORD
,
4519 (const BYTE
*)&folders
[i
].attr
, sizeof(DWORD
));
4520 if (folders
[i
].call_for_attr
)
4521 res
= RegSetValueExW( hkey
, cfattributesW
, 0, REG_DWORD
,
4522 (const BYTE
*)&folders
[i
].call_for_attr
, sizeof(DWORD
));
4523 RegCloseKey( hkey
);
4528 /*************************************************************************
4529 * SHGetSpecialFolderPathA [SHELL32.@]
4531 BOOL WINAPI
SHGetSpecialFolderPathA (
4537 return SHGetFolderPathA(hwndOwner
, nFolder
+ (bCreate
? CSIDL_FLAG_CREATE
: 0), NULL
, 0,
4541 /*************************************************************************
4542 * SHGetSpecialFolderPathW
4544 BOOL WINAPI
SHGetSpecialFolderPathW (
4550 return SHGetFolderPathW(hwndOwner
, nFolder
+ (bCreate
? CSIDL_FLAG_CREATE
: 0), NULL
, 0,
4554 /*************************************************************************
4555 * SHGetSpecialFolderPath (SHELL32.175)
4557 BOOL WINAPI
SHGetSpecialFolderPathAW (
4564 if (SHELL_OsIsUnicode())
4565 return SHGetSpecialFolderPathW (hwndOwner
, szPath
, nFolder
, bCreate
);
4566 return SHGetSpecialFolderPathA (hwndOwner
, szPath
, nFolder
, bCreate
);
4569 /*************************************************************************
4570 * SHGetFolderLocation [SHELL32.@]
4572 * Gets the folder locations from the registry and creates a pidl.
4576 * nFolder [I] CSIDL_xxxxx
4577 * hToken [I] token representing user, or NULL for current user, or -1 for
4579 * dwReserved [I] must be zero
4580 * ppidl [O] PIDL of a special folder
4584 * Failure: Standard OLE-defined error result, S_FALSE or E_INVALIDARG
4587 * Creates missing reg keys and directories.
4588 * Mostly forwards to SHGetFolderPathW, but a few values of nFolder return
4589 * virtual folders that are handled here.
4591 HRESULT WINAPI
SHGetFolderLocation(
4596 LPITEMIDLIST
*ppidl
)
4598 HRESULT hr
= E_INVALIDARG
;
4600 TRACE("%p 0x%08x %p 0x%08x %p\n",
4601 hwndOwner
, nFolder
, hToken
, dwReserved
, ppidl
);
4604 return E_INVALIDARG
;
4606 return E_INVALIDARG
;
4608 /* The virtual folders' locations are not user-dependent */
4610 switch (nFolder
& CSIDL_FOLDER_MASK
)
4613 *ppidl
= _ILCreateDesktop();
4616 case CSIDL_PERSONAL
:
4617 *ppidl
= _ILCreateMyDocuments();
4620 case CSIDL_INTERNET
:
4621 *ppidl
= _ILCreateIExplore();
4624 case CSIDL_CONTROLS
:
4625 *ppidl
= _ILCreateControlPanel();
4628 case CSIDL_PRINTERS
:
4629 *ppidl
= _ILCreatePrinters();
4632 case CSIDL_BITBUCKET
:
4633 *ppidl
= _ILCreateBitBucket();
4637 *ppidl
= _ILCreateMyComputer();
4641 *ppidl
= _ILCreateNetwork();
4646 WCHAR szPath
[MAX_PATH
];
4648 hr
= SHGetFolderPathW(hwndOwner
, nFolder
, hToken
,
4649 SHGFP_TYPE_CURRENT
, szPath
);
4654 TRACE("Value=%s\n", debugstr_w(szPath
));
4655 hr
= SHILCreateFromPathW(szPath
, ppidl
, &attributes
);
4657 else if (hr
== HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
))
4659 /* unlike SHGetFolderPath, SHGetFolderLocation in shell32
4660 * version 6.0 returns E_FAIL for nonexistent paths
4669 TRACE("-- (new pidl %p)\n",*ppidl
);
4673 /*************************************************************************
4674 * SHGetSpecialFolderLocation [SHELL32.@]
4677 * In NT5, SHGetSpecialFolderLocation needs the <winntdir>/Recent
4680 HRESULT WINAPI
SHGetSpecialFolderLocation(
4683 LPITEMIDLIST
* ppidl
)
4685 HRESULT hr
= E_INVALIDARG
;
4687 TRACE("(%p,0x%x,%p)\n", hwndOwner
,nFolder
,ppidl
);
4690 return E_INVALIDARG
;
4692 hr
= SHGetFolderLocation(hwndOwner
, nFolder
, NULL
, 0, ppidl
);
4696 static int csidl_from_id( const KNOWNFOLDERID
*id
)
4699 for (i
= 0; i
< sizeof(CSIDL_Data
) / sizeof(CSIDL_Data
[0]); i
++)
4700 if (IsEqualGUID( CSIDL_Data
[i
].id
, id
)) return i
;
4704 /*************************************************************************
4705 * SHGetKnownFolderPath [SHELL32.@]
4707 HRESULT WINAPI
SHGetKnownFolderPath(REFKNOWNFOLDERID rfid
, DWORD flags
, HANDLE token
, PWSTR
*path
)
4710 WCHAR folder
[MAX_PATH
];
4711 int index
= csidl_from_id( rfid
);
4713 TRACE("%s, 0x%08x, %p, %p\n", debugstr_guid(rfid
), flags
, token
, path
);
4718 return HRESULT_FROM_WIN32( ERROR_FILE_NOT_FOUND
);
4720 if (flags
& KF_FLAG_CREATE
)
4721 index
|= CSIDL_FLAG_CREATE
;
4723 if (flags
& KF_FLAG_DONT_VERIFY
)
4724 index
|= CSIDL_FLAG_DONT_VERIFY
;
4726 if (flags
& KF_FLAG_NO_ALIAS
)
4727 index
|= CSIDL_FLAG_NO_ALIAS
;
4729 if (flags
& KF_FLAG_INIT
)
4730 index
|= CSIDL_FLAG_PER_USER_INIT
;
4732 if (flags
& ~(KF_FLAG_CREATE
|KF_FLAG_DONT_VERIFY
|KF_FLAG_NO_ALIAS
|KF_FLAG_INIT
))
4734 FIXME("flags 0x%08x not supported\n", flags
);
4735 return E_INVALIDARG
;
4738 hr
= SHGetFolderPathW( NULL
, index
, token
, 0, folder
);
4741 *path
= CoTaskMemAlloc( (strlenW( folder
) + 1) * sizeof(WCHAR
) );
4743 return E_OUTOFMEMORY
;
4744 strcpyW( *path
, folder
);
4749 /*************************************************************************
4750 * SHGetFolderPathEx [SHELL32.@]
4752 HRESULT WINAPI
SHGetFolderPathEx(REFKNOWNFOLDERID rfid
, DWORD flags
, HANDLE token
, LPWSTR path
, DWORD len
)
4757 TRACE("%s, 0x%08x, %p, %p, %u\n", debugstr_guid(rfid
), flags
, token
, path
, len
);
4759 if (!path
|| !len
) return E_INVALIDARG
;
4761 hr
= SHGetKnownFolderPath( rfid
, flags
, token
, &buffer
);
4762 if (SUCCEEDED( hr
))
4764 if (strlenW( buffer
) + 1 > len
)
4766 CoTaskMemFree( buffer
);
4767 return HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER
);
4769 strcpyW( path
, buffer
);
4770 CoTaskMemFree( buffer
);
4776 * Internal function to convert known folder identifier to path of registry key
4777 * associated with known folder.
4780 * rfid [I] pointer to known folder identifier (may be NULL)
4781 * lpStringGuid [I] string with known folder identifier (used when rfid is NULL)
4782 * lpPath [O] place to store string address. String should be
4783 * later freed using HeapFree(GetProcessHeap(),0, ... )
4785 static HRESULT
get_known_folder_registry_path(
4786 REFKNOWNFOLDERID rfid
,
4787 LPWSTR lpStringGuid
,
4790 static const WCHAR sBackslash
[] = {'\\',0};
4795 TRACE("(%s, %s, %p)\n", debugstr_guid(rfid
), debugstr_w(lpStringGuid
), lpPath
);
4798 StringFromGUID2(rfid
, sGuid
, sizeof(sGuid
)/sizeof(sGuid
[0]));
4800 lstrcpyW(sGuid
, lpStringGuid
);
4802 length
= lstrlenW(szKnownFolderDescriptions
)+51;
4803 *lpPath
= HeapAlloc(GetProcessHeap(), 0, length
*sizeof(WCHAR
));
4809 lstrcpyW(*lpPath
, szKnownFolderDescriptions
);
4810 lstrcatW(*lpPath
, sBackslash
);
4811 lstrcatW(*lpPath
, sGuid
);
4817 static HRESULT
get_known_folder_wstr(const WCHAR
*regpath
, const WCHAR
*value
, WCHAR
**out
)
4823 hr
= HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE
, regpath
, value
, RRF_RT_REG_SZ
, NULL
, NULL
, &size
));
4827 *out
= CoTaskMemAlloc(size
);
4829 return E_OUTOFMEMORY
;
4831 hr
= HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE
, regpath
, value
, RRF_RT_REG_SZ
, NULL
, *out
, &size
));
4833 CoTaskMemFree(*out
);
4840 static HRESULT
get_known_folder_dword(const WCHAR
*registryPath
, const WCHAR
*value
, DWORD
*out
)
4842 DWORD dwSize
= sizeof(DWORD
);
4844 return HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE
, registryPath
, value
, RRF_RT_DWORD
, &dwType
, out
, &dwSize
));
4848 * Internal function to get place where folder redirection information are stored.
4851 * rfid [I] pointer to known folder identifier (may be NULL)
4852 * rootKey [O] root key where the redirection information are stored
4853 * It can be HKLM for COMMON folders, and HKCU for PERUSER folders.
4854 * However, besides root key, path is always that same, and is stored
4855 * as "szKnownFolderRedirections" constant
4857 static HRESULT
get_known_folder_redirection_place(
4858 REFKNOWNFOLDERID rfid
,
4862 LPWSTR lpRegistryPath
= NULL
;
4863 KF_CATEGORY category
;
4865 /* first, get known folder's category */
4866 hr
= get_known_folder_registry_path(rfid
, NULL
, &lpRegistryPath
);
4869 hr
= get_known_folder_dword(lpRegistryPath
, szCategory
, &category
);
4873 if(category
== KF_CATEGORY_COMMON
)
4875 *rootKey
= HKEY_LOCAL_MACHINE
;
4878 else if(category
== KF_CATEGORY_PERUSER
)
4880 *rootKey
= HKEY_CURRENT_USER
;
4887 HeapFree(GetProcessHeap(), 0, lpRegistryPath
);
4891 static HRESULT
get_known_folder_path_by_id(REFKNOWNFOLDERID folderId
, LPWSTR lpRegistryPath
, DWORD dwFlags
, LPWSTR
*ppszPath
);
4893 static HRESULT
redirect_known_folder(
4894 REFKNOWNFOLDERID rfid
,
4896 KF_REDIRECT_FLAGS flags
,
4897 LPCWSTR pszTargetPath
,
4899 KNOWNFOLDERID
const *pExclusion
,
4903 HKEY rootKey
= HKEY_LOCAL_MACHINE
, hKey
;
4905 LPWSTR lpRegistryPath
= NULL
, lpSrcPath
= NULL
;
4906 TRACE("(%s, %p, 0x%08x, %s, %d, %p, %p)\n", debugstr_guid(rfid
), hwnd
, flags
, debugstr_w(pszTargetPath
), cFolders
, pExclusion
, ppszError
);
4908 if (ppszError
) *ppszError
= NULL
;
4910 hr
= get_known_folder_registry_path(rfid
, NULL
, &lpRegistryPath
);
4913 hr
= get_known_folder_path_by_id(rfid
, lpRegistryPath
, 0, &lpSrcPath
);
4915 HeapFree(GetProcessHeap(), 0, lpRegistryPath
);
4917 /* get path to redirection storage */
4919 hr
= get_known_folder_redirection_place(rfid
, &rootKey
);
4921 /* write redirection information */
4923 hr
= HRESULT_FROM_WIN32(RegCreateKeyExW(rootKey
, szKnownFolderRedirections
, 0, NULL
, 0, KEY_WRITE
, NULL
, &hKey
, NULL
));
4927 StringFromGUID2(rfid
, sGuid
, sizeof(sGuid
)/sizeof(sGuid
[0]));
4929 hr
= HRESULT_FROM_WIN32(RegSetValueExW(hKey
, sGuid
, 0, REG_SZ
, (LPBYTE
)pszTargetPath
, (lstrlenW(pszTargetPath
)+1)*sizeof(WCHAR
)));
4934 /* make sure destination path exists */
4935 SHCreateDirectory(NULL
, pszTargetPath
);
4937 /* copy content if required */
4938 if(SUCCEEDED(hr
) && (flags
& KF_REDIRECT_COPY_CONTENTS
) )
4940 static const WCHAR sWildcard
[] = {'\\','*',0};
4941 WCHAR srcPath
[MAX_PATH
+1], dstPath
[MAX_PATH
+1];
4942 SHFILEOPSTRUCTW fileOp
;
4944 ZeroMemory(srcPath
, sizeof(srcPath
));
4945 lstrcpyW(srcPath
, lpSrcPath
);
4946 lstrcatW(srcPath
, sWildcard
);
4948 ZeroMemory(dstPath
, sizeof(dstPath
));
4949 lstrcpyW(dstPath
, pszTargetPath
);
4951 ZeroMemory(&fileOp
, sizeof(fileOp
));
4953 if(flags
& KF_REDIRECT_DEL_SOURCE_CONTENTS
)
4954 fileOp
.wFunc
= FO_MOVE
;
4956 fileOp
.wFunc
= FO_COPY
;
4958 fileOp
.pFrom
= srcPath
;
4959 fileOp
.pTo
= dstPath
;
4960 fileOp
.fFlags
= FOF_NO_UI
;
4962 hr
= (SHFileOperationW(&fileOp
)==0 ? S_OK
: E_FAIL
);
4964 if(flags
& KF_REDIRECT_DEL_SOURCE_CONTENTS
)
4966 ZeroMemory(srcPath
, sizeof(srcPath
));
4967 lstrcpyW(srcPath
, lpSrcPath
);
4969 ZeroMemory(&fileOp
, sizeof(fileOp
));
4970 fileOp
.wFunc
= FO_DELETE
;
4971 fileOp
.pFrom
= srcPath
;
4972 fileOp
.fFlags
= FOF_NO_UI
;
4974 hr
= (SHFileOperationW(&fileOp
)==0 ? S_OK
: E_FAIL
);
4978 CoTaskMemFree(lpSrcPath
);
4986 IKnownFolder IKnownFolder_iface
;
4989 LPWSTR registryPath
;
4992 static inline struct knownfolder
*impl_from_IKnownFolder( IKnownFolder
*iface
)
4994 return CONTAINING_RECORD( iface
, struct knownfolder
, IKnownFolder_iface
);
4997 static ULONG WINAPI
knownfolder_AddRef(
4998 IKnownFolder
*iface
)
5000 struct knownfolder
*knownfolder
= impl_from_IKnownFolder( iface
);
5001 return InterlockedIncrement( &knownfolder
->refs
);
5004 static ULONG WINAPI
knownfolder_Release(
5005 IKnownFolder
*iface
)
5007 struct knownfolder
*knownfolder
= impl_from_IKnownFolder( iface
);
5008 LONG refs
= InterlockedDecrement( &knownfolder
->refs
);
5011 TRACE("destroying %p\n", knownfolder
);
5012 HeapFree( GetProcessHeap(), 0, knownfolder
->registryPath
);
5013 HeapFree( GetProcessHeap(), 0, knownfolder
);
5018 static HRESULT WINAPI
knownfolder_QueryInterface(
5019 IKnownFolder
*iface
,
5023 struct knownfolder
*This
= impl_from_IKnownFolder( iface
);
5025 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppv
);
5028 if ( IsEqualGUID( riid
, &IID_IKnownFolder
) ||
5029 IsEqualGUID( riid
, &IID_IUnknown
) )
5033 else if ( IsEqualGUID( riid
, &IID_IMarshal
) )
5035 TRACE("IID_IMarshal returning NULL.\n");
5036 return E_NOINTERFACE
;
5040 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
5041 return E_NOINTERFACE
;
5043 IKnownFolder_AddRef( iface
);
5047 static HRESULT
knownfolder_set_id(
5048 struct knownfolder
*knownfolder
,
5049 const KNOWNFOLDERID
*kfid
)
5054 TRACE("%s\n", debugstr_guid(kfid
));
5056 knownfolder
->id
= *kfid
;
5058 /* check is it registry-registered folder */
5059 hr
= get_known_folder_registry_path(kfid
, NULL
, &knownfolder
->registryPath
);
5061 hr
= HRESULT_FROM_WIN32(RegOpenKeyExW(HKEY_LOCAL_MACHINE
, knownfolder
->registryPath
, 0, 0, &hKey
));
5070 /* This known folder is not registered. To mark it, we set registryPath to NULL */
5071 HeapFree(GetProcessHeap(), 0, knownfolder
->registryPath
);
5072 knownfolder
->registryPath
= NULL
;
5079 static HRESULT WINAPI
knownfolder_GetId(
5080 IKnownFolder
*iface
,
5081 KNOWNFOLDERID
*pkfid
)
5083 struct knownfolder
*knownfolder
= impl_from_IKnownFolder( iface
);
5085 TRACE("%p\n", pkfid
);
5087 *pkfid
= knownfolder
->id
;
5091 static HRESULT WINAPI
knownfolder_GetCategory(
5092 IKnownFolder
*iface
,
5093 KF_CATEGORY
*pCategory
)
5095 struct knownfolder
*knownfolder
= impl_from_IKnownFolder(iface
);
5098 TRACE("%p, %p\n", knownfolder
, pCategory
);
5100 /* we cannot get a category for a folder which is not registered */
5101 if(!knownfolder
->registryPath
)
5105 hr
= get_known_folder_dword(knownfolder
->registryPath
, szCategory
, pCategory
);
5110 static HRESULT WINAPI
knownfolder_GetShellItem(
5111 IKnownFolder
*iface
,
5116 struct knownfolder
*knownfolder
= impl_from_IKnownFolder(iface
);
5117 TRACE("(%p, 0x%08x, %s, %p)\n", knownfolder
, flags
, debugstr_guid(riid
), ppv
);
5118 return SHGetKnownFolderItem(&knownfolder
->id
, flags
, NULL
, riid
, ppv
);
5121 static HRESULT
get_known_folder_path(
5123 LPWSTR registryPath
,
5126 static const WCHAR sBackslash
[] = {'\\',0};
5128 DWORD dwSize
, dwType
;
5129 WCHAR path
[MAX_PATH
] = {0};
5130 WCHAR parentGuid
[39];
5131 KF_CATEGORY category
;
5132 LPWSTR parentRegistryPath
, parentPath
;
5133 HKEY hRedirectionRootKey
= NULL
;
5135 TRACE("(%s, %p)\n", debugstr_w(registryPath
), ppszPath
);
5138 /* check if folder has parent */
5139 dwSize
= sizeof(parentGuid
);
5140 hr
= HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE
, registryPath
, szParentFolder
, RRF_RT_REG_SZ
, &dwType
, parentGuid
, &dwSize
));
5141 if(hr
== HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
)) hr
= S_FALSE
;
5145 /* get parent's known folder path (recursive) */
5146 hr
= get_known_folder_registry_path(NULL
, parentGuid
, &parentRegistryPath
);
5147 if(FAILED(hr
)) return hr
;
5149 hr
= get_known_folder_path(parentGuid
, parentRegistryPath
, &parentPath
);
5151 HeapFree(GetProcessHeap(), 0, parentRegistryPath
);
5155 lstrcatW(path
, parentPath
);
5156 lstrcatW(path
, sBackslash
);
5158 HeapFree(GetProcessHeap(), 0, parentRegistryPath
);
5159 HeapFree(GetProcessHeap(), 0, parentPath
);
5162 /* check, if folder was redirected */
5164 hr
= get_known_folder_dword(registryPath
, szCategory
, &category
);
5168 if(category
== KF_CATEGORY_COMMON
)
5169 hRedirectionRootKey
= HKEY_LOCAL_MACHINE
;
5170 else if(category
== KF_CATEGORY_PERUSER
)
5171 hRedirectionRootKey
= HKEY_CURRENT_USER
;
5173 if(hRedirectionRootKey
)
5175 hr
= HRESULT_FROM_WIN32(RegGetValueW(hRedirectionRootKey
, szKnownFolderRedirections
, sFolderId
, RRF_RT_REG_SZ
, NULL
, NULL
, &dwSize
));
5179 *ppszPath
= CoTaskMemAlloc(dwSize
+(lstrlenW(path
)+1)*sizeof(WCHAR
));
5180 if(!*ppszPath
) hr
= E_OUTOFMEMORY
;
5185 lstrcpyW(*ppszPath
, path
);
5186 hr
= HRESULT_FROM_WIN32(RegGetValueW(hRedirectionRootKey
, szKnownFolderRedirections
, sFolderId
, RRF_RT_REG_SZ
, NULL
, *ppszPath
+ lstrlenW(path
), &dwSize
));
5192 /* no redirection, use previous way - read the relative path from folder definition */
5193 hr
= HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE
, registryPath
, szRelativePath
, RRF_RT_REG_SZ
, &dwType
, NULL
, &dwSize
));
5197 *ppszPath
= CoTaskMemAlloc(dwSize
+(lstrlenW(path
)+1)*sizeof(WCHAR
));
5198 if(!*ppszPath
) hr
= E_OUTOFMEMORY
;
5203 lstrcpyW(*ppszPath
, path
);
5204 hr
= HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE
, registryPath
, szRelativePath
, RRF_RT_REG_SZ
, &dwType
, *ppszPath
+ lstrlenW(path
), &dwSize
));
5209 TRACE("returning path: %s\n", debugstr_w(*ppszPath
));
5213 static HRESULT
get_known_folder_path_by_id(
5214 REFKNOWNFOLDERID folderId
,
5215 LPWSTR lpRegistryPath
,
5219 HRESULT hr
= E_FAIL
;
5223 TRACE("(%s, %s, 0x%08x, %p)\n", debugstr_guid(folderId
), debugstr_w(lpRegistryPath
), dwFlags
, ppszPath
);
5225 /* if this is registry-registered known folder, get path from registry */
5228 StringFromGUID2(folderId
, sGuid
, sizeof(sGuid
)/sizeof(sGuid
[0]));
5230 hr
= get_known_folder_path(sGuid
, lpRegistryPath
, ppszPath
);
5232 /* in other case, use older way */
5235 hr
= SHGetKnownFolderPath( folderId
, dwFlags
, NULL
, ppszPath
);
5237 if (FAILED(hr
)) return hr
;
5239 /* check if known folder really exists */
5240 dwAttributes
= GetFileAttributesW(*ppszPath
);
5241 if(dwAttributes
== INVALID_FILE_ATTRIBUTES
|| !(dwAttributes
& FILE_ATTRIBUTE_DIRECTORY
) )
5243 TRACE("directory %s not found\n", debugstr_w(*ppszPath
));
5244 CoTaskMemFree(*ppszPath
);
5246 hr
= HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
);
5252 static HRESULT WINAPI
knownfolder_GetPath(
5253 IKnownFolder
*iface
,
5257 struct knownfolder
*knownfolder
= impl_from_IKnownFolder( iface
);
5258 TRACE("(%p, 0x%08x, %p)\n", knownfolder
, dwFlags
, ppszPath
);
5260 return get_known_folder_path_by_id(&knownfolder
->id
, knownfolder
->registryPath
, dwFlags
, ppszPath
);
5263 static HRESULT WINAPI
knownfolder_SetPath(
5264 IKnownFolder
*iface
,
5268 struct knownfolder
*knownfolder
= impl_from_IKnownFolder( iface
);
5271 TRACE("(%p, 0x%08x, %s)\n", knownfolder
, dwFlags
, debugstr_w(pszPath
));
5273 /* check if the known folder is registered */
5274 if(!knownfolder
->registryPath
)
5278 hr
= redirect_known_folder(&knownfolder
->id
, NULL
, 0, pszPath
, 0, NULL
, NULL
);
5283 static HRESULT WINAPI
knownfolder_GetIDList(
5284 IKnownFolder
*iface
,
5286 PIDLIST_ABSOLUTE
*ppidl
)
5288 struct knownfolder
*knownfolder
= impl_from_IKnownFolder( iface
);
5289 TRACE("(%p, 0x%08x, %p)\n", knownfolder
, flags
, ppidl
);
5290 return SHGetKnownFolderIDList(&knownfolder
->id
, flags
, NULL
, ppidl
);
5293 static HRESULT WINAPI
knownfolder_GetFolderType(
5294 IKnownFolder
*iface
,
5295 FOLDERTYPEID
*pftid
)
5297 FIXME("%p\n", pftid
);
5301 static HRESULT WINAPI
knownfolder_GetRedirectionCapabilities(
5302 IKnownFolder
*iface
,
5303 KF_REDIRECTION_CAPABILITIES
*pCapabilities
)
5305 FIXME("%p\n", pCapabilities
);
5309 static HRESULT WINAPI
knownfolder_GetFolderDefinition(
5310 IKnownFolder
*iface
,
5311 KNOWNFOLDER_DEFINITION
*pKFD
)
5313 struct knownfolder
*knownfolder
= impl_from_IKnownFolder( iface
);
5316 WCHAR parentGuid
[39];
5317 TRACE("(%p, %p)\n", knownfolder
, pKFD
);
5319 if(!pKFD
) return E_INVALIDARG
;
5321 ZeroMemory(pKFD
, sizeof(*pKFD
));
5323 /* required fields */
5324 hr
= get_known_folder_dword(knownfolder
->registryPath
, szCategory
, &pKFD
->category
);
5328 hr
= get_known_folder_wstr(knownfolder
->registryPath
, szName
, &pKFD
->pszName
);
5332 /* optional fields */
5333 dwSize
= sizeof(parentGuid
);
5334 hr
= HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE
, knownfolder
->registryPath
, szParentFolder
,
5335 RRF_RT_REG_SZ
, NULL
, parentGuid
, &dwSize
));
5338 hr
= IIDFromString(parentGuid
, &pKFD
->fidParent
);
5343 get_known_folder_dword(knownfolder
->registryPath
, szAttributes
, &pKFD
->dwAttributes
);
5345 get_known_folder_wstr(knownfolder
->registryPath
, szRelativePath
, &pKFD
->pszRelativePath
);
5347 get_known_folder_wstr(knownfolder
->registryPath
, szParsingName
, &pKFD
->pszParsingName
);
5352 static const struct IKnownFolderVtbl knownfolder_vtbl
=
5354 knownfolder_QueryInterface
,
5356 knownfolder_Release
,
5358 knownfolder_GetCategory
,
5359 knownfolder_GetShellItem
,
5360 knownfolder_GetPath
,
5361 knownfolder_SetPath
,
5362 knownfolder_GetIDList
,
5363 knownfolder_GetFolderType
,
5364 knownfolder_GetRedirectionCapabilities
,
5365 knownfolder_GetFolderDefinition
5368 static HRESULT
knownfolder_create( struct knownfolder
**knownfolder
)
5370 struct knownfolder
*kf
;
5372 kf
= HeapAlloc( GetProcessHeap(), 0, sizeof(*kf
) );
5373 if (!kf
) return E_OUTOFMEMORY
;
5375 kf
->IKnownFolder_iface
.lpVtbl
= &knownfolder_vtbl
;
5377 memset( &kf
->id
, 0, sizeof(kf
->id
) );
5378 kf
->registryPath
= NULL
;
5382 TRACE("returning iface %p\n", &kf
->IKnownFolder_iface
);
5386 struct foldermanager
5388 IKnownFolderManager IKnownFolderManager_iface
;
5394 static inline struct foldermanager
*impl_from_IKnownFolderManager( IKnownFolderManager
*iface
)
5396 return CONTAINING_RECORD( iface
, struct foldermanager
, IKnownFolderManager_iface
);
5399 static ULONG WINAPI
foldermanager_AddRef(
5400 IKnownFolderManager
*iface
)
5402 struct foldermanager
*foldermanager
= impl_from_IKnownFolderManager( iface
);
5403 return InterlockedIncrement( &foldermanager
->refs
);
5406 static ULONG WINAPI
foldermanager_Release(
5407 IKnownFolderManager
*iface
)
5409 struct foldermanager
*foldermanager
= impl_from_IKnownFolderManager( iface
);
5410 LONG refs
= InterlockedDecrement( &foldermanager
->refs
);
5413 TRACE("destroying %p\n", foldermanager
);
5414 HeapFree( GetProcessHeap(), 0, foldermanager
->ids
);
5415 HeapFree( GetProcessHeap(), 0, foldermanager
);
5420 static HRESULT WINAPI
foldermanager_QueryInterface(
5421 IKnownFolderManager
*iface
,
5425 struct foldermanager
*This
= impl_from_IKnownFolderManager( iface
);
5427 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppv
);
5430 if ( IsEqualGUID( riid
, &IID_IKnownFolderManager
) ||
5431 IsEqualGUID( riid
, &IID_IUnknown
) )
5435 else if ( IsEqualGUID( riid
, &IID_IMarshal
) )
5437 TRACE("IID_IMarshal returning NULL.\n");
5438 return E_NOINTERFACE
;
5442 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
5443 return E_NOINTERFACE
;
5445 IKnownFolderManager_AddRef( iface
);
5449 static HRESULT WINAPI
foldermanager_FolderIdFromCsidl(
5450 IKnownFolderManager
*iface
,
5452 KNOWNFOLDERID
*pfid
)
5454 TRACE("%d, %p\n", nCsidl
, pfid
);
5456 if (nCsidl
>= sizeof(CSIDL_Data
) / sizeof(CSIDL_Data
[0]))
5457 return E_INVALIDARG
;
5458 *pfid
= *CSIDL_Data
[nCsidl
].id
;
5462 static HRESULT WINAPI
foldermanager_FolderIdToCsidl(
5463 IKnownFolderManager
*iface
,
5464 REFKNOWNFOLDERID rfid
,
5469 TRACE("%s, %p\n", debugstr_guid(rfid
), pnCsidl
);
5471 csidl
= csidl_from_id( rfid
);
5472 if (csidl
== -1) return E_INVALIDARG
;
5477 static HRESULT WINAPI
foldermanager_GetFolderIds(
5478 IKnownFolderManager
*iface
,
5479 KNOWNFOLDERID
**ppKFId
,
5482 struct foldermanager
*fm
= impl_from_IKnownFolderManager( iface
);
5484 TRACE("%p, %p\n", ppKFId
, pCount
);
5486 *ppKFId
= CoTaskMemAlloc(fm
->num_ids
* sizeof(KNOWNFOLDERID
));
5487 memcpy(*ppKFId
, fm
->ids
, fm
->num_ids
* sizeof(KNOWNFOLDERID
));
5488 *pCount
= fm
->num_ids
;
5492 static BOOL
is_knownfolder( struct foldermanager
*fm
, const KNOWNFOLDERID
*id
)
5496 LPWSTR registryPath
= NULL
;
5499 /* TODO: move all entries from "CSIDL_Data" static array to registry known folder descriptions */
5500 for (i
= 0; i
< fm
->num_ids
; i
++)
5501 if (IsEqualGUID( &fm
->ids
[i
], id
)) return TRUE
;
5503 hr
= get_known_folder_registry_path(id
, NULL
, ®istryPath
);
5506 hr
= HRESULT_FROM_WIN32(RegOpenKeyExW(HKEY_LOCAL_MACHINE
, registryPath
, 0, 0, &hKey
));
5507 HeapFree(GetProcessHeap(), 0, registryPath
);
5519 static HRESULT WINAPI
foldermanager_GetFolder(
5520 IKnownFolderManager
*iface
,
5521 REFKNOWNFOLDERID rfid
,
5522 IKnownFolder
**ppkf
)
5524 struct foldermanager
*fm
= impl_from_IKnownFolderManager( iface
);
5525 struct knownfolder
*kf
;
5528 TRACE("%s, %p\n", debugstr_guid(rfid
), ppkf
);
5530 if (!is_knownfolder( fm
, rfid
))
5532 WARN("unknown folder\n");
5533 return E_INVALIDARG
;
5535 hr
= knownfolder_create( &kf
);
5536 if (SUCCEEDED( hr
))
5538 hr
= knownfolder_set_id( kf
, rfid
);
5539 *ppkf
= &kf
->IKnownFolder_iface
;
5547 static HRESULT WINAPI
foldermanager_GetFolderByName(
5548 IKnownFolderManager
*iface
,
5549 LPCWSTR pszCanonicalName
,
5550 IKnownFolder
**ppkf
)
5552 FIXME("%s, %p\n", debugstr_w(pszCanonicalName
), ppkf
);
5556 static HRESULT
register_folder(const KNOWNFOLDERID
*rfid
, const KNOWNFOLDER_DEFINITION
*pKFD
)
5561 LPWSTR registryPath
= NULL
;
5563 hr
= get_known_folder_registry_path(rfid
, NULL
, ®istryPath
);
5564 TRACE("registry path: %s\n", debugstr_w(registryPath
));
5567 hr
= HRESULT_FROM_WIN32(RegCreateKeyExW(HKEY_LOCAL_MACHINE
, registryPath
, 0, NULL
, 0, KEY_WRITE
, 0, &hKey
, &dwDisp
));
5572 hr
= HRESULT_FROM_WIN32(RegSetValueExW(hKey
, szCategory
, 0, REG_DWORD
, (LPBYTE
)&pKFD
->category
, sizeof(pKFD
->category
)));
5574 if(SUCCEEDED(hr
) && pKFD
->dwAttributes
!= 0)
5575 hr
= HRESULT_FROM_WIN32(RegSetValueExW(hKey
, szAttributes
, 0, REG_DWORD
, (LPBYTE
)&pKFD
->dwAttributes
, sizeof(pKFD
->dwAttributes
)));
5578 hr
= HRESULT_FROM_WIN32(RegSetValueExW(hKey
, szName
, 0, REG_SZ
, (LPBYTE
)pKFD
->pszName
, (lstrlenW(pKFD
->pszName
)+1)*sizeof(WCHAR
) ));
5580 if(SUCCEEDED(hr
) && pKFD
->pszParsingName
)
5581 hr
= HRESULT_FROM_WIN32(RegSetValueExW(hKey
, szParsingName
, 0, REG_SZ
, (LPBYTE
)pKFD
->pszParsingName
, (lstrlenW(pKFD
->pszParsingName
)+1)*sizeof(WCHAR
) ));
5583 if(SUCCEEDED(hr
) && !IsEqualGUID(&pKFD
->fidParent
, &GUID_NULL
))
5585 WCHAR sParentGuid
[39];
5586 StringFromGUID2(&pKFD
->fidParent
, sParentGuid
, sizeof(sParentGuid
)/sizeof(sParentGuid
[0]));
5588 /* this known folder has parent folder */
5589 hr
= HRESULT_FROM_WIN32(RegSetValueExW(hKey
, szParentFolder
, 0, REG_SZ
, (LPBYTE
)sParentGuid
, sizeof(sParentGuid
)));
5592 if(SUCCEEDED(hr
) && pKFD
->category
!= KF_CATEGORY_VIRTUAL
&& pKFD
->pszRelativePath
)
5595 hr
= HRESULT_FROM_WIN32(RegSetValueExW(hKey
, szRelativePath
, 0, REG_SZ
, (LPBYTE
)pKFD
->pszRelativePath
, (lstrlenW(pKFD
->pszRelativePath
)+1)*sizeof(WCHAR
) ));
5601 SHDeleteKeyW(HKEY_LOCAL_MACHINE
, registryPath
);
5604 HeapFree(GetProcessHeap(), 0, registryPath
);
5608 static HRESULT WINAPI
foldermanager_RegisterFolder(
5609 IKnownFolderManager
*iface
,
5610 REFKNOWNFOLDERID rfid
,
5611 KNOWNFOLDER_DEFINITION
const *pKFD
)
5613 TRACE("(%p, %s, %p)\n", iface
, debugstr_guid(rfid
), pKFD
);
5614 return register_folder(rfid
, pKFD
);
5617 static HRESULT WINAPI
foldermanager_UnregisterFolder(
5618 IKnownFolderManager
*iface
,
5619 REFKNOWNFOLDERID rfid
)
5622 LPWSTR registryPath
= NULL
;
5623 TRACE("(%p, %s)\n", iface
, debugstr_guid(rfid
));
5625 hr
= get_known_folder_registry_path(rfid
, NULL
, ®istryPath
);
5628 hr
= HRESULT_FROM_WIN32(SHDeleteKeyW(HKEY_LOCAL_MACHINE
, registryPath
));
5630 HeapFree(GetProcessHeap(), 0, registryPath
);
5634 static HRESULT WINAPI
foldermanager_FindFolderFromPath(
5635 IKnownFolderManager
*iface
,
5638 IKnownFolder
**ppkf
)
5640 FIXME("%s, 0x%08x, %p\n", debugstr_w(pszPath
), mode
, ppkf
);
5644 static HRESULT WINAPI
foldermanager_FindFolderFromIDList(
5645 IKnownFolderManager
*iface
,
5646 PCIDLIST_ABSOLUTE pidl
,
5647 IKnownFolder
**ppkf
)
5649 FIXME("%p, %p\n", pidl
, ppkf
);
5653 static HRESULT WINAPI
foldermanager_Redirect(
5654 IKnownFolderManager
*iface
,
5655 REFKNOWNFOLDERID rfid
,
5657 KF_REDIRECT_FLAGS flags
,
5658 LPCWSTR pszTargetPath
,
5660 KNOWNFOLDERID
const *pExclusion
,
5663 return redirect_known_folder(rfid
, hwnd
, flags
, pszTargetPath
, cFolders
, pExclusion
, ppszError
);
5666 static const struct IKnownFolderManagerVtbl foldermanager_vtbl
=
5668 foldermanager_QueryInterface
,
5669 foldermanager_AddRef
,
5670 foldermanager_Release
,
5671 foldermanager_FolderIdFromCsidl
,
5672 foldermanager_FolderIdToCsidl
,
5673 foldermanager_GetFolderIds
,
5674 foldermanager_GetFolder
,
5675 foldermanager_GetFolderByName
,
5676 foldermanager_RegisterFolder
,
5677 foldermanager_UnregisterFolder
,
5678 foldermanager_FindFolderFromPath
,
5679 foldermanager_FindFolderFromIDList
,
5680 foldermanager_Redirect
5683 static HRESULT
foldermanager_create( void **ppv
)
5686 struct foldermanager
*fm
;
5688 fm
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fm
) );
5689 if (!fm
) return E_OUTOFMEMORY
;
5691 fm
->IKnownFolderManager_iface
.lpVtbl
= &foldermanager_vtbl
;
5695 for (i
= 0; i
< sizeof(CSIDL_Data
) / sizeof(CSIDL_Data
[0]); i
++)
5697 if (!IsEqualGUID( CSIDL_Data
[i
].id
, &GUID_NULL
)) fm
->num_ids
++;
5699 fm
->ids
= HeapAlloc( GetProcessHeap(), 0, fm
->num_ids
* sizeof(KNOWNFOLDERID
) );
5702 HeapFree( GetProcessHeap(), 0, fm
);
5703 return E_OUTOFMEMORY
;
5705 for (i
= j
= 0; i
< sizeof(CSIDL_Data
) / sizeof(CSIDL_Data
[0]); i
++)
5707 if (!IsEqualGUID( CSIDL_Data
[i
].id
, &GUID_NULL
))
5709 fm
->ids
[j
] = *CSIDL_Data
[i
].id
;
5713 TRACE("found %u known folders\n", fm
->num_ids
);
5714 *ppv
= &fm
->IKnownFolderManager_iface
;
5716 TRACE("returning iface %p\n", *ppv
);
5720 HRESULT WINAPI
KnownFolderManager_Constructor( IUnknown
*punk
, REFIID riid
, void **ppv
)
5722 TRACE("%p, %s, %p\n", punk
, debugstr_guid(riid
), ppv
);
5727 return CLASS_E_NOAGGREGATION
;
5729 return foldermanager_create( ppv
);
5732 HRESULT WINAPI
SHGetKnownFolderIDList(REFKNOWNFOLDERID rfid
, DWORD flags
, HANDLE token
, PIDLIST_ABSOLUTE
*pidl
)
5734 TRACE("%s, 0x%08x, %p, %p\n", debugstr_guid(rfid
), flags
, token
, pidl
);
5737 return E_INVALIDARG
;
5740 FIXME("unsupported flags: 0x%08x\n", flags
);
5743 FIXME("user token is not used.\n");
5746 if (IsEqualIID(rfid
, &FOLDERID_Desktop
))
5747 *pidl
= _ILCreateDesktop();
5748 else if (IsEqualIID(rfid
, &FOLDERID_RecycleBinFolder
))
5749 *pidl
= _ILCreateBitBucket();
5750 else if (IsEqualIID(rfid
, &FOLDERID_ComputerFolder
))
5751 *pidl
= _ILCreateMyComputer();
5752 else if (IsEqualIID(rfid
, &FOLDERID_PrintersFolder
))
5753 *pidl
= _ILCreatePrinters();
5754 else if (IsEqualIID(rfid
, &FOLDERID_ControlPanelFolder
))
5755 *pidl
= _ILCreateControlPanel();
5756 else if (IsEqualIID(rfid
, &FOLDERID_NetworkFolder
))
5757 *pidl
= _ILCreateNetwork();
5758 else if (IsEqualIID(rfid
, &FOLDERID_Documents
))
5759 *pidl
= _ILCreateMyDocuments();
5762 DWORD attributes
= 0;
5766 hr
= SHGetKnownFolderPath(rfid
, flags
, token
, &pathW
);
5770 hr
= SHILCreateFromPathW(pathW
, pidl
, &attributes
);
5771 CoTaskMemFree(pathW
);
5775 return *pidl
? S_OK
: E_FAIL
;
5778 HRESULT WINAPI
SHGetKnownFolderItem(REFKNOWNFOLDERID rfid
, KNOWN_FOLDER_FLAG flags
, HANDLE hToken
,
5779 REFIID riid
, void **ppv
)
5781 PIDLIST_ABSOLUTE pidl
;
5784 TRACE("%s, 0x%08x, %p, %s, %p\n", debugstr_guid(rfid
), flags
, hToken
, debugstr_guid(riid
), ppv
);
5786 hr
= SHGetKnownFolderIDList(rfid
, flags
, hToken
, &pidl
);
5793 hr
= SHCreateItemFromIDList(pidl
, riid
, ppv
);
5794 CoTaskMemFree(pidl
);
5798 static void register_system_knownfolders(void)
5801 for(i
= 0; i
< sizeof(CSIDL_Data
) / sizeof(CSIDL_Data
[0]); ++i
){
5802 const CSIDL_DATA
*folder
= &CSIDL_Data
[i
];
5803 if(folder
->pszName
){
5804 KNOWNFOLDER_DEFINITION kfd
;
5806 /* register_folder won't modify kfd, so cast away const instead of
5808 kfd
.category
= folder
->category
;
5809 kfd
.pszName
= (WCHAR
*)folder
->pszName
;
5810 kfd
.pszDescription
= (WCHAR
*)folder
->pszDescription
;
5811 memcpy(&kfd
.fidParent
, folder
->fidParent
, sizeof(KNOWNFOLDERID
));
5812 kfd
.pszRelativePath
= (WCHAR
*)folder
->pszRelativePath
;
5813 kfd
.pszParsingName
= (WCHAR
*)folder
->pszParsingName
;
5814 kfd
.pszTooltip
= (WCHAR
*)folder
->pszTooltip
;
5815 kfd
.pszLocalizedName
= (WCHAR
*)folder
->pszLocalizedName
;
5816 kfd
.pszIcon
= (WCHAR
*)folder
->pszIcon
;
5817 kfd
.pszSecurity
= (WCHAR
*)folder
->pszSecurity
;
5818 kfd
.dwAttributes
= folder
->dwAttributes
;
5819 kfd
.kfdFlags
= folder
->kfdFlags
;
5820 memcpy(&kfd
.ftidType
, folder
->ftidType
, sizeof(FOLDERTYPEID
));
5822 register_folder(folder
->id
, &kfd
);
5827 HRESULT
SHELL_RegisterShellFolders(void)
5831 /* Set up '$HOME' targeted symlinks for 'My Documents', 'My Pictures',
5832 * 'My Videos', 'My Music' and 'Desktop' in advance, so that the
5833 * _SHRegister*ShellFolders() functions will find everything nice and clean
5834 * and thus will not attempt to create them in the profile directory. */
5835 _SHCreateSymbolicLinks();
5837 hr
= _SHRegisterUserShellFolders(TRUE
);
5839 hr
= _SHRegisterUserShellFolders(FALSE
);
5841 hr
= _SHRegisterCommonShellFolders();
5843 hr
= create_extra_folders();
5845 hr
= set_folder_attributes();
5847 register_system_knownfolders();