Added some missing definitions.
[wine/multimedia.git] / dlls / shlwapi / path.c
blobc1abfb70c2ce02bf4aaa5397df1c2d06db7f4e3e
1 /*
2 * Path Functions
3 */
5 #include <ctype.h>
6 #include <string.h>
8 #include "winerror.h"
9 #include "wine/unicode.h"
10 #include "wine/undocshell.h"
11 #include "shlwapi.h"
12 #include "debugtools.h"
14 DEFAULT_DEBUG_CHANNEL(shell);
16 #define isSlash(x) ((x)=='\\' || (x)=='/')
18 ########## Combining and Constructing paths ##########
21 /*************************************************************************
22 * PathAppendA [SHLWAPI.@]
24 * NOTES
25 * concat path lpszPath2 onto lpszPath1
27 * FIXME
28 * the resulting path is also canonicalized
30 BOOL WINAPI PathAppendA(
31 LPSTR lpszPath1,
32 LPCSTR lpszPath2)
34 TRACE("%s %s\n",lpszPath1, lpszPath2);
35 while (lpszPath2[0]=='\\') lpszPath2++;
36 PathCombineA(lpszPath1,lpszPath1,lpszPath2);
37 return TRUE;
40 /*************************************************************************
41 * PathAppendW [SHLWAPI.@]
43 BOOL WINAPI PathAppendW(
44 LPWSTR lpszPath1,
45 LPCWSTR lpszPath2)
47 TRACE("%s %s\n",debugstr_w(lpszPath1), debugstr_w(lpszPath2));
48 while (lpszPath2[0]=='\\') lpszPath2++;
49 PathCombineW(lpszPath1,lpszPath1,lpszPath2);
50 return TRUE;
53 /*************************************************************************
54 * PathCombineA [SHLWAPI.@]
56 * NOTES
57 * if lpszFile='.' skip it
58 * szDest can be equal to lpszFile. Thats why we use sTemp
60 * FIXME
61 * the resulting path is also canonicalized
63 LPSTR WINAPI PathCombineA(
64 LPSTR szDest,
65 LPCSTR lpszDir,
66 LPCSTR lpszFile)
68 char sTemp[MAX_PATH];
69 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, lpszDir, lpszFile, lpszFile);
72 if (!lpszFile || !lpszFile[0] || (lpszFile[0]=='.' && !lpszFile[1]) )
74 strcpy(szDest,lpszDir);
75 return szDest;
78 /* if lpszFile is a complete path don't care about lpszDir */
79 if (PathGetDriveNumberA(lpszFile) != -1)
81 strcpy(szDest,lpszFile);
83 else if (lpszFile[0] == '\\' )
85 strcpy(sTemp,lpszDir);
86 PathStripToRootA(sTemp);
87 strcat(sTemp,lpszFile);
88 strcpy(szDest,sTemp);
90 else
92 strcpy(sTemp,lpszDir);
93 PathAddBackslashA(sTemp);
94 strcat(sTemp,lpszFile);
95 strcpy(szDest,sTemp);
97 return szDest;
100 /*************************************************************************
101 * PathCombineW [SHLWAPI.@]
103 LPWSTR WINAPI PathCombineW(
104 LPWSTR szDest,
105 LPCWSTR lpszDir,
106 LPCWSTR lpszFile)
108 WCHAR sTemp[MAX_PATH];
109 TRACE("%p %p->%s %p->%s\n",szDest, lpszDir, debugstr_w(lpszDir),
110 lpszFile, debugstr_w(lpszFile));
113 if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) )
115 strcpyW(szDest,lpszDir);
116 return szDest;
119 /* if lpszFile is a complete path don't care about lpszDir */
120 if (PathGetDriveNumberW(lpszFile) != -1)
122 strcpyW(szDest,lpszFile);
124 else if (lpszFile[0] == (WCHAR)'\\' )
126 strcpyW(sTemp,lpszDir);
127 PathStripToRootW(sTemp);
128 strcatW(sTemp,lpszFile);
129 strcpyW(szDest,sTemp);
131 else
133 strcpyW(sTemp,lpszDir);
134 PathAddBackslashW(sTemp);
135 strcatW(sTemp,lpszFile);
136 strcpyW(szDest,sTemp);
138 return szDest;
141 /*************************************************************************
142 * PathAddBackslashA [SHLWAPI.@]
144 * NOTES
145 * append \ if there is none
147 LPSTR WINAPI PathAddBackslashA(LPSTR lpszPath)
149 int len;
150 TRACE("%p->%s\n",lpszPath,lpszPath);
152 len = strlen(lpszPath);
153 if (len && lpszPath[len-1]!='\\')
155 lpszPath[len] = '\\';
156 lpszPath[len+1]= 0x00;
157 return lpszPath+len+1;
159 return lpszPath+len;
162 /*************************************************************************
163 * PathAddBackslashW [SHLWAPI.@]
165 LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
167 int len;
168 TRACE("%p->%s\n",lpszPath,debugstr_w(lpszPath));
170 len = strlenW(lpszPath);
171 if (len && lpszPath[len-1]!=(WCHAR)'\\')
173 lpszPath[len] = (WCHAR)'\\';
174 lpszPath[len+1]= 0x00;
175 return lpszPath+len+1;
177 return lpszPath+len;
180 /*************************************************************************
181 * PathBuildRootA [SHLWAPI.@]
183 LPSTR WINAPI PathBuildRootA(LPSTR lpszPath, int drive)
185 TRACE("%p %i\n",lpszPath, drive);
187 strcpy(lpszPath,"A:\\");
188 lpszPath[0]+=drive;
189 return lpszPath;
192 /*************************************************************************
193 * PathBuildRootW [SHLWAPI.@]
195 LPWSTR WINAPI PathBuildRootW(LPWSTR lpszPath, int drive)
197 lpszPath[0] = 'A' + drive;
198 lpszPath[1] = ':';
199 lpszPath[2] = '\\';
200 lpszPath[3] = 0;
201 TRACE("%p %i\n",debugstr_w(lpszPath), drive);
202 return lpszPath;
206 Extracting Component Parts
209 /*************************************************************************
210 * PathFindFileNameA [SHLWAPI.@]
212 LPSTR WINAPI PathFindFileNameA(LPCSTR lpszPath)
214 LPCSTR lastSlash = lpszPath;
216 TRACE("%s\n",lpszPath);
217 while (*lpszPath)
219 if ( isSlash(lpszPath[0]) && lpszPath[1])
220 lastSlash = lpszPath+1;
221 lpszPath = CharNextA(lpszPath);
223 return (LPSTR)lastSlash;
227 /*************************************************************************
228 * PathFindFileNameW [SHLWAPI.@]
230 LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
232 LPCWSTR wslash;
233 wslash = lpszPath;
235 TRACE("%s\n",debugstr_w(wslash));
236 while (lpszPath[0])
238 if (((lpszPath[0]=='\\') || (lpszPath[0]==':')) && lpszPath[1] && lpszPath[1]!='\\')
239 wslash = lpszPath+1;
240 lpszPath = CharNextW(lpszPath);
242 return (LPWSTR)wslash;
245 /*************************************************************************
246 * PathFindExtensionA [SHLWAPI.@]
248 * NOTES
249 * returns pointer to last . in last lpszPath component or at \0.
252 LPSTR WINAPI PathFindExtensionA(LPCSTR lpszPath)
254 LPCSTR lastpoint = NULL;
256 TRACE("%p %s\n",lpszPath,lpszPath);
258 while (*lpszPath)
260 if (*lpszPath=='\\'||*lpszPath==' ')
261 lastpoint=NULL;
262 if (*lpszPath=='.')
263 lastpoint=lpszPath;
264 lpszPath = CharNextA(lpszPath);
266 return (LPSTR)(lastpoint?lastpoint:lpszPath);
269 /*************************************************************************
270 * PathFindExtensionW [SHLWAPI.@]
272 LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
274 LPCWSTR lastpoint = NULL;
276 TRACE("(%p %s)\n",lpszPath,debugstr_w(lpszPath));
278 while (*lpszPath)
280 if (*lpszPath==(WCHAR)'\\'||*lpszPath==(WCHAR)' ')
281 lastpoint=NULL;
282 if (*lpszPath==(WCHAR)'.')
283 lastpoint=lpszPath;
284 lpszPath = CharNextW(lpszPath);
286 return (LPWSTR)(lastpoint?lastpoint:lpszPath);
289 /*************************************************************************
290 * PathGetArgsA [SHLWAPI.@]
292 * NOTES
293 * look for next arg in string. handle "quoted" strings
294 * returns pointer to argument *AFTER* the space. Or to the \0.
296 * FIXME
297 * quoting by '\'
299 LPSTR WINAPI PathGetArgsA(LPCSTR lpszPath)
301 BOOL qflag = FALSE;
303 TRACE("%s\n",lpszPath);
305 while (*lpszPath)
307 if ((*lpszPath==' ') && !qflag)
308 return (LPSTR)lpszPath+1;
309 if (*lpszPath=='"')
310 qflag=!qflag;
311 lpszPath = CharNextA(lpszPath);
313 return (LPSTR)lpszPath;
316 /*************************************************************************
317 * PathGetArgsW [SHLWAPI.@]
319 LPWSTR WINAPI PathGetArgsW(LPCWSTR lpszPath)
321 BOOL qflag = FALSE;
323 TRACE("%s\n",debugstr_w(lpszPath));
325 while (*lpszPath)
327 if ((*lpszPath==' ') && !qflag)
328 return (LPWSTR)lpszPath+1;
329 if (*lpszPath=='"')
330 qflag=!qflag;
331 lpszPath = CharNextW(lpszPath);
333 return (LPWSTR)lpszPath;
336 /*************************************************************************
337 * PathGetDriveNumberA [SHLWAPI.@]
339 int WINAPI PathGetDriveNumberA(LPCSTR lpszPath)
341 int chr = tolower(lpszPath[0]);
343 TRACE ("%s\n",debugstr_a(lpszPath));
345 if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1;
346 return tolower(lpszPath[0]) - 'a' ;
349 /*************************************************************************
350 * PathGetDriveNumberW [SHLWAPI.@]
352 int WINAPI PathGetDriveNumberW(LPCWSTR lpszPath)
354 int chr = tolowerW(lpszPath[0]);
356 TRACE ("%s\n",debugstr_w(lpszPath));
358 if (!lpszPath || lpszPath[1]!=':' || chr < 'a' || chr > 'z') return -1;
359 return tolowerW(lpszPath[0]) - 'a' ;
362 /*************************************************************************
363 * PathRemoveFileSpecA [SHLWAPI.@]
365 * NOTES
366 * truncates passed argument to a valid path
367 * returns if the string was modified or not.
368 * "\foo\xx\foo"-> "\foo\xx"
369 * "\" -> "\"
370 * "a:\foo" -> "a:\"
372 BOOL WINAPI PathRemoveFileSpecA(LPSTR lpszPath)
374 LPSTR cutplace = lpszPath;
375 BOOL ret = FALSE;
377 TRACE("%s\n",lpszPath);
379 if(lpszPath)
381 while (*lpszPath == '\\') cutplace = ++lpszPath;
383 while (*lpszPath)
385 if(lpszPath[0] == '\\') cutplace = lpszPath;
387 if(lpszPath[0] == ':')
389 cutplace = lpszPath + 1;
390 if (lpszPath[1] == '\\') cutplace++;
391 lpszPath++;
393 lpszPath = CharNextA(lpszPath);
394 if (!lpszPath) break;
397 ret = (*cutplace!='\0');
398 *cutplace = '\0';
400 return ret;
403 /*************************************************************************
404 * PathRemoveFileSpecW [SHLWAPI.@]
406 BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath)
408 LPWSTR cutplace = lpszPath;
409 BOOL ret = FALSE;
411 TRACE("%s\n",debugstr_w(lpszPath));
413 if(lpszPath)
415 while (*lpszPath == '\\') cutplace = ++lpszPath;
417 while (*lpszPath)
419 if(lpszPath[0] == '\\') cutplace = lpszPath;
421 if(lpszPath[0] == ':')
423 cutplace = lpszPath + 1;
424 if (lpszPath[1] == '\\') cutplace++;
425 lpszPath++;
427 lpszPath = CharNextW(lpszPath);
428 if (!lpszPath) break;
431 ret = (*cutplace!='\0');
432 *cutplace = '\0';
434 return ret;
437 /*************************************************************************
438 * PathStripPathA [SHELLWAPI.@]
440 * NOTES
441 * removes the path from the beginning of a filename
443 void WINAPI PathStripPathA(LPSTR lpszPath)
445 LPSTR lpszFileName = PathFindFileNameA(lpszPath);
447 TRACE("%s\n", lpszPath);
449 if(lpszFileName)
450 RtlMoveMemory(lpszPath, lpszFileName, strlen(lpszFileName)+1);
453 /*************************************************************************
454 * PathStripPathW [SHELLWAPI.@]
456 void WINAPI PathStripPathW(LPWSTR lpszPath)
458 LPWSTR lpszFileName = PathFindFileNameW(lpszPath);
460 TRACE("%s\n", debugstr_w(lpszPath));
461 if(lpszFileName)
462 RtlMoveMemory(lpszPath, lpszFileName, (strlenW(lpszFileName)+1)*sizeof(WCHAR));
465 /*************************************************************************
466 * PathStripToRootA [SHLWAPI.@]
468 BOOL WINAPI PathStripToRootA(LPSTR lpszPath)
470 TRACE("%s\n", lpszPath);
472 if (!lpszPath) return FALSE;
473 while(!PathIsRootA(lpszPath))
474 if (!PathRemoveFileSpecA(lpszPath)) return FALSE;
475 return TRUE;
478 /*************************************************************************
479 * PathStripToRootW [SHLWAPI.@]
481 BOOL WINAPI PathStripToRootW(LPWSTR lpszPath)
483 TRACE("%s\n", debugstr_w(lpszPath));
485 if (!lpszPath) return FALSE;
486 while(!PathIsRootW(lpszPath))
487 if (!PathRemoveFileSpecW(lpszPath)) return FALSE;
488 return TRUE;
491 /*************************************************************************
492 * PathRemoveArgsA [SHLWAPI.@]
495 void WINAPI PathRemoveArgsA(LPSTR lpszPath)
497 TRACE("%s\n",lpszPath);
499 if(lpszPath)
501 LPSTR lpszArgs = PathGetArgsA(lpszPath);
502 if (!*lpszArgs)
504 LPSTR lpszLastChar = CharPrevA(lpszPath, lpszArgs);
505 if(*lpszLastChar==' ') *lpszLastChar = '\0';
510 /*************************************************************************
511 * PathRemoveArgsW [SHLWAPI.@]
513 void WINAPI PathRemoveArgsW(LPWSTR lpszPath)
515 TRACE("%s\n", debugstr_w(lpszPath));
517 if(lpszPath)
519 LPWSTR lpszArgs = PathGetArgsW(lpszPath);
520 if (!*lpszArgs)
522 LPWSTR lpszLastChar = CharPrevW(lpszPath, lpszArgs);
523 if(*lpszLastChar==' ') *lpszLastChar = '\0';
528 /*************************************************************************
529 * PathRemoveExtensionA [SHLWAPI.@]
531 void WINAPI PathRemoveExtensionA(LPSTR lpszPath)
533 LPSTR lpszExtension = PathFindExtensionA(lpszPath);
535 TRACE("%s\n", lpszPath);
537 if (lpszExtension) *lpszExtension='\0';
540 /*************************************************************************
541 * PathRemoveExtensionW [SHLWAPI.@]
543 void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
545 LPWSTR lpszExtension = PathFindExtensionW(lpszPath);
547 TRACE("%s\n", debugstr_w(lpszPath));
549 if (lpszExtension) *lpszExtension='\0';
552 /*************************************************************************
553 * PathRemoveBackslashA [SHLWAPI.@]
555 * If the path ends in a backslash it is replaced by a NULL
556 * and the address of the NULL is returned
557 * Otherwise
558 * the address of the last character is returned.
560 * FIXME
561 * "c:\": keep backslash
563 LPSTR WINAPI PathRemoveBackslashA( LPSTR lpszPath )
565 int len;
566 LPSTR szTemp = NULL;
568 if(lpszPath)
570 len = strlen(lpszPath);
571 szTemp = CharPrevA(lpszPath, lpszPath+len);
572 if (! PathIsRootA(lpszPath))
574 if (*szTemp == '\\') *szTemp = '\0';
577 return szTemp;
580 /*************************************************************************
581 * PathRemoveBackslashW [SHLWAPI.@]
583 LPWSTR WINAPI PathRemoveBackslashW( LPWSTR lpszPath )
585 int len;
586 LPWSTR szTemp = NULL;
588 if(lpszPath)
590 len = strlenW(lpszPath);
591 szTemp = CharPrevW(lpszPath, lpszPath+len);
592 if (! PathIsRootW(lpszPath))
594 if (*szTemp == '\\') *szTemp = '\0';
597 return szTemp;
602 Path Manipulations
605 /*************************************************************************
606 * PathRemoveBlanksA [SHLWAPI.@]
608 * NOTES
609 * remove spaces from beginning and end of passed string
611 void WINAPI PathRemoveBlanksA(LPSTR str)
613 LPSTR x = str;
615 TRACE("%s\n",str);
617 if(str)
619 while (*x==' ') x = CharNextA(x);
620 if (x!=str) strcpy(str,x);
621 x=str+strlen(str)-1;
622 while (*x==' ') x = CharPrevA(str, x);
623 if (*x==' ') *x='\0';
627 /*************************************************************************
628 * PathRemoveBlanksW [SHLWAPI.@]
630 void WINAPI PathRemoveBlanksW(LPWSTR str)
632 LPWSTR x = str;
634 TRACE("%s\n",debugstr_w(str));
636 if(str)
638 while (*x==' ') x = CharNextW(x);
639 if (x!=str) strcpyW(str,x);
640 x=str+strlenW(str)-1;
641 while (*x==' ') x = CharPrevW(str, x);
642 if (*x==' ') *x='\0';
646 /*************************************************************************
647 * PathQuoteSpacesA [SHLWAPI.@]
650 LPSTR WINAPI PathQuoteSpacesA(LPSTR lpszPath)
652 TRACE("%s\n",lpszPath);
654 if(StrChrA(lpszPath,' '))
656 int len = strlen(lpszPath);
657 RtlMoveMemory(lpszPath+1, lpszPath, len);
658 *(lpszPath++) = '"';
659 lpszPath += len;
660 *(lpszPath++) = '"';
661 *(lpszPath) = '\0';
662 return --lpszPath;
664 return 0;
667 /*************************************************************************
668 * PathQuoteSpacesW [SHLWAPI.@]
670 LPWSTR WINAPI PathQuoteSpacesW(LPWSTR lpszPath)
672 TRACE("%s\n",debugstr_w(lpszPath));
674 if(StrChrW(lpszPath,' '))
676 int len = strlenW(lpszPath);
677 RtlMoveMemory(lpszPath+1, lpszPath, len*sizeof(WCHAR));
678 *(lpszPath++) = '"';
679 lpszPath += len;
680 *(lpszPath++) = '"';
681 *(lpszPath) = '\0';
682 return --lpszPath;
684 return 0;
687 /*************************************************************************
688 * PathUnquoteSpacesA [SHLWAPI.@]
690 * NOTES
691 * unquote string (remove ")
693 VOID WINAPI PathUnquoteSpacesA(LPSTR str)
695 DWORD len = strlen(str);
697 TRACE("%s\n",str);
699 if (*str!='"')
700 return;
701 if (str[len-1]!='"')
702 return;
703 str[len-1]='\0';
704 strcpy(str,str+1);
705 return;
708 /*************************************************************************
709 * PathUnquoteSpacesW [SHLWAPI.@]
711 VOID WINAPI PathUnquoteSpacesW(LPWSTR str)
713 DWORD len = strlenW(str);
715 TRACE("%s\n",debugstr_w(str));
717 if (*str!='"')
718 return;
719 if (str[len-1]!='"')
720 return;
721 str[len-1]='\0';
722 strcpyW(str,str+1);
723 return;
726 /*************************************************************************
727 * PathParseIconLocationA [SHLWAPI.@]
729 int WINAPI PathParseIconLocationA(LPSTR lpszPath)
731 LPSTR lpstrComma = strchr(lpszPath, ',');
733 FIXME("%s stub\n", debugstr_a(lpszPath));
735 if (lpstrComma && lpstrComma[1])
737 lpstrComma[0]='\0';
738 /* return atoi(&lpstrComma[1]); FIXME */
741 PathUnquoteSpacesA(lpszPath);
742 return 0;
745 /*************************************************************************
746 * PathParseIconLocationW [SHLWAPI.@]
748 int WINAPI PathParseIconLocationW(LPWSTR lpszPath)
750 LPWSTR lpstrComma = strchrW(lpszPath, ',');
752 FIXME("%s stub\n", debugstr_w(lpszPath));
754 if (lpstrComma && lpstrComma[1])
756 lpstrComma[0]='\0';
757 /* return _wtoi(&lpstrComma[1]); FIXME */
759 PathUnquoteSpacesW(lpszPath);
760 return 0;
764 ########## cleaning and resolving paths ##########
767 /*************************************************************************
768 * PathFindOnPathA [SHLWAPI.@]
770 BOOL WINAPI PathFindOnPathA(LPSTR sFile, LPCSTR sOtherDirs)
772 FIXME("%s %s\n",sFile, sOtherDirs);
773 return FALSE;
776 /*************************************************************************
777 * PathFindOnPathW [SHLWAPI.@]
779 BOOL WINAPI PathFindOnPathW(LPWSTR sFile, LPCWSTR sOtherDirs)
781 FIXME("%s %s\n",debugstr_w(sFile), debugstr_w(sOtherDirs));
782 return FALSE;
785 /*************************************************************************
786 * PathCompactPathExA [SHLWAPI.@]
788 BOOL WINAPI PathCompactPathExA(
789 LPSTR pszOut,
790 LPCSTR pszSrc,
791 UINT cchMax,
792 DWORD dwFlags)
794 FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, pszSrc, cchMax, dwFlags);
795 return FALSE;
798 /*************************************************************************
799 * PathCompactPathExW [SHLWAPI.@]
801 BOOL WINAPI PathCompactPathExW(
802 LPWSTR pszOut,
803 LPCWSTR pszSrc,
804 UINT cchMax,
805 DWORD dwFlags)
807 FIXME("%p %s 0x%08x 0x%08lx\n", pszOut, debugstr_w(pszSrc), cchMax, dwFlags);
808 return FALSE;
812 ########## Path Testing ##########
815 /*************************************************************************
816 * PathIsUNCA [SHLWAPI.@]
818 * NOTES
819 * PathIsUNC(char*path);
821 BOOL WINAPI PathIsUNCA(LPCSTR lpszPath)
823 TRACE("%s\n",lpszPath);
825 return (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\'));
828 /*************************************************************************
829 * PathIsUNCW [SHLWAPI.@]
831 BOOL WINAPI PathIsUNCW(LPCWSTR lpszPath)
833 TRACE("%s\n",debugstr_w(lpszPath));
835 return (lpszPath && (lpszPath[0]=='\\') && (lpszPath[1]=='\\'));
838 /*************************************************************************
839 * PathIsRelativeA [SHLWAPI.@]
841 BOOL WINAPI PathIsRelativeA (LPCSTR lpszPath)
843 TRACE("lpszPath=%s\n",lpszPath);
845 return (lpszPath && (lpszPath[0]!='\\' && lpszPath[1]!=':'));
848 /*************************************************************************
849 * PathIsRelativeW [SHLWAPI.@]
851 BOOL WINAPI PathIsRelativeW (LPCWSTR lpszPath)
853 TRACE("lpszPath=%s\n",debugstr_w(lpszPath));
855 return (lpszPath && (lpszPath[0]!='\\' && lpszPath[1]!=':'));
858 /*************************************************************************
859 * PathIsRootA [SHLWAPI.@]
861 * notes
862 * TRUE if the path points to a root directory
864 BOOL WINAPI PathIsRootA(LPCSTR lpszPath)
866 TRACE("%s\n",lpszPath);
868 /* X:\ */
869 if (lpszPath[1]==':' && lpszPath[2]=='\\' && lpszPath[3]=='\0')
870 return TRUE;
872 /* "\" */
873 if (lpszPath[0]=='\\' && lpszPath[1]=='\0')
874 return TRUE;
876 /* UNC "\\<computer>\<share>" */
877 if (lpszPath[0]=='\\' && lpszPath[1]=='\\')
879 int foundbackslash = 0;
880 lpszPath += 2;
881 while (*lpszPath)
883 if (*lpszPath=='\\') foundbackslash++;
884 lpszPath = CharNextA(lpszPath);
886 if (foundbackslash <= 1)
887 return TRUE;
889 return FALSE;
892 /*************************************************************************
893 * PathIsRootW [SHLWAPI.@]
895 BOOL WINAPI PathIsRootW(LPCWSTR lpszPath)
897 TRACE("%s\n",debugstr_w(lpszPath));
899 /* X:\ */
900 if (lpszPath[1]==':' && lpszPath[2]=='\\' && lpszPath[3]=='\0')
901 return TRUE;
903 /* "\" */
904 if (lpszPath[0]=='\\' && lpszPath[1]=='\0')
905 return TRUE;
907 /* UNC "\\<computer>\<share>" */
908 if (lpszPath[0]=='\\' && lpszPath[1]=='\\')
910 int foundbackslash = 0;
911 lpszPath += 2;
912 while (*lpszPath)
914 if (*lpszPath=='\\') foundbackslash++;
915 lpszPath = CharNextW(lpszPath);
917 if (foundbackslash <= 1)
918 return TRUE;
920 return FALSE;
924 /*************************************************************************
925 * PathIsDirectoryA [SHLWAPI.@]
927 BOOL WINAPI PathIsDirectoryA(LPCSTR lpszPath)
929 DWORD dwAttr;
931 TRACE("%s\n", debugstr_a(lpszPath));
933 dwAttr = GetFileAttributesA(lpszPath);
934 return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0;
937 /*************************************************************************
938 * PathIsDirectoryW [SHLWAPI.@]
940 BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
942 DWORD dwAttr;
944 TRACE("%s\n", debugstr_w(lpszPath));
946 dwAttr = GetFileAttributesW(lpszPath);
947 return (dwAttr != -1) ? dwAttr & FILE_ATTRIBUTE_DIRECTORY : 0;
950 /*************************************************************************
951 * PathFileExistsA [SHLWAPI.@]
953 * NOTES
954 * file_exists(char *fn);
956 BOOL WINAPI PathFileExistsA(LPCSTR lpszPath)
958 TRACE("%s\n",lpszPath);
959 return (GetFileAttributesA(lpszPath)!=-1);
962 /*************************************************************************
963 * PathFileExistsW [SHLWAPI.@]
965 BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
967 TRACE("%s\n",debugstr_w(lpszPath));
968 return (GetFileAttributesW(lpszPath)!=-1);
971 /*************************************************************************
972 * PathMatchSingleMaskA [internal]
974 * NOTES
975 * internal (used by PathMatchSpec)
977 static BOOL PathMatchSingleMaskA(LPCSTR name, LPCSTR mask)
979 while (*name && *mask && *mask!=';')
981 if (*mask=='*')
985 if (PathMatchSingleMaskA(name,mask+1)) return 1; /* try substrings */
986 } while (*name++);
987 return 0;
989 if (toupper(*mask)!=toupper(*name) && *mask!='?') return 0;
990 name = CharNextA(name);
991 mask = CharNextA(mask);
993 if (!*name)
995 while (*mask=='*') mask++;
996 if (!*mask || *mask==';') return 1;
998 return 0;
1001 /*************************************************************************
1002 * PathMatchSingleMaskW [internal]
1004 static BOOL PathMatchSingleMaskW(LPCWSTR name, LPCWSTR mask)
1006 while (*name && *mask && *mask!=';')
1008 if (*mask=='*')
1012 if (PathMatchSingleMaskW(name,mask+1)) return 1; /* try substrings */
1013 } while (*name++);
1014 return 0;
1016 if (toupperW(*mask)!=toupperW(*name) && *mask!='?') return 0;
1017 name = CharNextW(name);
1018 mask = CharNextW(mask);
1020 if (!*name)
1022 while (*mask=='*') mask++;
1023 if (!*mask || *mask==';') return 1;
1025 return 0;
1027 /*************************************************************************
1028 * PathMatchSpecA [SHLWAPI.@]
1030 * NOTES
1031 * used from COMDLG32
1033 BOOL WINAPI PathMatchSpecA(LPCSTR name, LPCSTR mask)
1035 TRACE("%s %s\n",name,mask);
1037 if (!lstrcmpA( mask, "*.*" )) return 1; /* we don't require a period */
1039 while (*mask)
1041 if (PathMatchSingleMaskA(name,mask)) return 1; /* helper function */
1042 while (*mask && *mask!=';') mask = CharNextA(mask);
1043 if (*mask==';')
1045 mask++;
1046 while (*mask==' ') mask++; /* masks may be separated by "; " */
1049 return 0;
1052 /*************************************************************************
1053 * PathMatchSpecW [SHLWAPI.@]
1055 BOOL WINAPI PathMatchSpecW(LPCWSTR name, LPCWSTR mask)
1057 static const WCHAR stemp[] = { '*','.','*',0 };
1058 TRACE("%s %s\n",debugstr_w(name),debugstr_w(mask));
1060 if (!lstrcmpW( mask, stemp )) return 1; /* we don't require a period */
1062 while (*mask)
1064 if (PathMatchSingleMaskW(name,mask)) return 1; /* helper function */
1065 while (*mask && *mask!=';') mask = CharNextW(mask);
1066 if (*mask==';')
1068 mask++;
1069 while (*mask==' ') mask++; /* masks may be separated by "; " */
1072 return 0;
1075 /*************************************************************************
1076 * PathIsSameRootA [SHLWAPI.@]
1078 * FIXME
1079 * what to do with "\path" ??
1081 BOOL WINAPI PathIsSameRootA(LPCSTR lpszPath1, LPCSTR lpszPath2)
1083 TRACE("%s %s\n", lpszPath1, lpszPath2);
1085 if (PathIsRelativeA(lpszPath1) || PathIsRelativeA(lpszPath2)) return FALSE;
1087 /* usual path */
1088 if ( toupper(lpszPath1[0])==toupper(lpszPath2[0]) &&
1089 lpszPath1[1]==':' && lpszPath2[1]==':' &&
1090 lpszPath1[2]=='\\' && lpszPath2[2]=='\\')
1091 return TRUE;
1093 /* UNC */
1094 if (lpszPath1[0]=='\\' && lpszPath2[0]=='\\' &&
1095 lpszPath1[1]=='\\' && lpszPath2[1]=='\\')
1097 int pos=2, bsfound=0;
1098 while (lpszPath1[pos] && lpszPath2[pos] &&
1099 (lpszPath1[pos] == lpszPath2[pos]))
1101 if (lpszPath1[pos]=='\\') bsfound++;
1102 if (bsfound == 2) return TRUE;
1103 pos++; /* fixme: use CharNext*/
1105 return (lpszPath1[pos] == lpszPath2[pos]);
1107 return FALSE;
1110 /*************************************************************************
1111 * PathIsSameRootW [SHLWAPI.@]
1113 BOOL WINAPI PathIsSameRootW(LPCWSTR lpszPath1, LPCWSTR lpszPath2)
1115 TRACE("%s %s\n", debugstr_w(lpszPath1), debugstr_w(lpszPath2));
1117 if (PathIsRelativeW(lpszPath1) || PathIsRelativeW(lpszPath2)) return FALSE;
1119 /* usual path */
1120 if ( toupperW(lpszPath1[0])==toupperW(lpszPath2[0]) &&
1121 lpszPath1[1]==':' && lpszPath2[1]==':' &&
1122 lpszPath1[2]=='\\' && lpszPath2[2]=='\\')
1123 return TRUE;
1125 /* UNC */
1126 if (lpszPath1[0]=='\\' && lpszPath2[0]=='\\' &&
1127 lpszPath1[1]=='\\' && lpszPath2[1]=='\\')
1129 int pos=2, bsfound=0;
1130 while (lpszPath1[pos] && lpszPath2[pos] &&
1131 (lpszPath1[pos] == lpszPath2[pos]))
1133 if (lpszPath1[pos]=='\\') bsfound++;
1134 if (bsfound == 2) return TRUE;
1135 pos++;/* fixme: use CharNext*/
1137 return (lpszPath1[pos] == lpszPath2[pos]);
1139 return FALSE;
1142 /*************************************************************************
1143 * PathIsURLA
1145 BOOL WINAPI PathIsURLA(LPCSTR lpstrPath)
1147 LPSTR lpstrRes;
1148 int iSize, i=0;
1149 static LPSTR SupportedProtocol[] =
1150 {"http","https","ftp","gopher","file","mailto",NULL};
1152 if(!lpstrPath) return FALSE;
1154 /* get protocol */
1155 lpstrRes = strchr(lpstrPath,':');
1156 if(!lpstrRes) return FALSE;
1157 iSize = lpstrRes - lpstrPath;
1159 while(SupportedProtocol[i])
1161 if (iSize == strlen(SupportedProtocol[i]))
1162 if(!strncasecmp(lpstrPath, SupportedProtocol[i], iSize))
1163 return TRUE;
1164 i++;
1167 return FALSE;
1170 /*************************************************************************
1171 * PathIsURLW
1173 BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
1175 LPWSTR lpstrRes;
1176 int iSize, i=0;
1177 static WCHAR SupportedProtocol[7][7] =
1178 {{'h','t','t','p','\0'},{'h','t','t','p','s','\0'},{'f','t','p','\0'},
1179 {'g','o','p','h','e','r','\0'},{'f','i','l','e','\0'},
1180 {'m','a','i','l','t','o','\0'},{0}};
1182 if(!lpstrPath) return FALSE;
1184 /* get protocol */
1185 lpstrRes = strchrW(lpstrPath,':');
1186 if(!lpstrRes) return FALSE;
1187 iSize = lpstrRes - lpstrPath;
1189 while(SupportedProtocol[i])
1191 if (iSize == strlenW(SupportedProtocol[i]))
1192 if(!strncmpiW(lpstrPath, SupportedProtocol[i], iSize))
1193 return TRUE;
1194 i++;
1197 return FALSE;
1201 /*************************************************************************
1202 * PathIsContentTypeA [SHLWAPI.@]
1204 BOOL WINAPI PathIsContentTypeA(LPCSTR pszPath, LPCSTR pszContentType)
1206 FIXME("%s %s\n", pszPath, pszContentType);
1207 return FALSE;
1210 /*************************************************************************
1211 * PathIsContentTypeW [SHLWAPI.@]
1213 BOOL WINAPI PathIsContentTypeW(LPCWSTR pszPath, LPCWSTR pszContentType)
1215 FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszContentType));
1216 return FALSE;
1219 /*************************************************************************
1220 * PathIsFileSpecA [SHLWAPI.@]
1222 BOOL WINAPI PathIsFileSpecA(LPCSTR pszPath)
1224 FIXME("%s\n", pszPath);
1225 return FALSE;
1228 /*************************************************************************
1229 * PathIsFileSpecW [SHLWAPI.@]
1231 BOOL WINAPI PathIsFileSpecW(LPCWSTR pszPath)
1233 FIXME("%s\n", debugstr_w(pszPath));
1234 return FALSE;
1237 /*************************************************************************
1238 * PathIsPrefixA [SHLWAPI.@]
1240 BOOL WINAPI PathIsPrefixA(LPCSTR pszPrefix, LPCSTR pszPath)
1242 FIXME("%s %s\n", pszPrefix, pszPath);
1243 return FALSE;
1246 /*************************************************************************
1247 * PathIsPrefixW [SHLWAPI.@]
1249 BOOL WINAPI PathIsPrefixW(LPCWSTR pszPrefix, LPCWSTR pszPath)
1251 FIXME("%s %s\n", debugstr_w(pszPrefix), debugstr_w(pszPath));
1252 return FALSE;
1255 /*************************************************************************
1256 * PathIsSystemFolderA [SHLWAPI.@]
1258 BOOL WINAPI PathIsSystemFolderA(LPCSTR pszPath, DWORD dwAttrb)
1260 FIXME("%s 0x%08lx\n", pszPath, dwAttrb);
1261 return FALSE;
1264 /*************************************************************************
1265 * PathIsSystemFolderW [SHLWAPI.@]
1267 BOOL WINAPI PathIsSystemFolderW(LPCWSTR pszPath, DWORD dwAttrb)
1269 FIXME("%s 0x%08lx\n", debugstr_w(pszPath), dwAttrb);
1270 return FALSE;
1273 /*************************************************************************
1274 * PathIsUNCServerA [SHLWAPI.@]
1276 BOOL WINAPI PathIsUNCServerA(
1277 LPCSTR pszPath)
1279 FIXME("%s\n", pszPath);
1280 return FALSE;
1283 /*************************************************************************
1284 * PathIsUNCServerW [SHLWAPI.@]
1286 BOOL WINAPI PathIsUNCServerW(
1287 LPCWSTR pszPath)
1289 FIXME("%s\n", debugstr_w(pszPath));
1290 return FALSE;
1293 /*************************************************************************
1294 * PathIsUNCServerShareA [SHLWAPI.@]
1296 BOOL WINAPI PathIsUNCServerShareA(
1297 LPCSTR pszPath)
1299 FIXME("%s\n", pszPath);
1300 return FALSE;
1303 /*************************************************************************
1304 * PathIsUNCServerShareW [SHLWAPI.@]
1306 BOOL WINAPI PathIsUNCServerShareW(
1307 LPCWSTR pszPath)
1309 FIXME("%s\n", debugstr_w(pszPath));
1310 return FALSE;
1313 /*************************************************************************
1314 * PathCanonicalizeA [SHLWAPI.@]
1316 * FIXME
1317 * returnvalue, use CharNext
1320 BOOL WINAPI PathCanonicalizeA(LPSTR pszBuf, LPCSTR pszPath)
1322 int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = strlen(pszPath);
1323 BOOL bModifyed = FALSE;
1325 TRACE("%p %s\n", pszBuf, pszPath);
1327 pszBuf[OffsetDst]='\0';
1329 /* keep the root of the path */
1330 if( LenSrc && (pszPath[OffsetSrc]=='\\'))
1332 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;
1334 else if ( (LenSrc >= 2) && (pszPath[OffsetSrc+1] == ':'))
1336 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;
1337 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;
1338 if (LenSrc && (pszPath[OffsetSrc] == '\\'))
1340 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;
1341 if (LenSrc == 1 && pszPath[OffsetSrc]=='.')
1343 /* C:\. */
1344 OffsetSrc++; LenSrc--; bModifyed = TRUE;
1346 else if (LenSrc == 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='.')
1348 /* C:\.. */
1349 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE;
1354 /* ".\" at the beginning of the path */
1355 if (LenSrc >= 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='\\')
1357 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE;
1360 while ( LenSrc )
1362 if((LenSrc>=3) && (pszPath[OffsetSrc]=='\\') && (pszPath[OffsetSrc+1]=='.') && (pszPath[OffsetSrc+2]=='.'))
1364 /* "\.." found, go one deeper */
1365 while((OffsetDst > OffsetMin) && (pszBuf[OffsetDst]!='\\')) OffsetDst--;
1366 OffsetSrc += 3; LenSrc -= 3; bModifyed = TRUE;
1367 if(OffsetDst == OffsetMin && pszPath[OffsetSrc]=='\\') OffsetSrc++;
1368 pszBuf[OffsetDst] = '\0'; /* important for \..\.. */
1370 else if(LenSrc>=2 && pszPath[OffsetSrc]=='\\' && pszPath[OffsetSrc+1]=='.' )
1372 /* "\." found, skip it */
1373 OffsetSrc += 2; LenSrc-=2; bModifyed = TRUE;
1375 else
1377 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; LenSrc--;
1380 pszBuf[OffsetDst] = '\0';
1381 TRACE("-- %s %u\n", pszBuf, bModifyed);
1382 return bModifyed;
1386 /*************************************************************************
1387 * PathCanonicalizeW [SHLWAPI.@]
1389 * FIXME
1390 * returnvalue, use CharNext
1392 BOOL WINAPI PathCanonicalizeW(LPWSTR pszBuf, LPCWSTR pszPath)
1394 int OffsetMin = 0, OffsetSrc = 0, OffsetDst = 0, LenSrc = strlenW(pszPath);
1395 BOOL bModifyed = FALSE;
1397 TRACE("%p %s\n", pszBuf, debugstr_w(pszPath));
1399 pszBuf[OffsetDst]='\0';
1401 /* keep the root of the path */
1402 if( LenSrc && (pszPath[OffsetSrc]=='\\'))
1404 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;
1406 else if ( (LenSrc >= 2) && (pszPath[OffsetSrc+1] == ':'))
1408 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;
1409 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;
1410 if (LenSrc && (pszPath[OffsetSrc] == '\\'))
1412 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; OffsetMin++; LenSrc--;
1413 if (LenSrc == 1 && pszPath[OffsetSrc]=='.')
1415 /* C:\. */
1416 OffsetSrc++; LenSrc--; bModifyed = TRUE;
1418 else if (LenSrc == 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='.')
1420 /* C:\.. */
1421 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE;
1426 /* ".\" at the beginning of the path */
1427 if (LenSrc >= 2 && pszPath[OffsetSrc]=='.' && pszPath[OffsetSrc+1]=='\\')
1429 OffsetSrc+=2; LenSrc-=2; bModifyed = TRUE;
1432 while ( LenSrc )
1434 if((LenSrc>=3) && (pszPath[OffsetSrc]=='\\') && (pszPath[OffsetSrc+1]=='.') && (pszPath[OffsetSrc+2]=='.'))
1436 /* "\.." found, go one deeper */
1437 while((OffsetDst > OffsetMin) && (pszBuf[OffsetDst]!='\\')) OffsetDst--;
1438 OffsetSrc += 3; LenSrc -= 3; bModifyed = TRUE;
1439 if(OffsetDst == OffsetMin && pszPath[OffsetSrc]=='\\') OffsetSrc++;
1440 pszBuf[OffsetDst] = '\0'; /* important for \..\.. */
1442 else if(LenSrc>=2 && pszPath[OffsetSrc]=='\\' && pszPath[OffsetSrc+1]=='.' )
1444 /* "\." found, skip it */
1445 OffsetSrc += 2; LenSrc-=2; bModifyed = TRUE;
1447 else
1449 pszBuf[OffsetDst++] = pszPath[OffsetSrc++]; LenSrc--;
1452 pszBuf[OffsetDst] = '\0';
1453 TRACE("-- %s %u\n", debugstr_w(pszBuf), bModifyed);
1454 return bModifyed;
1457 /*************************************************************************
1458 * PathFindNextComponentA [SHLWAPI.@]
1460 * NOTES
1461 * special cases:
1462 * "" null
1463 * aa "" (pointer to traling NULL)
1464 * aa\ "" (pointer to traling NULL)
1465 * aa\\ "" (pointer to traling NULL)
1466 * aa\\bb bb
1467 * aa\\\bb \bb
1468 * c:\aa\ "aa\"
1469 * \\aa aa
1470 * \\aa\b aa\b
1472 LPSTR WINAPI PathFindNextComponentA(LPCSTR pszPath)
1474 LPSTR pos;
1476 TRACE("%s\n", pszPath);
1478 if(!pszPath || !*pszPath) return NULL;
1479 if(!(pos = StrChrA(pszPath, '\\')))
1480 return (LPSTR) pszPath + strlen(pszPath);
1481 pos++;
1482 if(pos[0] == '\\') pos++;
1483 return pos;
1486 /*************************************************************************
1487 * PathFindNextComponentW [SHLWAPI.@]
1489 LPWSTR WINAPI PathFindNextComponentW(LPCWSTR pszPath)
1491 LPWSTR pos;
1493 TRACE("%s\n", debugstr_w(pszPath));
1495 if(!pszPath || !*pszPath) return NULL;
1496 if (!(pos = StrChrW(pszPath, '\\')))
1497 return (LPWSTR) pszPath + strlenW(pszPath);
1498 pos++;
1499 if(pos[0] == '\\') pos++;
1500 return pos;
1503 /*************************************************************************
1504 * PathAddExtensionA [SHLWAPI.@]
1506 * NOTES
1507 * it adds never a dot
1510 BOOL WINAPI PathAddExtensionA(
1511 LPSTR pszPath,
1512 LPCSTR pszExtension)
1514 if (*pszPath)
1516 if (*(PathFindExtensionA(pszPath))) return FALSE;
1518 if (!pszExtension || *pszExtension=='\0')
1519 strcat(pszPath, "exe");
1520 else
1521 strcat(pszPath, pszExtension);
1524 return TRUE;
1527 /*************************************************************************
1528 * PathAddExtensionW [SHLWAPI.@]
1530 BOOL WINAPI PathAddExtensionW(
1531 LPWSTR pszPath,
1532 LPCWSTR pszExtension)
1534 static const WCHAR ext[] = { 'e','x','e',0 };
1536 if (*pszPath)
1538 if (*(PathFindExtensionW(pszPath))) return FALSE;
1540 if (!pszExtension || *pszExtension=='\0')
1541 strcatW(pszPath, ext);
1542 else
1543 strcatW(pszPath, pszExtension);
1545 return TRUE;
1549 /*************************************************************************
1550 * PathMakePrettyA [SHLWAPI.@]
1552 BOOL WINAPI PathMakePrettyA(
1553 LPSTR lpPath)
1555 FIXME("%s\n", lpPath);
1556 return TRUE;
1559 /*************************************************************************
1560 * PathMakePrettyW [SHLWAPI.@]
1562 BOOL WINAPI PathMakePrettyW(
1563 LPWSTR lpPath)
1565 FIXME("%s\n", debugstr_w(lpPath));
1566 return TRUE;
1570 /*************************************************************************
1571 * PathCommonPrefixA [SHLWAPI.@]
1573 int WINAPI PathCommonPrefixA(
1574 LPCSTR pszFile1,
1575 LPCSTR pszFile2,
1576 LPSTR achPath)
1578 FIXME("%s %s %p\n", pszFile1, pszFile2, achPath);
1579 return 0;
1582 /*************************************************************************
1583 * PathCommonPrefixW [SHLWAPI.@]
1585 int WINAPI PathCommonPrefixW(
1586 LPCWSTR pszFile1,
1587 LPCWSTR pszFile2,
1588 LPWSTR achPath)
1590 FIXME("%s %s %p\n", debugstr_w(pszFile1), debugstr_w(pszFile2),achPath );
1591 return 0;
1594 /*************************************************************************
1595 * PathCompactPathA [SHLWAPI.@]
1597 BOOL WINAPI PathCompactPathA(HDC hDC, LPSTR pszPath, UINT dx)
1599 FIXME("0x%08x %s 0x%08x\n", hDC, pszPath, dx);
1600 return FALSE;
1603 /*************************************************************************
1604 * PathCompactPathW [SHLWAPI.@]
1606 BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR pszPath, UINT dx)
1608 FIXME("0x%08x %s 0x%08x\n", hDC, debugstr_w(pszPath), dx);
1609 return FALSE;
1612 /*************************************************************************
1613 * PathGetCharTypeA [SHLWAPI.@]
1615 UINT WINAPI PathGetCharTypeA(UCHAR ch)
1617 FIXME("%c\n", ch);
1618 return 0;
1621 /*************************************************************************
1622 * PathGetCharTypeW [SHLWAPI.@]
1624 UINT WINAPI PathGetCharTypeW(WCHAR ch)
1626 FIXME("%c\n", ch);
1627 return 0;
1630 /*************************************************************************
1631 * PathMakeSystemFolderA [SHLWAPI.@]
1633 BOOL WINAPI PathMakeSystemFolderA(LPCSTR pszPath)
1635 FIXME("%s\n", pszPath);
1636 return FALSE;
1639 /*************************************************************************
1640 * PathMakeSystemFolderW [SHLWAPI.@]
1642 BOOL WINAPI PathMakeSystemFolderW(LPCWSTR pszPath)
1644 FIXME("%s\n", debugstr_w(pszPath));
1645 return FALSE;
1648 /*************************************************************************
1649 * PathRenameExtensionA [SHLWAPI.@]
1651 BOOL WINAPI PathRenameExtensionA(LPSTR pszPath, LPCSTR pszExt)
1653 FIXME("%s %s\n", pszPath, pszExt);
1654 return FALSE;
1657 /*************************************************************************
1658 * PathRenameExtensionW [SHLWAPI.@]
1660 BOOL WINAPI PathRenameExtensionW(LPWSTR pszPath, LPCWSTR pszExt)
1662 FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszExt));
1663 return FALSE;
1666 /*************************************************************************
1667 * PathSearchAndQualifyA [SHLWAPI.@]
1669 BOOL WINAPI PathSearchAndQualifyA(
1670 LPCSTR pszPath,
1671 LPSTR pszBuf,
1672 UINT cchBuf)
1674 FIXME("%s %s 0x%08x\n", pszPath, pszBuf, cchBuf);
1675 return FALSE;
1678 /*************************************************************************
1679 * PathSearchAndQualifyW [SHLWAPI.@]
1681 BOOL WINAPI PathSearchAndQualifyW(
1682 LPCWSTR pszPath,
1683 LPWSTR pszBuf,
1684 UINT cchBuf)
1686 FIXME("%s %s 0x%08x\n", debugstr_w(pszPath), debugstr_w(pszBuf), cchBuf);
1687 return FALSE;
1690 /*************************************************************************
1691 * PathSkipRootA [SHLWAPI.@]
1693 LPSTR WINAPI PathSkipRootA(LPCSTR pszPath)
1695 FIXME("%s\n", pszPath);
1696 return (LPSTR)pszPath;
1699 /*************************************************************************
1700 * PathSkipRootW [SHLWAPI.@]
1702 LPWSTR WINAPI PathSkipRootW(LPCWSTR pszPath)
1704 FIXME("%s\n", debugstr_w(pszPath));
1705 return (LPWSTR)pszPath;
1708 /*************************************************************************
1709 * PathCreateFromUrlA [SHLWAPI.@]
1711 HRESULT WINAPI PathCreateFromUrlA(
1712 LPCSTR pszUrl,
1713 LPSTR pszPath,
1714 LPDWORD pcchPath,
1715 DWORD dwFlags)
1717 FIXME("%s %p %p 0x%08lx\n",
1718 pszUrl, pszPath, pcchPath, dwFlags);
1719 return S_OK;
1722 /*************************************************************************
1723 * PathCreateFromUrlW [SHLWAPI.@]
1725 HRESULT WINAPI PathCreateFromUrlW(
1726 LPCWSTR pszUrl,
1727 LPWSTR pszPath,
1728 LPDWORD pcchPath,
1729 DWORD dwFlags)
1731 FIXME("%s %p %p 0x%08lx\n",
1732 debugstr_w(pszUrl), pszPath, pcchPath, dwFlags);
1733 return S_OK;
1736 /*************************************************************************
1737 * PathRelativePathToA [SHLWAPI.@]
1739 BOOL WINAPI PathRelativePathToA(
1740 LPSTR pszPath,
1741 LPCSTR pszFrom,
1742 DWORD dwAttrFrom,
1743 LPCSTR pszTo,
1744 DWORD dwAttrTo)
1746 FIXME("%s %s 0x%08lx %s 0x%08lx\n",
1747 pszPath, pszFrom, dwAttrFrom, pszTo, dwAttrTo);
1748 return FALSE;
1751 /*************************************************************************
1752 * PathRelativePathToW [SHLWAPI.@]
1754 BOOL WINAPI PathRelativePathToW(
1755 LPWSTR pszPath,
1756 LPCWSTR pszFrom,
1757 DWORD dwAttrFrom,
1758 LPCWSTR pszTo,
1759 DWORD dwAttrTo)
1761 FIXME("%s %s 0x%08lx %s 0x%08lx\n",
1762 debugstr_w(pszPath), debugstr_w(pszFrom), dwAttrFrom, debugstr_w(pszTo), dwAttrTo);
1763 return FALSE;
1766 /*************************************************************************
1767 * PathUnmakeSystemFolderA [SHLWAPI.@]
1769 BOOL WINAPI PathUnmakeSystemFolderA(LPCSTR pszPath)
1771 FIXME("%s\n", pszPath);
1772 return FALSE;
1775 /*************************************************************************
1776 * PathUnmakeSystemFolderW [SHLWAPI.@]
1778 BOOL WINAPI PathUnmakeSystemFolderW(LPCWSTR pszPath)
1780 FIXME("%s\n", debugstr_w(pszPath));
1781 return FALSE;
1785 ########## special ##########
1788 /*************************************************************************
1789 * PathSetDlgItemPathA [SHLWAPI.@]
1791 * NOTES
1792 * use PathCompactPath to make sure, the path fits into the control
1794 BOOL WINAPI PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR pszPath)
1795 { TRACE("%x %x %s\n",hDlg, id, pszPath);
1796 return SetDlgItemTextA(hDlg, id, pszPath);
1799 /*************************************************************************
1800 * PathSetDlgItemPathW [SHLWAPI.@]
1802 BOOL WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR pszPath)
1803 { TRACE("%x %x %s\n",hDlg, id, debugstr_w(pszPath));
1804 return SetDlgItemTextW(hDlg, id, pszPath);