ReactOS 0.4.17-dev-1190-g4c812f4
shellpath.c
Go to the documentation of this file.
1/*
2 * Path Functions
3 *
4 * Copyright 1998, 1999, 2000 Juergen Schmied
5 * Copyright 2004 Juan Lang
6 * Copyright 2018-2022 Katayama Hirofumi MZ
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 *
22 * NOTES:
23 *
24 * Many of these functions are in SHLWAPI.DLL also
25 *
26 */
27
28#ifdef __REACTOS__
29#define WIN32_NO_STATUS
30#define _INC_WINDOWS
31#define COBJMACROS
32
33#undef _WIN32_WINNT
34#define _WIN32_WINNT _WIN32_WINNT_WS03
35
36#include <wine/config.h>
37
38#include <windef.h>
39#include <winbase.h>
40#include <shlobj.h>
41#include <undocshell.h>
42#include <shlwapi.h>
43#include <sddl.h>
44#include <strsafe.h>
45#include <wine/debug.h>
46#include <wine/unicode.h>
47#include <assert.h>
48
49#include <shlwapi_undoc.h>
50#include <shellutils.h>
51
52#include <userenv.h>
53
54#include "pidl.h"
55#include "shell32_main.h"
56#include "shresdef.h"
57
58#else
59#define COBJMACROS
60
61#include <stdio.h>
62#include <stdarg.h>
63#include <string.h>
64#include <ctype.h>
65
66#include "windef.h"
67#include "winbase.h"
68#include "winternl.h"
69#include "winnls.h"
70#include "winreg.h"
71#include "wingdi.h"
72#include "winuser.h"
73#include "winioctl.h"
74#define WINE_MOUNTMGR_EXTENSIONS
75#include "ddk/mountmgr.h"
76
77#include "shlobj.h"
78#include "shtypes.h"
79#include "shresdef.h"
80#include "shell32_main.h"
81#include "pidl.h"
82#include "shlwapi.h"
83#include "sddl.h"
84#include "knownfolders.h"
85#include "initguid.h"
86#include "shobjidl.h"
87#include "wine/debug.h"
88#endif
89
91
92static const BOOL is_win64 = sizeof(void *) > sizeof(int);
93
94#ifdef __REACTOS__
95BOOL APIENTRY IsRemovableDrive(DWORD iDrive)
96{
97 WCHAR szRoot[] = L"C:\\";
98 assert(L'A' + iDrive <= L'Z');
99 szRoot[0] = (WCHAR)(L'A' + iDrive);
100 return GetDriveTypeW(szRoot) == DRIVE_REMOVABLE;
101}
102
103/*
104 ########## Combining and Constructing paths ##########
105*/
106
107static BOOL WINAPI
108PathSearchOnExtensionsW(
109 _Inout_ LPWSTR pszPath,
110 _In_opt_ LPCWSTR *ppszDirs,
111 _In_ BOOL bDoSearch,
112 _In_ DWORD dwWhich)
113{
114 if (*PathFindExtensionW(pszPath) != 0)
115 return FALSE;
116
117 if (bDoSearch)
118 return PathFindOnPathExW(pszPath, ppszDirs, dwWhich);
119 else
120 return PathFileExistsDefExtW(pszPath, dwWhich);
121}
122
123#if (_WIN32_WINNT >= _WIN32_WINNT_WS03)
124static BOOL WINAPI PathIsAbsoluteW(_In_ LPCWSTR path)
125{
126 return PathIsUNCW(path) || (PathGetDriveNumberW(path) != -1 && path[2] == L'\\');
127}
128
129static BOOL WINAPI PathMakeAbsoluteW(_Inout_ LPWSTR path)
130{
132 DWORD cch;
133
134 if (path == NULL)
135 return FALSE;
137 if (!cch || cch > _countof(path1))
138 return FALSE;
139 return (PathCombineW(path, path1, path) != NULL);
140}
141#endif
142
144
145static VOID WINAPI
146PathQualifyExW(_Inout_ LPWSTR pszPath, _Inout_opt_ LPCWSTR pszDir, _In_ DWORD dwFlags)
147{
148 INT iDrive, cchPathLeft;
149 WCHAR szTemp[MAX_PATH], szRoot[MAX_PATH];
150 PWCHAR pchTemp = szTemp, pchPath;
151 BOOL bLFN;
152
153 TRACE("(%s,%s,0x%08x)\n", debugstr_w(pszPath), debugstr_w(pszDir), dwFlags);
154
155 /* Save pszPath path into szTemp for rebuilding the path later */
156 if (FAILED(StringCchCopyW(szTemp, _countof(szTemp), pszPath)))
157 return;
158
159 /* Replace every '/' by '\' */
160 FixSlashesAndColonW(szTemp);
161
162 cchPathLeft = MAX_PATH;
163
164 /* Build the root-like path on pszPath, and set pchTemp */
165 if (!PathIsUNCW(szTemp))
166 {
167 /*
168 * Non-UNC path.
169 * Determine and normalize the root drive.
170 */
171 iDrive = PathGetDriveNumberW(szTemp);
172 if (iDrive == -1)
173 {
174 /*
175 * No drive was specified in the path. Try to find one from the
176 * optional directory (if this fails, fall back to the one of the
177 * Windows directory).
178 */
179 if (!pszDir || FAILED(StringCchCopyW(szRoot, _countof(szRoot), pszDir)))
180 {
181 /* pszDir was invalid or NULL. Fall back to the
182 * Windows directory and find its root. */
183 szRoot[0] = UNICODE_NULL;
184 GetWindowsDirectoryW(szRoot, _countof(szRoot));
185 iDrive = PathGetDriveNumberW(szRoot);
186 if (iDrive != -1)
187 PathBuildRootW(szRoot, iDrive);
188 }
189
190 if (szTemp[0] == L'\\')
191 {
192 PathStripToRootW(szRoot);
193 }
194 }
195 else
196 {
197 /*
198 * A drive is specified in the path, that can be either of the
199 * form 'C:\xxx' or of the form 'C:xxx' (relative path). Isolate
200 * the root part 'C:' and the rest of the path 'xxx' in pchTemp.
201 */
202 PathBuildRootW(szRoot, iDrive);
203 pchTemp += 2;
204 if (*pchTemp == L'\\')
205 ++pchTemp;
206 }
207
208 bLFN = IsLFNDriveW(szRoot);
209 if (!bLFN)
210 {
211 PWCHAR pch;
212 for (pch = pchTemp; *pch != UNICODE_NULL; ++pch)
213 {
214#define VALID_SHORT_PATH_CHAR_CLASSES ( \
215 PATH_CHAR_CLASS_DOT | \
216 PATH_CHAR_CLASS_BACKSLASH | \
217 PATH_CHAR_CLASS_COLON | \
218 PATH_CHAR_CLASS_OTHER_VALID \
219)
220 if (!PathIsValidCharW(*pch, VALID_SHORT_PATH_CHAR_CLASSES))
221 {
222 *pch = L'_';
223 }
224 }
225 }
226
227 StringCchCopyW(pszPath, MAX_PATH, szRoot);
228 cchPathLeft -= lstrlenW(pszPath) + 1;
229 }
230 else /* UNC path: Begins with double backslash */
231 {
232 bLFN = IsLFNDriveW(pchTemp);
233 if (bLFN)
234 {
235 pszPath[2] = UNICODE_NULL; /* Cut off */
236 cchPathLeft -= (2 + 1);
237 pchTemp += 2;
238 }
239 else
240 {
241 PWCHAR pchSlash = StrChrW(pszPath + 2, L'\\');
242 if (pchSlash)
243 pchSlash = StrChrW(pchSlash + 1, L'\\');
244
245 if (pchSlash)
246 {
247 *(pchSlash + 1) = UNICODE_NULL; /* Cut off */
248 pchTemp += pchSlash - pszPath;
249 cchPathLeft -= (INT)(SIZE_T)(pchSlash - pszPath) + 1;
250 }
251 else
252 {
253 bLFN = TRUE;
254 pszPath[2] = UNICODE_NULL; /* Cut off */
255 cchPathLeft -= 2;
256 pchTemp += 2;
257 }
258 }
259 }
260 /* Now pszPath is a root-like path or an empty string. */
261
262 /* Start appending the path components of szTemp to pszPath. */
263 while (*pchTemp && cchPathLeft > 0)
264 {
265 /* Collapse any .\ and ..\ parts in the path */
266 if (*pchTemp == L'.')
267 {
268 BOOL bDots = FALSE; /* '.' or '..' ? */
269
270 if (pchTemp[1] == UNICODE_NULL || pchTemp[1] == L'\\')
271 {
272 /* Component '.' */
273 bDots = TRUE;
274 }
275 else if (pchTemp[1] == L'.' && (pchTemp[2] == UNICODE_NULL || pchTemp[2] == L'\\'))
276 {
277 /* Component '..' */
278 PathRemoveFileSpecW(pszPath); /* Remove the last component from pszPath */
279 bDots = TRUE;
280 }
281
282 /* If a '.' or '..' was encountered, skip to the next component */
283 if (bDots)
284 {
285 while (*pchTemp && *pchTemp != L'\\')
286 {
287 ++pchTemp;
288 }
289
290 while (*pchTemp == L'\\')
291 {
292 ++pchTemp;
293 }
294
295 continue;
296 }
297 }
298
299 /* Otherwise, copy the other path component */
300
301 if (!PathAddBackslashW(pszPath)) /* Append a backslash at the end */
302 break;
303
304 --cchPathLeft;
305
306 pchPath = &pszPath[lstrlenW(pszPath)];
307
308 if (!bLFN) /* Not LFN? */
309 {
310 /* Copy MS-DOS 8.3 filename */
311 PWCHAR pchDot = NULL;
312 INT ich;
313 WCHAR szTitle[8 + 1] = L"";
314 INT cchTitle = 0;
315 WCHAR szDotExtension[1 + 3 + 1] = L"";
316 INT cchDotExtension = 0;
317
318 /* Copy the component to szTitle and szDotExtension... */
319 while (*pchTemp && *pchTemp != L'\\')
320 {
321 if (*pchTemp == L'.')
322 {
323 pchDot = pchTemp; /* Remember the last position */
324
325 /* Clear szDotExtension */
326 cchDotExtension = 0;
327 ZeroMemory(szDotExtension, sizeof(szDotExtension));
328 }
329
330 if (pchDot)
331 {
332 if (cchDotExtension < 1 + 3)
333 szDotExtension[cchDotExtension++] = *pchTemp;
334 }
335 else
336 {
337 if (cchTitle < 8)
338 szTitle[cchTitle++] = *pchTemp;
339 }
340
341 ++pchTemp;
342 }
343
344 /* Add file title 'szTitle' to pchPath */
345 for (ich = 0; szTitle[ich] && cchPathLeft > 0; ++ich)
346 {
347 *pchPath++ = szTitle[ich];
348 --cchPathLeft;
349 }
350
351 /* Add file extension 'szDotExtension' to pchPath */
352 if (pchDot)
353 {
354 for (ich = 0; szDotExtension[ich] && cchPathLeft > 0; ++ich)
355 {
356 *pchPath++ = szDotExtension[ich];
357 --cchPathLeft;
358 }
359 }
360 }
361 else /* LFN */
362 {
363 /* Copy the component up to the next separator */
364 while (*pchTemp != UNICODE_NULL && *pchTemp != L'\\' && cchPathLeft > 0)
365 {
366 *pchPath++ = *pchTemp++;
367 --cchPathLeft;
368 }
369 }
370
371 /* Skip the backslashes */
372 while (*pchTemp == L'\\')
373 {
374 ++pchTemp;
375 }
376
377 /* Keep null-terminated */
378 *pchPath = UNICODE_NULL;
379 }
380
381 /* Remove any trailing backslash */
382 PathRemoveBackslashW(pszPath);
383
384 if (!(dwFlags & 1)) /* Remove the trailing dot? */
385 {
386 pchPath = CharPrevW(pszPath, pszPath + lstrlenW(pszPath));
387 if (*pchPath == L'.')
388 *pchPath = UNICODE_NULL;
389 }
390}
391
392BOOL SHELL_GetUserProfileDirectoryW(HANDLE hToken, LPWSTR szPath, LPDWORD lpcchPath)
393{
394 BOOL result;
395 if (!hToken)
396 {
398 result = GetUserProfileDirectoryW(hToken, szPath, lpcchPath);
399 CloseHandle(hToken);
400 }
401 else if ((INT) hToken == -1)
402 {
404 }
405 else
406 {
407 result = GetUserProfileDirectoryW(hToken, szPath, lpcchPath);
408 }
409 TRACE("SHELL_GetUserProfileDirectoryW returning %S\n", szPath);
410 return result;
411}
412#endif
413
414/*
415 ########## Combining and Constructing paths ##########
416*/
417
418/*************************************************************************
419 * PathAppend [SHELL32.36]
420 */
422 LPVOID lpszPath1,
423 LPCVOID lpszPath2)
424{
425 if (SHELL_OsIsUnicode())
426 return PathAppendW(lpszPath1, lpszPath2);
427 return PathAppendA(lpszPath1, lpszPath2);
428}
429
430/*************************************************************************
431 * PathCombine [SHELL32.37]
432 */
434 LPVOID szDest,
435 LPCVOID lpszDir,
436 LPCVOID lpszFile)
437{
438 if (SHELL_OsIsUnicode())
439 return PathCombineW( szDest, lpszDir, lpszFile );
440 return PathCombineA( szDest, lpszDir, lpszFile );
441}
442
443/*************************************************************************
444 * PathAddBackslash [SHELL32.32]
445 */
447{
449 return PathAddBackslashW(lpszPath);
450 return PathAddBackslashA(lpszPath);
451}
452
453/*************************************************************************
454 * PathBuildRoot [SHELL32.30]
455 */
457{
459 return PathBuildRootW(lpszPath, drive);
460 return PathBuildRootA(lpszPath, drive);
461}
462
463/*
464 Extracting Component Parts
465*/
466
467/*************************************************************************
468 * PathFindFileName [SHELL32.34]
469 */
471{
473 return PathFindFileNameW(lpszPath);
474 return PathFindFileNameA(lpszPath);
475}
476
477/*************************************************************************
478 * PathFindExtension [SHELL32.31]
479 */
481{
482 if (SHELL_OsIsUnicode())
483 return PathFindExtensionW(lpszPath);
484 return PathFindExtensionA(lpszPath);
485
486}
487
488/*************************************************************************
489 * PathGetExtensionA [internal]
490 *
491 * NOTES
492 * exported by ordinal
493 * return value points to the first char after the dot
494 */
496{
497 TRACE("(%s)\n",lpszPath);
498
499 lpszPath = PathFindExtensionA(lpszPath);
500 return (LPSTR)(*lpszPath?(lpszPath+1):lpszPath);
501}
502
503/*************************************************************************
504 * PathGetExtensionW [internal]
505 */
507{
508 TRACE("(%s)\n",debugstr_w(lpszPath));
509
510 lpszPath = PathFindExtensionW(lpszPath);
511 return (LPWSTR)(*lpszPath?(lpszPath+1):lpszPath);
512}
513
514/*************************************************************************
515 * PathGetExtension [SHELL32.158]
516 */
518{
519 if (SHELL_OsIsUnicode())
520 return PathGetExtensionW(lpszPath);
521 return PathGetExtensionA(lpszPath);
522}
523
524/*************************************************************************
525 * PathGetArgs [SHELL32.52]
526 */
528{
529 if (SHELL_OsIsUnicode())
530 return PathGetArgsW(lpszPath);
531 return PathGetArgsA(lpszPath);
532}
533
534/*************************************************************************
535 * PathGetDriveNumber [SHELL32.57]
536 */
538{
539 if (SHELL_OsIsUnicode())
540 return PathGetDriveNumberW(lpszPath);
541 return PathGetDriveNumberA(lpszPath);
542}
543
544/*************************************************************************
545 * PathRemoveFileSpec [SHELL32.35]
546 */
548{
549 if (SHELL_OsIsUnicode())
550 return PathRemoveFileSpecW(lpszPath);
551 return PathRemoveFileSpecA(lpszPath);
552}
553
554/*************************************************************************
555 * PathStripPath [SHELL32.38]
556 */
558{
559 if (SHELL_OsIsUnicode())
560 PathStripPathW(lpszPath);
561 else
562 PathStripPathA(lpszPath);
563}
564
565/*************************************************************************
566 * PathStripToRoot [SHELL32.50]
567 */
569{
570 if (SHELL_OsIsUnicode())
571 return PathStripToRootW(lpszPath);
572 return PathStripToRootA(lpszPath);
573}
574
575/*************************************************************************
576 * PathRemoveArgs [SHELL32.251]
577 */
579{
580 if (SHELL_OsIsUnicode())
581 PathRemoveArgsW(lpszPath);
582 else
583 PathRemoveArgsA(lpszPath);
584}
585
586/*************************************************************************
587 * PathRemoveExtension [SHELL32.250]
588 */
590{
591 if (SHELL_OsIsUnicode())
592 PathRemoveExtensionW(lpszPath);
593 else
594 PathRemoveExtensionA(lpszPath);
595}
596
597
598/*
599 Path Manipulations
600*/
601
602/*************************************************************************
603 * PathGetShortPathA [internal]
604 */
605static void PathGetShortPathA(LPSTR pszPath)
606{
608
609 TRACE("%s\n", pszPath);
610
611 if (GetShortPathNameA(pszPath, path, MAX_PATH))
612 {
613 lstrcpyA(pszPath, path);
614 }
615}
616
617/*************************************************************************
618 * PathGetShortPathW [internal]
619 */
620static void PathGetShortPathW(LPWSTR pszPath)
621{
623
624 TRACE("%s\n", debugstr_w(pszPath));
625
626 if (GetShortPathNameW(pszPath, path, MAX_PATH))
627 {
628 lstrcpyW(pszPath, path);
629 }
630}
631
632/*************************************************************************
633 * PathGetShortPath [SHELL32.92]
634 */
636{
638 PathGetShortPathW(pszPath);
639 PathGetShortPathA(pszPath);
640}
641
642/*************************************************************************
643 * PathRemoveBlanks [SHELL32.33]
644 */
646{
649 else
651}
652
653/*************************************************************************
654 * PathQuoteSpaces [SHELL32.55]
655 */
657{
659 PathQuoteSpacesW(lpszPath);
660 else
661 PathQuoteSpacesA(lpszPath);
662}
663
664/*************************************************************************
665 * PathUnquoteSpaces [SHELL32.56]
666 */
668{
671 else
673}
674
675/*************************************************************************
676 * PathParseIconLocation [SHELL32.249]
677 */
679{
681 return PathParseIconLocationW(lpszPath);
682 return PathParseIconLocationA(lpszPath);
683}
684
685/*
686 ########## Path Testing ##########
687*/
688/*************************************************************************
689 * PathIsUNC [SHELL32.39]
690 */
692{
693 if (SHELL_OsIsUnicode())
694 return PathIsUNCW( lpszPath );
695 return PathIsUNCA( lpszPath );
696}
697
698/*************************************************************************
699 * PathIsRelative [SHELL32.40]
700 */
702{
703 if (SHELL_OsIsUnicode())
704 return PathIsRelativeW( lpszPath );
705 return PathIsRelativeA( lpszPath );
706}
707
708/*************************************************************************
709 * PathIsRoot [SHELL32.29]
710 */
712{
713 if (SHELL_OsIsUnicode())
714 return PathIsRootW(lpszPath);
715 return PathIsRootA(lpszPath);
716}
717
718/*************************************************************************
719 * PathIsExeA [internal]
720 */
721static BOOL PathIsExeA (LPCSTR lpszPath)
722{
723 LPCSTR lpszExtension = PathGetExtensionA(lpszPath);
724 int i;
725 static const char * const lpszExtensions[] =
726 {"exe", "com", "pif", "cmd", "bat", "scf", "scr", NULL };
727
728 TRACE("path=%s\n",lpszPath);
729
730 for(i=0; lpszExtensions[i]; i++)
731 if (!lstrcmpiA(lpszExtension,lpszExtensions[i])) return TRUE;
732
733 return FALSE;
734}
735
736/*************************************************************************
737 * PathIsExeW [internal]
738 */
739#ifdef __REACTOS__
740BOOL PathIsExeW (LPCWSTR lpszPath)
741#else
742static BOOL PathIsExeW (LPCWSTR lpszPath)
743#endif
744{
745 LPCWSTR lpszExtension = PathGetExtensionW(lpszPath);
746 int i;
747 static const WCHAR lpszExtensions[][4] =
748 {L"exe", L"com", L"pif",L"cmd", L"bat", L"scf",L"scr",L"" };
749
750 TRACE("path=%s\n",debugstr_w(lpszPath));
751
752 for(i=0; lpszExtensions[i][0]; i++)
753 if (!wcsicmp(lpszExtension,lpszExtensions[i])) return TRUE;
754
755 return FALSE;
756}
757
758/*************************************************************************
759 * PathIsExe [SHELL32.43]
760 */
762{
763 if (SHELL_OsIsUnicode())
764 return PathIsExeW (path);
765 return PathIsExeA(path);
766}
767
768/*************************************************************************
769 * PathIsDirectory [SHELL32.159]
770 */
772{
773 if (SHELL_OsIsUnicode())
774 return PathIsDirectoryW (lpszPath);
775 return PathIsDirectoryA (lpszPath);
776}
777
778/*************************************************************************
779 * PathFileExists [SHELL32.45]
780 */
782{
783 if (SHELL_OsIsUnicode())
784 return PathFileExistsW (lpszPath);
785 return PathFileExistsA (lpszPath);
786}
787
788/*************************************************************************
789 * PathMatchSpec [SHELL32.46]
790 */
792{
793 if (SHELL_OsIsUnicode())
794 return PathMatchSpecW( name, mask );
795 return PathMatchSpecA( name, mask );
796}
797
798/*************************************************************************
799 * PathIsSameRoot [SHELL32.650]
800 */
802{
803 if (SHELL_OsIsUnicode())
804 return PathIsSameRootW(lpszPath1, lpszPath2);
805 return PathIsSameRootA(lpszPath1, lpszPath2);
806}
807
808#ifdef __REACTOS__
809/*************************************************************************
810 * IsLFNDriveA [SHELL32.41]
811 */
813{
814 WCHAR szBuffW[MAX_PATH], *pszW = NULL;
815 if (lpszPath)
816 {
817 SHAnsiToUnicode(lpszPath, szBuffW, _countof(szBuffW));
818 pszW = szBuffW;
819 }
820 return IsLFNDriveW(pszW);
821}
822
823/*************************************************************************
824 * IsLFNDriveW [SHELL32.42]
825 */
827{
828 DWORD cchMaxFileName, iDrive;
829 WCHAR szRoot[MAX_PATH];
830
831 if (lpszPath == NULL || lpszPath[0] == UNICODE_NULL)
832 {
833 szRoot[0] = 0;
834 GetWindowsDirectoryW(szRoot, _countof(szRoot));
835 lpszPath = szRoot;
836 }
837
838 if (PathIsUNCW(lpszPath))
839 {
840 StringCchCopyW(szRoot, _countof(szRoot), lpszPath);
841 PathStripToRootW(szRoot);
842
843 if (StrChrW(szRoot + 2, L'\\') == NULL)
844 return TRUE; /* LFN */
845
846 StringCchCatW(szRoot, _countof(szRoot), L"\\"); /* Add a backslash */
847 }
848 else
849 {
850 iDrive = ((lpszPath[0] - L'A') & 0x1F);
851 PathBuildRootW(szRoot, iDrive);
852
853 if (!IsRemovableDrive(iDrive))
854 {
855 /* FIXME: Cache correctly */
856 }
857 }
858
859#define MSDOS_8DOT3_LEN 12 /* MS-DOS 8.3 filename == length 12 */
860
861 /* GetVolumeInformation requires a root path */
862 if (!GetVolumeInformationW(szRoot, NULL, 0, NULL, &cchMaxFileName, NULL, NULL, 0))
863 {
864 /* Don't return FALSE when GetVolumeInformationW fails. */
865 return TRUE;
866 }
867
868 return cchMaxFileName > MSDOS_8DOT3_LEN;
869}
870#else
871/*************************************************************************
872 * IsLFNDriveA [SHELL32.41]
873 */
875{
876 DWORD fnlen;
877
878 if (!GetVolumeInformationA(lpszPath, NULL, 0, NULL, &fnlen, NULL, NULL, 0))
879 return FALSE;
880 return fnlen > 12;
881}
882
883/*************************************************************************
884 * IsLFNDriveW [SHELL32.42]
885 */
887{
888 DWORD fnlen;
889
890 if (!GetVolumeInformationW(lpszPath, NULL, 0, NULL, &fnlen, NULL, NULL, 0))
891 return FALSE;
892 return fnlen > 12;
893}
894#endif
895
896/*************************************************************************
897 * IsLFNDrive [SHELL32.119]
898 */
900{
901 if (SHELL_OsIsUnicode())
902 return IsLFNDriveW(lpszPath);
903 return IsLFNDriveA(lpszPath);
904}
905
906/*
907 ########## Creating Something Unique ##########
908*/
909/*************************************************************************
910 * PathMakeUniqueNameA [internal]
911 */
913 LPSTR lpszBuffer,
914 DWORD dwBuffSize,
915 LPCSTR lpszShortName,
916 LPCSTR lpszLongName,
917 LPCSTR lpszPathName)
918{
919 FIXME("%p %lu %s %s %s stub\n",
920 lpszBuffer, dwBuffSize, debugstr_a(lpszShortName),
921 debugstr_a(lpszLongName), debugstr_a(lpszPathName));
922 return TRUE;
923}
924
925/*************************************************************************
926 * PathMakeUniqueNameW [internal]
927 */
928#ifdef __REACTOS__
929/* https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-pathmakeuniquename */
931 _Out_ PWSTR pszUniqueName,
934 _In_opt_ PCWSTR pszLongPlate, /* Long template */
936{
937 TRACE("%p %u %s %s %s\n",
938 pszUniqueName, cchMax, debugstr_w(pszTemplate),
939 debugstr_w(pszLongPlate), debugstr_w(pszDir));
940
941 if (!cchMax || !pszUniqueName)
942 return FALSE;
943
944 pszUniqueName[0] = UNICODE_NULL;
945
946 PWSTR pszDest = pszUniqueName;
947 UINT dirLength = 0;
948 if (pszDir)
949 {
950 if (StringCchCopyW(pszUniqueName, cchMax - 1, pszDir) != S_OK)
951 return FALSE;
952
953 pszDest = PathAddBackslashW(pszUniqueName);
954 if (!pszDest)
955 return FALSE;
956
957 dirLength = lstrlenW(pszDir);
958 }
959
960 PCWSTR pszTitle = pszLongPlate ? pszLongPlate : pszTemplate;
961 PCWSTR pchDotExt, formatString = L"%d";
962 INT maxCount, cchTitle;
963
964 if ( !pszTitle
967 || pszDir
968#endif
969 )
970 {
971 if (!pszTemplate)
972 return FALSE;
973
974 pchDotExt = PathFindExtensionW(pszTemplate);
975
976 cchTitle = pchDotExt - pszTemplate;
977 if (cchTitle > 1)
978 {
979 PCWSTR pch = pchDotExt - 1;
980 while (cchTitle > 1 && (L'0' <= *pch && *pch <= L'9'))
981 {
982 --cchTitle;
983 --pch;
984 }
985 }
986
987#define MSDOS_8DOT3_FILENAME_TITLE_LEN 8
988 if (cchTitle > MSDOS_8DOT3_FILENAME_TITLE_LEN - 1)
989 cchTitle = MSDOS_8DOT3_FILENAME_TITLE_LEN - 1;
990
991 INT extLength = lstrlenW(pchDotExt);
992 while (cchTitle > 1 && (dirLength + cchTitle + extLength + 1 > (cchMax - 1)))
993 --cchTitle;
994
995 if (cchTitle <= 0)
996 maxCount = 1;
997 else if (cchTitle == 1)
998 maxCount = 10;
999 else
1000 maxCount = 100;
1001
1002 pszTitle = pszTemplate;
1003 }
1004 else
1005 {
1006 PCWSTR openParen = StrChrW(pszTitle, L'(');
1007 if (openParen)
1008 {
1009 while (openParen)
1010 {
1011 PCWSTR pch = openParen + 1;
1012 while (*pch >= L'0' && *pch <= L'9')
1013 ++pch;
1014
1015 if (*pch == L')')
1016 break;
1017
1018 openParen = StrChrW(openParen + 1, L'(');
1019 }
1020
1021 if (openParen)
1022 {
1023 pchDotExt = openParen + 1;
1024 cchTitle = pchDotExt - pszTitle;
1025 }
1026 else
1027 {
1028 pchDotExt = PathFindExtensionW(pszTitle);
1029 cchTitle = pchDotExt - pszTitle;
1030 formatString = L" (%d)";
1031 }
1032 }
1033 else
1034 {
1035 pchDotExt = PathFindExtensionW(pszTitle);
1036 cchTitle = pchDotExt - pszTitle;
1037 formatString = L" (%d)";
1038 }
1039
1040 INT remainingChars = cchMax - (dirLength + cchTitle + (lstrlenW(formatString) - 2));
1041 if (remainingChars <= 0)
1042 maxCount = 1;
1043 else if (remainingChars == 1)
1044 maxCount = 10;
1045 else if (remainingChars == 2)
1046 maxCount = 100;
1047 else
1048 maxCount = 1000;
1049 }
1050
1051 if (StringCchCopyNW(pszDest, cchMax - dirLength, pszTitle, cchTitle) != S_OK)
1052 return FALSE;
1053
1054 PWSTR pchTitle = pszDest + cchTitle;
1055 INT count;
1056 for (count = 1; count < maxCount; ++count)
1057 {
1058 WCHAR tempName[MAX_PATH];
1059 if (StringCchPrintfW(tempName, _countof(tempName), formatString, count) != S_OK ||
1060 StringCchCatW(tempName, _countof(tempName), pchDotExt) != S_OK)
1061 {
1062 return FALSE;
1063 }
1064
1065 if (StringCchCopyW(pchTitle, cchMax - (pchTitle - pszUniqueName), tempName) != S_OK)
1066 return FALSE;
1067
1068 if (!PathFileExistsW(pszUniqueName))
1069 return TRUE;
1070 }
1071
1072 pszUniqueName[0] = UNICODE_NULL;
1073 return FALSE;
1074}
1075#else
1077 LPWSTR lpszBuffer,
1078 DWORD dwBuffSize,
1079 LPCWSTR lpszShortName,
1080 LPCWSTR lpszLongName,
1081 LPCWSTR lpszPathName)
1082{
1083 FIXME("%p %lu %s %s %s stub\n",
1084 lpszBuffer, dwBuffSize, debugstr_w(lpszShortName),
1085 debugstr_w(lpszLongName), debugstr_w(lpszPathName));
1086 return TRUE;
1087}
1088#endif
1089
1090/*************************************************************************
1091 * PathMakeUniqueName [SHELL32.47]
1092 */
1094 LPVOID lpszBuffer,
1095 DWORD dwBuffSize,
1096 LPCVOID lpszShortName,
1097 LPCVOID lpszLongName,
1098 LPCVOID lpszPathName)
1099{
1100 if (SHELL_OsIsUnicode())
1101 return PathMakeUniqueNameW(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName);
1102 return PathMakeUniqueNameA(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName);
1103}
1104
1105/*************************************************************************
1106 * PathYetAnotherMakeUniqueName [SHELL32.75]
1107 */
1109{
1110 WCHAR pathW[MAX_PATH], retW[MAX_PATH];
1111 const WCHAR *file, *ext;
1112 int i = 2;
1113
1114 TRACE("(%p, %s, %s, %s)\n", buffer, debugstr_w(path), debugstr_w(shortname), debugstr_w(longname));
1115
1116 file = longname ? longname : shortname;
1118 lstrcpyW(retW, pathW);
1120
1122
1123 /* now try to make it unique */
1124 while (PathFileExistsW(retW))
1125 {
1126 swprintf(retW, ARRAY_SIZE(retW), L"%s (%d)%s", pathW, i, ext);
1127 i++;
1128 }
1129
1130 lstrcpyW(buffer, retW);
1131 TRACE("ret - %s\n", debugstr_w(buffer));
1132
1133 return TRUE;
1134}
1135
1136/*
1137 ########## cleaning and resolving paths ##########
1138 */
1139
1140/*************************************************************************
1141 * PathFindOnPath [SHELL32.145]
1142 */
1144{
1145 if (SHELL_OsIsUnicode())
1146 return PathFindOnPathW(sFile, (LPCWSTR *)sOtherDirs);
1147 return PathFindOnPathA(sFile, (LPCSTR *)sOtherDirs);
1148}
1149
1150/*************************************************************************
1151 * PathCleanupSpec [SHELL32.171]
1152 *
1153 * lpszFile is changed in place.
1154 */
1155int WINAPI PathCleanupSpec( LPCWSTR lpszPathW, LPWSTR lpszFileW )
1156{
1157 int i = 0;
1158 DWORD rc = 0;
1159 int length = 0;
1160
1161 if (SHELL_OsIsUnicode())
1162 {
1163 LPWSTR p = lpszFileW;
1164
1165 TRACE("Cleanup %s\n",debugstr_w(lpszFileW));
1166
1167 if (lpszPathW)
1168 length = lstrlenW(lpszPathW);
1169
1170 while (*p)
1171 {
1172 int gct = PathGetCharTypeW(*p);
1173 if (gct == GCT_INVALID || gct == GCT_WILD || gct == GCT_SEPARATOR)
1174 {
1175 lpszFileW[i]='-';
1176 rc |= PCS_REPLACEDCHAR;
1177 }
1178 else
1179 lpszFileW[i]=*p;
1180 i++;
1181 p++;
1182 if (length + i == MAX_PATH)
1183 {
1184 rc |= PCS_FATAL | PCS_PATHTOOLONG;
1185 break;
1186 }
1187 }
1188 lpszFileW[i]=0;
1189 }
1190 else
1191 {
1192 LPSTR lpszFileA = (LPSTR)lpszFileW;
1193 LPCSTR lpszPathA = (LPCSTR)lpszPathW;
1194 LPSTR p = lpszFileA;
1195
1196 TRACE("Cleanup %s\n",debugstr_a(lpszFileA));
1197
1198 if (lpszPathA)
1199 length = strlen(lpszPathA);
1200
1201 while (*p)
1202 {
1203 int gct = PathGetCharTypeA(*p);
1204 if (gct == GCT_INVALID || gct == GCT_WILD || gct == GCT_SEPARATOR)
1205 {
1206 lpszFileA[i]='-';
1207 rc |= PCS_REPLACEDCHAR;
1208 }
1209 else
1210 lpszFileA[i]=*p;
1211 i++;
1212 p++;
1213 if (length + i == MAX_PATH)
1214 {
1215 rc |= PCS_FATAL | PCS_PATHTOOLONG;
1216 break;
1217 }
1218 }
1219 lpszFileA[i]=0;
1220 }
1221 return rc;
1222}
1223
1224#ifdef __REACTOS__
1226{
1228 TRACE("%s\n",pszPath);
1231 SHUnicodeToAnsi(szPath, pszPath, MAX_PATH);
1232}
1233
1234/*************************************************************************
1235 * PathQualifyW [SHELL32]
1236 */
1238{
1239 TRACE("%s\n",debugstr_w(pszPath));
1240 PathQualifyExW(pszPath, NULL, 0);
1241}
1242
1243/*************************************************************************
1244 * PathQualify [SHELL32.49]
1245 */
1247{
1248 if (SHELL_OsIsUnicode())
1249 PathQualifyW(pszPath);
1250 else
1251 PathQualifyA(pszPath);
1252}
1254{
1255 BOOL ret = FALSE;
1256 LPWSTR *dirsW = NULL;
1257 DWORD iDir, cDirs, cbDirs;
1259
1260 TRACE("(%s,%p,0x%08x)\n", debugstr_a(path), dirs, flags);
1261
1262 if (dirs)
1263 {
1264 for (cDirs = 0; dirs[cDirs]; ++cDirs)
1265 ;
1266
1267 cbDirs = (cDirs + 1) * sizeof(LPWSTR);
1268 dirsW = SHAlloc(cbDirs);
1269 if (!dirsW)
1270 goto Cleanup;
1271
1272 ZeroMemory(dirsW, cbDirs);
1273 for (iDir = 0; iDir < cDirs; ++iDir)
1274 {
1275 __SHCloneStrAtoW(&dirsW[iDir], dirs[iDir]);
1276 if (dirsW[iDir] == NULL)
1277 goto Cleanup;
1278 }
1279 }
1280
1282
1283 ret = PathResolveW(pathW, (LPCWSTR*)dirsW, flags);
1284 if (ret)
1286
1287Cleanup:
1288 if (dirsW)
1289 {
1290 for (iDir = 0; iDir < cDirs; ++iDir)
1291 {
1292 SHFree(dirsW[iDir]);
1293 }
1294 SHFree(dirsW);
1295 }
1296 return ret;
1297}
1298
1300{
1301 DWORD dwWhich = WHICH_DEFAULT; /* The extensions to be searched */
1302
1303 TRACE("(%s,%p,0x%08x)\n", debugstr_w(path), dirs, flags);
1304
1305 if (flags & PRF_DONTFINDLNK)
1306 dwWhich &= ~WHICH_LNK; /* Don't search '.LNK' (shortcut) */
1307
1308 if (flags & PRF_VERIFYEXISTS)
1309 SetLastError(ERROR_FILE_NOT_FOUND); /* We set this error code at first in verification */
1310
1312
1313 if (PathIsRootW(path)) /* Root path */
1314 {
1315 if (path[0] == L'\\' && path[1] == UNICODE_NULL) /* '\' only? */
1316 PathQualifyExW(path, ((flags & PRF_FIRSTDIRDEF) ? *dirs : NULL), 0); /* Qualify */
1317
1318 if (flags & PRF_VERIFYEXISTS)
1319 return PathFileExistsAndAttributesW(path, NULL); /* Check the existence */
1320
1321 return TRUE;
1322 }
1323
1324 if (PathIsFileSpecW(path)) /* Filename only */
1325 {
1326 /* Try to find the path with program extensions applied? */
1328 PathSearchOnExtensionsW(path, dirs, TRUE, dwWhich))
1329 {
1330 return TRUE; /* Found */
1331 }
1332
1333 /* Try to find the filename in the directories */
1334 if (PathFindOnPathW(path, dirs))
1335 goto CheckAbsoluteAndFinish;
1336
1337 return FALSE; /* Not found */
1338 }
1339
1340 if (PathIsURLW(path)) /* URL? */
1341 return FALSE;
1342
1343 /* Qualify the path */
1344 PathQualifyExW(path, ((flags & PRF_FIRSTDIRDEF) ? *dirs : NULL), 1);
1345
1346 TRACE("(%s)\n", debugstr_w(path));
1347
1348 if (!(flags & PRF_VERIFYEXISTS)) /* Don't verify the existence? */
1349 return TRUE;
1350
1351 /* Try to find the path with program extensions applied? */
1353 !PathSearchOnExtensionsW(path, dirs, FALSE, dwWhich))
1354 {
1356 return FALSE; /* Not found */
1357 }
1358
1359CheckAbsoluteAndFinish:
1360#if (_WIN32_WINNT >= _WIN32_WINNT_WS03)
1361 if (!(flags & PRF_REQUIREABSOLUTE) || PathIsAbsoluteW(path))
1362 return TRUE;
1363
1364 if (!PathMakeAbsoluteW(path))
1365 return FALSE;
1366
1368#else
1369 return TRUE; /* Found */
1370#endif
1371}
1372
1373/*************************************************************************
1374 * PathResolve [SHELL32.51]
1375 */
1377{
1378 if (SHELL_OsIsUnicode())
1379 return PathResolveW(path, (LPCWSTR*)paths, flags);
1380 else
1381 return PathResolveA(path, (LPCSTR*)paths, flags);
1382}
1383#else
1384/*************************************************************************
1385 * PathQualifyA [SHELL32]
1386 */
1387static BOOL PathQualifyA(LPCSTR pszPath)
1388{
1389 FIXME("%s\n",pszPath);
1390 return FALSE;
1391}
1392
1393/*************************************************************************
1394 * PathQualifyW [SHELL32]
1395 */
1397{
1398 FIXME("%s\n",debugstr_w(pszPath));
1399 return FALSE;
1400}
1401
1402/*************************************************************************
1403 * PathQualify [SHELL32.49]
1404 */
1406{
1407 if (SHELL_OsIsUnicode())
1408 return PathQualifyW(pszPath);
1409 return PathQualifyA(pszPath);
1410}
1411
1412static BOOL PathResolveA(char *path, const char **dirs, DWORD flags)
1413{
1414 BOOL is_file_spec = PathIsFileSpecA(path);
1415 DWORD dwWhich = flags & PRF_DONTFINDLNK ? 0xf : 0xbf;
1416
1417 TRACE("(%s,%p,0x%08lx)\n", debugstr_a(path), dirs, flags);
1418
1419 if (flags & PRF_VERIFYEXISTS)
1420 {
1421 if (PathFindOnPathExA(path, dirs, dwWhich))
1422 {
1424 return TRUE;
1425 }
1426 if (!is_file_spec)
1427 {
1429 if (PathFileExistsDefExtA(path, dwWhich))
1430 return TRUE;
1431 }
1433 return FALSE;
1434 }
1435
1436 if (is_file_spec)
1437 {
1439 return FALSE;
1440 }
1441
1443
1444 return TRUE;
1445}
1446
1448{
1449 BOOL is_file_spec = PathIsFileSpecW(path);
1450 DWORD dwWhich = flags & PRF_DONTFINDLNK ? 0xf : 0xbf;
1451
1452 TRACE("(%s,%p,0x%08lx)\n", debugstr_w(path), dirs, flags);
1453
1454 if (flags & PRF_VERIFYEXISTS)
1455 {
1456 if (PathFindOnPathExW(path, dirs, dwWhich))
1457 {
1459 return TRUE;
1460 }
1461 if (!is_file_spec)
1462 {
1464 if (PathFileExistsDefExtW(path, dwWhich))
1465 return TRUE;
1466 }
1468 return FALSE;
1469 }
1470
1471 if (is_file_spec)
1472 {
1474 return FALSE;
1475 }
1476
1478
1479 return TRUE;
1480}
1481
1482/*************************************************************************
1483 * PathResolve [SHELL32.51]
1484 */
1486{
1487 if (SHELL_OsIsUnicode())
1488 return PathResolveW(path, (const WCHAR **)paths, flags);
1489 else
1490 return PathResolveA(path, (const char **)paths, flags);
1491}
1492#endif
1493
1494/*************************************************************************
1495* PathProcessCommandA
1496*/
1498 LPCSTR lpszPath,
1499 LPSTR lpszBuff,
1500 DWORD dwBuffSize,
1501 DWORD dwFlags)
1502{
1503 FIXME("%s %p 0x%04lx 0x%04lx stub\n",
1504 lpszPath, lpszBuff, dwBuffSize, dwFlags);
1505 if(!lpszPath) return -1;
1506 if(lpszBuff) strcpy(lpszBuff, lpszPath);
1507 return strlen(lpszPath);
1508}
1509
1510#ifndef __REACTOS__ // See ../shlexec.cpp
1511/*************************************************************************
1512* PathProcessCommandW
1513*/
1515 LPCWSTR lpszPath,
1516 LPWSTR lpszBuff,
1517 DWORD dwBuffSize,
1518 DWORD dwFlags)
1519{
1520 FIXME("(%s, %p, 0x%04lx, 0x%04lx) stub\n",
1521 debugstr_w(lpszPath), lpszBuff, dwBuffSize, dwFlags);
1522 if(!lpszPath) return -1;
1523 if(lpszBuff) lstrcpyW(lpszBuff, lpszPath);
1524 return lstrlenW(lpszPath);
1525}
1526#endif
1527
1528/*************************************************************************
1529* PathProcessCommand (SHELL32.653)
1530*/
1532 LPCVOID lpszPath,
1533 LPVOID lpszBuff,
1534 DWORD dwBuffSize,
1535 DWORD dwFlags)
1536{
1537 if (SHELL_OsIsUnicode())
1538 return PathProcessCommandW(lpszPath, lpszBuff, dwBuffSize, dwFlags);
1539 return PathProcessCommandA(lpszPath, lpszBuff, dwBuffSize, dwFlags);
1540}
1541
1542/*
1543 ########## special ##########
1544*/
1545
1546/*************************************************************************
1547 * PathSetDlgItemPath (SHELL32.48)
1548 */
1550{
1551 if (SHELL_OsIsUnicode())
1552 PathSetDlgItemPathW(hDlg, id, pszPath);
1553 else
1554 PathSetDlgItemPathA(hDlg, id, pszPath);
1555}
1556
1557typedef enum _CSIDL_Type {
1568
1569#define CSIDL_CONTACTS 0x0043
1570#define CSIDL_DOWNLOADS 0x0047
1571#define CSIDL_LINKS 0x004d
1572#define CSIDL_APPDATA_LOCALLOW 0x004e
1573#define CSIDL_SAVED_GAMES 0x0062
1574#define CSIDL_SEARCHES 0x0063
1575
1576typedef struct
1577{
1581
1583{
1584 return CONTAINING_RECORD(iface, IApplicationDestinationsImpl, IApplicationDestinations_iface);
1585}
1586
1588 LPVOID *ppv)
1589{
1591
1592 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppv);
1593
1594 if (ppv == NULL)
1595 return E_POINTER;
1596
1597 if (IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IApplicationDestinations, riid))
1598 {
1599 *ppv = &This->IApplicationDestinations_iface;
1600 IUnknown_AddRef((IUnknown*)*ppv);
1601
1602 TRACE("Returning IApplicationDestinations: %p\n", *ppv);
1603 return S_OK;
1604 }
1605
1606 *ppv = NULL;
1607 FIXME("(%p)->(%s, %p) interface not supported.\n", This, debugstr_guid(riid), ppv);
1608
1609 return E_NOINTERFACE;
1610}
1611
1613{
1616
1617 TRACE("(%p), new refcount=%li\n", This, ref);
1618
1619 return ref;
1620}
1621
1623{
1626
1627 TRACE("(%p), new refcount=%li\n", This, ref);
1628
1629 if (ref == 0)
1630 free(This);
1631
1632 return ref;
1633}
1634
1636{
1638
1639 FIXME("(%p, %s) stub!\n", This, debugstr_w(appid));
1640
1641 return E_NOTIMPL;
1642}
1643
1645{
1647
1648 FIXME("(%p, %p) stub!\n", This, punk);
1649
1650 return E_NOTIMPL;
1651}
1652
1654{
1656
1657 FIXME("(%p) stub!\n", This);
1658
1659 return E_NOTIMPL;
1660}
1661
1662static const IApplicationDestinationsVtbl ApplicationDestinationsVtbl =
1663{
1670};
1671
1673{
1675 HRESULT hr;
1676
1677 TRACE("(%p, %s, %p)\n", outer, debugstr_guid(riid), ppv);
1678
1679 if (outer)
1680 return CLASS_E_NOAGGREGATION;
1681
1682 if (!(This = SHAlloc(sizeof(*This))))
1683 return E_OUTOFMEMORY;
1684
1685 This->IApplicationDestinations_iface.lpVtbl = &ApplicationDestinationsVtbl;
1686 This->ref = 0;
1687
1688 hr = IUnknown_QueryInterface(&This->IApplicationDestinations_iface, riid, ppv);
1689 if (FAILED(hr))
1690 SHFree(This);
1691
1692 return hr;
1693}
1694
1695typedef struct
1696{
1700
1702{
1703 return CONTAINING_RECORD(iface, IApplicationDocumentListsImpl, IApplicationDocumentLists_iface);
1704}
1705
1708{
1710
1711 TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppv);
1712
1713 if (ppv == NULL)
1714 return E_POINTER;
1715
1716 if (IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IApplicationDocumentLists, riid))
1717 {
1718 *ppv = &This->IApplicationDocumentLists_iface;
1719 IUnknown_AddRef((IUnknown*)*ppv);
1720
1721 TRACE("Returning IApplicationDocumentLists: %p\n", *ppv);
1722 return S_OK;
1723 }
1724
1725 *ppv = NULL;
1726 FIXME("(%p)->(%s, %p) interface not supported.\n", This, debugstr_guid(riid), ppv);
1727
1728 return E_NOINTERFACE;
1729}
1730
1732{
1735
1736 TRACE("(%p), new refcount=%li\n", This, ref);
1737
1738 return ref;
1739}
1740
1742{
1745
1746 TRACE("(%p), new refcount=%li\n", This, ref);
1747
1748 if (ref == 0)
1749 free(This);
1750
1751 return ref;
1752}
1753
1755 const WCHAR *appid)
1756{
1758
1759 FIXME("(%p, %s) stub!\n", This, debugstr_w(appid));
1760
1761 return E_NOTIMPL;
1762}
1763
1765 APPDOCLISTTYPE list_type, UINT item_count,
1766 REFIID riid, void **obj)
1767{
1769
1770 FIXME("(%p, %u, %u, %s, %p): stub\n", This, list_type, item_count, debugstr_guid(riid), obj);
1771
1772 return E_NOTIMPL;
1773}
1774
1775static const IApplicationDocumentListsVtbl ApplicationDocumentListsVtbl =
1776{
1782};
1783
1785{
1787 HRESULT hr;
1788
1789 TRACE("(%p, %s, %p)\n", outer, debugstr_guid(riid), ppv);
1790
1791 if (outer)
1792 return CLASS_E_NOAGGREGATION;
1793
1794 if (!(This = SHAlloc(sizeof(*This))))
1795 return E_OUTOFMEMORY;
1796
1797 This->IApplicationDocumentLists_iface.lpVtbl = &ApplicationDocumentListsVtbl;
1798 This->ref = 0;
1799
1800 hr = IUnknown_QueryInterface(&This->IApplicationDocumentLists_iface, riid, ppv);
1801 if (FAILED(hr))
1802 SHFree(This);
1803
1804 return hr;
1805}
1806
1807typedef struct
1808{
1811 const WCHAR *value;
1812 const WCHAR *def_path; /* fallback string or resource ID */
1813 KF_CATEGORY category;
1814 const WCHAR *name;
1820 const FOLDERTYPEID *typeid;
1821#ifdef __REACTOS__
1822 INT nShell32IconIndex;
1823#endif
1824} CSIDL_DATA;
1825
1826static const CSIDL_DATA CSIDL_Data[] =
1827{
1828 { /* 0x00 - CSIDL_DESKTOP */
1829 .id = &FOLDERID_Desktop,
1830 .type = CSIDL_Type_User,
1831 .value = L"Desktop",
1832 .category = KF_CATEGORY_PERUSER,
1833 .name = L"Desktop",
1834 .path = L"Desktop",
1835 .attributes = FILE_ATTRIBUTE_READONLY,
1836 },
1837 { /* 0x01 - CSIDL_INTERNET */
1838 .id = &FOLDERID_InternetFolder,
1839 .type = CSIDL_Type_Disallowed,
1840 .category = KF_CATEGORY_VIRTUAL,
1841 .name = L"InternetFolder",
1842 .parsing = L"::{871C5380-42A0-1069-A2EA-08002B30309D}",
1843 },
1844 { /* 0x02 - CSIDL_PROGRAMS */
1845 .id = &FOLDERID_Programs,
1846 .type = CSIDL_Type_User,
1847 .value = L"Programs",
1848 .category = KF_CATEGORY_PERUSER,
1849 .name = L"Programs",
1850 .parent = &FOLDERID_StartMenu,
1851 .path = L"Programs",
1852 .attributes = FILE_ATTRIBUTE_READONLY,
1853 },
1854 { /* 0x03 - CSIDL_CONTROLS (.CPL files) */
1855 .id = &FOLDERID_ControlPanelFolder,
1856 .type = CSIDL_Type_SystemPath,
1857 .category = KF_CATEGORY_VIRTUAL,
1858 .name = L"ControlPanelFolder",
1859 .path = L"::{21EC2020-3AEA-1069-A2DD-08002B30309D}",
1860 .parsing = L"::{26EE0668-A00A-44D7-9371-BEB064C98683}\\0",
1861#ifdef __REACTOS__
1862 .nShell32IconIndex = -IDI_SHELL_CONTROL_PANEL
1863#endif
1864 },
1865 { /* 0x04 - CSIDL_PRINTERS */
1866 .id = &FOLDERID_PrintersFolder,
1867 .type = CSIDL_Type_SystemPath,
1868 .category = KF_CATEGORY_VIRTUAL,
1869 .name = L"PrintersFolder",
1870 .parsing = L"::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}",
1871#ifdef __REACTOS__
1872 .nShell32IconIndex = -IDI_SHELL_PRINTERS_FOLDER
1873#endif
1874 },
1875 { /* 0x05 - CSIDL_PERSONAL */
1876 .id = &FOLDERID_Documents,
1877 .type = CSIDL_Type_User,
1878 .value = L"Personal",
1879 .category = KF_CATEGORY_PERUSER,
1880 .name = L"Personal",
1881 .parent = &FOLDERID_Profile,
1882 .path = L"Documents",
1883 .parsing = L"::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{FDD39AD0-238F-46AF-ADB4-6C85480369C7}",
1884 .attributes = FILE_ATTRIBUTE_READONLY,
1885 .flags = KFDF_ROAMABLE | KFDF_PRECREATE,
1886#ifdef __REACTOS__
1887 .nShell32IconIndex = -IDI_SHELL_MY_DOCUMENTS
1888#endif
1889 },
1890 { /* 0x06 - CSIDL_FAVORITES */
1891 .id = &FOLDERID_Favorites,
1892 .type = CSIDL_Type_User,
1893 .value = L"Favorites",
1894 .category = KF_CATEGORY_PERUSER,
1895 .name = L"Favorites",
1896 .path = L"Favorites",
1897 .attributes = FILE_ATTRIBUTE_READONLY,
1899#ifdef __REACTOS__
1900 .nShell32IconIndex = -IDI_SHELL_FAVORITES
1901#endif
1902 },
1903 { /* 0x07 - CSIDL_STARTUP */
1904 .id = &FOLDERID_Startup,
1905 .type = CSIDL_Type_User,
1906 .value = L"StartUp",
1907 .category = KF_CATEGORY_PERUSER,
1908 .name = L"Startup",
1909 .parent = &FOLDERID_Programs,
1910 .path = L"StartUp",
1911 .attributes = FILE_ATTRIBUTE_READONLY,
1912 .flags = KFDF_PRECREATE,
1913 },
1914 { /* 0x08 - CSIDL_RECENT */
1915 .id = &FOLDERID_Recent,
1916 .type = CSIDL_Type_User,
1917 .value = L"Recent",
1918 .category = KF_CATEGORY_PERUSER,
1919 .name = L"Recent",
1920 .parent = &FOLDERID_RoamingAppData,
1921 .path = L"Microsoft\\Windows\\Recent",
1922 .attributes = FILE_ATTRIBUTE_READONLY,
1923 .flags = KFDF_PRECREATE,
1924#ifdef __REACTOS__
1925 .nShell32IconIndex = -IDI_SHELL_RECENT_DOCUMENTS
1926#endif
1927 },
1928 { /* 0x09 - CSIDL_SENDTO */
1929 .id = &FOLDERID_SendTo,
1930 .type = CSIDL_Type_User,
1931 .value = L"SendTo",
1932 .category = KF_CATEGORY_PERUSER,
1933 .name = L"SendTo",
1934 .parent = &FOLDERID_RoamingAppData,
1935 .path = L"Microsoft\\Windows\\SendTo",
1936 .flags = KFDF_PRECREATE,
1937 },
1938 { /* 0x0a - CSIDL_BITBUCKET - Recycle Bin */
1939 .id = &FOLDERID_RecycleBinFolder,
1940 .type = CSIDL_Type_Disallowed,
1941 .category = KF_CATEGORY_VIRTUAL,
1942 .name = L"RecycleBinFolder",
1943 .parsing = L"::{645FF040-5081-101B-9F08-00AA002F954E}",
1944 },
1945 { /* 0x0b - CSIDL_STARTMENU */
1946 .id = &FOLDERID_StartMenu,
1947 .type = CSIDL_Type_User,
1948 .value = L"Start Menu",
1949 .category = KF_CATEGORY_PERUSER,
1950 .name = L"Start Menu",
1951 .parent = &FOLDERID_RoamingAppData,
1952 .path = L"Microsoft\\Windows\\Start Menu",
1953 .attributes = FILE_ATTRIBUTE_READONLY,
1954 .flags = KFDF_PRECREATE,
1955#ifdef __REACTOS__
1956 .nShell32IconIndex = -IDI_SHELL_TSKBAR_STARTMENU
1957#endif
1958 },
1959 { /* 0x0c - CSIDL_MYDOCUMENTS */
1960 .id = &GUID_NULL,
1961 .type = CSIDL_Type_Disallowed, /* matches WinXP--can't get its path */
1962#ifdef __REACTOS__
1963 .nShell32IconIndex = -IDI_SHELL_MY_DOCUMENTS
1964#endif
1965 },
1966 { /* 0x0d - CSIDL_MYMUSIC */
1967 .id = &FOLDERID_Music,
1968 .type = CSIDL_Type_User,
1969 .value = L"My Music",
1970 .category = KF_CATEGORY_PERUSER,
1971 .name = L"My Music",
1972 .parent = &FOLDERID_Profile,
1973 .path = L"Music",
1974 .parsing = L"::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{4BD8D571-6D19-48D3-BE97-422220080E43}",
1975 .attributes = FILE_ATTRIBUTE_READONLY,
1976 .flags = KFDF_ROAMABLE | KFDF_PRECREATE,
1977#ifdef __REACTOS__
1978 .nShell32IconIndex = -IDI_SHELL_MY_MUSIC
1979#endif
1980 },
1981 { /* 0x0e - CSIDL_MYVIDEO */
1982 .id = &FOLDERID_Videos,
1983 .type = CSIDL_Type_User,
1984 .value = L"My Videos",
1985 .category = KF_CATEGORY_PERUSER,
1986 .name = L"My Video",
1987 .parent = &FOLDERID_Profile,
1988 .path = L"Videos",
1989 .parsing = L"::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{18989B1D-99B5-455B-841C-AB7C74E4DDFC}",
1990 .attributes = FILE_ATTRIBUTE_READONLY,
1991 .flags = KFDF_ROAMABLE | KFDF_PRECREATE,
1992#ifdef __REACTOS__
1993 .nShell32IconIndex = -IDI_SHELL_MY_MOVIES
1994#endif
1995 },
1996 { /* 0x0f - unassigned */
1997 .id = &GUID_NULL,
1998 .type = CSIDL_Type_Disallowed,
1999 },
2000 { /* 0x10 - CSIDL_DESKTOPDIRECTORY */
2001 .id = &FOLDERID_Desktop,
2002 .type = CSIDL_Type_User,
2003 .value = L"Desktop",
2004 .category = KF_CATEGORY_PERUSER,
2005 .name = L"Desktop",
2006 .parent = &FOLDERID_Profile,
2007 .path = L"Desktop",
2008 .attributes = FILE_ATTRIBUTE_READONLY,
2010#ifdef __REACTOS__
2011 .nShell32IconIndex = 0
2012#endif
2013 },
2014 { /* 0x11 - CSIDL_DRIVES */
2015 .id = &FOLDERID_ComputerFolder,
2016 .type = CSIDL_Type_Disallowed,
2017 .category = KF_CATEGORY_VIRTUAL,
2018 .name = L"MyComputerFolder",
2019 .parsing = L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
2020#ifdef __REACTOS__
2021 .nShell32IconIndex = -IDI_SHELL_COMPUTER_FOLDER
2022#endif
2023 },
2024 { /* 0x12 - CSIDL_NETWORK */
2025 .id = &FOLDERID_NetworkFolder,
2026 .type = CSIDL_Type_Disallowed,
2027 .category = KF_CATEGORY_VIRTUAL,
2028 .name = L"NetworkPlacesFolder",
2029 .parsing = L"::{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}",
2030#ifdef __REACTOS__
2031 .nShell32IconIndex = -IDI_SHELL_NETWORK_FOLDER
2032#endif
2033 },
2034 { /* 0x13 - CSIDL_NETHOOD */
2035 .id = &FOLDERID_NetHood,
2036 .type = CSIDL_Type_User,
2037 .value = L"NetHood",
2038 .category = KF_CATEGORY_PERUSER,
2039 .name = L"NetHood",
2040 .parent = &FOLDERID_RoamingAppData,
2041 .path = L"Microsoft\\Windows\\Network Shortcuts",
2042#ifdef __REACTOS__
2043 .nShell32IconIndex = -IDI_SHELL_NETWORK
2044#endif
2045 },
2046 { /* 0x14 - CSIDL_FONTS */
2047 .id = &FOLDERID_Fonts,
2048 .type = CSIDL_Type_WindowsPath,
2049 .value = L"Fonts",
2050 .def_path = L"Fonts",
2051 .category = KF_CATEGORY_FIXED,
2052 .name = L"Fonts",
2053 .parent = &FOLDERID_Windows,
2054 .typeid = &FOLDERID_Windows,
2055#ifdef __REACTOS__
2056 .nShell32IconIndex = -IDI_SHELL_FONTS_FOLDER
2057#endif
2058 },
2059 { /* 0x15 - CSIDL_TEMPLATES */
2060 .id = &FOLDERID_Templates,
2061 .type = CSIDL_Type_User,
2062 .value = L"Templates",
2063 .category = KF_CATEGORY_PERUSER,
2064 .name = L"Templates",
2065 .parent = &FOLDERID_RoamingAppData,
2066 .path = L"Microsoft\\Windows\\Templates",
2067 },
2068 { /* 0x16 - CSIDL_COMMON_STARTMENU */
2069 .id = &FOLDERID_CommonStartMenu,
2070 .type = CSIDL_Type_ProgramData,
2071 .value = L"Common Start Menu",
2072 .category = KF_CATEGORY_COMMON,
2073 .name = L"Common Start Menu",
2074 .parent = &FOLDERID_ProgramData,
2075 .path = L"Microsoft\\Windows\\Start Menu",
2076 .attributes = FILE_ATTRIBUTE_READONLY,
2077#ifdef __REACTOS__
2078 .nShell32IconIndex = -IDI_SHELL_TSKBAR_STARTMENU
2079#endif
2080 },
2081 { /* 0x17 - CSIDL_COMMON_PROGRAMS */
2082 .id = &FOLDERID_CommonPrograms,
2083 .type = CSIDL_Type_ProgramData,
2084 .value = L"Common Programs",
2085 .category = KF_CATEGORY_COMMON,
2086 .name = L"Common Programs",
2087 .parent = &FOLDERID_CommonStartMenu,
2088 .path = L"Programs",
2089 .attributes = FILE_ATTRIBUTE_READONLY,
2090 },
2091 { /* 0x18 - CSIDL_COMMON_STARTUP */
2092 .id = &FOLDERID_CommonStartup,
2093 .type = CSIDL_Type_ProgramData,
2094 .value = L"Common StartUp",
2095 .category = KF_CATEGORY_COMMON,
2096 .name = L"Common Startup",
2097 .parent = &FOLDERID_CommonPrograms,
2098 .path = L"StartUp",
2099 .attributes = FILE_ATTRIBUTE_READONLY,
2100 .flags = KFDF_PRECREATE,
2101 },
2102 { /* 0x19 - CSIDL_COMMON_DESKTOPDIRECTORY */
2103 .id = &FOLDERID_PublicDesktop,
2104 .type = CSIDL_Type_AllUsers,
2105 .value = L"Common Desktop",
2106 .category = KF_CATEGORY_COMMON,
2107 .name = L"Common Desktop",
2108 .parent = &FOLDERID_Public,
2109 .path = L"Desktop",
2111 .flags = KFDF_PRECREATE,
2112 },
2113 { /* 0x1a - CSIDL_APPDATA */
2114 .id = &FOLDERID_RoamingAppData,
2115 .type = CSIDL_Type_User,
2116 .value = L"AppData",
2117 .category = KF_CATEGORY_PERUSER,
2118 .name = L"AppData",
2119 .parent = &FOLDERID_Profile,
2120 .path = L"AppData\\Roaming",
2121 },
2122 { /* 0x1b - CSIDL_PRINTHOOD */
2123 .id = &FOLDERID_PrintHood,
2124 .type = CSIDL_Type_User,
2125 .value = L"PrintHood",
2126 .category = KF_CATEGORY_PERUSER,
2127 .name = L"PrintHood",
2128 .parent = &FOLDERID_RoamingAppData,
2129 .path = L"Microsoft\\Windows\\Printer Shortcuts",
2130#ifdef __REACTOS__
2131 .nShell32IconIndex = -IDI_SHELL_PRINTERS_FOLDER
2132#endif
2133 },
2134 { /* 0x1c - CSIDL_LOCAL_APPDATA */
2135 .id = &FOLDERID_LocalAppData,
2136 .type = CSIDL_Type_User,
2137 .value = L"Local AppData",
2138 .category = KF_CATEGORY_PERUSER,
2139 .name = L"Local AppData",
2140 .parent = &FOLDERID_Profile,
2141 .path = L"AppData\\Local",
2143 },
2144 { /* 0x1d - CSIDL_ALTSTARTUP */
2145 .id = &GUID_NULL,
2146 .type = CSIDL_Type_NonExistent,
2147 },
2148 { /* 0x1e - CSIDL_COMMON_ALTSTARTUP */
2149 .id = &GUID_NULL,
2150 .type = CSIDL_Type_NonExistent,
2151 },
2152 { /* 0x1f - CSIDL_COMMON_FAVORITES */
2153 .id = &FOLDERID_Favorites,
2154 .type = CSIDL_Type_AllUsers,
2155 .value = L"Common Favorites",
2156 .category = KF_CATEGORY_PERUSER,
2157 .name = L"Favorites",
2158 .parent = &FOLDERID_Profile,
2159 .path = L"Favorites",
2160 .attributes = FILE_ATTRIBUTE_READONLY,
2162#ifdef __REACTOS__
2163 .nShell32IconIndex = -IDI_SHELL_FAVORITES
2164#endif
2165 },
2166 { /* 0x20 - CSIDL_INTERNET_CACHE */
2167 .id = &FOLDERID_InternetCache,
2168 .type = CSIDL_Type_User,
2169 .value = L"Cache",
2170 .category = KF_CATEGORY_PERUSER,
2171 .name = L"Cache",
2172 .parent = &FOLDERID_LocalAppData,
2173 .path = L"Microsoft\\Windows\\INetCache",
2174 .flags = KFDF_LOCAL_REDIRECT_ONLY,
2175 },
2176 { /* 0x21 - CSIDL_COOKIES */
2177 .id = &FOLDERID_Cookies,
2178 .type = CSIDL_Type_User,
2179 .value = L"Cookies",
2180 .category = KF_CATEGORY_PERUSER,
2181 .name = L"Cookies",
2182 .parent = &FOLDERID_LocalAppData,
2183 .path = L"Microsoft\\Windows\\INetCookies",
2184 },
2185 { /* 0x22 - CSIDL_HISTORY */
2186 .id = &FOLDERID_History,
2187 .type = CSIDL_Type_User,
2188 .value = L"History",
2189 .category = KF_CATEGORY_PERUSER,
2190 .name = L"History",
2191 .parent = &FOLDERID_LocalAppData,
2192 .path = L"Microsoft\\Windows\\History",
2193 .flags = KFDF_LOCAL_REDIRECT_ONLY,
2194 },
2195 { /* 0x23 - CSIDL_COMMON_APPDATA */
2196 .id = &FOLDERID_ProgramData,
2197 .type = CSIDL_Type_ProgramData,
2198 .value = L"Common AppData",
2199 .category = KF_CATEGORY_FIXED,
2200 .name = L"Common AppData",
2201 },
2202 { /* 0x24 - CSIDL_WINDOWS */
2203 .id = &FOLDERID_Windows,
2204 .type = CSIDL_Type_WindowsPath,
2205 .category = KF_CATEGORY_FIXED,
2206 .name = L"Windows",
2207 },
2208 { /* 0x25 - CSIDL_SYSTEM */
2209 .id = &FOLDERID_System,
2210 .type = CSIDL_Type_SystemPath,
2211 .category = KF_CATEGORY_FIXED,
2212 .name = L"System",
2213 },
2214 { /* 0x26 - CSIDL_PROGRAM_FILES */
2215 .id = &FOLDERID_ProgramFiles,
2216 .type = CSIDL_Type_CurrVer,
2217 .value = L"ProgramFilesDir",
2218 .def_path = L"Program Files",
2219 .category = KF_CATEGORY_FIXED,
2220 .name = L"ProgramFiles",
2221 .attributes = FILE_ATTRIBUTE_READONLY,
2222 },
2223 { /* 0x27 - CSIDL_MYPICTURES */
2224 .id = &FOLDERID_Pictures,
2225 .type = CSIDL_Type_User,
2226 .value = L"My Pictures",
2227 .category = KF_CATEGORY_PERUSER,
2228 .name = L"My Pictures",
2229 .parent = &FOLDERID_Profile,
2230 .path = L"Pictures",
2231 .parsing = L"::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{33E28130-4E1E-4676-835A-98395C3BC3BB}",
2232 .attributes = FILE_ATTRIBUTE_READONLY,
2233 .flags = KFDF_ROAMABLE | KFDF_PRECREATE,
2234#ifdef __REACTOS__
2235 .nShell32IconIndex = -IDI_SHELL_MY_PICTURES
2236#endif
2237 },
2238 { /* 0x28 - CSIDL_PROFILE */
2239 .id = &FOLDERID_Profile,
2240 .type = CSIDL_Type_User,
2241 .category = KF_CATEGORY_FIXED,
2242 .name = L"Profile",
2243 },
2244 { /* 0x29 - CSIDL_SYSTEMX86 */
2245 .id = &FOLDERID_SystemX86,
2247 .category = KF_CATEGORY_FIXED,
2248 .name = L"SystemX86",
2249#ifdef __REACTOS__
2250 .nShell32IconIndex = -IDI_SHELL_SYSTEM_GEAR
2251#endif
2252 },
2253 { /* 0x2a - CSIDL_PROGRAM_FILESX86 */
2254 .id = &FOLDERID_ProgramFilesX86,
2255 .type = CSIDL_Type_CurrVer,
2256 .value = L"ProgramFilesDir (x86)",
2257 .def_path = L"Program Files (x86)",
2258 .category = KF_CATEGORY_FIXED,
2259 .name = L"ProgramFilesX86",
2260 .attributes = FILE_ATTRIBUTE_READONLY,
2261 },
2262 { /* 0x2b - CSIDL_PROGRAM_FILES_COMMON */
2263 .id = &FOLDERID_ProgramFilesCommon,
2264 .type = CSIDL_Type_CurrVer,
2265 .value = L"CommonFilesDir",
2266 .def_path = L"Program Files\\Common Files",
2267 .category = KF_CATEGORY_FIXED,
2268 .name = L"ProgramFilesCommon",
2269 },
2270 { /* 0x2c - CSIDL_PROGRAM_FILES_COMMONX86 */
2271 .id = &FOLDERID_ProgramFilesCommonX86,
2272 .type = CSIDL_Type_CurrVer,
2273 .value = L"CommonFilesDir (x86)",
2274 .def_path = L"Program Files (x86)\\Common Files",
2275 .category = KF_CATEGORY_FIXED,
2276 .name = L"ProgramFilesCommonX86",
2277 },
2278 { /* 0x2d - CSIDL_COMMON_TEMPLATES */
2279 .id = &FOLDERID_CommonTemplates,
2280 .type = CSIDL_Type_ProgramData,
2281 .value = L"Common Templates",
2282 .category = KF_CATEGORY_COMMON,
2283 .name = L"Common Templates",
2284 .parent = &FOLDERID_ProgramData,
2285 .path = L"Microsoft\\Windows\\Templates",
2286 },
2287 { /* 0x2e - CSIDL_COMMON_DOCUMENTS */
2288 .id = &FOLDERID_PublicDocuments,
2289 .type = CSIDL_Type_AllUsers,
2290 .value = L"Common Documents",
2291 .category = KF_CATEGORY_COMMON,
2292 .name = L"Common Documents",
2293 .parent = &FOLDERID_Public,
2294 .path = L"Documents",
2295 .attributes = FILE_ATTRIBUTE_READONLY,
2296 .flags = KFDF_PRECREATE,
2297#ifdef __REACTOS__
2298 .nShell32IconIndex = -IDI_SHELL_MY_DOCUMENTS
2299#endif
2300 },
2301 { /* 0x2f - CSIDL_COMMON_ADMINTOOLS */
2302 .id = &FOLDERID_CommonAdminTools,
2303 .type = CSIDL_Type_ProgramData,
2304 .value = L"Common Administrative Tools",
2305 .category = KF_CATEGORY_COMMON,
2306 .name = L"Common Administrative Tools",
2307 .parent = &FOLDERID_CommonPrograms,
2308 .path = L"Administrative Tools",
2309 .attributes = FILE_ATTRIBUTE_READONLY,
2310 .flags = KFDF_PRECREATE,
2311 },
2312 { /* 0x30 - CSIDL_ADMINTOOLS */
2313 .id = &FOLDERID_AdminTools,
2314 .type = CSIDL_Type_User,
2315 .value = L"Administrative Tools",
2316 .category = KF_CATEGORY_PERUSER,
2317 .name = L"Administrative Tools",
2318 .parent = &FOLDERID_Programs,
2319 .path = L"Administrative Tools",
2320 .attributes = FILE_ATTRIBUTE_READONLY,
2321 .flags = KFDF_PRECREATE,
2322 },
2323 { /* 0x31 - CSIDL_CONNECTIONS */
2324 .id = &FOLDERID_ConnectionsFolder,
2325 .type = CSIDL_Type_Disallowed,
2326 .category = KF_CATEGORY_VIRTUAL,
2327 .name = L"ConnectionsFolder",
2328 .path = L"Administrative Tools",
2329 .parsing = L"::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}",
2330 },
2331 { /* 0x32 - unassigned */
2332 .id = &GUID_NULL,
2333 .type = CSIDL_Type_Disallowed,
2334 },
2335 { /* 0x33 - unassigned */
2336 .id = &GUID_NULL,
2337 .type = CSIDL_Type_Disallowed,
2338 },
2339 { /* 0x34 - unassigned */
2340 .id = &GUID_NULL,
2341 .type = CSIDL_Type_Disallowed,
2342 },
2343 { /* 0x35 - CSIDL_COMMON_MUSIC */
2344 .id = &FOLDERID_PublicMusic,
2345 .type = CSIDL_Type_AllUsers,
2346 .value = L"CommonMusic",
2347 .category = KF_CATEGORY_COMMON,
2348 .name = L"CommonMusic",
2349 .parent = &FOLDERID_Public,
2350 .path = L"Music",
2351 .attributes = FILE_ATTRIBUTE_READONLY,
2352 .flags = KFDF_PRECREATE,
2353#ifdef __REACTOS__
2354 .nShell32IconIndex = -IDI_SHELL_MY_MUSIC
2355#endif
2356 },
2357 { /* 0x36 - CSIDL_COMMON_PICTURES */
2358 .id = &FOLDERID_PublicPictures,
2359 .type = CSIDL_Type_AllUsers,
2360 .value = L"CommonPictures",
2361 .category = KF_CATEGORY_COMMON,
2362 .name = L"CommonPictures",
2363 .parent = &FOLDERID_Public,
2364 .path = L"Pictures",
2365 .attributes = FILE_ATTRIBUTE_READONLY,
2366 .flags = KFDF_PRECREATE,
2367#ifdef __REACTOS__
2368 .nShell32IconIndex = -IDI_SHELL_MY_PICTURES
2369#endif
2370 },
2371 { /* 0x37 - CSIDL_COMMON_VIDEO */
2372 .id = &FOLDERID_PublicVideos,
2373 .type = CSIDL_Type_AllUsers,
2374 .value = L"CommonVideo",
2375 .category = KF_CATEGORY_COMMON,
2376 .name = L"CommonVideo",
2377 .parent = &FOLDERID_Public,
2378 .path = L"Videos",
2379 .attributes = FILE_ATTRIBUTE_READONLY,
2380 .flags = KFDF_PRECREATE,
2381#ifdef __REACTOS__
2382 .nShell32IconIndex = -IDI_SHELL_MY_MOVIES
2383#endif
2384 },
2385 { /* 0x38 - CSIDL_RESOURCES */
2386 .id = &FOLDERID_ResourceDir,
2387 .type = CSIDL_Type_WindowsPath,
2388 .def_path = L"Resources",
2389 .category = KF_CATEGORY_FIXED,
2390 .name = L"ResourceDir",
2391 },
2392 { /* 0x39 - CSIDL_RESOURCES_LOCALIZED */
2393 .id = &FOLDERID_LocalizedResourcesDir,
2394 .type = CSIDL_Type_NonExistent,
2395 .category = KF_CATEGORY_FIXED,
2396 .name = L"LocalizedResourcesDir",
2397 },
2398 { /* 0x3a - CSIDL_COMMON_OEM_LINKS */
2399 .id = &FOLDERID_CommonOEMLinks,
2400 .type = CSIDL_Type_ProgramData,
2401 .category = KF_CATEGORY_COMMON,
2402 .name = L"OEM Links",
2403 .parent = &FOLDERID_ProgramData,
2404 .path = L"OEM Links",
2405 },
2406 { /* 0x3b - CSIDL_CDBURN_AREA */
2407 .id = &FOLDERID_CDBurning,
2408 .type = CSIDL_Type_User,
2409 .value = L"CD Burning",
2410 .category = KF_CATEGORY_PERUSER,
2411 .name = L"CD Burning",
2412 .parent = &FOLDERID_LocalAppData,
2413 .path = L"Microsoft\\Windows\\Burn\\Burn",
2414 .attributes = FILE_ATTRIBUTE_READONLY,
2415 .flags = KFDF_LOCAL_REDIRECT_ONLY,
2416 },
2417 { /* 0x3c unassigned */
2418 .id = &GUID_NULL,
2419 .type = CSIDL_Type_Disallowed,
2420 },
2421 { /* 0x3d - CSIDL_COMPUTERSNEARME */
2422 .id = &GUID_NULL,
2423 .type = CSIDL_Type_Disallowed, /* FIXME */
2424 },
2425 { /* 0x3e - CSIDL_PROFILES */
2426 .id = &GUID_NULL,
2427 .type = CSIDL_Type_Disallowed, /* oddly, this matches WinXP */
2428 },
2429 { /* 0x3f */
2430 .id = &FOLDERID_AddNewPrograms,
2431 .type = CSIDL_Type_Disallowed,
2432 .category = KF_CATEGORY_VIRTUAL,
2433 .name = L"AddNewProgramsFolder",
2434 .parsing = L"::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{15eae92e-f17a-4431-9f28-805e482dafd4}",
2435 },
2436 { /* 0x40 */
2437 .id = &FOLDERID_AppUpdates,
2438 .type = CSIDL_Type_Disallowed,
2439 .category = KF_CATEGORY_VIRTUAL,
2440 .name = L"AppUpdatesFolder",
2441 .parsing = L"::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{7b81be6a-ce2b-4676-a29e-eb907a5126c5}\\::{d450a8a1-9568-45c7-9c0e-b4f9fb4537bd}",
2442 },
2443 { /* 0x41 */
2444 .id = &FOLDERID_ChangeRemovePrograms,
2445 .type = CSIDL_Type_Disallowed,
2446 .category = KF_CATEGORY_VIRTUAL,
2447 .name = L"ChangeRemoveProgramsFolder",
2448 .parsing = L"::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{7b81be6a-ce2b-4676-a29e-eb907a5126c5}",
2449 },
2450 { /* 0x42 */
2451 .id = &FOLDERID_ConflictFolder,
2452 .type = CSIDL_Type_Disallowed,
2453 .category = KF_CATEGORY_VIRTUAL,
2454 .name = L"ConflictFolder",
2455 .parsing = L"::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF}\\::{E413D040-6788-4C22-957E-175D1C513A34},",
2456 },
2457 { /* 0x43 - CSIDL_CONTACTS */
2458 .id = &FOLDERID_Contacts,
2459 .type = CSIDL_Type_User,
2460 .category = KF_CATEGORY_PERUSER,
2461 .name = L"Contacts",
2462 .parent = &FOLDERID_Profile,
2463 .path = L"Contacts",
2464 .parsing = L"::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{56784854-C6CB-462B-8169-88E350ACB882}",
2465 .attributes = FILE_ATTRIBUTE_READONLY,
2467 },
2468 { /* 0x44 */
2469 .id = &FOLDERID_DeviceMetadataStore,
2470 .type = CSIDL_Type_Disallowed, /* FIXME */
2471 .category = KF_CATEGORY_COMMON,
2472 .name = L"Device Metadata Store",
2473 .parent = &FOLDERID_ProgramData,
2474 .path = L"Microsoft\\Windows\\DeviceMetadataStore",
2475 },
2476 { /* 0x45 */
2477 .id = &GUID_NULL,
2478 .type = CSIDL_Type_Disallowed,
2479 },
2480 { /* 0x46 */
2481 .id = &FOLDERID_DocumentsLibrary,
2482 .type = CSIDL_Type_Disallowed, /* FIXME */
2483 .category = KF_CATEGORY_PERUSER,
2484 .name = L"DocumentsLibrary",
2485 .parent = &FOLDERID_Libraries,
2486 .path = L"Documents.library-ms",
2487 .parsing = L"::{031E4825-7B94-4dc3-B131-E946B44C8DD5}\\{7b0db17d-9cd2-4a93-9733-46cc89022e7c}",
2488 .flags = KFDF_PRECREATE | KFDF_STREAM,
2489 },
2490 { /* 0x47 - CSIDL_DOWNLOADS */
2491 .id = &FOLDERID_Downloads,
2492 .type = CSIDL_Type_User,
2493 .category = KF_CATEGORY_PERUSER,
2494 .name = L"Downloads",
2495 .parent = &FOLDERID_Profile,
2496 .path = L"Downloads",
2497 .attributes = FILE_ATTRIBUTE_READONLY,
2499 },
2500 { /* 0x48 */
2501 .id = &FOLDERID_Games,
2502 .type = CSIDL_Type_Disallowed,
2503 .category = KF_CATEGORY_VIRTUAL,
2504 .name = L"Games",
2505 .parsing = L"::{ED228FDF-9EA8-4870-83b1-96b02CFE0D52}",
2506 },
2507 { /* 0x49 */
2508 .id = &FOLDERID_GameTasks,
2509 .type = CSIDL_Type_Disallowed, /* FIXME */
2510 .category = KF_CATEGORY_PERUSER,
2511 .name = L"GameTasks",
2512 .parent = &FOLDERID_LocalAppData,
2513 .path = L"Microsoft\\Windows\\GameExplorer",
2514 .flags = KFDF_LOCAL_REDIRECT_ONLY,
2515 },
2516 { /* 0x4a */
2517 .id = &FOLDERID_HomeGroup,
2518 .type = CSIDL_Type_Disallowed,
2519 .category = KF_CATEGORY_VIRTUAL,
2520 .name = L"HomeGroupFolder",
2521 .parsing = L"::{B4FB3F98-C1EA-428d-A78A-D1F5659CBA93}",
2522 },
2523 { /* 0x4b */
2524 .id = &FOLDERID_ImplicitAppShortcuts,
2525 .type = CSIDL_Type_User,
2526 .category = KF_CATEGORY_PERUSER,
2527 .name = L"ImplicitAppShortcuts",
2528 .parent = &FOLDERID_UserPinned,
2529 .path = L"ImplicitAppShortcuts",
2530 .flags = KFDF_PRECREATE,
2531 },
2532 { /* 0x4c */
2533 .id = &FOLDERID_Libraries,
2534 .type = CSIDL_Type_Disallowed, /* FIXME */
2535 .category = KF_CATEGORY_PERUSER,
2536 .name = L"Libraries",
2537 .parent = &FOLDERID_RoamingAppData,
2538 .path = L"Microsoft\\Windows\\Libraries",
2540 },
2541 { /* 0x4d - CSIDL_LINKS */
2542 .id = &FOLDERID_Links,
2543 .type = CSIDL_Type_User,
2544 .category = KF_CATEGORY_PERUSER,
2545 .name = L"Links",
2546 .parent = &FOLDERID_Profile,
2547 .path = L"Links",
2548 .parsing = L"::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{bfb9d5e0-c6a9-404c-b2b2-ae6db6af4968}",
2549 .attributes = FILE_ATTRIBUTE_READONLY,
2551 },
2552 { /* 0x4e - CSIDL_APPDATA_LOCALLOW */
2553 .id = &FOLDERID_LocalAppDataLow,
2554 .type = CSIDL_Type_User,
2555 .category = KF_CATEGORY_PERUSER,
2556 .name = L"LocalAppDataLow",
2557 .parent = &FOLDERID_Profile,
2558 .path = L"AppData\\LocalLow",
2561 },
2562 { /* 0x4f */
2563 .id = &FOLDERID_MusicLibrary,
2564 .type = CSIDL_Type_Disallowed, /* FIXME */
2565 .category = KF_CATEGORY_PERUSER,
2566 .name = L"MusicLibrary",
2567 .parent = &FOLDERID_Libraries,
2568 .path = L"Music.library-ms",
2569 .parsing = L"::{031E4825-7B94-4dc3-B131-E946B44C8DD5}\\{2112AB0A-C86A-4ffe-A368-0DE96E47012E}",
2570 .flags = KFDF_PRECREATE | KFDF_STREAM,
2571 },
2572 { /* 0x50 */
2573 .id = &FOLDERID_OriginalImages,
2574 .type = CSIDL_Type_Disallowed, /* FIXME */
2575 .category = KF_CATEGORY_PERUSER,
2576 .name = L"Original Images",
2577 .parent = &FOLDERID_LocalAppData,
2578 .path = L"Microsoft\\Windows Photo Gallery\\Original Images",
2579 },
2580 { /* 0x51 */
2581 .id = &FOLDERID_PhotoAlbums,
2582 .type = CSIDL_Type_User,
2583 .category = KF_CATEGORY_PERUSER,
2584 .name = L"PhotoAlbums",
2585 .parent = &FOLDERID_Pictures,
2586 .path = L"Slide Shows",
2587 .attributes = FILE_ATTRIBUTE_READONLY,
2588 },
2589 { /* 0x52 */
2590 .id = &FOLDERID_PicturesLibrary,
2591 .type = CSIDL_Type_Disallowed, /* FIXME */
2592 .category = KF_CATEGORY_PERUSER,
2593 .name = L"PicturesLibrary",
2594 .parent = &FOLDERID_Libraries,
2595 .path = L"Pictures.library-ms",
2596 .parsing = L"::{031E4825-7B94-4dc3-B131-E946B44C8DD5}\\{A990AE9F-A03B-4e80-94BC-9912D7504104}",
2597 .flags = KFDF_PRECREATE | KFDF_STREAM,
2598 },
2599 { /* 0x53 */
2600 .id = &FOLDERID_Playlists,
2601 .type = CSIDL_Type_User,
2602 .category = KF_CATEGORY_PERUSER,
2603 .name = L"Playlists",
2604 .parent = &FOLDERID_Music,
2605 .path = L"Playlists",
2606 .attributes = FILE_ATTRIBUTE_READONLY,
2607 },
2608 { /* 0x54 */
2609 .id = &FOLDERID_ProgramFilesX64,
2610#ifdef _WIN64
2611 .type = CSIDL_Type_CurrVer,
2612 .value = L"ProgramFilesDir",
2613 .def_path = L"Program Files",
2614#else
2615 .type = CSIDL_Type_NonExistent,
2616#endif
2617 .category = KF_CATEGORY_FIXED,
2618 .name = L"ProgramFilesX64",
2619 },
2620 { /* 0x55 */
2621 .id = &FOLDERID_ProgramFilesCommonX64,
2622#ifdef _WIN64
2623 .type = CSIDL_Type_CurrVer,
2624 .value = L"ProgramFilesCommonX64",
2625 .def_path = L"Program Files\\Common Files",
2626#else
2627 .type = CSIDL_Type_NonExistent,
2628#endif
2629 .category = KF_CATEGORY_FIXED,
2630 .name = L"ProgramFilesCommonX64",
2631 },
2632 { /* 0x56 */
2633 .id = &FOLDERID_Public,
2634 .type = CSIDL_Type_AllUsers,
2635 .category = KF_CATEGORY_FIXED,
2636 .name = L"Public",
2637 .parsing = L"::{4336a54d-038b-4685-ab02-99bb52d3fb8b}",
2638 .attributes = FILE_ATTRIBUTE_READONLY,
2639 .flags = KFDF_PRECREATE,
2640 },
2641 { /* 0x57 */
2642 .id = &FOLDERID_PublicDownloads,
2643 .type = CSIDL_Type_AllUsers,
2644 .category = KF_CATEGORY_COMMON,
2645 .name = L"CommonDownloads",
2646 .parent = &FOLDERID_Public,
2647 .path = L"Downloads",
2648 .attributes = FILE_ATTRIBUTE_READONLY,
2649 .flags = KFDF_PRECREATE,
2650 },
2651 { /* 0x58 */
2652 .id = &FOLDERID_PublicGameTasks,
2653 .type = CSIDL_Type_ProgramData,
2654 .category = KF_CATEGORY_COMMON,
2655 .name = L"PublicGameTasks",
2656 .parent = &FOLDERID_ProgramData,
2657 .path = L"Microsoft\\Windows\\GameExplorer",
2658 .flags = KFDF_LOCAL_REDIRECT_ONLY,
2659 },
2660 { /* 0x59 */
2661 .id = &FOLDERID_PublicLibraries,
2662 .type = CSIDL_Type_AllUsers,
2663 .category = KF_CATEGORY_COMMON,
2664 .name = L"PublicLibraries",
2665 .parent = &FOLDERID_Public,
2666 .path = L"Libraries",
2668 .flags = KFDF_PRECREATE,
2669 },
2670 { /* 0x5a */
2671 .id = &FOLDERID_PublicRingtones,
2672 .type = CSIDL_Type_ProgramData,
2673 .category = KF_CATEGORY_COMMON,
2674 .name = L"CommonRingtones",
2675 .parent = &FOLDERID_ProgramData,
2676 .path = L"Microsoft\\Windows\\Ringtones",
2677 .flags = KFDF_PRECREATE,
2678 },
2679 { /* 0x5b */
2680 .id = &FOLDERID_QuickLaunch,
2681 .type = CSIDL_Type_User,
2682 .category = KF_CATEGORY_PERUSER,
2683 .name = L"Quick Launch",
2684 .parent = &FOLDERID_RoamingAppData,
2685 .path = L"Microsoft\\Internet Explorer\\Quick Launch",
2686 },
2687 { /* 0x5c */
2688 .id = &FOLDERID_RecordedTVLibrary,
2689 .type = CSIDL_Type_Disallowed, /* FIXME */
2690 .category = KF_CATEGORY_COMMON,
2691 .name = L"RecordedTVLibrary",
2692 .parent = &FOLDERID_PublicLibraries,
2693 .path = L"RecordedTV.library-ms",
2694 .flags = KFDF_PRECREATE | KFDF_STREAM,
2695 },
2696 { /* 0x5d */
2697 .id = &FOLDERID_Ringtones,
2698 .type = CSIDL_Type_Disallowed, /* FIXME */
2699 .category = KF_CATEGORY_PERUSER,
2700 .name = L"Ringtones",
2701 .parent = &FOLDERID_LocalAppData,
2702 .path = L"Microsoft\\Windows\\Ringtones",
2703 .flags = KFDF_PRECREATE,
2704 },
2705 { /* 0x5e */
2706 .id = &FOLDERID_SampleMusic,
2707 .type = CSIDL_Type_AllUsers,
2708 .category = KF_CATEGORY_COMMON,
2709 .name = L"SampleMusic",
2710 .parent = &FOLDERID_PublicMusic,
2711 .path = L"Sample Music",
2712 .attributes = FILE_ATTRIBUTE_READONLY,
2713 .flags = KFDF_PRECREATE,
2714 },
2715 { /* 0x5f */
2716 .id = &FOLDERID_SamplePictures,
2717 .type = CSIDL_Type_AllUsers,
2718 .category = KF_CATEGORY_COMMON,
2719 .name = L"SamplePictures",
2720 .parent = &FOLDERID_PublicPictures,
2721 .path = L"Sample Pictures",
2722 .attributes = FILE_ATTRIBUTE_READONLY,
2723 .flags = KFDF_PRECREATE,
2724 },
2725 { /* 0x60 */
2726 .id = &FOLDERID_SamplePlaylists,
2727 .type = CSIDL_Type_AllUsers,
2728 .category = KF_CATEGORY_COMMON,
2729 .name = L"SamplePlaylists",
2730 .parent = &FOLDERID_PublicMusic,
2731 .path = L"Sample Playlists",
2732 .attributes = FILE_ATTRIBUTE_READONLY,
2733 .flags = KFDF_PRECREATE,
2734 },
2735 { /* 0x61 */
2736 .id = &FOLDERID_SampleVideos,
2737 .type = CSIDL_Type_AllUsers,
2738 .category = KF_CATEGORY_COMMON,
2739 .name = L"SampleVideos",
2740 .parent = &FOLDERID_PublicVideos,
2741 .path = L"Sample Videos",
2742 .attributes = FILE_ATTRIBUTE_READONLY,
2743 .flags = KFDF_PRECREATE,
2744 },
2745 { /* 0x62 - CSIDL_SAVED_GAMES */
2746 .id = &FOLDERID_SavedGames,
2747 .type = CSIDL_Type_User,
2748 .category = KF_CATEGORY_PERUSER,
2749 .name = L"SavedGames",
2750 .parent = &FOLDERID_Profile,
2751 .path = L"Saved Games",
2752 .parsing = L"::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}",
2753 .attributes = FILE_ATTRIBUTE_READONLY,
2755 },
2756 { /* 0x63 - CSIDL_SEARCHES */
2757 .id = &FOLDERID_SavedSearches,
2758 .type = CSIDL_Type_User,
2759 .category = KF_CATEGORY_PERUSER,
2760 .name = L"Searches",
2761 .parent = &FOLDERID_Profile,
2762 .path = L"Searches",
2763 .parsing = L"::{59031a47-3f72-44a7-89c5-5595fe6b30ee}\\{7d1d3a04-debb-4115-95cf-2f29da2920da}",
2764 .attributes = FILE_ATTRIBUTE_READONLY,
2766 },
2767 { /* 0x64 */
2768 .id = &FOLDERID_SEARCH_CSC,
2769 .type = CSIDL_Type_Disallowed,
2770 .category = KF_CATEGORY_VIRTUAL,
2771 .name = L"CSCFolder",
2772 .parsing = L"shell:::{BD7A2E7B-21CB-41b2-A086-B309680C6B7E}\\*",
2773 },
2774 { /* 0x65 */
2775 .id = &FOLDERID_SEARCH_MAPI,
2776 .type = CSIDL_Type_Disallowed,
2777 .category = KF_CATEGORY_VIRTUAL,
2778 .name = L"MAPIFolder",
2779 .parsing = L"shell:::{89D83576-6BD1-4C86-9454-BEB04E94C819}\\*",
2780 },
2781 { /* 0x66 */
2782 .id = &FOLDERID_SearchHome,
2783 .type = CSIDL_Type_Disallowed,
2784 .category = KF_CATEGORY_VIRTUAL,
2785 .name = L"SearchHomeFolder",
2786 .parsing = L"::{9343812e-1c37-4a49-a12e-4b2d810d956b}",
2787 },
2788 { /* 0x67 */
2789 .id = &FOLDERID_SidebarDefaultParts,
2790 .type = CSIDL_Type_Disallowed, /* FIXME */
2791 .category = KF_CATEGORY_COMMON,
2792 .name = L"Default Gadgets",
2793 .parent = &FOLDERID_ProgramFiles,
2794 .path = L"Windows Sidebar\\Gadgets",
2795 },
2796 { /* 0x68 */
2797 .id = &FOLDERID_SidebarParts,
2798 .type = CSIDL_Type_Disallowed, /* FIXME */
2799 .category = KF_CATEGORY_PERUSER,
2800 .name = L"Gadgets",
2801 .parent = &FOLDERID_LocalAppData,
2802 .path = L"Microsoft\\Windows Sidebar\\Gadgets",
2803 },
2804 { /* 0x69 */
2805 .id = &FOLDERID_SyncManagerFolder,
2806 .type = CSIDL_Type_Disallowed,
2807 .category = KF_CATEGORY_VIRTUAL,
2808 .name = L"SyncCenterFolder",
2809 .parsing = L"::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF}",
2810 },
2811 { /* 0x6a */
2812 .id = &FOLDERID_SyncResultsFolder,
2813 .type = CSIDL_Type_Disallowed,
2814 .category = KF_CATEGORY_VIRTUAL,
2815 .name = L"SyncResultsFolder",
2816 .parsing = L"::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF}\\::{BC48B32F-5910-47F5-8570-5074A8A5636A},",
2817 },
2818 { /* 0x6b */
2819 .id = &FOLDERID_SyncSetupFolder,
2820 .type = CSIDL_Type_Disallowed,
2821 .category = KF_CATEGORY_VIRTUAL,
2822 .name = L"SyncSetupFolder",
2823 .parsing = L"::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{9C73F5E5-7AE7-4E32-A8E8-8D23B85255BF}\\::{F1390A9A-A3F4-4E5D-9C5F-98F3BD8D935C},",
2824 },
2825 { /* 0x6c */
2826 .id = &FOLDERID_UserPinned,
2827 .type = CSIDL_Type_User,
2828 .category = KF_CATEGORY_PERUSER,
2829 .name = L"User Pinned",
2830 .parent = &FOLDERID_QuickLaunch,
2831 .path = L"User Pinned",
2832 .attributes = FILE_ATTRIBUTE_HIDDEN,
2833 .flags = KFDF_PRECREATE,
2834 },
2835 { /* 0x6d */
2836 .id = &FOLDERID_UserProfiles,
2837 .type = CSIDL_Type_CurrVer,
2838 .value = L"Users",
2839 .def_path = L"Users",
2840 .category = KF_CATEGORY_FIXED,
2841 .name = L"UserProfiles",
2842 .attributes = FILE_ATTRIBUTE_READONLY,
2843 .flags = KFDF_PRECREATE,
2844 },
2845 { /* 0x6e */
2846 .id = &FOLDERID_UserProgramFiles,
2847 .type = CSIDL_Type_User,
2848 .category = KF_CATEGORY_PERUSER,
2849 .name = L"UserProgramFiles",
2850 .parent = &FOLDERID_LocalAppData,
2851 .path = L"Programs",
2852 },
2853 { /* 0x6f */
2854 .id = &FOLDERID_UserProgramFilesCommon,
2855 .type = CSIDL_Type_Disallowed, /* FIXME */
2856 .category = KF_CATEGORY_PERUSER,
2857 .name = L"UserProgramFilesCommon",
2858 .parent = &FOLDERID_UserProgramFiles,
2859 .path = L"Common",
2860 },
2861 { /* 0x70 */
2862 .id = &FOLDERID_UsersFiles,
2863 .type = CSIDL_Type_Disallowed,
2864 .category = KF_CATEGORY_VIRTUAL,
2865 .name = L"UsersFilesFolder",
2866 .parsing = L"::{59031a47-3f72-44a7-89c5-5595fe6b30ee}",
2867 },
2868 { /* 0x71 */
2869 .id = &FOLDERID_UsersLibraries,
2870 .type = CSIDL_Type_Disallowed,
2871 .category = KF_CATEGORY_VIRTUAL,
2872 .name = L"UsersLibrariesFolder",
2873 .parsing = L"::{031E4825-7B94-4dc3-B131-E946B44C8DD5}",
2874 },
2875 { /* 0x72 */
2876 .id = &FOLDERID_VideosLibrary,
2877 .type = CSIDL_Type_Disallowed, /* FIXME */
2878 .category = KF_CATEGORY_PERUSER,
2879 .name = L"VideosLibrary",
2880 .path = L"Videos.library-ms",
2881 .parsing = L"::{031E4825-7B94-4dc3-B131-E946B44C8DD5}\\{491E922F-5643-4af4-A7EB-4E7A138D8174}",
2882 },
2883 { /* 0x73 */
2884 .id = &FOLDERID_AccountPictures,
2885 .type = CSIDL_Type_User,
2886 .category = KF_CATEGORY_PERUSER,
2887 .name = L"AccountPictures",
2888 .parent = &FOLDERID_RoamingAppData,
2889 .path = L"Microsoft\\Windows\\AccountPictures",
2890 .attributes = FILE_ATTRIBUTE_READONLY,
2891 .flags = KFDF_PRECREATE | KFDF_ROAMABLE,
2892 },
2893 { /* 0x74 */
2894 .id = &FOLDERID_Screenshots,
2895 .type = CSIDL_Type_User,
2896 .category = KF_CATEGORY_PERUSER,
2897 .name = L"Screenshots",
2898 .parent = &FOLDERID_Pictures,
2899 .path = L"Screenshots",
2900 .flags = KFDF_PRECREATE | KFDF_ROAMABLE,
2901 },
2902 { /* 0x75 */
2903 .id = &FOLDERID_AppDataDocuments,
2904 .type = CSIDL_Type_User,
2905 .category = KF_CATEGORY_PERUSER,
2906 .name = L"AppDataDocuments",
2907 .parent = &FOLDERID_LocalAppData,
2908 .path = L"Documents",
2909 .flags = KFDF_PRECREATE | KFDF_ROAMABLE,
2910 },
2911};
2912
2913static int csidl_from_id( const KNOWNFOLDERID *id )
2914{
2915 int i;
2916 for (i = 0; i < ARRAY_SIZE(CSIDL_Data); i++)
2917 if (IsEqualGUID( CSIDL_Data[i].id, id )) return i;
2918 return -1;
2919}
2920
2921#ifdef __REACTOS__
2922INT SHGetSpecialFolderID(_In_ LPCWSTR pszName)
2923{
2924 UINT csidl;
2925
2926 for (csidl = 0; csidl < _countof(CSIDL_Data); ++csidl)
2927 {
2928 const CSIDL_DATA *pData = &CSIDL_Data[csidl];
2929 if (pData->name && lstrcmpiW(pszName, pData->name) == 0)
2930 return csidl;
2931 }
2932
2933 return -1;
2934}
2935
2937{
2938 LPCWSTR pszPath, pchBackslash;
2940
2941 pchBackslash = StrChrW(pszStart, L'\\');
2942 if (pchBackslash)
2943 {
2944 *ppch = (LPWSTR)(pchBackslash + 1);
2945 *pcch = (pchBackslash - pszStart) + 1;
2946 StrCpyNW(szPath, pszStart, min(*pcch, _countof(szPath)));
2947 pszPath = szPath;
2948 }
2949 else
2950 {
2951 *ppch = NULL;
2952 *pcch = lstrlenW(pszStart);
2953 pszPath = pszStart;
2954 }
2955
2956 return SHGetSpecialFolderID(pszPath);
2957}
2958#endif
2959
2960#ifndef __REACTOS__
2962#else
2964#endif
2965
2966/* Gets the value named value from the registry key
2967 * rootKey\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
2968 * (or from rootKey\userPrefix\... if userPrefix is not NULL) into path, which
2969 * is assumed to be MAX_PATH WCHARs in length.
2970 * If it exists, expands the value and writes the expanded value to
2971 * rootKey\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
2972 * Returns successful error code if the value was retrieved from the registry,
2973 * and a failure otherwise.
2974 */
2975#ifndef __REACTOS__
2977#else
2978static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, HANDLE hToken, LPCWSTR userPrefix,
2979#endif
2981{
2982 HRESULT hr;
2983 WCHAR shellFolderPath[MAX_PATH], userShellFolderPath[MAX_PATH];
2984 LPCWSTR pShellFolderPath, pUserShellFolderPath;
2985 HKEY userShellFolderKey, shellFolderKey;
2986 DWORD dwType, dwPathLen;
2987
2988 TRACE("%p,%s,%s,%p\n",rootKey, debugstr_w(userPrefix), debugstr_w(value),
2989 path);
2990
2991 if (userPrefix)
2992 {
2993 lstrcpyW(shellFolderPath, userPrefix);
2994 PathAddBackslashW(shellFolderPath);
2995 lstrcatW(shellFolderPath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
2996 pShellFolderPath = shellFolderPath;
2997 lstrcpyW(userShellFolderPath, userPrefix);
2998 PathAddBackslashW(userShellFolderPath);
2999 lstrcatW(userShellFolderPath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders");
3000 pUserShellFolderPath = userShellFolderPath;
3001 }
3002 else
3003 {
3004 pUserShellFolderPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders";
3005 pShellFolderPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
3006 }
3007
3008 if (RegCreateKeyW(rootKey, pShellFolderPath, &shellFolderKey))
3009 {
3010 TRACE("Failed to create %s\n", debugstr_w(pShellFolderPath));
3011 return E_FAIL;
3012 }
3013 if (RegCreateKeyW(rootKey, pUserShellFolderPath, &userShellFolderKey))
3014 {
3015 TRACE("Failed to create %s\n",
3016 debugstr_w(pUserShellFolderPath));
3017 RegCloseKey(shellFolderKey);
3018 return E_FAIL;
3019 }
3020
3021 dwPathLen = MAX_PATH * sizeof(WCHAR);
3022 if (!RegQueryValueExW(userShellFolderKey, value, NULL, &dwType,
3023 (LPBYTE)path, &dwPathLen) && (dwType == REG_EXPAND_SZ || dwType == REG_SZ))
3024 {
3025 LONG ret;
3026
3027 path[dwPathLen / sizeof(WCHAR)] = '\0';
3028 if (dwType == REG_EXPAND_SZ && path[0] == '%')
3029 {
3030 WCHAR szTemp[MAX_PATH];
3031
3032#ifndef __REACTOS__
3034#else
3035 hr = _SHExpandEnvironmentStrings(hToken, path, szTemp, _countof(szTemp));
3036 if (FAILED(hr))
3037 goto end;
3038#endif
3039 lstrcpynW(path, szTemp, MAX_PATH);
3040 }
3041 ret = RegSetValueExW(shellFolderKey, value, 0, REG_SZ, (LPBYTE)path,
3042 (lstrlenW(path) + 1) * sizeof(WCHAR));
3043 if (ret != ERROR_SUCCESS)
3045 else
3046 hr = S_OK;
3047 }
3048 else
3049 hr = E_FAIL;
3050#ifdef __REACTOS__
3051end:
3052#endif
3053 RegCloseKey(shellFolderKey);
3054 RegCloseKey(userShellFolderKey);
3055 TRACE("returning 0x%08lx\n", hr);
3056 return hr;
3057}
3058
3060{
3061 if (CSIDL_Data[folder].path)
3062 {
3063 PathAddBackslashW(pszPath);
3064 lstrcatW(pszPath, CSIDL_Data[folder].path);
3065 }
3066 else if (CSIDL_Data[folder].def_path)
3067 {
3068 PathAddBackslashW(pszPath);
3069 lstrcatW(pszPath, CSIDL_Data[folder].def_path);
3070 }
3071}
3072
3073/* Gets a 'semi-expanded' default value of the CSIDL with index folder into
3074 * pszPath, based on the entries in CSIDL_Data. By semi-expanded, I mean:
3075 * - Depending on the entry's type, the path may begin with an (unexpanded)
3076 * environment variable name. The caller is responsible for expanding
3077 * environment strings if so desired.
3078 * The types that are prepended with environment variables are:
3079 * CSIDL_Type_User: %USERPROFILE%
3080 * CSIDL_Type_AllUsers: %ALLUSERSPROFILE%
3081 * CSIDL_Type_CurrVer: %SystemDrive%
3082 * (Others might make sense too, but as yet are unneeded.)
3083 */
3084#ifndef __REACTOS__
3086#else
3087static HRESULT _SHGetDefaultValue(HANDLE hToken, BYTE folder, LPWSTR pszPath)
3088#endif
3089{
3090 HRESULT hr;
3091
3092 TRACE("0x%02x,%p\n", folder, pszPath);
3093
3095 return E_INVALIDARG;
3096
3097 if (!pszPath)
3098 return E_INVALIDARG;
3099
3100#ifdef __REACTOS__
3101 if (hToken != NULL && hToken != (HANDLE)-1)
3102 {
3103 FIXME("unsupported for user other than current or default\n");
3104 }
3105#endif
3106
3107 if (!is_win64)
3108 {
3109 BOOL is_wow64;
3110
3111 switch (folder)
3112 {
3117 break;
3122 break;
3123 }
3124 }
3125
3126 if (!CSIDL_Data[folder].parent)
3127 {
3128 /* hit the root, sub in env var */
3129 switch (CSIDL_Data[folder].type)
3130 {
3131 case CSIDL_Type_User:
3132 lstrcpyW(pszPath, L"%USERPROFILE%");
3133 break;
3135 lstrcpyW(pszPath, L"%PUBLIC%");
3136 break;
3138 lstrcpyW(pszPath, L"%ProgramData%");
3139 break;
3140 case CSIDL_Type_CurrVer:
3141 lstrcpyW(pszPath, L"%SystemDrive%");
3142 break;
3143 default:
3144 ; /* no corresponding env. var, do nothing */
3145 }
3146 hr = S_OK;
3147 }else{
3148 /* prepend with parent */
3149#ifdef __REACTOS__
3151#else
3153#endif
3154 }
3155
3156 if (SUCCEEDED(hr))
3157 append_relative_path(folder, pszPath);
3158
3159 TRACE("returning 0x%08lx\n", hr);
3160 return hr;
3161}
3162
3163/* Gets the (unexpanded) value of the folder with index folder into pszPath.
3164 * The folder's type is assumed to be CSIDL_Type_CurrVer. Its default value
3165 * can be overridden in the HKLM\\Software\\Microsoft\\Windows\\CurrentVersion key.
3166 * If dwFlags has SHGFP_TYPE_DEFAULT set or if the value isn't overridden in
3167 * the registry, uses _SHGetDefaultValue to get the value.
3168 */
3170 LPWSTR pszPath)
3171{
3172 HRESULT hr;
3173
3174 TRACE("0x%08lx,0x%02x,%p\n", dwFlags, folder, pszPath);
3175
3177 return E_INVALIDARG;
3179 return E_INVALIDARG;
3180 if (!pszPath)
3181 return E_INVALIDARG;
3182
3184#ifndef __REACTOS__
3185 hr = _SHGetDefaultValue(folder, pszPath);
3186#else
3187 hr = _SHGetDefaultValue(NULL, folder, pszPath);
3188#endif
3189 else
3190 {
3191 HKEY hKey;
3192
3193 if (RegCreateKeyW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion", &hKey))
3194 hr = E_FAIL;
3195 else
3196 {
3197 DWORD dwType, dwPathLen = MAX_PATH * sizeof(WCHAR);
3198
3200 &dwType, (LPBYTE)pszPath, &dwPathLen) ||
3201 (dwType != REG_SZ && dwType != REG_EXPAND_SZ))
3202 {
3203#ifndef __REACTOS__
3204 hr = _SHGetDefaultValue(folder, pszPath);
3205#else
3206 hr = _SHGetDefaultValue(NULL, folder, pszPath);
3207#endif
3208 dwType = REG_EXPAND_SZ;
3209 switch (folder)
3210 {
3213 /* these two should never be set on 32-bit setups */
3214 if (!is_win64)
3215 {
3216 BOOL is_wow64;
3218 if (!is_wow64) break;
3219 }
3220 /* fall through */
3221 default:
3223 (LPBYTE)pszPath, (lstrlenW(pszPath)+1)*sizeof(WCHAR));
3224 }
3225 }
3226 else
3227 {
3228 pszPath[dwPathLen / sizeof(WCHAR)] = '\0';
3229 hr = S_OK;
3230 }
3232 }
3233 }
3234 TRACE("returning 0x%08lx (output path is %s)\n", hr, debugstr_w(pszPath));
3235 return hr;
3236}
3237
3239{
3240 char InfoBuffer[64];
3241 PTOKEN_USER UserInfo;
3242 DWORD InfoSize;
3243 LPWSTR SidStr;
3244
3245 UserInfo = (PTOKEN_USER) InfoBuffer;
3246 if (! GetTokenInformation(Token, TokenUser, InfoBuffer, sizeof(InfoBuffer),
3247 &InfoSize))
3248 {
3250 return NULL;
3251 UserInfo = malloc(InfoSize);
3252 if (UserInfo == NULL)
3253 return NULL;
3254 if (! GetTokenInformation(Token, TokenUser, UserInfo, InfoSize,
3255 &InfoSize))
3256 {
3257 free(UserInfo);
3258 return NULL;
3259 }
3260 }
3261
3262 if (! ConvertSidToStringSidW(UserInfo->User.Sid, &SidStr))
3263 SidStr = NULL;
3264
3265 if (UserInfo != (PTOKEN_USER) InfoBuffer)
3266 free(UserInfo);
3267
3268 return SidStr;
3269}
3270
3271/* Gets the user's path (unexpanded) for the CSIDL with index folder:
3272 * If SHGFP_TYPE_DEFAULT is set, calls _SHGetDefaultValue for it. Otherwise
3273 * calls _SHGetUserShellFolderPath for it. Where it looks depends on hToken:
3274 * - if hToken is -1, looks in HKEY_USERS\.Default
3275 * - otherwise looks first in HKEY_CURRENT_USER, followed by HKEY_LOCAL_MACHINE
3276 * if HKEY_CURRENT_USER doesn't contain any entries. If both fail, finally
3277 * calls _SHGetDefaultValue for it.
3278 */
3280 LPWSTR pszPath)
3281{
3282 const WCHAR *szValueName;
3283 WCHAR buffer[40];
3284 HRESULT hr;
3285
3286 TRACE("%p,0x%08lx,0x%02x,%p\n", hToken, dwFlags, folder, pszPath);
3287
3289 return E_INVALIDARG;
3291 return E_INVALIDARG;
3292 if (!pszPath)
3293 return E_INVALIDARG;
3294
3296 {
3297#ifndef __REACTOS__
3298 if (hToken != NULL && hToken != (HANDLE)-1)
3299 {
3300 FIXME("unsupported for user other than current or default\n");
3301 return E_FAIL;
3302 }
3303 hr = _SHGetDefaultValue(folder, pszPath);
3304#else
3305 hr = _SHGetDefaultValue(hToken, folder, pszPath);
3306#endif
3307 }
3308 else
3309 {
3310 static const WCHAR DefaultW[] = L".Default";
3311 LPCWSTR userPrefix = NULL;
3312 HKEY hRootKey;
3313
3314 if (hToken == (HANDLE)-1)
3315 {
3316 hRootKey = HKEY_USERS;
3317 userPrefix = DefaultW;
3318 }
3319 else if (hToken == NULL)
3320 hRootKey = HKEY_CURRENT_USER;
3321 else
3322 {
3323 hRootKey = HKEY_USERS;
3324 userPrefix = _GetUserSidStringFromToken(hToken);
3325 if (userPrefix == NULL)
3326 {
3327 hr = E_FAIL;
3328 goto error;
3329 }
3330 }
3331
3332 /* For CSIDL_Type_User we also use the GUID if no szValueName is provided */
3333 szValueName = CSIDL_Data[folder].value;
3334 if (!szValueName)
3335 {
3337 szValueName = &buffer[0];
3338 }
3339
3340#ifndef __REACTOS__
3341 hr = _SHGetUserShellFolderPath(hRootKey, userPrefix, szValueName, pszPath);
3342 if (FAILED(hr) && hRootKey != HKEY_LOCAL_MACHINE)
3343 hr = _SHGetUserShellFolderPath(HKEY_LOCAL_MACHINE, NULL, szValueName, pszPath);
3344 if (FAILED(hr))
3345 hr = _SHGetDefaultValue(folder, pszPath);
3346#else
3347 hr = _SHGetUserShellFolderPath(hRootKey, hToken, userPrefix, szValueName, pszPath);
3348 if (FAILED(hr) && hRootKey != HKEY_LOCAL_MACHINE)
3349 hr = _SHGetUserShellFolderPath(HKEY_LOCAL_MACHINE, hToken, NULL, szValueName, pszPath);
3350 if (FAILED(hr))
3351 hr = _SHGetDefaultValue(hToken, folder, pszPath);
3352#endif
3353 if (userPrefix != NULL && userPrefix != DefaultW)
3354 LocalFree((HLOCAL) userPrefix);
3355 }
3356error:
3357 TRACE("returning 0x%08lx (output path is %s)\n", hr, debugstr_w(pszPath));
3358 return hr;
3359}
3360
3361/* Gets the (unexpanded) path for the CSIDL with index folder. If dwFlags has
3362 * SHGFP_TYPE_DEFAULT set, calls _SHGetDefaultValue. Otherwise calls
3363 * _SHGetUserShellFolderPath for it, looking only in HKEY_LOCAL_MACHINE.
3364 * If this fails, falls back to _SHGetDefaultValue.
3365 */
3367 LPWSTR pszPath)
3368{
3369 HRESULT hr;
3370
3371 TRACE("0x%08lx,0x%02x,%p\n", dwFlags, folder, pszPath);
3372
3374 return E_INVALIDARG;
3376 return E_INVALIDARG;
3377 if (!pszPath)
3378 return E_INVALIDARG;
3379
3381#ifndef __REACTOS__
3382 hr = _SHGetDefaultValue(folder, pszPath);
3383#else
3384 hr = _SHGetDefaultValue(NULL, folder, pszPath);
3385#endif
3386 else
3387 {
3388#ifndef __REACTOS__
3390#else
3392#endif
3393 CSIDL_Data[folder].value, pszPath);
3394 if (FAILED(hr))
3395#ifndef __REACTOS__
3396 hr = _SHGetDefaultValue(folder, pszPath);
3397#else
3398 hr = _SHGetDefaultValue(NULL, folder, pszPath);
3399#endif
3400 }
3401 TRACE("returning 0x%08lx (output path is %s)\n", hr, debugstr_w(pszPath));
3402 return hr;
3403}
3404
3406{
3407 LONG lRet;
3408 DWORD disp;
3409
3410 lRet = RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList", 0, NULL, 0,
3411 KEY_ALL_ACCESS, NULL, pKey, &disp);
3412 return HRESULT_FROM_WIN32(lRet);
3413}
3414
3415/* Reads the value named szValueName from the key profilesKey (assumed to be
3416 * opened by _SHOpenProfilesKey) into szValue, which is assumed to be MAX_PATH
3417 * WCHARs in length. If it doesn't exist, returns szDefault (and saves
3418 * szDefault to the registry).
3419 */
3420static HRESULT _SHGetProfilesValue(HKEY profilesKey, LPCWSTR szValueName,
3421 LPWSTR szValue, LPCWSTR szDefault)
3422{
3423 HRESULT hr;
3424 DWORD type, dwPathLen = MAX_PATH * sizeof(WCHAR);
3425 LONG lRet;
3426
3427 TRACE("%p,%s,%p,%s\n", profilesKey, debugstr_w(szValueName), szValue,
3428 debugstr_w(szDefault));
3429 lRet = RegQueryValueExW(profilesKey, szValueName, NULL, &type,
3430 (LPBYTE)szValue, &dwPathLen);
3431 if (!lRet && (type == REG_SZ || type == REG_EXPAND_SZ) && dwPathLen
3432 && *szValue)
3433 {
3434 dwPathLen /= sizeof(WCHAR);
3435 szValue[dwPathLen] = '\0';
3436 hr = S_OK;
3437 }
3438 else
3439 {
3440 /* Missing or invalid value, set a default */
3441 lstrcpynW(szValue, szDefault, MAX_PATH);
3442 TRACE("Setting missing value %s to %s\n", debugstr_w(szValueName),
3443 debugstr_w(szValue));
3444 lRet = RegSetValueExW(profilesKey, szValueName, 0, REG_EXPAND_SZ,
3445 (LPBYTE)szValue,
3446 (lstrlenW(szValue) + 1) * sizeof(WCHAR));
3447 if (lRet)
3448 hr = HRESULT_FROM_WIN32(lRet);
3449 else
3450 hr = S_OK;
3451 }
3452 TRACE("returning 0x%08lx (output value is %s)\n", hr, debugstr_w(szValue));
3453 return hr;
3454}
3455
3456/* Attempts to expand environment variables from szSrc into szDest, which is
3457 * assumed to be MAX_PATH characters in length. Before referring to the
3458 * environment, handles a few variables directly, because the environment
3459 * variables may not be set when this is called (as during Wine's installation
3460 * when default values are being written to the registry).
3461 * The directly handled environment variables, and their source, are:
3462 * - ALLUSERSPROFILE, USERPROFILE: reads from the registry
3463 * - SystemDrive: uses GetSystemDirectoryW and uses the drive portion of its
3464 * path
3465 * If one of the directly handled environment variables is expanded, only
3466 * expands a single variable, and only in the beginning of szSrc.
3467 */
3468#ifndef __REACTOS__
3470#else
3472#endif
3473{
3474 HRESULT hr;
3475 WCHAR szTemp[MAX_PATH], szProfilesPrefix[MAX_PATH] = { 0 };
3476 HKEY key = NULL;
3477
3478 TRACE("%s, %p\n", debugstr_w(szSrc), szDest);
3479
3480 if (!szSrc || !szDest) return E_INVALIDARG;
3481
3482 /* short-circuit if there's nothing to expand */
3483 if (szSrc[0] != '%')
3484 {
3485 lstrcpyW(szDest, szSrc);
3486 hr = S_OK;
3487 goto end;
3488 }
3489
3490 /* Get the profile prefix, we'll probably be needing it */
3492 if (SUCCEEDED(hr))
3493 {
3494 WCHAR def_val[MAX_PATH];
3495
3496 /* get the system drive */
3497 GetSystemDirectoryW(def_val, MAX_PATH);
3498 lstrcpyW( def_val + 3, L"users" );
3499
3500 hr = _SHGetProfilesValue(key, L"ProfilesDirectory", szProfilesPrefix, def_val );
3501 }
3502
3503 *szDest = 0;
3504 lstrcpyW(szTemp, szSrc);
3505 while (SUCCEEDED(hr) && szTemp[0] == '%')
3506 {
3507 if (!wcsnicmp(szTemp, L"%ALLUSERSPROFILE%", lstrlenW(L"%ALLUSERSPROFILE%")))
3508 {
3509#ifndef __REACTOS__
3510 WCHAR szAllUsers[MAX_PATH], def_val[MAX_PATH];
3511
3512 GetSystemDirectoryW(def_val, MAX_PATH);
3513 lstrcpyW( def_val + 3, L"users\\Public" );
3514
3515 hr = _SHGetProfilesValue(key, L"Public", szAllUsers, def_val);
3516 PathAppendW(szDest, szAllUsers);
3517#else
3518 DWORD cchSize = cchDest;
3519 if (!GetAllUsersProfileDirectoryW(szDest, &cchSize))
3520 goto fallback_expand;
3521#endif
3522 PathAppendW(szDest, szTemp + lstrlenW(L"%ALLUSERSPROFILE%"));
3523 }
3524 else if (!wcsnicmp(szTemp, L"%PUBLIC%", lstrlenW(L"%PUBLIC%")))
3525 {
3526 WCHAR szAllUsers[MAX_PATH], def_val[MAX_PATH];
3527
3528 GetSystemDirectoryW(def_val, MAX_PATH);
3529 lstrcpyW( def_val + 3, L"users\\Public" );
3530
3531 hr = _SHGetProfilesValue(key, L"Public", szAllUsers, def_val);
3532 PathAppendW(szDest, szAllUsers);
3533 PathAppendW(szDest, szTemp + lstrlenW(L"%PUBLIC%"));
3534 }
3535 else if (!wcsnicmp(szTemp, L"%ProgramData%", lstrlenW(L"%ProgramData%")))
3536 {
3537 WCHAR szProgramData[MAX_PATH], def_val[MAX_PATH];
3538 HKEY shellFolderKey;
3539 DWORD dwType, dwPathLen = sizeof(def_val);
3540 BOOL in_registry = FALSE;
3541
3542 if (!RegCreateKeyW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &shellFolderKey))
3543 {
3544 if (!RegQueryValueExW(shellFolderKey, L"Common AppData", NULL, &dwType,
3545 (LPBYTE)def_val, &dwPathLen) && (dwType == REG_EXPAND_SZ || dwType == REG_SZ))
3546 in_registry = TRUE;
3547
3548 RegCloseKey(shellFolderKey);
3549 }
3550
3551 if (!in_registry)
3552 {
3553 GetSystemDirectoryW(def_val, MAX_PATH);
3554 lstrcpyW( def_val + 3, L"ProgramData" );
3555 }
3556
3557 hr = _SHGetProfilesValue(key, L"ProgramData", szProgramData, def_val);
3558 PathAppendW(szDest, szProgramData);
3559 PathAppendW(szDest, szTemp + lstrlenW(L"%ProgramData%"));
3560 }
3561 else if (!wcsnicmp(szTemp, L"%USERPROFILE%", lstrlenW(L"%USERPROFILE%")))
3562 {
3563#ifndef __REACTOS__
3565 DWORD userLen = MAX_PATH;
3566
3567 lstrcpyW(szDest, szProfilesPrefix);
3568 GetUserNameW(userName, &userLen);
3569 PathAppendW(szDest, userName);
3570#else
3571 DWORD cchSize = cchDest;
3572 if (!SHELL_GetUserProfileDirectoryW(hToken, szDest, &cchSize))
3573 goto fallback_expand;
3574#endif
3575 PathAppendW(szDest, szTemp + lstrlenW(L"%USERPROFILE%"));
3576 }
3577 else if (!wcsnicmp(szTemp, L"%SystemDrive%", lstrlenW(L"%SystemDrive%")))
3578 {
3579#ifndef __REACTOS__
3581#else
3582 if (!GetSystemDirectoryW(szDest, cchDest))
3583 goto fallback_expand;
3584#endif
3585 lstrcpyW(szDest + 3, szTemp + lstrlenW(L"%SystemDrive%") + 1);
3586 }
3587 else
3588#ifdef __REACTOS__
3589fallback_expand:
3590#endif
3591 {
3592#ifndef __REACTOS__
3593 DWORD ret = ExpandEnvironmentStringsW(szTemp, szDest, MAX_PATH);
3594#else
3595 DWORD ret = SHExpandEnvironmentStringsForUserW(hToken, szTemp, szDest, cchDest);
3596#endif
3597
3598#ifndef __REACTOS__
3599 if (ret > MAX_PATH)
3600#else
3601 if (ret > cchDest)
3602#endif
3604 else if (ret == 0)
3606 else if (!wcscmp( szTemp, szDest )) break; /* nothing expanded */
3607 }
3608 if (SUCCEEDED(hr)) lstrcpyW(szTemp, szDest);
3609 }
3610end:
3611#ifndef __REACTOS__
3612 if (key)
3614#endif
3615 TRACE("returning 0x%08lx (input was %s, output is %s)\n", hr,
3616 debugstr_w(szSrc), debugstr_w(szDest));
3617 return hr;
3618}
3619
3620#ifndef __REACTOS__
3621static char *xdg_config;
3623
3624static BOOL WINAPI init_xdg_dirs( INIT_ONCE *once, void *param, void **context )
3625{
3626 const WCHAR *var, *fmt = L"\\??\\unix%s/user-dirs.dirs";
3627 char *p;
3628 WCHAR *name, *ptr;
3629 HANDLE file;
3630 DWORD len;
3631
3632 if (!(var = _wgetenv( L"WINE_HOST_XDG_CONFIG_HOME" )) || var[0] != '/')
3633 {
3634 if (!(var = _wgetenv( L"WINEHOMEDIR" ))) return TRUE;
3635 fmt = L"%s/.config/user-dirs.dirs";
3636 }
3637 len = lstrlenW(var) + lstrlenW(fmt);
3638 name = malloc( len * sizeof(WCHAR) );
3639 swprintf( name, len, fmt, var );
3640 name[1] = '\\'; /* change \??\ to \\?\ */
3641 for (ptr = name; *ptr; ptr++) if (*ptr == '/') *ptr = '\\';
3642
3644 free( name );
3646 {
3647 len = GetFileSize( file, NULL );
3648 if (!(xdg_config = malloc( len + 1 ))) return TRUE;
3650 {
3651 free( xdg_config );
3652 xdg_config = NULL;
3653 }
3654 else
3655 {
3656 for (p = xdg_config; p < xdg_config + xdg_config_len; p++) if (*p == '\n') *p = 0;
3657 *p = 0; /* append null to simplify string parsing */
3658 }
3659 CloseHandle( file );
3660 }
3661 return TRUE;
3662}
3663
3664static char *get_xdg_path( const char *var )
3665{
3666 static INIT_ONCE once;
3667 char *p, *ret = NULL;
3668 int i;
3669
3671 if (!xdg_config) return NULL;
3672
3673 for (p = xdg_config; p < xdg_config + xdg_config_len; p += strlen(p) + 1)
3674 {
3675 while (*p == ' ' || *p == '\t') p++;
3676 if (strncmp( p, var, strlen(var) )) continue;
3677 p += strlen(var);
3678 while (*p == ' ' || *p == '\t') p++;
3679 if (*p != '=') continue;
3680 p++;
3681 while (*p == ' ' || *p == '\t') p++;
3682 if (*p != '"') continue;
3683 p++;
3684 if (*p != '/' && strncmp( p, "$HOME/", 6 )) continue;
3685
3686 if (!(ret = malloc( strlen(p) + 1 ))) break;
3687 for (i = 0; *p && *p != '"'; i++, p++)
3688 {
3689 if (*p == '\\' && p[1]) p++;
3690 ret[i] = *p;
3691 }
3692 ret[i] = 0;
3693 if (*p != '"')
3694 {
3695 free( ret );
3696 ret = NULL;
3697 }
3698 break;
3699 }
3700 return ret;
3701}
3702
3703static BOOL link_folder( HANDLE mgr, const UNICODE_STRING *path, const char *link )
3704{
3705 struct mountmgr_shell_folder *ioctl;
3706 DWORD len = sizeof(*ioctl) + path->Length + strlen(link) + 1;
3707 BOOL ret;
3708
3709 if (!(ioctl = malloc( len ))) return FALSE;
3710 ioctl->create_backup = FALSE;
3711 ioctl->folder_offset = sizeof(*ioctl);
3712 ioctl->folder_size = path->Length;
3713 memcpy( (char *)ioctl + ioctl->folder_offset, path->Buffer, ioctl->folder_size );
3714 ioctl->symlink_offset = ioctl->folder_offset + ioctl->folder_size;
3715 strcpy( (char *)ioctl + ioctl->symlink_offset, link );
3716
3717 ret = DeviceIoControl( mgr, IOCTL_MOUNTMGR_DEFINE_SHELL_FOLDER, ioctl, len, NULL, 0, NULL, NULL );
3718 free( ioctl );
3719 return ret;
3720}
3721
3722/******************************************************************************
3723 * create_link
3724 *
3725 * Sets up a symbolic link for one of the 'My Whatever' shell folders to point
3726 * into the corresponding XDG directory.
3727 */
3728static void create_link( const WCHAR *path, const char *xdg_name, const char *default_name )
3729{
3730 UNICODE_STRING nt_name;
3731 char *target = NULL;
3732 HANDLE mgr;
3733
3736 0, 0 )) == INVALID_HANDLE_VALUE)
3737 {
3738 FIXME( "failed to connect to mount manager\n" );
3739 return;
3740 }
3741
3742 nt_name.Buffer = NULL;
3743 if (!RtlDosPathNameToNtPathName_U( path, &nt_name, NULL, NULL )) goto done;
3744
3745 if ((target = get_xdg_path( xdg_name )))
3746 {
3747 if (link_folder( mgr, &nt_name, target )) goto done;
3748 }
3749 link_folder( mgr, &nt_name, default_name );
3750
3751done:
3752 RtlFreeUnicodeString( &nt_name );
3753 free( target );
3754 CloseHandle( mgr );
3755}
3756
3757/******************************************************************************
3758 * _SHCreateSymbolicLink [Internal]
3759 *
3760 * Sets up a symbolic link for one of the special shell folders to point into
3761 * the users home directory.
3762 *
3763 * PARAMS
3764 * nFolder [I] CSIDL identifying the folder.
3765 */
3766static void _SHCreateSymbolicLink(int nFolder, const WCHAR *path)
3767{
3769
3770 switch (folder) {
3771 case CSIDL_PERSONAL:
3772 create_link( path, "XDG_DOCUMENTS_DIR", "$HOME/Documents" );
3773 break;
3775 create_link( path, "XDG_DESKTOP_DIR", "$HOME/Desktop" );
3776 break;
3777 case CSIDL_MYPICTURES:
3778 create_link( path, "XDG_PICTURES_DIR", "$HOME/Pictures" );
3779 break;
3780 case CSIDL_MYVIDEO:
3781 create_link( path, "XDG_VIDEOS_DIR", "$HOME/Movies" );
3782 break;
3783 case CSIDL_MYMUSIC:
3784 create_link( path, "XDG_MUSIC_DIR", "$HOME/Music" );
3785 break;
3786 case CSIDL_DOWNLOADS:
3787 create_link( path, "XDG_DOWNLOAD_DIR", "$HOME/Downloads" );
3788 break;
3789 case CSIDL_TEMPLATES:
3790 create_link( path, "XDG_TEMPLATES_DIR", "$HOME/Templates" );
3791 break;
3792 }
3793}
3794#endif
3795
3796/******************************************************************************
3797 * SHGetFolderPathW [SHELL32.@]
3798 *
3799 * Convert nFolder to path.
3800 *
3801 * RETURNS
3802 * Success: S_OK
3803 * Failure: standard HRESULT error codes.
3804 *
3805 * NOTES
3806 * Most values can be overridden in either
3807 * HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
3808 * or in the same location in HKLM.
3809 * The "Shell Folders" registry key was used in NT4 and earlier systems.
3810 * Beginning with Windows 2000, the "User Shell Folders" key is used, so
3811 * changes made to it are made to the former key too. This synchronization is
3812 * done on-demand: not until someone requests the value of one of these paths
3813 * (by calling one of the SHGet functions) is the value synchronized.
3814 * Furthermore, the HKCU paths take precedence over the HKLM paths.
3815 */
3817 HWND hwndOwner, /* [I] owner window */
3818 int nFolder, /* [I] CSIDL identifying the folder */
3819 HANDLE hToken, /* [I] access token */
3820 DWORD dwFlags, /* [I] which path to return */
3821 LPWSTR pszPath) /* [O] converted path */
3822{
3823 HRESULT hr = SHGetFolderPathAndSubDirW(hwndOwner, nFolder, hToken, dwFlags, NULL, pszPath);
3826 return hr;
3827}
3828
3830 HWND hwndOwner, /* [I] owner window */
3831 int nFolder, /* [I] CSIDL identifying the folder */
3832 HANDLE hToken, /* [I] access token */
3833 DWORD dwFlags, /* [I] which path to return */
3834 LPCSTR pszSubPath, /* [I] sub directory of the specified folder */
3835 LPSTR pszPath) /* [O] converted path */
3836{
3837 int length;
3838 HRESULT hr = S_OK;
3839 LPWSTR pszSubPathW = NULL;
3840 LPWSTR pszPathW = NULL;
3841
3842 TRACE("%p,%#x,%p,%#lx,%s,%p\n", hwndOwner, nFolder, hToken, dwFlags, debugstr_a(pszSubPath), pszPath);
3843
3844 if(pszPath) {
3845 pszPathW = malloc(MAX_PATH * sizeof(WCHAR));
3846 if(!pszPathW) {
3848 goto cleanup;
3849 }
3850 }
3851 TRACE("%08x,%08lx,%s\n",nFolder, dwFlags, debugstr_w(pszSubPathW));
3852
3853 /* SHGetFolderPathAndSubDirW does not distinguish if pszSubPath isn't
3854 * set (null), or an empty string.therefore call it without the parameter set
3855 * if pszSubPath is an empty string
3856 */
3857 if (pszSubPath && pszSubPath[0]) {
3858 length = MultiByteToWideChar(CP_ACP, 0, pszSubPath, -1, NULL, 0);
3859 pszSubPathW = malloc(length * sizeof(WCHAR));
3860 if(!pszSubPathW) {
3862 goto cleanup;
3863 }
3864 MultiByteToWideChar(CP_ACP, 0, pszSubPath, -1, pszSubPathW, length);
3865 }
3866
3867 hr = SHGetFolderPathAndSubDirW(hwndOwner, nFolder, hToken, dwFlags, pszSubPathW, pszPathW);
3868
3869 if (SUCCEEDED(hr) && pszPath)
3870 WideCharToMultiByte(CP_ACP, 0, pszPathW, -1, pszPath, MAX_PATH, NULL, NULL);
3871
3872cleanup:
3873 free(pszPathW);
3874 free(pszSubPathW);
3875 return hr;
3876}
3877
3878/*************************************************************************
3879 * SHGetFolderPathAndSubDirW [SHELL32.@]
3880 */
3882 HWND hwndOwner, /* [I] owner window */
3883 int nFolder, /* [I] CSIDL identifying the folder */
3884 HANDLE hToken, /* [I] access token */
3885 DWORD dwFlags, /* [I] which path to return */
3886 LPCWSTR pszSubPath,/* [I] sub directory of the specified folder */
3887 LPWSTR pszPath) /* [O] converted path */
3888{
3889 HRESULT hr;
3890 WCHAR szBuildPath[MAX_PATH], szTemp[MAX_PATH];
3893 int ret;
3894
3895 TRACE("%p,%#x,%p,%#lx,%s,%p\n", hwndOwner, nFolder, hToken, dwFlags, debugstr_w(pszSubPath), pszPath);
3896
3897 /* Windows always NULL-terminates the resulting path regardless of success
3898 * or failure, so do so first
3899 */
3900 if (pszPath)
3901 *pszPath = '\0';
3902
3904 return E_INVALIDARG;
3906 return E_INVALIDARG;
3907 szTemp[0] = 0;
3909 switch (type)
3910 {
3912 hr = E_INVALIDARG;
3913 break;
3915 hr = S_FALSE;
3916 break;
3920 hr = S_OK;
3921 break;
3925 hr = S_OK;
3926 break;
3930 hr = S_OK;
3931 break;
3932 case CSIDL_Type_CurrVer:
3934 break;
3935 case CSIDL_Type_User:
3936 hr = _SHGetUserProfilePath(hToken, dwFlags, folder, szTemp);
3937 break;
3941 break;
3942 default:
3943 FIXME("bogus type %d, please fix\n", type);
3944 hr = E_INVALIDARG;
3945 break;
3946 }
3947
3948 /* Expand environment strings if necessary */
3949 if (*szTemp == '%')
3950#ifndef __REACTOS__
3951 hr = _SHExpandEnvironmentStrings(szTemp, szBuildPath);
3952#else
3953 hr = _SHExpandEnvironmentStrings(hToken, szTemp, szBuildPath, _countof(szBuildPath));
3954#endif
3955 else
3956 lstrcpyW(szBuildPath, szTemp);
3957
3958 if (FAILED(hr)) goto end;
3959
3960 if(pszSubPath) {
3961 /* make sure the new path does not exceed the buffer length
3962 * and remember to backslash and terminate it */
3963 if(MAX_PATH < (lstrlenW(szBuildPath) + lstrlenW(pszSubPath) + 2)) {
3965 goto end;
3966 }
3967 PathAppendW(szBuildPath, pszSubPath);
3968 PathRemoveBackslashW(szBuildPath);
3969 }
3970 /* Copy the path if it's available before we might return */
3971 if (SUCCEEDED(hr) && pszPath)
3972 lstrcpyW(pszPath, szBuildPath);
3973
3974 /* if we don't care about existing directories we are ready */
3976
3977 if (PathFileExistsW(szBuildPath)) goto end;
3978
3979 /* not existing but we are not allowed to create it. The return value
3980 * is verified against shell32 version 6.0.
3981 */
3982 if (!(nFolder & CSIDL_FLAG_CREATE))
3983 {
3985 goto end;
3986 }
3987
3988#ifndef __REACTOS__
3989 /* create symbolic links rather than directories for specific
3990 * user shell folders */
3991 if (!pszSubPath)
3992 _SHCreateSymbolicLink(folder, szBuildPath);
3993#endif
3994
3995 /* create directory/directories */
3996 ret = SHCreateDirectoryExW(hwndOwner, szBuildPath, NULL);
3997 if (ret && ret != ERROR_ALREADY_EXISTS)
3998 {
3999 ERR("Failed to create directory %s.\n", debugstr_w(szBuildPath));
4000 hr = E_FAIL;
4001 goto end;
4002 }
4003
4004 TRACE("Created missing system directory %s\n", debugstr_w(szBuildPath));
4005end:
4006#ifdef __REACTOS__
4007 /* create desktop.ini for custom icon */
4008 if ((nFolder & CSIDL_FLAG_CREATE) &&
4009 CSIDL_Data[folder].nShell32IconIndex)
4010 {
4011 WCHAR szIconLocation[MAX_PATH];
4013
4014 /* make the directory a read-only folder */
4015 dwAttributes = GetFileAttributesW(szBuildPath);
4017 SetFileAttributesW(szBuildPath, dwAttributes);
4018
4019 /* build the desktop.ini file path */
4020 PathAppendW(szBuildPath, L"desktop.ini");
4021
4022 /* build the icon location */
4023 StringCchPrintfW(szIconLocation, _countof(szIconLocation),
4024 L"%%SystemRoot%%\\system32\\shell32.dll,%d",
4025 CSIDL_Data[folder].nShell32IconIndex);
4026
4027 /* write desktop.ini */
4028 WritePrivateProfileStringW(L".ShellClassInfo", L"IconResource", szIconLocation, szBuildPath);
4029
4030 /* flush! */
4031 WritePrivateProfileStringW(NULL, NULL, NULL, szBuildPath);
4032
4033 /* make the desktop.ini a system and hidden file */
4034 dwAttributes = GetFileAttributesW(szBuildPath);
4036 SetFileAttributesW(szBuildPath, dwAttributes);
4037 }
4038#endif
4039 TRACE("returning 0x%08lx (final path is %s)\n", hr, debugstr_w(szBuildPath));
4040 return hr;
4041}
4042
4043/*************************************************************************
4044 * SHGetFolderPathA [SHELL32.@]
4045 *
4046 * See SHGetFolderPathW.
4047 */
4049 HWND hwndOwner,
4050 int nFolder,
4051 HANDLE hToken,
4052 DWORD dwFlags,
4053 LPSTR pszPath)
4054{
4055 WCHAR szTemp[MAX_PATH];
4056 HRESULT hr;
4057
4058 TRACE("%p,%d,%p,%#lx,%p\n", hwndOwner, nFolder, hToken, dwFlags, pszPath);
4059
4060 if (pszPath)
4061 *pszPath = '\0';
4062 hr = SHGetFolderPathW(hwndOwner, nFolder, hToken, dwFlags, szTemp);
4063 if (SUCCEEDED(hr) && pszPath)
4064 WideCharToMultiByte(CP_ACP, 0, szTemp, -1, pszPath, MAX_PATH, NULL,
4065 NULL);
4066
4067 return hr;
4068}
4069
4070/* For each folder in folders, if its value has not been set in the registry,
4071 * calls _SHGetUserProfilePath or _SHGetAllUsersProfilePath (depending on the
4072 * folder's type) to get the unexpanded value first.
4073 * Writes the unexpanded value to User Shell Folders, and queries it with
4074 * SHGetFolderPathW to force the creation of the directory if it doesn't
4075 * already exist. SHGetFolderPathW also returns the expanded value, which
4076 * this then writes to Shell Folders.
4077 */
4078static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken,
4079 LPCWSTR szUserShellFolderPath, LPCWSTR szShellFolderPath, const UINT folders[],
4080 UINT foldersLen)
4081{
4082 const WCHAR *szValueName;
4083 WCHAR buffer[40];
4084 UINT i;
4086 HRESULT hr = S_OK;
4087 HKEY hUserKey = NULL, hKey = NULL;
4088 DWORD dwType, dwPathLen;
4089 LONG ret;
4090
4091 TRACE("%p,%p,%s,%p,%u\n", hRootKey, hToken,
4092 debugstr_w(szUserShellFolderPath), folders, foldersLen);
4093
4094 ret = RegCreateKeyW(hRootKey, szUserShellFolderPath, &hUserKey);
4095 if (ret)
4097 else
4098 {
4099 ret = RegCreateKeyW(hRootKey, szShellFolderPath, &hKey);
4100 if (ret)
4102 }
4103 for (i = 0; SUCCEEDED(hr) && i < foldersLen; i++)
4104 {
4105 dwPathLen = MAX_PATH * sizeof(WCHAR);
4106
4107 /* For CSIDL_Type_User we also use the GUID if no szValueName is provided */
4108 szValueName = CSIDL_Data[folders[i]].value;
4109 if (!szValueName && CSIDL_Data[folders[i]].type == CSIDL_Type_User)
4110 {
4111 StringFromGUID2( CSIDL_Data[folders[i]].id, buffer, 39 );
4112 szValueName = &buffer[0];
4113 }
4114
4115 if (RegQueryValueExW(hUserKey, szValueName, NULL,
4116 &dwType, (LPBYTE)path, &dwPathLen) || (dwType != REG_SZ &&
4117 dwType != REG_EXPAND_SZ))
4118 {
4119 *path = '\0';
4120 if (CSIDL_Data[folders[i]].type == CSIDL_Type_User)
4121 _SHGetUserProfilePath(hToken, SHGFP_TYPE_DEFAULT, folders[i],
4122 path);
4123 else if (CSIDL_Data[folders[i]].type == CSIDL_Type_AllUsers ||
4126 else if (CSIDL_Data[folders[i]].type == CSIDL_Type_WindowsPath)
4127 {
4129 append_relative_path(folders[i], path);
4130 }
4131 else
4132 hr = E_FAIL;
4133 if (*path)
4134 {
4135 ret = RegSetValueExW(hUserKey, szValueName, 0, REG_EXPAND_SZ,
4136 (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR));
4137 if (ret)
4139 else
4140 {
4142 hToken, SHGFP_TYPE_DEFAULT, path);
4143 ret = RegSetValueExW(hKey, szValueName, 0, REG_SZ,
4144 (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR));
4145 if (ret)
4147 }
4148 }
4149 }
4150 else
4151 {
4152 /* create the default dir, which may be different from the path
4153 * stored in the registry. */
4155 hToken, SHGFP_TYPE_DEFAULT, path);
4156 }
4157 }
4158 if (hUserKey)
4159 RegCloseKey(hUserKey);
4160 if (hKey)
4162
4163 TRACE("returning 0x%08lx\n", hr);
4164 return hr;
4165}
4166
4168{
4169 static const UINT folders[] = {
4197 };
4198 WCHAR userShellFolderPath[MAX_PATH], shellFolderPath[MAX_PATH];
4199 LPCWSTR pUserShellFolderPath, pShellFolderPath;
4200 HRESULT hr = S_OK;
4201 HKEY hRootKey;
4202 HANDLE hToken;
4203
4204 TRACE("%s\n", bDefault ? "TRUE" : "FALSE");
4205 if (bDefault)
4206 {
4207 hToken = (HANDLE)-1;
4208 hRootKey = HKEY_USERS;
4209 lstrcpyW(userShellFolderPath, L".Default");
4210 PathAddBackslashW(userShellFolderPath);
4211 lstrcatW(userShellFolderPath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders");
4212 pUserShellFolderPath = userShellFolderPath;
4213 lstrcpyW(shellFolderPath, L".Default");
4214 PathAddBackslashW(shellFolderPath);
4215 lstrcatW(shellFolderPath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
4216 pShellFolderPath = shellFolderPath;
4217 }
4218 else
4219 {
4220 hToken = NULL;
4221 hRootKey = HKEY_CURRENT_USER;
4222 pUserShellFolderPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders";
4223 pShellFolderPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
4224 }
4225
4226 hr = _SHRegisterFolders(hRootKey, hToken, pUserShellFolderPath,
4227 pShellFolderPath, folders, ARRAY_SIZE(folders));
4228 TRACE("returning 0x%08lx\n", hr);
4229 return hr;
4230}
4231
4233{
4234 static const UINT folders[] = {
4247 };
4248 HRESULT hr;
4249
4250 TRACE("\n");
4252 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders",
4253 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
4254 folders, ARRAY_SIZE(folders));
4255 TRACE("returning 0x%08lx\n", hr);
4256 return hr;
4257}
4258
4259#ifndef __REACTOS__
4260/******************************************************************************
4261 * create_extra_folders [Internal]
4262 *
4263 * Create some extra folders that don't have a standard CSIDL definition.
4264 */
4266{
4267 WCHAR path[MAX_PATH+5];
4268 HRESULT hr;
4269 HKEY hkey;
4270 DWORD type, size, ret;
4271
4272 ret = RegCreateKeyW( HKEY_CURRENT_USER, L"Environment", &hkey );
4273 if (ret) return HRESULT_FROM_WIN32( ret );
4274
4276 SHGFP_TYPE_DEFAULT, L"Temp", path );
4277 if (SUCCEEDED(hr))
4278 {
4279 size = sizeof(path);
4280 if (RegQueryValueExW( hkey, L"TEMP", NULL, &type, (LPBYTE)path, &size ))
4281 RegSetValueExW( hkey, L"TEMP", 0, REG_SZ, (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR) );
4282 size = sizeof(path);
4283 if (RegQueryValueExW( hkey, L"TMP", NULL, &type, (LPBYTE)path, &size ))
4284 RegSetValueExW( hkey, L"TMP", 0, REG_SZ, (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR) );
4285 }
4286 RegCloseKey( hkey );
4287
4288 if (SUCCEEDED(hr))
4289 {
4291 SHGFP_TYPE_DEFAULT, L"Microsoft", path );
4292 }
4293 if (SUCCEEDED(hr))
4294 {
4296 SHGFP_TYPE_DEFAULT, L"Microsoft\\Windows\\Themes", path);
4297 }
4298 if (SUCCEEDED(hr))
4299 {
4301 SHGFP_TYPE_DEFAULT, L"Microsoft\\Windows\\AccountPictures", path);
4302 }
4303 if (SUCCEEDED(hr))
4304 {
4306 SHGFP_TYPE_DEFAULT, L"Screenshots", path);
4307 }
4308 return hr;
4309}
4310#endif
4311
4312
4313/******************************************************************************
4314 * set_folder_attributes
4315 *
4316 * Set the various folder attributes registry keys.
4317 */
4319{
4320 static const struct
4321 {
4322 const CLSID *clsid;
4323 unsigned int wfparsing : 1;
4324 unsigned int wfdisplay : 1;
4325 unsigned int hideasdel : 1;
4326 DWORD attr;
4327 DWORD call_for_attr;
4328 } folders[] =
4329 {
4330#ifndef __REACTOS__
4333 SFGAO_FILESYSANCESTOR|SFGAO_FOLDER|SFGAO_HASSUBFOLDER, SFGAO_FILESYSTEM },
4334#endif
4335 { &CLSID_FolderShortcut, FALSE, FALSE, FALSE,
4336 SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_LINK,
4337 SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR },
4338 { &CLSID_MyDocuments, TRUE, FALSE, FALSE,
4339 SFGAO_FILESYSANCESTOR|SFGAO_FOLDER|SFGAO_HASSUBFOLDER, SFGAO_FILESYSTEM },
4340 { &CLSID_RecycleBin, FALSE, FALSE, FALSE,
4341 SFGAO_FOLDER|SFGAO_DROPTARGET|SFGAO_HASPROPSHEET },
4342 { &CLSID_ControlPanel, FALSE, TRUE, TRUE,
4343 SFGAO_FOLDER|SFGAO_HASSUBFOLDER },
4344 { &CLSID_Printers, FALSE, FALSE, FALSE,
4345 SFGAO_FOLDER|SFGAO_CANLINK }
4346 };
4347
4348 unsigned int i;
4349 WCHAR buffer[39 + ARRAY_SIZE(L"CLSID\\") + ARRAY_SIZE(L"\\ShellFolder")];
4350 LONG res;
4351 HKEY hkey;
4352
4353 for (i = 0; i < ARRAY_SIZE(folders); i++)
4354 {
4355 lstrcpyW( buffer, L"CLSID\\" );
4356 StringFromGUID2( folders[i].clsid, buffer + lstrlenW(buffer), 39 );
4357 lstrcatW( buffer, L"\\ShellFolder" );
4359 KEY_READ | KEY_WRITE, NULL, &hkey, NULL);
4360 if (res) return HRESULT_FROM_WIN32( res );
4361 if (folders[i].wfparsing)
4362 res = RegSetValueExW( hkey, L"WantsFORPARSING", 0, REG_SZ, (const BYTE *)L"", sizeof(WCHAR) );
4363 if (folders[i].wfdisplay)
4364 res = RegSetValueExW( hkey, L"WantsFORDISPLAY", 0, REG_SZ, (const BYTE *)L"", sizeof(WCHAR) );
4365 if (folders[i].hideasdel)
4366 res = RegSetValueExW( hkey, L"HideAsDeletePerUser", 0, REG_SZ, (const BYTE *)L"", sizeof(WCHAR) );
4367 if (folders[i].attr)
4368 res = RegSetValueExW( hkey, L"Attributes", 0, REG_DWORD,
4369 (const BYTE *)&folders[i].attr, sizeof(DWORD));
4370 if (folders[i].call_for_attr)
4371 res = RegSetValueExW( hkey, L"CallForAttributes", 0, REG_DWORD,
4372 (const BYTE *)&folders[i].call_for_attr, sizeof(DWORD));
4373 RegCloseKey( hkey );
4374 }
4375 return S_OK;
4376}
4377
4378/*************************************************************************
4379 * SHGetSpecialFolderPathA [SHELL32.@]
4380 */
4382 HWND hwndOwner,
4383 LPSTR szPath,
4384 int nFolder,
4385 BOOL bCreate)
4386{
4387 return SHGetFolderPathA(hwndOwner, nFolder + (bCreate ? CSIDL_FLAG_CREATE : 0), NULL, 0,
4388 szPath) == S_OK;
4389}
4390
4391/*************************************************************************
4392 * SHGetSpecialFolderPathW
4393 */
4395 HWND hwndOwner,
4396 LPWSTR szPath,
4397 int nFolder,
4398 BOOL bCreate)
4399{
4400 return SHGetFolderPathW(hwndOwner, nFolder + (bCreate ? CSIDL_FLAG_CREATE : 0), NULL, 0,
4401 szPath) == S_OK;
4402}
4403
4404#ifdef __REACTOS__
4405HRESULT SHGetFolderLocationHelper(HWND hwnd, int nFolder, REFCLSID clsid, LPITEMIDLIST *ppidl)
4406{
4407 HRESULT hr;
4408 IShellFolder *psf;
4410 SHSTDAPI SHBindToObject(IShellFolder *psf, LPCITEMIDLIST pidl, IBindCtx *pBindCtx, REFIID riid, void **ppvObj);
4411 *ppidl = NULL;
4413 return hr;
4414 if (SUCCEEDED(hr = SHBindToObject(NULL, parent, NULL, &IID_IShellFolder, (void**)&psf)))
4415 {
4416 WCHAR clsidstr[2 + 38 + 1];
4417 clsidstr[0] = clsidstr[1] = L':';
4418 StringFromGUID2(clsid, clsidstr + 2, 38 + 1);
4419 hr = IShellFolder_ParseDisplayName(psf, hwnd, NULL, clsidstr, NULL, &child, NULL);
4420 if (SUCCEEDED(hr))
4421 *ppidl = ILCombine(parent, child);
4422 IShellFolder_Release(psf);
4423 ILFree(child);
4424 }
4425 ILFree(parent);
4426 return hr;
4427}
4428#endif
4429
4430/*************************************************************************
4431 * SHGetSpecialFolderPath (SHELL32.175)
4432 */
4434 HWND hwndOwner,
4435 LPVOID szPath,
4436 int nFolder,
4437 BOOL bCreate)
4438
4439{
4440 if (SHELL_OsIsUnicode())
4441 return SHGetSpecialFolderPathW (hwndOwner, szPath, nFolder, bCreate);
4442 return SHGetSpecialFolderPathA (hwndOwner, szPath, nFolder, bCreate);
4443}
4444
4445/*************************************************************************
4446 * SHGetFolderLocation [SHELL32.@]
4447 *
4448 * Gets the folder locations from the registry and creates a pidl.
4449 *
4450 * PARAMS
4451 * hwndOwner [I]
4452 * nFolder [I] CSIDL_xxxxx
4453 * hToken [I] token representing user, or NULL for current user, or -1 for
4454 * default user
4455 * dwReserved [I] must be zero
4456 * ppidl [O] PIDL of a special folder
4457 *
4458 * RETURNS
4459 * Success: S_OK
4460 * Failure: Standard OLE-defined error result, S_FALSE or E_INVALIDARG
4461 *
4462 * NOTES
4463 * Creates missing reg keys and directories.
4464 * Mostly forwards to SHGetFolderPathW, but a few values of nFolder return
4465 * virtual folders that are handled here.
4466 */
4468 HWND hwndOwner,
4469 int nFolder,
4470 HANDLE hToken,
4472 LPITEMIDLIST *ppidl)
4473{
4475#ifdef __REACTOS__
4477#endif
4478
4479 TRACE("%p 0x%08x %p 0x%08lx %p\n",
4480 hwndOwner, nFolder, hToken, dwReserved, ppidl);
4481
4482 if (!ppidl)
4483 return E_INVALIDARG;
4484 if (dwReserved)
4485 return E_INVALIDARG;
4486
4487#ifdef __REACTOS__
4488 if ((nFolder & CSIDL_FLAG_NO_ALIAS) &&
4490 {
4491 *ppidl = ILCreateFromPathW(szPath);
4492 if (*ppidl)
4493 return S_OK;
4494 }
4495#endif
4496 /* The virtual folders' locations are not user-dependent */
4497 *ppidl = NULL;
4498 switch (nFolder & CSIDL_FOLDER_MASK)
4499 {
4500 case CSIDL_DESKTOP:
4501 *ppidl = _ILCreateDesktop();
4502 break;
4503
4504 case CSIDL_PERSONAL:
4505 *ppidl = _ILCreateMyDocuments();
4506 break;
4507
4508 case CSIDL_INTERNET:
4509 *ppidl = _ILCreateIExplore();
4510 break;
4511
4512 case CSIDL_CONTROLS:
4513 *ppidl = _ILCreateControlPanel();
4514 break;
4515
4516 case CSIDL_PRINTERS:
4517 *ppidl = _ILCreatePrinters();
4518 break;
4519
4520 case CSIDL_BITBUCKET:
4521 *ppidl = _ILCreateBitBucket();
4522 break;
4523
4524 case CSIDL_DRIVES:
4525 *ppidl = _ILCreateMyComputer();
4526 break;
4527
4528 case CSIDL_NETWORK:
4529 *ppidl = _ILCreateNetwork();
4530 break;
4531
4532#ifdef __REACTOS__
4533 case CSIDL_CONNECTIONS:
4534 hr = SHGetFolderLocationHelper(hwndOwner, CSIDL_CONTROLS, &CLSID_NetworkConnections, ppidl);
4535 break;
4536#endif
4537
4538 default:
4539 {
4541
4542 hr = SHGetFolderPathW(hwndOwner, nFolder, hToken,
4544 if (SUCCEEDED(hr))
4545 {
4546 DWORD attributes=0;
4547
4548 TRACE("Value=%s\n", debugstr_w(szPath));
4550 }
4552 {
4553 /* unlike SHGetFolderPath, SHGetFolderLocation in shell32
4554 * version 6.0 returns E_FAIL for nonexistent paths
4555 */
4556 hr = E_FAIL;
4557 }
4558 }
4559 }
4560 if(*ppidl)
4561 hr = S_OK;
4562
4563 TRACE("-- (new pidl %p)\n",*ppidl);
4564 return hr;
4565}
4566
4567/*************************************************************************
4568 * SHGetSpecialFolderLocation [SHELL32.@]
4569 *
4570 * NOTES
4571 * In NT5, SHGetSpecialFolderLocation needs the <winntdir>/Recent
4572 * directory.
4573 */
4575 HWND hwndOwner,
4576 INT nFolder,
4577 LPITEMIDLIST * ppidl)
4578{
4580
4581 TRACE("(%p,0x%x,%p)\n", hwndOwner,nFolder,ppidl);
4582
4583 if (!ppidl)
4584 return E_INVALIDARG;
4585
4586 hr = SHGetFolderLocation(hwndOwner, nFolder, NULL, 0, ppidl);
4587 return hr;
4588}
4589
4590/*************************************************************************
4591 * SHGetKnownFolderPath [SHELL32.@]
4592 */
4594{
4596 HRESULT hr;
4597 int folder = csidl_from_id(rfid), shgfp_flags;
4598
4599 TRACE("%s, 0x%08lx, %p, %p\n", debugstr_guid(rfid), flags, token, ret_path);
4600
4601 *ret_path = NULL;
4602
4603 if (folder < 0)
4605
4608 {
4609 FIXME("flags 0x%08lx not supported\n", flags);
4610 return E_INVALIDARG;
4611 }
4612
4614 {
4615 WARN("Invalid flags mask %#lx.\n", flags);
4616 return E_INVALIDARG;
4617 }
4618
4620 {
4621 FIXME("Ignoring KF_FLAG_NOT_PARENT_RELATIVE.\n");
4622 flags &= ~KF_FLAG_NOT_PARENT_RELATIVE;
4623 }
4624
4627
4628 hr = SHGetFolderPathAndSubDirW( 0, folder, token, shgfp_flags, NULL, pathW );
4629 if (FAILED( hr ))
4630 {
4631 TRACE("Failed to get folder path, %#lx.\n", hr);
4632 return hr;
4633 }
4634
4635 TRACE("Final path is %s, %#lx\n", debugstr_w(pathW), hr);
4636
4637 *ret_path = CoTaskMemAlloc((lstrlenW(pathW) + 1) * sizeof(WCHAR));
4638 if (!*ret_path)
4639 return E_OUTOFMEMORY;
4640 lstrcpyW(*ret_path, pathW);
4641
4642 return hr;
4643}
4644
4645/*************************************************************************
4646 * SHGetFolderPathEx [SHELL32.@]
4647 */
4649{
4650 HRESULT hr;
4651 WCHAR *buffer;
4652
4653 TRACE("%s, 0x%08lx, %p, %p, %lu\n", debugstr_guid(rfid), flags, token, path, len);
4654
4655 if (!path || !len) return E_INVALIDARG;
4656
4658 if (SUCCEEDED( hr ))
4659 {
4660 if (lstrlenW( buffer ) + 1 > len)
4661 {
4664 }
4665 lstrcpyW( path, buffer );
4667 }
4668 return hr;
4669}
4670
4671/*
4672 * Internal function to convert known folder identifier to path of registry key
4673 * associated with known folder.
4674 *
4675 * Parameters:
4676 * rfid [I] pointer to known folder identifier (may be NULL)
4677 * lpStringGuid [I] string with known folder identifier (used when rfid is NULL)
4678 * lpPath [O] place to store string address. String should be
4679 * later freed using HeapFree(GetProcessHeap(),0, ... )
4680 */
4682 REFKNOWNFOLDERID rfid,
4683 LPWSTR lpStringGuid,
4684 LPWSTR *lpPath)
4685{
4686 HRESULT hr = S_OK;
4687 int length;
4688 WCHAR sGuid[50];
4689
4690 TRACE("(%s, %s, %p)\n", debugstr_guid(rfid), debugstr_w(lpStringGuid), lpPath);
4691
4692 if(rfid)
4693 StringFromGUID2(rfid, sGuid, ARRAY_SIZE(sGuid));
4694 else
4695 lstrcpyW(sGuid, lpStringGuid);
4696
4697 length = lstrlenW(L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FolderDescriptions")+51;
4698 *lpPath = malloc(length * sizeof(WCHAR));
4699 if(!(*lpPath))
4700 hr = E_OUTOFMEMORY;
4701
4702 if(SUCCEEDED(hr))
4703 {
4704 lstrcpyW(*lpPath, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FolderDescriptions\\");
4705 lstrcatW(*lpPath, sGuid);
4706 }
4707
4708 return hr;
4709}
4710
4711static HRESULT get_known_folder_wstr(const WCHAR *regpath, const WCHAR *value, WCHAR **out)
4712{
4713 DWORD size = 0;
4714 HRESULT hr;
4715
4716 size = 0;
4718 if(FAILED(hr))
4719 return hr;
4720
4722 if(!*out)
4723 return E_OUTOFMEMORY;
4724
4726 if(FAILED(hr)){
4728 *out = NULL;
4729 }
4730
4731 return hr;
4732}
4733
4735{
4736 DWORD dwSize = sizeof(DWORD);
4737 DWORD dwType;
4739}
4740
4741/*
4742 * Internal function to get place where folder redirection information are stored.
4743 *
4744 * Parameters:
4745 * rfid [I] pointer to known folder identifier (may be NULL)
4746 * rootKey [O] root key where the redirection information are stored
4747 * It can be HKLM for COMMON folders, and HKCU for PERUSER folders.
4748 */
4750 REFKNOWNFOLDERID rfid,
4751 HKEY *rootKey)
4752{
4753 HRESULT hr;
4754 LPWSTR lpRegistryPath = NULL;
4756
4757 /* first, get known folder's category */
4758 hr = get_known_folder_registry_path(rfid, NULL, &lpRegistryPath);
4759
4760 if(SUCCEEDED(hr))
4761 hr = get_known_folder_dword(lpRegistryPath, L"Category", &category);
4762
4763 if(SUCCEEDED(hr))
4764 {
4765 if(category == KF_CATEGORY_COMMON)
4766 {
4767 *rootKey = HKEY_LOCAL_MACHINE;
4768 hr = S_OK;
4769 }
4770 else if(category == KF_CATEGORY_PERUSER)
4771 {
4772 *rootKey = HKEY_CURRENT_USER;
4773 hr = S_OK;
4774 }
4775 else
4776 hr = E_FAIL;
4777 }
4778
4779 free(lpRegistryPath);
4780 return hr;
4781}
4782
4783static HRESULT get_known_folder_path_by_id(REFKNOWNFOLDERID folderId, LPWSTR lpRegistryPath, DWORD dwFlags, LPWSTR *ppszPath);
4784
4786 REFKNOWNFOLDERID rfid,
4787 HWND hwnd,
4788 KF_REDIRECT_FLAGS flags,
4789 LPCWSTR pszTargetPath,
4790 UINT cFolders,
4791 KNOWNFOLDERID const *pExclusion,
4792 LPWSTR *ppszError)
4793{
4794 HRESULT hr;
4795 HKEY rootKey = HKEY_LOCAL_MACHINE, hKey;
4796 WCHAR sGuid[39];
4797 LPWSTR lpRegistryPath = NULL, lpSrcPath = NULL;
4798 TRACE("(%s, %p, 0x%08x, %s, %d, %p, %p)\n", debugstr_guid(rfid), hwnd, flags, debugstr_w(pszTargetPath), cFolders, pExclusion, ppszError);
4799
4800 if (ppszError) *ppszError = NULL;
4801
4802 hr = get_known_folder_registry_path(rfid, NULL, &lpRegistryPath);
4803
4804 if(SUCCEEDED(hr))
4805 hr = get_known_folder_path_by_id(rfid, lpRegistryPath, 0, &lpSrcPath);
4806
4807 free(lpRegistryPath);
4808
4809 /* get path to redirection storage */
4810 if(SUCCEEDED(hr))
4811 hr = get_known_folder_redirection_place(rfid, &rootKey);
4812
4813 /* write redirection information */
4814 if(SUCCEEDED(hr))
4815 hr = HRESULT_FROM_WIN32(RegCreateKeyExW(rootKey, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders", 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL));
4816
4817 if(SUCCEEDED(hr))
4818 {
4819 StringFromGUID2(rfid, sGuid, ARRAY_SIZE(sGuid));
4820
4821 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, sGuid, 0, REG_SZ, (LPBYTE)pszTargetPath, (lstrlenW(pszTargetPath)+1)*sizeof(WCHAR)));
4822
4824 }
4825
4826 /* make sure destination path exists */
4827 SHCreateDirectory(NULL, pszTargetPath);
4828
4829 /* copy content if required */
4831 {
4832 WCHAR srcPath[MAX_PATH+1], dstPath[MAX_PATH+1];
4833 SHFILEOPSTRUCTW fileOp;
4834
4835 ZeroMemory(srcPath, sizeof(srcPath));
4836 lstrcpyW(srcPath, lpSrcPath);
4837 lstrcatW(srcPath, L"\\*");
4838
4839 ZeroMemory(dstPath, sizeof(dstPath));
4840 lstrcpyW(dstPath, pszTargetPath);
4841
4842 ZeroMemory(&fileOp, sizeof(fileOp));
4843
4845 fileOp.wFunc = FO_MOVE;
4846 else
4847 fileOp.wFunc = FO_COPY;
4848
4849 fileOp.pFrom = srcPath;
4850 fileOp.pTo = dstPath;
4851 fileOp.fFlags = FOF_NO_UI;
4852
4853 hr = (SHFileOperationW(&fileOp)==0 ? S_OK : E_FAIL);
4854
4856 {
4857 ZeroMemory(srcPath, sizeof(srcPath));
4858 lstrcpyW(srcPath, lpSrcPath);
4859
4860 ZeroMemory(&fileOp, sizeof(fileOp));
4861 fileOp.wFunc = FO_DELETE;
4862 fileOp.pFrom = srcPath;
4863 fileOp.fFlags = FOF_NO_UI;
4864
4865 hr = (SHFileOperationW(&fileOp)==0 ? S_OK : E_FAIL);
4866 }
4867 }
4868
4869 CoTaskMemFree(lpSrcPath);
4870
4871 return hr;
4872}
4873
4874
4876{
4881};
4882
4883static inline struct knownfolder *impl_from_IKnownFolder( IKnownFolder *iface )
4884{
4885 return CONTAINING_RECORD( iface, struct knownfolder, IKnownFolder_iface );
4886}
4887
4889 IKnownFolder *iface )
4890{
4893}
4894
4896 IKnownFolder *iface )
4897{
4900 if (!refs)
4901 {
4902 TRACE("destroying %p\n", knownfolder);
4904 free( knownfolder );
4905 }
4906 return refs;
4907}
4908
4910 IKnownFolder *iface,
4911 REFIID riid,
4912 void **ppv )
4913{
4914 struct knownfolder *This = impl_from_IKnownFolder( iface );
4915
4916 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppv );
4917
4918 *ppv = NULL;
4919 if ( IsEqualGUID( riid, &IID_IKnownFolder ) ||
4921 {
4922 *ppv = iface;
4923 }
4924 else if ( IsEqualGUID( riid, &IID_IMarshal ) )
4925 {
4926 TRACE("IID_IMarshal returning NULL.\n");
4927 return E_NOINTERFACE;
4928 }
4929 else
4930 {
4931 FIXME("interface %s not implemented\n", debugstr_guid(riid));
4932 return E_NOINTERFACE;
4933 }
4934 IKnownFolder_AddRef( iface );
4935 return S_OK;
4936}
4937
4939 struct knownfolder *knownfolder,
4940 const KNOWNFOLDERID *kfid)
4941{
4942 HKEY hKey;
4943 HRESULT hr;
4944
4945 TRACE("%s\n", debugstr_guid(kfid));
4946
4947 knownfolder->id = *kfid;
4948
4949 /* check is it registry-registered folder */
4951 if(SUCCEEDED(hr))
4953
4954 if(SUCCEEDED(hr))
4955 {
4956 hr = S_OK;
4958 }
4959 else
4960 {
4961 /* This known folder is not registered. To mark it, we set registryPath to NULL */
4964 hr = S_OK;
4965 }
4966
4967 return hr;
4968}
4969
4971 IKnownFolder *iface,
4972 KNOWNFOLDERID *pkfid)
4973{
4975
4976 TRACE("%p\n", pkfid);
4977
4978 *pkfid = knownfolder->id;
4979 return S_OK;
4980}
4981
4983 IKnownFolder *iface,
4984 KF_CATEGORY *pCategory)
4985{
4987 HRESULT hr = S_OK;
4988
4989 TRACE("%p, %p\n", knownfolder, pCategory);
4990
4991 /* we cannot get a category for a folder which is not registered */
4993 hr = E_FAIL;
4994
4995 if(SUCCEEDED(hr))
4996 hr = get_known_folder_dword(knownfolder->registryPath, L"Category", (DWORD *)pCategory);
4997
4998 return hr;
4999}
5000
5002 IKnownFolder *iface,
5003 DWORD flags,
5004 REFIID riid,
5005 void **ppv)
5006{
5008 TRACE("(%p, 0x%08lx, %s, %p)\n", knownfolder, flags, debugstr_guid(riid), ppv);
5010}
5011
5013 LPWSTR sFolderId,
5015 LPWSTR *ppszPath)
5016{
5017 HRESULT hr;
5018 DWORD dwSize, dwType;
5019 WCHAR path[MAX_PATH] = {0};
5020 WCHAR parentGuid[39];
5022 LPWSTR parentRegistryPath, parentPath;
5023 HKEY hRedirectionRootKey = NULL;
5024
5025 TRACE("(%s, %p)\n", debugstr_w(registryPath), ppszPath);
5026 *ppszPath = NULL;
5027
5028 /* check if folder has parent */
5029 dwSize = sizeof(parentGuid);
5030 hr = HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE, registryPath, L"ParentFolder", RRF_RT_REG_SZ, &dwType, parentGuid, &dwSize));
5032
5033 if(hr == S_OK)
5034 {
5035 /* get parent's known folder path (recursive) */
5036 hr = get_known_folder_registry_path(NULL, parentGuid, &parentRegistryPath);
5037 if(FAILED(hr)) return hr;
5038
5039 hr = get_known_folder_path(parentGuid, parentRegistryPath, &parentPath);
5040 if(FAILED(hr)) {
5041 free(parentRegistryPath);
5042 return hr;
5043 }
5044
5045 lstrcatW(path, parentPath);
5046 lstrcatW(path, L"\\");
5047
5048 free(parentRegistryPath);
5049 free(parentPath);
5050 }
5051
5052 /* check, if folder was redirected */
5053 if(SUCCEEDED(hr))
5055
5056 if(SUCCEEDED(hr))
5057 {
5058 if(category == KF_CATEGORY_COMMON)
5059 hRedirectionRootKey = HKEY_LOCAL_MACHINE;
5060 else if(category == KF_CATEGORY_PERUSER)
5061 hRedirectionRootKey = HKEY_CURRENT_USER;
5062
5063 if(hRedirectionRootKey)
5064 {
5065 hr = HRESULT_FROM_WIN32(RegGetValueW(hRedirectionRootKey, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders", sFolderId, RRF_RT_REG_SZ, NULL, NULL, &dwSize));
5066
5067 if(SUCCEEDED(hr))
5068 {
5069 *ppszPath = CoTaskMemAlloc(dwSize+(lstrlenW(path)+1)*sizeof(WCHAR));
5070 if(!*ppszPath) hr = E_OUTOFMEMORY;
5071 }
5072
5073 if(SUCCEEDED(hr))
5074 {
5075 lstrcpyW(*ppszPath, path);
5076 hr = HRESULT_FROM_WIN32(RegGetValueW(hRedirectionRootKey, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders", sFolderId, RRF_RT_REG_SZ, NULL, *ppszPath + lstrlenW(path), &dwSize));
5077 }
5078 }
5079
5080 if(!*ppszPath)
5081 {
5082 /* no redirection, use previous way - read the relative path from folder definition */
5084
5085 if(SUCCEEDED(hr))
5086 {
5087 *ppszPath = CoTaskMemAlloc(dwSize+(lstrlenW(path)+1)*sizeof(WCHAR));
5088 if(!*ppszPath) hr = E_OUTOFMEMORY;
5089 }
5090
5091 if(SUCCEEDED(hr))
5092 {
5093 lstrcpyW(*ppszPath, path);
5095 }
5096 }
5097 }
5098
5099 TRACE("returning path: %s\n", debugstr_w(*ppszPath));
5100 return hr;
5101}
5102
5104 REFKNOWNFOLDERID folderId,
5105 LPWSTR lpRegistryPath,
5106 DWORD dwFlags,
5107 LPWSTR *ppszPath)
5108{
5109 HRESULT hr = E_FAIL;
5110 WCHAR sGuid[39];
5112
5113 TRACE("(%s, %s, 0x%08lx, %p)\n", debugstr_guid(folderId), debugstr_w(lpRegistryPath), dwFlags, ppszPath);
5114
5115 /* if this is registry-registered known folder, get path from registry */
5116 if(lpRegistryPath)
5117 {
5118 StringFromGUID2(folderId, sGuid, ARRAY_SIZE(sGuid));
5119
5120 hr = get_known_folder_path(sGuid, lpRegistryPath, ppszPath);
5121 }
5122 /* in other case, use older way */
5123
5124 if(FAILED(hr))
5125 hr = SHGetKnownFolderPath( folderId, dwFlags, NULL, ppszPath );
5126
5127 if (FAILED(hr)) return hr;
5128
5129 /* check if known folder really exists */
5130 dwAttributes = GetFileAttributesW(*ppszPath);
5132 {
5133 TRACE("directory %s not found\n", debugstr_w(*ppszPath));
5134 CoTaskMemFree(*ppszPath);
5135 *ppszPath = NULL;
5137 }
5138
5139 return hr;
5140}
5141
5143 IKnownFolder *iface,
5144 DWORD dwFlags,
5145 LPWSTR *ppszPath)
5146{
5148 TRACE("(%p, 0x%08lx, %p)\n", knownfolder, dwFlags, ppszPath);
5149
5151}
5152
5154 IKnownFolder *iface,
5155 DWORD dwFlags,
5156 LPCWSTR pszPath)
5157{
5159 HRESULT hr = S_OK;
5160
5161 TRACE("(%p, 0x%08lx, %s)\n", knownfolder, dwFlags, debugstr_w(pszPath));
5162
5163 /* check if the known folder is registered */
5165 hr = E_FAIL;
5166
5167 if(SUCCEEDED(hr))
5168 hr = redirect_known_folder(&knownfolder->id, NULL, 0, pszPath, 0, NULL, NULL);
5169
5170 return hr;
5171}
5172
5174 IKnownFolder *iface,
5175 DWORD flags,
5176 PIDLIST_ABSOLUTE *ppidl)
5177{
5179 TRACE("(%p, 0x%08lx, %p)\n", knownfolder, flags, ppidl);
5180 return SHGetKnownFolderIDList(&knownfolder->id, flags, NULL, ppidl);
5181}
5182
5184 IKnownFolder *iface,
5185 FOLDERTYPEID *pftid)
5186{
5187 FIXME("%p\n", pftid);
5188 return E_NOTIMPL;
5189}
5190
5192 IKnownFolder *iface,
5193 KF_REDIRECTION_CAPABILITIES *pCapabilities)
5194{
5195 FIXME("%p stub\n", pCapabilities);
5196 if(!pCapabilities) return E_INVALIDARG;
5197 *pCapabilities = KF_REDIRECTION_CAPABILITIES_DENY_ALL;
5198 return S_OK;
5199}
5200
5202 IKnownFolder *iface,
5204{
5206 HRESULT hr;
5207 DWORD dwSize;
5208 WCHAR parentGuid[39];
5209 TRACE("(%p, %p)\n", knownfolder, pKFD);
5210
5211 if(!pKFD) return E_INVALIDARG;
5212
5213 ZeroMemory(pKFD, sizeof(*pKFD));
5214
5215 /* required fields */
5217 if(FAILED(hr))
5218 return hr;
5219
5221 if(FAILED(hr))
5222 return hr;
5223
5224 /* optional fields */
5225 dwSize = sizeof(parentGuid);
5227 RRF_RT_REG_SZ, NULL, parentGuid, &dwSize));
5228 if(SUCCEEDED(hr))
5229 {
5230 hr = IIDFromString(parentGuid, &pKFD->fidParent);
5231 if(FAILED(hr))
5232 return hr;
5233 }
5234
5236
5238
5240
5241 return S_OK;
5242}
5243
5244static const struct IKnownFolderVtbl knownfolder_vtbl =
5245{
5258};
5259
5261{
5262 struct knownfolder *kf;
5263
5264 kf = malloc( sizeof(*kf) );
5265 if (!kf) return E_OUTOFMEMORY;
5266
5268 kf->refs = 1;
5269 memset( &kf->id, 0, sizeof(kf->id) );
5270 kf->registryPath = NULL;
5271
5272 *knownfolder = kf;
5273
5274 TRACE("returning iface %p\n", &kf->IKnownFolder_iface);
5275 return S_OK;
5276}
5277
5279{
5284};
5285
5287{
5289}
5290
5292 IKnownFolderManager *iface )
5293{
5296}
5297
5299 IKnownFolderManager *iface )
5300{
5303 if (!refs)
5304 {
5305 TRACE("destroying %p\n", foldermanager);
5308 }
5309 return refs;
5310}
5311
5313 IKnownFolderManager *iface,
5314 REFIID riid,
5315 void **ppv )
5316{
5318
5319 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppv );
5320
5321 *ppv = NULL;
5322 if ( IsEqualGUID( riid, &IID_IKnownFolderManager ) ||
5324 {
5325 *ppv = iface;
5326 }
5327 else if ( IsEqualGUID( riid, &IID_IMarshal ) )
5328 {
5329 TRACE("IID_IMarshal returning NULL.\n");
5330 return E_NOINTERFACE;
5331 }
5332 else
5333 {
5334 FIXME("interface %s not implemented\n", debugstr_guid(riid));
5335 return E_NOINTERFACE;
5336 }
5337 IKnownFolderManager_AddRef( iface );
5338 return S_OK;
5339}
5340
5342 IKnownFolderManager *iface,
5343 int nCsidl,
5344 KNOWNFOLDERID *pfid)
5345{
5346 TRACE("%d, %p\n", nCsidl, pfid);
5347
5348 if (nCsidl >= ARRAY_SIZE(CSIDL_Data))
5349 return E_INVALIDARG;
5350 *pfid = *CSIDL_Data[nCsidl].id;
5351 return S_OK;
5352}
5353
5355 IKnownFolderManager *iface,
5356 REFKNOWNFOLDERID rfid,
5357 int *pnCsidl)
5358{
5359 int csidl;
5360
5361 TRACE("%s, %p\n", debugstr_guid(rfid), pnCsidl);
5362
5363 csidl = csidl_from_id( rfid );
5364 if (csidl == -1) return E_INVALIDARG;
5365 *pnCsidl = csidl;
5366 return S_OK;
5367}
5368
5370 IKnownFolderManager *iface,
5371 KNOWNFOLDERID **ppKFId,
5372 UINT *pCount)
5373{
5374 struct foldermanager *fm = impl_from_IKnownFolderManager( iface );
5375
5376 TRACE("%p, %p\n", ppKFId, pCount);
5377
5378 *ppKFId = CoTaskMemAlloc(fm->num_ids * sizeof(KNOWNFOLDERID));
5379 memcpy(*ppKFId, fm->ids, fm->num_ids * sizeof(KNOWNFOLDERID));
5380 *pCount = fm->num_ids;
5381 return S_OK;
5382}
5383
5384static BOOL is_knownfolder( struct foldermanager *fm, const KNOWNFOLDERID *id )
5385{
5386 UINT i;
5387 HRESULT hr;
5389 HKEY hKey;
5390
5391 /* TODO: move all entries from "CSIDL_Data" static array to registry known folder descriptions */
5392 for (i = 0; i < fm->num_ids; i++)
5393 if (IsEqualGUID( &fm->ids[i], id )) return TRUE;
5394
5396 if(SUCCEEDED(hr))
5397 {
5400 }
5401
5402 if(SUCCEEDED(hr))
5403 {
5404 hr = S_OK;
5406 }
5407
5408 return hr == S_OK;
5409}
5410
5412 IKnownFolderManager *iface,
5413 REFKNOWNFOLDERID rfid,
5414 IKnownFolder **ppkf)
5415{
5416 struct foldermanager *fm = impl_from_IKnownFolderManager( iface );
5417 struct knownfolder *kf;
5418 HRESULT hr;
5419
5420 TRACE("%s, %p\n", debugstr_guid(rfid), ppkf);
5421
5422 if (!is_knownfolder( fm, rfid ))
5423 {
5424 WARN("unknown folder\n");
5425 return E_INVALIDARG;
5426 }
5427 hr = knownfolder_create( &kf );
5428 if (SUCCEEDED( hr ))
5429 {
5430 hr = knownfolder_set_id( kf, rfid );
5431 *ppkf = &kf->IKnownFolder_iface;
5432 }
5433 else
5434 *ppkf = NULL;
5435
5436 return hr;
5437}
5438
5440 IKnownFolderManager *iface,
5441 LPCWSTR pszCanonicalName,
5442 IKnownFolder **ppkf)
5443{
5444 struct foldermanager *fm = impl_from_IKnownFolderManager( iface );
5445 struct knownfolder *kf;
5446 BOOL found = FALSE;
5447 HRESULT hr;
5448 UINT i;
5449
5450 TRACE( "%s, %p\n", debugstr_w(pszCanonicalName), ppkf );
5451
5452 for (i = 0; i < fm->num_ids; i++)
5453 {
5454 WCHAR *path, *name;
5456 if (FAILED( hr )) return hr;
5457
5458 hr = get_known_folder_wstr( path, L"Name", &name );
5459 free( path );
5460 if (FAILED( hr )) return hr;
5461
5462 found = !wcsicmp( pszCanonicalName, name );
5464 if (found) break;
5465 }
5466
5467 if (found)
5468 {
5469 hr = knownfolder_create( &kf );
5470 if (FAILED( hr )) return hr;
5471
5472 hr = knownfolder_set_id( kf, &fm->ids[i] );
5473 if (FAILED( hr ))
5474 {
5475 IKnownFolder_Release( &kf->IKnownFolder_iface );
5476 return hr;
5477 }
5478 *ppkf = &kf->IKnownFolder_iface;
5479 }
5480 else
5481 {
5483 *ppkf = NULL;
5484 }
5485
5486 return hr;
5487}
5488
5490{
5491 HRESULT hr;
5492 HKEY hKey = NULL;
5493 DWORD dwDisp;
5495
5497 TRACE("registry path: %s\n", debugstr_w(registryPath));
5498
5499 if(SUCCEEDED(hr))
5501
5502 if(SUCCEEDED(hr))
5503 {
5504 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, L"Category", 0, REG_DWORD, (LPBYTE)&pKFD->category, sizeof(pKFD->category)));
5505
5506 if(SUCCEEDED(hr) && pKFD->dwAttributes != 0)
5507 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, L"Attributes", 0, REG_DWORD, (LPBYTE)&pKFD->dwAttributes, sizeof(pKFD->dwAttributes)));
5508
5509 if(SUCCEEDED(hr))
5510 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, L"Name", 0, REG_SZ, (LPBYTE)pKFD->pszName, (lstrlenW(pKFD->pszName)+1)*sizeof(WCHAR) ));
5511
5512 if(SUCCEEDED(hr) && pKFD->pszParsingName)
5513 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, L"ParsingName", 0, REG_SZ, (LPBYTE)pKFD->pszParsingName, (lstrlenW(pKFD->pszParsingName)+1)*sizeof(WCHAR) ));
5514
5515 if(SUCCEEDED(hr) && !IsEqualGUID(&pKFD->fidParent, &GUID_NULL))
5516 {
5517 WCHAR sParentGuid[39];
5518 StringFromGUID2(&pKFD->fidParent, sParentGuid, ARRAY_SIZE(sParentGuid));
5519
5520 /* this known folder has parent folder */
5521 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, L"ParentFolder", 0, REG_SZ, (LPBYTE)sParentGuid, sizeof(sParentGuid)));
5522 }
5523
5524 if(SUCCEEDED(hr) && pKFD->category != KF_CATEGORY_VIRTUAL && pKFD->pszRelativePath)
5525 hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, L"RelativePath", 0, REG_SZ, (LPBYTE)pKFD->pszRelativePath, (lstrlenW(pKFD->pszRelativePath)+1)*sizeof(WCHAR) ));
5526
5528
5529 if(FAILED(hr))
5531 }
5532
5534 return hr;
5535}
5536
5538 IKnownFolderManager *iface,
5539 REFKNOWNFOLDERID rfid,
5540 KNOWNFOLDER_DEFINITION const *pKFD)
5541{
5542 TRACE("(%p, %s, %p)\n", iface, debugstr_guid(rfid), pKFD);
5543 return register_folder(rfid, pKFD);
5544}
5545
5547 IKnownFolderManager *iface,
5548 REFKNOWNFOLDERID rfid)
5549{
5550 HRESULT hr;
5552 TRACE("(%p, %s)\n", iface, debugstr_guid(rfid));
5553
5555
5556 if(SUCCEEDED(hr))
5558
5560 return hr;
5561}
5562
5564 IKnownFolderManager *iface,
5565 LPCWSTR pszPath,
5566 FFFP_MODE mode,
5567 IKnownFolder **ppkf)
5568{
5569 FIXME("%s, 0x%08x, %p\n", debugstr_w(pszPath), mode, ppkf);
5570 return E_NOTIMPL;
5571}
5572
5574 IKnownFolderManager *iface,
5575 PCIDLIST_ABSOLUTE pidl,
5576 IKnownFolder **ppkf)
5577{
5578 FIXME("%p, %p\n", pidl, ppkf);
5579 return E_NOTIMPL;
5580}
5581
5583 IKnownFolderManager *iface,
5584 REFKNOWNFOLDERID rfid,
5585 HWND hwnd,
5586 KF_REDIRECT_FLAGS flags,
5587 LPCWSTR pszTargetPath,
5588 UINT cFolders,
5589 KNOWNFOLDERID const *pExclusion,
5590 LPWSTR *ppszError)
5591{
5592 return redirect_known_folder(rfid, hwnd, flags, pszTargetPath, cFolders, pExclusion, ppszError);
5593}
5594
5595static const struct IKnownFolderManagerVtbl foldermanager_vtbl =
5596{
5610};
5611
5613{
5614 UINT i, j;
5615 struct foldermanager *fm;
5616
5617 fm = malloc( sizeof(*fm) );
5618 if (!fm) return E_OUTOFMEMORY;
5619
5621 fm->refs = 1;
5622 fm->num_ids = 0;
5623
5624 for (i = 0; i < ARRAY_SIZE(CSIDL_Data); i++)
5625 {
5626 if (!IsEqualGUID( CSIDL_Data[i].id, &GUID_NULL )) fm->num_ids++;
5627 }
5628 fm->ids = malloc( fm->num_ids * sizeof(KNOWNFOLDERID) );
5629 if (!fm->ids)
5630 {
5631 free( fm );
5632 return E_OUTOFMEMORY;
5633 }
5634 for (i = j = 0; i < ARRAY_SIZE(CSIDL_Data); i++)
5635 {
5636 if (!IsEqualGUID( CSIDL_Data[i].id, &GUID_NULL ))
5637 {
5638 fm->ids[j] = *CSIDL_Data[i].id;
5639 j++;
5640 }
5641 }
5642 TRACE("found %u known folders\n", fm->num_ids);
5644
5645 TRACE("returning iface %p\n", *ppv);
5646 return S_OK;
5647}
5648
5650{
5651 TRACE("%p, %s, %p\n", punk, debugstr_guid(riid), ppv);
5652
5653 if (!ppv)
5654 return E_POINTER;
5655 if (punk)
5656 return CLASS_E_NOAGGREGATION;
5657
5658 return foldermanager_create( ppv );
5659}
5660
5662{
5663 TRACE("%s, 0x%08lx, %p, %p\n", debugstr_guid(rfid), flags, token, pidl);
5664
5665 if (!pidl)
5666 return E_INVALIDARG;
5667
5668 if (flags)
5669 FIXME("unsupported flags: 0x%08lx\n", flags);
5670
5671 if (token)
5672 FIXME("user token is not used.\n");
5673
5674 *pidl = NULL;
5675 if (IsEqualIID(rfid, &FOLDERID_Desktop))
5676 *pidl = _ILCreateDesktop();
5677 else if (IsEqualIID(rfid, &FOLDERID_RecycleBinFolder))
5678 *pidl = _ILCreateBitBucket();
5679 else if (IsEqualIID(rfid, &FOLDERID_ComputerFolder))
5680 *pidl = _ILCreateMyComputer();
5681 else if (IsEqualIID(rfid, &FOLDERID_PrintersFolder))
5682 *pidl = _ILCreatePrinters();
5683 else if (IsEqualIID(rfid, &FOLDERID_ControlPanelFolder))
5684 *pidl = _ILCreateControlPanel();
5685 else if (IsEqualIID(rfid, &FOLDERID_NetworkFolder))
5686 *pidl = _ILCreateNetwork();
5687 else if (IsEqualIID(rfid, &FOLDERID_Documents))
5688 *pidl = _ILCreateMyDocuments();
5689 else
5690 {
5691 DWORD attributes = 0;
5692 WCHAR *pathW;
5693 HRESULT hr;
5694
5696 if (FAILED(hr))
5697 return hr;
5698
5701 return hr;
5702 }
5703
5704 return *pidl ? S_OK : E_FAIL;
5705}
5706
5708 REFIID riid, void **ppv)
5709{
5710 PIDLIST_ABSOLUTE pidl;
5711 HRESULT hr;
5712
5713 TRACE("%s, 0x%08x, %p, %s, %p\n", debugstr_guid(rfid), flags, hToken, debugstr_guid(riid), ppv);
5714
5715 hr = SHGetKnownFolderIDList(rfid, flags, hToken, &pidl);
5716 if (FAILED(hr))
5717 {
5718 *ppv = NULL;
5719 return hr;
5720 }
5721
5723 CoTaskMemFree(pidl);
5724 return hr;
5725}
5726
5728{
5729 int i;
5730
5731 for (i = 0; i < ARRAY_SIZE(CSIDL_Data); ++i)
5732 {
5733 const CSIDL_DATA *folder = &CSIDL_Data[i];
5734 if(folder->name){
5736
5737 /* register_folder won't modify kfd, so cast away const instead of
5738 * reallocating */
5739 kfd.category = folder->category;
5740 kfd.pszName = (WCHAR *)folder->name;
5741 kfd.pszDescription = NULL;
5742 kfd.fidParent = folder->parent ? *folder->parent : GUID_NULL;
5743 kfd.pszRelativePath = (WCHAR *)folder->path;
5744 kfd.pszParsingName = (WCHAR *)folder->parsing;
5745 kfd.pszTooltip = NULL;
5746 kfd.pszLocalizedName = NULL;
5747 kfd.pszIcon = NULL;
5748 kfd.pszSecurity = NULL;
5749 kfd.dwAttributes = folder->attributes;
5750 kfd.kfdFlags = folder->flags;
5751 kfd.ftidType = folder->typeid ? *folder->typeid : GUID_NULL;
5752 register_folder(folder->id, &kfd);
5753 }
5754 }
5755}
5756
5758{
5759 HRESULT hr;
5760
5762 if (SUCCEEDED(hr))
5764 if (SUCCEEDED(hr))
5766#ifndef __REACTOS__
5767 if (SUCCEEDED(hr))
5769#endif
5770 if (SUCCEEDED(hr))
5772 if (SUCCEEDED(hr))
5774 return hr;
5775}
#define PRF_VERIFYEXISTS
Definition: PathResolve.cpp:38
#define PRF_TRYPROGRAMEXTENSIONS
Definition: PathResolve.cpp:40
#define PRF_REQUIREABSOLUTE
Definition: PathResolve.cpp:45
#define PRF_FIRSTDIRDEF
Definition: PathResolve.cpp:41
#define PRF_DONTFINDLNK
Definition: PathResolve.cpp:42
UINT cchMax
#define REG_SZ
Definition: layer.c:22
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define ARRAY_SIZE(A)
Definition: main.h:20
PCWSTR pszTemplate
Definition: reactos.c:3626
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
#define RegCloseKey(hKey)
Definition: registry.h:49
LPCTSTR registryPath
Definition: butterflies.c:17
const WCHAR * link
Definition: db.cpp:998
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define APIENTRY
Definition: api.h:79
#define IDI_SHELL_NETWORK_FOLDER
Definition: resource.h:8
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1201
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:411
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3583
HRESULT WINAPI IIDFromString(LPCOLESTR str, IID *iid)
Definition: combase.c:1492
INT WINAPI StringFromGUID2(REFGUID guid, LPOLESTR str, INT cmax)
Definition: combase.c:1525
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:464
#define CloseHandle
Definition: compat.h:739
#define wcsnicmp
Definition: compat.h:14
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GetCurrentProcess()
Definition: compat.h:759
#define GENERIC_READ
Definition: compat.h:135
#define IsWow64Process
Definition: compat.h:760
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
#define wcsicmp
Definition: compat.h:15
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
static const WCHAR *const ext[]
Definition: module.c:53
LONG refs
Definition: port.c:62
static void cleanup(void)
Definition: main.c:1335
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:636
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:779
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
BOOL WINAPI GetVolumeInformationW(IN LPCWSTR lpRootPathName, IN LPWSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPWSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:226
BOOL WINAPI GetVolumeInformationA(IN LPCSTR lpRootPathName, IN LPSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:32
UINT WINAPI GetSystemWow64DirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2439
DWORD WINAPI GetFullPathNameA(IN LPCSTR lpFileName, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart)
Definition: path.c:1051
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2331
DWORD WINAPI GetShortPathNameW(IN LPCWSTR lpszLongPath, OUT LPWSTR lpszShortPath, IN DWORD cchBuffer)
Definition: path.c:1851
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1164
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2370
BOOL WINAPI InitOnceExecuteOnce(_Inout_ PINIT_ONCE InitOnce, _In_ __callback PINIT_ONCE_FN InitFn, _Inout_opt_ PVOID Parameter, _Outptr_opt_result_maybenull_ LPVOID *Context)
Definition: InitOnce.c:12
BOOL WINAPI WritePrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string, LPCWSTR filename)
Definition: profile.c:1453
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4133
BOOL WINAPI PathIsRootA(const char *path)
Definition: path.c:1064
BOOL WINAPI PathMatchSpecA(const char *path, const char *mask)
Definition: path.c:2432
BOOL WINAPI PathIsSameRootW(const WCHAR *path1, const WCHAR *path2)
Definition: path.c:2552
void WINAPI PathRemoveExtensionW(WCHAR *path)
Definition: path.c:1922
void WINAPI PathRemoveBlanksW(WCHAR *path)
Definition: path.c:1886
BOOL WINAPI PathIsUNCW(const WCHAR *path)
Definition: path.c:989
LPSTR WINAPI PathFindExtensionA(const char *path)
Definition: path.c:1229
void WINAPI PathRemoveBlanksA(char *path)
Definition: path.c:1862
void WINAPI PathUnquoteSpacesW(WCHAR *path)
Definition: path.c:1982
int WINAPI PathGetDriveNumberW(const WCHAR *path)
Definition: path.c:1786
void WINAPI PathQuoteSpacesA(char *path)
Definition: path.c:2502
BOOL WINAPI PathRemoveFileSpecA(char *path)
Definition: path.c:1084
WCHAR *WINAPI PathRemoveBackslashW(WCHAR *path)
Definition: path.c:2016
BOOL WINAPI PathIsFileSpecA(const char *path)
Definition: path.c:1801
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
Definition: path.c:1677
BOOL WINAPI PathFileExistsA(const char *path)
Definition: path.c:2566
UINT WINAPI PathGetCharTypeA(UCHAR ch)
Definition: path.c:1769
char *WINAPI PathGetArgsA(const char *path)
Definition: path.c:1694
void WINAPI PathStripPathA(char *path)
Definition: path.c:2292
void WINAPI PathStripPathW(WCHAR *path)
Definition: path.c:2304
BOOL WINAPI PathRemoveFileSpecW(WCHAR *path)
Definition: path.c:1121
void WINAPI PathRemoveExtensionA(char *path)
Definition: path.c:1910
LPWSTR WINAPI PathFindExtensionW(const WCHAR *path)
Definition: path.c:1250
int WINAPI PathGetDriveNumberA(const char *path)
Definition: path.c:1774
BOOL WINAPI PathIsRelativeA(const char *path)
Definition: path.c:996
int WINAPI PathParseIconLocationA(char *path)
Definition: path.c:2599
void WINAPI PathUnquoteSpacesA(char *path)
Definition: path.c:1964
BOOL WINAPI PathIsRelativeW(const WCHAR *path)
Definition: path.c:1006
int WINAPI PathParseIconLocationW(WCHAR *path)
Definition: path.c:2620
BOOL WINAPI PathStripToRootW(WCHAR *path)
Definition: path.c:1171
BOOL WINAPI PathStripToRootA(char *path)
Definition: path.c:1157
BOOL WINAPI PathIsSameRootA(const char *path1, const char *path2)
Definition: path.c:2538
BOOL WINAPI PathIsURLW(const WCHAR *path)
Definition: path.c:3214
BOOL WINAPI PathIsValidCharW(WCHAR c, DWORD class)
Definition: path.c:2197
BOOL WINAPI PathMatchSpecW(const WCHAR *path, const WCHAR *mask)
Definition: path.c:2497
WCHAR *WINAPI PathGetArgsW(const WCHAR *path)
Definition: path.c:1716
UINT WINAPI PathGetCharTypeW(WCHAR ch)
Definition: path.c:1738
BOOL WINAPI PathFileExistsW(const WCHAR *path)
Definition: path.c:2583
char *WINAPI PathFindFileNameA(const char *path)
Definition: path.c:1660
BOOL WINAPI PathIsFileSpecW(const WCHAR *path)
Definition: path.c:1818
BOOL WINAPI PathIsRootW(const WCHAR *path)
Definition: path.c:1077
BOOL WINAPI PathIsUNCA(const char *path)
Definition: path.c:982
void WINAPI PathQuoteSpacesW(WCHAR *path)
Definition: path.c:2520
LPWSTR WINAPI CharPrevW(const WCHAR *start, const WCHAR *x)
Definition: string.c:1194
WCHAR *WINAPI StrCpyNW(WCHAR *dst, const WCHAR *src, int count)
Definition: string.c:470
wchar_t *CDECL _wgetenv(const wchar_t *name)
Definition: environ.c:254
#define assert(_expr)
Definition: assert.h:32
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
Definition: string.c:3335
DWORD WINAPI SHAnsiToUnicode(const char *src, WCHAR *dest, int dest_len)
Definition: main.c:1801
DWORD WINAPI SHUnicodeToAnsi(const WCHAR *src, char *dest, int dest_len)
Definition: main.c:1756
DWORD WINAPI SHDeleteKeyW(HKEY hkey, const WCHAR *subkey)
Definition: main.c:1886
EXTERN_C HRESULT WINAPI SHCreateItemFromIDList(_In_ PCIDLIST_ABSOLUTE pidl, _In_ REFIID riid, _Out_ void **ppv)
Definition: CShellItem.cpp:512
SHSTDAPI SHBindToObject(_In_opt_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_opt_ IBindCtx *pBindCtx, _In_ REFIID riid, _Out_ void **ppvObj)
const GUID CLSID_UnixDosFolder
EXTERN_C INT Shell_ParseSpecialFolder(_In_ LPCWSTR pszStart, _Out_ LPWSTR *ppch, _Out_ INT *pcch)
const GUID CLSID_UnixFolder
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:370
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:348
#define CSIDL_LINKS
Definition: shellpath.c:1571
static HRESULT get_known_folder_dword(const WCHAR *registryPath, const WCHAR *value, DWORD *out)
Definition: shellpath.c:4734
static LPWSTR PathGetExtensionW(LPCWSTR lpszPath)
Definition: shellpath.c:506
#define CSIDL_APPDATA_LOCALLOW
Definition: shellpath.c:1572
LPVOID WINAPI PathBuildRootAW(LPVOID lpszPath, int drive)
Definition: shellpath.c:456
static ULONG WINAPI ApplicationDocumentLists_AddRef(IApplicationDocumentLists *iface)
Definition: shellpath.c:1731
BOOL WINAPI PathQualifyAW(LPCVOID pszPath)
Definition: shellpath.c:1405
static HRESULT get_known_folder_path_by_id(REFKNOWNFOLDERID folderId, LPWSTR lpRegistryPath, DWORD dwFlags, LPWSTR *ppszPath)
Definition: shellpath.c:5103
BOOL WINAPI PathIsRootAW(LPCVOID lpszPath)
Definition: shellpath.c:711
int WINAPI PathGetDriveNumberAW(LPVOID lpszPath)
Definition: shellpath.c:537
void WINAPI PathRemoveBlanksAW(LPVOID str)
Definition: shellpath.c:645
static HRESULT set_folder_attributes(void)
Definition: shellpath.c:4318
static BOOL link_folder(HANDLE mgr, const UNICODE_STRING *path, const char *link)
Definition: shellpath.c:3703
HRESULT WINAPI ApplicationDestinations_Constructor(IUnknown *outer, REFIID riid, LPVOID *ppv)
Definition: shellpath.c:1672
static HRESULT WINAPI knownfolder_GetCategory(IKnownFolder *iface, KF_CATEGORY *pCategory)
Definition: shellpath.c:4982
static ULONG WINAPI ApplicationDocumentLists_Release(IApplicationDocumentLists *iface)
Definition: shellpath.c:1741
HRESULT SHELL_RegisterShellFolders(void)
Definition: shellpath.c:5757
static HRESULT WINAPI knownfolder_GetRedirectionCapabilities(IKnownFolder *iface, KF_REDIRECTION_CAPABILITIES *pCapabilities)
Definition: shellpath.c:5191
LPVOID WINAPI PathGetExtensionAW(LPCVOID lpszPath, DWORD void1, DWORD void2)
Definition: shellpath.c:517
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:4574
LPVOID WINAPI PathFindFileNameAW(LPCVOID lpszPath)
Definition: shellpath.c:470
enum _CSIDL_Type CSIDL_Type
BOOL WINAPI IsLFNDriveAW(LPCVOID lpszPath)
Definition: shellpath.c:899
static IApplicationDocumentListsImpl * impl_from_IApplicationDocumentLists(IApplicationDocumentLists *iface)
Definition: shellpath.c:1701
static BOOL WINAPI init_xdg_dirs(INIT_ONCE *once, void *param, void **context)
Definition: shellpath.c:3624
static HRESULT WINAPI knownfolder_QueryInterface(IKnownFolder *iface, REFIID riid, void **ppv)
Definition: shellpath.c:4909
void WINAPI PathStripPathAW(LPVOID lpszPath)
Definition: shellpath.c:557
#define CSIDL_DOWNLOADS
Definition: shellpath.c:1570
static HRESULT get_known_folder_registry_path(REFKNOWNFOLDERID rfid, LPWSTR lpStringGuid, LPWSTR *lpPath)
Definition: shellpath.c:4681
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:4467
static struct foldermanager * impl_from_IKnownFolderManager(IKnownFolderManager *iface)
Definition: shellpath.c:5286
LPVOID WINAPI PathAddBackslashAW(LPVOID lpszPath)
Definition: shellpath.c:446
static ULONG WINAPI knownfolder_Release(IKnownFolder *iface)
Definition: shellpath.c:4895
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:3816
BOOL WINAPI PathIsDirectoryAW(LPCVOID lpszPath)
Definition: shellpath.c:771
static HRESULT _SHGetCurrentVersionPath(DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:3169
static HRESULT WINAPI knownfolder_SetPath(IKnownFolder *iface, DWORD dwFlags, LPCWSTR pszPath)
Definition: shellpath.c:5153
static BOOL PathMakeUniqueNameW(LPWSTR lpszBuffer, DWORD dwBuffSize, LPCWSTR lpszShortName, LPCWSTR lpszLongName, LPCWSTR lpszPathName)
Definition: shellpath.c:1076
LPVOID WINAPI PathGetArgsAW(LPVOID lpszPath)
Definition: shellpath.c:527
static LPSTR PathGetExtensionA(LPCSTR lpszPath)
Definition: shellpath.c:495
static HRESULT _SHRegisterUserShellFolders(BOOL bDefault)
Definition: shellpath.c:4167
BOOL WINAPI PathAppendAW(LPVOID lpszPath1, LPCVOID lpszPath2)
Definition: shellpath.c:421
static HRESULT WINAPI knownfolder_GetShellItem(IKnownFolder *iface, DWORD flags, REFIID riid, void **ppv)
Definition: shellpath.c:5001
static HRESULT WINAPI foldermanager_GetFolderIds(IKnownFolderManager *iface, KNOWNFOLDERID **ppKFId, UINT *pCount)
Definition: shellpath.c:5369
void WINAPI PathRemoveArgsAW(LPVOID lpszPath)
Definition: shellpath.c:578
static HRESULT get_known_folder_path(LPWSTR sFolderId, LPWSTR registryPath, LPWSTR *ppszPath)
Definition: shellpath.c:5012
static int csidl_from_id(const KNOWNFOLDERID *id)
Definition: shellpath.c:2913
static HRESULT WINAPI ApplicationDocumentLists_GetList(IApplicationDocumentLists *iface, APPDOCLISTTYPE list_type, UINT item_count, REFIID riid, void **obj)
Definition: shellpath.c:1764
static char * get_xdg_path(const char *var)
Definition: shellpath.c:3664
static HRESULT WINAPI knownfolder_GetFolderType(IKnownFolder *iface, FOLDERTYPEID *pftid)
Definition: shellpath.c:5183
static BOOL PathQualifyW(LPCWSTR pszPath)
Definition: shellpath.c:1396
BOOL WINAPI PathStripToRootAW(LPVOID lpszPath)
Definition: shellpath.c:568
static HRESULT WINAPI foldermanager_FindFolderFromPath(IKnownFolderManager *iface, LPCWSTR pszPath, FFFP_MODE mode, IKnownFolder **ppkf)
Definition: shellpath.c:5563
BOOL WINAPI PathResolveAW(void *path, const void **paths, DWORD flags)
Definition: shellpath.c:1485
static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest)
Definition: shellpath.c:3469
static void PathGetShortPathA(LPSTR pszPath)
Definition: shellpath.c:605
static BOOL PathMakeUniqueNameA(LPSTR lpszBuffer, DWORD dwBuffSize, LPCSTR lpszShortName, LPCSTR lpszLongName, LPCSTR lpszPathName)
Definition: shellpath.c:912
static HRESULT WINAPI ApplicationDestinations_RemoveAllDestinations(IApplicationDestinations *iface)
Definition: shellpath.c:1653
static BOOL PathResolveA(char *path, const char **dirs, DWORD flags)
Definition: shellpath.c:1412
BOOL WINAPI PathIsExeAW(LPCVOID path)
Definition: shellpath.c:761
static BOOL is_knownfolder(struct foldermanager *fm, const KNOWNFOLDERID *id)
Definition: shellpath.c:5384
BOOL WINAPI PathFileExistsAW(LPCVOID lpszPath)
Definition: shellpath.c:781
static HRESULT WINAPI foldermanager_GetFolder(IKnownFolderManager *iface, REFKNOWNFOLDERID rfid, IKnownFolder **ppkf)
Definition: shellpath.c:5411
static BOOL PathQualifyA(LPCSTR pszPath)
Definition: shellpath.c:1387
static HRESULT get_known_folder_wstr(const WCHAR *regpath, const WCHAR *value, WCHAR **out)
Definition: shellpath.c:4711
BOOL WINAPI SHGetSpecialFolderPathAW(HWND hwndOwner, LPVOID szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:4433
HRESULT WINAPI SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE token, WCHAR **ret_path)
Definition: shellpath.c:4593
static HRESULT WINAPI ApplicationDocumentLists_QueryInterface(IApplicationDocumentLists *iface, REFIID riid, LPVOID *ppv)
Definition: shellpath.c:1706
static const BOOL is_win64
Definition: shellpath.c:92
#define CSIDL_SEARCHES
Definition: shellpath.c:1574
_CSIDL_Type
Definition: shellpath.c:1557
@ CSIDL_Type_CurrVer
Definition: shellpath.c:1560
@ CSIDL_Type_ProgramData
Definition: shellpath.c:1566
@ CSIDL_Type_AllUsers
Definition: shellpath.c:1559
@ CSIDL_Type_WindowsPath
Definition: shellpath.c:1563
@ CSIDL_Type_Disallowed
Definition: shellpath.c:1561
@ CSIDL_Type_SystemX86Path
Definition: shellpath.c:1565
@ CSIDL_Type_SystemPath
Definition: shellpath.c:1564
@ CSIDL_Type_User
Definition: shellpath.c:1558
@ CSIDL_Type_NonExistent
Definition: shellpath.c:1562
BOOL WINAPI PathIsSameRootAW(LPCVOID lpszPath1, LPCVOID lpszPath2)
Definition: shellpath.c:801
HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCWSTR pszSubPath, LPWSTR pszPath)
Definition: shellpath.c:3881
VOID WINAPI PathQuoteSpacesAW(LPVOID lpszPath)
Definition: shellpath.c:656
static DWORD xdg_config_len
Definition: shellpath.c:3622
static HRESULT _SHOpenProfilesKey(PHKEY pKey)
Definition: shellpath.c:3405
HRESULT WINAPI SHGetFolderPathEx(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE token, LPWSTR path, DWORD len)
Definition: shellpath.c:4648
BOOL WINAPI PathIsUNCAW(LPCVOID lpszPath)
Definition: shellpath.c:691
BOOL WINAPI PathMatchSpecAW(LPVOID name, LPVOID mask)
Definition: shellpath.c:791
int WINAPI PathParseIconLocationAW(LPVOID lpszPath)
Definition: shellpath.c:678
#define CSIDL_SAVED_GAMES
Definition: shellpath.c:1573
BOOL WINAPI PathResolveW(WCHAR *path, const WCHAR **dirs, DWORD flags)
Definition: shellpath.c:1447
static LONG PathProcessCommandW(LPCWSTR lpszPath, LPWSTR lpszBuff, DWORD dwBuffSize, DWORD dwFlags)
Definition: shellpath.c:1514
static HRESULT knownfolder_set_id(struct knownfolder *knownfolder, const KNOWNFOLDERID *kfid)
Definition: shellpath.c:4938
static HRESULT WINAPI ApplicationDestinations_RemoveDestination(IApplicationDestinations *iface, IUnknown *punk)
Definition: shellpath.c:1644
BOOL WINAPI IsLFNDriveW(LPCWSTR lpszPath)
Definition: shellpath.c:886
static ULONG WINAPI foldermanager_AddRef(IKnownFolderManager *iface)
Definition: shellpath.c:5291
static IApplicationDestinationsImpl * impl_from_IApplicationDestinations(IApplicationDestinations *iface)
Definition: shellpath.c:1582
static HRESULT foldermanager_create(void **ppv)
Definition: shellpath.c:5612
static HRESULT WINAPI foldermanager_FolderIdToCsidl(IKnownFolderManager *iface, REFKNOWNFOLDERID rfid, int *pnCsidl)
Definition: shellpath.c:5354
HRESULT WINAPI ApplicationDocumentLists_Constructor(IUnknown *outer, REFIID riid, LPVOID *ppv)
Definition: shellpath.c:1784
static HRESULT register_folder(const KNOWNFOLDERID *rfid, const KNOWNFOLDER_DEFINITION *pKFD)
Definition: shellpath.c:5489
static HRESULT WINAPI foldermanager_GetFolderByName(IKnownFolderManager *iface, LPCWSTR pszCanonicalName, IKnownFolder **ppkf)
Definition: shellpath.c:5439
static HRESULT _SHGetAllUsersProfilePath(DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:3366
HRESULT WINAPI SHGetFolderPathAndSubDirA(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPCSTR pszSubPath, LPSTR pszPath)
Definition: shellpath.c:3829
static ULONG WINAPI knownfolder_AddRef(IKnownFolder *iface)
Definition: shellpath.c:4888
static ULONG WINAPI foldermanager_Release(IKnownFolderManager *iface)
Definition: shellpath.c:5298
static HRESULT WINAPI foldermanager_FolderIdFromCsidl(IKnownFolderManager *iface, int nCsidl, KNOWNFOLDERID *pfid)
Definition: shellpath.c:5341
static HRESULT WINAPI ApplicationDestinations_SetAppID(IApplicationDestinations *iface, const WCHAR *appid)
Definition: shellpath.c:1635
static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:3085
static void create_link(const WCHAR *path, const char *xdg_name, const char *default_name)
Definition: shellpath.c:3728
static BOOL PathIsExeA(LPCSTR lpszPath)
Definition: shellpath.c:721
static void register_system_knownfolders(void)
Definition: shellpath.c:5727
LPVOID WINAPI PathFindExtensionAW(LPCVOID lpszPath)
Definition: shellpath.c:480
static HRESULT _SHGetProfilesValue(HKEY profilesKey, LPCWSTR szValueName, LPWSTR szValue, LPCWSTR szDefault)
Definition: shellpath.c:3420
static const CSIDL_DATA CSIDL_Data[]
Definition: shellpath.c:1826
static HRESULT redirect_known_folder(REFKNOWNFOLDERID rfid, HWND hwnd, KF_REDIRECT_FLAGS flags, LPCWSTR pszTargetPath, UINT cFolders, KNOWNFOLDERID const *pExclusion, LPWSTR *ppszError)
Definition: shellpath.c:4785
static HRESULT create_extra_folders(void)
Definition: shellpath.c:4265
static const IApplicationDocumentListsVtbl ApplicationDocumentListsVtbl
Definition: shellpath.c:1775
static HRESULT WINAPI knownfolder_GetIDList(IKnownFolder *iface, DWORD flags, PIDLIST_ABSOLUTE *ppidl)
Definition: shellpath.c:5173
BOOL WINAPI PathMakeUniqueNameAW(LPVOID lpszBuffer, DWORD dwBuffSize, LPCVOID lpszShortName, LPCVOID lpszLongName, LPCVOID lpszPathName)
Definition: shellpath.c:1093
static HRESULT WINAPI foldermanager_RegisterFolder(IKnownFolderManager *iface, REFKNOWNFOLDERID rfid, KNOWNFOLDER_DEFINITION const *pKFD)
Definition: shellpath.c:5537
static HRESULT WINAPI ApplicationDestinations_QueryInterface(IApplicationDestinations *iface, REFIID riid, LPVOID *ppv)
Definition: shellpath.c:1587
LONG WINAPI PathProcessCommandAW(LPCVOID lpszPath, LPVOID lpszBuff, DWORD dwBuffSize, DWORD dwFlags)
Definition: shellpath.c:1531
static BOOL PathIsExeW(LPCWSTR lpszPath)
Definition: shellpath.c:742
static HRESULT get_known_folder_redirection_place(REFKNOWNFOLDERID rfid, HKEY *rootKey)
Definition: shellpath.c:4749
VOID WINAPI PathGetShortPathAW(LPVOID pszPath)
Definition: shellpath.c:635
static HRESULT _SHRegisterCommonShellFolders(void)
Definition: shellpath.c:4232
static LPWSTR _GetUserSidStringFromToken(HANDLE Token)
Definition: shellpath.c:3238
static char * xdg_config
Definition: shellpath.c:3621
void WINAPI PathRemoveExtensionAW(LPVOID lpszPath)
Definition: shellpath.c:589
static LONG PathProcessCommandA(LPCSTR lpszPath, LPSTR lpszBuff, DWORD dwBuffSize, DWORD dwFlags)
Definition: shellpath.c:1497
static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken, LPCWSTR szUserShellFolderPath, LPCWSTR szShellFolderPath, const UINT folders[], UINT foldersLen)
Definition: shellpath.c:4078
static HRESULT WINAPI knownfolder_GetId(IKnownFolder *iface, KNOWNFOLDERID *pkfid)
Definition: shellpath.c:4970
int WINAPI PathCleanupSpec(LPCWSTR lpszPathW, LPWSTR lpszFileW)
Definition: shellpath.c:1155
static HRESULT WINAPI foldermanager_FindFolderFromIDList(IKnownFolderManager *iface, PCIDLIST_ABSOLUTE pidl, IKnownFolder **ppkf)
Definition: shellpath.c:5573
static void append_relative_path(BYTE folder, WCHAR *pszPath)
Definition: shellpath.c:3059
static HRESULT WINAPI knownfolder_GetFolderDefinition(IKnownFolder *iface, KNOWNFOLDER_DEFINITION *pKFD)
Definition: shellpath.c:5201
static const struct IKnownFolderManagerVtbl foldermanager_vtbl
Definition: shellpath.c:5595
static HRESULT _SHGetUserProfilePath(HANDLE hToken, DWORD dwFlags, BYTE folder, LPWSTR pszPath)
Definition: shellpath.c:3279
static struct knownfolder * impl_from_IKnownFolder(IKnownFolder *iface)
Definition: shellpath.c:4883
BOOL WINAPI PathRemoveFileSpecAW(LPVOID lpszPath)
Definition: shellpath.c:547
static HRESULT knownfolder_create(struct knownfolder **knownfolder)
Definition: shellpath.c:5260
BOOL WINAPI SHGetSpecialFolderPathA(HWND hwndOwner, LPSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:4381
HRESULT WINAPI SHGetFolderPathA(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPSTR pszPath)
Definition: shellpath.c:4048
BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR shortname, LPCWSTR longname)
Definition: shellpath.c:1108
VOID WINAPI PathSetDlgItemPathAW(HWND hDlg, int id, LPCVOID pszPath)
Definition: shellpath.c:1549
HRESULT WINAPI KnownFolderManager_Constructor(IUnknown *punk, REFIID riid, void **ppv)
Definition: shellpath.c:5649
static HRESULT WINAPI knownfolder_GetPath(IKnownFolder *iface, DWORD dwFlags, LPWSTR *ppszPath)
Definition: shellpath.c:5142
static HRESULT WINAPI foldermanager_QueryInterface(IKnownFolderManager *iface, REFIID riid, void **ppv)
Definition: shellpath.c:5312
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:4394
BOOL WINAPI PathFindOnPathAW(LPVOID sFile, LPCVOID *sOtherDirs)
Definition: shellpath.c:1143
static void _SHCreateSymbolicLink(int nFolder, const WCHAR *path)
Definition: shellpath.c:3766
static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix, LPCWSTR value, LPWSTR path)
Definition: shellpath.c:2976
static HRESULT WINAPI ApplicationDocumentLists_SetAppID(IApplicationDocumentLists *iface, const WCHAR *appid)
Definition: shellpath.c:1754
BOOL WINAPI PathIsRelativeAW(LPCVOID lpszPath)
Definition: shellpath.c:701
LPVOID WINAPI PathCombineAW(LPVOID szDest, LPCVOID lpszDir, LPCVOID lpszFile)
Definition: shellpath.c:433
static void PathGetShortPathW(LPWSTR pszPath)
Definition: shellpath.c:620
static ULONG WINAPI ApplicationDestinations_AddRef(IApplicationDestinations *iface)
Definition: shellpath.c:1612
BOOL WINAPI IsLFNDriveA(LPCSTR lpszPath)
Definition: shellpath.c:874
static ULONG WINAPI ApplicationDestinations_Release(IApplicationDestinations *iface)
Definition: shellpath.c:1622
VOID WINAPI PathUnquoteSpacesAW(LPVOID str)
Definition: shellpath.c:667
static const struct IKnownFolderVtbl knownfolder_vtbl
Definition: shellpath.c:5244
HRESULT WINAPI SHGetKnownFolderItem(REFKNOWNFOLDERID rfid, KNOWN_FOLDER_FLAG flags, HANDLE hToken, REFIID riid, void **ppv)
Definition: shellpath.c:5707
#define CSIDL_CONTACTS
Definition: shellpath.c:1569
static HRESULT WINAPI foldermanager_UnregisterFolder(IKnownFolderManager *iface, REFKNOWNFOLDERID rfid)
Definition: shellpath.c:5546
static const IApplicationDestinationsVtbl ApplicationDestinationsVtbl
Definition: shellpath.c:1662
static HRESULT WINAPI foldermanager_Redirect(IKnownFolderManager *iface, REFKNOWNFOLDERID rfid, HWND hwnd, KF_REDIRECT_FLAGS flags, LPCWSTR pszTargetPath, UINT cFolders, KNOWNFOLDERID const *pExclusion, LPWSTR *ppszError)
Definition: shellpath.c:5582
HRESULT WINAPI SHGetKnownFolderIDList(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE token, PIDLIST_ABSOLUTE *pidl)
Definition: shellpath.c:5661
VOID WINAPI FixSlashesAndColonW(LPWSTR lpwstr)
Definition: ordinal.c:3976
void WINAPI PathRemoveArgsW(LPWSTR lpszPath)
Definition: path.c:153
BOOL WINAPI PathFileExistsDefExtA(LPSTR lpszPath, DWORD dwWhich)
Definition: path.c:248
BOOL WINAPI PathIsDirectoryA(LPCSTR lpszPath)
Definition: path.c:625
LPSTR WINAPI PathBuildRootA(LPSTR lpszPath, int drive)
Definition: path.c:86
BOOL WINAPI PathFindOnPathExA(LPSTR lpszFile, LPCSTR *lppszOtherDirs, DWORD dwWhich)
Definition: path.c:360
void WINAPI PathRemoveArgsA(LPSTR lpszPath)
Definition: path.c:130
BOOL WINAPI PathFindOnPathW(LPWSTR lpszFile, LPCWSTR *lppszOtherDirs)
Definition: path.c:456
BOOL WINAPI PathFindOnPathA(LPSTR lpszFile, LPCSTR *lppszOtherDirs)
Definition: path.c:445
LPWSTR WINAPI PathBuildRootW(LPWSTR lpszPath, int drive)
Definition: path.c:105
VOID WINAPI PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR lpszPath)
Definition: path.c:1246
BOOL WINAPI PathFindOnPathExW(LPWSTR lpszFile, LPCWSTR *lppszOtherDirs, DWORD dwWhich)
Definition: path.c:404
VOID WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR lpszPath)
Definition: path.c:1264
BOOL WINAPI PathFileExistsAndAttributesW(LPCWSTR lpszPath, DWORD *dwAttr)
Definition: path.c:747
BOOL WINAPI PathFileExistsDefExtW(LPWSTR lpszPath, DWORD dwWhich)
Definition: path.c:170
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:669
#define IShellFolder_ParseDisplayName
Definition: utils.cpp:14
BOOL WINAPI GetAllUsersProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1315
BOOL WINAPI GetDefaultUserProfileDirectoryW(_Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1426
BOOL WINAPI GetUserProfileDirectoryW(_In_ HANDLE hToken, _Out_opt_ LPWSTR lpProfileDir, _Inout_ LPDWORD lpcchSize)
Definition: profile.c:1753
static const WCHAR Cleanup[]
Definition: register.c:80
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
r parent
Definition: btrfs.c:3010
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
GLuint res
Definition: glext.h:9613
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLuint mask
Definition: glext.h:6028
GLbitfield flags
Definition: glext.h:7161
GLuint srcPath
Definition: glext.h:11718
GLsizei maxCount
Definition: glext.h:6042
GLenum mode
Definition: glext.h:6217
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLfloat param
Definition: glext.h:5796
GLenum GLsizei len
Definition: glext.h:6722
GLsizei const GLuint * paths
Definition: glext.h:11717
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
unsigned int UINT
Definition: sysinfo.c:13
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define NTDDI_VERSION
Definition: k32.h:35
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
BOOL is_wow64
Definition: main.c:38
#define GUID_NULL
Definition: ks.h:106
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define ZeroMemory
Definition: minwinbase.h:31
CONST void * LPCVOID
Definition: minwindef.h:164
#define error(str)
Definition: mkdosfs.c:1605
#define pch(ap)
Definition: match.c:418
char * appid
Definition: mkisofs.c:161
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
LPCWSTR szPath
Definition: env.c:37
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static PVOID ptr
Definition: dispmode.c:27
const char * var
Definition: shader.c:5879
static const WCHAR pathW[]
Definition: path.c:2368
static IUnknown * outer
Definition: compobj.c:82
static HWND child
Definition: cursoricon.c:298
static const WCHAR path1[]
Definition: path.c:28
#define min(a, b)
Definition: monoChain.cc:55
#define MOUNTMGR_DOS_DEVICE_NAME
Definition: mountmgr.h:37
const CLSID * clsid
Definition: msctf.cpp:50
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define _Inout_
Definition: no_sal2.h:162
#define _Inout_opt_
Definition: no_sal2.h:216
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
#define KEY_READ
Definition: nt_native.h:1026
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1022
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define KEY_WRITE
Definition: nt_native.h:1034
#define DWORD
Definition: nt_native.h:44
#define GENERIC_WRITE
Definition: nt_native.h:90
#define REG_EXPAND_SZ
Definition: nt_native.h:1497
#define UNICODE_NULL
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
Definition: ntifs_ex.h:384
static HANDLE ACCESS_MASK ULONG attributes
Definition: om.c:94
DWORD WINAPI GetShortPathNameA(IN LPCSTR lpszLongPath, OUT LPSTR lpszShortPath, IN DWORD cchBuffer)
Definition: pathansi.c:20
#define PathCombineA
Definition: pathcch.h:317
#define PathAppendA
Definition: pathcch.h:309
#define PathAddBackslashA
Definition: pathcch.h:301
#define PathCombineW
Definition: pathcch.h:318
#define PathAddBackslashW
Definition: pathcch.h:302
#define PathAppendW
Definition: pathcch.h:310
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
char CHAR
Definition: pedump.c:57
LPITEMIDLIST _ILCreateMyComputer(void)
Definition: pidl.c:1807
LPITEMIDLIST _ILCreateIExplore(void)
Definition: pidl.c:1819
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1051
HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST *ppidl, DWORD *attributes)
Definition: pidl.c:404
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:817
LPITEMIDLIST _ILCreateDesktop(void)
Definition: pidl.c:1796
LPITEMIDLIST _ILCreateNetwork(void)
Definition: pidl.c:1870
LPITEMIDLIST _ILCreatePrinters(void)
Definition: pidl.c:1843
LPITEMIDLIST _ILCreateControlPanel(void)
Definition: pidl.c:1825
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
Definition: pidl.c:1108
LPITEMIDLIST _ILCreateMyDocuments(void)
Definition: pidl.c:1813
LPITEMIDLIST _ILCreateBitBucket(void)
Definition: pidl.c:1876
#define INT
Definition: polytest.cpp:20
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
_In_opt_ IUnknown * punk
Definition: shlwapi.h:158
#define GCT_SEPARATOR
Definition: shlwapi.h:275
_In_ INT cchDest
Definition: shlwapi.h:1161
#define GCT_INVALID
Definition: shlwapi.h:271
#define GCT_WILD
Definition: shlwapi.h:274
const WCHAR * str
#define REG_DWORD
Definition: sdbapi.c:615
strcpy
Definition: string.h:131
#define memset(x, y, z)
Definition: compat.h:39
#define NTDDI_VISTA
Definition: sdkddkver.h:103
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:197
static __inline LPWSTR __SHCloneStrAtoW(WCHAR **target, const char *source)
Definition: shell32_main.h:227
_In_ UINT _In_ UINT cch
Definition: shellapi.h:428
#define FO_DELETE
Definition: shellapi.h:138
#define FO_COPY
Definition: shellapi.h:137
_In_ LPCSTR pszDir
Definition: shellapi.h:612
#define FOF_NO_UI
Definition: shellapi.h:157
#define FO_MOVE
Definition: shellapi.h:136
int WINAPI SHFileOperationW(LPSHFILEOPSTRUCTW lpFileOp)
Definition: shlfileop.cpp:2200
int WINAPI SHCreateDirectory(HWND hWnd, LPCWSTR path)
Definition: shlfileop.cpp:948
int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES sec)
Definition: shlfileop.cpp:1006
#define CSIDL_COMMON_TEMPLATES
Definition: shlobj.h:2264
#define CSIDL_COMMON_DESKTOPDIRECTORY
Definition: shlobj.h:2244
#define CSIDL_TEMPLATES
Definition: shlobj.h:2240
#define CSIDL_PROGRAM_FILES
Definition: shlobj.h:2257
#define CSIDL_INTERNET_CACHE
Definition: shlobj.h:2251
_In_ int _In_ BOOL bCreate
Definition: shlobj.h:1565
#define CSIDL_DESKTOPDIRECTORY
Definition: shlobj.h:2235
#define CSIDL_SENDTO
Definition: shlobj.h:2229
#define CSIDL_RECENT
Definition: shlobj.h:2228
#define CSIDL_ADMINTOOLS
Definition: shlobj.h:2267
#define CSIDL_COMMON_STARTMENU
Definition: shlobj.h:2241
@ SHGFP_TYPE_DEFAULT
Definition: shlobj.h:2197
@ SHGFP_TYPE_CURRENT
Definition: shlobj.h:2196
#define PCS_REPLACEDCHAR
Definition: shlobj.h:396
#define CSIDL_FONTS
Definition: shlobj.h:2239
#define CSIDL_PERSONAL
Definition: shlobj.h:2225
#define CSIDL_FAVORITES
Definition: shlobj.h:2226
#define CSIDL_FLAG_CREATE
Definition: shlobj.h:2282
#define CSIDL_FLAG_NO_ALIAS
Definition: shlobj.h:2280
#define CSIDL_COMMON_APPDATA
Definition: shlobj.h:2254
#define CSIDL_CONNECTIONS
Definition: shlobj.h:2268
#define CSIDL_COMMON_PROGRAMS
Definition: shlobj.h:2242
#define PCS_PATHTOOLONG
Definition: shlobj.h:399
#define CSIDL_FLAG_DONT_VERIFY
Definition: shlobj.h:2281
#define CSIDL_MYPICTURES
Definition: shlobj.h:2258
#define CSIDL_COOKIES
Definition: shlobj.h:2252
#define CSIDL_COMMON_FAVORITES
Definition: shlobj.h:2250
#define CSIDL_PRINTERS
Definition: shlobj.h:2224
KNOWN_FOLDER_FLAG
Definition: shlobj.h:97
@ KF_FLAG_NOT_PARENT_RELATIVE
Definition: shlobj.h:100
@ KF_FLAG_NO_ALIAS
Definition: shlobj.h:103
@ KF_FLAG_SIMPLE_IDLIST
Definition: shlobj.h:99
@ KF_FLAG_DONT_UNEXPAND
Definition: shlobj.h:104
@ KF_FLAG_DONT_VERIFY
Definition: shlobj.h:105
@ KF_FLAG_CREATE
Definition: shlobj.h:106
@ KF_FLAG_INIT
Definition: shlobj.h:102
#define CSIDL_HISTORY
Definition: shlobj.h:2253
#define CSIDL_LOCAL_APPDATA
Definition: shlobj.h:2247
#define CSIDL_PROGRAM_FILES_COMMONX86
Definition: shlobj.h:2263
#define CSIDL_PROGRAM_FILES_COMMON
Definition: shlobj.h:2262
#define CSIDL_COMMON_MUSIC
Definition: shlobj.h:2269
#define PCS_FATAL
Definition: shlobj.h:395
#define CSIDL_COMMON_VIDEO
Definition: shlobj.h:2271
#define CSIDL_FOLDER_MASK
Definition: shlobj.h:2278
#define CSIDL_DESKTOP
Definition: shlobj.h:2220
#define CSIDL_NETWORK
Definition: shlobj.h:2237
#define CSIDL_STARTMENU
Definition: shlobj.h:2231
#define CSIDL_PROGRAM_FILESX86
Definition: shlobj.h:2261
#define CSIDL_COMMON_PICTURES
Definition: shlobj.h:2270
#define CSIDL_PROGRAMS
Definition: shlobj.h:2222
#define CSIDL_COMMON_STARTUP
Definition: shlobj.h:2243
#define CSIDL_APPDATA
Definition: shlobj.h:2245
#define CSIDL_PRINTHOOD
Definition: shlobj.h:2246
#define KF_FLAG_DEFAULT_PATH
Definition: shlobj.h:354
#define CSIDL_STARTUP
Definition: shlobj.h:2227
#define CSIDL_DRIVES
Definition: shlobj.h:2236
#define CSIDL_MYMUSIC
Definition: shlobj.h:2233
#define CSIDL_INTERNET
Definition: shlobj.h:2221
#define CSIDL_FLAG_MASK
Definition: shlobj.h:2284
#define CSIDL_COMMON_DOCUMENTS
Definition: shlobj.h:2265
#define CSIDL_CONTROLS
Definition: shlobj.h:2223
#define CSIDL_BITBUCKET
Definition: shlobj.h:2230
#define CSIDL_NETHOOD
Definition: shlobj.h:2238
#define CSIDL_COMMON_ADMINTOOLS
Definition: shlobj.h:2266
#define CSIDL_MYVIDEO
Definition: shlobj.h:2234
_In_ int nFolder
Definition: shlobj.h:1564
#define WHICH_DEFAULT
enum tagKF_DEFINITION_FLAGS KF_DEFINITION_FLAGS
@ KF_REDIRECTION_CAPABILITIES_DENY_ALL
Definition: shobjidl.idl:4083
@ KFDF_PUBLISHEXPANDEDPATH
Definition: shobjidl.idl:4095
@ KFDF_LOCAL_REDIRECT_ONLY
Definition: shobjidl.idl:4091
@ KFDF_ROAMABLE
Definition: shobjidl.idl:4092
@ KFDF_PRECREATE
Definition: shobjidl.idl:4093
@ KFDF_STREAM
Definition: shobjidl.idl:4094
pointer_default(unique)] interface IFileDialogCustomize enum tagKF_REDIRECTION_CAPABILITIES KF_REDIRECTION_CAPABILITIES
#define IDI_SHELL_MY_DOCUMENTS
Definition: shresdef.h:721
#define IDI_SHELL_MY_MUSIC
Definition: shresdef.h:723
#define IDI_SHELL_MY_PICTURES
Definition: shresdef.h:722
#define IDI_SHELL_TSKBAR_STARTMENU
Definition: shresdef.h:631
#define IDI_SHELL_COMPUTER_FOLDER
Definition: shresdef.h:634
#define IDI_SHELL_FAVORITES
Definition: shresdef.h:635
#define IDI_SHELL_MY_MOVIES
Definition: shresdef.h:724
#define IDI_SHELL_RECENT_DOCUMENTS
Definition: shresdef.h:612
#define IDI_SHELL_NETWORK
Definition: shresdef.h:606
#define IDI_SHELL_PRINTERS_FOLDER
Definition: shresdef.h:629
#define IDI_SHELL_FONTS_FOLDER
Definition: shresdef.h:630
#define IDI_SHELL_CONTROL_PANEL
Definition: shresdef.h:613
#define IDI_SHELL_SYSTEM_GEAR
Definition: shresdef.h:760
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
const WCHAR * value
Definition: shellpath.c:1811
DWORD attributes
Definition: shellpath.c:1818
const WCHAR * name
Definition: shellpath.c:1814
const WCHAR * parsing
Definition: shellpath.c:1817
CSIDL_Type type
Definition: shellpath.c:1810
const WCHAR * def_path
Definition: shellpath.c:1812
KF_CATEGORY category
Definition: shellpath.c:1813
const KNOWNFOLDERID * parent
Definition: shellpath.c:1815
const WCHAR * path
Definition: shellpath.c:1816
const KNOWNFOLDERID * id
Definition: shellpath.c:1809
KF_DEFINITION_FLAGS flags
Definition: shellpath.c:1819
IApplicationDestinations IApplicationDestinations_iface
Definition: shellpath.c:1578
IApplicationDocumentLists IApplicationDocumentLists_iface
Definition: shellpath.c:1697
LPCWSTR pFrom
Definition: shellapi.h:370
FILEOP_FLAGS fFlags
Definition: shellapi.h:372
SID_AND_ATTRIBUTES User
Definition: setypes.h:1022
Definition: cookie.c:202
Definition: http.c:7783
char * name
Definition: wpp.c:52
Definition: fci.c:123
Definition: dsound.c:943
Definition: fci.c:112
BSTR path
Definition: filesystem.c:108
KNOWNFOLDERID * ids
Definition: shellpath.c:5283
IKnownFolderManager IKnownFolderManager_iface
Definition: shellpath.c:5280
Definition: copy.c:22
LPWSTR registryPath
Definition: shellpath.c:4880
KNOWNFOLDERID id
Definition: shellpath.c:4879
IKnownFolder IKnownFolder_iface
Definition: shellpath.c:4877
Definition: name.c:39
Definition: send.c:48
KF_DEFINITION_FLAGS kfdFlags
Definition: shobjidl.idl:4111
Definition: tools.h:99
PCSYMCRYPT_HMAC_MD5_EXPANDED_KEY pKey
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
uint16_t * PWSTR
Definition: typedefs.h:56
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * PCWSTR
Definition: typedefs.h:57
const uint16_t * LPCWSTR
Definition: typedefs.h:57
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56
PVOID HANDLE
Definition: typedefs.h:73
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t * LPDWORD
Definition: typedefs.h:59
char * LPSTR
Definition: typedefs.h:51
int32_t INT
Definition: typedefs.h:58
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define SHSTDAPI
Definition: undocshell.h:22
Definition: pdh_main.c:64
DWORD dwAttributes
Definition: vdmdbg.h:34
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
RTL_RUN_ONCE INIT_ONCE
Definition: winbase.h:3654
#define DRIVE_REMOVABLE
Definition: winbase.h:276
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WINAPI
Definition: msvc.h:6
#define swprintf
Definition: winemm.h:209
#define S_FALSE
Definition: winerror.h:3451
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:3437
#define E_NOINTERFACE
Definition: winerror.h:3479
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:228
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771
#define ERROR_FILENAME_EXCED_RANGE
Definition: winerror.h:385
#define E_POINTER
Definition: winerror.h:3480
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RRF_RT_DWORD
Definition: winreg.h:64
#define RRF_RT_REG_SZ
Definition: winreg.h:58
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define HKEY_USERS
Definition: winreg.h:13
#define ioctl
Definition: wintirpc.h:60
static const WCHAR userName[]
Definition: wnet.c:2156
struct _TOKEN_USER * PTOKEN_USER
#define TOKEN_QUERY
Definition: setypes.h:940
@ TokenUser
Definition: setypes.h:978
unsigned char BYTE
Definition: xxhash.c:193