OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
shelwapi.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1995, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Implementations of Windows light-weight utility APIs:
7/// TSHReg, TSHPath
8//----------------------------------------------------------------------------
9#include <owl/pch.h>
10#include <owl/defs.h>
11#include <owl/shelwapi.h>
12#include <owl/module.h>
13
14namespace owl {
15
16////////////////////////////////////////////////////////////////////
17//
18// class TSHReg
19// ~~~~~ ~~~~~~
20// delay loading SHLWAPI.DLL
21 static const tchar shellStr[] = _T("SHLWAPI.DLL");
22
23 static const char DuplicateKeyStr[] = "SHRegDuplicateHKey";
24# if defined(UNICODE)
25 static const char DeleteEmptyKeyStr[] = "SHDeleteEmptyKeyW";
26 static const char DeleteKeyStr[] = "SHDeleteKeyW";
27 static const char DeleteValueStr[] = "SHDeleteValueW";
28 static const char GetValueStr[] = "SHGetValueW";
29 static const char SetValueStr[] = "SHSetValueW";
30 static const char QueryValueExStr[] = "SHQueryValueExW";
31 static const char EnumKeyExStr[] = "SHEnumKeyExW";
32 static const char EnumValueStr[] = "SHEnumValueW";
33 static const char QueryInfoKeyStr[] = "SHQueryInfoKeyW";
34 static const char CopyKeyStr[] = "SHCopyKeyW";
35 static const char RegGetPathStr[] = "SHRegGetPathW";
36 static const char RegSetPathStr[] = "SHRegSetPathW";
37# else
38 static const char DeleteEmptyKeyStr[] = "SHDeleteEmptyKeyA";
39 static const char DeleteKeyStr[] = "SHDeleteKeyA";
40 static const char DeleteValueStr[] = "SHDeleteValueA";
41 static const char GetValueStr[] = "SHGetValueA";
42 static const char SetValueStr[] = "SHSetValueA";
43 static const char QueryValueExStr[] = "SHQueryValueExA";
44 static const char EnumKeyExStr[] = "SHEnumKeyExA";
45 static const char EnumValueStr[] = "SHEnumValueA";
46 static const char QueryInfoKeyStr[] = "SHQueryInfoKeyA";
47 static const char CopyKeyStr[] = "SHCopyKeyA";
48 static const char RegGetPathStr[] = "SHRegGetPathA";
49 static const char RegSetPathStr[] = "SHRegSetPathA";
50# endif
51
52
53//
54// Returns TModule object wrapping the handle of the SHLWAPI.DLL module
55//
58{
59 static TModule shellModule(shellStr, true, true, false);
60 return shellModule;
61}
62
63DWORD
64TSHReg::DeleteEmptyKey(HKEY hkey, LPCTSTR pszSubKey)
65{
66 static TModuleProc2<DWORD,HKEY,LPCTSTR>
67 deleteEmptyKey(GetModule(), DeleteEmptyKeyStr);
68 return deleteEmptyKey(hkey,pszSubKey);
69}
70
71DWORD
72TSHReg::DeleteKey(HKEY hkey, LPCTSTR pszSubKey)
73{
74 static TModuleProc2<DWORD,HKEY,LPCTSTR>
75 deleteKey(GetModule(), DeleteKeyStr);
76 return deleteKey(hkey,pszSubKey);
77}
78
79HKEY
81{
82 static TModuleProc1<HKEY,HKEY>
83 duplicateKey(GetModule(), DuplicateKeyStr);
84 return duplicateKey(hkey);
85}
86
87DWORD
88TSHReg::DeleteValue(HKEY hkey, LPCTSTR pszSubKey, LPCTSTR pszValue)
89{
90 static TModuleProc3<DWORD,HKEY,LPCTSTR,LPCTSTR>
91 deleteValue(GetModule(), DeleteValueStr);
92 return deleteValue(hkey, pszSubKey, pszValue);
93}
94
95DWORD
96TSHReg::GetValue(HKEY hkey, LPCTSTR pszSubKey, LPCTSTR pszValue, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
97{
98 static TModuleProc6<DWORD,HKEY,LPCTSTR,LPCTSTR,LPDWORD,LPVOID,LPDWORD>
99 getValue(GetModule(), GetValueStr);
100 return getValue(hkey, pszSubKey, pszValue, pdwType, pvData, pcbData);
101}
102
103DWORD
104TSHReg::SetValue(HKEY hkey, LPCTSTR pszSubKey, LPCTSTR pszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
105{
106 static TModuleProc6<DWORD,HKEY,LPCTSTR,LPCTSTR,DWORD,LPCVOID,DWORD>
107 setValue(GetModule(), SetValueStr);
108 return setValue(hkey, pszSubKey, pszValue, dwType, pvData, cbData);
109}
110
111DWORD
112TSHReg::QueryValueEx(HKEY hkey, LPCTSTR pszValue, LPDWORD pdwReserved, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
113{
114 static TModuleProc6<DWORD,HKEY,LPCTSTR,LPDWORD,LPDWORD,LPVOID,LPDWORD>
115 queryValueEx(GetModule(), QueryValueExStr);
116 return queryValueEx(hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
117}
118
119LONG
120TSHReg::EnumKeyEx(HKEY hkey, DWORD dwIndex, LPTSTR pszName, LPDWORD pcchName)
121{
122 static TModuleProc4<LONG,HKEY,DWORD,LPTSTR,LPDWORD>
123 enumKeyEx(GetModule(), EnumKeyExStr);
124 return enumKeyEx(hkey, dwIndex, pszName, pcchName);
125}
126
127LONG
128TSHReg::EnumValue(HKEY hkey, DWORD dwIndex, LPTSTR pszValueName, LPDWORD pcchValueName, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
129{
130 static TModuleProc7<LONG,HKEY,DWORD,LPTSTR,LPDWORD,LPDWORD,LPVOID,LPDWORD>
131 enumValue(GetModule(), EnumValueStr);
132 return enumValue(hkey, dwIndex, pszValueName, pcchValueName, pdwType, pvData, pcbData);
133}
134
135LONG
136TSHReg::QueryInfoKey(HKEY hkey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen)
137{
138 static TModuleProc5<LONG,HKEY,LPDWORD,LPDWORD,LPDWORD,LPDWORD>
139 queryInfoKey(GetModule(), QueryInfoKeyStr);
140 return queryInfoKey(hkey, pcSubKeys, pcchMaxSubKeyLen, pcValues, pcchMaxValueNameLen);
141}
142
143// recursive key copy
144DWORD
145TSHReg::CopyKey(HKEY hkeySrc, LPCTSTR szSrcSubKey, HKEY hkeyDest, DWORD fReserved)
146{
147 static TModuleProc4<DWORD,HKEY,LPCTSTR,HKEY,DWORD>
148 copyKey(GetModule(), CopyKeyStr);
149 return copyKey(hkeySrc, szSrcSubKey, hkeyDest, fReserved);
150}
151
152// Getting and setting file system paths with environment variables
153DWORD
154TSHReg::RegGetPath(HKEY hkey, LPCTSTR pcszSubKey, LPCTSTR pcszValue, LPTSTR pszPath, DWORD dwFlags)
155{
156 static TModuleProc5<DWORD,HKEY,LPCTSTR,LPCTSTR,LPTSTR,DWORD>
157 regGetPath(GetModule(), RegGetPathStr);
158 return regGetPath(hkey, pcszSubKey, pcszValue, pszPath, dwFlags);
159}
160
161DWORD
162TSHReg::RegSetPath(HKEY hkey, LPCTSTR pcszSubKey, LPCTSTR pcszValue, LPCTSTR pcszPath, DWORD dwFlags)
163{
164 static TModuleProc5<DWORD,HKEY,LPCTSTR,LPCTSTR,LPCTSTR,DWORD>
165 regSetPath(GetModule(), RegSetPathStr);
166 return regSetPath(hkey, pcszSubKey, pcszValue, pcszPath, dwFlags);
167}
168
169////////////////////////////////////////////////////////////////////
170//
171// class TSHPath
172// ~~~~~ ~~~~~~
173
174# if defined(UNICODE)
175 static const char AddBackslashStr[] = "PathAddBackslashW";
176 static const char AddExtensionStr[] = "PathAddExtensionW";
177 static const char AppendStr[] = "PathAppendW";
178 static const char BuildRootStr[] = "PathBuildRootW";
179 static const char CanonicalizeStr[] = "PathCanonicalizeW";
180 static const char CombineStr[] = "PathCombineW";
181 static const char CompactPathStr[] = "PathCompactPathW";
182 static const char CompactPathExStr[] = "PathCompactPathExW";
183 static const char CommonPrefixStr[] = "PathCommonPrefixW";
184 static const char FileExistsStr[] = "PathFileExistsW";
185 static const char FindExtensionStr[] = "PathFindExtensionW";
186 static const char FindFileNameStr[] = "PathFindFileNameW";
187 static const char FindNextComponentStr[] = "PathFindNextComponentW";
188 static const char FindOnPathStr[] = "PathFindOnPathW";
189 static const char GetArgsStr[] = "PathGetArgsW";
190 static const char FindSuffixArrayStr[] = "PathFindSuffixArrayW";
191 static const char IsLFNFileSpecStr[] = "PathIsLFNFileSpecW";
192 static const char GetCharTypeStr[] = "PathGetCharTypeW";
193 static const char GetDriveNumberStr[] = "PathGetDriveNumberW";
194 static const char IsDirectoryStr[] = "PathIsDirectoryW";
195 static const char IsDirectoryEmptyStr[] = "PathIsDirectoryEmptyW";
196 static const char IsFileSpecStr[] = "PathIsFileSpecW";
197 static const char IsPrefixStr[] = "PathIsPrefixW";
198 static const char IsRelativeStr[] = "PathIsRelativeW";
199 static const char IsRootStr[] = "PathIsRootW";
200 static const char IsSameRootStr[] = "PathIsSameRootW";
201 static const char IsUNCStr[] = "PathIsUNCW";
202 static const char IsNetworkPathStr[] = "PathIsNetworkPathW";
203 static const char IsUNCServerStr[] = "PathIsUNCServerW";
204 static const char IsUNCServerShareStr[] = "PathIsUNCServerShareW";
205 static const char IsContentTypeStr[] = "PathIsContentTypeW";
206 static const char IsURLStr[] = "PathIsURLW";
207 static const char MakePrettyStr[] = "PathMakePrettyW";
208 static const char MatchSpecStr[] = "PathMatchSpecW";
209 static const char ParseIconLocationStr[] = "PathParseIconLocationW";
210 static const char QuoteSpacesStr[] = "PathQuoteSpacesW";
211 static const char RelativePathToStr[] = "PathRelativePathToW";
212 static const char RemoveArgsStr[] = "PathRemoveArgsW";
213 static const char RemoveBackslashStr[] = "PathRemoveBackslashW";
214 static const char RemoveBlanksStr[] = "PathRemoveBlanksW";
215 static const char RemoveExtensionStr[] = "PathRemoveExtensionW";
216 static const char RemoveFileSpecStr[] = "PathRemoveFileSpecW";
217 static const char RenameExtensionStr[] = "PathRenameExtensionW";
218 static const char SearchAndQualifyStr[] = "PathSearchAndQualifyW";
219 static const char SetDlgItemPathStr[] = "PathSetDlgItemPathW";
220 static const char SkipRootStr[] = "PathSkipRootW";
221 static const char StripPathStr[] = "PathStripPathW";
222 static const char StripToRootStr[] = "PathStripToRootW";
223 static const char UnquoteSpacesStr[] = "PathUnquoteSpacesW";
224 static const char MakeSystemFolderStr[] = "PathMakeSystemFolderW";
225 static const char UnmakeSystemFolderStr[] = "PathUnmakeSystemFolderW";
226 static const char IsSystemFolderStr[] = "PathIsSystemFolderW";
227 static const char UndecorateStr[] = "PathUndecorateW";
228 static const char UnExpandEnvStringsStr[] = "PathUnExpandEnvStringsW";
229 static const char UnExpandEnvStringsForUserStr[] = "PathUnExpandEnvStringsForUserW";
230# else
231 static const char AddBackslashStr[] = "PathAddBackslashA";
232 static const char AddExtensionStr[] = "PathAddExtensionA";
233 static const char AppendStr[] = "PathAppendA";
234 static const char BuildRootStr[] = "PathBuildRootA";
235 static const char CanonicalizeStr[] = "PathCanonicalizeA";
236 static const char CombineStr[] = "PathCombineA";
237 static const char CompactPathStr[] = "PathCompactPathA";
238 static const char CompactPathExStr[] = "PathCompactPathExA";
239 static const char CommonPrefixStr[] = "PathCommonPrefixA";
240 static const char FileExistsStr[] = "PathFileExistsA";
241 static const char FindExtensionStr[] = "PathFindExtensionA";
242 static const char FindFileNameStr[] = "PathFindFileNameA";
243 static const char FindNextComponentStr[] = "PathFindNextComponentA";
244 static const char FindOnPathStr[] = "PathFindOnPathA";
245 static const char GetArgsStr[] = "PathGetArgsA";
246 static const char FindSuffixArrayStr[] = "PathFindSuffixArrayA";
247 static const char IsLFNFileSpecStr[] = "PathIsLFNFileSpecA";
248 static const char GetCharTypeStr[] = "PathGetCharTypeA";
249 static const char GetDriveNumberStr[] = "PathGetDriveNumberA";
250 static const char IsDirectoryStr[] = "PathIsDirectoryA";
251 static const char IsDirectoryEmptyStr[] = "PathIsDirectoryEmptyA";
252 static const char IsFileSpecStr[] = "PathIsFileSpecA";
253 static const char IsPrefixStr[] = "PathIsPrefixA";
254 static const char IsRelativeStr[] = "PathIsRelativeA";
255 static const char IsRootStr[] = "PathIsRootA";
256 static const char IsSameRootStr[] = "PathIsSameRootA";
257 static const char IsUNCStr[] = "PathIsUNCA";
258 static const char IsNetworkPathStr[] = "PathIsNetworkPathA";
259 static const char IsUNCServerStr[] = "PathIsUNCServerA";
260 static const char IsUNCServerShareStr[] = "PathIsUNCServerShareA";
261 static const char IsContentTypeStr[] = "PathIsContentTypeA";
262 static const char IsURLStr[] = "PathIsURLA";
263 static const char MakePrettyStr[] = "PathMakePrettyA";
264 static const char MatchSpecStr[] = "PathMatchSpecA";
265 static const char ParseIconLocationStr[] = "PathParseIconLocationA";
266 static const char QuoteSpacesStr[] = "PathQuoteSpacesA";
267 static const char RelativePathToStr[] = "PathRelativePathToA";
268 static const char RemoveArgsStr[] = "PathRemoveArgsA";
269 static const char RemoveBackslashStr[] = "PathRemoveBackslashA";
270 static const char RemoveBlanksStr[] = "PathRemoveBlanksA";
271 static const char RemoveExtensionStr[] = "PathRemoveExtensionA";
272 static const char RemoveFileSpecStr[] = "PathRemoveFileSpecA";
273 static const char RenameExtensionStr[] = "PathRenameExtensionA";
274 static const char SearchAndQualifyStr[] = "PathSearchAndQualifyA";
275 static const char SetDlgItemPathStr[] = "PathSetDlgItemPathA";
276 static const char SkipRootStr[] = "PathSkipRootA";
277 static const char StripPathStr[] = "PathStripPathA";
278 static const char StripToRootStr[] = "PathStripToRootA";
279 static const char UnquoteSpacesStr[] = "PathUnquoteSpacesA";
280 static const char MakeSystemFolderStr[] = "PathMakeSystemFolderA";
281 static const char UnmakeSystemFolderStr[] = "PathUnmakeSystemFolderA";
282 static const char IsSystemFolderStr[] = "PathIsSystemFolderA";
283 static const char UndecorateStr[] = "PathUndecorateA";
284 static const char UnExpandEnvStringsStr[] = "PathUnExpandEnvStringsA";
285 static const char UnExpandEnvStringsForUserStr[] = "PathUnExpandEnvStringsForUserA";
286# endif
287
288
289//
290// Returns TModule object wrapping the handle of the SHLWAPI.DLL module
291//
292TModule&
294{
295 static TModule shellModule(shellStr, true, true, false);
296 return shellModule;
297}
298
299LPTSTR
301{
302 static TModuleProc1<LPTSTR,LPTSTR>
303 addBackslash(GetModule(), AddBackslashStr);
304 return addBackslash(pszPath);
305}
306
307BOOL
308TSHPath::AddExtension(LPTSTR pszPath, LPCTSTR pszExt)
309{
310 static TModuleProc2<BOOL,LPTSTR,LPCTSTR>
311 addExtension(GetModule(), AddExtensionStr);
312 return addExtension(pszPath, pszExt);
313}
314
315BOOL
316TSHPath::Append(LPTSTR pszPath, LPCTSTR pszMore)
317{
318 static TModuleProc2<BOOL,LPTSTR,LPCTSTR>
319 append(GetModule(), AppendStr);
320 return append(pszPath, pszMore);
321}
322
323LPTSTR
324TSHPath::BuildRoot(LPTSTR pszRoot, int iDrive)
325{
326 static TModuleProc2<LPTSTR,LPTSTR,int>
327 buildRoot(GetModule(), BuildRootStr);
328 return buildRoot(pszRoot, iDrive);
329}
330
331BOOL
332TSHPath::Canonicalize(LPTSTR pszBuf, LPCTSTR pszPath)
333{
334 static TModuleProc2<BOOL,LPTSTR,LPCTSTR>
335 canonicalize(GetModule(), CanonicalizeStr);
336 return canonicalize(pszBuf, pszPath);
337}
338
339LPTSTR
340TSHPath::Combine(LPTSTR pszDest, LPCTSTR pszDir, LPCTSTR pszFile)
341{
342 static TModuleProc3<LPTSTR,LPTSTR,LPCTSTR,LPCTSTR>
343 combine(GetModule(), CombineStr);
344 return combine(pszDest, pszDir, pszFile);
345}
346
347BOOL
348TSHPath::CompactPath(HDC hDC, LPTSTR pszPath, UINT dx)
349{
350 static TModuleProc3<BOOL,HDC,LPTSTR,UINT>
351 compactPath(GetModule(), CompactPathStr);
352 return compactPath(hDC, pszPath, dx);
353}
354
355BOOL
356TSHPath::CompactPathEx(LPTSTR pszOut, LPCTSTR pszSrc, UINT cchMax, DWORD dwFlags)
357{
358 static TModuleProc4<BOOL,LPTSTR,LPCTSTR,UINT,DWORD>
359 compactPathEx(GetModule(), CompactPathExStr);
360 return compactPathEx(pszOut, pszSrc, cchMax, dwFlags);
361}
362
363int
364TSHPath::CommonPrefix(LPCTSTR pszFile1, LPCTSTR pszFile2, LPTSTR achPath)
365{
366 static TModuleProc3<int,LPCTSTR,LPCTSTR,LPTSTR>
367 commonPrefix(GetModule(), CommonPrefixStr);
368 return commonPrefix(pszFile1, pszFile2, achPath);
369}
370
371BOOL
372TSHPath::FileExists(LPCTSTR pszPath)
373{
374 static TModuleProc1<BOOL,LPCTSTR>
375 fileExists(GetModule(), FileExistsStr);
376 return fileExists(pszPath);
377}
378
379LPTSTR
381{
382 static TModuleProc1<LPTSTR,LPCTSTR>
383 findExtension(GetModule(), FindExtensionStr);
384 return findExtension(pszPath);
385}
386
387LPTSTR
388TSHPath::FindFileName(LPCTSTR pszPath)
389{
390 static TModuleProc1<LPTSTR,LPCTSTR>
391 findFileName(GetModule(), FindFileNameStr);
392 return findFileName(pszPath);
393}
394
395LPTSTR
397{
398 static TModuleProc1<LPTSTR,LPCTSTR>
399 findNextComponent(GetModule(), FindNextComponentStr);
400 return findNextComponent(pszPath);
401}
402
403BOOL
404TSHPath::FindOnPath(LPTSTR pszPath, LPCTSTR * ppszOtherDirs)
405{
406 static TModuleProc2<BOOL,LPTSTR,LPCTSTR*>
407 findOnPath(GetModule(), FindOnPathStr);
408 return findOnPath(pszPath, ppszOtherDirs);
409}
410
411LPTSTR
412TSHPath::GetArgs(LPCTSTR pszPath)
413{
414 static TModuleProc1<LPTSTR,LPCTSTR>
415 getArgs(GetModule(), GetArgsStr);
416 return getArgs(pszPath);
417}
418
419LPCTSTR
420TSHPath::FindSuffixArray(LPCTSTR pszPath, const LPCTSTR *apszSuffix, int iArraySize)
421{
422 static TModuleProc3<LPCTSTR,LPCTSTR,const LPCTSTR *,int>
423 findSuffixArray(GetModule(), FindSuffixArrayStr);
424 return findSuffixArray(pszPath, apszSuffix, iArraySize);
425}
426
427BOOL
429{
430 static TModuleProc1<BOOL,LPCTSTR>
431 isLFNFileSpec(GetModule(), IsLFNFileSpecStr);
432 return isLFNFileSpec(lpName);
433}
434
435UINT
437{
438 static TModuleProc1<UINT,tchar>
439 getCharType(GetModule(), GetCharTypeStr);
440 return getCharType(ch);
441}
442
443int
445{
446 static TModuleProc1<int,LPCTSTR>
447 getDriveNumber(GetModule(), GetDriveNumberStr);
448 return getDriveNumber(pszPath);
449}
450
451BOOL
452TSHPath::IsDirectory(LPCTSTR pszPath)
453{
454 static TModuleProc1<BOOL,LPCTSTR>
455 isDirectory(GetModule(), IsDirectoryStr);
456 return isDirectory(pszPath);
457}
458
459BOOL
461{
462 static TModuleProc1<BOOL,LPCTSTR>
463 isDirectoryEmpty(GetModule(), IsDirectoryEmptyStr);
464 return isDirectoryEmpty(pszPath);
465}
466
467BOOL
468TSHPath::IsFileSpec(LPCTSTR pszPath)
469{
470 static TModuleProc1<BOOL,LPCTSTR>
471 isFileSpec(GetModule(), IsFileSpecStr);
472 return isFileSpec(pszPath);
473}
474
475BOOL
476TSHPath::IsPrefix(LPCTSTR pszPrefix, LPCTSTR pszPath)
477{
478 static TModuleProc2<BOOL,LPCTSTR,LPCTSTR>
479 isPrefix(GetModule(), IsPrefixStr);
480 return isPrefix(pszPrefix, pszPath);
481}
482
483BOOL
484TSHPath::IsRelative(LPCTSTR pszPath)
485{
486 static TModuleProc1<BOOL,LPCTSTR>
487 isRelative(GetModule(), IsRelativeStr);
488 return isRelative(pszPath);
489}
490
491BOOL
492TSHPath::IsRoot(LPCTSTR pszPath)
493{
494 static TModuleProc1<BOOL,LPCTSTR>
495 isRoot(GetModule(), IsRootStr);
496 return isRoot(pszPath);
497}
498
499BOOL
500TSHPath::IsSameRoot(LPCTSTR pszPath1, LPCTSTR pszPath2)
501{
502 static TModuleProc2<BOOL,LPCTSTR,LPCTSTR>
503 isSameRoot(GetModule(), IsSameRootStr);
504 return isSameRoot(pszPath1, pszPath2);
505}
506
507BOOL
508TSHPath::IsUNC(LPCTSTR pszPath)
509{
510 static TModuleProc1<BOOL,LPCTSTR>
511 isUNC(GetModule(), IsUNCStr);
512 return isUNC(pszPath);
513}
514
515BOOL
517{
518 static TModuleProc1<BOOL,LPCTSTR>
519 isNetworkPath(GetModule(), IsNetworkPathStr);
520 return isNetworkPath(pszPath);
521}
522
523BOOL
524TSHPath::IsUNCServer(LPCTSTR pszPath)
525{
526 static TModuleProc1<BOOL,LPCTSTR>
527 isUNCServer(GetModule(), IsUNCServerStr);
528 return isUNCServer(pszPath);
529}
530
531BOOL
533{
534 static TModuleProc1<BOOL,LPCTSTR>
535 isUNCServerShare(GetModule(), IsUNCServerShareStr);
536 return isUNCServerShare(pszPath);
537}
538
539BOOL
540TSHPath::IsContentType(LPCTSTR pszPath, LPCTSTR pszContentType)
541{
542 static TModuleProc2<BOOL,LPCTSTR,LPCTSTR>
543 isContentType(GetModule(), IsContentTypeStr);
544 return isContentType(pszPath,pszContentType);
545}
546
547BOOL
548TSHPath::IsURL(LPCTSTR pszPath)
549{
550 static TModuleProc1<BOOL,LPCTSTR>
551 isURL(GetModule(), IsURLStr);
552 return isURL(pszPath);
553}
554
555BOOL
556TSHPath::MakePretty(LPTSTR pszPath)
557{
558 static TModuleProc1<BOOL,LPTSTR>
559 makePretty(GetModule(), MakePrettyStr);
560 return makePretty(pszPath);
561}
562
563BOOL
564TSHPath::MatchSpec(LPCTSTR pszFile, LPCTSTR pszSpec)
565{
566 static TModuleProc2<BOOL,LPCTSTR,LPCTSTR>
567 matchSpec(GetModule(), MatchSpecStr);
568 return matchSpec(pszFile, pszSpec);
569}
570
571int
572TSHPath::ParseIconLocation(LPTSTR pszIconFile)
573{
574 static TModuleProc1<int,LPTSTR>
575 parseIconLocation(GetModule(), ParseIconLocationStr);
576 return parseIconLocation(pszIconFile);
577}
578
579void
581{
582 static TModuleProcV1<LPTSTR>
583 quoteSpaces(GetModule(), QuoteSpacesStr);
584 quoteSpaces(lpsz);
585}
586
587BOOL
588TSHPath::RelativePathTo(LPTSTR pszPath, LPCTSTR pszFrom, DWORD dwAttrFrom, LPCTSTR pszTo, DWORD dwAttrTo)
589{
590 static TModuleProc5<BOOL,LPTSTR,LPCTSTR,DWORD,LPCTSTR,DWORD>
591 relativePathTo(GetModule(), RelativePathToStr);
592 return relativePathTo(pszPath, pszFrom, dwAttrFrom, pszTo, dwAttrTo);
593}
594
595void
596TSHPath::RemoveArgs(LPTSTR pszPath)
597{
598 static TModuleProcV1<LPTSTR>
599 removeArgs(GetModule(), RemoveArgsStr);
600 removeArgs(pszPath);
601}
602
603LPTSTR
605{
606 static TModuleProc1<LPTSTR,LPTSTR>
607 removeBackslash(GetModule(), RemoveBackslashStr);
608 return removeBackslash(pszPath);
609}
610
611void
613{
614 static TModuleProcV1<LPTSTR>
615 removeBlanks(GetModule(), RemoveBlanksStr);
616 removeBlanks(pszPath);
617}
618
619void
621{
622 static TModuleProcV1<LPTSTR>
623 removeExtension(GetModule(), RemoveExtensionStr);
624 removeExtension(pszPath);
625}
626
627BOOL
629{
630 static TModuleProc1<BOOL,LPTSTR>
631 removeFileSpec(GetModule(), RemoveFileSpecStr);
632 return removeFileSpec(pszPath);
633}
634
635BOOL
636TSHPath::RenameExtension(LPTSTR pszPath, LPCTSTR pszExt)
637{
638 static TModuleProc2<BOOL,LPTSTR,LPCTSTR>
639 renameExtension(GetModule(), RenameExtensionStr);
640 return renameExtension(pszPath, pszExt);
641}
642
643BOOL
644TSHPath::SearchAndQualify(LPCTSTR pszPath, LPTSTR pszBuf, UINT cchBuf)
645{
646 static TModuleProc3<BOOL,LPCTSTR,LPTSTR,UINT>
647 searchAndQualify(GetModule(), SearchAndQualifyStr);
648 return searchAndQualify(pszPath, pszBuf, cchBuf);
649}
650
651void
652TSHPath::SetDlgItemPath(HWND hDlg, int id, LPCTSTR pszPath)
653{
654 static TModuleProcV3<HWND,int,LPCTSTR>
655 setDlgItemPath(GetModule(), SetDlgItemPathStr);
656 setDlgItemPath(hDlg, id, pszPath);
657}
658
659LPTSTR
660TSHPath::SkipRoot(LPCTSTR pszPath)
661{
662 static TModuleProc1<LPTSTR,LPCTSTR>
663 skipRoot(GetModule(), SkipRootStr);
664 return skipRoot(pszPath);
665}
666
667void
668TSHPath::StripPath(LPTSTR pszPath)
669{
670 static TModuleProcV1<LPTSTR>
671 stripPath(GetModule(), StripPathStr);
672 stripPath(pszPath);
673}
674
675BOOL
676TSHPath::StripToRoot(LPTSTR pszPath)
677{
678 static TModuleProc1<BOOL,LPTSTR>
679 stripToRoot(GetModule(), StripToRootStr);
680 return stripToRoot(pszPath);
681}
682
683void
685{
686 static TModuleProcV1<LPTSTR>
687 unquoteSpaces(GetModule(), UnquoteSpacesStr);
688 unquoteSpaces(lpsz);
689}
690
691BOOL
693{
694 static TModuleProc1<BOOL,LPCTSTR>
695 makeSystemFolder(GetModule(), MakeSystemFolderStr);
696 return makeSystemFolder(pszPath);
697}
698
699BOOL
701{
702 static TModuleProc1<BOOL,LPCTSTR>
703 unmakeSystemFolder(GetModule(), UnmakeSystemFolderStr);
704 return unmakeSystemFolder(pszPath);
705}
706
707BOOL
708TSHPath::IsSystemFolder(LPCTSTR pszPath, DWORD dwAttrb)
709{
710 static TModuleProc2<BOOL,LPCTSTR,DWORD>
711 isSystemFolder(GetModule(), IsSystemFolderStr);
712 return isSystemFolder(pszPath,dwAttrb);
713}
714
715void
716TSHPath::Undecorate(LPTSTR pszPath)
717{
718 static TModuleProcV1<LPTSTR>
719 undecorate(GetModule(), UndecorateStr);
720 undecorate(pszPath);
721}
722
723
724BOOL
725TSHPath::UnExpandEnvStrings(LPCTSTR pszPath, LPTSTR pszBuf, UINT cchBuf)
726{
727 static TModuleProc3<BOOL,LPCTSTR,LPTSTR,UINT>
728 pathUnExpandEnvStrings(GetModule(), UnExpandEnvStringsStr);
729 return pathUnExpandEnvStrings(pszPath, pszBuf, cchBuf);
730}
731
732BOOL
733TSHPath::UnExpandEnvStringsForUser(HANDLE hToken, LPCTSTR pszPath, LPTSTR pszBuf, UINT cchBuf)
734{
735 static TModuleProc4<BOOL,HANDLE,LPCTSTR,LPTSTR,UINT>
736 pathUnExpandEnvStringsForUser(GetModule(), UnExpandEnvStringsForUserStr);
737 return pathUnExpandEnvStringsForUser(hToken, pszPath, pszBuf, cchBuf);
738}
739
740} // OWL namespace
741/* ========================================================================== */
742
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:78
static BOOL UnExpandEnvStrings(LPCTSTR pszPath, TCHAR *pszBuf, UINT cchBuf)
Takes a fully qualified path, and replaces several folder names with their associated environment str...
Definition shelwapi.cpp:725
static BOOL IsSystemFolder(LPCTSTR pszPath, DWORD dwAttrb)
Determines if an existing folder contains the attributes that make it a system folder.
Definition shelwapi.cpp:708
static BOOL IsPrefix(LPCTSTR pszPrefix, LPCTSTR pszPath)
Searches a path to determine if it contains a valid prefix of the type passed by pszPrefix.
Definition shelwapi.cpp:476
static void RemoveBlanks(TCHAR *pszPath)
Removes all leading and trailing spaces from a string.
Definition shelwapi.cpp:612
static BOOL FindOnPath(TCHAR *pszPath, LPCTSTR *ppszOtherDirs)
Searches for a file.
Definition shelwapi.cpp:404
static BOOL StripToRoot(TCHAR *pszPath)
Removes all parts of the path except for the root information.
Definition shelwapi.cpp:676
static BOOL RelativePathTo(TCHAR *pszPath, LPCTSTR pszFrom, DWORD dwAttrFrom, LPCTSTR pszTo, DWORD dwAttrTo)
Creates a relative path from one file or folder to another.
Definition shelwapi.cpp:588
static TCHAR * FindExtension(LPCTSTR pszPath)
Searches a path for an extension.
Definition shelwapi.cpp:380
static BOOL IsLFNFileSpec(LPCTSTR lpName)
Determines whether or not a file name is in long format.
Definition shelwapi.cpp:428
static BOOL IsNetworkPath(LPCTSTR pszPath)
Determines whether a path string represents a network resource.
Definition shelwapi.cpp:516
static TCHAR * FindNextComponent(LPCTSTR pszPath)
Parses a path for the next path component.
Definition shelwapi.cpp:396
static int ParseIconLocation(TCHAR *pszIconFile)
Parses a file location string containing a file location and icon index, and returns separate values.
Definition shelwapi.cpp:572
static void SetDlgItemPath(HWND hDlg, int id, LPCTSTR pszPath)
Sets the text of a child control in a window or dialog box, using PathCompactPath to make sure the pa...
Definition shelwapi.cpp:652
static BOOL MatchSpec(LPCTSTR pszFile, LPCTSTR pszSpec)
Searches a string using a DOS wild card match type.
Definition shelwapi.cpp:564
static BOOL IsUNCServer(LPCTSTR pszPath)
Determines if a string is a valid UNC (universal naming convention) for a server path only.
Definition shelwapi.cpp:524
static void RemoveArgs(TCHAR *pszPath)
Removes any arguments from a given path.
Definition shelwapi.cpp:596
static BOOL AddExtension(TCHAR *pszPath, LPCTSTR pszExt)
Adds a file extension to a path string.
Definition shelwapi.cpp:308
static void RemoveExtension(TCHAR *pszPath)
Removes the file extension from a path, if there is one.
Definition shelwapi.cpp:620
static BOOL UnExpandEnvStringsForUser(HANDLE hToken, LPCTSTR pszPath, TCHAR *pszBuf, UINT cchBuf)
Definition shelwapi.cpp:733
static int GetDriveNumber(LPCTSTR pszPath)
Searches a path for a drive letter within the range of 'A' to 'Z' and returns the corresponding drive...
Definition shelwapi.cpp:444
static void QuoteSpaces(TCHAR *lpsz)
Searches a path for spaces.
Definition shelwapi.cpp:580
static int CommonPrefix(LPCTSTR pszFile1, LPCTSTR pszFile2, TCHAR *achPath)
Compares two paths to determine if they share a common prefix.
Definition shelwapi.cpp:364
static void UnquoteSpaces(TCHAR *lpsz)
Removes quotes from the beginning and end of a path.
Definition shelwapi.cpp:684
static TModule & GetModule()
Definition shelwapi.cpp:293
static void Undecorate(TCHAR *pszPath)
Removes the decoration from a path string.
Definition shelwapi.cpp:716
static TCHAR * SkipRoot(LPCTSTR pszPath)
Parses a path, ignoring the drive letter or UNC server/share path parts.
Definition shelwapi.cpp:660
static TCHAR * BuildRoot(TCHAR *pszRoot, int iDrive)
Creates a root path from a given drive number.
Definition shelwapi.cpp:324
static BOOL MakePretty(TCHAR *pszPath)
Converts a path to all lowercase characters to give the path a consistent appearance.
Definition shelwapi.cpp:556
static BOOL Append(TCHAR *pszPath, LPCTSTR pMore)
Appends one path to the end of another.
Definition shelwapi.cpp:316
static BOOL IsDirectoryEmpty(LPCTSTR pszPath)
Determines whether or not a specified path is an empty directory.
Definition shelwapi.cpp:460
static void StripPath(TCHAR *pszPath)
Removes the path portion of a fully qualified path and file.
Definition shelwapi.cpp:668
static TCHAR * AddBackslash(TCHAR *pszPath)
Adds a backslash to the end of a string to create the correct syntax for a path.
Definition shelwapi.cpp:300
static BOOL IsRoot(LPCTSTR pszPath)
Parses a path to determine if it is a directory root.
Definition shelwapi.cpp:492
static BOOL IsContentType(LPCTSTR pszPath, LPCTSTR pszContentType)
Determines if a file's registered content type matches the specified content type.
Definition shelwapi.cpp:540
static BOOL IsRelative(LPCTSTR pszPath)
Searches a path and determines if it is relative.
Definition shelwapi.cpp:484
static BOOL RemoveFileSpec(TCHAR *pszPath)
Removes the trailing file name and backslash from a path, if it has them.
Definition shelwapi.cpp:628
static BOOL IsFileSpec(LPCTSTR pszPath)
Searches a path for any path delimiting characters (for example, ':' or '\' ).
Definition shelwapi.cpp:468
static TCHAR * GetArgs(LPCTSTR pszPath)
Finds the command line arguments within a given path.
Definition shelwapi.cpp:412
static BOOL Canonicalize(TCHAR *pszBuf, LPCTSTR pszPath)
Canonicalizes a path.
Definition shelwapi.cpp:332
static BOOL CompactPath(HDC hDC, TCHAR *pszPath, UINT dx)
Truncates a file path to fit within a given pixel width by replacing path components with ellipses.
Definition shelwapi.cpp:348
static BOOL IsURL(LPCTSTR pszPath)
Tests a given string to determine if it conforms to a valid URL format.
Definition shelwapi.cpp:548
static BOOL IsUNCServerShare(LPCTSTR pszPath)
Determines if a string is a valid universal naming convention (UNC) share path, \\server\share.
Definition shelwapi.cpp:532
static BOOL IsUNC(LPCTSTR pszPath)
Determines if the string is a valid UNC (universal naming convention) for a server and share path.
Definition shelwapi.cpp:508
static UINT GetCharType(tchar ch)
Determines the type of character with respect to a path.
Definition shelwapi.cpp:436
static BOOL IsDirectory(LPCTSTR pszPath)
Verifies that a path is a valid directory.
Definition shelwapi.cpp:452
static LPCTSTR FindSuffixArray(LPCTSTR pszPath, const LPCTSTR *apszSuffix, int iArraySize)
Determines if a given file name has one of a list of suffixes.
Definition shelwapi.cpp:420
static TCHAR * FindFileName(LPCTSTR pszPath)
Searches a path for a file name.
Definition shelwapi.cpp:388
static BOOL UnmakeSystemFolder(LPCTSTR pszPath)
Removes the attributes from a folder that make it a system folder.
Definition shelwapi.cpp:700
static BOOL FileExists(LPCTSTR pszPath)
Determines whether a path to a file system object such as a file or directory is valid.
Definition shelwapi.cpp:372
static TCHAR * Combine(TCHAR *pszDest, LPCTSTR pszDir, LPCTSTR pszFile)
Concatenates two strings that represent properly formed paths into one path, as well as any relative ...
Definition shelwapi.cpp:340
static BOOL MakeSystemFolder(LPCTSTR pszPath)
Gives an existing folder the proper attributes to become a system folder.
Definition shelwapi.cpp:692
static TCHAR * RemoveBackslash(TCHAR *pszPath)
Removes the trailing backslash from a given path.
Definition shelwapi.cpp:604
static BOOL SearchAndQualify(LPCTSTR pszPath, TCHAR *pszBuf, UINT cchBuf)
Determines if a given path is correctly formatted and fully qualified.
Definition shelwapi.cpp:644
static BOOL RenameExtension(TCHAR *pszPath, LPCTSTR pszExt)
Replaces the extension of a file name with a new extension.
Definition shelwapi.cpp:636
static BOOL IsSameRoot(LPCTSTR pszPath1, LPCTSTR pszPath2)
Compares two paths to determine if they have a common root component.
Definition shelwapi.cpp:500
static BOOL CompactPathEx(TCHAR *pszOut, LPCTSTR pszSrc, UINT cchMax, DWORD dwFlags)
Definition shelwapi.cpp:356
static DWORD DeleteKey(HKEY hkey, LPCTSTR pszSubKey)
DeleteKey mimics RegDeleteKey as it behaves on Win95 - deletes a subkey and all its values and descen...
Definition shelwapi.cpp:72
static LONG QueryInfoKey(HKEY hkey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen)
Retrieves information about a specified registry key.
Definition shelwapi.cpp:136
static DWORD SetValue(HKEY hkey, LPCTSTR pszSubKey, LPCTSTR pszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition shelwapi.cpp:104
static DWORD CopyKey(HKEY hkeySrc, LPCTSTR szSrcSubKey, HKEY hkeyDest, DWORD fReserved)
Recursively copies the subkeys and values of the source subkey to the destination key.
Definition shelwapi.cpp:145
static DWORD QueryValueEx(HKEY hkey, LPCTSTR pszValue, LPDWORD pdwReserved, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
This functions work just like RegQueryValueEx, except if the data type is REG_EXPAND_SZ,...
Definition shelwapi.cpp:112
static DWORD DeleteEmptyKey(HKEY hkey, LPCTSTR pszSubKey)
DeleteEmptyKey mimics RegDeleteKey as it behaves on NT - delete the subkey only if it does not contai...
Definition shelwapi.cpp:64
static HKEY DuplicateKey(HKEY hkey)
Duplicates a registry key's HKEY handle.
Definition shelwapi.cpp:80
static DWORD DeleteValue(HKEY hkey, LPCTSTR pszSubKey, LPCTSTR pszValue)
These functions open the key, get/set/delete the value, then close the key.
Definition shelwapi.cpp:88
static LONG EnumKeyEx(HKEY hkey, DWORD dwIndex, TCHAR *pszName, LPDWORD pcchName)
Enumerates the subkeys of the specified open registry key.
Definition shelwapi.cpp:120
static DWORD GetValue(HKEY hkey, LPCTSTR pszSubKey, LPCTSTR pszValue, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
Definition shelwapi.cpp:96
static LONG EnumValue(HKEY hkey, DWORD dwIndex, TCHAR *pszValueName, LPDWORD pcchValueName, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
Enumerates the values of the specified open registry key.
Definition shelwapi.cpp:128
static DWORD RegGetPath(HKEY hkey, LPCTSTR pcszSubKey, LPCTSTR pcszValue, TCHAR *pszPath, DWORD dwFlags)
Retrieves a file path from the registry, expanding environment variables as needed.
Definition shelwapi.cpp:154
static TModule & GetModule()
Definition shelwapi.cpp:57
static DWORD RegSetPath(HKEY hkey, LPCTSTR pcszSubKey, LPCTSTR pcszValue, LPCTSTR pcszPath, DWORD dwFlags)
Takes a file path, replaces folder names with environment strings, and places the resulting string in...
Definition shelwapi.cpp:162
#define _T(x)
Definition cygwin.h:51
Definition of class TModule.
Object Windows Library (OWLNext Core).
Definition animctrl.h:22
char tchar
Definition defs.h:77
General definitions used by all ObjectWindows programs.
Definitions of Windows light-weight utility APIs: TSHReg, TSHPath.