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

Last change on this file since 972 was 972, checked in by sandervl, 26 years ago

Import lstrncmpiA from kernel32

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