OWLNext
7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
shelwapi.h
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
/// Definitions of Windows light-weight utility APIs:
7
/// TSHReg, TSHPath
8
//
9
//----------------------------------------------------------------------------
10
11
#if !defined(OWL_SHELWAPI_H)
12
#define OWL_SHELWAPI_H
13
14
#include <
owl/private/defs.h
>
15
#if defined(BI_HAS_PRAGMA_ONCE)
16
# pragma once
17
#endif
18
19
#if !defined(_INC_SHLWAPI)
20
# include <shlwapi.h>
21
#endif
22
23
24
25
namespace
owl
{
26
27
class
_OWLCLASS
TModule;
28
29
#include <
owl/preclass.h
>
30
31
//
32
/// \class TSHReg
33
// ~~~~~ ~~~~~~
34
/// delay loading SHLWAPI.DLL
35
class
_OWLCLASS
TSHReg
{
36
public
:
37
38
/// DeleteEmptyKey mimics RegDeleteKey as it behaves on NT -
39
/// delete the subkey only if it does not contain any subkeys and values.
40
static
DWORD
DeleteEmptyKey(
HKEY
hkey
,
LPCTSTR
pszSubKey
);
41
42
/// DeleteKey mimics RegDeleteKey as it behaves on Win95 -
43
/// deletes a subkey and all its values and descendants
44
static
DWORD
DeleteKey(
HKEY
hkey
,
LPCTSTR
pszSubKey
);
45
46
/// Duplicates a registry key's HKEY handle
47
static
HKEY
DuplicateKey(
HKEY
hkey
);
48
49
/// These functions open the key, get/set/delete the value, then close
50
/// the key.
51
static
DWORD
DeleteValue(
HKEY
hkey
,
LPCTSTR
pszSubKey
,
LPCTSTR
pszValue
);
52
static
DWORD
GetValue(
HKEY
hkey
,
LPCTSTR
pszSubKey
,
LPCTSTR
pszValue
,
LPDWORD
pdwType
,
LPVOID
pvData
,
LPDWORD
pcbData
);
53
static
DWORD
SetValue(
HKEY
hkey
,
LPCTSTR
pszSubKey
,
LPCTSTR
pszValue
,
DWORD
dwType
,
LPCVOID
pvData
,
DWORD
cbData
);
54
55
/// This functions work just like RegQueryValueEx, except if the
56
/// data type is REG_EXPAND_SZ, then these will go ahead and expand
57
/// out the string. *pdwType will always be massaged to REG_SZ
58
/// if this happens. REG_SZ values are also guaranteed to be null
59
/// terminated.
60
static
DWORD
QueryValueEx(
HKEY
hkey
,
LPCTSTR
pszValue
,
LPDWORD
pdwReserved
,
LPDWORD
pdwType
,
LPVOID
pvData
,
LPDWORD
pcbData
);
61
62
63
/// Enumerates the subkeys of the specified open registry key
64
static
LONG
EnumKeyEx(
HKEY
hkey
,
DWORD
dwIndex
,
LPTSTR
pszName
,
LPDWORD
pcchName
);
65
66
/// Enumerates the values of the specified open registry key
67
static
LONG
EnumValue(
HKEY
hkey
,
DWORD
dwIndex
,
LPTSTR
pszValueName
,
LPDWORD
pcchValueName
,
LPDWORD
pdwType
,
LPVOID
pvData
,
LPDWORD
pcbData
);
68
69
/// Retrieves information about a specified registry key
70
static
LONG
QueryInfoKey(
HKEY
hkey
,
LPDWORD
pcSubKeys
,
LPDWORD
pcchMaxSubKeyLen
,
LPDWORD
pcValues
,
LPDWORD
pcchMaxValueNameLen
);
71
72
/// Recursively copies the subkeys and values of the source subkey to the destination key
73
static
DWORD
CopyKey(
HKEY
hkeySrc
,
LPCTSTR
szSrcSubKey
,
HKEY
hkeyDest
,
DWORD
fReserved
);
74
75
/// Retrieves a file path from the registry, expanding environment variables as needed
76
static
DWORD
RegGetPath(
HKEY
hkey
,
LPCTSTR
pcszSubKey
,
LPCTSTR
pcszValue
,
LPTSTR
pszPath
,
DWORD
dwFlags
);
77
78
/// Takes a file path, replaces folder names with environment strings, and places the resulting string in the registry
79
static
DWORD
RegSetPath(
HKEY
hkey
,
LPCTSTR
pcszSubKey
,
LPCTSTR
pcszValue
,
LPCTSTR
pcszPath
,
DWORD
dwFlags
);
80
81
static
TModule
& GetModule();
82
};
83
84
85
////////////////////////////////////////////////////////////////////////////////
86
87
88
//
89
/// \class TSHPath
90
// ~~~~~ ~~~~~~
91
/// delay loading SHLWAPI.DLL
92
class
_OWLCLASS
TSHPath
{
93
public
:
94
95
/// Adds a backslash to the end of a string to create the correct syntax for a path.
96
/// If the source path already has a trailing backslash, no backslash will be added
97
static
LPTSTR
AddBackslash(
LPTSTR
pszPath
);
98
99
/// Adds a file extension to a path string
100
static
BOOL
AddExtension(
LPTSTR
pszPath
,
LPCTSTR
pszExt
);
101
102
/// Appends one path to the end of another
103
static
BOOL
Append(
LPTSTR
pszPath
,
LPCTSTR
pMore
);
104
105
/// Creates a root path from a given drive number
106
static
LPTSTR
BuildRoot(
LPTSTR
pszRoot
,
int
iDrive
);
107
108
/// Canonicalizes a path
109
static
BOOL
Canonicalize(
LPTSTR
pszBuf
,
LPCTSTR
pszPath
);
110
111
/// Concatenates two strings that represent properly formed paths into one path,
112
/// as well as any relative path pieces
113
static
LPTSTR
Combine(
LPTSTR
pszDest
,
LPCTSTR
pszDir
,
LPCTSTR
pszFile
);
114
115
/// Truncates a file path to fit within a given pixel width
116
/// by replacing path components with ellipses
117
static
BOOL
CompactPath(
HDC
hDC
,
LPTSTR
pszPath
,
UINT
dx
);
118
static
BOOL
CompactPathEx(
LPTSTR
pszOut
,
LPCTSTR
pszSrc
,
UINT
cchMax
,
DWORD
dwFlags
);
119
120
/// Compares two paths to determine if they share a common prefix.
121
/// A prefix is one of these types: "C:\\", ".", "..", "..\\".
122
static
int
CommonPrefix(
LPCTSTR
pszFile1
,
LPCTSTR
pszFile2
,
LPTSTR
achPath
);
123
124
/// Determines whether a path to a file system object
125
/// such as a file or directory is valid
126
static
BOOL
FileExists(
LPCTSTR
pszPath
);
127
128
/// Searches a path for an extension
129
static
LPTSTR
FindExtension(
LPCTSTR
pszPath
);
130
131
/// Searches a path for a file name
132
static
LPTSTR
FindFileName(
LPCTSTR
pszPath
);
133
134
/// Parses a path for the next path component
135
static
LPTSTR
FindNextComponent(
LPCTSTR
pszPath
);
136
137
/// Searches for a file
138
static
BOOL
FindOnPath(
LPTSTR
pszPath
,
LPCTSTR
*
ppszOtherDirs
);
139
140
/// Finds the command line arguments within a given path
141
static
LPTSTR
GetArgs(
LPCTSTR
pszPath
);
142
143
/// Determines if a given file name has one of a list of suffixes
144
static
LPCTSTR
FindSuffixArray(
LPCTSTR
pszPath
,
const
LPCTSTR
*
apszSuffix
,
int
iArraySize
);
145
146
/// Determines whether or not a file name is in long format
147
static
BOOL
IsLFNFileSpec(
LPCTSTR
lpName
);
148
149
/// Determines the type of character with respect to a path
150
static
UINT
GetCharType(
tchar
ch
);
151
152
/// Searches a path for a drive letter within the range of 'A' to 'Z'
153
/// and returns the corresponding drive number
154
static
int
GetDriveNumber(
LPCTSTR
pszPath
);
155
156
/// Verifies that a path is a valid directory
157
static
BOOL
IsDirectory(
LPCTSTR
pszPath
);
158
159
/// Determines whether or not a specified path is an empty directory
160
static
BOOL
IsDirectoryEmpty(
LPCTSTR
pszPath
);
161
162
/// Searches a path for any path delimiting characters (for example, ':' or '\' ).
163
/// If there are no path delimiting characters present,
164
/// the path is considered to be a File Spec path
165
static
BOOL
IsFileSpec(
LPCTSTR
pszPath
);
166
167
/// Searches a path to determine if it contains a valid prefix
168
/// of the type passed by pszPrefix.
169
/// A prefix is one of these types: "C:\\", ".", "..", "..\\"
170
static
BOOL
IsPrefix(
LPCTSTR
pszPrefix
,
LPCTSTR
pszPath
);
171
172
/// Searches a path and determines if it is relative
173
static
BOOL
IsRelative(
LPCTSTR
pszPath
);
174
175
/// Parses a path to determine if it is a directory root
176
static
BOOL
IsRoot(
LPCTSTR
pszPath
);
177
178
/// Compares two paths to determine if they have a common root component
179
static
BOOL
IsSameRoot(
LPCTSTR
pszPath1
,
LPCTSTR
pszPath2
);
180
181
/// Determines if the string is a valid UNC (universal naming convention)
182
/// for a server and share path
183
static
BOOL
IsUNC(
LPCTSTR
pszPath
);
184
185
/// Determines whether a path string represents a network resource
186
static
BOOL
IsNetworkPath(
LPCTSTR
pszPath
);
187
188
/// Determines if a string is a valid UNC (universal naming convention)
189
/// for a server path only
190
static
BOOL
IsUNCServer(
LPCTSTR
pszPath
);
191
192
/// Determines if a string is a valid universal naming convention (UNC)
193
/// share path, \\\\server\\share
194
static
BOOL
IsUNCServerShare(
LPCTSTR
pszPath
);
195
196
/// Determines if a file's registered content type matches
197
/// the specified content type.
198
/// This function obtains the content type for the specified file type
199
/// and compares that string with the pszContentType.
200
/// The comparison is not case sensitive
201
static
BOOL
IsContentType(
LPCTSTR
pszPath
,
LPCTSTR
pszContentType
);
202
203
/// Tests a given string to determine if it conforms to a valid URL format
204
static
BOOL
IsURL(
LPCTSTR
pszPath
);
205
206
/// Converts a path to all lowercase characters
207
/// to give the path a consistent appearance
208
static
BOOL
MakePretty(
LPTSTR
pszPath
);
209
210
/// Searches a string using a DOS wild card match type
211
static
BOOL
MatchSpec(
LPCTSTR
pszFile
,
LPCTSTR
pszSpec
);
212
213
/// Parses a file location string containing a file location and icon index,
214
/// and returns separate values
215
static
int
ParseIconLocation(
LPTSTR
pszIconFile
);
216
217
/// Searches a path for spaces. If spaces are found,
218
/// the entire path is enclosed in quotation marks
219
static
void
QuoteSpaces(
LPTSTR
lpsz
);
220
221
/// Creates a relative path from one file or folder to another
222
static
BOOL
RelativePathTo(
LPTSTR
pszPath
,
LPCTSTR
pszFrom
,
DWORD
dwAttrFrom
,
LPCTSTR
pszTo
,
DWORD
dwAttrTo
);
223
224
/// Removes any arguments from a given path
225
static
void
RemoveArgs(
LPTSTR
pszPath
);
226
227
/// Removes the trailing backslash from a given path
228
static
LPTSTR
RemoveBackslash(
LPTSTR
pszPath
);
229
230
/// Removes all leading and trailing spaces from a string
231
static
void
RemoveBlanks(
LPTSTR
pszPath
);
232
233
/// Removes the file extension from a path, if there is one
234
static
void
RemoveExtension(
LPTSTR
pszPath
);
235
236
/// Removes the trailing file name and backslash from a path, if it has them
237
static
BOOL
RemoveFileSpec(
LPTSTR
pszPath
);
238
239
/// Replaces the extension of a file name with a new extension.
240
/// If the file name does not contain an extension,
241
/// the extension will be attached to the end of the string
242
static
BOOL
RenameExtension(
LPTSTR
pszPath
,
LPCTSTR
pszExt
);
243
244
/// Determines if a given path is correctly formatted and fully qualified
245
static
BOOL
SearchAndQualify(
LPCTSTR
pszPath
,
LPTSTR
pszBuf
,
UINT
cchBuf
);
246
247
/// Sets the text of a child control in a window or dialog box,
248
/// using PathCompactPath to make sure the path fits in the control
249
static
void
SetDlgItemPath(
HWND
hDlg
,
int
id
,
LPCTSTR
pszPath
);
250
251
/// Parses a path, ignoring the drive letter or UNC server/share path parts
252
static
LPTSTR
SkipRoot(
LPCTSTR
pszPath
);
253
254
/// Removes the path portion of a fully qualified path and file
255
static
void
StripPath(
LPTSTR
pszPath
);
256
257
/// Removes all parts of the path except for the root information
258
static
BOOL
StripToRoot(
LPTSTR
pszPath
);
259
260
/// Removes quotes from the beginning and end of a path
261
static
void
UnquoteSpaces(
LPTSTR
lpsz
);
262
263
/// Gives an existing folder the proper attributes to become a system folder
264
static
BOOL
MakeSystemFolder(
LPCTSTR
pszPath
);
265
266
/// Removes the attributes from a folder that make it a system folder.
267
/// This folder must actually exist in the file system
268
static
BOOL
UnmakeSystemFolder(
LPCTSTR
pszPath
);
269
270
/// Determines if an existing folder contains the attributes
271
/// that make it a system folder.
272
/// Alternately indicates if certain attributes qualify
273
/// a folder to be a system folder
274
static
BOOL
IsSystemFolder(
LPCTSTR
pszPath
,
DWORD
dwAttrb
);
275
276
/// Removes the decoration from a path string
277
static
void
Undecorate(
LPTSTR
pszPath
);
278
279
/// Takes a fully qualified path, and replaces several folder names
280
/// with their associated environment string
281
static
BOOL
UnExpandEnvStrings(
LPCTSTR
pszPath
,
LPTSTR
pszBuf
,
UINT
cchBuf
);
282
static
BOOL
UnExpandEnvStringsForUser(
HANDLE
hToken
,
LPCTSTR
pszPath
,
LPTSTR
pszBuf
,
UINT
cchBuf
);
283
284
285
static
TModule
& GetModule();
286
};
287
288
#include <
owl/posclass.h
>
289
290
}
// OWL namespace
291
292
293
#endif
// OWL_SHELWAPI_H
294
VarType
Definition
safearray.h:14
owl::TModule
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition
module.h:75
owl::TSHPath
delay loading SHLWAPI.DLL
Definition
shelwapi.h:92
owl::TSHReg
delay loading SHLWAPI.DLL
Definition
shelwapi.h:35
owl
Object Windows Library (OWLNext Core)
Definition
animctrl.h:22
owl::tchar
char tchar
Definition
defs.h:77
defs.h
_OWLCLASS
#define _OWLCLASS
Definition
defs.h:338
posclass.h
preclass.h
include
owl
shelwapi.h
Generated by
1.10.0