source: trunk/src/shell32/path.cpp@ 187

Last change on this file since 187 was 187, checked in by phaller, 26 years ago

Fix: added missing path.cpp

File size: 22.6 KB
Line 
1/* $Id: path.cpp,v 1.1 1999-06-25 09:02:13 phaller Exp $ */
2
3/*
4 * Win32 SHELL32 for OS/2
5 * Copyright 1997 Marcus Meissner
6 * Copyright 1988 Patrick Haller (adapted for win32os2)
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 */
10
11
12/*****************************************************************************
13 * Includes *
14 *****************************************************************************/
15
16#include <os2win.h>
17#include <shellapi.h>
18#include <winreg.h>
19
20#include <stdarg.h>
21//#include <builtin.h>
22#include <stdio.h>
23#include <stdlib.h>
24#include <string.h>
25#include <wchar.h>
26#include <wcstr.h>
27
28#define HAVE_WCTYPE_H
29#include <wctype.h>
30
31#include <misc.h>
32#include <nameid.h>
33#include <unicode.h>
34#include <winnls.h>
35#include <ctype.h>
36
37#include "shell32.h"
38
39
40/*****************************************************************************
41 * Types & Defines *
42 *****************************************************************************/
43
44BOOL VERSION_OsIsUnicode()
45{
46 return FALSE; // ODIN is ASCII by default
47 // however: what will the applications do ?
48}
49
50// quick'n'dirty port macros
51#define debugstr_w(a) (a)
52#define debugstr_a(a) (a)
53#define lstrcpyAtoW(a,b) AsciiToUnicode(b,a)
54#define lstrcpyWtoA(a,b) UnicodeToAscii(b,a)
55
56
57/*****************************************************************************
58 * Name :
59 * Purpose :
60 * Parameters:
61 * Variables :
62 * Result :
63 * Remark : unknown
64 * Status : UNTESTED UNKNOWN STUB
65 *
66 * Author : Patrick Haller [Tue, 1998/06/15 03:00]
67 *****************************************************************************/
68
69
70/*************************************************************************
71 * PathIsRoot [SHELL32.29]
72 */
73BOOL WIN32API PathIsRootA(LPCSTR x)
74{
75 dprintf(("SHELL32: %s\n",x));
76
77 if (*(x+1)==':' && *(x+2)=='\\') /* "X:\" */
78 return 1;
79 if (*x=='\\') /* "\" */
80 return 0;
81 if (x[0]=='\\' && x[1]=='\\') /* UNC "\\<xx>\" */
82 { int foundbackslash = 0;
83 x=x+2;
84 while (*x)
85 { if (*x++=='\\')
86 foundbackslash++;
87 }
88 if (foundbackslash<=1) /* max 1 \ more ... */
89 return 1;
90 }
91 return 0;
92}
93
94BOOL WIN32API PathIsRootW(LPCWSTR x)
95{ dprintf(("SHELL32: %s\n",debugstr_w(x)));
96 if (*(x+1)==':' && *(x+2)=='\\') /* "X:\" */
97 return 1;
98 if (*x == (WCHAR) '\\') /* "\" */
99 return 0;
100 if (x[0]==(WCHAR)'\\' && x[1]==(WCHAR)'\\') /* UNC "\\<xx>\" */
101 { int foundbackslash = 0;
102 x=x+2;
103 while (*x)
104 { if (*x++==(WCHAR)'\\')
105 foundbackslash++;
106 }
107 if (foundbackslash<=1) /* max 1 \ more ... */
108 return 1;
109 }
110 return 0;
111}
112
113BOOL WIN32API PathIsRootAW(LPCVOID x)
114{
115 if (VERSION_OsIsUnicode())
116 return PathIsRootW( (LPWSTR)x );
117 else
118 return PathIsRootA( (LPTSTR)x );
119}
120
121/*************************************************************************
122 * PathBuildRoot [SHELL32.30]
123 */
124LPSTR WIN32API PathBuildRootA(LPSTR root,BYTE drive)
125{
126 dprintf(("SHELL32: %p %i\n",root, drive));
127 strcpy(root,"A:\\");
128 root[0]+=drive;
129 return root;
130}
131
132LPWSTR WIN32API PathBuildRootW(LPWSTR root,BYTE drive)
133{
134 dprintf(("SHELL32: %p %i\n",root, drive));
135
136 wcscpy((wchar_t*)root,L"A:\\");
137 root[0]+=drive;
138 return root;
139}
140
141LPVOID WIN32API PathBuildRootAW(LPCVOID x, BYTE y)
142{
143 if (VERSION_OsIsUnicode())
144 return (LPVOID)PathBuildRootW( (LPWSTR)x,y);
145 else
146 return (LPVOID)PathBuildRootA( (LPTSTR)x,y);
147}
148
149/*************************************************************************
150 * PathFindExtension [SHELL32.31]
151 *
152 * NOTES
153 * returns pointer to last . in last pathcomponent or at \0.
154 */
155LPCSTR WIN32API PathFindExtensionA(LPCSTR path)
156{ LPCSTR lastpoint = NULL;
157 dprintf(("SHELL32: %p %s\n",path,path));
158 while (*path)
159 { if (*path=='\\'||*path==' ')
160 lastpoint=NULL;
161 if (*path=='.')
162 lastpoint=path;
163 path++;
164 }
165 return lastpoint?lastpoint:path;
166}
167LPCWSTR WIN32API PathFindExtensionW(LPCWSTR path)
168{ LPCWSTR lastpoint = NULL;
169 dprintf(("SHELL32: %p L%s\n",path,debugstr_w(path)));
170 while (*path)
171 { if (*path==(WCHAR)'\\'||*path==(WCHAR)' ')
172 lastpoint=NULL;
173 if (*path==(WCHAR)'.')
174 lastpoint=path;
175 path++;
176 }
177 return lastpoint?lastpoint:path;
178}
179LPCVOID WIN32API PathFindExtensionAW(LPCVOID path)
180{
181 if (VERSION_OsIsUnicode())
182 return PathFindExtensionW( (LPCWSTR)path );
183 else
184 return PathFindExtensionA( (LPCTSTR)path );
185}
186
187/*************************************************************************
188 * PathAddBackslash [SHELL32.32]
189 *
190 * NOTES
191 * append \ if there is none
192 */
193LPSTR WIN32API PathAddBackslashA(LPSTR path)
194{ int len;
195 dprintf(("SHELL32: %p->%s\n",path,path));
196
197 len = strlen(path);
198 if (len && path[len-1]!='\\')
199 { path[len] = '\\';
200 path[len+1]= 0x00;
201 return path+len+1;
202 }
203 return path+len;
204}
205LPWSTR WIN32API PathAddBackslashW(LPWSTR path)
206{ int len;
207 dprintf(("SHELL32: %p->%s\n",path,debugstr_w(path)));
208
209 len = lstrlenW(path);
210 if (len && path[len-1]!=(WCHAR)'\\')
211 { path[len] = (WCHAR)'\\';
212 path[len+1]= 0x00;
213 return path+len+1;
214 }
215 return path+len;
216}
217LPVOID WIN32API PathAddBackslashAW(LPVOID path)
218{
219 if(VERSION_OsIsUnicode())
220 return PathAddBackslashW( (LPWSTR)path );
221 else
222 return PathAddBackslashA( (LPTSTR)path );
223}
224
225
226/*************************************************************************
227 * PathRemoveBlanks [SHELL32.33]
228 *
229 * NOTES
230 * remove spaces from beginning and end of passed string
231 */
232LPSTR WIN32API PathRemoveBlanksA(LPSTR str)
233{ LPSTR x = str;
234 dprintf(("SHELL32: %s\n",str));
235 while (*x==' ') x++;
236 if (x!=str)
237 strcpy(str,x);
238 if (!*str)
239 return str;
240 x=str+strlen(str)-1;
241 while (*x==' ')
242 x--;
243 if (*x==' ')
244 *x='\0';
245 return x;
246}
247LPWSTR WIN32API PathRemoveBlanksW(LPWSTR str)
248{ LPWSTR x = str;
249 dprintf(("SHELL32: %s\n",debugstr_w(str)));
250 while (*x==' ') x++;
251 if (x!=str)
252 lstrcpyW(str,x);
253 if (!*str)
254 return str;
255 x=str+lstrlenW(str)-1;
256 while (*x==' ')
257 x--;
258 if (*x==' ')
259 *x='\0';
260 return x;
261}
262
263LPVOID WIN32API PathRemoveBlanksAW(LPVOID str)
264{
265 if(VERSION_OsIsUnicode())
266 return PathRemoveBlanksW( (LPWSTR)str );
267 else
268 return PathRemoveBlanksA( (LPTSTR)str );
269}
270
271
272
273/*************************************************************************
274 * PathFindFilename [SHELL32.34]
275 *
276 * NOTES
277 * basename(char *fn);
278 */
279LPCSTR WIN32API PathFindFilenameA(LPCSTR aptr)
280{ LPCSTR aslash;
281 aslash = aptr;
282
283 dprintf(("SHELL32: %s\n",aslash));
284 while (aptr[0])
285 { if (((aptr[0]=='\\') || (aptr[0]==':')) && aptr[1] && aptr[1]!='\\')
286 aslash = aptr+1;
287 aptr++;
288 }
289 return aslash;
290
291}
292LPCWSTR WIN32API PathFindFilenameW(LPCWSTR wptr)
293{ LPCWSTR wslash;
294 wslash = wptr;
295
296 dprintf(("SHELL32: L%s\n",debugstr_w(wslash)));
297 while (wptr[0])
298 { if (((wptr[0]=='\\') || (wptr[0]==':')) && wptr[1] && wptr[1]!='\\')
299 wslash = wptr+1;
300 wptr++;
301 }
302 return wslash;
303}
304LPCVOID WIN32API PathFindFilenameAW(LPCVOID fn)
305{
306 if(VERSION_OsIsUnicode())
307 return PathFindFilenameW( (LPCWSTR)fn );
308 else
309 return PathFindFilenameA( (LPCTSTR)fn );
310}
311
312/*************************************************************************
313 * PathRemoveFileSpec [SHELL32.35]
314 *
315 * NOTES
316 * bool getpath(char *pathname); truncates passed argument to a valid path
317 * returns if the string was modified or not.
318 * "\foo\xx\foo"-> "\foo\xx"
319 * "\" -> "\"
320 * "a:\foo" -> "a:\"
321 */
322DWORD WIN32API PathRemoveFileSpecA(LPSTR fn)
323{
324 LPSTR x,cutplace;
325 dprintf(("SHELL32: %s\n",fn));
326 if (!fn[0])
327 return 0;
328 x=fn;
329 cutplace = fn;
330 while (*x) {
331 if (*x=='\\') {
332 cutplace=x++;
333 continue;
334 }
335 if (*x==':') {
336 x++;
337 if (*x=='\\')
338 cutplace=++x;
339 continue; /* already x++ed */
340 }
341 x++;
342 }
343 if (!*cutplace)
344 return 0;
345 if (cutplace==fn) {
346 if (fn[0]=='\\') {
347 if (!fn[1])
348 return 0;
349 fn[0]='\0';
350 return 1;
351 }
352 }
353 *cutplace='\0';
354 return 1;
355}
356
357/*************************************************************************
358 * PathAppend [SHELL32.36]
359 *
360 * NOTES
361 * concat_paths(char*target,const char*add);
362 * concats "target\\add" and writes them to target
363 */
364LPSTR WIN32API PathAppendA(LPSTR x1,LPSTR x2)
365{
366 dprintf(("SHELL32: %s %s\n",x1,x2));
367 while (x2[0]=='\\') x2++;
368 return PathCombineA(x1,x1,x2);
369}
370
371/*************************************************************************
372 * PathCombine [SHELL32.37]
373 *
374 * NOTES
375 * if lpszFile='.' skip it
376 * szDest can be equal to lpszFile. Thats why we use sTemp
377 */
378LPSTR WIN32API PathCombineA(LPSTR szDest, LPCSTR lpszDir, LPCSTR lpszFile)
379{ char sTemp[MAX_PATH];
380 dprintf(("SHELL32: %p %p->%s %p->%s\n",szDest, lpszDir, lpszDir, lpszFile, lpszFile));
381
382
383 if (!lpszFile || !lpszFile[0] || (lpszFile[0]=='.' && !lpszFile[1]) )
384 { strcpy(szDest,lpszDir);
385 return szDest;
386 }
387
388 /* if lpszFile is a complete path don't care about lpszDir */
389 if (PathIsRootA(lpszFile))
390 { strcpy(szDest,lpszFile);
391 }
392 else
393 { strcpy(sTemp,lpszDir);
394 PathAddBackslashA(sTemp);
395 strcat(sTemp,lpszFile);
396 strcpy(szDest,sTemp);
397 }
398 return szDest;
399}
400LPWSTR WIN32API PathCombineW(LPWSTR szDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
401{ WCHAR sTemp[MAX_PATH];
402 dprintf(("SHELL32: %p %p->%s %p->%s\n",szDest, lpszDir, debugstr_w(lpszDir),
403 lpszFile, debugstr_w(lpszFile)));
404
405
406 if (!lpszFile || !lpszFile[0] || (lpszFile[0]==(WCHAR)'.' && !lpszFile[1]) )
407 { lstrcpyW(szDest,lpszDir);
408 return szDest;
409 }
410
411 /* if lpszFile is a complete path don't care about lpszDir */
412 if (PathIsRootW(lpszFile))
413 { lstrcpyW(szDest,lpszFile);
414 }
415 else
416 { lstrcpyW(sTemp,lpszDir);
417 PathAddBackslashW(sTemp);
418 lstrcatW(sTemp,lpszFile);
419 lstrcpyW(szDest,sTemp);
420 }
421 return szDest;
422}
423LPVOID WIN32API PathCombineAW(LPVOID szDest, LPCVOID lpszDir, LPCVOID lpszFile)
424{
425 if (VERSION_OsIsUnicode())
426 return PathCombineW( (LPWSTR)szDest,
427 (LPWSTR)lpszDir,
428 (LPWSTR)lpszFile );
429 else
430 return PathCombineA( (LPTSTR)szDest,
431 (LPTSTR)lpszDir,
432 (LPTSTR)lpszFile );
433}
434
435/*************************************************************************
436 * PathIsUNC [SHELL32.39]
437 *
438 * NOTES
439 * PathIsUNC(char*path);
440 */
441BOOL WIN32API PathIsUNCA(LPCSTR path)
442{ dprintf(("SHELL32: %s\n",path));
443
444 if ((path[0]=='\\') && (path[1]=='\\'))
445 return TRUE;
446 return FALSE;
447}
448BOOL WIN32API PathIsUNCW(LPCWSTR path)
449{ dprintf(("SHELL32: %s\n",debugstr_w(path)));
450
451 if ((path[0]=='\\') && (path[1]=='\\'))
452 return TRUE;
453 return FALSE;
454}
455BOOL WIN32API PathIsUNCAW (LPCVOID path)
456{
457 if (VERSION_OsIsUnicode())
458 return PathIsUNCW( (LPWSTR)path );
459 else
460 return PathIsUNCA( (LPTSTR)path );
461}
462/*************************************************************************
463 * PathIsRelativ [SHELL32.40]
464 *
465 */
466BOOL WIN32API PathIsRelativeA (LPCSTR path)
467{
468 dprintf(("SHELL32: path=%s\n",path));
469
470 if (path && (path[0]!='\\' && path[1]==':'))
471 return TRUE;
472 else
473 return FALSE;
474}
475
476BOOL WIN32API PathIsRelativeW (LPCWSTR path)
477{
478 dprintf(("SHELL32: path=%s\n",debugstr_w(path)));
479
480 if (path && (path[0]!='\\' && path[1]==':'))
481 return TRUE;
482 else
483 return FALSE;
484}
485BOOL WIN32API PathIsRelativeAW (LPCVOID path)
486{
487 if (VERSION_OsIsUnicode())
488 return PathIsRelativeW( (LPWSTR)path );
489 else
490 return PathIsRelativeA( (LPTSTR)path );
491}
492
493/*************************************************************************
494 * PathIsExe [SHELL32.43]
495 *
496 */
497BOOL WIN32API PathIsExeA (LPCSTR path)
498{ dprintf(("SHELL32: path=%s\n",path));
499 return FALSE;
500}
501BOOL WIN32API PathIsExeW (LPCWSTR path)
502{ dprintf(("SHELL32: path=%s\n",debugstr_w(path)));
503 return FALSE;
504}
505
506BOOL WIN32API PathIsExeAW (LPCVOID path)
507{
508 if (VERSION_OsIsUnicode())
509 return PathIsExeW ((LPWSTR)path);
510 else
511 return PathIsExeA ((LPTSTR)path);
512}
513
514/*************************************************************************
515 * PathFileExists [SHELL32.45]
516 *
517 * NOTES
518 * file_exists(char *fn);
519 */
520BOOL WIN32API PathFileExistsA(LPSTR fn)
521{
522 dprintf(("SHELL32: %s\n",fn));
523
524 if (GetFileAttributesA(fn)==-1)
525 return FALSE;
526 else
527 return TRUE;
528}
529
530BOOL WIN32API PathFileExistsW(LPWSTR fn)
531{
532 dprintf(("SHELL32: %08xh\n",fn));
533
534 if (GetFileAttributesW(fn)==-1)
535 return FALSE;
536 else
537 return TRUE;
538}
539
540BOOL WIN32API PathFileExistsAW (LPCVOID fn)
541{
542 if (VERSION_OsIsUnicode())
543 return PathFileExistsW ((LPWSTR)fn);
544 else
545 return PathFileExistsA ((LPTSTR)fn);
546}
547
548
549/*************************************************************************
550 * PathMatchSpec [SHELL32.46]
551 *
552 * NOTES
553 * used from COMDLG32
554 */
555
556BOOL WIN32API PathMatchSpecA(LPCSTR name, LPCSTR mask)
557{ LPCSTR _name;
558
559 dprintf(("SHELL32: %s %s stub\n",name,mask));
560
561 _name = name;
562 while (*_name && *mask)
563 { if (*mask ==';')
564 { mask++;
565 _name = name;
566 }
567 else if (*mask == '*')
568 { mask++;
569 while (*mask == '*') mask++; /* Skip consecutive '*' */
570 if (!*mask || *mask==';') return TRUE; /* '*' matches everything */
571 while (*_name && (toupper(*_name) != toupper(*mask))) _name++;
572 if (!*_name)
573 { while ( *mask && *mask != ';') mask++;
574 _name = name;
575 }
576 }
577 else if ( (*mask == '?') || (toupper(*mask) == toupper(*_name)) )
578 { mask++;
579 _name++;
580 }
581 else
582 { while ( *mask && *mask != ';') mask++;
583 }
584 }
585 return (!*_name && (!*mask || *mask==';'));
586}
587BOOL WIN32API PathMatchSpecW(LPCWSTR name, LPCWSTR mask)
588{ WCHAR stemp[4];
589 LPCWSTR _name;
590
591 dprintf(("SHELL32: %s %s stub\n",debugstr_w(name),debugstr_w(mask)));
592
593 lstrcpyAtoW(stemp,"*.*");
594 if (!lstrcmpW( mask, stemp )) return 1;
595
596 _name = name;
597 while (*_name && *mask)
598 { if (*mask ==';')
599 { mask++;
600 _name = name;
601 }
602 else if (*mask == '*')
603 { mask++;
604 while (*mask == '*') mask++; /* Skip consecutive '*' */
605 if (!*mask || *mask==';') return TRUE; /* '*' matches everything */
606 while (*_name && (towupper(*_name) != towupper(*mask))) _name++;
607 if (!*_name)
608 { while ( *mask && *mask != ';') mask++;
609 _name = name;
610 }
611 }
612 else if ( (*mask == '?') || (towupper(*mask) == towupper(*_name)) )
613 { mask++;
614 _name++;
615 }
616 else
617 { while ( *mask && *mask != ';') mask++;
618 }
619 }
620 return (!*_name && (!*mask || *mask==';'));
621}
622BOOL WIN32API PathMatchSpecAW(LPVOID name, LPVOID mask)
623{
624 if (VERSION_OsIsUnicode())
625 return PathMatchSpecW( (LPCWSTR)name,
626 (LPCWSTR)mask );
627 else
628 return PathMatchSpecA( (LPCTSTR)name,
629 (LPCTSTR)mask );
630}
631/*************************************************************************
632 * PathSetDlgItemPathAW [SHELL32.48]
633 * NOTES
634 * use PathCompactPath to make sure, the path fits into the control
635 */
636
637BOOL WIN32API PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR pszPath)
638{ dprintf(("SHELL32: %x %x %s\n",hDlg, id, pszPath));
639 return SetDlgItemTextA(hDlg, id, pszPath);
640}
641BOOL WIN32API PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR pszPath)
642{ dprintf(("SHELL32: %x %x %s\n",hDlg, id, debugstr_w(pszPath)));
643 return SetDlgItemTextW(hDlg, id, pszPath);
644}
645BOOL WIN32API PathSetDlgItemPathAW(HWND hDlg, int id, LPCVOID pszPath)
646{
647 if (VERSION_OsIsUnicode())
648 return PathSetDlgItemPathW(hDlg,
649 id,
650 (LPCWSTR)pszPath);
651 else
652 return PathSetDlgItemPathA(hDlg,
653 id,
654 (LPCTSTR)pszPath);
655}
656
657/*************************************************************************
658 * PathQualifyAW [SHELL32.49]
659 */
660
661BOOL WIN32API PathQualifyA(LPCSTR pszPath)
662{ dprintf(("SHELL32: %s\n",pszPath));
663 return 0;
664}
665BOOL WIN32API PathQualifyW(LPCWSTR pszPath)
666{ dprintf(("SHELL32: %s\n",debugstr_w(pszPath)));
667 return 0;
668}
669BOOL WIN32API PathQualifyAW(LPCVOID pszPath)
670{
671 if (VERSION_OsIsUnicode())
672 return PathQualifyW((LPWSTR)pszPath);
673 else
674 return PathQualifyA((LPTSTR)pszPath);
675}
676
677/*************************************************************************
678 * PathResolve [SHELL32.51]
679 */
680DWORD WIN32API PathResolve(LPCSTR s,DWORD x2,DWORD x3) {
681 dprintf(("SHELL32: (%s,0x%08lx,0x%08lx),stub!\n",s,x2,x3));
682 return 0;
683}
684
685/*************************************************************************
686 * PathGetArgs [SHELL32.52]
687 *
688 * NOTES
689 * look for next arg in string. handle "quoted" strings
690 * returns pointer to argument *AFTER* the space. Or to the \0.
691 */
692LPCSTR WIN32API PathGetArgsA(LPCSTR cmdline)
693{ BOOL qflag = FALSE;
694
695 dprintf(("SHELL32: %s\n",cmdline));
696
697 while (*cmdline)
698 { if ((*cmdline==' ') && !qflag)
699 return cmdline+1;
700 if (*cmdline=='"')
701 qflag=!qflag;
702 cmdline++;
703 }
704 return cmdline;
705
706}
707LPCWSTR WIN32API PathGetArgsW(LPCWSTR cmdline)
708{ BOOL qflag = FALSE;
709
710 dprintf(("SHELL32: %sL\n",debugstr_w(cmdline)));
711
712 while (*cmdline)
713 { if ((*cmdline==' ') && !qflag)
714 return cmdline+1;
715 if (*cmdline=='"')
716 qflag=!qflag;
717 cmdline++;
718 }
719 return cmdline;
720}
721LPCVOID WIN32API PathGetArgsAW(LPVOID cmdline)
722{
723 if (VERSION_OsIsUnicode())
724 return PathGetArgsW((LPCWSTR)cmdline);
725 else
726 return PathGetArgsA((LPCTSTR)cmdline);
727}
728
729/*************************************************************************
730 * PathQuoteSpaces [SHELL32.55]
731 *
732 * NOTES
733 * basename(char *fn);
734 */
735LPSTR WIN32API PathQuoteSpacesA(LPCSTR aptr)
736{ dprintf(("SHELL32: %s\n",aptr));
737 return 0;
738
739}
740LPWSTR WIN32API PathQuoteSpacesW(LPCWSTR wptr)
741{ dprintf(("SHELL32: L%s\n",debugstr_w(wptr)));
742 return 0;
743}
744LPVOID WIN32API PathQuoteSpacesAW (LPCVOID fn)
745{
746 if(VERSION_OsIsUnicode())
747 return PathQuoteSpacesW((LPCWSTR)fn);
748 else
749 return PathQuoteSpacesA((LPCTSTR)fn);
750}
751
752
753/*************************************************************************
754 * PathUnquoteSpaces [SHELL32.56]
755 *
756 * NOTES
757 * unquote string (remove ")
758 */
759VOID WIN32API PathUnquoteSpacesA(LPSTR str)
760{ DWORD len = lstrlenA(str);
761 dprintf(("SHELL32: %s\n",str));
762 if (*str!='"')
763 return;
764 if (str[len-1]!='"')
765 return;
766 str[len-1]='\0';
767 lstrcpyA(str,str+1);
768 return;
769}
770VOID WIN32API PathUnquoteSpacesW(LPWSTR str)
771{ DWORD len = lstrlenW(str);
772
773 dprintf(("SHELL32: %s\n",debugstr_w(str)));
774
775 if (*str!='"')
776 return;
777 if (str[len-1]!='"')
778 return;
779 str[len-1]='\0';
780 lstrcpyW(str,str+1);
781 return;
782}
783VOID WIN32API PathUnquoteSpacesAW(LPVOID str)
784{
785 if(VERSION_OsIsUnicode())
786 PathUnquoteSpacesW((LPWSTR)str);
787 else
788 PathUnquoteSpacesA((LPTSTR)str);
789}
790
791
792/*************************************************************************
793 * PathGetDriveNumber32 [SHELL32.57]
794 *
795 */
796HRESULT WIN32API PathGetDriveNumber(LPSTR u)
797{ dprintf(("SHELL32: %s stub\n",debugstr_a(u)));
798 return 0;
799}
800
801/*************************************************************************
802 * PathYetAnotherMakeUniqueName [SHELL32.75]
803 *
804 * NOTES
805 * exported by ordinal
806 */
807BOOL WIN32API PathYetAnotherMakeUniqueNameA(LPDWORD x,LPDWORD y) {
808 dprintf(("SHELL32: (%p,%p):stub.\n",x,y));
809 return TRUE;
810}
811
812/*************************************************************************
813 * IsLFNDrive [SHELL32.119]
814 *
815 * NOTES
816 * exported by ordinal Name
817 */
818BOOL WIN32API IsLFNDriveA(LPCSTR path) {
819 DWORD fnlen;
820
821 if (!GetVolumeInformationA(path,NULL,0,NULL,&fnlen,NULL,NULL,0))
822 return FALSE;
823 return fnlen>12;
824}
825/*************************************************************************
826 * PathFindOnPath [SHELL32.145]
827 */
828BOOL WIN32API PathFindOnPathA(LPSTR sFile, LPCSTR sOtherDirs)
829{ dprintf(("SHELL32: %s %s\n",sFile, sOtherDirs));
830 return FALSE;
831}
832BOOL WIN32API PathFindOnPathW(LPWSTR sFile, LPCWSTR sOtherDirs)
833{ dprintf(("SHELL32: %s %s\n",debugstr_w(sFile), debugstr_w(sOtherDirs)));
834 return FALSE;
835}
836BOOL WIN32API PathFindOnPathAW(LPVOID sFile, LPCVOID sOtherDirs)
837{
838 if (VERSION_OsIsUnicode())
839 return PathFindOnPathW((LPWSTR)sFile,
840 (LPWSTR)sOtherDirs);
841 else
842 return PathFindOnPathA((LPTSTR)sFile,
843 (LPTSTR)sOtherDirs);
844}
845
846/*************************************************************************
847 * PathGetExtension [SHELL32.158]
848 *
849 * NOTES
850 * exported by ordinal
851 */
852LPCSTR WIN32API PathGetExtensionA(LPCSTR path,DWORD y,DWORD z)
853{ dprintf(("SHELL32: (%s,%08lx,%08lx)\n",path,y,z));
854 path = PathFindExtensionA(path);
855 return *path?(path+1):path;
856}
857LPCWSTR WIN32API PathGetExtensionW(LPCWSTR path,DWORD y,DWORD z)
858{ dprintf(("SHELL32: (L%s,%08lx,%08lx)\n",debugstr_w(path),y,z));
859 path = PathFindExtensionW(path);
860 return *path?(path+1):path;
861}
862LPCVOID WIN32API PathGetExtensionAW(LPCVOID path,DWORD y,DWORD z)
863{
864 if (VERSION_OsIsUnicode())
865 return PathGetExtensionW((LPCWSTR)path,y,z);
866 else
867 return PathGetExtensionA((LPCTSTR)path,y,z);
868}
869
870/*************************************************************************
871 * SheGetDirW [SHELL32.281]
872 *
873 */
874HRESULT WIN32API SheGetDirW(LPWSTR u, LPWSTR v)
875{ dprintf(("SHELL32: %p %p stub\n",u,v));
876 return 0;
877}
878
879/*************************************************************************
880 * SheChangeDirW [SHELL32.274]
881 *
882 */
883HRESULT WIN32API SheChangeDirW(LPWSTR u)
884{ dprintf(("SHELL32: (%s),stub\n",debugstr_w(u)));
885 return 0;
886}
887
888/*************************************************************************
889* PathProcessCommand [SHELL32.653]
890*/
891HRESULT WIN32API PathProcessCommand (DWORD u, DWORD v, DWORD w, DWORD x)
892{ dprintf(("SHELL32: 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w,x));
893 return 0;
894}
895
896/*************************************************************************
897 * SHGetSpecialFolderPath [SHELL32.175]
898 *
899 * converts csidl to path
900 *
901 */
902BOOL WIN32API SHGetSpecialFolderPathA (DWORD x1,LPSTR szPath,DWORD csidl,DWORD x4)
903{ LPITEMIDLIST pidl;
904
905 dprintf(("SHELL32: (0x%04lx,%p,csidl=%lu,0x%04lx) semi-stub\n", x1,szPath,csidl,x4));
906
907 SHGetSpecialFolderLocation(0, csidl, &pidl);
908 SHGetPathFromIDListA (pidl, szPath);
909 SHFree (pidl);
910 return TRUE;
911}
912BOOL WIN32API SHGetSpecialFolderPathW (DWORD x1,LPWSTR szPath, DWORD csidl,DWORD x4)
913{ LPITEMIDLIST pidl;
914
915 dprintf(("SHELL32: (0x%04lx,%p,csidl=%lu,0x%04lx) semi-stub\n", x1,szPath,csidl,x4));
916
917 SHGetSpecialFolderLocation(0, csidl, &pidl);
918 SHGetPathFromIDListW (pidl, szPath);
919 SHFree (pidl);
920 return TRUE;
921}
922BOOL WIN32API SHGetSpecialFolderPath (DWORD x1,LPVOID szPath,DWORD csidl,DWORD x4)
923{
924 if (VERSION_OsIsUnicode())
925 return SHGetSpecialFolderPathW ( x1, (LPWSTR)szPath, csidl, x4);
926 else
927 return SHGetSpecialFolderPathA ( x1, (LPTSTR)szPath, csidl, x4);
928}
929
Note: See TracBrowser for help on using the repository browser.