/src/libfwsi/libfwsi/libfwsi_mtp_volume_values.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * MTP storage device volume (shell item) values functions |
3 | | * |
4 | | * Copyright (C) 2010-2024, Joachim Metz <joachim.metz@gmail.com> |
5 | | * |
6 | | * Refer to AUTHORS for acknowledgements. |
7 | | * |
8 | | * This program is free software: you can redistribute it and/or modify |
9 | | * it under the terms of the GNU Lesser General Public License as published by |
10 | | * the Free Software Foundation, either version 3 of the License, or |
11 | | * (at your option) any later version. |
12 | | * |
13 | | * This program is distributed in the hope that it will be useful, |
14 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | | * GNU General Public License for more details. |
17 | | * |
18 | | * You should have received a copy of the GNU Lesser General Public License |
19 | | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
20 | | */ |
21 | | |
22 | | #include <common.h> |
23 | | #include <byte_stream.h> |
24 | | #include <memory.h> |
25 | | #include <types.h> |
26 | | |
27 | | #include "libfwsi_debug.h" |
28 | | #include "libfwsi_libcerror.h" |
29 | | #include "libfwsi_libcnotify.h" |
30 | | #include "libfwsi_libfguid.h" |
31 | | #include "libfwsi_libfole.h" |
32 | | #include "libfwsi_libuna.h" |
33 | | #include "libfwsi_mtp_volume_values.h" |
34 | | |
35 | | /* Creates MTP volume values |
36 | | * Make sure the value mtp_volume_values is referencing, is set to NULL |
37 | | * Returns 1 if successful or -1 on error |
38 | | */ |
39 | | int libfwsi_mtp_volume_values_initialize( |
40 | | libfwsi_mtp_volume_values_t **mtp_volume_values, |
41 | | libcerror_error_t **error ) |
42 | 0 | { |
43 | 0 | static char *function = "libfwsi_mtp_volume_values_initialize"; |
44 | |
|
45 | 0 | if( mtp_volume_values == NULL ) |
46 | 0 | { |
47 | 0 | libcerror_error_set( |
48 | 0 | error, |
49 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
50 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
51 | 0 | "%s: invalid MTP volume values.", |
52 | 0 | function ); |
53 | |
|
54 | 0 | return( -1 ); |
55 | 0 | } |
56 | 0 | if( *mtp_volume_values != NULL ) |
57 | 0 | { |
58 | 0 | libcerror_error_set( |
59 | 0 | error, |
60 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
61 | 0 | LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, |
62 | 0 | "%s: invalid MTP volume values value already set.", |
63 | 0 | function ); |
64 | |
|
65 | 0 | return( -1 ); |
66 | 0 | } |
67 | 0 | *mtp_volume_values = memory_allocate_structure( |
68 | 0 | libfwsi_mtp_volume_values_t ); |
69 | |
|
70 | 0 | if( *mtp_volume_values == NULL ) |
71 | 0 | { |
72 | 0 | libcerror_error_set( |
73 | 0 | error, |
74 | 0 | LIBCERROR_ERROR_DOMAIN_MEMORY, |
75 | 0 | LIBCERROR_MEMORY_ERROR_INSUFFICIENT, |
76 | 0 | "%s: unable to create MTP volume values.", |
77 | 0 | function ); |
78 | |
|
79 | 0 | goto on_error; |
80 | 0 | } |
81 | 0 | if( memory_set( |
82 | 0 | *mtp_volume_values, |
83 | 0 | 0, |
84 | 0 | sizeof( libfwsi_mtp_volume_values_t ) ) == NULL ) |
85 | 0 | { |
86 | 0 | libcerror_error_set( |
87 | 0 | error, |
88 | 0 | LIBCERROR_ERROR_DOMAIN_MEMORY, |
89 | 0 | LIBCERROR_MEMORY_ERROR_SET_FAILED, |
90 | 0 | "%s: unable to clear MTP volume values.", |
91 | 0 | function ); |
92 | |
|
93 | 0 | goto on_error; |
94 | 0 | } |
95 | 0 | return( 1 ); |
96 | | |
97 | 0 | on_error: |
98 | 0 | if( *mtp_volume_values != NULL ) |
99 | 0 | { |
100 | 0 | memory_free( |
101 | 0 | *mtp_volume_values ); |
102 | |
|
103 | 0 | *mtp_volume_values = NULL; |
104 | 0 | } |
105 | 0 | return( -1 ); |
106 | 0 | } |
107 | | |
108 | | /* Frees MTP volume values |
109 | | * Returns 1 if successful or -1 on error |
110 | | */ |
111 | | int libfwsi_mtp_volume_values_free( |
112 | | libfwsi_mtp_volume_values_t **mtp_volume_values, |
113 | | libcerror_error_t **error ) |
114 | 0 | { |
115 | 0 | static char *function = "libfwsi_mtp_volume_values_free"; |
116 | |
|
117 | 0 | if( mtp_volume_values == NULL ) |
118 | 0 | { |
119 | 0 | libcerror_error_set( |
120 | 0 | error, |
121 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
122 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
123 | 0 | "%s: invalid MTP volume values.", |
124 | 0 | function ); |
125 | |
|
126 | 0 | return( -1 ); |
127 | 0 | } |
128 | 0 | if( *mtp_volume_values != NULL ) |
129 | 0 | { |
130 | 0 | memory_free( |
131 | 0 | *mtp_volume_values ); |
132 | |
|
133 | 0 | *mtp_volume_values = NULL; |
134 | 0 | } |
135 | 0 | return( 1 ); |
136 | 0 | } |
137 | | |
138 | | /* Reads the MTP volume values |
139 | | * Returns 1 if successful, 0 if not supported or -1 on error |
140 | | */ |
141 | | int libfwsi_mtp_volume_values_read_data( |
142 | | libfwsi_mtp_volume_values_t *mtp_volume_values, |
143 | | const uint8_t *data, |
144 | | size_t data_size, |
145 | | libcerror_error_t **error ) |
146 | 0 | { |
147 | 0 | static char *function = "libfwsi_mtp_volume_values_read_data"; |
148 | 0 | size_t data_offset = 0; |
149 | 0 | uint32_t file_system_string_size = 0; |
150 | 0 | uint32_t guid_string_index = 0; |
151 | 0 | uint32_t identifier_string_size = 0; |
152 | 0 | uint32_t name_string_size = 0; |
153 | 0 | uint32_t number_of_guid_strings = 0; |
154 | 0 | uint32_t number_of_properties = 0; |
155 | 0 | uint32_t property_index = 0; |
156 | 0 | uint32_t property_value_type = 0; |
157 | 0 | uint32_t signature = 0; |
158 | 0 | uint32_t string_size = 0; |
159 | 0 | uint16_t item_data_size = 0; |
160 | |
|
161 | | #if defined( HAVE_DEBUG_OUTPUT ) |
162 | | uint32_t value_32bit = 0; |
163 | | uint16_t value_16bit = 0; |
164 | | #endif |
165 | |
|
166 | 0 | if( mtp_volume_values == NULL ) |
167 | 0 | { |
168 | 0 | libcerror_error_set( |
169 | 0 | error, |
170 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
171 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
172 | 0 | "%s: invalid MTP volume values.", |
173 | 0 | function ); |
174 | |
|
175 | 0 | return( -1 ); |
176 | 0 | } |
177 | 0 | if( data == NULL ) |
178 | 0 | { |
179 | 0 | libcerror_error_set( |
180 | 0 | error, |
181 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
182 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
183 | 0 | "%s: invalid data.", |
184 | 0 | function ); |
185 | |
|
186 | 0 | return( -1 ); |
187 | 0 | } |
188 | 0 | if( data_size > (size_t) SSIZE_MAX ) |
189 | 0 | { |
190 | 0 | libcerror_error_set( |
191 | 0 | error, |
192 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
193 | 0 | LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, |
194 | 0 | "%s: data size exceeds maximum.", |
195 | 0 | function ); |
196 | |
|
197 | 0 | return( -1 ); |
198 | 0 | } |
199 | | /* Do not try to parse unsupported data sizes |
200 | | */ |
201 | 0 | if( data_size < 10 ) |
202 | 0 | { |
203 | 0 | return( 0 ); |
204 | 0 | } |
205 | | /* Do not try to parse unsupported shell item signatures |
206 | | */ |
207 | 0 | byte_stream_copy_to_uint32_little_endian( |
208 | 0 | &( data[ 6 ] ), |
209 | 0 | signature ); |
210 | |
|
211 | 0 | if( signature != 0x10312005UL ) |
212 | 0 | { |
213 | 0 | return( 0 ); |
214 | 0 | } |
215 | 0 | byte_stream_copy_to_uint32_little_endian( |
216 | 0 | &( data[ 4 ] ), |
217 | 0 | item_data_size ); |
218 | |
|
219 | | #if defined( HAVE_DEBUG_OUTPUT ) |
220 | | if( libcnotify_verbose != 0 ) |
221 | | { |
222 | | libcnotify_printf( |
223 | | "%s: class type indicator\t\t: 0x%02" PRIx8 "\n", |
224 | | function, |
225 | | data[ 2 ] ); |
226 | | |
227 | | libcnotify_printf( |
228 | | "%s: unknown1\t\t\t\t: 0x%02" PRIx8 "\n", |
229 | | function, |
230 | | data[ 3 ] ); |
231 | | |
232 | | libcnotify_printf( |
233 | | "%s: data size\t\t\t\t: %" PRIu16 "\n", |
234 | | function, |
235 | | item_data_size ); |
236 | | |
237 | | libcnotify_printf( |
238 | | "%s: signature\t\t\t\t: 0x%08" PRIx32 "\n", |
239 | | function, |
240 | | signature ); |
241 | | } |
242 | | #endif /* defined( HAVE_DEBUG_OUTPUT ) */ |
243 | |
|
244 | 0 | if( item_data_size == 0 ) |
245 | 0 | { |
246 | 0 | return( 10 ); |
247 | 0 | } |
248 | 0 | if( ( item_data_size < 44 ) |
249 | 0 | && ( item_data_size > ( data_size - 10 ) ) ) |
250 | 0 | { |
251 | 0 | libcerror_error_set( |
252 | 0 | error, |
253 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
254 | 0 | LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, |
255 | 0 | "%s: invalid data size value out of bounds.", |
256 | 0 | function ); |
257 | |
|
258 | 0 | return( -1 ); |
259 | 0 | } |
260 | 0 | byte_stream_copy_to_uint32_little_endian( |
261 | 0 | &( data[ 38 ] ), |
262 | 0 | name_string_size ); |
263 | |
|
264 | 0 | byte_stream_copy_to_uint32_little_endian( |
265 | 0 | &( data[ 42 ] ), |
266 | 0 | identifier_string_size ); |
267 | |
|
268 | 0 | byte_stream_copy_to_uint32_little_endian( |
269 | 0 | &( data[ 46 ] ), |
270 | 0 | file_system_string_size ); |
271 | |
|
272 | 0 | byte_stream_copy_to_uint32_little_endian( |
273 | 0 | &( data[ 50 ] ), |
274 | 0 | number_of_guid_strings ); |
275 | |
|
276 | | #if defined( HAVE_DEBUG_OUTPUT ) |
277 | | if( libcnotify_verbose != 0 ) |
278 | | { |
279 | | byte_stream_copy_to_uint32_little_endian( |
280 | | &( data[ 10 ] ), |
281 | | value_32bit ); |
282 | | libcnotify_printf( |
283 | | "%s: unknown2\t\t\t\t: 0x%08" PRIx32 "\n", |
284 | | function, |
285 | | value_32bit ); |
286 | | |
287 | | byte_stream_copy_to_uint16_little_endian( |
288 | | &( data[ 14 ] ), |
289 | | value_16bit ); |
290 | | libcnotify_printf( |
291 | | "%s: unknown3\t\t\t\t: 0x%04" PRIx16 "\n", |
292 | | function, |
293 | | value_16bit ); |
294 | | |
295 | | byte_stream_copy_to_uint16_little_endian( |
296 | | &( data[ 16 ] ), |
297 | | value_16bit ); |
298 | | libcnotify_printf( |
299 | | "%s: unknown4\t\t\t\t: 0x%04" PRIx16 "\n", |
300 | | function, |
301 | | value_16bit ); |
302 | | |
303 | | byte_stream_copy_to_uint16_little_endian( |
304 | | &( data[ 18 ] ), |
305 | | value_16bit ); |
306 | | libcnotify_printf( |
307 | | "%s: unknown5\t\t\t\t: 0x%04" PRIx16 "\n", |
308 | | function, |
309 | | value_16bit ); |
310 | | |
311 | | byte_stream_copy_to_uint16_little_endian( |
312 | | &( data[ 20 ] ), |
313 | | value_16bit ); |
314 | | libcnotify_printf( |
315 | | "%s: unknown6\t\t\t\t: 0x%04" PRIx16 "\n", |
316 | | function, |
317 | | value_16bit ); |
318 | | |
319 | | byte_stream_copy_to_uint32_little_endian( |
320 | | &( data[ 22 ] ), |
321 | | value_32bit ); |
322 | | libcnotify_printf( |
323 | | "%s: unknown7\t\t\t\t: 0x%08" PRIx32 "\n", |
324 | | function, |
325 | | value_32bit ); |
326 | | |
327 | | libcnotify_printf( |
328 | | "%s: unknown8:\n", |
329 | | function ); |
330 | | libcnotify_print_data( |
331 | | &( data[ 26 ] ), |
332 | | 8, |
333 | | 0 ); |
334 | | |
335 | | byte_stream_copy_to_uint32_little_endian( |
336 | | &( data[ 34 ] ), |
337 | | value_32bit ); |
338 | | libcnotify_printf( |
339 | | "%s: unknown9\t\t\t\t: 0x%08" PRIx32 "\n", |
340 | | function, |
341 | | value_32bit ); |
342 | | |
343 | | libcnotify_printf( |
344 | | "%s: name string size\t\t\t: %" PRIu32 "\n", |
345 | | function, |
346 | | name_string_size ); |
347 | | |
348 | | libcnotify_printf( |
349 | | "%s: identifier string size\t\t: %" PRIu32 "\n", |
350 | | function, |
351 | | identifier_string_size ); |
352 | | |
353 | | libcnotify_printf( |
354 | | "%s: file system string size\t\t: %" PRIu32 "\n", |
355 | | function, |
356 | | file_system_string_size ); |
357 | | |
358 | | libcnotify_printf( |
359 | | "%s: number of GUID strings\t\t: %" PRIu32 "\n", |
360 | | function, |
361 | | number_of_guid_strings ); |
362 | | } |
363 | | #endif /* defined( HAVE_DEBUG_OUTPUT ) */ |
364 | |
|
365 | 0 | data_offset = 54; |
366 | |
|
367 | 0 | if( name_string_size > 0 ) |
368 | 0 | { |
369 | 0 | name_string_size *= 2; |
370 | | |
371 | | /* TODO check bounds */ |
372 | | #if defined( HAVE_DEBUG_OUTPUT ) |
373 | | if( libcnotify_verbose != 0 ) |
374 | | { |
375 | | if( libfwsi_debug_print_utf16_string_value( |
376 | | function, |
377 | | "name\t\t\t\t", |
378 | | &( data[ data_offset ] ), |
379 | | name_string_size, |
380 | | LIBUNA_ENDIAN_LITTLE, |
381 | | error ) != 1 ) |
382 | | { |
383 | | libcerror_error_set( |
384 | | error, |
385 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
386 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
387 | | "%s: unable to print UTF-16 string value.", |
388 | | function ); |
389 | | |
390 | | return( -1 ); |
391 | | } |
392 | | } |
393 | | #endif |
394 | 0 | data_offset += name_string_size; |
395 | 0 | } |
396 | 0 | if( identifier_string_size > 0 ) |
397 | 0 | { |
398 | 0 | identifier_string_size *= 2; |
399 | | |
400 | | /* TODO check bounds */ |
401 | | #if defined( HAVE_DEBUG_OUTPUT ) |
402 | | if( libcnotify_verbose != 0 ) |
403 | | { |
404 | | if( libfwsi_debug_print_utf16_string_value( |
405 | | function, |
406 | | "identifier\t\t\t\t", |
407 | | &( data[ data_offset ] ), |
408 | | identifier_string_size, |
409 | | LIBUNA_ENDIAN_LITTLE, |
410 | | error ) != 1 ) |
411 | | { |
412 | | libcerror_error_set( |
413 | | error, |
414 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
415 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
416 | | "%s: unable to print UTF-16 string value.", |
417 | | function ); |
418 | | |
419 | | return( -1 ); |
420 | | } |
421 | | } |
422 | | #endif |
423 | 0 | data_offset += identifier_string_size; |
424 | 0 | } |
425 | 0 | if( file_system_string_size > 0 ) |
426 | 0 | { |
427 | 0 | file_system_string_size *= 2; |
428 | | |
429 | | /* TODO check bounds */ |
430 | | #if defined( HAVE_DEBUG_OUTPUT ) |
431 | | if( libcnotify_verbose != 0 ) |
432 | | { |
433 | | if( libfwsi_debug_print_utf16_string_value( |
434 | | function, |
435 | | "file system\t\t\t", |
436 | | &( data[ data_offset ] ), |
437 | | file_system_string_size, |
438 | | LIBUNA_ENDIAN_LITTLE, |
439 | | error ) != 1 ) |
440 | | { |
441 | | libcerror_error_set( |
442 | | error, |
443 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
444 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
445 | | "%s: unable to print UTF-16 string value.", |
446 | | function ); |
447 | | |
448 | | return( -1 ); |
449 | | } |
450 | | } |
451 | | #endif |
452 | 0 | data_offset += file_system_string_size; |
453 | 0 | } |
454 | 0 | for( guid_string_index = 0; |
455 | 0 | guid_string_index < number_of_guid_strings; |
456 | 0 | guid_string_index++ ) |
457 | 0 | { |
458 | | /* TODO check bounds */ |
459 | | #if defined( HAVE_DEBUG_OUTPUT ) |
460 | | if( libcnotify_verbose != 0 ) |
461 | | { |
462 | | if( libfwsi_debug_print_utf16_string_value( |
463 | | function, |
464 | | "GUID\t\t\t\t", |
465 | | &( data[ data_offset ] ), |
466 | | 78, |
467 | | LIBUNA_ENDIAN_LITTLE, |
468 | | error ) != 1 ) |
469 | | { |
470 | | libcerror_error_set( |
471 | | error, |
472 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
473 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
474 | | "%s: unable to print UTF-16 string value.", |
475 | | function ); |
476 | | |
477 | | return( -1 ); |
478 | | } |
479 | | } |
480 | | #endif |
481 | 0 | data_offset += 78; |
482 | 0 | } |
483 | | /* TODO move to common MTP property values function */ |
484 | 0 | if( data_offset < ( data_size - 4 ) ) |
485 | 0 | { |
486 | | #if defined( HAVE_DEBUG_OUTPUT ) |
487 | | if( libcnotify_verbose != 0 ) |
488 | | { |
489 | | byte_stream_copy_to_uint32_little_endian( |
490 | | &( data[ data_offset ] ), |
491 | | value_32bit ); |
492 | | libcnotify_printf( |
493 | | "%s: unknown10\t\t\t\t: 0x%08" PRIx32 "\n", |
494 | | function, |
495 | | value_32bit ); |
496 | | } |
497 | | #endif |
498 | 0 | data_offset += 4; |
499 | 0 | } |
500 | 0 | if( data_offset < ( data_size - 16 ) ) |
501 | 0 | { |
502 | | #if defined( HAVE_DEBUG_OUTPUT ) |
503 | | if( libcnotify_verbose != 0 ) |
504 | | { |
505 | | if( libfwsi_debug_print_guid_value( |
506 | | function, |
507 | | "class identifier\t\t\t", |
508 | | &( data[ data_offset ] ), |
509 | | 16, |
510 | | LIBFGUID_ENDIAN_LITTLE, |
511 | | LIBFGUID_STRING_FORMAT_FLAG_USE_UPPER_CASE | LIBFGUID_STRING_FORMAT_FLAG_USE_SURROUNDING_BRACES, |
512 | | error ) != 1 ) |
513 | | { |
514 | | libcerror_error_set( |
515 | | error, |
516 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
517 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
518 | | "%s: unable to print GUID value.", |
519 | | function ); |
520 | | |
521 | | return( -1 ); |
522 | | } |
523 | | } |
524 | | #endif |
525 | 0 | data_offset += 16; |
526 | 0 | } |
527 | 0 | if( data_offset < ( data_size - 4 ) ) |
528 | 0 | { |
529 | 0 | byte_stream_copy_to_uint32_little_endian( |
530 | 0 | &( data[ data_offset ] ), |
531 | 0 | number_of_properties ); |
532 | |
|
533 | | #if defined( HAVE_DEBUG_OUTPUT ) |
534 | | if( libcnotify_verbose != 0 ) |
535 | | { |
536 | | libcnotify_printf( |
537 | | "%s: number of properties\t\t: %" PRIu32 "\n", |
538 | | function, |
539 | | number_of_properties ); |
540 | | } |
541 | | #endif |
542 | 0 | data_offset += 4; |
543 | 0 | } |
544 | | #if defined( HAVE_DEBUG_OUTPUT ) |
545 | | if( libcnotify_verbose != 0 ) |
546 | | { |
547 | | libcnotify_printf( |
548 | | "\n" ); |
549 | | } |
550 | | #endif |
551 | 0 | for( property_index = 0; |
552 | 0 | property_index < number_of_properties; |
553 | 0 | property_index++ ) |
554 | 0 | { |
555 | | #if defined( HAVE_DEBUG_OUTPUT ) |
556 | | if( libcnotify_verbose != 0 ) |
557 | | { |
558 | | libcnotify_printf( |
559 | | "%s: property value: %" PRIu32 "\n", |
560 | | function, |
561 | | property_index ); |
562 | | } |
563 | | #endif |
564 | | /* TODO at least 24 bytes in size ? */ |
565 | 0 | if( data_offset < ( data_size - 16 ) ) |
566 | 0 | { |
567 | | #if defined( HAVE_DEBUG_OUTPUT ) |
568 | | if( libcnotify_verbose != 0 ) |
569 | | { |
570 | | if( libfwsi_debug_print_guid_value( |
571 | | function, |
572 | | "property set identifier\t\t", |
573 | | &( data[ data_offset ] ), |
574 | | 16, |
575 | | LIBFGUID_ENDIAN_LITTLE, |
576 | | LIBFGUID_STRING_FORMAT_FLAG_USE_UPPER_CASE | LIBFGUID_STRING_FORMAT_FLAG_USE_SURROUNDING_BRACES, |
577 | | error ) != 1 ) |
578 | | { |
579 | | libcerror_error_set( |
580 | | error, |
581 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
582 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
583 | | "%s: unable to print GUID value.", |
584 | | function ); |
585 | | |
586 | | return( -1 ); |
587 | | } |
588 | | } |
589 | | #endif |
590 | 0 | data_offset += 16; |
591 | 0 | } |
592 | 0 | if( data_offset < ( data_size - 4 ) ) |
593 | 0 | { |
594 | | #if defined( HAVE_DEBUG_OUTPUT ) |
595 | | if( libcnotify_verbose != 0 ) |
596 | | { |
597 | | byte_stream_copy_to_uint32_little_endian( |
598 | | &( data[ data_offset ] ), |
599 | | value_32bit ); |
600 | | libcnotify_printf( |
601 | | "%s: property value identifier\t\t: %" PRIu32 "\n", |
602 | | function, |
603 | | value_32bit ); |
604 | | } |
605 | | #endif |
606 | 0 | data_offset += 4; |
607 | 0 | } |
608 | 0 | if( data_offset < ( data_size - 4 ) ) |
609 | 0 | { |
610 | 0 | byte_stream_copy_to_uint32_little_endian( |
611 | 0 | &( data[ data_offset ] ), |
612 | 0 | property_value_type ); |
613 | |
|
614 | | #if defined( HAVE_DEBUG_OUTPUT ) |
615 | | if( libcnotify_verbose != 0 ) |
616 | | { |
617 | | libcnotify_printf( |
618 | | "%s: property value type\t\t: 0x%08" PRIx32 " (%s : %s)\n", |
619 | | function, |
620 | | property_value_type, |
621 | | libfole_value_type_get_identifier( |
622 | | property_value_type ), |
623 | | libfole_value_type_get_description( |
624 | | property_value_type ) ); |
625 | | } |
626 | | #endif |
627 | 0 | data_offset += 4; |
628 | 0 | } |
629 | | /* TODO merge with FOLE */ |
630 | 0 | switch( property_value_type ) |
631 | 0 | { |
632 | 0 | case 0x00000005UL: |
633 | 0 | case 0x00000007UL: |
634 | 0 | case 0x00000015UL: |
635 | | #if defined( HAVE_DEBUG_OUTPUT ) |
636 | | if( libcnotify_verbose != 0 ) |
637 | | { |
638 | | libcnotify_printf( |
639 | | "%s: value data:\n", |
640 | | function ); |
641 | | libcnotify_print_data( |
642 | | &( data[ data_offset ] ), |
643 | | 8, |
644 | | 0 ); |
645 | | } |
646 | | #endif |
647 | 0 | data_offset += 8; |
648 | |
|
649 | 0 | break; |
650 | | |
651 | 0 | case 0x0000000bUL: |
652 | 0 | case 0x00000012UL: |
653 | 0 | if( data_offset < ( data_size - 2 ) ) |
654 | 0 | { |
655 | | #if defined( HAVE_DEBUG_OUTPUT ) |
656 | | if( libcnotify_verbose != 0 ) |
657 | | { |
658 | | byte_stream_copy_to_uint16_little_endian( |
659 | | &( data[ data_offset ] ), |
660 | | value_16bit ); |
661 | | libcnotify_printf( |
662 | | "%s: value\t\t\t\t: 0x%04" PRIx16 "\n", |
663 | | function, |
664 | | value_16bit ); |
665 | | |
666 | | libcnotify_printf( |
667 | | "\n" ); |
668 | | } |
669 | | #endif |
670 | 0 | data_offset += 2; |
671 | 0 | } |
672 | 0 | break; |
673 | | |
674 | 0 | case 0x0000000aUL: |
675 | 0 | case 0x00000013UL: |
676 | 0 | if( data_offset < ( data_size - 4 ) ) |
677 | 0 | { |
678 | | #if defined( HAVE_DEBUG_OUTPUT ) |
679 | | if( libcnotify_verbose != 0 ) |
680 | | { |
681 | | byte_stream_copy_to_uint32_little_endian( |
682 | | &( data[ data_offset ] ), |
683 | | value_32bit ); |
684 | | libcnotify_printf( |
685 | | "%s: value\t\t\t\t: 0x%08" PRIx32 "\n", |
686 | | function, |
687 | | value_32bit ); |
688 | | |
689 | | libcnotify_printf( |
690 | | "\n" ); |
691 | | } |
692 | | #endif |
693 | 0 | data_offset += 4; |
694 | 0 | } |
695 | 0 | break; |
696 | | |
697 | 0 | case 0x0000001fUL: |
698 | 0 | if( data_offset < ( data_size - 4 ) ) |
699 | 0 | { |
700 | 0 | byte_stream_copy_to_uint32_little_endian( |
701 | 0 | &( data[ data_offset ] ), |
702 | 0 | string_size ); |
703 | |
|
704 | | #if defined( HAVE_DEBUG_OUTPUT ) |
705 | | if( libcnotify_verbose != 0 ) |
706 | | { |
707 | | libcnotify_printf( |
708 | | "%s: string size\t\t\t: %" PRIu32 "\n", |
709 | | function, |
710 | | string_size ); |
711 | | } |
712 | | #endif |
713 | 0 | data_offset += 4; |
714 | |
|
715 | 0 | if( string_size > 0 ) |
716 | 0 | { |
717 | | #if defined( HAVE_DEBUG_OUTPUT ) |
718 | | if( libcnotify_verbose != 0 ) |
719 | | { |
720 | | if( libfwsi_debug_print_utf16_string_value( |
721 | | function, |
722 | | "string\t\t\t\t", |
723 | | &( data[ data_offset ] ), |
724 | | string_size, |
725 | | LIBUNA_ENDIAN_LITTLE, |
726 | | error ) != 1 ) |
727 | | { |
728 | | libcerror_error_set( |
729 | | error, |
730 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
731 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
732 | | "%s: unable to print UTF-16 string value.", |
733 | | function ); |
734 | | |
735 | | return( -1 ); |
736 | | } |
737 | | libcnotify_printf( |
738 | | "\n" ); |
739 | | } |
740 | | #endif |
741 | 0 | data_offset += string_size; |
742 | 0 | } |
743 | 0 | } |
744 | 0 | break; |
745 | | |
746 | 0 | case 0x00000048UL: |
747 | 0 | if( data_offset < ( data_size - 16 ) ) |
748 | 0 | { |
749 | | #if defined( HAVE_DEBUG_OUTPUT ) |
750 | | if( libcnotify_verbose != 0 ) |
751 | | { |
752 | | if( libfwsi_debug_print_guid_value( |
753 | | function, |
754 | | "GUID\t\t\t\t", |
755 | | &( data[ data_offset ] ), |
756 | | 16, |
757 | | LIBFGUID_ENDIAN_LITTLE, |
758 | | LIBFGUID_STRING_FORMAT_FLAG_USE_UPPER_CASE | LIBFGUID_STRING_FORMAT_FLAG_USE_SURROUNDING_BRACES, |
759 | | error ) != 1 ) |
760 | | { |
761 | | libcerror_error_set( |
762 | | error, |
763 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
764 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
765 | | "%s: unable to print GUID value.", |
766 | | function ); |
767 | | |
768 | | return( -1 ); |
769 | | } |
770 | | libcnotify_printf( |
771 | | "\n" ); |
772 | | } |
773 | | #endif |
774 | 0 | data_offset += 16; |
775 | 0 | } |
776 | 0 | break; |
777 | 0 | } |
778 | 0 | } |
779 | | /* TODO */ |
780 | | |
781 | | #if defined( HAVE_DEBUG_OUTPUT ) |
782 | | if( libcnotify_verbose != 0 ) |
783 | | { |
784 | | libcnotify_printf( |
785 | | "\n" ); |
786 | | } |
787 | | #endif |
788 | 0 | return( 1 ); |
789 | 0 | } |
790 | | |