4 * Many of this functions are in SHLWAPI.DLL also
9 #include "debugtools.h"
11 #include "winversion.h"
16 #include "shell32_main.h"
19 DEFAULT_DEBUG_CHANNEL(shell)
21 /*************************************************************************
22 * PathIsRoot [SHELL32.29]
24 BOOL WINAPI PathIsRootA(LPCSTR x)
26 if (*(x+1)==':' && *(x+2)=='\\') /* "X:\" */
28 if (*x=='\\') /* "\" */
30 if (x[0]=='\\' && x[1]=='\\') /* UNC "\\<xx>\" */
31 { int foundbackslash = 0;
37 if (foundbackslash<=1) /* max 1 \ more ... */
42 BOOL WINAPI PathIsRootW(LPCWSTR x)
43 { TRACE("%s\n",debugstr_w(x));
44 if (*(x+1)==':' && *(x+2)=='\\') /* "X:\" */
46 if (*x == (WCHAR) '\\') /* "\" */
48 if (x[0]==(WCHAR)'\\' && x[1]==(WCHAR)'\\') /* UNC "\\<xx>\" */
49 { int foundbackslash = 0;
52 { if (*x++==(WCHAR)'\\')
55 if (foundbackslash<=1) /* max 1 \ more ... */
60 BOOL WINAPI PathIsRootAW(LPCVOID x)
61 { if (VERSION_OsIsUnicode())
62 return PathIsRootW(x);
63 return PathIsRootA(x);
66 /*************************************************************************
67 * PathBuildRoot [SHELL32.30]
69 LPSTR WINAPI PathBuildRootA(LPSTR root,BYTE drive) {
70 TRACE("%p %i\n",root, drive);
76 /*************************************************************************
77 * PathFindExtension [SHELL32.31]
80 * returns pointer to last . in last pathcomponent or at \0.
82 LPCSTR WINAPI PathFindExtensionA(LPCSTR path)
83 { LPCSTR lastpoint = NULL;
84 TRACE("%p %s\n",path,path);
86 { if (*path=='\\'||*path==' ')
92 return lastpoint?lastpoint:path;
94 LPCWSTR WINAPI PathFindExtensionW(LPCWSTR path)
95 { LPCWSTR lastpoint = NULL;
96 TRACE("(%p %s)\n",path,debugstr_w(path));
98 { if (*path==(WCHAR)'\\'||*path==(WCHAR)' ')
100 if (*path==(WCHAR)'.')
104 return lastpoint?lastpoint:path;
106 LPCVOID WINAPI PathFindExtensionAW(LPCVOID path)
107 { if (VERSION_OsIsUnicode())
108 return PathFindExtensionW(path);
109 return PathFindExtensionA(path);
113 /*************************************************************************
114 * PathAddBackslash [SHELL32.32]
117 * append \ if there is none
119 LPSTR WINAPI PathAddBackslashA(LPSTR path)
121 TRACE("%p->%s\n",path,path);
124 if (len && path[len-1]!='\\')
131 LPWSTR WINAPI PathAddBackslashW(LPWSTR path)
133 TRACE("%p->%s\n",path,debugstr_w(path));
135 len = CRTDLL_wcslen(path);
136 if (len && path[len-1]!=(WCHAR)'\\')
137 { path[len] = (WCHAR)'\\';
143 LPVOID WINAPI PathAddBackslashAW(LPVOID path)
144 { if(VERSION_OsIsUnicode())
145 return PathAddBackslashW(path);
146 return PathAddBackslashA(path);
149 /*************************************************************************
150 * PathRemoveBlanks [SHELL32.33]
153 * remove spaces from beginning and end of passed string
155 LPSTR WINAPI PathRemoveBlanksA(LPSTR str)
170 LPWSTR WINAPI PathRemoveBlanksW(LPWSTR str)
172 TRACE("%s\n",debugstr_w(str));
175 CRTDLL_wcscpy(str,x);
178 x=str+CRTDLL_wcslen(str)-1;
185 LPVOID WINAPI PathRemoveBlanksAW(LPVOID str)
186 { if(VERSION_OsIsUnicode())
187 return PathRemoveBlanksW(str);
188 return PathRemoveBlanksA(str);
193 /*************************************************************************
194 * PathFindFilename [SHELL32.34]
197 * basename(char *fn);
199 LPCSTR WINAPI PathFindFilenameA(LPCSTR aptr)
203 TRACE("%s\n",aslash);
205 { if (((aptr[0]=='\\') || (aptr[0]==':')) && aptr[1] && aptr[1]!='\\')
212 LPCWSTR WINAPI PathFindFilenameW(LPCWSTR wptr)
216 TRACE("%s\n",debugstr_w(wslash));
218 { if (((wptr[0]=='\\') || (wptr[0]==':')) && wptr[1] && wptr[1]!='\\')
224 LPCVOID WINAPI PathFindFilenameAW(LPCVOID fn)
226 if(VERSION_OsIsUnicode())
227 return PathFindFilenameW(fn);
228 return PathFindFilenameA(fn);
231 /*************************************************************************
232 * PathRemoveFileSpec [SHELL32.35]
235 * bool getpath(char *pathname); truncates passed argument to a valid path
236 * returns if the string was modified or not.
237 * "\foo\xx\foo"-> "\foo\xx"
241 DWORD WINAPI PathRemoveFileSpecA(LPSTR fn) {
257 continue; /* already x++ed */
275 /*************************************************************************
276 * PathAppend [SHELL32.36]
279 * concat_paths(char*target,const char*add);
280 * concats "target\\add" and writes them to target
282 LPSTR WINAPI PathAppendA(LPSTR x1,LPSTR x2) {
283 TRACE("%s %s\n",x1,x2);
284 while (x2[0]=='\\') x2++;
285 return PathCombineA(x1,x1,x2);
288 /*************************************************************************
289 * PathCombine [SHELL32.37]
292 * if lpszFile='.' skip it
293 * szDest can be equal to lpszFile. Thats why we use sTemp
295 LPSTR WINAPI PathCombineA(LPSTR szDest, LPCSTR lpszDir, LPCSTR lpszFile)
296 { char sTemp[MAX_PATH];
297 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, lpszDir, lpszFile, lpszFile);
300 if (!lpszFile || !lpszFile[0] || (lpszFile[0]=='.' && !lpszFile[1]) )
301 { strcpy(szDest,lpszDir);
305 /* if lpszFile is a complete path don't care about lpszDir */
306 if (PathIsRootA(lpszFile))
307 { strcpy(szDest,lpszFile);
310 { strcpy(sTemp,lpszDir);
311 PathAddBackslashA(sTemp);
312 strcat(sTemp,lpszFile);
313 strcpy(szDest,sTemp);
317 LPWSTR WINAPI PathCombineW(LPWSTR szDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
318 { WCHAR sTemp[MAX_PATH];
319 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, debugstr_w(lpszDir),
320 lpszFile, debugstr_w(lpszFile));
323 if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) )
324 { CRTDLL_wcscpy(szDest,lpszDir);
328 /* if lpszFile is a complete path don't care about lpszDir */
329 if (PathIsRootW(lpszFile))
330 { CRTDLL_wcscpy(szDest,lpszFile);
333 { CRTDLL_wcscpy(sTemp,lpszDir);
334 PathAddBackslashW(sTemp);
335 CRTDLL_wcscat(sTemp,lpszFile);
336 CRTDLL_wcscpy(szDest,sTemp);
340 LPVOID WINAPI PathCombineAW(LPVOID szDest, LPCVOID lpszDir, LPCVOID lpszFile)
341 { if (VERSION_OsIsUnicode())
342 return PathCombineW( szDest, lpszDir, lpszFile );
343 return PathCombineA( szDest, lpszDir, lpszFile );
346 /*************************************************************************
347 * PathIsUNC [SHELL32.39]
350 * PathIsUNC(char*path);
352 BOOL WINAPI PathIsUNCA(LPCSTR path)
353 { TRACE("%s\n",path);
355 if ((path[0]=='\\') && (path[1]=='\\'))
359 BOOL WINAPI PathIsUNCW(LPCWSTR path)
360 { TRACE("%s\n",debugstr_w(path));
362 if ((path[0]=='\\') && (path[1]=='\\'))
366 BOOL WINAPI PathIsUNCAW (LPCVOID path)
367 { if (VERSION_OsIsUnicode())
368 return PathIsUNCW( path );
369 return PathIsUNCA( path );
371 /*************************************************************************
372 * PathIsRelativ [SHELL32.40]
375 BOOL WINAPI PathIsRelativeA (LPCSTR path)
376 { TRACE("path=%s\n",path);
378 if (path && (path[0]!='\\' && path[1]==':'))
382 BOOL WINAPI PathIsRelativeW (LPCWSTR path)
383 { TRACE("path=%s\n",debugstr_w(path));
385 if (path && (path[0]!='\\' && path[1]==':'))
389 BOOL WINAPI PathIsRelativeAW (LPCVOID path)
390 { if (VERSION_OsIsUnicode())
391 return PathIsRelativeW( path );
392 return PathIsRelativeA( path );
394 /*************************************************************************
395 * PathIsExe [SHELL32.43]
398 BOOL WINAPI PathIsExeA (LPCSTR path)
399 { FIXME("path=%s\n",path);
402 BOOL WINAPI PathIsExeW (LPCWSTR path)
403 { FIXME("path=%s\n",debugstr_w(path));
406 BOOL WINAPI PathIsExeAW (LPCVOID path)
407 { if (VERSION_OsIsUnicode())
408 return PathIsExeW (path);
409 return PathIsExeA(path);
412 /*************************************************************************
413 * PathFileExists [SHELL32.45]
416 * file_exists(char *fn);
418 BOOL WINAPI PathFileExistsA(LPSTR fn) {
420 if (GetFileAttributesA(fn)==-1)
425 /*************************************************************************
426 * PathMatchSingleMask
429 * internal (used by PathMatchSpec)
431 static BOOL PathMatchSingleMaskA(LPCSTR name, LPCSTR mask)
433 while (*name && *mask && *mask!=';') {
436 if (PathMatchSingleMaskA(name,mask+1)) return 1; /* try substrings */
440 if (toupper(*mask)!=toupper(*name) && *mask!='?') return 0;
445 while (*mask=='*') mask++;
446 if (!*mask || *mask==';') return 1;
450 static BOOL PathMatchSingleMaskW(LPCWSTR name, LPCWSTR mask)
452 while (*name && *mask && *mask!=';') {
455 if (PathMatchSingleMaskW(name,mask+1)) return 1; /* try substrings */
459 if (towupper(*mask)!=towupper(*name) && *mask!='?') return 0;
464 while (*mask=='*') mask++;
465 if (!*mask || *mask==';') return 1;
469 /*************************************************************************
470 * PathMatchSpec [SHELL32.46]
475 BOOL WINAPI PathMatchSpecA(LPCSTR name, LPCSTR mask)
477 TRACE("%s %s\n",name,mask);
479 if (!lstrcmpA( mask, "*.*" )) return 1; /* we don't require a period */
482 if (PathMatchSingleMaskA(name,mask)) return 1; /* helper function */
483 while (*mask && *mask!=';') mask++;
486 while (*mask==' ') mask++; /* masks may be separated by "; " */
491 BOOL WINAPI PathMatchSpecW(LPCWSTR name, LPCWSTR mask)
494 TRACE("%s %s\n",debugstr_w(name),debugstr_w(mask));
496 lstrcpyAtoW(stemp,"*.*");
497 if (!lstrcmpW( mask, stemp )) return 1; /* we don't require a period */
500 if (PathMatchSingleMaskW(name,mask)) return 1; /* helper function */
501 while (*mask && *mask!=';') mask++;
504 while (*mask==' ') mask++; /* masks may be separated by "; " */
509 BOOL WINAPI PathMatchSpecAW(LPVOID name, LPVOID mask)
510 { if (VERSION_OsIsUnicode())
511 return PathMatchSpecW( name, mask );
512 return PathMatchSpecA( name, mask );
514 /*************************************************************************
515 * PathSetDlgItemPathAW [SHELL32.48]
517 * use PathCompactPath to make sure, the path fits into the control
520 BOOL WINAPI PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR pszPath)
521 { TRACE("%x %x %s\n",hDlg, id, pszPath);
522 return SetDlgItemTextA(hDlg, id, pszPath);
524 BOOL WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR pszPath)
525 { TRACE("%x %x %s\n",hDlg, id, debugstr_w(pszPath));
526 return SetDlgItemTextW(hDlg, id, pszPath);
528 BOOL WINAPI PathSetDlgItemPathAW(HWND hDlg, int id, LPCVOID pszPath)
529 { if (VERSION_OsIsUnicode())
530 return PathSetDlgItemPathW(hDlg, id, pszPath);
531 return PathSetDlgItemPathA(hDlg, id, pszPath);
534 /*************************************************************************
535 * PathQualifyAW [SHELL32.49]
538 BOOL WINAPI PathQualifyA(LPCSTR pszPath)
539 { FIXME("%s\n",pszPath);
542 BOOL WINAPI PathQualifyW(LPCWSTR pszPath)
543 { FIXME("%s\n",debugstr_w(pszPath));
546 BOOL WINAPI PathQualifyAW(LPCVOID pszPath)
547 { if (VERSION_OsIsUnicode())
548 return PathQualifyW(pszPath);
549 return PathQualifyA(pszPath);
552 /*************************************************************************
553 * PathResolve [SHELL32.51]
555 DWORD WINAPI PathResolve(LPCSTR s,DWORD x2,DWORD x3) {
556 FIXME("(%s,0x%08lx,0x%08lx),stub!\n",s,x2,x3);
560 /*************************************************************************
561 * PathGetArgs [SHELL32.52]
564 * look for next arg in string. handle "quoted" strings
565 * returns pointer to argument *AFTER* the space. Or to the \0.
567 LPCSTR WINAPI PathGetArgsA(LPCSTR cmdline)
568 { BOOL qflag = FALSE;
570 TRACE("%s\n",cmdline);
573 { if ((*cmdline==' ') && !qflag)
582 LPCWSTR WINAPI PathGetArgsW(LPCWSTR cmdline)
583 { BOOL qflag = FALSE;
585 TRACE("%s\n",debugstr_w(cmdline));
588 { if ((*cmdline==' ') && !qflag)
596 LPCVOID WINAPI PathGetArgsAW(LPVOID cmdline)
597 { if (VERSION_OsIsUnicode())
598 return PathGetArgsW(cmdline);
599 return PathGetArgsA(cmdline);
601 /*************************************************************************
602 * PathQuoteSpaces [SHELL32.55]
605 * basename(char *fn);
607 LPSTR WINAPI PathQuoteSpacesA(LPCSTR aptr)
608 { FIXME("%s\n",aptr);
612 LPWSTR WINAPI PathQuoteSpacesW(LPCWSTR wptr)
613 { FIXME("%s\n",debugstr_w(wptr));
616 LPVOID WINAPI PathQuoteSpacesAW (LPCVOID fn)
617 { if(VERSION_OsIsUnicode())
618 return PathQuoteSpacesW(fn);
619 return PathQuoteSpacesA(fn);
623 /*************************************************************************
624 * PathUnquoteSpaces [SHELL32.56]
627 * unquote string (remove ")
629 VOID WINAPI PathUnquoteSpacesA(LPSTR str)
630 { DWORD len = lstrlenA(str);
640 VOID WINAPI PathUnquoteSpacesW(LPWSTR str)
641 { DWORD len = CRTDLL_wcslen(str);
643 TRACE("%s\n",debugstr_w(str));
650 CRTDLL_wcscpy(str,str+1);
653 VOID WINAPI PathUnquoteSpacesAW(LPVOID str)
655 if(VERSION_OsIsUnicode())
656 PathUnquoteSpacesW(str);
658 PathUnquoteSpacesA(str);
662 /*************************************************************************
663 * PathGetDriveNumber32 [SHELL32.57]
666 HRESULT WINAPI PathGetDriveNumber(LPSTR u)
667 { FIXME("%s stub\n",debugstr_a(u));
671 /*************************************************************************
672 * PathYetAnotherMakeUniqueName [SHELL32.75]
675 * exported by ordinal
677 BOOL WINAPI PathYetAnotherMakeUniqueNameA(LPDWORD x,LPDWORD y) {
678 FIXME("(%p,%p):stub.\n",x,y);
682 /*************************************************************************
683 * IsLFNDrive [SHELL32.119]
686 * exported by ordinal Name
688 BOOL WINAPI IsLFNDriveA(LPCSTR path) {
691 if (!GetVolumeInformationA(path,NULL,0,NULL,&fnlen,NULL,NULL,0))
695 /*************************************************************************
696 * PathFindOnPath [SHELL32.145]
698 BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR sOtherDirs)
699 { FIXME("%s %s\n",sFile, sOtherDirs);
702 BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR sOtherDirs)
703 { FIXME("%s %s\n",debugstr_w(sFile), debugstr_w(sOtherDirs));
706 BOOL WINAPI PathFindOnPathAW(LPVOID sFile, LPCVOID sOtherDirs)
707 { if (VERSION_OsIsUnicode())
708 return PathFindOnPathW(sFile, sOtherDirs);
709 return PathFindOnPathA(sFile, sOtherDirs);
712 /*************************************************************************
713 * PathGetExtension [SHELL32.158]
716 * exported by ordinal
718 LPCSTR WINAPI PathGetExtensionA(LPCSTR path,DWORD y,DWORD z)
719 { TRACE("(%s,%08lx,%08lx)\n",path,y,z);
720 path = PathFindExtensionA(path);
721 return *path?(path+1):path;
723 LPCWSTR WINAPI PathGetExtensionW(LPCWSTR path,DWORD y,DWORD z)
724 { TRACE("(%s, %08lx, %08lx)\n",debugstr_w(path),y,z);
725 path = PathFindExtensionW(path);
726 return *path?(path+1):path;
728 LPCVOID WINAPI PathGetExtensionAW(LPCVOID path,DWORD y,DWORD z)
729 { if (VERSION_OsIsUnicode())
730 return PathGetExtensionW(path,y,z);
731 return PathGetExtensionA(path,y,z);
734 /*************************************************************************
735 * PathCleanupSpec [SHELL32.171]
738 DWORD WINAPI PathCleanupSpecA(LPSTR x, LPSTR y)
740 FIXME("(%p %s, %p %s) stub\n",x,debugstr_a(x),y,debugstr_a(y));
744 DWORD WINAPI PathCleanupSpecW(LPWSTR x, LPWSTR y)
746 FIXME("(%p %s, %p %s) stub\n",x,debugstr_w(x),y,debugstr_w(y));
750 DWORD WINAPI PathCleanupSpecAW (LPVOID x, LPVOID y)
752 if (VERSION_OsIsUnicode())
753 return PathCleanupSpecW(x,y);
754 return PathCleanupSpecA(x,y);
757 /*************************************************************************
758 * SheGetDirW [SHELL32.281]
761 HRESULT WINAPI SheGetDirW(LPWSTR u, LPWSTR v)
762 { FIXME("%p %p stub\n",u,v);
766 /*************************************************************************
767 * SheChangeDirW [SHELL32.274]
770 HRESULT WINAPI SheChangeDirW(LPWSTR u)
771 { FIXME("(%s),stub\n",debugstr_w(u));
775 /*************************************************************************
776 * PathProcessCommand [SHELL32.653]
778 HRESULT WINAPI PathProcessCommandA (LPSTR lpCommand, LPSTR v, DWORD w, DWORD x)
780 FIXME("%p(%s) %p 0x%04lx 0x%04lx stub\n",
781 lpCommand, lpCommand, v, w,x );
782 lstrcpyA(v, lpCommand);
786 HRESULT WINAPI PathProcessCommandW (LPWSTR lpCommand, LPSTR v, DWORD w, DWORD x)
788 FIXME("(%p %s, %p, 0x%04lx, 0x%04lx) stub\n",
789 lpCommand, debugstr_w(lpCommand), v, w,x );
793 HRESULT WINAPI PathProcessCommandAW (LPVOID lpCommand, LPSTR v, DWORD w, DWORD x)
795 if (VERSION_OsIsUnicode())
796 return PathProcessCommandW(lpCommand, v, w, x);
797 return PathProcessCommandA(lpCommand, v, w, x);
800 /*************************************************************************
801 * SHGetSpecialFolderPath [SHELL32.175]
803 * converts csidl to path
807 static char * szSHFolders = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
809 BOOL WINAPI SHGetSpecialFolderPathA (
815 CHAR szValueName[MAX_PATH], szDefaultPath[MAX_PATH];
817 BOOL bRelative = TRUE;
818 DWORD dwType, dwDisp, dwPathLen = MAX_PATH;
820 TRACE("0x%04x,%p,csidl=%lu,0x%04x\n", hwndOwner,szPath,csidl,bCreate);
822 /* build default values */
826 hRootKey = HKEY_CURRENT_USER;
827 strcpy (szValueName, "AppData");
828 strcpy (szDefaultPath, "AppData");
832 hRootKey = HKEY_CURRENT_USER;
833 strcpy (szValueName, "Cookies");
834 strcpy(szDefaultPath, "Cookies");
837 case CSIDL_DESKTOPDIRECTORY:
838 hRootKey = HKEY_CURRENT_USER;
839 strcpy(szValueName, "Desktop");
840 strcpy(szDefaultPath, "Desktop");
843 case CSIDL_COMMON_DESKTOPDIRECTORY:
844 hRootKey = HKEY_LOCAL_MACHINE;
845 strcpy(szValueName, "Common Desktop");
846 strcpy(szDefaultPath, "Desktop");
849 case CSIDL_FAVORITES:
850 hRootKey = HKEY_CURRENT_USER;
851 strcpy(szValueName, "Favorites");
852 strcpy(szDefaultPath, "Favorites");
856 hRootKey = HKEY_CURRENT_USER;
857 strcpy(szValueName, "Fonts");
858 strcpy(szDefaultPath, "Fonts");
862 hRootKey = HKEY_CURRENT_USER;
863 strcpy(szValueName, "History");
864 strcpy(szDefaultPath, "History");
868 hRootKey = HKEY_CURRENT_USER;
869 strcpy(szValueName, "NetHood");
870 strcpy(szDefaultPath, "NetHood");
873 case CSIDL_INTERNET_CACHE:
874 hRootKey = HKEY_CURRENT_USER;
875 strcpy(szValueName, "Cache");
876 strcpy(szDefaultPath, "Temporary Internet Files");
880 hRootKey = HKEY_CURRENT_USER;
881 strcpy(szValueName, "Personal");
882 strcpy(szDefaultPath, "My Own Files");
886 case CSIDL_PRINTHOOD:
887 hRootKey = HKEY_CURRENT_USER;
888 strcpy(szValueName, "PrintHood");
889 strcpy(szDefaultPath, "PrintHood");
893 hRootKey = HKEY_CURRENT_USER;
894 strcpy(szValueName, "Programs");
895 strcpy(szDefaultPath, "StartMenu\\Programs");
898 case CSIDL_COMMON_PROGRAMS:
899 hRootKey = HKEY_LOCAL_MACHINE;
900 strcpy(szValueName, "Common Programs");
901 strcpy(szDefaultPath, "");
905 hRootKey = HKEY_CURRENT_USER;
906 strcpy(szValueName, "Recent");
907 strcpy(szDefaultPath, "Recent");
911 hRootKey = HKEY_CURRENT_USER;
912 strcpy(szValueName, "SendTo");
913 strcpy(szDefaultPath, "SendTo");
916 case CSIDL_STARTMENU:
917 hRootKey = HKEY_CURRENT_USER;
918 strcpy(szValueName, "StartMenu");
919 strcpy(szDefaultPath, "StartMenu");
922 case CSIDL_COMMON_STARTMENU:
923 hRootKey = HKEY_LOCAL_MACHINE;
924 strcpy(szValueName, "Common StartMenu");
925 strcpy(szDefaultPath, "StartMenu");
929 hRootKey = HKEY_CURRENT_USER;
930 strcpy(szValueName, "Startup");
931 strcpy(szDefaultPath, "StartMenu\\Programs\\Startup");
934 case CSIDL_COMMON_STARTUP:
935 hRootKey = HKEY_LOCAL_MACHINE;
936 strcpy(szValueName, "Common Startup");
937 strcpy(szDefaultPath, "StartMenu\\Programs\\Startup");
940 case CSIDL_TEMPLATES:
941 hRootKey = HKEY_CURRENT_USER;
942 strcpy(szValueName, "Templates");
943 strcpy(szDefaultPath, "ShellNew");
947 ERR("folder unknown or not allowed\n");
951 if (RegCreateKeyExA(hRootKey,szSHFolders,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&hKey,&dwDisp))
956 if (RegQueryValueExA(hKey,szValueName,NULL,&dwType,(LPBYTE)szPath,&dwPathLen))
958 /* value not existing */
961 GetWindowsDirectoryA(szPath, MAX_PATH);
962 PathAddBackslashA(szPath);
963 strcat(szPath, szDefaultPath);
967 strcpy(szPath, szDefaultPath);
971 CreateDirectoryA(szPath,NULL);
973 RegSetValueExA(hKey,szValueName,0,REG_SZ,(LPBYTE)szPath,strlen(szPath)+1);
979 BOOL WINAPI SHGetSpecialFolderPathW (
985 char szTemp[MAX_PATH];
987 if (SHGetSpecialFolderPathA(hwndOwner, szTemp, csidl, bCreate))
989 lstrcpynAtoW(szPath, szTemp, MAX_PATH);
992 TRACE("0x%04x,%p,csidl=%lu,0x%04x\n", hwndOwner,szPath,csidl,bCreate);
996 BOOL WINAPI SHGetSpecialFolderPathAW (
1003 if (VERSION_OsIsUnicode())
1004 return SHGetSpecialFolderPathW (hwndOwner, szPath, csidl, bCreate);
1005 return SHGetSpecialFolderPathA (hwndOwner, szPath, csidl, bCreate);
1008 /* PathRemoveBackslash
1010 * If the path ends in a backslash it is replaced by a NULL
1011 * and the address of the NULL is returned
1013 * the address of the last character is returned.
1017 LPSTR WINAPI PathRemoveBackslashA( LPSTR lpPath )
1021 while (*lpPath) p = lpPath++;
1022 if ( *p == (CHAR)'\\') *p = (CHAR)'\0';
1026 LPWSTR WINAPI PathRemoveBackslashW( LPWSTR lpPath )
1030 while (*lpPath); p = lpPath++;
1031 if ( *p == (WCHAR)'\\') *p = (WCHAR)'\0';
1036 shlwapi functions that have found their way in because most of
1037 shlwapi is unimplemented and doesn't have a home.
1039 FIXME: move to a more appropriate file( when one exists )
1042 /* SHGetValue: Gets a value from the registry */
1044 DWORD WINAPI SHGetValueA(
1053 FIXME("(%p),stub!\n", pSubKey);
1055 return ERROR_SUCCESS; /* return success */
1058 DWORD WINAPI SHGetValueW(
1067 FIXME("(%p),stub!\n", pSubKey);
1069 return ERROR_SUCCESS; /* return success */
1072 /* gets a user-specific registry value. */
1074 LONG WINAPI SHRegGetUSValueA(
1081 LPVOID pDefaultData,
1082 DWORD wDefaultDataSize
1085 FIXME("(%p),stub!\n", pSubKey);
1087 return ERROR_SUCCESS; /* return success */
1090 LONG WINAPI SHRegGetUSValueW(
1096 BOOL flagIgnoreHKCU,
1097 LPVOID pDefaultData,
1098 DWORD wDefaultDataSize
1101 FIXME("(%p),stub!\n", pSubKey);
1103 return ERROR_SUCCESS; /* return success */