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