1 | /* $Id: shellpath.c,v 1.1 2000-08-24 12:01:42 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 SHELL32 for OS/2
|
---|
5 | *
|
---|
6 | * Copyright 1997 Marcus Meissner
|
---|
7 | * Copyright 1999 Patrick Haller (haller@zebra.fh-weingarten.de)
|
---|
8 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
9 | *
|
---|
10 | * Path Functions
|
---|
11 | *
|
---|
12 | * NOTE: SHGetSpecialFolderPathA: StartMenu changed in 'Start Menu'
|
---|
13 | * Odin changes in #ifdef __WIN32OS2__ statements!
|
---|
14 | *
|
---|
15 | * Many of this functions are in SHLWAPI.DLL also
|
---|
16 | *
|
---|
17 | * Corel WINE 20000324 level (without CRTDLL_* calls)
|
---|
18 | */
|
---|
19 |
|
---|
20 |
|
---|
21 | /*****************************************************************************
|
---|
22 | * Includes *
|
---|
23 | *****************************************************************************/
|
---|
24 |
|
---|
25 | #include <odin.h>
|
---|
26 | #include <odinwrap.h>
|
---|
27 | #include <os2sel.h>
|
---|
28 |
|
---|
29 | #include <string.h>
|
---|
30 | #include <ctype.h>
|
---|
31 | #include <wctype.h>
|
---|
32 | #define HAVE_WCTYPE_H
|
---|
33 | #include <odin.h>
|
---|
34 |
|
---|
35 | #define ICOM_CINTERFACE 1
|
---|
36 | #define CINTERFACE 1
|
---|
37 |
|
---|
38 | #include "debugtools.h"
|
---|
39 | #include "winnls.h"
|
---|
40 | #include "winversion.h"
|
---|
41 | #include "winreg.h"
|
---|
42 | #include "crtdll.h"
|
---|
43 |
|
---|
44 | #include "shlobj.h"
|
---|
45 | #include "shell32_main.h"
|
---|
46 | #include <shlwapi.h>
|
---|
47 | #include <wine/undocshell.h>
|
---|
48 |
|
---|
49 | #include <heapstring.h>
|
---|
50 | #include <misc.h>
|
---|
51 |
|
---|
52 |
|
---|
53 | ODINDEBUGCHANNEL(SHELL32-SHELLPATH)
|
---|
54 |
|
---|
55 |
|
---|
56 | #define isSlash(x) ((x)=='\\' || (x)=='/')
|
---|
57 | /*
|
---|
58 | ########## Combining and Constructing paths ##########
|
---|
59 | */
|
---|
60 |
|
---|
61 | /*************************************************************************
|
---|
62 | * PathAppendAW [SHELL32.36]
|
---|
63 | */
|
---|
64 | BOOL WINAPI PathAppendAW(
|
---|
65 | LPVOID lpszPath1,
|
---|
66 | LPCVOID lpszPath2)
|
---|
67 | {
|
---|
68 | if (SHELL_OsIsUnicode())
|
---|
69 | return PathAppendW(lpszPath1, lpszPath2);
|
---|
70 | return PathAppendA(lpszPath1, lpszPath2);
|
---|
71 | }
|
---|
72 |
|
---|
73 | /*************************************************************************
|
---|
74 | * PathCombineAW [SHELL32.37]
|
---|
75 | */
|
---|
76 | LPVOID WINAPI PathCombineAW(
|
---|
77 | LPVOID szDest,
|
---|
78 | LPCVOID lpszDir,
|
---|
79 | LPCVOID lpszFile)
|
---|
80 | {
|
---|
81 | if (SHELL_OsIsUnicode())
|
---|
82 | return PathCombineW( szDest, lpszDir, lpszFile );
|
---|
83 | return PathCombineA( szDest, lpszDir, lpszFile );
|
---|
84 | }
|
---|
85 |
|
---|
86 | /*************************************************************************
|
---|
87 | * PathAddBackslashAW [SHELL32.32]
|
---|
88 | */
|
---|
89 | LPVOID WINAPI PathAddBackslashAW(LPVOID lpszPath)
|
---|
90 | {
|
---|
91 | if(SHELL_OsIsUnicode())
|
---|
92 | return PathAddBackslashW(lpszPath);
|
---|
93 | return PathAddBackslashA(lpszPath);
|
---|
94 | }
|
---|
95 |
|
---|
96 | /*************************************************************************
|
---|
97 | * PathBuildRootAW [SHELL32.30]
|
---|
98 | */
|
---|
99 | LPVOID WINAPI PathBuildRootAW(LPVOID lpszPath, int drive)
|
---|
100 | {
|
---|
101 | if(SHELL_OsIsUnicode())
|
---|
102 | return PathBuildRootW(lpszPath, drive);
|
---|
103 | return PathBuildRootA(lpszPath, drive);
|
---|
104 | }
|
---|
105 |
|
---|
106 | /*
|
---|
107 | Extracting Component Parts
|
---|
108 | */
|
---|
109 |
|
---|
110 | /*************************************************************************
|
---|
111 | * PathFindFileNameAW [SHELL32.34]
|
---|
112 | */
|
---|
113 | LPVOID WINAPI PathFindFileNameAW(LPCVOID lpszPath)
|
---|
114 | {
|
---|
115 | if(SHELL_OsIsUnicode())
|
---|
116 | return PathFindFileNameW(lpszPath);
|
---|
117 | return PathFindFileNameA(lpszPath);
|
---|
118 | }
|
---|
119 |
|
---|
120 | /*************************************************************************
|
---|
121 | * PathFindExtensionAW [SHELL32.31]
|
---|
122 | */
|
---|
123 | LPVOID WINAPI PathFindExtensionAW(LPCVOID lpszPath)
|
---|
124 | {
|
---|
125 | if (SHELL_OsIsUnicode())
|
---|
126 | return PathFindExtensionW(lpszPath);
|
---|
127 | return PathFindExtensionA(lpszPath);
|
---|
128 |
|
---|
129 | }
|
---|
130 |
|
---|
131 | /*************************************************************************
|
---|
132 | * PathGetExtensionA [internal]
|
---|
133 | *
|
---|
134 | * NOTES
|
---|
135 | * exported by ordinal
|
---|
136 | * return value points to the first char after the dot
|
---|
137 | */
|
---|
138 | static LPSTR PathGetExtensionA(LPCSTR lpszPath)
|
---|
139 | {
|
---|
140 | TRACE("(%s)\n",lpszPath);
|
---|
141 |
|
---|
142 | lpszPath = PathFindExtensionA(lpszPath);
|
---|
143 | return (LPSTR)(*lpszPath?(lpszPath+1):lpszPath);
|
---|
144 | }
|
---|
145 |
|
---|
146 | /*************************************************************************
|
---|
147 | * PathGetExtensionW [internal]
|
---|
148 | */
|
---|
149 | static LPWSTR PathGetExtensionW(LPCWSTR lpszPath)
|
---|
150 | {
|
---|
151 | TRACE("(%s)\n",debugstr_w(lpszPath));
|
---|
152 |
|
---|
153 | lpszPath = PathFindExtensionW(lpszPath);
|
---|
154 | return (LPWSTR)(*lpszPath?(lpszPath+1):lpszPath);
|
---|
155 | }
|
---|
156 |
|
---|
157 | /*************************************************************************
|
---|
158 | * PathGetExtensionAW [SHELL32.158]
|
---|
159 | */
|
---|
160 | LPVOID WINAPI PathGetExtensionAW(LPCVOID lpszPath)
|
---|
161 | {
|
---|
162 | if (SHELL_OsIsUnicode())
|
---|
163 | return PathGetExtensionW(lpszPath);
|
---|
164 | return PathGetExtensionA(lpszPath);
|
---|
165 | }
|
---|
166 |
|
---|
167 | /*************************************************************************
|
---|
168 | * PathGetArgsAW [SHELL32.52]
|
---|
169 | */
|
---|
170 | LPVOID WINAPI PathGetArgsAW(LPVOID lpszPath)
|
---|
171 | {
|
---|
172 | if (SHELL_OsIsUnicode())
|
---|
173 | return PathGetArgsW(lpszPath);
|
---|
174 | return PathGetArgsA(lpszPath);
|
---|
175 | }
|
---|
176 |
|
---|
177 | /*************************************************************************
|
---|
178 | * PathGetDriveNumber [SHELL32.57]
|
---|
179 | */
|
---|
180 | int WINAPI PathGetDriveNumberAW(LPVOID lpszPath)
|
---|
181 | {
|
---|
182 | if (SHELL_OsIsUnicode())
|
---|
183 | return PathGetDriveNumberW(lpszPath);
|
---|
184 | return PathGetDriveNumberA(lpszPath);
|
---|
185 | }
|
---|
186 |
|
---|
187 | /*************************************************************************
|
---|
188 | * PathRemoveFileSpec [SHELL32.35]
|
---|
189 | */
|
---|
190 | BOOL WINAPI PathRemoveFileSpecAW(LPVOID lpszPath)
|
---|
191 | {
|
---|
192 | if (SHELL_OsIsUnicode())
|
---|
193 | return PathRemoveFileSpecW(lpszPath);
|
---|
194 | return PathRemoveFileSpecA(lpszPath);
|
---|
195 | }
|
---|
196 |
|
---|
197 | /*************************************************************************
|
---|
198 | * PathStripPathAW [SHELL32.38]
|
---|
199 | */
|
---|
200 | void WINAPI PathStripPathAW(LPVOID lpszPath)
|
---|
201 | {
|
---|
202 | if (SHELL_OsIsUnicode())
|
---|
203 | return PathStripPathW(lpszPath);
|
---|
204 | return PathStripPathA(lpszPath);
|
---|
205 | }
|
---|
206 |
|
---|
207 | /*************************************************************************
|
---|
208 | * PathStripToRootAW [SHELL32.50]
|
---|
209 | */
|
---|
210 | BOOL WINAPI PathStripToRootAW(LPVOID lpszPath)
|
---|
211 | {
|
---|
212 | if (SHELL_OsIsUnicode())
|
---|
213 | return PathStripToRootW(lpszPath);
|
---|
214 | return PathStripToRootA(lpszPath);
|
---|
215 | }
|
---|
216 |
|
---|
217 | /*************************************************************************
|
---|
218 | * PathRemoveArgsAW [SHELL32.251]
|
---|
219 | */
|
---|
220 | void WINAPI PathRemoveArgsAW(LPVOID lpszPath)
|
---|
221 | {
|
---|
222 | if (SHELL_OsIsUnicode())
|
---|
223 | PathRemoveArgsW(lpszPath);
|
---|
224 | PathRemoveArgsA(lpszPath);
|
---|
225 | }
|
---|
226 |
|
---|
227 | /*************************************************************************
|
---|
228 | * PathRemoveExtensionAW [SHELL32.250]
|
---|
229 | */
|
---|
230 | void WINAPI PathRemoveExtensionAW(LPVOID lpszPath)
|
---|
231 | {
|
---|
232 | if (SHELL_OsIsUnicode())
|
---|
233 | return PathRemoveExtensionW(lpszPath);
|
---|
234 | return PathRemoveExtensionA(lpszPath);
|
---|
235 | }
|
---|
236 |
|
---|
237 |
|
---|
238 | /*
|
---|
239 | Path Manipulations
|
---|
240 | */
|
---|
241 |
|
---|
242 | /*************************************************************************
|
---|
243 | * PathGetShortPathA [internal]
|
---|
244 | */
|
---|
245 | LPSTR WINAPI PathGetShortPathA(LPSTR lpszPath)
|
---|
246 | {
|
---|
247 | FIXME("%s stub\n", lpszPath);
|
---|
248 | return NULL;
|
---|
249 | }
|
---|
250 |
|
---|
251 | /*************************************************************************
|
---|
252 | * PathGetShortPathW [internal]
|
---|
253 | */
|
---|
254 | LPWSTR WINAPI PathGetShortPathW(LPWSTR lpszPath)
|
---|
255 | {
|
---|
256 | FIXME("%s stub\n", debugstr_w(lpszPath));
|
---|
257 | return NULL;
|
---|
258 | }
|
---|
259 |
|
---|
260 | /*************************************************************************
|
---|
261 | * PathGetShortPathAW [SHELL32.92]
|
---|
262 | */
|
---|
263 | LPVOID WINAPI PathGetShortPathAW(LPVOID lpszPath)
|
---|
264 | {
|
---|
265 | if(SHELL_OsIsUnicode())
|
---|
266 | return PathGetShortPathW(lpszPath);
|
---|
267 | return PathGetShortPathA(lpszPath);
|
---|
268 | }
|
---|
269 |
|
---|
270 | /*************************************************************************
|
---|
271 | * PathRemoveBlanksAW [SHELL32.33]
|
---|
272 | */
|
---|
273 | void WINAPI PathRemoveBlanksAW(LPVOID str)
|
---|
274 | {
|
---|
275 | if(SHELL_OsIsUnicode())
|
---|
276 | PathRemoveBlanksW(str);
|
---|
277 | PathRemoveBlanksA(str);
|
---|
278 | }
|
---|
279 |
|
---|
280 | /*************************************************************************
|
---|
281 | * PathQuoteSpacesAW [SHELL32.55]
|
---|
282 | */
|
---|
283 | LPVOID WINAPI PathQuoteSpacesAW (LPVOID lpszPath)
|
---|
284 | {
|
---|
285 | if(SHELL_OsIsUnicode())
|
---|
286 | return PathQuoteSpacesW(lpszPath);
|
---|
287 | return PathQuoteSpacesA(lpszPath);
|
---|
288 | }
|
---|
289 |
|
---|
290 | /*************************************************************************
|
---|
291 | * PathUnquoteSpacesAW [SHELL32.56]
|
---|
292 | */
|
---|
293 | VOID WINAPI PathUnquoteSpacesAW(LPVOID str)
|
---|
294 | {
|
---|
295 | if(SHELL_OsIsUnicode())
|
---|
296 | PathUnquoteSpacesW(str);
|
---|
297 | else
|
---|
298 | PathUnquoteSpacesA(str);
|
---|
299 | }
|
---|
300 |
|
---|
301 | /*************************************************************************
|
---|
302 | * PathParseIconLocationAW [SHELL32.249]
|
---|
303 | */
|
---|
304 | int WINAPI PathParseIconLocationAW (LPVOID lpszPath)
|
---|
305 | {
|
---|
306 | if(SHELL_OsIsUnicode())
|
---|
307 | return PathParseIconLocationW(lpszPath);
|
---|
308 | return PathParseIconLocationA(lpszPath);
|
---|
309 | }
|
---|
310 |
|
---|
311 | /*
|
---|
312 | ########## Path Testing ##########
|
---|
313 | */
|
---|
314 | /*************************************************************************
|
---|
315 | * PathIsUNCAW [SHELL32.39]
|
---|
316 | */
|
---|
317 | BOOL WINAPI PathIsUNCAW (LPCVOID lpszPath)
|
---|
318 | {
|
---|
319 | if (SHELL_OsIsUnicode())
|
---|
320 | return PathIsUNCW( lpszPath );
|
---|
321 | return PathIsUNCA( lpszPath );
|
---|
322 | }
|
---|
323 |
|
---|
324 | /*************************************************************************
|
---|
325 | * PathIsRelativeAW [SHELL32.40]
|
---|
326 | */
|
---|
327 | BOOL WINAPI PathIsRelativeAW (LPCVOID lpszPath)
|
---|
328 | {
|
---|
329 | if (SHELL_OsIsUnicode())
|
---|
330 | return PathIsRelativeW( lpszPath );
|
---|
331 | return PathIsRelativeA( lpszPath );
|
---|
332 | }
|
---|
333 |
|
---|
334 | /*************************************************************************
|
---|
335 | * PathIsRootAW [SHELL32.29]
|
---|
336 | */
|
---|
337 | BOOL WINAPI PathIsRootAW(LPCVOID lpszPath)
|
---|
338 | {
|
---|
339 | if (SHELL_OsIsUnicode())
|
---|
340 | return PathIsRootW(lpszPath);
|
---|
341 | return PathIsRootA(lpszPath);
|
---|
342 | }
|
---|
343 |
|
---|
344 | /*************************************************************************
|
---|
345 | * PathIsExeA [internal]
|
---|
346 | */
|
---|
347 | static BOOL PathIsExeA (LPCSTR lpszPath)
|
---|
348 | {
|
---|
349 | LPCSTR lpszExtension = PathGetExtensionA(lpszPath);
|
---|
350 | int i = 0;
|
---|
351 | static char * lpszExtensions[6] = {"exe", "com", "pid", "cmd", "bat", NULL };
|
---|
352 |
|
---|
353 | TRACE("path=%s\n",lpszPath);
|
---|
354 |
|
---|
355 | for(i=0; lpszExtensions[i]; i++)
|
---|
356 | if (!strcasecmp(lpszExtension,lpszExtensions[i])) return TRUE;
|
---|
357 |
|
---|
358 | return FALSE;
|
---|
359 | }
|
---|
360 |
|
---|
361 | /*************************************************************************
|
---|
362 | * PathIsExeW [internal]
|
---|
363 | */
|
---|
364 | static BOOL PathIsExeW (LPCWSTR lpszPath)
|
---|
365 | {
|
---|
366 | LPCWSTR lpszExtension = PathGetExtensionW(lpszPath);
|
---|
367 | int i = 0;
|
---|
368 | static WCHAR lpszExtensions[6][4] =
|
---|
369 | {{'e','x','e','\0'}, {'c','o','m','\0'}, {'p','i','d','\0'},
|
---|
370 | {'c','m','d','\0'}, {'b','a','t','\0'}, {'\0'} };
|
---|
371 |
|
---|
372 | TRACE("path=%s\n",debugstr_w(lpszPath));
|
---|
373 |
|
---|
374 | for(i=0; lpszExtensions[i]; i++)
|
---|
375 | if (!strcmpiW(lpszExtension,lpszExtensions[i])) return TRUE;
|
---|
376 |
|
---|
377 | return FALSE;
|
---|
378 | }
|
---|
379 |
|
---|
380 | /*************************************************************************
|
---|
381 | * PathIsExeAW [SHELL32.43]
|
---|
382 | */
|
---|
383 | BOOL WINAPI PathIsExeAW (LPCVOID path)
|
---|
384 | {
|
---|
385 | if (SHELL_OsIsUnicode())
|
---|
386 | return PathIsExeW (path);
|
---|
387 | return PathIsExeA(path);
|
---|
388 | }
|
---|
389 |
|
---|
390 | /*************************************************************************
|
---|
391 | * PathIsDirectoryAW [SHELL32.159]
|
---|
392 | */
|
---|
393 | BOOL WINAPI PathIsDirectoryAW (LPCVOID lpszPath)
|
---|
394 | {
|
---|
395 | if (SHELL_OsIsUnicode())
|
---|
396 | return PathIsDirectoryW (lpszPath);
|
---|
397 | return PathIsDirectoryA (lpszPath);
|
---|
398 | }
|
---|
399 |
|
---|
400 | /*************************************************************************
|
---|
401 | * PathFileExistsAW [SHELL32.45]
|
---|
402 | */
|
---|
403 | BOOL WINAPI PathFileExistsAW (LPCVOID lpszPath)
|
---|
404 | {
|
---|
405 | if (SHELL_OsIsUnicode())
|
---|
406 | return PathFileExistsW (lpszPath);
|
---|
407 | return PathFileExistsA (lpszPath);
|
---|
408 | }
|
---|
409 |
|
---|
410 | /*************************************************************************
|
---|
411 | * PathMatchSpecAW [SHELL32.46]
|
---|
412 | */
|
---|
413 | BOOL WINAPI PathMatchSpecAW(LPVOID name, LPVOID mask)
|
---|
414 | {
|
---|
415 | if (SHELL_OsIsUnicode())
|
---|
416 | return PathMatchSpecW( name, mask );
|
---|
417 | return PathMatchSpecA( name, mask );
|
---|
418 | }
|
---|
419 |
|
---|
420 | /*************************************************************************
|
---|
421 | * PathIsSameRootAW [SHELL32.650]
|
---|
422 | */
|
---|
423 | BOOL WINAPI PathIsSameRootAW(LPCVOID lpszPath1, LPCVOID lpszPath2)
|
---|
424 | {
|
---|
425 | if (SHELL_OsIsUnicode())
|
---|
426 | return PathIsSameRootW(lpszPath1, lpszPath2);
|
---|
427 | return PathIsSameRootA(lpszPath1, lpszPath2);
|
---|
428 | }
|
---|
429 |
|
---|
430 | /*************************************************************************
|
---|
431 | * IsLFNDriveA [SHELL32.119]
|
---|
432 | *
|
---|
433 | * NOTES
|
---|
434 | * exported by ordinal Name
|
---|
435 | */
|
---|
436 | BOOL WINAPI IsLFNDriveA(LPCSTR lpszPath)
|
---|
437 | {
|
---|
438 | DWORD fnlen;
|
---|
439 |
|
---|
440 | if (!GetVolumeInformationA(lpszPath,NULL,0,NULL,&fnlen,NULL,NULL,0))
|
---|
441 | return FALSE;
|
---|
442 | return fnlen>12;
|
---|
443 | }
|
---|
444 |
|
---|
445 | /*
|
---|
446 | ########## Creating Something Unique ##########
|
---|
447 | */
|
---|
448 | /*************************************************************************
|
---|
449 | * PathMakeUniqueNameA [internal]
|
---|
450 | */
|
---|
451 | BOOL WINAPI PathMakeUniqueNameA(
|
---|
452 | LPSTR lpszBuffer,
|
---|
453 | DWORD dwBuffSize,
|
---|
454 | LPCSTR lpszShortName,
|
---|
455 | LPCSTR lpszLongName,
|
---|
456 | LPCSTR lpszPathName)
|
---|
457 | {
|
---|
458 | FIXME("%p %lu %s %s %s stub\n",
|
---|
459 | lpszBuffer, dwBuffSize, debugstr_a(lpszShortName),
|
---|
460 | debugstr_a(lpszLongName), debugstr_a(lpszPathName));
|
---|
461 | return TRUE;
|
---|
462 | }
|
---|
463 |
|
---|
464 | /*************************************************************************
|
---|
465 | * PathMakeUniqueNameW [internal]
|
---|
466 | */
|
---|
467 | BOOL WINAPI PathMakeUniqueNameW(
|
---|
468 | LPWSTR lpszBuffer,
|
---|
469 | DWORD dwBuffSize,
|
---|
470 | LPCWSTR lpszShortName,
|
---|
471 | LPCWSTR lpszLongName,
|
---|
472 | LPCWSTR lpszPathName)
|
---|
473 | {
|
---|
474 | FIXME("%p %lu %s %s %s stub\n",
|
---|
475 | lpszBuffer, dwBuffSize, debugstr_w(lpszShortName),
|
---|
476 | debugstr_w(lpszLongName), debugstr_w(lpszPathName));
|
---|
477 | return TRUE;
|
---|
478 | }
|
---|
479 |
|
---|
480 | /*************************************************************************
|
---|
481 | * PathMakeUniqueNameAW [SHELL32.47]
|
---|
482 | */
|
---|
483 | BOOL WINAPI PathMakeUniqueNameAW(
|
---|
484 | LPVOID lpszBuffer,
|
---|
485 | DWORD dwBuffSize,
|
---|
486 | LPCVOID lpszShortName,
|
---|
487 | LPCVOID lpszLongName,
|
---|
488 | LPCVOID lpszPathName)
|
---|
489 | {
|
---|
490 | if (SHELL_OsIsUnicode())
|
---|
491 | return PathMakeUniqueNameW(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName);
|
---|
492 | return PathMakeUniqueNameA(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName);
|
---|
493 | }
|
---|
494 |
|
---|
495 | /*************************************************************************
|
---|
496 | * PathYetAnotherMakeUniqueNameA [SHELL32.75]
|
---|
497 | *
|
---|
498 | * NOTES
|
---|
499 | * exported by ordinal
|
---|
500 | */
|
---|
501 | BOOL WINAPI PathYetAnotherMakeUniqueNameA(
|
---|
502 | LPSTR lpszBuffer,
|
---|
503 | LPCSTR lpszPathName,
|
---|
504 | LPCSTR lpszShortName,
|
---|
505 | LPCSTR lpszLongName)
|
---|
506 | {
|
---|
507 | FIXME("(%p,%p, %p ,%p):stub.\n",
|
---|
508 | lpszBuffer, lpszPathName, lpszShortName, lpszLongName);
|
---|
509 | return TRUE;
|
---|
510 | }
|
---|
511 |
|
---|
512 | /*************************************************************************
|
---|
513 | * PathYetAnotherMakeUniqueNameA [SHELL32.75]
|
---|
514 | *
|
---|
515 | * NOTES
|
---|
516 | * exported by ordinal
|
---|
517 | */
|
---|
518 | BOOL WINAPI PathYetAnotherMakeUniqueNameW(
|
---|
519 | LPWSTR lpszBuffer,
|
---|
520 | LPCWSTR lpszPathName,
|
---|
521 | LPCWSTR lpszShortName,
|
---|
522 | LPCWSTR lpszLongName)
|
---|
523 | {
|
---|
524 | FIXME("(%p,%p, %p ,%p):stub.\n",
|
---|
525 | lpszBuffer, lpszPathName, lpszShortName, lpszLongName);
|
---|
526 | return TRUE;
|
---|
527 | }
|
---|
528 |
|
---|
529 | BOOL WINAPI PathYetAnotherMakeUniqueNameAW(
|
---|
530 | LPSTR lpszBuffer,
|
---|
531 | LPCSTR lpszPathName,
|
---|
532 | LPCSTR lpszShortName,
|
---|
533 | LPCSTR lpszLongName)
|
---|
534 | {
|
---|
535 | if (SHELL_OsIsUnicode())
|
---|
536 | return PathYetAnotherMakeUniqueNameW((LPWSTR)lpszBuffer,(LPCWSTR)lpszPathName, (LPCWSTR)lpszShortName,(LPCWSTR)lpszLongName);
|
---|
537 | return PathYetAnotherMakeUniqueNameA(lpszBuffer, lpszPathName, lpszShortName,lpszLongName);
|
---|
538 | }
|
---|
539 |
|
---|
540 |
|
---|
541 | /*
|
---|
542 | ########## cleaning and resolving paths ##########
|
---|
543 | */
|
---|
544 |
|
---|
545 | /*************************************************************************
|
---|
546 | * PathFindOnPathAW [SHELL32]
|
---|
547 | */
|
---|
548 | BOOL WINAPI PathFindOnPathAW(LPVOID sFile, LPCVOID sOtherDirs)
|
---|
549 | {
|
---|
550 | if (SHELL_OsIsUnicode())
|
---|
551 | return PathFindOnPathW(sFile, sOtherDirs);
|
---|
552 | return PathFindOnPathA(sFile, sOtherDirs);
|
---|
553 | }
|
---|
554 |
|
---|
555 | /*************************************************************************
|
---|
556 | * PathCleanupSpecA [SHELL32.171]
|
---|
557 | */
|
---|
558 | DWORD WINAPI PathCleanupSpecA(LPSTR x, LPSTR y)
|
---|
559 | {
|
---|
560 | FIXME("(%p %s, %p %s) stub\n",x,debugstr_a(x),y,debugstr_a(y));
|
---|
561 | return TRUE;
|
---|
562 | }
|
---|
563 |
|
---|
564 | /*************************************************************************
|
---|
565 | * PathCleanupSpecA [SHELL32]
|
---|
566 | */
|
---|
567 | DWORD WINAPI PathCleanupSpecW(LPWSTR x, LPWSTR y)
|
---|
568 | {
|
---|
569 | FIXME("(%p %s, %p %s) stub\n",x,debugstr_w(x),y,debugstr_w(y));
|
---|
570 | return TRUE;
|
---|
571 | }
|
---|
572 |
|
---|
573 | /*************************************************************************
|
---|
574 | * PathCleanupSpecAW [SHELL32]
|
---|
575 | */
|
---|
576 | DWORD WINAPI PathCleanupSpecAW (LPVOID x, LPVOID y)
|
---|
577 | {
|
---|
578 | if (VERSION_OsIsUnicode())
|
---|
579 | return PathCleanupSpecW(x,y);
|
---|
580 | return PathCleanupSpecA(x,y);
|
---|
581 | }
|
---|
582 |
|
---|
583 | /*************************************************************************
|
---|
584 | * PathQualifyA [SHELL32]
|
---|
585 | */
|
---|
586 | BOOL WINAPI PathQualifyA(LPCSTR pszPath)
|
---|
587 | {
|
---|
588 | FIXME("%s\n",pszPath);
|
---|
589 | return 0;
|
---|
590 | }
|
---|
591 |
|
---|
592 | /*************************************************************************
|
---|
593 | * PathQualifyW [SHELL32]
|
---|
594 | */
|
---|
595 | BOOL WINAPI PathQualifyW(LPCWSTR pszPath)
|
---|
596 | {
|
---|
597 | FIXME("%s\n",debugstr_w(pszPath));
|
---|
598 | return 0;
|
---|
599 | }
|
---|
600 |
|
---|
601 | /*************************************************************************
|
---|
602 | * PathQualifyAW [SHELL32]
|
---|
603 | */
|
---|
604 | BOOL WINAPI PathQualifyAW(LPCVOID pszPath)
|
---|
605 | {
|
---|
606 | if (SHELL_OsIsUnicode())
|
---|
607 | return PathQualifyW(pszPath);
|
---|
608 | return PathQualifyA(pszPath);
|
---|
609 | }
|
---|
610 |
|
---|
611 | /*************************************************************************
|
---|
612 | * PathResolveA [SHELL32.51]
|
---|
613 | */
|
---|
614 | BOOL WINAPI PathResolveA(
|
---|
615 | LPSTR lpszPath,
|
---|
616 | LPCSTR *alpszPaths,
|
---|
617 | DWORD dwFlags)
|
---|
618 | {
|
---|
619 | FIXME("(%s,%p,0x%08lx),stub!\n",
|
---|
620 | lpszPath, *alpszPaths, dwFlags);
|
---|
621 | return 0;
|
---|
622 | }
|
---|
623 |
|
---|
624 | /*************************************************************************
|
---|
625 | * PathResolveW [SHELL32]
|
---|
626 | */
|
---|
627 | BOOL WINAPI PathResolveW(
|
---|
628 | LPWSTR lpszPath,
|
---|
629 | LPCWSTR *alpszPaths,
|
---|
630 | DWORD dwFlags)
|
---|
631 | {
|
---|
632 | FIXME("(%s,%p,0x%08lx),stub!\n",
|
---|
633 | debugstr_w(lpszPath), debugstr_w(*alpszPaths), dwFlags);
|
---|
634 | return 0;
|
---|
635 | }
|
---|
636 |
|
---|
637 | /*************************************************************************
|
---|
638 | * PathResolveAW [SHELL32]
|
---|
639 | */
|
---|
640 | BOOL WINAPI PathResolveAW(
|
---|
641 | LPVOID lpszPath,
|
---|
642 | LPCVOID *alpszPaths,
|
---|
643 | DWORD dwFlags)
|
---|
644 | {
|
---|
645 | if (SHELL_OsIsUnicode())
|
---|
646 | return PathResolveW(lpszPath, (LPCWSTR*)alpszPaths, dwFlags);
|
---|
647 | return PathResolveA(lpszPath, (LPCSTR*)alpszPaths, dwFlags);
|
---|
648 | }
|
---|
649 |
|
---|
650 | /*************************************************************************
|
---|
651 | * PathProcessCommandA [SHELL32.653]
|
---|
652 | */
|
---|
653 | HRESULT WINAPI PathProcessCommandA (
|
---|
654 | LPCSTR lpszPath,
|
---|
655 | LPSTR lpszBuff,
|
---|
656 | DWORD dwBuffSize,
|
---|
657 | DWORD dwFlags)
|
---|
658 | {
|
---|
659 | FIXME("%s %p 0x%04lx 0x%04lx stub\n",
|
---|
660 | lpszPath, lpszBuff, dwBuffSize, dwFlags);
|
---|
661 | strcpy(lpszBuff, lpszPath);
|
---|
662 | return 0;
|
---|
663 | }
|
---|
664 |
|
---|
665 | /*************************************************************************
|
---|
666 | * PathProcessCommandW
|
---|
667 | */
|
---|
668 | HRESULT WINAPI PathProcessCommandW (
|
---|
669 | LPCWSTR lpszPath,
|
---|
670 | LPWSTR lpszBuff,
|
---|
671 | DWORD dwBuffSize,
|
---|
672 | DWORD dwFlags)
|
---|
673 | {
|
---|
674 | FIXME("(%s, %p, 0x%04lx, 0x%04lx) stub\n",
|
---|
675 | debugstr_w(lpszPath), lpszBuff, dwBuffSize, dwFlags);
|
---|
676 | lstrcpyW(lpszBuff, lpszPath);
|
---|
677 | return 0;
|
---|
678 | }
|
---|
679 |
|
---|
680 | /*************************************************************************
|
---|
681 | * PathProcessCommandAW
|
---|
682 | */
|
---|
683 | HRESULT WINAPI PathProcessCommandAW (
|
---|
684 | LPCVOID lpszPath,
|
---|
685 | LPVOID lpszBuff,
|
---|
686 | DWORD dwBuffSize,
|
---|
687 | DWORD dwFlags)
|
---|
688 | {
|
---|
689 | if (SHELL_OsIsUnicode())
|
---|
690 | return PathProcessCommandW(lpszPath, lpszBuff, dwBuffSize, dwFlags);
|
---|
691 | return PathProcessCommandA(lpszPath, lpszBuff, dwBuffSize, dwFlags);
|
---|
692 | }
|
---|
693 |
|
---|
694 | /*
|
---|
695 | ########## special ##########
|
---|
696 | */
|
---|
697 |
|
---|
698 | /*************************************************************************
|
---|
699 | * PathSetDlgItemPathAW
|
---|
700 | */
|
---|
701 | BOOL WINAPI PathSetDlgItemPathAW(HWND hDlg, int id, LPCVOID pszPath)
|
---|
702 | { if (SHELL_OsIsUnicode())
|
---|
703 | return PathSetDlgItemPathW(hDlg, id, pszPath);
|
---|
704 | return PathSetDlgItemPathA(hDlg, id, pszPath);
|
---|
705 | }
|
---|
706 |
|
---|
707 | /*************************************************************************
|
---|
708 | * SHGetSpecialFolderPathA [SHELL32.175]
|
---|
709 | *
|
---|
710 | * converts csidl to path
|
---|
711 | */
|
---|
712 |
|
---|
713 | static char * szSHFolders = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
|
---|
714 | static char * szSHUserFolders = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders";
|
---|
715 | #if 0
|
---|
716 | static char * szEnvUserProfile = "%USERPROFILE%";
|
---|
717 | static char * szEnvSystemRoot = "%SYSTEMROOT%";
|
---|
718 | #endif
|
---|
719 |
|
---|
720 | BOOL WINAPI SHGetSpecialFolderPathA (
|
---|
721 | HWND hwndOwner,
|
---|
722 | LPSTR szPath,
|
---|
723 | DWORD csidl,
|
---|
724 | BOOL bCreate)
|
---|
725 | {
|
---|
726 | CHAR szValueName[MAX_PATH], szDefaultPath[MAX_PATH];
|
---|
727 | HKEY hRootKey, hKey;
|
---|
728 | BOOL bRelative = TRUE;
|
---|
729 | DWORD dwType, dwDisp, dwPathLen = MAX_PATH;
|
---|
730 |
|
---|
731 | TRACE("0x%04x,%p,csidl=%lu,0x%04x\n", hwndOwner,szPath,csidl,bCreate);
|
---|
732 |
|
---|
733 | /* build default values */
|
---|
734 | switch(csidl)
|
---|
735 | {
|
---|
736 | case CSIDL_APPDATA:
|
---|
737 | hRootKey = HKEY_CURRENT_USER;
|
---|
738 | strcpy (szValueName, "AppData");
|
---|
739 | strcpy (szDefaultPath, "AppData");
|
---|
740 | break;
|
---|
741 |
|
---|
742 | case CSIDL_COOKIES:
|
---|
743 | hRootKey = HKEY_CURRENT_USER;
|
---|
744 | strcpy (szValueName, "Cookies");
|
---|
745 | strcpy(szDefaultPath, "Cookies");
|
---|
746 | break;
|
---|
747 |
|
---|
748 | case CSIDL_DESKTOPDIRECTORY:
|
---|
749 | hRootKey = HKEY_CURRENT_USER;
|
---|
750 | strcpy(szValueName, "Desktop");
|
---|
751 | strcpy(szDefaultPath, "Desktop");
|
---|
752 | break;
|
---|
753 |
|
---|
754 | case CSIDL_COMMON_DESKTOPDIRECTORY:
|
---|
755 | hRootKey = HKEY_LOCAL_MACHINE;
|
---|
756 | strcpy(szValueName, "Common Desktop");
|
---|
757 | strcpy(szDefaultPath, "Desktop");
|
---|
758 | break;
|
---|
759 |
|
---|
760 | case CSIDL_FAVORITES:
|
---|
761 | hRootKey = HKEY_CURRENT_USER;
|
---|
762 | strcpy(szValueName, "Favorites");
|
---|
763 | strcpy(szDefaultPath, "Favorites");
|
---|
764 | break;
|
---|
765 |
|
---|
766 | case CSIDL_FONTS:
|
---|
767 | hRootKey = HKEY_CURRENT_USER;
|
---|
768 | strcpy(szValueName, "Fonts");
|
---|
769 | strcpy(szDefaultPath, "Fonts");
|
---|
770 | break;
|
---|
771 |
|
---|
772 | case CSIDL_HISTORY:
|
---|
773 | hRootKey = HKEY_CURRENT_USER;
|
---|
774 | strcpy(szValueName, "History");
|
---|
775 | strcpy(szDefaultPath, "History");
|
---|
776 | break;
|
---|
777 |
|
---|
778 | case CSIDL_NETHOOD:
|
---|
779 | hRootKey = HKEY_CURRENT_USER;
|
---|
780 | strcpy(szValueName, "NetHood");
|
---|
781 | strcpy(szDefaultPath, "NetHood");
|
---|
782 | break;
|
---|
783 |
|
---|
784 | case CSIDL_INTERNET_CACHE:
|
---|
785 | hRootKey = HKEY_CURRENT_USER;
|
---|
786 | strcpy(szValueName, "Cache");
|
---|
787 | strcpy(szDefaultPath, "Temporary Internet Files");
|
---|
788 | break;
|
---|
789 |
|
---|
790 | case CSIDL_PERSONAL:
|
---|
791 | hRootKey = HKEY_CURRENT_USER;
|
---|
792 | strcpy(szValueName, "Personal");
|
---|
793 | strcpy(szDefaultPath, "My Own Files");
|
---|
794 | bRelative = FALSE;
|
---|
795 | break;
|
---|
796 |
|
---|
797 | case CSIDL_PRINTHOOD:
|
---|
798 | hRootKey = HKEY_CURRENT_USER;
|
---|
799 | strcpy(szValueName, "PrintHood");
|
---|
800 | strcpy(szDefaultPath, "PrintHood");
|
---|
801 | break;
|
---|
802 |
|
---|
803 | case CSIDL_PROGRAMS:
|
---|
804 | hRootKey = HKEY_CURRENT_USER;
|
---|
805 | strcpy(szValueName, "Programs");
|
---|
806 | strcpy(szDefaultPath, "Start Menu\\Programs");
|
---|
807 | break;
|
---|
808 |
|
---|
809 | case CSIDL_COMMON_PROGRAMS:
|
---|
810 | hRootKey = HKEY_LOCAL_MACHINE;
|
---|
811 | strcpy(szValueName, "Common Programs");
|
---|
812 | strcpy(szDefaultPath, "");
|
---|
813 | break;
|
---|
814 |
|
---|
815 | case CSIDL_RECENT:
|
---|
816 | hRootKey = HKEY_CURRENT_USER;
|
---|
817 | strcpy(szValueName, "Recent");
|
---|
818 | strcpy(szDefaultPath, "Recent");
|
---|
819 | break;
|
---|
820 |
|
---|
821 | case CSIDL_SENDTO:
|
---|
822 | hRootKey = HKEY_CURRENT_USER;
|
---|
823 | strcpy(szValueName, "SendTo");
|
---|
824 | strcpy(szDefaultPath, "SendTo");
|
---|
825 | break;
|
---|
826 |
|
---|
827 | case CSIDL_STARTMENU:
|
---|
828 | hRootKey = HKEY_CURRENT_USER;
|
---|
829 | #ifdef __WIN32OS2__
|
---|
830 | strcpy(szValueName, "Start Menu");
|
---|
831 | strcpy(szDefaultPath, "Start Menu");
|
---|
832 | #else
|
---|
833 | strcpy(szValueName, "StartMenu");
|
---|
834 | strcpy(szDefaultPath, "StartMenu");
|
---|
835 | #endif
|
---|
836 | break;
|
---|
837 |
|
---|
838 | case CSIDL_COMMON_STARTMENU:
|
---|
839 | hRootKey = HKEY_LOCAL_MACHINE;
|
---|
840 | strcpy(szValueName, "Common StartMenu"); //TODO: Start Menu?
|
---|
841 | #ifdef __WIN32OS2__
|
---|
842 | strcpy(szDefaultPath, "StartMenu");
|
---|
843 | #else
|
---|
844 | strcpy(szDefaultPath, "Start Menu");
|
---|
845 | #endif
|
---|
846 | break;
|
---|
847 |
|
---|
848 | case CSIDL_STARTUP:
|
---|
849 | hRootKey = HKEY_CURRENT_USER;
|
---|
850 | strcpy(szValueName, "Startup");
|
---|
851 | strcpy(szDefaultPath, "StartMenu\\Programs\\Startup");
|
---|
852 | break;
|
---|
853 |
|
---|
854 | case CSIDL_COMMON_STARTUP:
|
---|
855 | hRootKey = HKEY_LOCAL_MACHINE;
|
---|
856 | strcpy(szValueName, "Common Startup");
|
---|
857 | strcpy(szDefaultPath, "StartMenu\\Programs\\Startup");
|
---|
858 | break;
|
---|
859 |
|
---|
860 | case CSIDL_TEMPLATES:
|
---|
861 | hRootKey = HKEY_CURRENT_USER;
|
---|
862 | strcpy(szValueName, "Templates");
|
---|
863 | strcpy(szDefaultPath, "ShellNew");
|
---|
864 | break;
|
---|
865 |
|
---|
866 | default:
|
---|
867 | ERR("folder unknown or not allowed\n");
|
---|
868 | return FALSE;
|
---|
869 | }
|
---|
870 |
|
---|
871 | /* user shell folders */
|
---|
872 | if (RegCreateKeyExA(hRootKey,szSHUserFolders,0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,&dwDisp)) return FALSE;
|
---|
873 |
|
---|
874 | if (RegQueryValueExA(hKey,szValueName,NULL,&dwType,(LPBYTE)szPath,&dwPathLen))
|
---|
875 | {
|
---|
876 | RegCloseKey(hKey);
|
---|
877 |
|
---|
878 | /* shell folders */
|
---|
879 | if (RegCreateKeyExA(hRootKey,szSHFolders,0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,&dwDisp)) return FALSE;
|
---|
880 |
|
---|
881 | if (RegQueryValueExA(hKey,szValueName,NULL,&dwType,(LPBYTE)szPath,&dwPathLen))
|
---|
882 | {
|
---|
883 |
|
---|
884 | /* value not existing */
|
---|
885 | if (bRelative)
|
---|
886 | {
|
---|
887 | GetWindowsDirectoryA(szPath, MAX_PATH);
|
---|
888 | PathAddBackslashA(szPath);
|
---|
889 | strcat(szPath, szDefaultPath);
|
---|
890 | }
|
---|
891 | else
|
---|
892 | {
|
---|
893 | strcpy(szPath, "C:\\"); /* fixme ??? */
|
---|
894 | strcat(szPath, szDefaultPath);
|
---|
895 | }
|
---|
896 | RegSetValueExA(hKey,szValueName,0,REG_SZ,(LPBYTE)szPath,strlen(szPath)+1);
|
---|
897 | }
|
---|
898 | }
|
---|
899 | RegCloseKey(hKey);
|
---|
900 |
|
---|
901 | /* expand paths like %USERPROFILE% */
|
---|
902 | if (dwType == REG_EXPAND_SZ)
|
---|
903 | {
|
---|
904 | ExpandEnvironmentStringsA(szPath, szDefaultPath, MAX_PATH);
|
---|
905 | strcpy(szPath, szDefaultPath);
|
---|
906 | }
|
---|
907 |
|
---|
908 | /* if we don't care about existing directorys we are ready */
|
---|
909 | if(csidl & CSIDL_FLAG_DONT_VERIFY) return TRUE;
|
---|
910 |
|
---|
911 | if (PathFileExistsA(szPath)) return TRUE;
|
---|
912 |
|
---|
913 | /* not existing but we not allowed to create it */
|
---|
914 | if (!bCreate) return FALSE;
|
---|
915 |
|
---|
916 | if (!CreateDirectoryA(szPath,NULL))
|
---|
917 | {
|
---|
918 | ERR("Failed to create directory '%s'.\n", szPath);
|
---|
919 | return FALSE;
|
---|
920 | }
|
---|
921 |
|
---|
922 | MESSAGE("Created not existing system directory '%s'\n", szPath);
|
---|
923 | return TRUE;
|
---|
924 | }
|
---|
925 |
|
---|
926 | /*************************************************************************
|
---|
927 | * SHGetSpecialFolderPathW
|
---|
928 | */
|
---|
929 | BOOL WINAPI SHGetSpecialFolderPathW (
|
---|
930 | HWND hwndOwner,
|
---|
931 | LPWSTR szPath,
|
---|
932 | DWORD csidl,
|
---|
933 | BOOL bCreate)
|
---|
934 | {
|
---|
935 | char szTemp[MAX_PATH];
|
---|
936 |
|
---|
937 | if (SHGetSpecialFolderPathA(hwndOwner, szTemp, csidl, bCreate))
|
---|
938 | {
|
---|
939 | lstrcpynAtoW(szPath, szTemp, MAX_PATH);
|
---|
940 | }
|
---|
941 |
|
---|
942 | TRACE("0x%04x,%p,csidl=%lu,0x%04x\n", hwndOwner,szPath,csidl,bCreate);
|
---|
943 |
|
---|
944 | return TRUE;
|
---|
945 | }
|
---|
946 |
|
---|
947 | /*************************************************************************
|
---|
948 | * SHGetSpecialFolderPathAW
|
---|
949 | */
|
---|
950 | BOOL WINAPI SHGetSpecialFolderPathAW (
|
---|
951 | HWND hwndOwner,
|
---|
952 | LPVOID szPath,
|
---|
953 | DWORD csidl,
|
---|
954 | BOOL bCreate)
|
---|
955 |
|
---|
956 | {
|
---|
957 | if (SHELL_OsIsUnicode())
|
---|
958 | return SHGetSpecialFolderPathW (hwndOwner, szPath, csidl, bCreate);
|
---|
959 | return SHGetSpecialFolderPathA (hwndOwner, szPath, csidl, bCreate);
|
---|
960 | }
|
---|
961 |
|
---|
962 | /*************************************************************************
|
---|
963 | * SHGetFolderPathA [SHFOLDER.@]
|
---|
964 | */
|
---|
965 | HRESULT WINAPI SHGetFolderPathA(
|
---|
966 | HWND hwndOwner,
|
---|
967 | int nFolder,
|
---|
968 | HANDLE hToken, /* FIXME: get paths for specific user */
|
---|
969 | DWORD dwFlags, /* FIXME: SHGFP_TYPE_CURRENT|SHGFP_TYPE_DEFAULT */
|
---|
970 | LPSTR pszPath)
|
---|
971 | {
|
---|
972 | return (SHGetSpecialFolderPathA(
|
---|
973 | hwndOwner,
|
---|
974 | pszPath,
|
---|
975 | CSIDL_FOLDER_MASK & nFolder,
|
---|
976 | CSIDL_FLAG_CREATE & nFolder )) ? S_OK : E_FAIL;
|
---|
977 | }
|
---|
978 |
|
---|
979 | /*************************************************************************
|
---|
980 | * SHGetFolderPathW [SHFOLDER.@]
|
---|
981 | */
|
---|
982 | HRESULT WINAPI SHGetFolderPathW(
|
---|
983 | HWND hwndOwner,
|
---|
984 | int nFolder,
|
---|
985 | HANDLE hToken,
|
---|
986 | DWORD dwFlags,
|
---|
987 | LPWSTR pszPath)
|
---|
988 | {
|
---|
989 | return (SHGetSpecialFolderPathW(
|
---|
990 | hwndOwner,
|
---|
991 | pszPath,
|
---|
992 | CSIDL_FOLDER_MASK & nFolder,
|
---|
993 | CSIDL_FLAG_CREATE & nFolder )) ? S_OK : E_FAIL;
|
---|
994 | }
|
---|