/src/libewf/libewf/libewf_source.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * (Acquisition) source functions |
3 | | * |
4 | | * Copyright (C) 2006-2024, Joachim Metz <joachim.metz@gmail.com> |
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 | | #include <common.h> |
23 | | #include <memory.h> |
24 | | #include <types.h> |
25 | | |
26 | | #include "libewf_lef_source.h" |
27 | | #include "libewf_libcerror.h" |
28 | | #include "libewf_libcthreads.h" |
29 | | #include "libewf_source.h" |
30 | | #include "libewf_types.h" |
31 | | |
32 | | /* Creates a source |
33 | | * Make sure the value source is referencing, is set to NULL |
34 | | * Returns 1 if successful or -1 on error |
35 | | */ |
36 | | int libewf_source_initialize( |
37 | | libewf_source_t **source, |
38 | | libewf_lef_source_t *lef_source, |
39 | | libcerror_error_t **error ) |
40 | 0 | { |
41 | 0 | libewf_internal_source_t *internal_source = NULL; |
42 | 0 | static char *function = "libewf_source_initialize"; |
43 | |
|
44 | 0 | if( source == NULL ) |
45 | 0 | { |
46 | 0 | libcerror_error_set( |
47 | 0 | error, |
48 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
49 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
50 | 0 | "%s: invalid source.", |
51 | 0 | function ); |
52 | |
|
53 | 0 | return( -1 ); |
54 | 0 | } |
55 | 0 | if( *source != NULL ) |
56 | 0 | { |
57 | 0 | libcerror_error_set( |
58 | 0 | error, |
59 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
60 | 0 | LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, |
61 | 0 | "%s: invalid source value already set.", |
62 | 0 | function ); |
63 | |
|
64 | 0 | return( -1 ); |
65 | 0 | } |
66 | 0 | if( lef_source == NULL ) |
67 | 0 | { |
68 | 0 | libcerror_error_set( |
69 | 0 | error, |
70 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
71 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
72 | 0 | "%s: invalid source.", |
73 | 0 | function ); |
74 | |
|
75 | 0 | return( -1 ); |
76 | 0 | } |
77 | 0 | internal_source = memory_allocate_structure( |
78 | 0 | libewf_internal_source_t ); |
79 | |
|
80 | 0 | if( internal_source == NULL ) |
81 | 0 | { |
82 | 0 | libcerror_error_set( |
83 | 0 | error, |
84 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
85 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
86 | 0 | "%s: unable to create source.", |
87 | 0 | function ); |
88 | |
|
89 | 0 | goto on_error; |
90 | 0 | } |
91 | 0 | if( memory_set( |
92 | 0 | internal_source, |
93 | 0 | 0, |
94 | 0 | sizeof( libewf_internal_source_t ) ) == NULL ) |
95 | 0 | { |
96 | 0 | libcerror_error_set( |
97 | 0 | error, |
98 | 0 | LIBCERROR_ERROR_DOMAIN_MEMORY, |
99 | 0 | LIBCERROR_MEMORY_ERROR_SET_FAILED, |
100 | 0 | "%s: unable to clear source.", |
101 | 0 | function ); |
102 | |
|
103 | 0 | memory_free( |
104 | 0 | internal_source ); |
105 | |
|
106 | 0 | return( -1 ); |
107 | 0 | } |
108 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
109 | 0 | if( libcthreads_read_write_lock_initialize( |
110 | 0 | &( internal_source->read_write_lock ), |
111 | 0 | error ) != 1 ) |
112 | 0 | { |
113 | 0 | libcerror_error_set( |
114 | 0 | error, |
115 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
116 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
117 | 0 | "%s: unable to initialize read/write lock.", |
118 | 0 | function ); |
119 | |
|
120 | 0 | goto on_error; |
121 | 0 | } |
122 | 0 | #endif |
123 | 0 | internal_source->lef_source = lef_source; |
124 | |
|
125 | 0 | *source = (libewf_source_t *) internal_source; |
126 | |
|
127 | 0 | return( 1 ); |
128 | | |
129 | 0 | on_error: |
130 | 0 | if( internal_source != NULL ) |
131 | 0 | { |
132 | 0 | memory_free( |
133 | 0 | internal_source ); |
134 | 0 | } |
135 | 0 | return( -1 ); |
136 | 0 | } |
137 | | |
138 | | /* Frees a source |
139 | | * Returns 1 if successful or -1 on error |
140 | | */ |
141 | | int libewf_source_free( |
142 | | libewf_source_t **source, |
143 | | libcerror_error_t **error ) |
144 | 0 | { |
145 | 0 | libewf_internal_source_t *internal_source = NULL; |
146 | 0 | static char *function = "libewf_source_free"; |
147 | 0 | int result = 1; |
148 | |
|
149 | 0 | if( source == NULL ) |
150 | 0 | { |
151 | 0 | libcerror_error_set( |
152 | 0 | error, |
153 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
154 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
155 | 0 | "%s: invalid source.", |
156 | 0 | function ); |
157 | |
|
158 | 0 | return( -1 ); |
159 | 0 | } |
160 | 0 | if( *source != NULL ) |
161 | 0 | { |
162 | 0 | internal_source = (libewf_internal_source_t *) *source; |
163 | 0 | *source = NULL; |
164 | | |
165 | | /* The lef_source reference is freed elsewhere |
166 | | */ |
167 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
168 | 0 | if( libcthreads_read_write_lock_free( |
169 | 0 | &( internal_source->read_write_lock ), |
170 | 0 | error ) != 1 ) |
171 | 0 | { |
172 | 0 | libcerror_error_set( |
173 | 0 | error, |
174 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
175 | 0 | LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, |
176 | 0 | "%s: unable to free read/write lock.", |
177 | 0 | function ); |
178 | |
|
179 | 0 | result = -1; |
180 | 0 | } |
181 | 0 | #endif |
182 | 0 | memory_free( |
183 | 0 | internal_source ); |
184 | 0 | } |
185 | 0 | return( result ); |
186 | 0 | } |
187 | | |
188 | | /* Retrieves the size of the UTF-8 encoded name |
189 | | * The returned size includes the end of string character |
190 | | * Returns 1 if successful, 0 if not set or -1 on error |
191 | | */ |
192 | | int libewf_source_get_utf8_name_size( |
193 | | libewf_source_t *source, |
194 | | size_t *utf8_string_size, |
195 | | libcerror_error_t **error ) |
196 | 0 | { |
197 | 0 | libewf_internal_source_t *internal_source = NULL; |
198 | 0 | static char *function = "libewf_source_get_utf8_name_size"; |
199 | 0 | int result = 0; |
200 | |
|
201 | 0 | if( source == NULL ) |
202 | 0 | { |
203 | 0 | libcerror_error_set( |
204 | 0 | error, |
205 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
206 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
207 | 0 | "%s: invalid access control entry.", |
208 | 0 | function ); |
209 | |
|
210 | 0 | return( -1 ); |
211 | 0 | } |
212 | 0 | internal_source = (libewf_internal_source_t *) source; |
213 | |
|
214 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
215 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
216 | 0 | internal_source->read_write_lock, |
217 | 0 | error ) != 1 ) |
218 | 0 | { |
219 | 0 | libcerror_error_set( |
220 | 0 | error, |
221 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
222 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
223 | 0 | "%s: unable to grab read/write lock for reading.", |
224 | 0 | function ); |
225 | |
|
226 | 0 | return( -1 ); |
227 | 0 | } |
228 | 0 | #endif |
229 | 0 | result = libewf_lef_source_get_utf8_name_size( |
230 | 0 | internal_source->lef_source, |
231 | 0 | utf8_string_size, |
232 | 0 | error ); |
233 | |
|
234 | 0 | if( result == -1 ) |
235 | 0 | { |
236 | 0 | libcerror_error_set( |
237 | 0 | error, |
238 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
239 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
240 | 0 | "%s: unable to retrieve UTF-8 name size.", |
241 | 0 | function ); |
242 | |
|
243 | 0 | result = -1; |
244 | 0 | } |
245 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
246 | 0 | if( libcthreads_read_write_lock_release_for_read( |
247 | 0 | internal_source->read_write_lock, |
248 | 0 | error ) != 1 ) |
249 | 0 | { |
250 | 0 | libcerror_error_set( |
251 | 0 | error, |
252 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
253 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
254 | 0 | "%s: unable to release read/write lock for reading.", |
255 | 0 | function ); |
256 | |
|
257 | 0 | return( -1 ); |
258 | 0 | } |
259 | 0 | #endif |
260 | 0 | return( result ); |
261 | 0 | } |
262 | | |
263 | | /* Retrieves the UTF-8 encoded name |
264 | | * The size should include the end of string character |
265 | | * Returns 1 if successful, 0 if not set or -1 on error |
266 | | */ |
267 | | int libewf_source_get_utf8_name( |
268 | | libewf_source_t *source, |
269 | | uint8_t *utf8_string, |
270 | | size_t utf8_string_size, |
271 | | libcerror_error_t **error ) |
272 | 0 | { |
273 | 0 | libewf_internal_source_t *internal_source = NULL; |
274 | 0 | static char *function = "libewf_source_get_utf8_name"; |
275 | 0 | int result = 0; |
276 | |
|
277 | 0 | if( source == NULL ) |
278 | 0 | { |
279 | 0 | libcerror_error_set( |
280 | 0 | error, |
281 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
282 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
283 | 0 | "%s: invalid access control entry.", |
284 | 0 | function ); |
285 | |
|
286 | 0 | return( -1 ); |
287 | 0 | } |
288 | 0 | internal_source = (libewf_internal_source_t *) source; |
289 | |
|
290 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
291 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
292 | 0 | internal_source->read_write_lock, |
293 | 0 | error ) != 1 ) |
294 | 0 | { |
295 | 0 | libcerror_error_set( |
296 | 0 | error, |
297 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
298 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
299 | 0 | "%s: unable to grab read/write lock for reading.", |
300 | 0 | function ); |
301 | |
|
302 | 0 | return( -1 ); |
303 | 0 | } |
304 | 0 | #endif |
305 | 0 | result = libewf_lef_source_get_utf8_name( |
306 | 0 | internal_source->lef_source, |
307 | 0 | utf8_string, |
308 | 0 | utf8_string_size, |
309 | 0 | error ); |
310 | |
|
311 | 0 | if( result == -1 ) |
312 | 0 | { |
313 | 0 | libcerror_error_set( |
314 | 0 | error, |
315 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
316 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
317 | 0 | "%s: unable to retrieve UTF-8 name size.", |
318 | 0 | function ); |
319 | |
|
320 | 0 | result = -1; |
321 | 0 | } |
322 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
323 | 0 | if( libcthreads_read_write_lock_release_for_read( |
324 | 0 | internal_source->read_write_lock, |
325 | 0 | error ) != 1 ) |
326 | 0 | { |
327 | 0 | libcerror_error_set( |
328 | 0 | error, |
329 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
330 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
331 | 0 | "%s: unable to release read/write lock for reading.", |
332 | 0 | function ); |
333 | |
|
334 | 0 | return( -1 ); |
335 | 0 | } |
336 | 0 | #endif |
337 | 0 | return( result ); |
338 | 0 | } |
339 | | |
340 | | /* Retrieves the size of the UTF-16 encoded name |
341 | | * The returned size includes the end of string character |
342 | | * Returns 1 if successful, 0 if not set or -1 on error |
343 | | */ |
344 | | int libewf_source_get_utf16_name_size( |
345 | | libewf_source_t *source, |
346 | | size_t *utf16_string_size, |
347 | | libcerror_error_t **error ) |
348 | 0 | { |
349 | 0 | libewf_internal_source_t *internal_source = NULL; |
350 | 0 | static char *function = "libewf_source_get_utf16_name_size"; |
351 | 0 | int result = 0; |
352 | |
|
353 | 0 | if( source == NULL ) |
354 | 0 | { |
355 | 0 | libcerror_error_set( |
356 | 0 | error, |
357 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
358 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
359 | 0 | "%s: invalid access control entry.", |
360 | 0 | function ); |
361 | |
|
362 | 0 | return( -1 ); |
363 | 0 | } |
364 | 0 | internal_source = (libewf_internal_source_t *) source; |
365 | |
|
366 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
367 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
368 | 0 | internal_source->read_write_lock, |
369 | 0 | error ) != 1 ) |
370 | 0 | { |
371 | 0 | libcerror_error_set( |
372 | 0 | error, |
373 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
374 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
375 | 0 | "%s: unable to grab read/write lock for reading.", |
376 | 0 | function ); |
377 | |
|
378 | 0 | return( -1 ); |
379 | 0 | } |
380 | 0 | #endif |
381 | 0 | result = libewf_lef_source_get_utf16_name_size( |
382 | 0 | internal_source->lef_source, |
383 | 0 | utf16_string_size, |
384 | 0 | error ); |
385 | |
|
386 | 0 | if( result == -1 ) |
387 | 0 | { |
388 | 0 | libcerror_error_set( |
389 | 0 | error, |
390 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
391 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
392 | 0 | "%s: unable to retrieve UTF-16 name size.", |
393 | 0 | function ); |
394 | |
|
395 | 0 | result = -1; |
396 | 0 | } |
397 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
398 | 0 | if( libcthreads_read_write_lock_release_for_read( |
399 | 0 | internal_source->read_write_lock, |
400 | 0 | error ) != 1 ) |
401 | 0 | { |
402 | 0 | libcerror_error_set( |
403 | 0 | error, |
404 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
405 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
406 | 0 | "%s: unable to release read/write lock for reading.", |
407 | 0 | function ); |
408 | |
|
409 | 0 | return( -1 ); |
410 | 0 | } |
411 | 0 | #endif |
412 | 0 | return( result ); |
413 | 0 | } |
414 | | |
415 | | /* Retrieves the UTF-16 encoded name |
416 | | * The size should include the end of string character |
417 | | * Returns 1 if successful, 0 if not set or -1 on error |
418 | | */ |
419 | | int libewf_source_get_utf16_name( |
420 | | libewf_source_t *source, |
421 | | uint16_t *utf16_string, |
422 | | size_t utf16_string_size, |
423 | | libcerror_error_t **error ) |
424 | 0 | { |
425 | 0 | libewf_internal_source_t *internal_source = NULL; |
426 | 0 | static char *function = "libewf_source_get_utf16_name"; |
427 | 0 | int result = 0; |
428 | |
|
429 | 0 | if( source == NULL ) |
430 | 0 | { |
431 | 0 | libcerror_error_set( |
432 | 0 | error, |
433 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
434 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
435 | 0 | "%s: invalid access control entry.", |
436 | 0 | function ); |
437 | |
|
438 | 0 | return( -1 ); |
439 | 0 | } |
440 | 0 | internal_source = (libewf_internal_source_t *) source; |
441 | |
|
442 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
443 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
444 | 0 | internal_source->read_write_lock, |
445 | 0 | error ) != 1 ) |
446 | 0 | { |
447 | 0 | libcerror_error_set( |
448 | 0 | error, |
449 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
450 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
451 | 0 | "%s: unable to grab read/write lock for reading.", |
452 | 0 | function ); |
453 | |
|
454 | 0 | return( -1 ); |
455 | 0 | } |
456 | 0 | #endif |
457 | 0 | result = libewf_lef_source_get_utf16_name( |
458 | 0 | internal_source->lef_source, |
459 | 0 | utf16_string, |
460 | 0 | utf16_string_size, |
461 | 0 | error ); |
462 | |
|
463 | 0 | if( result == -1 ) |
464 | 0 | { |
465 | 0 | libcerror_error_set( |
466 | 0 | error, |
467 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
468 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
469 | 0 | "%s: unable to retrieve UTF-16 name size.", |
470 | 0 | function ); |
471 | |
|
472 | 0 | result = -1; |
473 | 0 | } |
474 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
475 | 0 | if( libcthreads_read_write_lock_release_for_read( |
476 | 0 | internal_source->read_write_lock, |
477 | 0 | error ) != 1 ) |
478 | 0 | { |
479 | 0 | libcerror_error_set( |
480 | 0 | error, |
481 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
482 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
483 | 0 | "%s: unable to release read/write lock for reading.", |
484 | 0 | function ); |
485 | |
|
486 | 0 | return( -1 ); |
487 | 0 | } |
488 | 0 | #endif |
489 | 0 | return( result ); |
490 | 0 | } |
491 | | |
492 | | /* Retrieves the size of the UTF-8 encoded evidence number |
493 | | * The returned size includes the end of string character |
494 | | * Returns 1 if successful, 0 if not set or -1 on error |
495 | | */ |
496 | | int libewf_source_get_utf8_evidence_number_size( |
497 | | libewf_source_t *source, |
498 | | size_t *utf8_string_size, |
499 | | libcerror_error_t **error ) |
500 | 0 | { |
501 | 0 | libewf_internal_source_t *internal_source = NULL; |
502 | 0 | static char *function = "libewf_source_get_utf8_evidence_number_size"; |
503 | 0 | int result = 0; |
504 | |
|
505 | 0 | if( source == NULL ) |
506 | 0 | { |
507 | 0 | libcerror_error_set( |
508 | 0 | error, |
509 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
510 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
511 | 0 | "%s: invalid access control entry.", |
512 | 0 | function ); |
513 | |
|
514 | 0 | return( -1 ); |
515 | 0 | } |
516 | 0 | internal_source = (libewf_internal_source_t *) source; |
517 | |
|
518 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
519 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
520 | 0 | internal_source->read_write_lock, |
521 | 0 | error ) != 1 ) |
522 | 0 | { |
523 | 0 | libcerror_error_set( |
524 | 0 | error, |
525 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
526 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
527 | 0 | "%s: unable to grab read/write lock for reading.", |
528 | 0 | function ); |
529 | |
|
530 | 0 | return( -1 ); |
531 | 0 | } |
532 | 0 | #endif |
533 | 0 | result = libewf_lef_source_get_utf8_evidence_number_size( |
534 | 0 | internal_source->lef_source, |
535 | 0 | utf8_string_size, |
536 | 0 | error ); |
537 | |
|
538 | 0 | if( result == -1 ) |
539 | 0 | { |
540 | 0 | libcerror_error_set( |
541 | 0 | error, |
542 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
543 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
544 | 0 | "%s: unable to retrieve UTF-8 evidence number size.", |
545 | 0 | function ); |
546 | |
|
547 | 0 | result = -1; |
548 | 0 | } |
549 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
550 | 0 | if( libcthreads_read_write_lock_release_for_read( |
551 | 0 | internal_source->read_write_lock, |
552 | 0 | error ) != 1 ) |
553 | 0 | { |
554 | 0 | libcerror_error_set( |
555 | 0 | error, |
556 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
557 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
558 | 0 | "%s: unable to release read/write lock for reading.", |
559 | 0 | function ); |
560 | |
|
561 | 0 | return( -1 ); |
562 | 0 | } |
563 | 0 | #endif |
564 | 0 | return( result ); |
565 | 0 | } |
566 | | |
567 | | /* Retrieves the UTF-8 encoded evidence number |
568 | | * The size should include the end of string character |
569 | | * Returns 1 if successful, 0 if not set or -1 on error |
570 | | */ |
571 | | int libewf_source_get_utf8_evidence_number( |
572 | | libewf_source_t *source, |
573 | | uint8_t *utf8_string, |
574 | | size_t utf8_string_size, |
575 | | libcerror_error_t **error ) |
576 | 0 | { |
577 | 0 | libewf_internal_source_t *internal_source = NULL; |
578 | 0 | static char *function = "libewf_source_get_utf8_evidence_number"; |
579 | 0 | int result = 0; |
580 | |
|
581 | 0 | if( source == NULL ) |
582 | 0 | { |
583 | 0 | libcerror_error_set( |
584 | 0 | error, |
585 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
586 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
587 | 0 | "%s: invalid access control entry.", |
588 | 0 | function ); |
589 | |
|
590 | 0 | return( -1 ); |
591 | 0 | } |
592 | 0 | internal_source = (libewf_internal_source_t *) source; |
593 | |
|
594 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
595 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
596 | 0 | internal_source->read_write_lock, |
597 | 0 | error ) != 1 ) |
598 | 0 | { |
599 | 0 | libcerror_error_set( |
600 | 0 | error, |
601 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
602 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
603 | 0 | "%s: unable to grab read/write lock for reading.", |
604 | 0 | function ); |
605 | |
|
606 | 0 | return( -1 ); |
607 | 0 | } |
608 | 0 | #endif |
609 | 0 | result = libewf_lef_source_get_utf8_evidence_number( |
610 | 0 | internal_source->lef_source, |
611 | 0 | utf8_string, |
612 | 0 | utf8_string_size, |
613 | 0 | error ); |
614 | |
|
615 | 0 | if( result == -1 ) |
616 | 0 | { |
617 | 0 | libcerror_error_set( |
618 | 0 | error, |
619 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
620 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
621 | 0 | "%s: unable to retrieve UTF-8 evidence number size.", |
622 | 0 | function ); |
623 | |
|
624 | 0 | result = -1; |
625 | 0 | } |
626 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
627 | 0 | if( libcthreads_read_write_lock_release_for_read( |
628 | 0 | internal_source->read_write_lock, |
629 | 0 | error ) != 1 ) |
630 | 0 | { |
631 | 0 | libcerror_error_set( |
632 | 0 | error, |
633 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
634 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
635 | 0 | "%s: unable to release read/write lock for reading.", |
636 | 0 | function ); |
637 | |
|
638 | 0 | return( -1 ); |
639 | 0 | } |
640 | 0 | #endif |
641 | 0 | return( result ); |
642 | 0 | } |
643 | | |
644 | | /* Retrieves the size of the UTF-16 encoded evidence number |
645 | | * The returned size includes the end of string character |
646 | | * Returns 1 if successful, 0 if not set or -1 on error |
647 | | */ |
648 | | int libewf_source_get_utf16_evidence_number_size( |
649 | | libewf_source_t *source, |
650 | | size_t *utf16_string_size, |
651 | | libcerror_error_t **error ) |
652 | 0 | { |
653 | 0 | libewf_internal_source_t *internal_source = NULL; |
654 | 0 | static char *function = "libewf_source_get_utf16_evidence_number_size"; |
655 | 0 | int result = 0; |
656 | |
|
657 | 0 | if( source == NULL ) |
658 | 0 | { |
659 | 0 | libcerror_error_set( |
660 | 0 | error, |
661 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
662 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
663 | 0 | "%s: invalid access control entry.", |
664 | 0 | function ); |
665 | |
|
666 | 0 | return( -1 ); |
667 | 0 | } |
668 | 0 | internal_source = (libewf_internal_source_t *) source; |
669 | |
|
670 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
671 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
672 | 0 | internal_source->read_write_lock, |
673 | 0 | error ) != 1 ) |
674 | 0 | { |
675 | 0 | libcerror_error_set( |
676 | 0 | error, |
677 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
678 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
679 | 0 | "%s: unable to grab read/write lock for reading.", |
680 | 0 | function ); |
681 | |
|
682 | 0 | return( -1 ); |
683 | 0 | } |
684 | 0 | #endif |
685 | 0 | result = libewf_lef_source_get_utf16_evidence_number_size( |
686 | 0 | internal_source->lef_source, |
687 | 0 | utf16_string_size, |
688 | 0 | error ); |
689 | |
|
690 | 0 | if( result == -1 ) |
691 | 0 | { |
692 | 0 | libcerror_error_set( |
693 | 0 | error, |
694 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
695 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
696 | 0 | "%s: unable to retrieve UTF-16 evidence number size.", |
697 | 0 | function ); |
698 | |
|
699 | 0 | result = -1; |
700 | 0 | } |
701 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
702 | 0 | if( libcthreads_read_write_lock_release_for_read( |
703 | 0 | internal_source->read_write_lock, |
704 | 0 | error ) != 1 ) |
705 | 0 | { |
706 | 0 | libcerror_error_set( |
707 | 0 | error, |
708 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
709 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
710 | 0 | "%s: unable to release read/write lock for reading.", |
711 | 0 | function ); |
712 | |
|
713 | 0 | return( -1 ); |
714 | 0 | } |
715 | 0 | #endif |
716 | 0 | return( result ); |
717 | 0 | } |
718 | | |
719 | | /* Retrieves the UTF-16 encoded evidence number |
720 | | * The size should include the end of string character |
721 | | * Returns 1 if successful, 0 if not set or -1 on error |
722 | | */ |
723 | | int libewf_source_get_utf16_evidence_number( |
724 | | libewf_source_t *source, |
725 | | uint16_t *utf16_string, |
726 | | size_t utf16_string_size, |
727 | | libcerror_error_t **error ) |
728 | 0 | { |
729 | 0 | libewf_internal_source_t *internal_source = NULL; |
730 | 0 | static char *function = "libewf_source_get_utf16_evidence_number"; |
731 | 0 | int result = 0; |
732 | |
|
733 | 0 | if( source == NULL ) |
734 | 0 | { |
735 | 0 | libcerror_error_set( |
736 | 0 | error, |
737 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
738 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
739 | 0 | "%s: invalid access control entry.", |
740 | 0 | function ); |
741 | |
|
742 | 0 | return( -1 ); |
743 | 0 | } |
744 | 0 | internal_source = (libewf_internal_source_t *) source; |
745 | |
|
746 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
747 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
748 | 0 | internal_source->read_write_lock, |
749 | 0 | error ) != 1 ) |
750 | 0 | { |
751 | 0 | libcerror_error_set( |
752 | 0 | error, |
753 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
754 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
755 | 0 | "%s: unable to grab read/write lock for reading.", |
756 | 0 | function ); |
757 | |
|
758 | 0 | return( -1 ); |
759 | 0 | } |
760 | 0 | #endif |
761 | 0 | result = libewf_lef_source_get_utf16_evidence_number( |
762 | 0 | internal_source->lef_source, |
763 | 0 | utf16_string, |
764 | 0 | utf16_string_size, |
765 | 0 | error ); |
766 | |
|
767 | 0 | if( result == -1 ) |
768 | 0 | { |
769 | 0 | libcerror_error_set( |
770 | 0 | error, |
771 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
772 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
773 | 0 | "%s: unable to retrieve UTF-16 evidence number size.", |
774 | 0 | function ); |
775 | |
|
776 | 0 | result = -1; |
777 | 0 | } |
778 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
779 | 0 | if( libcthreads_read_write_lock_release_for_read( |
780 | 0 | internal_source->read_write_lock, |
781 | 0 | error ) != 1 ) |
782 | 0 | { |
783 | 0 | libcerror_error_set( |
784 | 0 | error, |
785 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
786 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
787 | 0 | "%s: unable to release read/write lock for reading.", |
788 | 0 | function ); |
789 | |
|
790 | 0 | return( -1 ); |
791 | 0 | } |
792 | 0 | #endif |
793 | 0 | return( result ); |
794 | 0 | } |
795 | | |
796 | | /* Retrieves the size of the UTF-8 encoded location |
797 | | * The returned size includes the end of string character |
798 | | * Returns 1 if successful, 0 if not set or -1 on error |
799 | | */ |
800 | | int libewf_source_get_utf8_location_size( |
801 | | libewf_source_t *source, |
802 | | size_t *utf8_string_size, |
803 | | libcerror_error_t **error ) |
804 | 0 | { |
805 | 0 | libewf_internal_source_t *internal_source = NULL; |
806 | 0 | static char *function = "libewf_source_get_utf8_location_size"; |
807 | 0 | int result = 0; |
808 | |
|
809 | 0 | if( source == NULL ) |
810 | 0 | { |
811 | 0 | libcerror_error_set( |
812 | 0 | error, |
813 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
814 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
815 | 0 | "%s: invalid access control entry.", |
816 | 0 | function ); |
817 | |
|
818 | 0 | return( -1 ); |
819 | 0 | } |
820 | 0 | internal_source = (libewf_internal_source_t *) source; |
821 | |
|
822 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
823 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
824 | 0 | internal_source->read_write_lock, |
825 | 0 | error ) != 1 ) |
826 | 0 | { |
827 | 0 | libcerror_error_set( |
828 | 0 | error, |
829 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
830 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
831 | 0 | "%s: unable to grab read/write lock for reading.", |
832 | 0 | function ); |
833 | |
|
834 | 0 | return( -1 ); |
835 | 0 | } |
836 | 0 | #endif |
837 | 0 | result = libewf_lef_source_get_utf8_location_size( |
838 | 0 | internal_source->lef_source, |
839 | 0 | utf8_string_size, |
840 | 0 | error ); |
841 | |
|
842 | 0 | if( result == -1 ) |
843 | 0 | { |
844 | 0 | libcerror_error_set( |
845 | 0 | error, |
846 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
847 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
848 | 0 | "%s: unable to retrieve UTF-8 location size.", |
849 | 0 | function ); |
850 | |
|
851 | 0 | result = -1; |
852 | 0 | } |
853 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
854 | 0 | if( libcthreads_read_write_lock_release_for_read( |
855 | 0 | internal_source->read_write_lock, |
856 | 0 | error ) != 1 ) |
857 | 0 | { |
858 | 0 | libcerror_error_set( |
859 | 0 | error, |
860 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
861 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
862 | 0 | "%s: unable to release read/write lock for reading.", |
863 | 0 | function ); |
864 | |
|
865 | 0 | return( -1 ); |
866 | 0 | } |
867 | 0 | #endif |
868 | 0 | return( result ); |
869 | 0 | } |
870 | | |
871 | | /* Retrieves the UTF-8 encoded location |
872 | | * The size should include the end of string character |
873 | | * Returns 1 if successful, 0 if not set or -1 on error |
874 | | */ |
875 | | int libewf_source_get_utf8_location( |
876 | | libewf_source_t *source, |
877 | | uint8_t *utf8_string, |
878 | | size_t utf8_string_size, |
879 | | libcerror_error_t **error ) |
880 | 0 | { |
881 | 0 | libewf_internal_source_t *internal_source = NULL; |
882 | 0 | static char *function = "libewf_source_get_utf8_location"; |
883 | 0 | int result = 0; |
884 | |
|
885 | 0 | if( source == NULL ) |
886 | 0 | { |
887 | 0 | libcerror_error_set( |
888 | 0 | error, |
889 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
890 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
891 | 0 | "%s: invalid access control entry.", |
892 | 0 | function ); |
893 | |
|
894 | 0 | return( -1 ); |
895 | 0 | } |
896 | 0 | internal_source = (libewf_internal_source_t *) source; |
897 | |
|
898 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
899 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
900 | 0 | internal_source->read_write_lock, |
901 | 0 | error ) != 1 ) |
902 | 0 | { |
903 | 0 | libcerror_error_set( |
904 | 0 | error, |
905 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
906 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
907 | 0 | "%s: unable to grab read/write lock for reading.", |
908 | 0 | function ); |
909 | |
|
910 | 0 | return( -1 ); |
911 | 0 | } |
912 | 0 | #endif |
913 | 0 | result = libewf_lef_source_get_utf8_location( |
914 | 0 | internal_source->lef_source, |
915 | 0 | utf8_string, |
916 | 0 | utf8_string_size, |
917 | 0 | error ); |
918 | |
|
919 | 0 | if( result == -1 ) |
920 | 0 | { |
921 | 0 | libcerror_error_set( |
922 | 0 | error, |
923 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
924 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
925 | 0 | "%s: unable to retrieve UTF-8 location size.", |
926 | 0 | function ); |
927 | |
|
928 | 0 | result = -1; |
929 | 0 | } |
930 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
931 | 0 | if( libcthreads_read_write_lock_release_for_read( |
932 | 0 | internal_source->read_write_lock, |
933 | 0 | error ) != 1 ) |
934 | 0 | { |
935 | 0 | libcerror_error_set( |
936 | 0 | error, |
937 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
938 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
939 | 0 | "%s: unable to release read/write lock for reading.", |
940 | 0 | function ); |
941 | |
|
942 | 0 | return( -1 ); |
943 | 0 | } |
944 | 0 | #endif |
945 | 0 | return( result ); |
946 | 0 | } |
947 | | |
948 | | /* Retrieves the size of the UTF-16 encoded location |
949 | | * The returned size includes the end of string character |
950 | | * Returns 1 if successful, 0 if not set or -1 on error |
951 | | */ |
952 | | int libewf_source_get_utf16_location_size( |
953 | | libewf_source_t *source, |
954 | | size_t *utf16_string_size, |
955 | | libcerror_error_t **error ) |
956 | 0 | { |
957 | 0 | libewf_internal_source_t *internal_source = NULL; |
958 | 0 | static char *function = "libewf_source_get_utf16_location_size"; |
959 | 0 | int result = 0; |
960 | |
|
961 | 0 | if( source == NULL ) |
962 | 0 | { |
963 | 0 | libcerror_error_set( |
964 | 0 | error, |
965 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
966 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
967 | 0 | "%s: invalid access control entry.", |
968 | 0 | function ); |
969 | |
|
970 | 0 | return( -1 ); |
971 | 0 | } |
972 | 0 | internal_source = (libewf_internal_source_t *) source; |
973 | |
|
974 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
975 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
976 | 0 | internal_source->read_write_lock, |
977 | 0 | error ) != 1 ) |
978 | 0 | { |
979 | 0 | libcerror_error_set( |
980 | 0 | error, |
981 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
982 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
983 | 0 | "%s: unable to grab read/write lock for reading.", |
984 | 0 | function ); |
985 | |
|
986 | 0 | return( -1 ); |
987 | 0 | } |
988 | 0 | #endif |
989 | 0 | result = libewf_lef_source_get_utf16_location_size( |
990 | 0 | internal_source->lef_source, |
991 | 0 | utf16_string_size, |
992 | 0 | error ); |
993 | |
|
994 | 0 | if( result == -1 ) |
995 | 0 | { |
996 | 0 | libcerror_error_set( |
997 | 0 | error, |
998 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
999 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1000 | 0 | "%s: unable to retrieve UTF-16 location size.", |
1001 | 0 | function ); |
1002 | |
|
1003 | 0 | result = -1; |
1004 | 0 | } |
1005 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1006 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1007 | 0 | internal_source->read_write_lock, |
1008 | 0 | error ) != 1 ) |
1009 | 0 | { |
1010 | 0 | libcerror_error_set( |
1011 | 0 | error, |
1012 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1013 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1014 | 0 | "%s: unable to release read/write lock for reading.", |
1015 | 0 | function ); |
1016 | |
|
1017 | 0 | return( -1 ); |
1018 | 0 | } |
1019 | 0 | #endif |
1020 | 0 | return( result ); |
1021 | 0 | } |
1022 | | |
1023 | | /* Retrieves the UTF-16 encoded location |
1024 | | * The size should include the end of string character |
1025 | | * Returns 1 if successful, 0 if not set or -1 on error |
1026 | | */ |
1027 | | int libewf_source_get_utf16_location( |
1028 | | libewf_source_t *source, |
1029 | | uint16_t *utf16_string, |
1030 | | size_t utf16_string_size, |
1031 | | libcerror_error_t **error ) |
1032 | 0 | { |
1033 | 0 | libewf_internal_source_t *internal_source = NULL; |
1034 | 0 | static char *function = "libewf_source_get_utf16_location"; |
1035 | 0 | int result = 0; |
1036 | |
|
1037 | 0 | if( source == NULL ) |
1038 | 0 | { |
1039 | 0 | libcerror_error_set( |
1040 | 0 | error, |
1041 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1042 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1043 | 0 | "%s: invalid access control entry.", |
1044 | 0 | function ); |
1045 | |
|
1046 | 0 | return( -1 ); |
1047 | 0 | } |
1048 | 0 | internal_source = (libewf_internal_source_t *) source; |
1049 | |
|
1050 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1051 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1052 | 0 | internal_source->read_write_lock, |
1053 | 0 | error ) != 1 ) |
1054 | 0 | { |
1055 | 0 | libcerror_error_set( |
1056 | 0 | error, |
1057 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1058 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1059 | 0 | "%s: unable to grab read/write lock for reading.", |
1060 | 0 | function ); |
1061 | |
|
1062 | 0 | return( -1 ); |
1063 | 0 | } |
1064 | 0 | #endif |
1065 | 0 | result = libewf_lef_source_get_utf16_location( |
1066 | 0 | internal_source->lef_source, |
1067 | 0 | utf16_string, |
1068 | 0 | utf16_string_size, |
1069 | 0 | error ); |
1070 | |
|
1071 | 0 | if( result == -1 ) |
1072 | 0 | { |
1073 | 0 | libcerror_error_set( |
1074 | 0 | error, |
1075 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1076 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1077 | 0 | "%s: unable to retrieve UTF-16 location size.", |
1078 | 0 | function ); |
1079 | |
|
1080 | 0 | result = -1; |
1081 | 0 | } |
1082 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1083 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1084 | 0 | internal_source->read_write_lock, |
1085 | 0 | error ) != 1 ) |
1086 | 0 | { |
1087 | 0 | libcerror_error_set( |
1088 | 0 | error, |
1089 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1090 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1091 | 0 | "%s: unable to release read/write lock for reading.", |
1092 | 0 | function ); |
1093 | |
|
1094 | 0 | return( -1 ); |
1095 | 0 | } |
1096 | 0 | #endif |
1097 | 0 | return( result ); |
1098 | 0 | } |
1099 | | |
1100 | | /* Retrieves the size of the UTF-8 encoded device GUID |
1101 | | * The returned size includes the end of string character |
1102 | | * Returns 1 if successful, 0 if not set or -1 on error |
1103 | | */ |
1104 | | int libewf_source_get_utf8_device_guid_size( |
1105 | | libewf_source_t *source, |
1106 | | size_t *utf8_string_size, |
1107 | | libcerror_error_t **error ) |
1108 | 0 | { |
1109 | 0 | libewf_internal_source_t *internal_source = NULL; |
1110 | 0 | static char *function = "libewf_source_get_utf8_device_guid_size"; |
1111 | 0 | int result = 0; |
1112 | |
|
1113 | 0 | if( source == NULL ) |
1114 | 0 | { |
1115 | 0 | libcerror_error_set( |
1116 | 0 | error, |
1117 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1118 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1119 | 0 | "%s: invalid access control entry.", |
1120 | 0 | function ); |
1121 | |
|
1122 | 0 | return( -1 ); |
1123 | 0 | } |
1124 | 0 | internal_source = (libewf_internal_source_t *) source; |
1125 | |
|
1126 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1127 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1128 | 0 | internal_source->read_write_lock, |
1129 | 0 | error ) != 1 ) |
1130 | 0 | { |
1131 | 0 | libcerror_error_set( |
1132 | 0 | error, |
1133 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1134 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1135 | 0 | "%s: unable to grab read/write lock for reading.", |
1136 | 0 | function ); |
1137 | |
|
1138 | 0 | return( -1 ); |
1139 | 0 | } |
1140 | 0 | #endif |
1141 | 0 | result = libewf_lef_source_get_utf8_device_guid_size( |
1142 | 0 | internal_source->lef_source, |
1143 | 0 | utf8_string_size, |
1144 | 0 | error ); |
1145 | |
|
1146 | 0 | if( result == -1 ) |
1147 | 0 | { |
1148 | 0 | libcerror_error_set( |
1149 | 0 | error, |
1150 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1151 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1152 | 0 | "%s: unable to retrieve UTF-8 device GUID size.", |
1153 | 0 | function ); |
1154 | |
|
1155 | 0 | result = -1; |
1156 | 0 | } |
1157 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1158 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1159 | 0 | internal_source->read_write_lock, |
1160 | 0 | error ) != 1 ) |
1161 | 0 | { |
1162 | 0 | libcerror_error_set( |
1163 | 0 | error, |
1164 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1165 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1166 | 0 | "%s: unable to release read/write lock for reading.", |
1167 | 0 | function ); |
1168 | |
|
1169 | 0 | return( -1 ); |
1170 | 0 | } |
1171 | 0 | #endif |
1172 | 0 | return( result ); |
1173 | 0 | } |
1174 | | |
1175 | | /* Retrieves the UTF-8 encoded device GUID |
1176 | | * The size should include the end of string character |
1177 | | * Returns 1 if successful, 0 if not set or -1 on error |
1178 | | */ |
1179 | | int libewf_source_get_utf8_device_guid( |
1180 | | libewf_source_t *source, |
1181 | | uint8_t *utf8_string, |
1182 | | size_t utf8_string_size, |
1183 | | libcerror_error_t **error ) |
1184 | 0 | { |
1185 | 0 | libewf_internal_source_t *internal_source = NULL; |
1186 | 0 | static char *function = "libewf_source_get_utf8_device_guid"; |
1187 | 0 | int result = 0; |
1188 | |
|
1189 | 0 | if( source == NULL ) |
1190 | 0 | { |
1191 | 0 | libcerror_error_set( |
1192 | 0 | error, |
1193 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1194 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1195 | 0 | "%s: invalid access control entry.", |
1196 | 0 | function ); |
1197 | |
|
1198 | 0 | return( -1 ); |
1199 | 0 | } |
1200 | 0 | internal_source = (libewf_internal_source_t *) source; |
1201 | |
|
1202 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1203 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1204 | 0 | internal_source->read_write_lock, |
1205 | 0 | error ) != 1 ) |
1206 | 0 | { |
1207 | 0 | libcerror_error_set( |
1208 | 0 | error, |
1209 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1210 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1211 | 0 | "%s: unable to grab read/write lock for reading.", |
1212 | 0 | function ); |
1213 | |
|
1214 | 0 | return( -1 ); |
1215 | 0 | } |
1216 | 0 | #endif |
1217 | 0 | result = libewf_lef_source_get_utf8_device_guid( |
1218 | 0 | internal_source->lef_source, |
1219 | 0 | utf8_string, |
1220 | 0 | utf8_string_size, |
1221 | 0 | error ); |
1222 | |
|
1223 | 0 | if( result == -1 ) |
1224 | 0 | { |
1225 | 0 | libcerror_error_set( |
1226 | 0 | error, |
1227 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1228 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1229 | 0 | "%s: unable to retrieve UTF-8 device GUID size.", |
1230 | 0 | function ); |
1231 | |
|
1232 | 0 | result = -1; |
1233 | 0 | } |
1234 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1235 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1236 | 0 | internal_source->read_write_lock, |
1237 | 0 | error ) != 1 ) |
1238 | 0 | { |
1239 | 0 | libcerror_error_set( |
1240 | 0 | error, |
1241 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1242 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1243 | 0 | "%s: unable to release read/write lock for reading.", |
1244 | 0 | function ); |
1245 | |
|
1246 | 0 | return( -1 ); |
1247 | 0 | } |
1248 | 0 | #endif |
1249 | 0 | return( result ); |
1250 | 0 | } |
1251 | | |
1252 | | /* Retrieves the size of the UTF-16 encoded device GUID |
1253 | | * The returned size includes the end of string character |
1254 | | * Returns 1 if successful, 0 if not set or -1 on error |
1255 | | */ |
1256 | | int libewf_source_get_utf16_device_guid_size( |
1257 | | libewf_source_t *source, |
1258 | | size_t *utf16_string_size, |
1259 | | libcerror_error_t **error ) |
1260 | 0 | { |
1261 | 0 | libewf_internal_source_t *internal_source = NULL; |
1262 | 0 | static char *function = "libewf_source_get_utf16_device_guid_size"; |
1263 | 0 | int result = 0; |
1264 | |
|
1265 | 0 | if( source == NULL ) |
1266 | 0 | { |
1267 | 0 | libcerror_error_set( |
1268 | 0 | error, |
1269 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1270 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1271 | 0 | "%s: invalid access control entry.", |
1272 | 0 | function ); |
1273 | |
|
1274 | 0 | return( -1 ); |
1275 | 0 | } |
1276 | 0 | internal_source = (libewf_internal_source_t *) source; |
1277 | |
|
1278 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1279 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1280 | 0 | internal_source->read_write_lock, |
1281 | 0 | error ) != 1 ) |
1282 | 0 | { |
1283 | 0 | libcerror_error_set( |
1284 | 0 | error, |
1285 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1286 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1287 | 0 | "%s: unable to grab read/write lock for reading.", |
1288 | 0 | function ); |
1289 | |
|
1290 | 0 | return( -1 ); |
1291 | 0 | } |
1292 | 0 | #endif |
1293 | 0 | result = libewf_lef_source_get_utf16_device_guid_size( |
1294 | 0 | internal_source->lef_source, |
1295 | 0 | utf16_string_size, |
1296 | 0 | error ); |
1297 | |
|
1298 | 0 | if( result == -1 ) |
1299 | 0 | { |
1300 | 0 | libcerror_error_set( |
1301 | 0 | error, |
1302 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1303 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1304 | 0 | "%s: unable to retrieve UTF-16 device GUID size.", |
1305 | 0 | function ); |
1306 | |
|
1307 | 0 | result = -1; |
1308 | 0 | } |
1309 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1310 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1311 | 0 | internal_source->read_write_lock, |
1312 | 0 | error ) != 1 ) |
1313 | 0 | { |
1314 | 0 | libcerror_error_set( |
1315 | 0 | error, |
1316 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1317 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1318 | 0 | "%s: unable to release read/write lock for reading.", |
1319 | 0 | function ); |
1320 | |
|
1321 | 0 | return( -1 ); |
1322 | 0 | } |
1323 | 0 | #endif |
1324 | 0 | return( result ); |
1325 | 0 | } |
1326 | | |
1327 | | /* Retrieves the UTF-16 encoded device GUID |
1328 | | * The size should include the end of string character |
1329 | | * Returns 1 if successful, 0 if not set or -1 on error |
1330 | | */ |
1331 | | int libewf_source_get_utf16_device_guid( |
1332 | | libewf_source_t *source, |
1333 | | uint16_t *utf16_string, |
1334 | | size_t utf16_string_size, |
1335 | | libcerror_error_t **error ) |
1336 | 0 | { |
1337 | 0 | libewf_internal_source_t *internal_source = NULL; |
1338 | 0 | static char *function = "libewf_source_get_utf16_device_guid"; |
1339 | 0 | int result = 0; |
1340 | |
|
1341 | 0 | if( source == NULL ) |
1342 | 0 | { |
1343 | 0 | libcerror_error_set( |
1344 | 0 | error, |
1345 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1346 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1347 | 0 | "%s: invalid access control entry.", |
1348 | 0 | function ); |
1349 | |
|
1350 | 0 | return( -1 ); |
1351 | 0 | } |
1352 | 0 | internal_source = (libewf_internal_source_t *) source; |
1353 | |
|
1354 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1355 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1356 | 0 | internal_source->read_write_lock, |
1357 | 0 | error ) != 1 ) |
1358 | 0 | { |
1359 | 0 | libcerror_error_set( |
1360 | 0 | error, |
1361 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1362 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1363 | 0 | "%s: unable to grab read/write lock for reading.", |
1364 | 0 | function ); |
1365 | |
|
1366 | 0 | return( -1 ); |
1367 | 0 | } |
1368 | 0 | #endif |
1369 | 0 | result = libewf_lef_source_get_utf16_device_guid( |
1370 | 0 | internal_source->lef_source, |
1371 | 0 | utf16_string, |
1372 | 0 | utf16_string_size, |
1373 | 0 | error ); |
1374 | |
|
1375 | 0 | if( result == -1 ) |
1376 | 0 | { |
1377 | 0 | libcerror_error_set( |
1378 | 0 | error, |
1379 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1380 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1381 | 0 | "%s: unable to retrieve UTF-16 device GUID size.", |
1382 | 0 | function ); |
1383 | |
|
1384 | 0 | result = -1; |
1385 | 0 | } |
1386 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1387 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1388 | 0 | internal_source->read_write_lock, |
1389 | 0 | error ) != 1 ) |
1390 | 0 | { |
1391 | 0 | libcerror_error_set( |
1392 | 0 | error, |
1393 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1394 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1395 | 0 | "%s: unable to release read/write lock for reading.", |
1396 | 0 | function ); |
1397 | |
|
1398 | 0 | return( -1 ); |
1399 | 0 | } |
1400 | 0 | #endif |
1401 | 0 | return( result ); |
1402 | 0 | } |
1403 | | |
1404 | | /* Retrieves the size of the UTF-8 encoded primary device GUID |
1405 | | * The returned size includes the end of string character |
1406 | | * Returns 1 if successful, 0 if not set or -1 on error |
1407 | | */ |
1408 | | int libewf_source_get_utf8_primary_device_guid_size( |
1409 | | libewf_source_t *source, |
1410 | | size_t *utf8_string_size, |
1411 | | libcerror_error_t **error ) |
1412 | 0 | { |
1413 | 0 | libewf_internal_source_t *internal_source = NULL; |
1414 | 0 | static char *function = "libewf_source_get_utf8_primary_device_guid_size"; |
1415 | 0 | int result = 0; |
1416 | |
|
1417 | 0 | if( source == NULL ) |
1418 | 0 | { |
1419 | 0 | libcerror_error_set( |
1420 | 0 | error, |
1421 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1422 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1423 | 0 | "%s: invalid access control entry.", |
1424 | 0 | function ); |
1425 | |
|
1426 | 0 | return( -1 ); |
1427 | 0 | } |
1428 | 0 | internal_source = (libewf_internal_source_t *) source; |
1429 | |
|
1430 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1431 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1432 | 0 | internal_source->read_write_lock, |
1433 | 0 | error ) != 1 ) |
1434 | 0 | { |
1435 | 0 | libcerror_error_set( |
1436 | 0 | error, |
1437 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1438 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1439 | 0 | "%s: unable to grab read/write lock for reading.", |
1440 | 0 | function ); |
1441 | |
|
1442 | 0 | return( -1 ); |
1443 | 0 | } |
1444 | 0 | #endif |
1445 | 0 | result = libewf_lef_source_get_utf8_primary_device_guid_size( |
1446 | 0 | internal_source->lef_source, |
1447 | 0 | utf8_string_size, |
1448 | 0 | error ); |
1449 | |
|
1450 | 0 | if( result == -1 ) |
1451 | 0 | { |
1452 | 0 | libcerror_error_set( |
1453 | 0 | error, |
1454 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1455 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1456 | 0 | "%s: unable to retrieve UTF-8 primary device GUID size.", |
1457 | 0 | function ); |
1458 | |
|
1459 | 0 | result = -1; |
1460 | 0 | } |
1461 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1462 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1463 | 0 | internal_source->read_write_lock, |
1464 | 0 | error ) != 1 ) |
1465 | 0 | { |
1466 | 0 | libcerror_error_set( |
1467 | 0 | error, |
1468 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1469 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1470 | 0 | "%s: unable to release read/write lock for reading.", |
1471 | 0 | function ); |
1472 | |
|
1473 | 0 | return( -1 ); |
1474 | 0 | } |
1475 | 0 | #endif |
1476 | 0 | return( result ); |
1477 | 0 | } |
1478 | | |
1479 | | /* Retrieves the UTF-8 encoded primary device GUID |
1480 | | * The size should include the end of string character |
1481 | | * Returns 1 if successful, 0 if not set or -1 on error |
1482 | | */ |
1483 | | int libewf_source_get_utf8_primary_device_guid( |
1484 | | libewf_source_t *source, |
1485 | | uint8_t *utf8_string, |
1486 | | size_t utf8_string_size, |
1487 | | libcerror_error_t **error ) |
1488 | 0 | { |
1489 | 0 | libewf_internal_source_t *internal_source = NULL; |
1490 | 0 | static char *function = "libewf_source_get_utf8_primary_device_guid"; |
1491 | 0 | int result = 0; |
1492 | |
|
1493 | 0 | if( source == NULL ) |
1494 | 0 | { |
1495 | 0 | libcerror_error_set( |
1496 | 0 | error, |
1497 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1498 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1499 | 0 | "%s: invalid access control entry.", |
1500 | 0 | function ); |
1501 | |
|
1502 | 0 | return( -1 ); |
1503 | 0 | } |
1504 | 0 | internal_source = (libewf_internal_source_t *) source; |
1505 | |
|
1506 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1507 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1508 | 0 | internal_source->read_write_lock, |
1509 | 0 | error ) != 1 ) |
1510 | 0 | { |
1511 | 0 | libcerror_error_set( |
1512 | 0 | error, |
1513 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1514 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1515 | 0 | "%s: unable to grab read/write lock for reading.", |
1516 | 0 | function ); |
1517 | |
|
1518 | 0 | return( -1 ); |
1519 | 0 | } |
1520 | 0 | #endif |
1521 | 0 | result = libewf_lef_source_get_utf8_primary_device_guid( |
1522 | 0 | internal_source->lef_source, |
1523 | 0 | utf8_string, |
1524 | 0 | utf8_string_size, |
1525 | 0 | error ); |
1526 | |
|
1527 | 0 | if( result == -1 ) |
1528 | 0 | { |
1529 | 0 | libcerror_error_set( |
1530 | 0 | error, |
1531 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1532 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1533 | 0 | "%s: unable to retrieve UTF-8 primary device GUID size.", |
1534 | 0 | function ); |
1535 | |
|
1536 | 0 | result = -1; |
1537 | 0 | } |
1538 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1539 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1540 | 0 | internal_source->read_write_lock, |
1541 | 0 | error ) != 1 ) |
1542 | 0 | { |
1543 | 0 | libcerror_error_set( |
1544 | 0 | error, |
1545 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1546 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1547 | 0 | "%s: unable to release read/write lock for reading.", |
1548 | 0 | function ); |
1549 | |
|
1550 | 0 | return( -1 ); |
1551 | 0 | } |
1552 | 0 | #endif |
1553 | 0 | return( result ); |
1554 | 0 | } |
1555 | | |
1556 | | /* Retrieves the size of the UTF-16 encoded primary device GUID |
1557 | | * The returned size includes the end of string character |
1558 | | * Returns 1 if successful, 0 if not set or -1 on error |
1559 | | */ |
1560 | | int libewf_source_get_utf16_primary_device_guid_size( |
1561 | | libewf_source_t *source, |
1562 | | size_t *utf16_string_size, |
1563 | | libcerror_error_t **error ) |
1564 | 0 | { |
1565 | 0 | libewf_internal_source_t *internal_source = NULL; |
1566 | 0 | static char *function = "libewf_source_get_utf16_primary_device_guid_size"; |
1567 | 0 | int result = 0; |
1568 | |
|
1569 | 0 | if( source == NULL ) |
1570 | 0 | { |
1571 | 0 | libcerror_error_set( |
1572 | 0 | error, |
1573 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1574 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1575 | 0 | "%s: invalid access control entry.", |
1576 | 0 | function ); |
1577 | |
|
1578 | 0 | return( -1 ); |
1579 | 0 | } |
1580 | 0 | internal_source = (libewf_internal_source_t *) source; |
1581 | |
|
1582 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1583 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1584 | 0 | internal_source->read_write_lock, |
1585 | 0 | error ) != 1 ) |
1586 | 0 | { |
1587 | 0 | libcerror_error_set( |
1588 | 0 | error, |
1589 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1590 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1591 | 0 | "%s: unable to grab read/write lock for reading.", |
1592 | 0 | function ); |
1593 | |
|
1594 | 0 | return( -1 ); |
1595 | 0 | } |
1596 | 0 | #endif |
1597 | 0 | result = libewf_lef_source_get_utf16_primary_device_guid_size( |
1598 | 0 | internal_source->lef_source, |
1599 | 0 | utf16_string_size, |
1600 | 0 | error ); |
1601 | |
|
1602 | 0 | if( result == -1 ) |
1603 | 0 | { |
1604 | 0 | libcerror_error_set( |
1605 | 0 | error, |
1606 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1607 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1608 | 0 | "%s: unable to retrieve UTF-16 primary device GUID size.", |
1609 | 0 | function ); |
1610 | |
|
1611 | 0 | result = -1; |
1612 | 0 | } |
1613 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1614 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1615 | 0 | internal_source->read_write_lock, |
1616 | 0 | error ) != 1 ) |
1617 | 0 | { |
1618 | 0 | libcerror_error_set( |
1619 | 0 | error, |
1620 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1621 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1622 | 0 | "%s: unable to release read/write lock for reading.", |
1623 | 0 | function ); |
1624 | |
|
1625 | 0 | return( -1 ); |
1626 | 0 | } |
1627 | 0 | #endif |
1628 | 0 | return( result ); |
1629 | 0 | } |
1630 | | |
1631 | | /* Retrieves the UTF-16 encoded primary device GUID |
1632 | | * The size should include the end of string character |
1633 | | * Returns 1 if successful, 0 if not set or -1 on error |
1634 | | */ |
1635 | | int libewf_source_get_utf16_primary_device_guid( |
1636 | | libewf_source_t *source, |
1637 | | uint16_t *utf16_string, |
1638 | | size_t utf16_string_size, |
1639 | | libcerror_error_t **error ) |
1640 | 0 | { |
1641 | 0 | libewf_internal_source_t *internal_source = NULL; |
1642 | 0 | static char *function = "libewf_source_get_utf16_primary_device_guid"; |
1643 | 0 | int result = 0; |
1644 | |
|
1645 | 0 | if( source == NULL ) |
1646 | 0 | { |
1647 | 0 | libcerror_error_set( |
1648 | 0 | error, |
1649 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1650 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1651 | 0 | "%s: invalid access control entry.", |
1652 | 0 | function ); |
1653 | |
|
1654 | 0 | return( -1 ); |
1655 | 0 | } |
1656 | 0 | internal_source = (libewf_internal_source_t *) source; |
1657 | |
|
1658 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1659 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1660 | 0 | internal_source->read_write_lock, |
1661 | 0 | error ) != 1 ) |
1662 | 0 | { |
1663 | 0 | libcerror_error_set( |
1664 | 0 | error, |
1665 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1666 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1667 | 0 | "%s: unable to grab read/write lock for reading.", |
1668 | 0 | function ); |
1669 | |
|
1670 | 0 | return( -1 ); |
1671 | 0 | } |
1672 | 0 | #endif |
1673 | 0 | result = libewf_lef_source_get_utf16_primary_device_guid( |
1674 | 0 | internal_source->lef_source, |
1675 | 0 | utf16_string, |
1676 | 0 | utf16_string_size, |
1677 | 0 | error ); |
1678 | |
|
1679 | 0 | if( result == -1 ) |
1680 | 0 | { |
1681 | 0 | libcerror_error_set( |
1682 | 0 | error, |
1683 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1684 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1685 | 0 | "%s: unable to retrieve UTF-16 primary device GUID size.", |
1686 | 0 | function ); |
1687 | |
|
1688 | 0 | result = -1; |
1689 | 0 | } |
1690 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1691 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1692 | 0 | internal_source->read_write_lock, |
1693 | 0 | error ) != 1 ) |
1694 | 0 | { |
1695 | 0 | libcerror_error_set( |
1696 | 0 | error, |
1697 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1698 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1699 | 0 | "%s: unable to release read/write lock for reading.", |
1700 | 0 | function ); |
1701 | |
|
1702 | 0 | return( -1 ); |
1703 | 0 | } |
1704 | 0 | #endif |
1705 | 0 | return( result ); |
1706 | 0 | } |
1707 | | |
1708 | | /* Retrieves the size of the UTF-8 encoded manufacturer |
1709 | | * The returned size includes the end of string character |
1710 | | * Returns 1 if successful, 0 if not set or -1 on error |
1711 | | */ |
1712 | | int libewf_source_get_utf8_manufacturer_size( |
1713 | | libewf_source_t *source, |
1714 | | size_t *utf8_string_size, |
1715 | | libcerror_error_t **error ) |
1716 | 0 | { |
1717 | 0 | libewf_internal_source_t *internal_source = NULL; |
1718 | 0 | static char *function = "libewf_source_get_utf8_manufacturer_size"; |
1719 | 0 | int result = 0; |
1720 | |
|
1721 | 0 | if( source == NULL ) |
1722 | 0 | { |
1723 | 0 | libcerror_error_set( |
1724 | 0 | error, |
1725 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1726 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1727 | 0 | "%s: invalid access control entry.", |
1728 | 0 | function ); |
1729 | |
|
1730 | 0 | return( -1 ); |
1731 | 0 | } |
1732 | 0 | internal_source = (libewf_internal_source_t *) source; |
1733 | |
|
1734 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1735 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1736 | 0 | internal_source->read_write_lock, |
1737 | 0 | error ) != 1 ) |
1738 | 0 | { |
1739 | 0 | libcerror_error_set( |
1740 | 0 | error, |
1741 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1742 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1743 | 0 | "%s: unable to grab read/write lock for reading.", |
1744 | 0 | function ); |
1745 | |
|
1746 | 0 | return( -1 ); |
1747 | 0 | } |
1748 | 0 | #endif |
1749 | 0 | result = libewf_lef_source_get_utf8_manufacturer_size( |
1750 | 0 | internal_source->lef_source, |
1751 | 0 | utf8_string_size, |
1752 | 0 | error ); |
1753 | |
|
1754 | 0 | if( result == -1 ) |
1755 | 0 | { |
1756 | 0 | libcerror_error_set( |
1757 | 0 | error, |
1758 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1759 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1760 | 0 | "%s: unable to retrieve UTF-8 manufacturer size.", |
1761 | 0 | function ); |
1762 | |
|
1763 | 0 | result = -1; |
1764 | 0 | } |
1765 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1766 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1767 | 0 | internal_source->read_write_lock, |
1768 | 0 | error ) != 1 ) |
1769 | 0 | { |
1770 | 0 | libcerror_error_set( |
1771 | 0 | error, |
1772 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1773 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1774 | 0 | "%s: unable to release read/write lock for reading.", |
1775 | 0 | function ); |
1776 | |
|
1777 | 0 | return( -1 ); |
1778 | 0 | } |
1779 | 0 | #endif |
1780 | 0 | return( result ); |
1781 | 0 | } |
1782 | | |
1783 | | /* Retrieves the UTF-8 encoded manufacturer |
1784 | | * The size should include the end of string character |
1785 | | * Returns 1 if successful, 0 if not set or -1 on error |
1786 | | */ |
1787 | | int libewf_source_get_utf8_manufacturer( |
1788 | | libewf_source_t *source, |
1789 | | uint8_t *utf8_string, |
1790 | | size_t utf8_string_size, |
1791 | | libcerror_error_t **error ) |
1792 | 0 | { |
1793 | 0 | libewf_internal_source_t *internal_source = NULL; |
1794 | 0 | static char *function = "libewf_source_get_utf8_manufacturer"; |
1795 | 0 | int result = 0; |
1796 | |
|
1797 | 0 | if( source == NULL ) |
1798 | 0 | { |
1799 | 0 | libcerror_error_set( |
1800 | 0 | error, |
1801 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1802 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1803 | 0 | "%s: invalid access control entry.", |
1804 | 0 | function ); |
1805 | |
|
1806 | 0 | return( -1 ); |
1807 | 0 | } |
1808 | 0 | internal_source = (libewf_internal_source_t *) source; |
1809 | |
|
1810 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1811 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1812 | 0 | internal_source->read_write_lock, |
1813 | 0 | error ) != 1 ) |
1814 | 0 | { |
1815 | 0 | libcerror_error_set( |
1816 | 0 | error, |
1817 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1818 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1819 | 0 | "%s: unable to grab read/write lock for reading.", |
1820 | 0 | function ); |
1821 | |
|
1822 | 0 | return( -1 ); |
1823 | 0 | } |
1824 | 0 | #endif |
1825 | 0 | result = libewf_lef_source_get_utf8_manufacturer( |
1826 | 0 | internal_source->lef_source, |
1827 | 0 | utf8_string, |
1828 | 0 | utf8_string_size, |
1829 | 0 | error ); |
1830 | |
|
1831 | 0 | if( result == -1 ) |
1832 | 0 | { |
1833 | 0 | libcerror_error_set( |
1834 | 0 | error, |
1835 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1836 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1837 | 0 | "%s: unable to retrieve UTF-8 manufacturer size.", |
1838 | 0 | function ); |
1839 | |
|
1840 | 0 | result = -1; |
1841 | 0 | } |
1842 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1843 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1844 | 0 | internal_source->read_write_lock, |
1845 | 0 | error ) != 1 ) |
1846 | 0 | { |
1847 | 0 | libcerror_error_set( |
1848 | 0 | error, |
1849 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1850 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1851 | 0 | "%s: unable to release read/write lock for reading.", |
1852 | 0 | function ); |
1853 | |
|
1854 | 0 | return( -1 ); |
1855 | 0 | } |
1856 | 0 | #endif |
1857 | 0 | return( result ); |
1858 | 0 | } |
1859 | | |
1860 | | /* Retrieves the size of the UTF-16 encoded manufacturer |
1861 | | * The returned size includes the end of string character |
1862 | | * Returns 1 if successful, 0 if not set or -1 on error |
1863 | | */ |
1864 | | int libewf_source_get_utf16_manufacturer_size( |
1865 | | libewf_source_t *source, |
1866 | | size_t *utf16_string_size, |
1867 | | libcerror_error_t **error ) |
1868 | 0 | { |
1869 | 0 | libewf_internal_source_t *internal_source = NULL; |
1870 | 0 | static char *function = "libewf_source_get_utf16_manufacturer_size"; |
1871 | 0 | int result = 0; |
1872 | |
|
1873 | 0 | if( source == NULL ) |
1874 | 0 | { |
1875 | 0 | libcerror_error_set( |
1876 | 0 | error, |
1877 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1878 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1879 | 0 | "%s: invalid access control entry.", |
1880 | 0 | function ); |
1881 | |
|
1882 | 0 | return( -1 ); |
1883 | 0 | } |
1884 | 0 | internal_source = (libewf_internal_source_t *) source; |
1885 | |
|
1886 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1887 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1888 | 0 | internal_source->read_write_lock, |
1889 | 0 | error ) != 1 ) |
1890 | 0 | { |
1891 | 0 | libcerror_error_set( |
1892 | 0 | error, |
1893 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1894 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1895 | 0 | "%s: unable to grab read/write lock for reading.", |
1896 | 0 | function ); |
1897 | |
|
1898 | 0 | return( -1 ); |
1899 | 0 | } |
1900 | 0 | #endif |
1901 | 0 | result = libewf_lef_source_get_utf16_manufacturer_size( |
1902 | 0 | internal_source->lef_source, |
1903 | 0 | utf16_string_size, |
1904 | 0 | error ); |
1905 | |
|
1906 | 0 | if( result == -1 ) |
1907 | 0 | { |
1908 | 0 | libcerror_error_set( |
1909 | 0 | error, |
1910 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1911 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1912 | 0 | "%s: unable to retrieve UTF-16 manufacturer size.", |
1913 | 0 | function ); |
1914 | |
|
1915 | 0 | result = -1; |
1916 | 0 | } |
1917 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1918 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1919 | 0 | internal_source->read_write_lock, |
1920 | 0 | error ) != 1 ) |
1921 | 0 | { |
1922 | 0 | libcerror_error_set( |
1923 | 0 | error, |
1924 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1925 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1926 | 0 | "%s: unable to release read/write lock for reading.", |
1927 | 0 | function ); |
1928 | |
|
1929 | 0 | return( -1 ); |
1930 | 0 | } |
1931 | 0 | #endif |
1932 | 0 | return( result ); |
1933 | 0 | } |
1934 | | |
1935 | | /* Retrieves the UTF-16 encoded manufacturer |
1936 | | * The size should include the end of string character |
1937 | | * Returns 1 if successful, 0 if not set or -1 on error |
1938 | | */ |
1939 | | int libewf_source_get_utf16_manufacturer( |
1940 | | libewf_source_t *source, |
1941 | | uint16_t *utf16_string, |
1942 | | size_t utf16_string_size, |
1943 | | libcerror_error_t **error ) |
1944 | 0 | { |
1945 | 0 | libewf_internal_source_t *internal_source = NULL; |
1946 | 0 | static char *function = "libewf_source_get_utf16_manufacturer"; |
1947 | 0 | int result = 0; |
1948 | |
|
1949 | 0 | if( source == NULL ) |
1950 | 0 | { |
1951 | 0 | libcerror_error_set( |
1952 | 0 | error, |
1953 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1954 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1955 | 0 | "%s: invalid access control entry.", |
1956 | 0 | function ); |
1957 | |
|
1958 | 0 | return( -1 ); |
1959 | 0 | } |
1960 | 0 | internal_source = (libewf_internal_source_t *) source; |
1961 | |
|
1962 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1963 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
1964 | 0 | internal_source->read_write_lock, |
1965 | 0 | error ) != 1 ) |
1966 | 0 | { |
1967 | 0 | libcerror_error_set( |
1968 | 0 | error, |
1969 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1970 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
1971 | 0 | "%s: unable to grab read/write lock for reading.", |
1972 | 0 | function ); |
1973 | |
|
1974 | 0 | return( -1 ); |
1975 | 0 | } |
1976 | 0 | #endif |
1977 | 0 | result = libewf_lef_source_get_utf16_manufacturer( |
1978 | 0 | internal_source->lef_source, |
1979 | 0 | utf16_string, |
1980 | 0 | utf16_string_size, |
1981 | 0 | error ); |
1982 | |
|
1983 | 0 | if( result == -1 ) |
1984 | 0 | { |
1985 | 0 | libcerror_error_set( |
1986 | 0 | error, |
1987 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1988 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1989 | 0 | "%s: unable to retrieve UTF-16 manufacturer size.", |
1990 | 0 | function ); |
1991 | |
|
1992 | 0 | result = -1; |
1993 | 0 | } |
1994 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
1995 | 0 | if( libcthreads_read_write_lock_release_for_read( |
1996 | 0 | internal_source->read_write_lock, |
1997 | 0 | error ) != 1 ) |
1998 | 0 | { |
1999 | 0 | libcerror_error_set( |
2000 | 0 | error, |
2001 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2002 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2003 | 0 | "%s: unable to release read/write lock for reading.", |
2004 | 0 | function ); |
2005 | |
|
2006 | 0 | return( -1 ); |
2007 | 0 | } |
2008 | 0 | #endif |
2009 | 0 | return( result ); |
2010 | 0 | } |
2011 | | |
2012 | | /* Retrieves the size of the UTF-8 encoded model |
2013 | | * The returned size includes the end of string character |
2014 | | * Returns 1 if successful, 0 if not set or -1 on error |
2015 | | */ |
2016 | | int libewf_source_get_utf8_model_size( |
2017 | | libewf_source_t *source, |
2018 | | size_t *utf8_string_size, |
2019 | | libcerror_error_t **error ) |
2020 | 0 | { |
2021 | 0 | libewf_internal_source_t *internal_source = NULL; |
2022 | 0 | static char *function = "libewf_source_get_utf8_model_size"; |
2023 | 0 | int result = 0; |
2024 | |
|
2025 | 0 | if( source == NULL ) |
2026 | 0 | { |
2027 | 0 | libcerror_error_set( |
2028 | 0 | error, |
2029 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2030 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2031 | 0 | "%s: invalid access control entry.", |
2032 | 0 | function ); |
2033 | |
|
2034 | 0 | return( -1 ); |
2035 | 0 | } |
2036 | 0 | internal_source = (libewf_internal_source_t *) source; |
2037 | |
|
2038 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2039 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2040 | 0 | internal_source->read_write_lock, |
2041 | 0 | error ) != 1 ) |
2042 | 0 | { |
2043 | 0 | libcerror_error_set( |
2044 | 0 | error, |
2045 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2046 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2047 | 0 | "%s: unable to grab read/write lock for reading.", |
2048 | 0 | function ); |
2049 | |
|
2050 | 0 | return( -1 ); |
2051 | 0 | } |
2052 | 0 | #endif |
2053 | 0 | result = libewf_lef_source_get_utf8_model_size( |
2054 | 0 | internal_source->lef_source, |
2055 | 0 | utf8_string_size, |
2056 | 0 | error ); |
2057 | |
|
2058 | 0 | if( result == -1 ) |
2059 | 0 | { |
2060 | 0 | libcerror_error_set( |
2061 | 0 | error, |
2062 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2063 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2064 | 0 | "%s: unable to retrieve UTF-8 model size.", |
2065 | 0 | function ); |
2066 | |
|
2067 | 0 | result = -1; |
2068 | 0 | } |
2069 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2070 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2071 | 0 | internal_source->read_write_lock, |
2072 | 0 | error ) != 1 ) |
2073 | 0 | { |
2074 | 0 | libcerror_error_set( |
2075 | 0 | error, |
2076 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2077 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2078 | 0 | "%s: unable to release read/write lock for reading.", |
2079 | 0 | function ); |
2080 | |
|
2081 | 0 | return( -1 ); |
2082 | 0 | } |
2083 | 0 | #endif |
2084 | 0 | return( result ); |
2085 | 0 | } |
2086 | | |
2087 | | /* Retrieves the UTF-8 encoded model |
2088 | | * The size should include the end of string character |
2089 | | * Returns 1 if successful, 0 if not set or -1 on error |
2090 | | */ |
2091 | | int libewf_source_get_utf8_model( |
2092 | | libewf_source_t *source, |
2093 | | uint8_t *utf8_string, |
2094 | | size_t utf8_string_size, |
2095 | | libcerror_error_t **error ) |
2096 | 0 | { |
2097 | 0 | libewf_internal_source_t *internal_source = NULL; |
2098 | 0 | static char *function = "libewf_source_get_utf8_model"; |
2099 | 0 | int result = 0; |
2100 | |
|
2101 | 0 | if( source == NULL ) |
2102 | 0 | { |
2103 | 0 | libcerror_error_set( |
2104 | 0 | error, |
2105 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2106 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2107 | 0 | "%s: invalid access control entry.", |
2108 | 0 | function ); |
2109 | |
|
2110 | 0 | return( -1 ); |
2111 | 0 | } |
2112 | 0 | internal_source = (libewf_internal_source_t *) source; |
2113 | |
|
2114 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2115 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2116 | 0 | internal_source->read_write_lock, |
2117 | 0 | error ) != 1 ) |
2118 | 0 | { |
2119 | 0 | libcerror_error_set( |
2120 | 0 | error, |
2121 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2122 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2123 | 0 | "%s: unable to grab read/write lock for reading.", |
2124 | 0 | function ); |
2125 | |
|
2126 | 0 | return( -1 ); |
2127 | 0 | } |
2128 | 0 | #endif |
2129 | 0 | result = libewf_lef_source_get_utf8_model( |
2130 | 0 | internal_source->lef_source, |
2131 | 0 | utf8_string, |
2132 | 0 | utf8_string_size, |
2133 | 0 | error ); |
2134 | |
|
2135 | 0 | if( result == -1 ) |
2136 | 0 | { |
2137 | 0 | libcerror_error_set( |
2138 | 0 | error, |
2139 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2140 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2141 | 0 | "%s: unable to retrieve UTF-8 model size.", |
2142 | 0 | function ); |
2143 | |
|
2144 | 0 | result = -1; |
2145 | 0 | } |
2146 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2147 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2148 | 0 | internal_source->read_write_lock, |
2149 | 0 | error ) != 1 ) |
2150 | 0 | { |
2151 | 0 | libcerror_error_set( |
2152 | 0 | error, |
2153 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2154 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2155 | 0 | "%s: unable to release read/write lock for reading.", |
2156 | 0 | function ); |
2157 | |
|
2158 | 0 | return( -1 ); |
2159 | 0 | } |
2160 | 0 | #endif |
2161 | 0 | return( result ); |
2162 | 0 | } |
2163 | | |
2164 | | /* Retrieves the size of the UTF-16 encoded model |
2165 | | * The returned size includes the end of string character |
2166 | | * Returns 1 if successful, 0 if not set or -1 on error |
2167 | | */ |
2168 | | int libewf_source_get_utf16_model_size( |
2169 | | libewf_source_t *source, |
2170 | | size_t *utf16_string_size, |
2171 | | libcerror_error_t **error ) |
2172 | 0 | { |
2173 | 0 | libewf_internal_source_t *internal_source = NULL; |
2174 | 0 | static char *function = "libewf_source_get_utf16_model_size"; |
2175 | 0 | int result = 0; |
2176 | |
|
2177 | 0 | if( source == NULL ) |
2178 | 0 | { |
2179 | 0 | libcerror_error_set( |
2180 | 0 | error, |
2181 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2182 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2183 | 0 | "%s: invalid access control entry.", |
2184 | 0 | function ); |
2185 | |
|
2186 | 0 | return( -1 ); |
2187 | 0 | } |
2188 | 0 | internal_source = (libewf_internal_source_t *) source; |
2189 | |
|
2190 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2191 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2192 | 0 | internal_source->read_write_lock, |
2193 | 0 | error ) != 1 ) |
2194 | 0 | { |
2195 | 0 | libcerror_error_set( |
2196 | 0 | error, |
2197 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2198 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2199 | 0 | "%s: unable to grab read/write lock for reading.", |
2200 | 0 | function ); |
2201 | |
|
2202 | 0 | return( -1 ); |
2203 | 0 | } |
2204 | 0 | #endif |
2205 | 0 | result = libewf_lef_source_get_utf16_model_size( |
2206 | 0 | internal_source->lef_source, |
2207 | 0 | utf16_string_size, |
2208 | 0 | error ); |
2209 | |
|
2210 | 0 | if( result == -1 ) |
2211 | 0 | { |
2212 | 0 | libcerror_error_set( |
2213 | 0 | error, |
2214 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2215 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2216 | 0 | "%s: unable to retrieve UTF-16 model size.", |
2217 | 0 | function ); |
2218 | |
|
2219 | 0 | result = -1; |
2220 | 0 | } |
2221 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2222 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2223 | 0 | internal_source->read_write_lock, |
2224 | 0 | error ) != 1 ) |
2225 | 0 | { |
2226 | 0 | libcerror_error_set( |
2227 | 0 | error, |
2228 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2229 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2230 | 0 | "%s: unable to release read/write lock for reading.", |
2231 | 0 | function ); |
2232 | |
|
2233 | 0 | return( -1 ); |
2234 | 0 | } |
2235 | 0 | #endif |
2236 | 0 | return( result ); |
2237 | 0 | } |
2238 | | |
2239 | | /* Retrieves the UTF-16 encoded model |
2240 | | * The size should include the end of string character |
2241 | | * Returns 1 if successful, 0 if not set or -1 on error |
2242 | | */ |
2243 | | int libewf_source_get_utf16_model( |
2244 | | libewf_source_t *source, |
2245 | | uint16_t *utf16_string, |
2246 | | size_t utf16_string_size, |
2247 | | libcerror_error_t **error ) |
2248 | 0 | { |
2249 | 0 | libewf_internal_source_t *internal_source = NULL; |
2250 | 0 | static char *function = "libewf_source_get_utf16_model"; |
2251 | 0 | int result = 0; |
2252 | |
|
2253 | 0 | if( source == NULL ) |
2254 | 0 | { |
2255 | 0 | libcerror_error_set( |
2256 | 0 | error, |
2257 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2258 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2259 | 0 | "%s: invalid access control entry.", |
2260 | 0 | function ); |
2261 | |
|
2262 | 0 | return( -1 ); |
2263 | 0 | } |
2264 | 0 | internal_source = (libewf_internal_source_t *) source; |
2265 | |
|
2266 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2267 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2268 | 0 | internal_source->read_write_lock, |
2269 | 0 | error ) != 1 ) |
2270 | 0 | { |
2271 | 0 | libcerror_error_set( |
2272 | 0 | error, |
2273 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2274 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2275 | 0 | "%s: unable to grab read/write lock for reading.", |
2276 | 0 | function ); |
2277 | |
|
2278 | 0 | return( -1 ); |
2279 | 0 | } |
2280 | 0 | #endif |
2281 | 0 | result = libewf_lef_source_get_utf16_model( |
2282 | 0 | internal_source->lef_source, |
2283 | 0 | utf16_string, |
2284 | 0 | utf16_string_size, |
2285 | 0 | error ); |
2286 | |
|
2287 | 0 | if( result == -1 ) |
2288 | 0 | { |
2289 | 0 | libcerror_error_set( |
2290 | 0 | error, |
2291 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2292 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2293 | 0 | "%s: unable to retrieve UTF-16 model size.", |
2294 | 0 | function ); |
2295 | |
|
2296 | 0 | result = -1; |
2297 | 0 | } |
2298 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2299 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2300 | 0 | internal_source->read_write_lock, |
2301 | 0 | error ) != 1 ) |
2302 | 0 | { |
2303 | 0 | libcerror_error_set( |
2304 | 0 | error, |
2305 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2306 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2307 | 0 | "%s: unable to release read/write lock for reading.", |
2308 | 0 | function ); |
2309 | |
|
2310 | 0 | return( -1 ); |
2311 | 0 | } |
2312 | 0 | #endif |
2313 | 0 | return( result ); |
2314 | 0 | } |
2315 | | |
2316 | | /* Retrieves the size of the UTF-8 encoded serial number |
2317 | | * The returned size includes the end of string character |
2318 | | * Returns 1 if successful, 0 if not set or -1 on error |
2319 | | */ |
2320 | | int libewf_source_get_utf8_serial_number_size( |
2321 | | libewf_source_t *source, |
2322 | | size_t *utf8_string_size, |
2323 | | libcerror_error_t **error ) |
2324 | 0 | { |
2325 | 0 | libewf_internal_source_t *internal_source = NULL; |
2326 | 0 | static char *function = "libewf_source_get_utf8_serial_number_size"; |
2327 | 0 | int result = 0; |
2328 | |
|
2329 | 0 | if( source == NULL ) |
2330 | 0 | { |
2331 | 0 | libcerror_error_set( |
2332 | 0 | error, |
2333 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2334 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2335 | 0 | "%s: invalid access control entry.", |
2336 | 0 | function ); |
2337 | |
|
2338 | 0 | return( -1 ); |
2339 | 0 | } |
2340 | 0 | internal_source = (libewf_internal_source_t *) source; |
2341 | |
|
2342 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2343 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2344 | 0 | internal_source->read_write_lock, |
2345 | 0 | error ) != 1 ) |
2346 | 0 | { |
2347 | 0 | libcerror_error_set( |
2348 | 0 | error, |
2349 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2350 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2351 | 0 | "%s: unable to grab read/write lock for reading.", |
2352 | 0 | function ); |
2353 | |
|
2354 | 0 | return( -1 ); |
2355 | 0 | } |
2356 | 0 | #endif |
2357 | 0 | result = libewf_lef_source_get_utf8_serial_number_size( |
2358 | 0 | internal_source->lef_source, |
2359 | 0 | utf8_string_size, |
2360 | 0 | error ); |
2361 | |
|
2362 | 0 | if( result == -1 ) |
2363 | 0 | { |
2364 | 0 | libcerror_error_set( |
2365 | 0 | error, |
2366 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2367 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2368 | 0 | "%s: unable to retrieve UTF-8 serial number size.", |
2369 | 0 | function ); |
2370 | |
|
2371 | 0 | result = -1; |
2372 | 0 | } |
2373 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2374 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2375 | 0 | internal_source->read_write_lock, |
2376 | 0 | error ) != 1 ) |
2377 | 0 | { |
2378 | 0 | libcerror_error_set( |
2379 | 0 | error, |
2380 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2381 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2382 | 0 | "%s: unable to release read/write lock for reading.", |
2383 | 0 | function ); |
2384 | |
|
2385 | 0 | return( -1 ); |
2386 | 0 | } |
2387 | 0 | #endif |
2388 | 0 | return( result ); |
2389 | 0 | } |
2390 | | |
2391 | | /* Retrieves the UTF-8 encoded serial number |
2392 | | * The size should include the end of string character |
2393 | | * Returns 1 if successful, 0 if not set or -1 on error |
2394 | | */ |
2395 | | int libewf_source_get_utf8_serial_number( |
2396 | | libewf_source_t *source, |
2397 | | uint8_t *utf8_string, |
2398 | | size_t utf8_string_size, |
2399 | | libcerror_error_t **error ) |
2400 | 0 | { |
2401 | 0 | libewf_internal_source_t *internal_source = NULL; |
2402 | 0 | static char *function = "libewf_source_get_utf8_serial_number"; |
2403 | 0 | int result = 0; |
2404 | |
|
2405 | 0 | if( source == NULL ) |
2406 | 0 | { |
2407 | 0 | libcerror_error_set( |
2408 | 0 | error, |
2409 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2410 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2411 | 0 | "%s: invalid access control entry.", |
2412 | 0 | function ); |
2413 | |
|
2414 | 0 | return( -1 ); |
2415 | 0 | } |
2416 | 0 | internal_source = (libewf_internal_source_t *) source; |
2417 | |
|
2418 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2419 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2420 | 0 | internal_source->read_write_lock, |
2421 | 0 | error ) != 1 ) |
2422 | 0 | { |
2423 | 0 | libcerror_error_set( |
2424 | 0 | error, |
2425 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2426 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2427 | 0 | "%s: unable to grab read/write lock for reading.", |
2428 | 0 | function ); |
2429 | |
|
2430 | 0 | return( -1 ); |
2431 | 0 | } |
2432 | 0 | #endif |
2433 | 0 | result = libewf_lef_source_get_utf8_serial_number( |
2434 | 0 | internal_source->lef_source, |
2435 | 0 | utf8_string, |
2436 | 0 | utf8_string_size, |
2437 | 0 | error ); |
2438 | |
|
2439 | 0 | if( result == -1 ) |
2440 | 0 | { |
2441 | 0 | libcerror_error_set( |
2442 | 0 | error, |
2443 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2444 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2445 | 0 | "%s: unable to retrieve UTF-8 serial number size.", |
2446 | 0 | function ); |
2447 | |
|
2448 | 0 | result = -1; |
2449 | 0 | } |
2450 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2451 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2452 | 0 | internal_source->read_write_lock, |
2453 | 0 | error ) != 1 ) |
2454 | 0 | { |
2455 | 0 | libcerror_error_set( |
2456 | 0 | error, |
2457 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2458 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2459 | 0 | "%s: unable to release read/write lock for reading.", |
2460 | 0 | function ); |
2461 | |
|
2462 | 0 | return( -1 ); |
2463 | 0 | } |
2464 | 0 | #endif |
2465 | 0 | return( result ); |
2466 | 0 | } |
2467 | | |
2468 | | /* Retrieves the size of the UTF-16 encoded serial number |
2469 | | * The returned size includes the end of string character |
2470 | | * Returns 1 if successful, 0 if not set or -1 on error |
2471 | | */ |
2472 | | int libewf_source_get_utf16_serial_number_size( |
2473 | | libewf_source_t *source, |
2474 | | size_t *utf16_string_size, |
2475 | | libcerror_error_t **error ) |
2476 | 0 | { |
2477 | 0 | libewf_internal_source_t *internal_source = NULL; |
2478 | 0 | static char *function = "libewf_source_get_utf16_serial_number_size"; |
2479 | 0 | int result = 0; |
2480 | |
|
2481 | 0 | if( source == NULL ) |
2482 | 0 | { |
2483 | 0 | libcerror_error_set( |
2484 | 0 | error, |
2485 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2486 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2487 | 0 | "%s: invalid access control entry.", |
2488 | 0 | function ); |
2489 | |
|
2490 | 0 | return( -1 ); |
2491 | 0 | } |
2492 | 0 | internal_source = (libewf_internal_source_t *) source; |
2493 | |
|
2494 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2495 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2496 | 0 | internal_source->read_write_lock, |
2497 | 0 | error ) != 1 ) |
2498 | 0 | { |
2499 | 0 | libcerror_error_set( |
2500 | 0 | error, |
2501 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2502 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2503 | 0 | "%s: unable to grab read/write lock for reading.", |
2504 | 0 | function ); |
2505 | |
|
2506 | 0 | return( -1 ); |
2507 | 0 | } |
2508 | 0 | #endif |
2509 | 0 | result = libewf_lef_source_get_utf16_serial_number_size( |
2510 | 0 | internal_source->lef_source, |
2511 | 0 | utf16_string_size, |
2512 | 0 | error ); |
2513 | |
|
2514 | 0 | if( result == -1 ) |
2515 | 0 | { |
2516 | 0 | libcerror_error_set( |
2517 | 0 | error, |
2518 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2519 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2520 | 0 | "%s: unable to retrieve UTF-16 serial number size.", |
2521 | 0 | function ); |
2522 | |
|
2523 | 0 | result = -1; |
2524 | 0 | } |
2525 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2526 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2527 | 0 | internal_source->read_write_lock, |
2528 | 0 | error ) != 1 ) |
2529 | 0 | { |
2530 | 0 | libcerror_error_set( |
2531 | 0 | error, |
2532 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2533 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2534 | 0 | "%s: unable to release read/write lock for reading.", |
2535 | 0 | function ); |
2536 | |
|
2537 | 0 | return( -1 ); |
2538 | 0 | } |
2539 | 0 | #endif |
2540 | 0 | return( result ); |
2541 | 0 | } |
2542 | | |
2543 | | /* Retrieves the UTF-16 encoded serial number |
2544 | | * The size should include the end of string character |
2545 | | * Returns 1 if successful, 0 if not set or -1 on error |
2546 | | */ |
2547 | | int libewf_source_get_utf16_serial_number( |
2548 | | libewf_source_t *source, |
2549 | | uint16_t *utf16_string, |
2550 | | size_t utf16_string_size, |
2551 | | libcerror_error_t **error ) |
2552 | 0 | { |
2553 | 0 | libewf_internal_source_t *internal_source = NULL; |
2554 | 0 | static char *function = "libewf_source_get_utf16_serial_number"; |
2555 | 0 | int result = 0; |
2556 | |
|
2557 | 0 | if( source == NULL ) |
2558 | 0 | { |
2559 | 0 | libcerror_error_set( |
2560 | 0 | error, |
2561 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2562 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2563 | 0 | "%s: invalid access control entry.", |
2564 | 0 | function ); |
2565 | |
|
2566 | 0 | return( -1 ); |
2567 | 0 | } |
2568 | 0 | internal_source = (libewf_internal_source_t *) source; |
2569 | |
|
2570 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2571 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2572 | 0 | internal_source->read_write_lock, |
2573 | 0 | error ) != 1 ) |
2574 | 0 | { |
2575 | 0 | libcerror_error_set( |
2576 | 0 | error, |
2577 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2578 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2579 | 0 | "%s: unable to grab read/write lock for reading.", |
2580 | 0 | function ); |
2581 | |
|
2582 | 0 | return( -1 ); |
2583 | 0 | } |
2584 | 0 | #endif |
2585 | 0 | result = libewf_lef_source_get_utf16_serial_number( |
2586 | 0 | internal_source->lef_source, |
2587 | 0 | utf16_string, |
2588 | 0 | utf16_string_size, |
2589 | 0 | error ); |
2590 | |
|
2591 | 0 | if( result == -1 ) |
2592 | 0 | { |
2593 | 0 | libcerror_error_set( |
2594 | 0 | error, |
2595 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2596 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2597 | 0 | "%s: unable to retrieve UTF-16 serial number size.", |
2598 | 0 | function ); |
2599 | |
|
2600 | 0 | result = -1; |
2601 | 0 | } |
2602 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2603 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2604 | 0 | internal_source->read_write_lock, |
2605 | 0 | error ) != 1 ) |
2606 | 0 | { |
2607 | 0 | libcerror_error_set( |
2608 | 0 | error, |
2609 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2610 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2611 | 0 | "%s: unable to release read/write lock for reading.", |
2612 | 0 | function ); |
2613 | |
|
2614 | 0 | return( -1 ); |
2615 | 0 | } |
2616 | 0 | #endif |
2617 | 0 | return( result ); |
2618 | 0 | } |
2619 | | |
2620 | | /* Retrieves the size of the UTF-8 encoded domain |
2621 | | * The returned size includes the end of string character |
2622 | | * Returns 1 if successful, 0 if not set or -1 on error |
2623 | | */ |
2624 | | int libewf_source_get_utf8_domain_size( |
2625 | | libewf_source_t *source, |
2626 | | size_t *utf8_string_size, |
2627 | | libcerror_error_t **error ) |
2628 | 0 | { |
2629 | 0 | libewf_internal_source_t *internal_source = NULL; |
2630 | 0 | static char *function = "libewf_source_get_utf8_domain_size"; |
2631 | 0 | int result = 0; |
2632 | |
|
2633 | 0 | if( source == NULL ) |
2634 | 0 | { |
2635 | 0 | libcerror_error_set( |
2636 | 0 | error, |
2637 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2638 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2639 | 0 | "%s: invalid access control entry.", |
2640 | 0 | function ); |
2641 | |
|
2642 | 0 | return( -1 ); |
2643 | 0 | } |
2644 | 0 | internal_source = (libewf_internal_source_t *) source; |
2645 | |
|
2646 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2647 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2648 | 0 | internal_source->read_write_lock, |
2649 | 0 | error ) != 1 ) |
2650 | 0 | { |
2651 | 0 | libcerror_error_set( |
2652 | 0 | error, |
2653 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2654 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2655 | 0 | "%s: unable to grab read/write lock for reading.", |
2656 | 0 | function ); |
2657 | |
|
2658 | 0 | return( -1 ); |
2659 | 0 | } |
2660 | 0 | #endif |
2661 | 0 | result = libewf_lef_source_get_utf8_domain_size( |
2662 | 0 | internal_source->lef_source, |
2663 | 0 | utf8_string_size, |
2664 | 0 | error ); |
2665 | |
|
2666 | 0 | if( result == -1 ) |
2667 | 0 | { |
2668 | 0 | libcerror_error_set( |
2669 | 0 | error, |
2670 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2671 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2672 | 0 | "%s: unable to retrieve UTF-8 domain size.", |
2673 | 0 | function ); |
2674 | |
|
2675 | 0 | result = -1; |
2676 | 0 | } |
2677 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2678 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2679 | 0 | internal_source->read_write_lock, |
2680 | 0 | error ) != 1 ) |
2681 | 0 | { |
2682 | 0 | libcerror_error_set( |
2683 | 0 | error, |
2684 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2685 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2686 | 0 | "%s: unable to release read/write lock for reading.", |
2687 | 0 | function ); |
2688 | |
|
2689 | 0 | return( -1 ); |
2690 | 0 | } |
2691 | 0 | #endif |
2692 | 0 | return( result ); |
2693 | 0 | } |
2694 | | |
2695 | | /* Retrieves the UTF-8 encoded domain |
2696 | | * The size should include the end of string character |
2697 | | * Returns 1 if successful, 0 if not set or -1 on error |
2698 | | */ |
2699 | | int libewf_source_get_utf8_domain( |
2700 | | libewf_source_t *source, |
2701 | | uint8_t *utf8_string, |
2702 | | size_t utf8_string_size, |
2703 | | libcerror_error_t **error ) |
2704 | 0 | { |
2705 | 0 | libewf_internal_source_t *internal_source = NULL; |
2706 | 0 | static char *function = "libewf_source_get_utf8_domain"; |
2707 | 0 | int result = 0; |
2708 | |
|
2709 | 0 | if( source == NULL ) |
2710 | 0 | { |
2711 | 0 | libcerror_error_set( |
2712 | 0 | error, |
2713 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2714 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2715 | 0 | "%s: invalid access control entry.", |
2716 | 0 | function ); |
2717 | |
|
2718 | 0 | return( -1 ); |
2719 | 0 | } |
2720 | 0 | internal_source = (libewf_internal_source_t *) source; |
2721 | |
|
2722 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2723 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2724 | 0 | internal_source->read_write_lock, |
2725 | 0 | error ) != 1 ) |
2726 | 0 | { |
2727 | 0 | libcerror_error_set( |
2728 | 0 | error, |
2729 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2730 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2731 | 0 | "%s: unable to grab read/write lock for reading.", |
2732 | 0 | function ); |
2733 | |
|
2734 | 0 | return( -1 ); |
2735 | 0 | } |
2736 | 0 | #endif |
2737 | 0 | result = libewf_lef_source_get_utf8_domain( |
2738 | 0 | internal_source->lef_source, |
2739 | 0 | utf8_string, |
2740 | 0 | utf8_string_size, |
2741 | 0 | error ); |
2742 | |
|
2743 | 0 | if( result == -1 ) |
2744 | 0 | { |
2745 | 0 | libcerror_error_set( |
2746 | 0 | error, |
2747 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2748 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2749 | 0 | "%s: unable to retrieve UTF-8 domain size.", |
2750 | 0 | function ); |
2751 | |
|
2752 | 0 | result = -1; |
2753 | 0 | } |
2754 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2755 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2756 | 0 | internal_source->read_write_lock, |
2757 | 0 | error ) != 1 ) |
2758 | 0 | { |
2759 | 0 | libcerror_error_set( |
2760 | 0 | error, |
2761 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2762 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2763 | 0 | "%s: unable to release read/write lock for reading.", |
2764 | 0 | function ); |
2765 | |
|
2766 | 0 | return( -1 ); |
2767 | 0 | } |
2768 | 0 | #endif |
2769 | 0 | return( result ); |
2770 | 0 | } |
2771 | | |
2772 | | /* Retrieves the size of the UTF-16 encoded domain |
2773 | | * The returned size includes the end of string character |
2774 | | * Returns 1 if successful, 0 if not set or -1 on error |
2775 | | */ |
2776 | | int libewf_source_get_utf16_domain_size( |
2777 | | libewf_source_t *source, |
2778 | | size_t *utf16_string_size, |
2779 | | libcerror_error_t **error ) |
2780 | 0 | { |
2781 | 0 | libewf_internal_source_t *internal_source = NULL; |
2782 | 0 | static char *function = "libewf_source_get_utf16_domain_size"; |
2783 | 0 | int result = 0; |
2784 | |
|
2785 | 0 | if( source == NULL ) |
2786 | 0 | { |
2787 | 0 | libcerror_error_set( |
2788 | 0 | error, |
2789 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2790 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2791 | 0 | "%s: invalid access control entry.", |
2792 | 0 | function ); |
2793 | |
|
2794 | 0 | return( -1 ); |
2795 | 0 | } |
2796 | 0 | internal_source = (libewf_internal_source_t *) source; |
2797 | |
|
2798 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2799 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2800 | 0 | internal_source->read_write_lock, |
2801 | 0 | error ) != 1 ) |
2802 | 0 | { |
2803 | 0 | libcerror_error_set( |
2804 | 0 | error, |
2805 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2806 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2807 | 0 | "%s: unable to grab read/write lock for reading.", |
2808 | 0 | function ); |
2809 | |
|
2810 | 0 | return( -1 ); |
2811 | 0 | } |
2812 | 0 | #endif |
2813 | 0 | result = libewf_lef_source_get_utf16_domain_size( |
2814 | 0 | internal_source->lef_source, |
2815 | 0 | utf16_string_size, |
2816 | 0 | error ); |
2817 | |
|
2818 | 0 | if( result == -1 ) |
2819 | 0 | { |
2820 | 0 | libcerror_error_set( |
2821 | 0 | error, |
2822 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2823 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2824 | 0 | "%s: unable to retrieve UTF-16 domain size.", |
2825 | 0 | function ); |
2826 | |
|
2827 | 0 | result = -1; |
2828 | 0 | } |
2829 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2830 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2831 | 0 | internal_source->read_write_lock, |
2832 | 0 | error ) != 1 ) |
2833 | 0 | { |
2834 | 0 | libcerror_error_set( |
2835 | 0 | error, |
2836 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2837 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2838 | 0 | "%s: unable to release read/write lock for reading.", |
2839 | 0 | function ); |
2840 | |
|
2841 | 0 | return( -1 ); |
2842 | 0 | } |
2843 | 0 | #endif |
2844 | 0 | return( result ); |
2845 | 0 | } |
2846 | | |
2847 | | /* Retrieves the UTF-16 encoded domain |
2848 | | * The size should include the end of string character |
2849 | | * Returns 1 if successful, 0 if not set or -1 on error |
2850 | | */ |
2851 | | int libewf_source_get_utf16_domain( |
2852 | | libewf_source_t *source, |
2853 | | uint16_t *utf16_string, |
2854 | | size_t utf16_string_size, |
2855 | | libcerror_error_t **error ) |
2856 | 0 | { |
2857 | 0 | libewf_internal_source_t *internal_source = NULL; |
2858 | 0 | static char *function = "libewf_source_get_utf16_domain"; |
2859 | 0 | int result = 0; |
2860 | |
|
2861 | 0 | if( source == NULL ) |
2862 | 0 | { |
2863 | 0 | libcerror_error_set( |
2864 | 0 | error, |
2865 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2866 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2867 | 0 | "%s: invalid access control entry.", |
2868 | 0 | function ); |
2869 | |
|
2870 | 0 | return( -1 ); |
2871 | 0 | } |
2872 | 0 | internal_source = (libewf_internal_source_t *) source; |
2873 | |
|
2874 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2875 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2876 | 0 | internal_source->read_write_lock, |
2877 | 0 | error ) != 1 ) |
2878 | 0 | { |
2879 | 0 | libcerror_error_set( |
2880 | 0 | error, |
2881 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2882 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2883 | 0 | "%s: unable to grab read/write lock for reading.", |
2884 | 0 | function ); |
2885 | |
|
2886 | 0 | return( -1 ); |
2887 | 0 | } |
2888 | 0 | #endif |
2889 | 0 | result = libewf_lef_source_get_utf16_domain( |
2890 | 0 | internal_source->lef_source, |
2891 | 0 | utf16_string, |
2892 | 0 | utf16_string_size, |
2893 | 0 | error ); |
2894 | |
|
2895 | 0 | if( result == -1 ) |
2896 | 0 | { |
2897 | 0 | libcerror_error_set( |
2898 | 0 | error, |
2899 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2900 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2901 | 0 | "%s: unable to retrieve UTF-16 domain size.", |
2902 | 0 | function ); |
2903 | |
|
2904 | 0 | result = -1; |
2905 | 0 | } |
2906 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2907 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2908 | 0 | internal_source->read_write_lock, |
2909 | 0 | error ) != 1 ) |
2910 | 0 | { |
2911 | 0 | libcerror_error_set( |
2912 | 0 | error, |
2913 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2914 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2915 | 0 | "%s: unable to release read/write lock for reading.", |
2916 | 0 | function ); |
2917 | |
|
2918 | 0 | return( -1 ); |
2919 | 0 | } |
2920 | 0 | #endif |
2921 | 0 | return( result ); |
2922 | 0 | } |
2923 | | |
2924 | | /* Retrieves the size of the UTF-8 encoded IP address |
2925 | | * The returned size includes the end of string character |
2926 | | * Returns 1 if successful, 0 if not set or -1 on error |
2927 | | */ |
2928 | | int libewf_source_get_utf8_ip_address_size( |
2929 | | libewf_source_t *source, |
2930 | | size_t *utf8_string_size, |
2931 | | libcerror_error_t **error ) |
2932 | 0 | { |
2933 | 0 | libewf_internal_source_t *internal_source = NULL; |
2934 | 0 | static char *function = "libewf_source_get_utf8_ip_address_size"; |
2935 | 0 | int result = 0; |
2936 | |
|
2937 | 0 | if( source == NULL ) |
2938 | 0 | { |
2939 | 0 | libcerror_error_set( |
2940 | 0 | error, |
2941 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
2942 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
2943 | 0 | "%s: invalid access control entry.", |
2944 | 0 | function ); |
2945 | |
|
2946 | 0 | return( -1 ); |
2947 | 0 | } |
2948 | 0 | internal_source = (libewf_internal_source_t *) source; |
2949 | |
|
2950 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2951 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
2952 | 0 | internal_source->read_write_lock, |
2953 | 0 | error ) != 1 ) |
2954 | 0 | { |
2955 | 0 | libcerror_error_set( |
2956 | 0 | error, |
2957 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2958 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2959 | 0 | "%s: unable to grab read/write lock for reading.", |
2960 | 0 | function ); |
2961 | |
|
2962 | 0 | return( -1 ); |
2963 | 0 | } |
2964 | 0 | #endif |
2965 | 0 | result = libewf_lef_source_get_utf8_ip_address_size( |
2966 | 0 | internal_source->lef_source, |
2967 | 0 | utf8_string_size, |
2968 | 0 | error ); |
2969 | |
|
2970 | 0 | if( result == -1 ) |
2971 | 0 | { |
2972 | 0 | libcerror_error_set( |
2973 | 0 | error, |
2974 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2975 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
2976 | 0 | "%s: unable to retrieve UTF-8 IP address size.", |
2977 | 0 | function ); |
2978 | |
|
2979 | 0 | result = -1; |
2980 | 0 | } |
2981 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
2982 | 0 | if( libcthreads_read_write_lock_release_for_read( |
2983 | 0 | internal_source->read_write_lock, |
2984 | 0 | error ) != 1 ) |
2985 | 0 | { |
2986 | 0 | libcerror_error_set( |
2987 | 0 | error, |
2988 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
2989 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
2990 | 0 | "%s: unable to release read/write lock for reading.", |
2991 | 0 | function ); |
2992 | |
|
2993 | 0 | return( -1 ); |
2994 | 0 | } |
2995 | 0 | #endif |
2996 | 0 | return( result ); |
2997 | 0 | } |
2998 | | |
2999 | | /* Retrieves the UTF-8 encoded IP address |
3000 | | * The size should include the end of string character |
3001 | | * Returns 1 if successful, 0 if not set or -1 on error |
3002 | | */ |
3003 | | int libewf_source_get_utf8_ip_address( |
3004 | | libewf_source_t *source, |
3005 | | uint8_t *utf8_string, |
3006 | | size_t utf8_string_size, |
3007 | | libcerror_error_t **error ) |
3008 | 0 | { |
3009 | 0 | libewf_internal_source_t *internal_source = NULL; |
3010 | 0 | static char *function = "libewf_source_get_utf8_ip_address"; |
3011 | 0 | int result = 0; |
3012 | |
|
3013 | 0 | if( source == NULL ) |
3014 | 0 | { |
3015 | 0 | libcerror_error_set( |
3016 | 0 | error, |
3017 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
3018 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
3019 | 0 | "%s: invalid access control entry.", |
3020 | 0 | function ); |
3021 | |
|
3022 | 0 | return( -1 ); |
3023 | 0 | } |
3024 | 0 | internal_source = (libewf_internal_source_t *) source; |
3025 | |
|
3026 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3027 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
3028 | 0 | internal_source->read_write_lock, |
3029 | 0 | error ) != 1 ) |
3030 | 0 | { |
3031 | 0 | libcerror_error_set( |
3032 | 0 | error, |
3033 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3034 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3035 | 0 | "%s: unable to grab read/write lock for reading.", |
3036 | 0 | function ); |
3037 | |
|
3038 | 0 | return( -1 ); |
3039 | 0 | } |
3040 | 0 | #endif |
3041 | 0 | result = libewf_lef_source_get_utf8_ip_address( |
3042 | 0 | internal_source->lef_source, |
3043 | 0 | utf8_string, |
3044 | 0 | utf8_string_size, |
3045 | 0 | error ); |
3046 | |
|
3047 | 0 | if( result == -1 ) |
3048 | 0 | { |
3049 | 0 | libcerror_error_set( |
3050 | 0 | error, |
3051 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3052 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
3053 | 0 | "%s: unable to retrieve UTF-8 IP address size.", |
3054 | 0 | function ); |
3055 | |
|
3056 | 0 | result = -1; |
3057 | 0 | } |
3058 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3059 | 0 | if( libcthreads_read_write_lock_release_for_read( |
3060 | 0 | internal_source->read_write_lock, |
3061 | 0 | error ) != 1 ) |
3062 | 0 | { |
3063 | 0 | libcerror_error_set( |
3064 | 0 | error, |
3065 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3066 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3067 | 0 | "%s: unable to release read/write lock for reading.", |
3068 | 0 | function ); |
3069 | |
|
3070 | 0 | return( -1 ); |
3071 | 0 | } |
3072 | 0 | #endif |
3073 | 0 | return( result ); |
3074 | 0 | } |
3075 | | |
3076 | | /* Retrieves the size of the UTF-16 encoded IP address |
3077 | | * The returned size includes the end of string character |
3078 | | * Returns 1 if successful, 0 if not set or -1 on error |
3079 | | */ |
3080 | | int libewf_source_get_utf16_ip_address_size( |
3081 | | libewf_source_t *source, |
3082 | | size_t *utf16_string_size, |
3083 | | libcerror_error_t **error ) |
3084 | 0 | { |
3085 | 0 | libewf_internal_source_t *internal_source = NULL; |
3086 | 0 | static char *function = "libewf_source_get_utf16_ip_address_size"; |
3087 | 0 | int result = 0; |
3088 | |
|
3089 | 0 | if( source == NULL ) |
3090 | 0 | { |
3091 | 0 | libcerror_error_set( |
3092 | 0 | error, |
3093 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
3094 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
3095 | 0 | "%s: invalid access control entry.", |
3096 | 0 | function ); |
3097 | |
|
3098 | 0 | return( -1 ); |
3099 | 0 | } |
3100 | 0 | internal_source = (libewf_internal_source_t *) source; |
3101 | |
|
3102 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3103 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
3104 | 0 | internal_source->read_write_lock, |
3105 | 0 | error ) != 1 ) |
3106 | 0 | { |
3107 | 0 | libcerror_error_set( |
3108 | 0 | error, |
3109 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3110 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3111 | 0 | "%s: unable to grab read/write lock for reading.", |
3112 | 0 | function ); |
3113 | |
|
3114 | 0 | return( -1 ); |
3115 | 0 | } |
3116 | 0 | #endif |
3117 | 0 | result = libewf_lef_source_get_utf16_ip_address_size( |
3118 | 0 | internal_source->lef_source, |
3119 | 0 | utf16_string_size, |
3120 | 0 | error ); |
3121 | |
|
3122 | 0 | if( result == -1 ) |
3123 | 0 | { |
3124 | 0 | libcerror_error_set( |
3125 | 0 | error, |
3126 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3127 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
3128 | 0 | "%s: unable to retrieve UTF-16 IP address size.", |
3129 | 0 | function ); |
3130 | |
|
3131 | 0 | result = -1; |
3132 | 0 | } |
3133 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3134 | 0 | if( libcthreads_read_write_lock_release_for_read( |
3135 | 0 | internal_source->read_write_lock, |
3136 | 0 | error ) != 1 ) |
3137 | 0 | { |
3138 | 0 | libcerror_error_set( |
3139 | 0 | error, |
3140 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3141 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3142 | 0 | "%s: unable to release read/write lock for reading.", |
3143 | 0 | function ); |
3144 | |
|
3145 | 0 | return( -1 ); |
3146 | 0 | } |
3147 | 0 | #endif |
3148 | 0 | return( result ); |
3149 | 0 | } |
3150 | | |
3151 | | /* Retrieves the UTF-16 encoded IP address |
3152 | | * The size should include the end of string character |
3153 | | * Returns 1 if successful, 0 if not set or -1 on error |
3154 | | */ |
3155 | | int libewf_source_get_utf16_ip_address( |
3156 | | libewf_source_t *source, |
3157 | | uint16_t *utf16_string, |
3158 | | size_t utf16_string_size, |
3159 | | libcerror_error_t **error ) |
3160 | 0 | { |
3161 | 0 | libewf_internal_source_t *internal_source = NULL; |
3162 | 0 | static char *function = "libewf_source_get_utf16_ip_address"; |
3163 | 0 | int result = 0; |
3164 | |
|
3165 | 0 | if( source == NULL ) |
3166 | 0 | { |
3167 | 0 | libcerror_error_set( |
3168 | 0 | error, |
3169 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
3170 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
3171 | 0 | "%s: invalid access control entry.", |
3172 | 0 | function ); |
3173 | |
|
3174 | 0 | return( -1 ); |
3175 | 0 | } |
3176 | 0 | internal_source = (libewf_internal_source_t *) source; |
3177 | |
|
3178 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3179 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
3180 | 0 | internal_source->read_write_lock, |
3181 | 0 | error ) != 1 ) |
3182 | 0 | { |
3183 | 0 | libcerror_error_set( |
3184 | 0 | error, |
3185 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3186 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3187 | 0 | "%s: unable to grab read/write lock for reading.", |
3188 | 0 | function ); |
3189 | |
|
3190 | 0 | return( -1 ); |
3191 | 0 | } |
3192 | 0 | #endif |
3193 | 0 | result = libewf_lef_source_get_utf16_ip_address( |
3194 | 0 | internal_source->lef_source, |
3195 | 0 | utf16_string, |
3196 | 0 | utf16_string_size, |
3197 | 0 | error ); |
3198 | |
|
3199 | 0 | if( result == -1 ) |
3200 | 0 | { |
3201 | 0 | libcerror_error_set( |
3202 | 0 | error, |
3203 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3204 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
3205 | 0 | "%s: unable to retrieve UTF-16 IP address size.", |
3206 | 0 | function ); |
3207 | |
|
3208 | 0 | result = -1; |
3209 | 0 | } |
3210 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3211 | 0 | if( libcthreads_read_write_lock_release_for_read( |
3212 | 0 | internal_source->read_write_lock, |
3213 | 0 | error ) != 1 ) |
3214 | 0 | { |
3215 | 0 | libcerror_error_set( |
3216 | 0 | error, |
3217 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3218 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3219 | 0 | "%s: unable to release read/write lock for reading.", |
3220 | 0 | function ); |
3221 | |
|
3222 | 0 | return( -1 ); |
3223 | 0 | } |
3224 | 0 | #endif |
3225 | 0 | return( result ); |
3226 | 0 | } |
3227 | | |
3228 | | /* Retrieves the size of the UTF-8 encoded MAC address |
3229 | | * The returned size includes the end of string character |
3230 | | * Returns 1 if successful, 0 if not set or -1 on error |
3231 | | */ |
3232 | | int libewf_source_get_utf8_mac_address_size( |
3233 | | libewf_source_t *source, |
3234 | | size_t *utf8_string_size, |
3235 | | libcerror_error_t **error ) |
3236 | 0 | { |
3237 | 0 | libewf_internal_source_t *internal_source = NULL; |
3238 | 0 | static char *function = "libewf_source_get_utf8_mac_address_size"; |
3239 | 0 | int result = 0; |
3240 | |
|
3241 | 0 | if( source == NULL ) |
3242 | 0 | { |
3243 | 0 | libcerror_error_set( |
3244 | 0 | error, |
3245 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
3246 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
3247 | 0 | "%s: invalid access control entry.", |
3248 | 0 | function ); |
3249 | |
|
3250 | 0 | return( -1 ); |
3251 | 0 | } |
3252 | 0 | internal_source = (libewf_internal_source_t *) source; |
3253 | |
|
3254 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3255 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
3256 | 0 | internal_source->read_write_lock, |
3257 | 0 | error ) != 1 ) |
3258 | 0 | { |
3259 | 0 | libcerror_error_set( |
3260 | 0 | error, |
3261 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3262 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3263 | 0 | "%s: unable to grab read/write lock for reading.", |
3264 | 0 | function ); |
3265 | |
|
3266 | 0 | return( -1 ); |
3267 | 0 | } |
3268 | 0 | #endif |
3269 | 0 | result = libewf_lef_source_get_utf8_mac_address_size( |
3270 | 0 | internal_source->lef_source, |
3271 | 0 | utf8_string_size, |
3272 | 0 | error ); |
3273 | |
|
3274 | 0 | if( result == -1 ) |
3275 | 0 | { |
3276 | 0 | libcerror_error_set( |
3277 | 0 | error, |
3278 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3279 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
3280 | 0 | "%s: unable to retrieve UTF-8 MAC address size.", |
3281 | 0 | function ); |
3282 | |
|
3283 | 0 | result = -1; |
3284 | 0 | } |
3285 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3286 | 0 | if( libcthreads_read_write_lock_release_for_read( |
3287 | 0 | internal_source->read_write_lock, |
3288 | 0 | error ) != 1 ) |
3289 | 0 | { |
3290 | 0 | libcerror_error_set( |
3291 | 0 | error, |
3292 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3293 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3294 | 0 | "%s: unable to release read/write lock for reading.", |
3295 | 0 | function ); |
3296 | |
|
3297 | 0 | return( -1 ); |
3298 | 0 | } |
3299 | 0 | #endif |
3300 | 0 | return( result ); |
3301 | 0 | } |
3302 | | |
3303 | | /* Retrieves the UTF-8 encoded MAC address |
3304 | | * The size should include the end of string character |
3305 | | * Returns 1 if successful, 0 if not set or -1 on error |
3306 | | */ |
3307 | | int libewf_source_get_utf8_mac_address( |
3308 | | libewf_source_t *source, |
3309 | | uint8_t *utf8_string, |
3310 | | size_t utf8_string_size, |
3311 | | libcerror_error_t **error ) |
3312 | 0 | { |
3313 | 0 | libewf_internal_source_t *internal_source = NULL; |
3314 | 0 | static char *function = "libewf_source_get_utf8_mac_address"; |
3315 | 0 | int result = 0; |
3316 | |
|
3317 | 0 | if( source == NULL ) |
3318 | 0 | { |
3319 | 0 | libcerror_error_set( |
3320 | 0 | error, |
3321 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
3322 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
3323 | 0 | "%s: invalid access control entry.", |
3324 | 0 | function ); |
3325 | |
|
3326 | 0 | return( -1 ); |
3327 | 0 | } |
3328 | 0 | internal_source = (libewf_internal_source_t *) source; |
3329 | |
|
3330 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3331 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
3332 | 0 | internal_source->read_write_lock, |
3333 | 0 | error ) != 1 ) |
3334 | 0 | { |
3335 | 0 | libcerror_error_set( |
3336 | 0 | error, |
3337 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3338 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3339 | 0 | "%s: unable to grab read/write lock for reading.", |
3340 | 0 | function ); |
3341 | |
|
3342 | 0 | return( -1 ); |
3343 | 0 | } |
3344 | 0 | #endif |
3345 | 0 | result = libewf_lef_source_get_utf8_mac_address( |
3346 | 0 | internal_source->lef_source, |
3347 | 0 | utf8_string, |
3348 | 0 | utf8_string_size, |
3349 | 0 | error ); |
3350 | |
|
3351 | 0 | if( result == -1 ) |
3352 | 0 | { |
3353 | 0 | libcerror_error_set( |
3354 | 0 | error, |
3355 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3356 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
3357 | 0 | "%s: unable to retrieve UTF-8 MAC address size.", |
3358 | 0 | function ); |
3359 | |
|
3360 | 0 | result = -1; |
3361 | 0 | } |
3362 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3363 | 0 | if( libcthreads_read_write_lock_release_for_read( |
3364 | 0 | internal_source->read_write_lock, |
3365 | 0 | error ) != 1 ) |
3366 | 0 | { |
3367 | 0 | libcerror_error_set( |
3368 | 0 | error, |
3369 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3370 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3371 | 0 | "%s: unable to release read/write lock for reading.", |
3372 | 0 | function ); |
3373 | |
|
3374 | 0 | return( -1 ); |
3375 | 0 | } |
3376 | 0 | #endif |
3377 | 0 | return( result ); |
3378 | 0 | } |
3379 | | |
3380 | | /* Retrieves the size of the UTF-16 encoded MAC address |
3381 | | * The returned size includes the end of string character |
3382 | | * Returns 1 if successful, 0 if not set or -1 on error |
3383 | | */ |
3384 | | int libewf_source_get_utf16_mac_address_size( |
3385 | | libewf_source_t *source, |
3386 | | size_t *utf16_string_size, |
3387 | | libcerror_error_t **error ) |
3388 | 0 | { |
3389 | 0 | libewf_internal_source_t *internal_source = NULL; |
3390 | 0 | static char *function = "libewf_source_get_utf16_mac_address_size"; |
3391 | 0 | int result = 0; |
3392 | |
|
3393 | 0 | if( source == NULL ) |
3394 | 0 | { |
3395 | 0 | libcerror_error_set( |
3396 | 0 | error, |
3397 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
3398 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
3399 | 0 | "%s: invalid access control entry.", |
3400 | 0 | function ); |
3401 | |
|
3402 | 0 | return( -1 ); |
3403 | 0 | } |
3404 | 0 | internal_source = (libewf_internal_source_t *) source; |
3405 | |
|
3406 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3407 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
3408 | 0 | internal_source->read_write_lock, |
3409 | 0 | error ) != 1 ) |
3410 | 0 | { |
3411 | 0 | libcerror_error_set( |
3412 | 0 | error, |
3413 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3414 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3415 | 0 | "%s: unable to grab read/write lock for reading.", |
3416 | 0 | function ); |
3417 | |
|
3418 | 0 | return( -1 ); |
3419 | 0 | } |
3420 | 0 | #endif |
3421 | 0 | result = libewf_lef_source_get_utf16_mac_address_size( |
3422 | 0 | internal_source->lef_source, |
3423 | 0 | utf16_string_size, |
3424 | 0 | error ); |
3425 | |
|
3426 | 0 | if( result == -1 ) |
3427 | 0 | { |
3428 | 0 | libcerror_error_set( |
3429 | 0 | error, |
3430 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3431 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
3432 | 0 | "%s: unable to retrieve UTF-16 MAC address size.", |
3433 | 0 | function ); |
3434 | |
|
3435 | 0 | result = -1; |
3436 | 0 | } |
3437 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3438 | 0 | if( libcthreads_read_write_lock_release_for_read( |
3439 | 0 | internal_source->read_write_lock, |
3440 | 0 | error ) != 1 ) |
3441 | 0 | { |
3442 | 0 | libcerror_error_set( |
3443 | 0 | error, |
3444 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3445 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3446 | 0 | "%s: unable to release read/write lock for reading.", |
3447 | 0 | function ); |
3448 | |
|
3449 | 0 | return( -1 ); |
3450 | 0 | } |
3451 | 0 | #endif |
3452 | 0 | return( result ); |
3453 | 0 | } |
3454 | | |
3455 | | /* Retrieves the UTF-16 encoded MAC address |
3456 | | * The size should include the end of string character |
3457 | | * Returns 1 if successful, 0 if not set or -1 on error |
3458 | | */ |
3459 | | int libewf_source_get_utf16_mac_address( |
3460 | | libewf_source_t *source, |
3461 | | uint16_t *utf16_string, |
3462 | | size_t utf16_string_size, |
3463 | | libcerror_error_t **error ) |
3464 | 0 | { |
3465 | 0 | libewf_internal_source_t *internal_source = NULL; |
3466 | 0 | static char *function = "libewf_source_get_utf16_mac_address"; |
3467 | 0 | int result = 0; |
3468 | |
|
3469 | 0 | if( source == NULL ) |
3470 | 0 | { |
3471 | 0 | libcerror_error_set( |
3472 | 0 | error, |
3473 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
3474 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
3475 | 0 | "%s: invalid access control entry.", |
3476 | 0 | function ); |
3477 | |
|
3478 | 0 | return( -1 ); |
3479 | 0 | } |
3480 | 0 | internal_source = (libewf_internal_source_t *) source; |
3481 | |
|
3482 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3483 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
3484 | 0 | internal_source->read_write_lock, |
3485 | 0 | error ) != 1 ) |
3486 | 0 | { |
3487 | 0 | libcerror_error_set( |
3488 | 0 | error, |
3489 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3490 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3491 | 0 | "%s: unable to grab read/write lock for reading.", |
3492 | 0 | function ); |
3493 | |
|
3494 | 0 | return( -1 ); |
3495 | 0 | } |
3496 | 0 | #endif |
3497 | 0 | result = libewf_lef_source_get_utf16_mac_address( |
3498 | 0 | internal_source->lef_source, |
3499 | 0 | utf16_string, |
3500 | 0 | utf16_string_size, |
3501 | 0 | error ); |
3502 | |
|
3503 | 0 | if( result == -1 ) |
3504 | 0 | { |
3505 | 0 | libcerror_error_set( |
3506 | 0 | error, |
3507 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3508 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
3509 | 0 | "%s: unable to retrieve UTF-16 MAC address size.", |
3510 | 0 | function ); |
3511 | |
|
3512 | 0 | result = -1; |
3513 | 0 | } |
3514 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3515 | 0 | if( libcthreads_read_write_lock_release_for_read( |
3516 | 0 | internal_source->read_write_lock, |
3517 | 0 | error ) != 1 ) |
3518 | 0 | { |
3519 | 0 | libcerror_error_set( |
3520 | 0 | error, |
3521 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3522 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3523 | 0 | "%s: unable to release read/write lock for reading.", |
3524 | 0 | function ); |
3525 | |
|
3526 | 0 | return( -1 ); |
3527 | 0 | } |
3528 | 0 | #endif |
3529 | 0 | return( result ); |
3530 | 0 | } |
3531 | | |
3532 | | /* Retrieves the size |
3533 | | * Returns 1 if successful or -1 on error |
3534 | | */ |
3535 | | int libewf_source_get_size( |
3536 | | libewf_source_t *source, |
3537 | | size64_t *size, |
3538 | | libcerror_error_t **error ) |
3539 | 0 | { |
3540 | 0 | libewf_internal_source_t *internal_source = NULL; |
3541 | 0 | static char *function = "libewf_source_get_size"; |
3542 | 0 | int result = 1; |
3543 | |
|
3544 | 0 | if( source == NULL ) |
3545 | 0 | { |
3546 | 0 | libcerror_error_set( |
3547 | 0 | error, |
3548 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
3549 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
3550 | 0 | "%s: invalid source.", |
3551 | 0 | function ); |
3552 | |
|
3553 | 0 | return( -1 ); |
3554 | 0 | } |
3555 | 0 | internal_source = (libewf_internal_source_t *) source; |
3556 | |
|
3557 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3558 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
3559 | 0 | internal_source->read_write_lock, |
3560 | 0 | error ) != 1 ) |
3561 | 0 | { |
3562 | 0 | libcerror_error_set( |
3563 | 0 | error, |
3564 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3565 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3566 | 0 | "%s: unable to grab read/write lock for reading.", |
3567 | 0 | function ); |
3568 | |
|
3569 | 0 | return( -1 ); |
3570 | 0 | } |
3571 | 0 | #endif |
3572 | 0 | if( libewf_lef_source_get_size( |
3573 | 0 | internal_source->lef_source, |
3574 | 0 | size, |
3575 | 0 | error ) != 1 ) |
3576 | 0 | { |
3577 | 0 | libcerror_error_set( |
3578 | 0 | error, |
3579 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3580 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
3581 | 0 | "%s: unable to retrieve size.", |
3582 | 0 | function ); |
3583 | |
|
3584 | 0 | result = -1; |
3585 | 0 | } |
3586 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3587 | 0 | if( libcthreads_read_write_lock_release_for_read( |
3588 | 0 | internal_source->read_write_lock, |
3589 | 0 | error ) != 1 ) |
3590 | 0 | { |
3591 | 0 | libcerror_error_set( |
3592 | 0 | error, |
3593 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3594 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3595 | 0 | "%s: unable to release read/write lock for reading.", |
3596 | 0 | function ); |
3597 | |
|
3598 | 0 | return( -1 ); |
3599 | 0 | } |
3600 | 0 | #endif |
3601 | 0 | return( result ); |
3602 | 0 | } |
3603 | | |
3604 | | /* Retrieves the acquisition date and time |
3605 | | * The date and time is formatted as a POSIX timestamp |
3606 | | * Returns 1 if successful, 0 if not set or -1 on error |
3607 | | */ |
3608 | | int libewf_source_get_acquisition_time( |
3609 | | libewf_source_t *source, |
3610 | | int64_t *posix_time, |
3611 | | libcerror_error_t **error ) |
3612 | 0 | { |
3613 | 0 | libewf_internal_source_t *internal_source = NULL; |
3614 | 0 | static char *function = "libewf_source_get_acquisition_time"; |
3615 | 0 | int result = 1; |
3616 | |
|
3617 | 0 | if( source == NULL ) |
3618 | 0 | { |
3619 | 0 | libcerror_error_set( |
3620 | 0 | error, |
3621 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
3622 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
3623 | 0 | "%s: invalid source.", |
3624 | 0 | function ); |
3625 | |
|
3626 | 0 | return( -1 ); |
3627 | 0 | } |
3628 | 0 | internal_source = (libewf_internal_source_t *) source; |
3629 | |
|
3630 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3631 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
3632 | 0 | internal_source->read_write_lock, |
3633 | 0 | error ) != 1 ) |
3634 | 0 | { |
3635 | 0 | libcerror_error_set( |
3636 | 0 | error, |
3637 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3638 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3639 | 0 | "%s: unable to grab read/write lock for reading.", |
3640 | 0 | function ); |
3641 | |
|
3642 | 0 | return( -1 ); |
3643 | 0 | } |
3644 | 0 | #endif |
3645 | 0 | result = libewf_lef_source_get_acquisition_time( |
3646 | 0 | internal_source->lef_source, |
3647 | 0 | posix_time, |
3648 | 0 | error ); |
3649 | |
|
3650 | 0 | if( result == -1 ) |
3651 | 0 | { |
3652 | 0 | libcerror_error_set( |
3653 | 0 | error, |
3654 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3655 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
3656 | 0 | "%s: unable to retrieve acquisition time.", |
3657 | 0 | function ); |
3658 | |
|
3659 | 0 | result = -1; |
3660 | 0 | } |
3661 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3662 | 0 | if( libcthreads_read_write_lock_release_for_read( |
3663 | 0 | internal_source->read_write_lock, |
3664 | 0 | error ) != 1 ) |
3665 | 0 | { |
3666 | 0 | libcerror_error_set( |
3667 | 0 | error, |
3668 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3669 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3670 | 0 | "%s: unable to release read/write lock for reading.", |
3671 | 0 | function ); |
3672 | |
|
3673 | 0 | return( -1 ); |
3674 | 0 | } |
3675 | 0 | #endif |
3676 | 0 | return( result ); |
3677 | 0 | } |
3678 | | |
3679 | | /* Retrieves the UTF-8 encoded MD5 hash value |
3680 | | * The size should include the end of string character |
3681 | | * Returns 1 if successful, 0 if not set or -1 on error |
3682 | | */ |
3683 | | int libewf_source_get_utf8_hash_value_md5( |
3684 | | libewf_source_t *source, |
3685 | | uint8_t *utf8_string, |
3686 | | size_t utf8_string_size, |
3687 | | libcerror_error_t **error ) |
3688 | 0 | { |
3689 | 0 | libewf_internal_source_t *internal_source = NULL; |
3690 | 0 | static char *function = "libewf_source_get_utf8_hash_value_md5"; |
3691 | 0 | int result = 0; |
3692 | |
|
3693 | 0 | if( source == NULL ) |
3694 | 0 | { |
3695 | 0 | libcerror_error_set( |
3696 | 0 | error, |
3697 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
3698 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
3699 | 0 | "%s: invalid source.", |
3700 | 0 | function ); |
3701 | |
|
3702 | 0 | return( -1 ); |
3703 | 0 | } |
3704 | 0 | internal_source = (libewf_internal_source_t *) source; |
3705 | |
|
3706 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3707 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
3708 | 0 | internal_source->read_write_lock, |
3709 | 0 | error ) != 1 ) |
3710 | 0 | { |
3711 | 0 | libcerror_error_set( |
3712 | 0 | error, |
3713 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3714 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3715 | 0 | "%s: unable to grab read/write lock for reading.", |
3716 | 0 | function ); |
3717 | |
|
3718 | 0 | return( -1 ); |
3719 | 0 | } |
3720 | 0 | #endif |
3721 | 0 | result = libewf_lef_source_get_utf8_hash_value_md5( |
3722 | 0 | internal_source->lef_source, |
3723 | 0 | utf8_string, |
3724 | 0 | utf8_string_size, |
3725 | 0 | error ); |
3726 | |
|
3727 | 0 | if( result == -1 ) |
3728 | 0 | { |
3729 | 0 | libcerror_error_set( |
3730 | 0 | error, |
3731 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3732 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
3733 | 0 | "%s: unable to retrieve hash value: MD5.", |
3734 | 0 | function ); |
3735 | |
|
3736 | 0 | result = -1; |
3737 | 0 | } |
3738 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3739 | 0 | if( libcthreads_read_write_lock_release_for_read( |
3740 | 0 | internal_source->read_write_lock, |
3741 | 0 | error ) != 1 ) |
3742 | 0 | { |
3743 | 0 | libcerror_error_set( |
3744 | 0 | error, |
3745 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3746 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3747 | 0 | "%s: unable to release read/write lock for reading.", |
3748 | 0 | function ); |
3749 | |
|
3750 | 0 | return( -1 ); |
3751 | 0 | } |
3752 | 0 | #endif |
3753 | 0 | return( result ); |
3754 | 0 | } |
3755 | | |
3756 | | /* Retrieves the UTF-16 encoded MD5 hash value |
3757 | | * The size should include the end of string character |
3758 | | * Returns 1 if successful, 0 if not set or -1 on error |
3759 | | */ |
3760 | | int libewf_source_get_utf16_hash_value_md5( |
3761 | | libewf_source_t *source, |
3762 | | uint16_t *utf16_string, |
3763 | | size_t utf16_string_size, |
3764 | | libcerror_error_t **error ) |
3765 | 0 | { |
3766 | 0 | libewf_internal_source_t *internal_source = NULL; |
3767 | 0 | static char *function = "libewf_source_get_utf16_hash_value_md5"; |
3768 | 0 | int result = 0; |
3769 | |
|
3770 | 0 | if( source == NULL ) |
3771 | 0 | { |
3772 | 0 | libcerror_error_set( |
3773 | 0 | error, |
3774 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
3775 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
3776 | 0 | "%s: invalid source.", |
3777 | 0 | function ); |
3778 | |
|
3779 | 0 | return( -1 ); |
3780 | 0 | } |
3781 | 0 | internal_source = (libewf_internal_source_t *) source; |
3782 | |
|
3783 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3784 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
3785 | 0 | internal_source->read_write_lock, |
3786 | 0 | error ) != 1 ) |
3787 | 0 | { |
3788 | 0 | libcerror_error_set( |
3789 | 0 | error, |
3790 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3791 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3792 | 0 | "%s: unable to grab read/write lock for reading.", |
3793 | 0 | function ); |
3794 | |
|
3795 | 0 | return( -1 ); |
3796 | 0 | } |
3797 | 0 | #endif |
3798 | 0 | result = libewf_lef_source_get_utf16_hash_value_md5( |
3799 | 0 | internal_source->lef_source, |
3800 | 0 | utf16_string, |
3801 | 0 | utf16_string_size, |
3802 | 0 | error ); |
3803 | |
|
3804 | 0 | if( result == -1 ) |
3805 | 0 | { |
3806 | 0 | libcerror_error_set( |
3807 | 0 | error, |
3808 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3809 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
3810 | 0 | "%s: unable to retrieve hash value: MD5.", |
3811 | 0 | function ); |
3812 | |
|
3813 | 0 | result = -1; |
3814 | 0 | } |
3815 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3816 | 0 | if( libcthreads_read_write_lock_release_for_read( |
3817 | 0 | internal_source->read_write_lock, |
3818 | 0 | error ) != 1 ) |
3819 | 0 | { |
3820 | 0 | libcerror_error_set( |
3821 | 0 | error, |
3822 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3823 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3824 | 0 | "%s: unable to release read/write lock for reading.", |
3825 | 0 | function ); |
3826 | |
|
3827 | 0 | return( -1 ); |
3828 | 0 | } |
3829 | 0 | #endif |
3830 | 0 | return( result ); |
3831 | 0 | } |
3832 | | |
3833 | | /* Retrieves the UTF-8 encoded SHA1 hash value |
3834 | | * The size should include the end of string character |
3835 | | * Returns 1 if successful, 0 if not set or -1 on error |
3836 | | */ |
3837 | | int libewf_source_get_utf8_hash_value_sha1( |
3838 | | libewf_source_t *source, |
3839 | | uint8_t *utf8_string, |
3840 | | size_t utf8_string_size, |
3841 | | libcerror_error_t **error ) |
3842 | 0 | { |
3843 | 0 | libewf_internal_source_t *internal_source = NULL; |
3844 | 0 | static char *function = "libewf_source_get_utf8_hash_value_sha1"; |
3845 | 0 | int result = 0; |
3846 | |
|
3847 | 0 | if( source == NULL ) |
3848 | 0 | { |
3849 | 0 | libcerror_error_set( |
3850 | 0 | error, |
3851 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
3852 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
3853 | 0 | "%s: invalid source.", |
3854 | 0 | function ); |
3855 | |
|
3856 | 0 | return( -1 ); |
3857 | 0 | } |
3858 | 0 | internal_source = (libewf_internal_source_t *) source; |
3859 | |
|
3860 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3861 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
3862 | 0 | internal_source->read_write_lock, |
3863 | 0 | error ) != 1 ) |
3864 | 0 | { |
3865 | 0 | libcerror_error_set( |
3866 | 0 | error, |
3867 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3868 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3869 | 0 | "%s: unable to grab read/write lock for reading.", |
3870 | 0 | function ); |
3871 | |
|
3872 | 0 | return( -1 ); |
3873 | 0 | } |
3874 | 0 | #endif |
3875 | 0 | result = libewf_lef_source_get_utf8_hash_value_sha1( |
3876 | 0 | internal_source->lef_source, |
3877 | 0 | utf8_string, |
3878 | 0 | utf8_string_size, |
3879 | 0 | error ); |
3880 | |
|
3881 | 0 | if( result == -1 ) |
3882 | 0 | { |
3883 | 0 | libcerror_error_set( |
3884 | 0 | error, |
3885 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3886 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
3887 | 0 | "%s: unable to retrieve hash value: SHA1.", |
3888 | 0 | function ); |
3889 | |
|
3890 | 0 | result = -1; |
3891 | 0 | } |
3892 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3893 | 0 | if( libcthreads_read_write_lock_release_for_read( |
3894 | 0 | internal_source->read_write_lock, |
3895 | 0 | error ) != 1 ) |
3896 | 0 | { |
3897 | 0 | libcerror_error_set( |
3898 | 0 | error, |
3899 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3900 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3901 | 0 | "%s: unable to release read/write lock for reading.", |
3902 | 0 | function ); |
3903 | |
|
3904 | 0 | return( -1 ); |
3905 | 0 | } |
3906 | 0 | #endif |
3907 | 0 | return( result ); |
3908 | 0 | } |
3909 | | |
3910 | | /* Retrieves the UTF-16 encoded SHA1 hash value |
3911 | | * The size should include the end of string character |
3912 | | * Returns 1 if successful, 0 if not set or -1 on error |
3913 | | */ |
3914 | | int libewf_source_get_utf16_hash_value_sha1( |
3915 | | libewf_source_t *source, |
3916 | | uint16_t *utf16_string, |
3917 | | size_t utf16_string_size, |
3918 | | libcerror_error_t **error ) |
3919 | 0 | { |
3920 | 0 | libewf_internal_source_t *internal_source = NULL; |
3921 | 0 | static char *function = "libewf_source_get_utf16_hash_value_sha1"; |
3922 | 0 | int result = 0; |
3923 | |
|
3924 | 0 | if( source == NULL ) |
3925 | 0 | { |
3926 | 0 | libcerror_error_set( |
3927 | 0 | error, |
3928 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
3929 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
3930 | 0 | "%s: invalid source.", |
3931 | 0 | function ); |
3932 | |
|
3933 | 0 | return( -1 ); |
3934 | 0 | } |
3935 | 0 | internal_source = (libewf_internal_source_t *) source; |
3936 | |
|
3937 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3938 | 0 | if( libcthreads_read_write_lock_grab_for_read( |
3939 | 0 | internal_source->read_write_lock, |
3940 | 0 | error ) != 1 ) |
3941 | 0 | { |
3942 | 0 | libcerror_error_set( |
3943 | 0 | error, |
3944 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3945 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3946 | 0 | "%s: unable to grab read/write lock for reading.", |
3947 | 0 | function ); |
3948 | |
|
3949 | 0 | return( -1 ); |
3950 | 0 | } |
3951 | 0 | #endif |
3952 | 0 | result = libewf_lef_source_get_utf16_hash_value_sha1( |
3953 | 0 | internal_source->lef_source, |
3954 | 0 | utf16_string, |
3955 | 0 | utf16_string_size, |
3956 | 0 | error ); |
3957 | |
|
3958 | 0 | if( result == -1 ) |
3959 | 0 | { |
3960 | 0 | libcerror_error_set( |
3961 | 0 | error, |
3962 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3963 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
3964 | 0 | "%s: unable to retrieve hash value: SHA1.", |
3965 | 0 | function ); |
3966 | |
|
3967 | 0 | result = -1; |
3968 | 0 | } |
3969 | 0 | #if defined( HAVE_LIBEWF_MULTI_THREAD_SUPPORT ) |
3970 | 0 | if( libcthreads_read_write_lock_release_for_read( |
3971 | 0 | internal_source->read_write_lock, |
3972 | 0 | error ) != 1 ) |
3973 | 0 | { |
3974 | 0 | libcerror_error_set( |
3975 | 0 | error, |
3976 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
3977 | 0 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, |
3978 | 0 | "%s: unable to release read/write lock for reading.", |
3979 | 0 | function ); |
3980 | |
|
3981 | 0 | return( -1 ); |
3982 | 0 | } |
3983 | 0 | #endif |
3984 | 0 | return( result ); |
3985 | 0 | } |
3986 | | |