/src/libfwsi/libfwsi/libfwsi_mtp_file_entry_values.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * MTP storage device file entry (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_file_entry_values.h" |
34 | | |
35 | | /* Creates MTP file entry values |
36 | | * Make sure the value mtp_file_entry_values is referencing, is set to NULL |
37 | | * Returns 1 if successful or -1 on error |
38 | | */ |
39 | | int libfwsi_mtp_file_entry_values_initialize( |
40 | | libfwsi_mtp_file_entry_values_t **mtp_file_entry_values, |
41 | | libcerror_error_t **error ) |
42 | 0 | { |
43 | 0 | static char *function = "libfwsi_mtp_file_entry_values_initialize"; |
44 | |
|
45 | 0 | if( mtp_file_entry_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 file entry values.", |
52 | 0 | function ); |
53 | |
|
54 | 0 | return( -1 ); |
55 | 0 | } |
56 | 0 | if( *mtp_file_entry_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 file entry values value already set.", |
63 | 0 | function ); |
64 | |
|
65 | 0 | return( -1 ); |
66 | 0 | } |
67 | 0 | *mtp_file_entry_values = memory_allocate_structure( |
68 | 0 | libfwsi_mtp_file_entry_values_t ); |
69 | |
|
70 | 0 | if( *mtp_file_entry_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 file entry values.", |
77 | 0 | function ); |
78 | |
|
79 | 0 | goto on_error; |
80 | 0 | } |
81 | 0 | if( memory_set( |
82 | 0 | *mtp_file_entry_values, |
83 | 0 | 0, |
84 | 0 | sizeof( libfwsi_mtp_file_entry_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 file entry 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_file_entry_values != NULL ) |
99 | 0 | { |
100 | 0 | memory_free( |
101 | 0 | *mtp_file_entry_values ); |
102 | |
|
103 | 0 | *mtp_file_entry_values = NULL; |
104 | 0 | } |
105 | 0 | return( -1 ); |
106 | 0 | } |
107 | | |
108 | | /* Frees MTP file entry values |
109 | | * Returns 1 if successful or -1 on error |
110 | | */ |
111 | | int libfwsi_mtp_file_entry_values_free( |
112 | | libfwsi_mtp_file_entry_values_t **mtp_file_entry_values, |
113 | | libcerror_error_t **error ) |
114 | 0 | { |
115 | 0 | static char *function = "libfwsi_mtp_file_entry_values_free"; |
116 | |
|
117 | 0 | if( mtp_file_entry_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 file entry values.", |
124 | 0 | function ); |
125 | |
|
126 | 0 | return( -1 ); |
127 | 0 | } |
128 | 0 | if( *mtp_file_entry_values != NULL ) |
129 | 0 | { |
130 | 0 | memory_free( |
131 | 0 | *mtp_file_entry_values ); |
132 | |
|
133 | 0 | *mtp_file_entry_values = NULL; |
134 | 0 | } |
135 | 0 | return( 1 ); |
136 | 0 | } |
137 | | |
138 | | /* Reads the MTP file entry values |
139 | | * Returns 1 if successful, 0 if not supported or -1 on error |
140 | | */ |
141 | | int libfwsi_mtp_file_entry_values_read_data( |
142 | | libfwsi_mtp_file_entry_values_t *mtp_file_entry_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_file_entry_values_read_data"; |
148 | 0 | size_t data_offset = 0; |
149 | 0 | uint32_t identifier_string_size = 0; |
150 | 0 | uint32_t name2_string_size = 0; |
151 | 0 | uint32_t name_string_size = 0; |
152 | 0 | uint32_t number_of_properties = 0; |
153 | 0 | uint32_t property_index = 0; |
154 | 0 | uint32_t property_value_type = 0; |
155 | 0 | uint32_t signature = 0; |
156 | 0 | uint32_t string_size = 0; |
157 | 0 | uint16_t item_data_size = 0; |
158 | |
|
159 | | #if defined( HAVE_DEBUG_OUTPUT ) |
160 | | uint32_t value_32bit = 0; |
161 | | uint16_t value_16bit = 0; |
162 | | #endif |
163 | |
|
164 | 0 | if( mtp_file_entry_values == NULL ) |
165 | 0 | { |
166 | 0 | libcerror_error_set( |
167 | 0 | error, |
168 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
169 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
170 | 0 | "%s: invalid MTP file entry values.", |
171 | 0 | function ); |
172 | |
|
173 | 0 | return( -1 ); |
174 | 0 | } |
175 | 0 | if( data == NULL ) |
176 | 0 | { |
177 | 0 | libcerror_error_set( |
178 | 0 | error, |
179 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
180 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
181 | 0 | "%s: invalid data.", |
182 | 0 | function ); |
183 | |
|
184 | 0 | return( -1 ); |
185 | 0 | } |
186 | 0 | if( data_size > (size_t) SSIZE_MAX ) |
187 | 0 | { |
188 | 0 | libcerror_error_set( |
189 | 0 | error, |
190 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
191 | 0 | LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, |
192 | 0 | "%s: data size exceeds maximum.", |
193 | 0 | function ); |
194 | |
|
195 | 0 | return( -1 ); |
196 | 0 | } |
197 | | /* Do not try to parse unsupported data sizes |
198 | | */ |
199 | 0 | if( data_size < 10 ) |
200 | 0 | { |
201 | 0 | return( 0 ); |
202 | 0 | } |
203 | | /* Do not try to parse unsupported shell item signatures |
204 | | */ |
205 | 0 | byte_stream_copy_to_uint32_little_endian( |
206 | 0 | &( data[ 6 ] ), |
207 | 0 | signature ); |
208 | |
|
209 | 0 | if( signature != 0x07192006UL ) |
210 | 0 | { |
211 | 0 | return( 0 ); |
212 | 0 | } |
213 | 0 | byte_stream_copy_to_uint32_little_endian( |
214 | 0 | &( data[ 4 ] ), |
215 | 0 | item_data_size ); |
216 | |
|
217 | | #if defined( HAVE_DEBUG_OUTPUT ) |
218 | | if( libcnotify_verbose != 0 ) |
219 | | { |
220 | | libcnotify_printf( |
221 | | "%s: class type indicator\t\t: 0x%02" PRIx8 "\n", |
222 | | function, |
223 | | data[ 2 ] ); |
224 | | |
225 | | libcnotify_printf( |
226 | | "%s: unknown1\t\t\t\t: 0x%02" PRIx8 "\n", |
227 | | function, |
228 | | data[ 3 ] ); |
229 | | |
230 | | libcnotify_printf( |
231 | | "%s: data size\t\t\t\t: %" PRIu16 "\n", |
232 | | function, |
233 | | item_data_size ); |
234 | | |
235 | | libcnotify_printf( |
236 | | "%s: signature\t\t\t\t: 0x%08" PRIx32 "\n", |
237 | | function, |
238 | | signature ); |
239 | | } |
240 | | #endif |
241 | 0 | if( item_data_size == 0 ) |
242 | 0 | { |
243 | 0 | return( 10 ); |
244 | 0 | } |
245 | 0 | if( ( item_data_size < 44 ) |
246 | 0 | && ( item_data_size > ( data_size - 10 ) ) ) |
247 | 0 | { |
248 | 0 | libcerror_error_set( |
249 | 0 | error, |
250 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
251 | 0 | LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, |
252 | 0 | "%s: invalid data size value out of bounds.", |
253 | 0 | function ); |
254 | |
|
255 | 0 | return( -1 ); |
256 | 0 | } |
257 | | /* TODO */ |
258 | 0 | byte_stream_copy_to_uint32_little_endian( |
259 | 0 | &( data[ 62 ] ), |
260 | 0 | name_string_size ); |
261 | |
|
262 | 0 | byte_stream_copy_to_uint32_little_endian( |
263 | 0 | &( data[ 66 ] ), |
264 | 0 | name2_string_size ); |
265 | |
|
266 | 0 | byte_stream_copy_to_uint32_little_endian( |
267 | 0 | &( data[ 70 ] ), |
268 | 0 | identifier_string_size ); |
269 | |
|
270 | | #if defined( HAVE_DEBUG_OUTPUT ) |
271 | | if( libcnotify_verbose != 0 ) |
272 | | { |
273 | | byte_stream_copy_to_uint32_little_endian( |
274 | | &( data[ 10 ] ), |
275 | | value_32bit ); |
276 | | libcnotify_printf( |
277 | | "%s: unknown2\t\t\t\t: 0x%08" PRIx32 "\n", |
278 | | function, |
279 | | value_32bit ); |
280 | | |
281 | | byte_stream_copy_to_uint16_little_endian( |
282 | | &( data[ 14 ] ), |
283 | | value_16bit ); |
284 | | libcnotify_printf( |
285 | | "%s: unknown3\t\t\t\t: 0x%04" PRIx16 "\n", |
286 | | function, |
287 | | value_16bit ); |
288 | | |
289 | | byte_stream_copy_to_uint16_little_endian( |
290 | | &( data[ 16 ] ), |
291 | | value_16bit ); |
292 | | libcnotify_printf( |
293 | | "%s: unknown4\t\t\t\t: 0x%04" PRIx16 "\n", |
294 | | function, |
295 | | value_16bit ); |
296 | | |
297 | | byte_stream_copy_to_uint16_little_endian( |
298 | | &( data[ 18 ] ), |
299 | | value_16bit ); |
300 | | libcnotify_printf( |
301 | | "%s: unknown5\t\t\t\t: 0x%04" PRIx16 "\n", |
302 | | function, |
303 | | value_16bit ); |
304 | | |
305 | | byte_stream_copy_to_uint16_little_endian( |
306 | | &( data[ 20 ] ), |
307 | | value_16bit ); |
308 | | libcnotify_printf( |
309 | | "%s: unknown6\t\t\t\t: 0x%04" PRIx16 "\n", |
310 | | function, |
311 | | value_16bit ); |
312 | | |
313 | | byte_stream_copy_to_uint32_little_endian( |
314 | | &( data[ 22 ] ), |
315 | | value_32bit ); |
316 | | libcnotify_printf( |
317 | | "%s: unknown7\t\t\t\t: 0x%08" PRIx32 "\n", |
318 | | function, |
319 | | value_32bit ); |
320 | | |
321 | | libcnotify_printf( |
322 | | "%s: unknown8:\n", |
323 | | function ); |
324 | | libcnotify_print_data( |
325 | | &( data[ 26 ] ), |
326 | | 8, |
327 | | 0 ); |
328 | | |
329 | | byte_stream_copy_to_uint32_little_endian( |
330 | | &( data[ 34 ] ), |
331 | | value_32bit ); |
332 | | libcnotify_printf( |
333 | | "%s: unknown9\t\t\t\t: 0x%08" PRIx32 "\n", |
334 | | function, |
335 | | value_32bit ); |
336 | | |
337 | | /* TODO */ |
338 | | libcnotify_printf( |
339 | | "%s: name string size\t\t\t: %" PRIu32 "\n", |
340 | | function, |
341 | | name_string_size ); |
342 | | |
343 | | libcnotify_printf( |
344 | | "%s: name string size\t\t\t: %" PRIu32 "\n", |
345 | | function, |
346 | | name2_string_size ); |
347 | | |
348 | | libcnotify_printf( |
349 | | "%s: identifier string size\t\t: %" PRIu32 "\n", |
350 | | function, |
351 | | identifier_string_size ); |
352 | | } |
353 | | #endif |
354 | 0 | data_offset = 74; |
355 | |
|
356 | 0 | if( name_string_size > 0 ) |
357 | 0 | { |
358 | 0 | name_string_size *= 2; |
359 | | |
360 | | /* TODO check bounds */ |
361 | | #if defined( HAVE_DEBUG_OUTPUT ) |
362 | | if( libcnotify_verbose != 0 ) |
363 | | { |
364 | | if( libfwsi_debug_print_utf16_string_value( |
365 | | function, |
366 | | "name\t\t\t\t", |
367 | | &( data[ data_offset ] ), |
368 | | name_string_size, |
369 | | LIBUNA_ENDIAN_LITTLE, |
370 | | error ) != 1 ) |
371 | | { |
372 | | libcerror_error_set( |
373 | | error, |
374 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
375 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
376 | | "%s: unable to print UTF-16 string value.", |
377 | | function ); |
378 | | |
379 | | return( -1 ); |
380 | | } |
381 | | } |
382 | | #endif |
383 | 0 | data_offset += name_string_size; |
384 | 0 | } |
385 | 0 | if( name2_string_size > 0 ) |
386 | 0 | { |
387 | 0 | name2_string_size *= 2; |
388 | | |
389 | | /* TODO check bounds */ |
390 | | #if defined( HAVE_DEBUG_OUTPUT ) |
391 | | if( libcnotify_verbose != 0 ) |
392 | | { |
393 | | if( libfwsi_debug_print_utf16_string_value( |
394 | | function, |
395 | | "name\t\t\t\t", |
396 | | &( data[ data_offset ] ), |
397 | | name2_string_size, |
398 | | LIBUNA_ENDIAN_LITTLE, |
399 | | error ) != 1 ) |
400 | | { |
401 | | libcerror_error_set( |
402 | | error, |
403 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
404 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
405 | | "%s: unable to print UTF-16 string value.", |
406 | | function ); |
407 | | |
408 | | return( -1 ); |
409 | | } |
410 | | } |
411 | | #endif |
412 | 0 | data_offset += name2_string_size; |
413 | 0 | } |
414 | 0 | if( identifier_string_size > 0 ) |
415 | 0 | { |
416 | 0 | identifier_string_size *= 2; |
417 | | |
418 | | /* TODO check bounds */ |
419 | | #if defined( HAVE_DEBUG_OUTPUT ) |
420 | | if( libcnotify_verbose != 0 ) |
421 | | { |
422 | | if( libfwsi_debug_print_utf16_string_value( |
423 | | function, |
424 | | "identifier\t\t\t\t", |
425 | | &( data[ data_offset ] ), |
426 | | identifier_string_size, |
427 | | LIBUNA_ENDIAN_LITTLE, |
428 | | error ) != 1 ) |
429 | | { |
430 | | libcerror_error_set( |
431 | | error, |
432 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
433 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
434 | | "%s: unable to print UTF-16 string value.", |
435 | | function ); |
436 | | |
437 | | return( -1 ); |
438 | | } |
439 | | } |
440 | | #endif |
441 | 0 | data_offset += identifier_string_size; |
442 | 0 | } |
443 | | /* TODO refactor */ |
444 | 0 | if( data_offset < ( data_size - 4 ) ) |
445 | 0 | { |
446 | | #if defined( HAVE_DEBUG_OUTPUT ) |
447 | | if( libcnotify_verbose != 0 ) |
448 | | { |
449 | | byte_stream_copy_to_uint32_little_endian( |
450 | | &( data[ data_offset ] ), |
451 | | value_32bit ); |
452 | | libcnotify_printf( |
453 | | "%s: unknown10\t\t\t\t: 0x%08" PRIx32 "\n", |
454 | | function, |
455 | | value_32bit ); |
456 | | } |
457 | | #endif |
458 | 0 | data_offset += 4; |
459 | 0 | } |
460 | 0 | if( data_offset < ( data_size - 16 ) ) |
461 | 0 | { |
462 | | #if defined( HAVE_DEBUG_OUTPUT ) |
463 | | if( libcnotify_verbose != 0 ) |
464 | | { |
465 | | if( libfwsi_debug_print_guid_value( |
466 | | function, |
467 | | "class identifier\t\t\t", |
468 | | &( data[ data_offset ] ), |
469 | | 16, |
470 | | LIBFGUID_ENDIAN_LITTLE, |
471 | | LIBFGUID_STRING_FORMAT_FLAG_USE_UPPER_CASE | LIBFGUID_STRING_FORMAT_FLAG_USE_SURROUNDING_BRACES, |
472 | | error ) != 1 ) |
473 | | { |
474 | | libcerror_error_set( |
475 | | error, |
476 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
477 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
478 | | "%s: unable to print GUID value.", |
479 | | function ); |
480 | | |
481 | | return( -1 ); |
482 | | } |
483 | | } |
484 | | #endif |
485 | 0 | data_offset += 16; |
486 | 0 | } |
487 | 0 | if( data_offset < ( data_size - 4 ) ) |
488 | 0 | { |
489 | 0 | byte_stream_copy_to_uint32_little_endian( |
490 | 0 | &( data[ data_offset ] ), |
491 | 0 | number_of_properties ); |
492 | |
|
493 | | #if defined( HAVE_DEBUG_OUTPUT ) |
494 | | if( libcnotify_verbose != 0 ) |
495 | | { |
496 | | libcnotify_printf( |
497 | | "%s: number of properties\t\t: %" PRIu32 "\n", |
498 | | function, |
499 | | number_of_properties ); |
500 | | } |
501 | | #endif |
502 | 0 | data_offset += 4; |
503 | 0 | } |
504 | | #if defined( HAVE_DEBUG_OUTPUT ) |
505 | | if( libcnotify_verbose != 0 ) |
506 | | { |
507 | | libcnotify_printf( |
508 | | "\n" ); |
509 | | } |
510 | | #endif |
511 | 0 | for( property_index = 0; |
512 | 0 | property_index < number_of_properties; |
513 | 0 | property_index++ ) |
514 | 0 | { |
515 | | #if defined( HAVE_DEBUG_OUTPUT ) |
516 | | if( libcnotify_verbose != 0 ) |
517 | | { |
518 | | libcnotify_printf( |
519 | | "%s: property value: %" PRIu32 "\n", |
520 | | function, |
521 | | property_index ); |
522 | | } |
523 | | #endif |
524 | | /* TODO at least 24 bytes in size ? */ |
525 | 0 | if( data_offset < ( data_size - 16 ) ) |
526 | 0 | { |
527 | | #if defined( HAVE_DEBUG_OUTPUT ) |
528 | | if( libcnotify_verbose != 0 ) |
529 | | { |
530 | | if( libfwsi_debug_print_guid_value( |
531 | | function, |
532 | | "property set identifier\t\t", |
533 | | &( data[ data_offset ] ), |
534 | | 16, |
535 | | LIBFGUID_ENDIAN_LITTLE, |
536 | | LIBFGUID_STRING_FORMAT_FLAG_USE_UPPER_CASE | LIBFGUID_STRING_FORMAT_FLAG_USE_SURROUNDING_BRACES, |
537 | | error ) != 1 ) |
538 | | { |
539 | | libcerror_error_set( |
540 | | error, |
541 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
542 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
543 | | "%s: unable to print GUID value.", |
544 | | function ); |
545 | | |
546 | | return( -1 ); |
547 | | } |
548 | | } |
549 | | #endif |
550 | 0 | data_offset += 16; |
551 | 0 | } |
552 | 0 | if( data_offset < ( data_size - 4 ) ) |
553 | 0 | { |
554 | | #if defined( HAVE_DEBUG_OUTPUT ) |
555 | | if( libcnotify_verbose != 0 ) |
556 | | { |
557 | | byte_stream_copy_to_uint32_little_endian( |
558 | | &( data[ data_offset ] ), |
559 | | value_32bit ); |
560 | | libcnotify_printf( |
561 | | "%s: property value identifier\t\t: %" PRIu32 "\n", |
562 | | function, |
563 | | value_32bit ); |
564 | | } |
565 | | #endif |
566 | 0 | data_offset += 4; |
567 | 0 | } |
568 | 0 | if( data_offset < ( data_size - 4 ) ) |
569 | 0 | { |
570 | 0 | byte_stream_copy_to_uint32_little_endian( |
571 | 0 | &( data[ data_offset ] ), |
572 | 0 | property_value_type ); |
573 | |
|
574 | | #if defined( HAVE_DEBUG_OUTPUT ) |
575 | | if( libcnotify_verbose != 0 ) |
576 | | { |
577 | | libcnotify_printf( |
578 | | "%s: property value type\t\t\t: 0x%08" PRIx32 " (%s : %s)\n", |
579 | | function, |
580 | | property_value_type, |
581 | | libfole_value_type_get_identifier( |
582 | | property_value_type ), |
583 | | libfole_value_type_get_description( |
584 | | property_value_type ) ); |
585 | | } |
586 | | #endif |
587 | 0 | data_offset += 4; |
588 | 0 | } |
589 | | /* TODO merge with FOLE */ |
590 | 0 | switch( property_value_type ) |
591 | 0 | { |
592 | 0 | case 0x00000005UL: |
593 | 0 | case 0x00000007UL: |
594 | 0 | case 0x00000015UL: |
595 | | #if defined( HAVE_DEBUG_OUTPUT ) |
596 | | if( libcnotify_verbose != 0 ) |
597 | | { |
598 | | libcnotify_printf( |
599 | | "%s: value data:\n", |
600 | | function ); |
601 | | libcnotify_print_data( |
602 | | &( data[ data_offset ] ), |
603 | | 8, |
604 | | 0 ); |
605 | | } |
606 | | #endif |
607 | 0 | data_offset += 8; |
608 | |
|
609 | 0 | break; |
610 | | |
611 | 0 | case 0x0000000bUL: |
612 | 0 | case 0x00000012UL: |
613 | 0 | if( data_offset < ( data_size - 2 ) ) |
614 | 0 | { |
615 | | #if defined( HAVE_DEBUG_OUTPUT ) |
616 | | if( libcnotify_verbose != 0 ) |
617 | | { |
618 | | byte_stream_copy_to_uint16_little_endian( |
619 | | &( data[ data_offset ] ), |
620 | | value_16bit ); |
621 | | libcnotify_printf( |
622 | | "%s: value\t\t\t\t: 0x%04" PRIx16 "\n", |
623 | | function, |
624 | | value_16bit ); |
625 | | |
626 | | libcnotify_printf( |
627 | | "\n" ); |
628 | | } |
629 | | #endif |
630 | 0 | data_offset += 2; |
631 | 0 | } |
632 | 0 | break; |
633 | | |
634 | 0 | case 0x0000000aUL: |
635 | 0 | case 0x00000013UL: |
636 | 0 | if( data_offset < ( data_size - 4 ) ) |
637 | 0 | { |
638 | | #if defined( HAVE_DEBUG_OUTPUT ) |
639 | | if( libcnotify_verbose != 0 ) |
640 | | { |
641 | | byte_stream_copy_to_uint32_little_endian( |
642 | | &( data[ data_offset ] ), |
643 | | value_32bit ); |
644 | | libcnotify_printf( |
645 | | "%s: value\t\t\t\t: 0x%08" PRIx32 "\n", |
646 | | function, |
647 | | value_32bit ); |
648 | | |
649 | | libcnotify_printf( |
650 | | "\n" ); |
651 | | } |
652 | | #endif |
653 | 0 | data_offset += 4; |
654 | 0 | } |
655 | 0 | break; |
656 | | |
657 | 0 | case 0x0000001fUL: |
658 | 0 | if( data_offset < ( data_size - 4 ) ) |
659 | 0 | { |
660 | 0 | byte_stream_copy_to_uint32_little_endian( |
661 | 0 | &( data[ data_offset ] ), |
662 | 0 | string_size ); |
663 | |
|
664 | | #if defined( HAVE_DEBUG_OUTPUT ) |
665 | | if( libcnotify_verbose != 0 ) |
666 | | { |
667 | | libcnotify_printf( |
668 | | "%s: string size\t\t\t\t: %" PRIu32 "\n", |
669 | | function, |
670 | | string_size ); |
671 | | } |
672 | | #endif |
673 | 0 | data_offset += 4; |
674 | |
|
675 | 0 | if( string_size > 0 ) |
676 | 0 | { |
677 | | #if defined( HAVE_DEBUG_OUTPUT ) |
678 | | if( libcnotify_verbose != 0 ) |
679 | | { |
680 | | if( libfwsi_debug_print_utf16_string_value( |
681 | | function, |
682 | | "string\t\t\t\t", |
683 | | &( data[ data_offset ] ), |
684 | | string_size, |
685 | | LIBUNA_ENDIAN_LITTLE, |
686 | | error ) != 1 ) |
687 | | { |
688 | | libcerror_error_set( |
689 | | error, |
690 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
691 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
692 | | "%s: unable to print UTF-16 string value.", |
693 | | function ); |
694 | | |
695 | | return( -1 ); |
696 | | } |
697 | | libcnotify_printf( |
698 | | "\n" ); |
699 | | } |
700 | | #endif |
701 | 0 | data_offset += string_size; |
702 | 0 | } |
703 | 0 | } |
704 | 0 | break; |
705 | | |
706 | 0 | case 0x00000048UL: |
707 | 0 | if( data_offset < ( data_size - 16 ) ) |
708 | 0 | { |
709 | | #if defined( HAVE_DEBUG_OUTPUT ) |
710 | | if( libcnotify_verbose != 0 ) |
711 | | { |
712 | | if( libfwsi_debug_print_guid_value( |
713 | | function, |
714 | | "GUID\t\t\t\t", |
715 | | &( data[ data_offset ] ), |
716 | | 16, |
717 | | LIBFGUID_ENDIAN_LITTLE, |
718 | | LIBFGUID_STRING_FORMAT_FLAG_USE_UPPER_CASE | LIBFGUID_STRING_FORMAT_FLAG_USE_SURROUNDING_BRACES, |
719 | | error ) != 1 ) |
720 | | { |
721 | | libcerror_error_set( |
722 | | error, |
723 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
724 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
725 | | "%s: unable to print GUID value.", |
726 | | function ); |
727 | | |
728 | | return( -1 ); |
729 | | } |
730 | | libcnotify_printf( |
731 | | "\n" ); |
732 | | } |
733 | | #endif |
734 | 0 | data_offset += 16; |
735 | 0 | } |
736 | 0 | break; |
737 | 0 | } |
738 | 0 | } |
739 | | /* TODO */ |
740 | | |
741 | | #if defined( HAVE_DEBUG_OUTPUT ) |
742 | | if( libcnotify_verbose != 0 ) |
743 | | { |
744 | | libcnotify_printf( |
745 | | "\n" ); |
746 | | } |
747 | | #endif |
748 | 0 | return( 1 ); |
749 | 0 | } |
750 | | |