4 * Many of this functions are in SHLWAPI.DLL also
9 #include "debugtools.h"
11 #include "winversion.h"
16 #include "shell32_main.h"
18 DEFAULT_DEBUG_CHANNEL(shell)
20 /*************************************************************************
21 * PathIsRoot [SHELL32.29]
23 BOOL WINAPI PathIsRootA(LPCSTR x)
25 if (*(x+1)==':' && *(x+2)=='\\') /* "X:\" */
27 if (*x=='\\') /* "\" */
29 if (x[0]=='\\' && x[1]=='\\') /* UNC "\\<xx>\" */
30 { int foundbackslash = 0;
36 if (foundbackslash<=1) /* max 1 \ more ... */
41 BOOL WINAPI PathIsRootW(LPCWSTR x)
42 { TRACE("%s\n",debugstr_w(x));
43 if (*(x+1)==':' && *(x+2)=='\\') /* "X:\" */
45 if (*x == (WCHAR) '\\') /* "\" */
47 if (x[0]==(WCHAR)'\\' && x[1]==(WCHAR)'\\') /* UNC "\\<xx>\" */
48 { int foundbackslash = 0;
51 { if (*x++==(WCHAR)'\\')
54 if (foundbackslash<=1) /* max 1 \ more ... */
59 BOOL WINAPI PathIsRootAW(LPCVOID x)
60 { if (VERSION_OsIsUnicode())
61 return PathIsRootW(x);
62 return PathIsRootA(x);
65 /*************************************************************************
66 * PathBuildRoot [SHELL32.30]
68 LPSTR WINAPI PathBuildRootA(LPSTR root,BYTE drive) {
69 TRACE("%p %i\n",root, drive);
75 /*************************************************************************
76 * PathFindExtension [SHELL32.31]
79 * returns pointer to last . in last pathcomponent or at \0.
81 LPCSTR WINAPI PathFindExtensionA(LPCSTR path)
82 { LPCSTR lastpoint = NULL;
83 TRACE("%p %s\n",path,path);
85 { if (*path=='\\'||*path==' ')
91 return lastpoint?lastpoint:path;
93 LPCWSTR WINAPI PathFindExtensionW(LPCWSTR path)
94 { LPCWSTR lastpoint = NULL;
95 TRACE("%p L%s\n",path,debugstr_w(path));
97 { if (*path==(WCHAR)'\\'||*path==(WCHAR)' ')
99 if (*path==(WCHAR)'.')
103 return lastpoint?lastpoint:path;
105 LPCVOID WINAPI PathFindExtensionAW(LPCVOID path)
106 { if (VERSION_OsIsUnicode())
107 return PathFindExtensionW(path);
108 return PathFindExtensionA(path);
112 /*************************************************************************
113 * PathAddBackslash [SHELL32.32]
116 * append \ if there is none
118 LPSTR WINAPI PathAddBackslashA(LPSTR path)
120 TRACE("%p->%s\n",path,path);
123 if (len && path[len-1]!='\\')
130 LPWSTR WINAPI PathAddBackslashW(LPWSTR path)
132 TRACE("%p->%s\n",path,debugstr_w(path));
134 len = CRTDLL_wcslen(path);
135 if (len && path[len-1]!=(WCHAR)'\\')
136 { path[len] = (WCHAR)'\\';
142 LPVOID WINAPI PathAddBackslashAW(LPVOID path)
143 { if(VERSION_OsIsUnicode())
144 return PathAddBackslashW(path);
145 return PathAddBackslashA(path);
148 /*************************************************************************
149 * PathRemoveBlanks [SHELL32.33]
152 * remove spaces from beginning and end of passed string
154 LPSTR WINAPI PathRemoveBlanksA(LPSTR str)
169 LPWSTR WINAPI PathRemoveBlanksW(LPWSTR str)
171 TRACE("%s\n",debugstr_w(str));
174 CRTDLL_wcscpy(str,x);
177 x=str+CRTDLL_wcslen(str)-1;
184 LPVOID WINAPI PathRemoveBlanksAW(LPVOID str)
185 { if(VERSION_OsIsUnicode())
186 return PathRemoveBlanksW(str);
187 return PathRemoveBlanksA(str);
192 /*************************************************************************
193 * PathFindFilename [SHELL32.34]
196 * basename(char *fn);
198 LPCSTR WINAPI PathFindFilenameA(LPCSTR aptr)
202 TRACE("%s\n",aslash);
204 { if (((aptr[0]=='\\') || (aptr[0]==':')) && aptr[1] && aptr[1]!='\\')
211 LPCWSTR WINAPI PathFindFilenameW(LPCWSTR wptr)
215 TRACE("L%s\n",debugstr_w(wslash));
217 { if (((wptr[0]=='\\') || (wptr[0]==':')) && wptr[1] && wptr[1]!='\\')
223 LPCVOID WINAPI PathFindFilenameAW(LPCVOID fn)
225 if(VERSION_OsIsUnicode())
226 return PathFindFilenameW(fn);
227 return PathFindFilenameA(fn);
230 /*************************************************************************
231 * PathRemoveFileSpec [SHELL32.35]
234 * bool getpath(char *pathname); truncates passed argument to a valid path
235 * returns if the string was modified or not.
236 * "\foo\xx\foo"-> "\foo\xx"
240 DWORD WINAPI PathRemoveFileSpecA(LPSTR fn) {
256 continue; /* already x++ed */
274 /*************************************************************************
275 * PathAppend [SHELL32.36]
278 * concat_paths(char*target,const char*add);
279 * concats "target\\add" and writes them to target
281 LPSTR WINAPI PathAppendA(LPSTR x1,LPSTR x2) {
282 TRACE("%s %s\n",x1,x2);
283 while (x2[0]=='\\') x2++;
284 return PathCombineA(x1,x1,x2);
287 /*************************************************************************
288 * PathCombine [SHELL32.37]
291 * if lpszFile='.' skip it
292 * szDest can be equal to lpszFile. Thats why we use sTemp
294 LPSTR WINAPI PathCombineA(LPSTR szDest, LPCSTR lpszDir, LPCSTR lpszFile)
295 { char sTemp[MAX_PATH];
296 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, lpszDir, lpszFile, lpszFile);
299 if (!lpszFile || !lpszFile[0] || (lpszFile[0]=='.' && !lpszFile[1]) )
300 { strcpy(szDest,lpszDir);
304 /* if lpszFile is a complete path don't care about lpszDir */
305 if (PathIsRootA(lpszFile))
306 { strcpy(szDest,lpszFile);
309 { strcpy(sTemp,lpszDir);
310 PathAddBackslashA(sTemp);
311 strcat(sTemp,lpszFile);
312 strcpy(szDest,sTemp);
316 LPWSTR WINAPI PathCombineW(LPWSTR szDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
317 { WCHAR sTemp[MAX_PATH];
318 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, debugstr_w(lpszDir),
319 lpszFile, debugstr_w(lpszFile));
322 if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) )
323 { CRTDLL_wcscpy(szDest,lpszDir);
327 /* if lpszFile is a complete path don't care about lpszDir */
328 if (PathIsRootW(lpszFile))
329 { CRTDLL_wcscpy(szDest,lpszFile);
332 { CRTDLL_wcscpy(sTemp,lpszDir);
333 PathAddBackslashW(sTemp);
334 CRTDLL_wcscat(sTemp,lpszFile);
335 CRTDLL_wcscpy(szDest,sTemp);
339 LPVOID WINAPI PathCombineAW(LPVOID szDest, LPCVOID lpszDir, LPCVOID lpszFile)
340 { if (VERSION_OsIsUnicode())
341 return PathCombineW( szDest, lpszDir, lpszFile );
342 return PathCombineA( szDest, lpszDir, lpszFile );
345 /*************************************************************************
346 * PathIsUNC [SHELL32.39]
349 * PathIsUNC(char*path);
351 BOOL WINAPI PathIsUNCA(LPCSTR path)
352 { TRACE("%s\n",path);
354 if ((path[0]=='\\') && (path[1]=='\\'))
358 BOOL WINAPI PathIsUNCW(LPCWSTR path)
359 { TRACE("%s\n",debugstr_w(path));
361 if ((path[0]=='\\') && (path[1]=='\\'))
365 BOOL WINAPI PathIsUNCAW (LPCVOID path)
366 { if (VERSION_OsIsUnicode())
367 return PathIsUNCW( path );
368 return PathIsUNCA( path );
370 /*************************************************************************
371 * PathIsRelativ [SHELL32.40]
374 BOOL WINAPI PathIsRelativeA (LPCSTR path)
375 { TRACE("path=%s\n",path);
377 if (path && (path[0]!='\\' && path[1]==':'))
381 BOOL WINAPI PathIsRelativeW (LPCWSTR path)
382 { TRACE("path=%s\n",debugstr_w(path));
384 if (path && (path[0]!='\\' && path[1]==':'))
388 BOOL WINAPI PathIsRelativeAW (LPCVOID path)
389 { if (VERSION_OsIsUnicode())
390 return PathIsRelativeW( path );
391 return PathIsRelativeA( path );
393 /*************************************************************************
394 * PathIsExe [SHELL32.43]
397 BOOL WINAPI PathIsExeA (LPCSTR path)
398 { FIXME("path=%s\n",path);
401 BOOL WINAPI PathIsExeW (LPCWSTR path)
402 { FIXME("path=%s\n",debugstr_w(path));
405 BOOL WINAPI PathIsExeAW (LPCVOID path)
406 { if (VERSION_OsIsUnicode())
407 return PathIsExeW (path);
408 return PathIsExeA(path);
411 /*************************************************************************
412 * PathFileExists [SHELL32.45]
415 * file_exists(char *fn);
417 BOOL WINAPI PathFileExistsA(LPSTR fn) {
419 if (GetFileAttributesA(fn)==-1)
424 /*************************************************************************
425 * PathMatchSingleMask
428 * internal (used by PathMatchSpec)
430 static BOOL PathMatchSingleMaskA(LPCSTR name, LPCSTR mask)
432 while (*name && *mask && *mask!=';') {
435 if (PathMatchSingleMaskA(name,mask+1)) return 1; /* try substrings */
439 if (toupper(*mask)!=toupper(*name) && *mask!='?') return 0;
444 while (*mask=='*') mask++;
445 if (!*mask || *mask==';') return 1;
449 static BOOL PathMatchSingleMaskW(LPCWSTR name, LPCWSTR mask)
451 while (*name && *mask && *mask!=';') {
454 if (PathMatchSingleMaskW(name,mask+1)) return 1; /* try substrings */
458 if (towupper(*mask)!=towupper(*name) && *mask!='?') return 0;
463 while (*mask=='*') mask++;
464 if (!*mask || *mask==';') return 1;
468 /*************************************************************************
469 * PathMatchSpec [SHELL32.46]
474 BOOL WINAPI PathMatchSpecA(LPCSTR name, LPCSTR mask)
476 TRACE("%s %s\n",name,mask);
478 if (!lstrcmpA( mask, "*.*" )) return 1; /* we don't require a period */
481 if (PathMatchSingleMaskA(name,mask)) return 1; /* helper function */
482 while (*mask && *mask!=';') mask++;
485 while (*mask==' ') mask++; /* masks may be separated by "; " */
490 BOOL WINAPI PathMatchSpecW(LPCWSTR name, LPCWSTR mask)
493 TRACE("%s %s\n",debugstr_w(name),debugstr_w(mask));
495 lstrcpyAtoW(stemp,"*.*");
496 if (!lstrcmpW( mask, stemp )) return 1; /* we don't require a period */
499 if (PathMatchSingleMaskW(name,mask)) return 1; /* helper function */
500 while (*mask && *mask!=';') mask++;
503 while (*mask==' ') mask++; /* masks may be separated by "; " */
508 BOOL WINAPI PathMatchSpecAW(LPVOID name, LPVOID mask)
509 { if (VERSION_OsIsUnicode())
510 return PathMatchSpecW( name, mask );
511 return PathMatchSpecA( name, mask );
513 /*************************************************************************
514 * PathSetDlgItemPathAW [SHELL32.48]
516 * use PathCompactPath to make sure, the path fits into the control
519 BOOL WINAPI PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR pszPath)
520 { TRACE("%x %x %s\n",hDlg, id, pszPath);
521 return SetDlgItemTextA(hDlg, id, pszPath);
523 BOOL WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR pszPath)
524 { TRACE("%x %x %s\n",hDlg, id, debugstr_w(pszPath));
525 return SetDlgItemTextW(hDlg, id, pszPath);
527 BOOL WINAPI PathSetDlgItemPathAW(HWND hDlg, int id, LPCVOID pszPath)
528 { if (VERSION_OsIsUnicode())
529 return PathSetDlgItemPathW(hDlg, id, pszPath);
530 return PathSetDlgItemPathA(hDlg, id, pszPath);
533 /*************************************************************************
534 * PathQualifyAW [SHELL32.49]
537 BOOL WINAPI PathQualifyA(LPCSTR pszPath)
538 { FIXME("%s\n",pszPath);
541 BOOL WINAPI PathQualifyW(LPCWSTR pszPath)
542 { FIXME("%s\n",debugstr_w(pszPath));
545 BOOL WINAPI PathQualifyAW(LPCVOID pszPath)
546 { if (VERSION_OsIsUnicode())
547 return PathQualifyW(pszPath);
548 return PathQualifyA(pszPath);
551 /*************************************************************************
552 * PathResolve [SHELL32.51]
554 DWORD WINAPI PathResolve(LPCSTR s,DWORD x2,DWORD x3) {
555 FIXME("(%s,0x%08lx,0x%08lx),stub!\n",s,x2,x3);
559 /*************************************************************************
560 * PathGetArgs [SHELL32.52]
563 * look for next arg in string. handle "quoted" strings
564 * returns pointer to argument *AFTER* the space. Or to the \0.
566 LPCSTR WINAPI PathGetArgsA(LPCSTR cmdline)
567 { BOOL qflag = FALSE;
569 TRACE("%s\n",cmdline);
572 { if ((*cmdline==' ') && !qflag)
581 LPCWSTR WINAPI PathGetArgsW(LPCWSTR cmdline)
582 { BOOL qflag = FALSE;
584 TRACE("%sL\n",debugstr_w(cmdline));
587 { if ((*cmdline==' ') && !qflag)
595 LPCVOID WINAPI PathGetArgsAW(LPVOID cmdline)
596 { if (VERSION_OsIsUnicode())
597 return PathGetArgsW(cmdline);
598 return PathGetArgsA(cmdline);
600 /*************************************************************************
601 * PathQuoteSpaces [SHELL32.55]
604 * basename(char *fn);
606 LPSTR WINAPI PathQuoteSpacesA(LPCSTR aptr)
607 { FIXME("%s\n",aptr);
611 LPWSTR WINAPI PathQuoteSpacesW(LPCWSTR wptr)
612 { FIXME("L%s\n",debugstr_w(wptr));
615 LPVOID WINAPI PathQuoteSpacesAW (LPCVOID fn)
616 { if(VERSION_OsIsUnicode())
617 return PathQuoteSpacesW(fn);
618 return PathQuoteSpacesA(fn);
622 /*************************************************************************
623 * PathUnquoteSpaces [SHELL32.56]
626 * unquote string (remove ")
628 VOID WINAPI PathUnquoteSpacesA(LPSTR str)
629 { DWORD len = lstrlenA(str);
639 VOID WINAPI PathUnquoteSpacesW(LPWSTR str)
640 { DWORD len = CRTDLL_wcslen(str);
642 TRACE("%s\n",debugstr_w(str));
649 CRTDLL_wcscpy(str,str+1);
652 VOID WINAPI PathUnquoteSpacesAW(LPVOID str)
653 { if(VERSION_OsIsUnicode())
654 PathUnquoteSpacesW(str);
655 PathUnquoteSpacesA(str);
659 /*************************************************************************
660 * PathGetDriveNumber32 [SHELL32.57]
663 HRESULT WINAPI PathGetDriveNumber(LPSTR u)
664 { FIXME("%s stub\n",debugstr_a(u));
668 /*************************************************************************
669 * PathYetAnotherMakeUniqueName [SHELL32.75]
672 * exported by ordinal
674 BOOL WINAPI PathYetAnotherMakeUniqueNameA(LPDWORD x,LPDWORD y) {
675 FIXME("(%p,%p):stub.\n",x,y);
679 /*************************************************************************
680 * IsLFNDrive [SHELL32.119]
683 * exported by ordinal Name
685 BOOL WINAPI IsLFNDriveA(LPCSTR path) {
688 if (!GetVolumeInformationA(path,NULL,0,NULL,&fnlen,NULL,NULL,0))
692 /*************************************************************************
693 * PathFindOnPath [SHELL32.145]
695 BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR sOtherDirs)
696 { FIXME("%s %s\n",sFile, sOtherDirs);
699 BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR sOtherDirs)
700 { FIXME("%s %s\n",debugstr_w(sFile), debugstr_w(sOtherDirs));
703 BOOL WINAPI PathFindOnPathAW(LPVOID sFile, LPCVOID sOtherDirs)
704 { if (VERSION_OsIsUnicode())
705 return PathFindOnPathW(sFile, sOtherDirs);
706 return PathFindOnPathA(sFile, sOtherDirs);
709 /*************************************************************************
710 * PathGetExtension [SHELL32.158]
713 * exported by ordinal
715 LPCSTR WINAPI PathGetExtensionA(LPCSTR path,DWORD y,DWORD z)
716 { TRACE("(%s,%08lx,%08lx)\n",path,y,z);
717 path = PathFindExtensionA(path);
718 return *path?(path+1):path;
720 LPCWSTR WINAPI PathGetExtensionW(LPCWSTR path,DWORD y,DWORD z)
721 { TRACE("(L%s,%08lx,%08lx)\n",debugstr_w(path),y,z);
722 path = PathFindExtensionW(path);
723 return *path?(path+1):path;
725 LPCVOID WINAPI PathGetExtensionAW(LPCVOID path,DWORD y,DWORD z)
726 { if (VERSION_OsIsUnicode())
727 return PathGetExtensionW(path,y,z);
728 return PathGetExtensionA(path,y,z);
731 /*************************************************************************
732 * PathCleanupSpec [SHELL32.171]
735 DWORD WINAPI PathCleanupSpecA(LPSTR x, LPSTR y)
737 FIXME("%p(%s) %p(%s) stub\n",x,x,y,y);
741 DWORD WINAPI PathCleanupSpecW(LPWSTR x, LPWSTR y)
743 FIXME("%p(%s) %p(%s) stub\n",x,debugstr_w(x),y,debugstr_w(y));
747 DWORD WINAPI PathCleanupSpecAW (LPVOID x, LPVOID y)
749 if (VERSION_OsIsUnicode())
750 return PathCleanupSpecW(x,y);
751 return PathCleanupSpecA(x,y);
754 /*************************************************************************
755 * SheGetDirW [SHELL32.281]
758 HRESULT WINAPI SheGetDirW(LPWSTR u, LPWSTR v)
759 { FIXME("%p %p stub\n",u,v);
763 /*************************************************************************
764 * SheChangeDirW [SHELL32.274]
767 HRESULT WINAPI SheChangeDirW(LPWSTR u)
768 { FIXME("(%s),stub\n",debugstr_w(u));
772 /*************************************************************************
773 * PathProcessCommand [SHELL32.653]
775 HRESULT WINAPI PathProcessCommandA (LPSTR lpCommand, LPSTR v, DWORD w, DWORD x)
777 FIXME("%p(%s) %p 0x%04lx 0x%04lx stub\n",
778 lpCommand, lpCommand, v, w,x );
782 HRESULT WINAPI PathProcessCommandW (LPWSTR lpCommand, LPSTR v, DWORD w, DWORD x)
784 FIXME("%p(%s) %p 0x%04lx 0x%04lx stub\n",
785 lpCommand, debugstr_w(lpCommand), v, w,x );
789 HRESULT WINAPI PathProcessCommandAW (LPVOID lpCommand, LPSTR v, DWORD w, DWORD x)
791 if (VERSION_OsIsUnicode())
792 return PathProcessCommandW(lpCommand, v, w, x);
793 return PathProcessCommandA(lpCommand, v, w, x);
796 /*************************************************************************
797 * SHGetSpecialFolderPath [SHELL32.175]
799 * converts csidl to path
803 static char * szSHFolders = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
805 BOOL WINAPI SHGetSpecialFolderPathA (
811 CHAR szValueName[MAX_PATH], szDefaultPath[MAX_PATH];
813 BOOL bRelative = TRUE;
814 DWORD dwType, dwDisp, dwPathLen = MAX_PATH;
816 TRACE("0x%04x,%p,csidl=%lu,0x%04x\n", hwndOwner,szPath,csidl,bCreate);
818 /* build default values */
822 hRootKey = HKEY_CURRENT_USER;
823 strcpy (szValueName, "AppData");
824 strcpy (szDefaultPath, "AppData");
828 hRootKey = HKEY_CURRENT_USER;
829 strcpy (szValueName, "Cookies");
830 strcpy(szDefaultPath, "Cookies");
833 case CSIDL_DESKTOPDIRECTORY:
834 hRootKey = HKEY_CURRENT_USER;
835 strcpy(szValueName, "Desktop");
836 strcpy(szDefaultPath, "Desktop");
839 case CSIDL_COMMON_DESKTOPDIRECTORY:
840 hRootKey = HKEY_LOCAL_MACHINE;
841 strcpy(szValueName, "Common Desktop");
842 strcpy(szDefaultPath, "Desktop");
845 case CSIDL_FAVORITES:
846 hRootKey = HKEY_CURRENT_USER;
847 strcpy(szValueName, "Favorites");
848 strcpy(szDefaultPath, "Favorites");
852 hRootKey = HKEY_CURRENT_USER;
853 strcpy(szValueName, "Fonts");
854 strcpy(szDefaultPath, "Fonts");
858 hRootKey = HKEY_CURRENT_USER;
859 strcpy(szValueName, "History");
860 strcpy(szDefaultPath, "History");
864 hRootKey = HKEY_CURRENT_USER;
865 strcpy(szValueName, "NetHood");
866 strcpy(szDefaultPath, "NetHood");
869 case CSIDL_INTERNET_CACHE:
870 hRootKey = HKEY_CURRENT_USER;
871 strcpy(szValueName, "Cache");
872 strcpy(szDefaultPath, "Temporary Internet Files");
876 hRootKey = HKEY_CURRENT_USER;
877 strcpy(szValueName, "Personal");
878 strcpy(szDefaultPath, "My Own Files");
882 case CSIDL_PRINTHOOD:
883 hRootKey = HKEY_CURRENT_USER;
884 strcpy(szValueName, "PrintHood");
885 strcpy(szDefaultPath, "PrintHood");
889 hRootKey = HKEY_CURRENT_USER;
890 strcpy(szValueName, "Programs");
891 strcpy(szDefaultPath, "StatrMenu\\Programs");
894 case CSIDL_COMMON_PROGRAMS:
895 hRootKey = HKEY_LOCAL_MACHINE;
896 strcpy(szValueName, "Common Programs");
897 strcpy(szDefaultPath, "");
901 hRootKey = HKEY_CURRENT_USER;
902 strcpy(szValueName, "Recent");
903 strcpy(szDefaultPath, "Recent");
907 hRootKey = HKEY_CURRENT_USER;
908 strcpy(szValueName, "SendTo");
909 strcpy(szDefaultPath, "SendTo");
912 case CSIDL_STARTMENU:
913 hRootKey = HKEY_CURRENT_USER;
914 strcpy(szValueName, "StartMenu");
915 strcpy(szDefaultPath, "StartMenu");
918 case CSIDL_COMMON_STARTMENU:
919 hRootKey = HKEY_LOCAL_MACHINE;
920 strcpy(szValueName, "Common StartMenu");
921 strcpy(szDefaultPath, "StartMenu");
925 hRootKey = HKEY_CURRENT_USER;
926 strcpy(szValueName, "Startup");
927 strcpy(szDefaultPath, "StartMenu\\Programs\\Startup");
930 case CSIDL_COMMON_STARTUP:
931 hRootKey = HKEY_LOCAL_MACHINE;
932 strcpy(szValueName, "Common Startup");
933 strcpy(szDefaultPath, "StartMenu\\Programs\\Startup");
936 case CSIDL_TEMPLATES:
937 hRootKey = HKEY_CURRENT_USER;
938 strcpy(szValueName, "Templates");
939 strcpy(szDefaultPath, "ShellNew");
943 ERR("folder unknown or not allowed\n");
947 if (RegCreateKeyExA(hRootKey,szSHFolders,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&hKey,&dwDisp))
952 if (RegQueryValueExA(hKey,szValueName,NULL,&dwType,(LPBYTE)szPath,&dwPathLen))
954 /* value not existing */
957 GetWindowsDirectoryA(szPath, MAX_PATH);
958 PathAddBackslashA(szPath);
959 strcat(szPath, szDefaultPath);
963 strcpy(szPath, szDefaultPath);
967 CreateDirectoryA(szPath,NULL);
969 RegSetValueExA(hKey,szValueName,0,REG_SZ,(LPBYTE)szPath,strlen(szPath)+1);
975 BOOL WINAPI SHGetSpecialFolderPathW (
981 char szTemp[MAX_PATH];
983 if (SHGetSpecialFolderPathA(hwndOwner, szTemp, csidl, bCreate))
985 lstrcpynAtoW(szPath, szTemp, MAX_PATH);
988 TRACE("0x%04x,%p,csidl=%lu,0x%04x\n", hwndOwner,szPath,csidl,bCreate);
992 BOOL WINAPI SHGetSpecialFolderPathAW (
999 if (VERSION_OsIsUnicode())
1000 return SHGetSpecialFolderPathW (hwndOwner, szPath, csidl, bCreate);
1001 return SHGetSpecialFolderPathA (hwndOwner, szPath, csidl, bCreate);