Debian Codegraph @

libcpath/libcpath_path.h

raw symbols SCIP
1 /*
2 * Path functions
3 *
4 * Copyright (C) 2008-2024, Joachim Metz <[email protected]>
5 *
6 * Refer to AUTHORS for acknowledgements.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22 #if !defined( _LIBCPATH_PATH_H )
23 #define _LIBCPATH_PATH_H
24
25 #include <common.h>
26 #include <types.h>
27
28 #include "libcpath_extern.h"
29 #include "libcpath_libcerror.h"
30
31 #if defined( __cplusplus )
32 extern "C" {
33 #endif
34
35 #if defined( WINAPI ) && ( WINVER <= 0x0500 )
36
37 BOOL libcpath_CloseHandle(
38 HANDLE file_handle );
39
40 #endif /* defined( WINAPI ) && ( WINVER <= 0x0500 ) */
41
42 #if defined( WINAPI ) && ( WINVER <= 0x0500 )
43
44 BOOL libcpath_SetCurrentDirectoryA(
45 LPCSTR path );
46
47 #endif /* defined( WINAPI ) && ( WINVER <= 0x0500 ) */
48
49 LIBCPATH_EXTERN \
50 int libcpath_path_change_directory(
51 const char *directory_name,
52 libcerror_error_t **error );
53
54 #if defined( WINAPI ) && ( WINVER <= 0x0500 )
55
56 DWORD libcpath_GetCurrentDirectoryA(
57 DWORD buffer_size,
58 LPCSTR buffer );
59
60 #endif /* defined( WINAPI ) && ( WINVER <= 0x0500 ) */
61
62 LIBCPATH_EXTERN \
63 int libcpath_path_get_current_working_directory(
64 char **current_working_directory,
65 size_t *current_working_directory_size,
66 libcerror_error_t **error );
67
68 #if defined( WINAPI )
69
70 int libcpath_path_get_path_type(
71 const char *path,
72 size_t path_length,
73 uint8_t *path_type,
74 libcerror_error_t **error );
75
76 int libcpath_path_get_volume_name(
77 const char *path,
78 size_t path_length,
79 char **volume_name,
80 size_t *volume_name_length,
81 size_t *directory_name_index,
82 libcerror_error_t **error );
83
84 int libcpath_path_get_current_working_directory_by_volume(
85 char *volume_name,
86 size_t volume_name_length,
87 char **current_working_directory,
88 size_t *current_working_directory_size,
89 libcerror_error_t **error );
90
91 #endif /* defined( WINAPI ) */
92
93 LIBCPATH_EXTERN \
94 int libcpath_path_get_full_path(
95 const char *path,
96 size_t path_length,
97 char **full_path,
98 size_t *full_path_size,
99 libcerror_error_t **error );
100
101 int libcpath_path_get_sanitized_character_size(
102 char character,
103 size_t *sanitized_character_size,
104 libcerror_error_t **error );
105
106 int libcpath_path_get_sanitized_character(
107 char character,
108 size_t sanitized_character_size,
109 char *sanitized_path,
110 size_t sanitized_path_size,
111 size_t *sanitized_path_index,
112 libcerror_error_t **error );
113
114 LIBCPATH_EXTERN \
115 int libcpath_path_get_sanitized_filename(
116 const char *filename,
117 size_t filename_length,
118 char **sanitized_filename,
119 size_t *sanitized_filename_size,
120 libcerror_error_t **error );
121
122 LIBCPATH_EXTERN \
123 int libcpath_path_get_sanitized_path(
124 const char *path,
125 size_t path_length,
126 char **sanitized_path,
127 size_t *sanitized_path_size,
128 libcerror_error_t **error );
129
130 LIBCPATH_EXTERN \
131 int libcpath_path_join(
132 char **path,
133 size_t *path_size,
134 const char *directory_name,
135 size_t directory_name_length,
136 const char *filename,
137 size_t filename_length,
138 libcerror_error_t **error );
139
140 #if defined( WINAPI ) && ( WINVER <= 0x0500 )
141
142 BOOL libcpath_CreateDirectoryA(
143 LPCSTR path,
144 SECURITY_ATTRIBUTES *security_attributes );
145
146 #endif /* defined( WINAPI ) && ( WINVER <= 0x0500 ) */
147
148 LIBCPATH_EXTERN \
149 int libcpath_path_make_directory(
150 const char *directory_name,
151 libcerror_error_t **error );
152
153 #if defined( HAVE_WIDE_CHARACTER_TYPE )
154
155 #if defined( WINAPI ) && ( WINVER <= 0x0500 )
156
157 BOOL libcpath_SetCurrentDirectoryW(
158 LPCWSTR path );
159
160 #endif /* defined( WINAPI ) && ( WINVER <= 0x0500 ) */
161
162 LIBCPATH_EXTERN \
163 int libcpath_path_change_directory_wide(
164 const wchar_t *directory_name,
165 libcerror_error_t **error );
166
167 #if defined( WINAPI ) && ( WINVER <= 0x0500 )
168
169 DWORD libcpath_GetCurrentDirectoryW(
170 DWORD buffer_size,
171 LPCWSTR buffer );
172
173 #endif /* defined( WINAPI ) && ( WINVER <= 0x0500 ) */
174
175 LIBCPATH_EXTERN \
176 int libcpath_path_get_current_working_directory_wide(
177 wchar_t **current_working_directory,
178 size_t *current_working_directory_size,
179 libcerror_error_t **error );
180
181 #if defined( WINAPI )
182
183 int libcpath_path_get_path_type_wide(
184 const wchar_t *path,
185 size_t path_length,
186 uint8_t *path_type,
187 libcerror_error_t **error );
188
189 int libcpath_path_get_volume_name_wide(
190 const wchar_t *path,
191 size_t path_length,
192 wchar_t **volume_name,
193 size_t *volume_name_length,
194 size_t *directory_name_index,
195 libcerror_error_t **error );
196
197 int libcpath_path_get_current_working_directory_by_volume_wide(
198 wchar_t *volume_name,
199 size_t volume_name_length,
200 wchar_t **current_working_directory,
201 size_t *current_working_directory_size,
202 libcerror_error_t **error );
203
204 #endif /* defined( WINAPI ) */
205
206 LIBCPATH_EXTERN \
207 int libcpath_path_get_full_path_wide(
208 const wchar_t *path,
209 size_t path_length,
210 wchar_t **full_path,
211 size_t *full_path_size,
212 libcerror_error_t **error );
213
214 int libcpath_path_get_sanitized_character_size_wide(
215 wchar_t character,
216 size_t *sanitized_character_size,
217 libcerror_error_t **error );
218
219 int libcpath_path_get_sanitized_character_wide(
220 wchar_t character,
221 size_t sanitized_character_size,
222 wchar_t *sanitized_path,
223 size_t sanitized_path_size,
224 size_t *sanitized_path_index,
225 libcerror_error_t **error );
226
227 LIBCPATH_EXTERN \
228 int libcpath_path_get_sanitized_filename_wide(
229 const wchar_t *filename,
230 size_t filename_length,
231 wchar_t **sanitized_filename,
232 size_t *sanitized_filename_size,
233 libcerror_error_t **error );
234
235 LIBCPATH_EXTERN \
236 int libcpath_path_get_sanitized_path_wide(
237 const wchar_t *path,
238 size_t path_length,
239 wchar_t **sanitized_path,
240 size_t *sanitized_path_size,
241 libcerror_error_t **error );
242
243 LIBCPATH_EXTERN \
244 int libcpath_path_join_wide(
245 wchar_t **path,
246 size_t *path_size,
247 const wchar_t *directory_name,
248 size_t directory_name_length,
249 const wchar_t *filename,
250 size_t filename_length,
251 libcerror_error_t **error );
252
253 #if defined( WINAPI ) && ( WINVER <= 0x0500 )
254
255 BOOL libcpath_CreateDirectoryW(
256 LPCWSTR path,
257 SECURITY_ATTRIBUTES *security_attributes );
258
259 #endif /* defined( WINAPI ) && ( WINVER <= 0x0500 ) */
260
261 LIBCPATH_EXTERN \
262 int libcpath_path_make_directory_wide(
263 const wchar_t *directory_name,
264 libcerror_error_t **error );
265
266 #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */
267
268 #if defined( __cplusplus )
269 }
270 #endif
271
272 #endif /* !defined( _LIBCPATH_PATH_H ) */
273