diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-06-03 17:48:39 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-06-07 19:44:36 -0500 |
commit | 6b0f2d978504da82070523eb6adb0b59f9812e93 (patch) | |
tree | 6f0b258519a0f51bf589e4313206b3ffeaa32a41 /src/libs/dutil/WixToolset.DUtil/inc/pathutil.h | |
parent | b652e93a460b4b822a01382e5992f96f1d805ffe (diff) | |
download | wix-6b0f2d978504da82070523eb6adb0b59f9812e93.tar.gz wix-6b0f2d978504da82070523eb6adb0b59f9812e93.tar.bz2 wix-6b0f2d978504da82070523eb6adb0b59f9812e93.zip |
Add PathSkipPastRoot.
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/inc/pathutil.h')
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/pathutil.h | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/pathutil.h b/src/libs/dutil/WixToolset.DUtil/inc/pathutil.h index e64c8ef3..727318f2 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/pathutil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/pathutil.h | |||
@@ -8,8 +8,8 @@ extern "C" { | |||
8 | 8 | ||
9 | typedef enum _PATH_CANONICALIZE | 9 | typedef enum _PATH_CANONICALIZE |
10 | { | 10 | { |
11 | // Always prefix fully qualified paths with the long path prefix (\\?\). | 11 | // Always prefix fully qualified paths with the extended path prefix (\\?\). |
12 | PATH_CANONICALIZE_APPEND_LONG_PATH_PREFIX = 0x0001, | 12 | PATH_CANONICALIZE_APPEND_EXTENDED_PATH_PREFIX = 0x0001, |
13 | // Always terminate the path with \. | 13 | // Always terminate the path with \. |
14 | PATH_CANONICALIZE_BACKSLASH_TERMINATE = 0x0002, | 14 | PATH_CANONICALIZE_BACKSLASH_TERMINATE = 0x0002, |
15 | // Don't collapse . or .. in the \\server\share portion of a UNC path. | 15 | // Don't collapse . or .. in the \\server\share portion of a UNC path. |
@@ -22,6 +22,14 @@ typedef enum _PATH_EXPAND | |||
22 | PATH_EXPAND_FULLPATH = 0x0002, | 22 | PATH_EXPAND_FULLPATH = 0x0002, |
23 | } PATH_EXPAND; | 23 | } PATH_EXPAND; |
24 | 24 | ||
25 | typedef enum _PATH_PREFIX | ||
26 | { | ||
27 | // Add prefix even if the path is not longer than MAX_PATH. | ||
28 | PATH_PREFIX_SHORT_PATHS = 0x0001, | ||
29 | // Error with E_INVALIDARG if the path is not fully qualified. | ||
30 | PATH_PREFIX_EXPECT_FULLY_QUALIFIED = 0x0002, | ||
31 | } PATH_PREFIX; | ||
32 | |||
25 | 33 | ||
26 | /******************************************************************* | 34 | /******************************************************************* |
27 | PathFile - returns a pointer to the file part of the path. | 35 | PathFile - returns a pointer to the file part of the path. |
@@ -40,8 +48,9 @@ DAPI_(LPCWSTR) PathExtension( | |||
40 | 48 | ||
41 | /******************************************************************* | 49 | /******************************************************************* |
42 | PathGetDirectory - extracts the directory from a path including the directory separator. | 50 | PathGetDirectory - extracts the directory from a path including the directory separator. |
43 | This means calling the function again with the previous result returns the same result. | 51 | Calling the function again with the previous result returns the same result. |
44 | Returns S_FALSE if the path only contains a file name. | 52 | Returns S_FALSE if the path only contains a file name. |
53 | For example, C:\a\b -> C:\a\ -> C:\a\ | ||
45 | ********************************************************************/ | 54 | ********************************************************************/ |
46 | DAPI_(HRESULT) PathGetDirectory( | 55 | DAPI_(HRESULT) PathGetDirectory( |
47 | __in_z LPCWSTR wzPath, | 56 | __in_z LPCWSTR wzPath, |
@@ -49,12 +58,18 @@ DAPI_(HRESULT) PathGetDirectory( | |||
49 | ); | 58 | ); |
50 | 59 | ||
51 | /******************************************************************* | 60 | /******************************************************************* |
52 | PathGetParentPath - extracts the parent directory from a full path. | 61 | PathGetParentPath - extracts the parent directory from a path |
53 | *psczDirectory is NULL if the path only contains a file name. | 62 | ignoring a trailing slash so that when called repeatedly, |
63 | it eventually returns the root portion of the path. | ||
64 | *psczDirectory is NULL if the path only contains a file name or | ||
65 | the path only contains the root. | ||
66 | *pcchRoot is the length of the root part of the path. | ||
67 | For example, C:\a\b -> C:\a\ -> C:\ -> NULL | ||
54 | ********************************************************************/ | 68 | ********************************************************************/ |
55 | DAPI_(HRESULT) PathGetParentPath( | 69 | DAPI_(HRESULT) PathGetParentPath( |
56 | __in_z LPCWSTR wzPath, | 70 | __in_z LPCWSTR wzPath, |
57 | __out_z LPWSTR *psczDirectory | 71 | __out_z LPWSTR *psczDirectory, |
72 | __out_opt SIZE_T* pcchRoot | ||
58 | ); | 73 | ); |
59 | 74 | ||
60 | /******************************************************************* | 75 | /******************************************************************* |
@@ -78,11 +93,14 @@ DAPI_(HRESULT) PathGetFullPathName( | |||
78 | ); | 93 | ); |
79 | 94 | ||
80 | /******************************************************************* | 95 | /******************************************************************* |
81 | PathPrefix - prefixes a full path with \\?\ or \\?\UNC as | 96 | PathPrefix - prefixes a path with \\?\ or \\?\UNC if it doesn't |
82 | appropriate. | 97 | already have an extended prefix, is longer than MAX_PATH, |
98 | and is fully qualified. | ||
83 | ********************************************************************/ | 99 | ********************************************************************/ |
84 | DAPI_(HRESULT) PathPrefix( | 100 | DAPI_(HRESULT) PathPrefix( |
85 | __inout LPWSTR *psczFullPath | 101 | __inout_z LPWSTR *psczFullPath, |
102 | __in SIZE_T cchFullPath, | ||
103 | __in DWORD dwPrefixFlags | ||
86 | ); | 104 | ); |
87 | 105 | ||
88 | /******************************************************************* | 106 | /******************************************************************* |
@@ -204,14 +222,27 @@ DAPI_(HRESULT) PathGetKnownFolder( | |||
204 | ); | 222 | ); |
205 | 223 | ||
206 | /******************************************************************* | 224 | /******************************************************************* |
225 | PathSkipPastRoot - returns a pointer to the first character after | ||
226 | the root portion of the path or NULL if the path has no root. | ||
227 | For example, the pointer will point to the "a" in "after": | ||
228 | C:\after, C:after, \after, \\server\share\after, | ||
229 | \\?\C:\afterroot, \\?\UNC\server\share\after | ||
230 | *******************************************************************/ | ||
231 | DAPI_(LPCWSTR) PathSkipPastRoot( | ||
232 | __in_z LPCWSTR wzPath, | ||
233 | __out_opt BOOL* pfHasExtendedPrefix, | ||
234 | __out_opt BOOL* pfFullyQualified, | ||
235 | __out_opt BOOL* pfUNC | ||
236 | ); | ||
237 | |||
238 | /******************************************************************* | ||
207 | PathIsFullyQualified - returns true if the path is fully qualified; false otherwise. | 239 | PathIsFullyQualified - returns true if the path is fully qualified; false otherwise. |
208 | Note that some rooted paths like C:dir are not fully qualified. | 240 | Note that some rooted paths like C:dir are not fully qualified. |
209 | For example, these are all fully qualified: C:\dir, C:/dir, \\server\share, \\?\C:\dir. | 241 | For example, these are all fully qualified: C:\dir, C:/dir, \\server\share, \\?\C:\dir. |
210 | For example, these are not fully qualified: C:dir, C:, \dir, dir, dir\subdir. | 242 | For example, these are not fully qualified: C:dir, C:, \dir, dir, dir\subdir. |
211 | *******************************************************************/ | 243 | *******************************************************************/ |
212 | DAPI_(BOOL) PathIsFullyQualified( | 244 | DAPI_(BOOL) PathIsFullyQualified( |
213 | __in_z LPCWSTR wzPath, | 245 | __in_z LPCWSTR wzPath |
214 | __out_opt BOOL* pfHasLongPathPrefix | ||
215 | ); | 246 | ); |
216 | 247 | ||
217 | /******************************************************************* | 248 | /******************************************************************* |