/src/libfwsi/libfwsi/libfwsi_item.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Windows Shell Item 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_acronis_tib_file_values.h" |
28 | | #include "libfwsi_cdburn_values.h" |
29 | | #include "libfwsi_compressed_folder_values.h" |
30 | | #include "libfwsi_codepage.h" |
31 | | #include "libfwsi_control_panel_category_values.h" |
32 | | #include "libfwsi_control_panel_cpl_file_values.h" |
33 | | #include "libfwsi_control_panel_item_values.h" |
34 | | #include "libfwsi_definitions.h" |
35 | | #include "libfwsi_delegate_folder_values.h" |
36 | | #include "libfwsi_extension_block.h" |
37 | | #include "libfwsi_file_attributes.h" |
38 | | #include "libfwsi_file_entry_values.h" |
39 | | #include "libfwsi_game_folder_values.h" |
40 | | #include "libfwsi_item.h" |
41 | | #include "libfwsi_libcdata.h" |
42 | | #include "libfwsi_libcerror.h" |
43 | | #include "libfwsi_libcnotify.h" |
44 | | #include "libfwsi_libfdatetime.h" |
45 | | #include "libfwsi_libfguid.h" |
46 | | #include "libfwsi_libuna.h" |
47 | | #include "libfwsi_mtp_file_entry_values.h" |
48 | | #include "libfwsi_mtp_volume_values.h" |
49 | | #include "libfwsi_network_location_values.h" |
50 | | #include "libfwsi_root_folder_values.h" |
51 | | #include "libfwsi_shell_folder_identifier.h" |
52 | | #include "libfwsi_types.h" |
53 | | #include "libfwsi_uri_values.h" |
54 | | #include "libfwsi_uri_sub_values.h" |
55 | | #include "libfwsi_users_property_view_values.h" |
56 | | #include "libfwsi_volume_values.h" |
57 | | #include "libfwsi_web_site_values.h" |
58 | | |
59 | | /* Creates an item |
60 | | * Make sure the value item is referencing, is set to NULL |
61 | | * Returns 1 if successful or -1 on error |
62 | | */ |
63 | | int libfwsi_item_initialize( |
64 | | libfwsi_item_t **item, |
65 | | libcerror_error_t **error ) |
66 | 41 | { |
67 | 41 | libfwsi_internal_item_t *internal_item = NULL; |
68 | 41 | static char *function = "libfwsi_item_initialize"; |
69 | | |
70 | 41 | if( item == NULL ) |
71 | 0 | { |
72 | 0 | libcerror_error_set( |
73 | 0 | error, |
74 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
75 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
76 | 0 | "%s: invalid item.", |
77 | 0 | function ); |
78 | |
|
79 | 0 | return( -1 ); |
80 | 0 | } |
81 | 41 | if( *item != NULL ) |
82 | 0 | { |
83 | 0 | libcerror_error_set( |
84 | 0 | error, |
85 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
86 | 0 | LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, |
87 | 0 | "%s: invalid item value already set.", |
88 | 0 | function ); |
89 | |
|
90 | 0 | return( -1 ); |
91 | 0 | } |
92 | 41 | if( libfwsi_internal_item_initialize( |
93 | 41 | &internal_item, |
94 | 41 | error ) != 1 ) |
95 | 0 | { |
96 | 0 | libcerror_error_set( |
97 | 0 | error, |
98 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
99 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
100 | 0 | "%s: unable to create item.", |
101 | 0 | function ); |
102 | |
|
103 | 0 | return( -1 ); |
104 | 0 | } |
105 | 41 | *item = (libfwsi_item_t *) internal_item; |
106 | | |
107 | 41 | return( 1 ); |
108 | 41 | } |
109 | | |
110 | | /* Creates an item |
111 | | * Make sure the value item is referencing, is set to NULL |
112 | | * Returns 1 if successful or -1 on error |
113 | | */ |
114 | | int libfwsi_internal_item_initialize( |
115 | | libfwsi_internal_item_t **internal_item, |
116 | | libcerror_error_t **error ) |
117 | 41 | { |
118 | 41 | static char *function = "libfwsi_internal_item_initialize"; |
119 | | |
120 | 41 | if( internal_item == NULL ) |
121 | 0 | { |
122 | 0 | libcerror_error_set( |
123 | 0 | error, |
124 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
125 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
126 | 0 | "%s: invalid item.", |
127 | 0 | function ); |
128 | |
|
129 | 0 | return( -1 ); |
130 | 0 | } |
131 | 41 | if( *internal_item != NULL ) |
132 | 0 | { |
133 | 0 | libcerror_error_set( |
134 | 0 | error, |
135 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
136 | 0 | LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, |
137 | 0 | "%s: invalid item value already set.", |
138 | 0 | function ); |
139 | |
|
140 | 0 | return( -1 ); |
141 | 0 | } |
142 | 41 | *internal_item = memory_allocate_structure( |
143 | 41 | libfwsi_internal_item_t ); |
144 | | |
145 | 41 | if( *internal_item == NULL ) |
146 | 0 | { |
147 | 0 | libcerror_error_set( |
148 | 0 | error, |
149 | 0 | LIBCERROR_ERROR_DOMAIN_MEMORY, |
150 | 0 | LIBCERROR_MEMORY_ERROR_INSUFFICIENT, |
151 | 0 | "%s: unable to create item.", |
152 | 0 | function ); |
153 | |
|
154 | 0 | goto on_error; |
155 | 0 | } |
156 | 41 | if( memory_set( |
157 | 41 | *internal_item, |
158 | 41 | 0, |
159 | 41 | sizeof( libfwsi_internal_item_t ) ) == NULL ) |
160 | 0 | { |
161 | 0 | libcerror_error_set( |
162 | 0 | error, |
163 | 0 | LIBCERROR_ERROR_DOMAIN_MEMORY, |
164 | 0 | LIBCERROR_MEMORY_ERROR_SET_FAILED, |
165 | 0 | "%s: unable to clear item.", |
166 | 0 | function ); |
167 | |
|
168 | 0 | goto on_error; |
169 | 0 | } |
170 | 41 | if( libcdata_array_initialize( |
171 | 41 | &( ( *internal_item )->extension_blocks_array ), |
172 | 41 | 0, |
173 | 41 | error ) != 1 ) |
174 | 0 | { |
175 | 0 | libcerror_error_set( |
176 | 0 | error, |
177 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
178 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
179 | 0 | "%s: unable to create extension blocks array.", |
180 | 0 | function ); |
181 | |
|
182 | 0 | goto on_error; |
183 | 0 | } |
184 | 41 | return( 1 ); |
185 | | |
186 | 0 | on_error: |
187 | 0 | if( *internal_item != NULL ) |
188 | 0 | { |
189 | 0 | memory_free( |
190 | 0 | *internal_item ); |
191 | |
|
192 | 0 | *internal_item = NULL; |
193 | 0 | } |
194 | 0 | return( -1 ); |
195 | 41 | } |
196 | | |
197 | | /* Frees an item |
198 | | * Returns 1 if successful or -1 on error |
199 | | */ |
200 | | int libfwsi_item_free( |
201 | | libfwsi_item_t **item, |
202 | | libcerror_error_t **error ) |
203 | 41 | { |
204 | 41 | libfwsi_internal_item_t *internal_item = NULL; |
205 | 41 | static char *function = "libfwsi_item_free"; |
206 | 41 | int result = 1; |
207 | | |
208 | 41 | if( item == NULL ) |
209 | 0 | { |
210 | 0 | libcerror_error_set( |
211 | 0 | error, |
212 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
213 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
214 | 0 | "%s: invalid item.", |
215 | 0 | function ); |
216 | |
|
217 | 0 | return( -1 ); |
218 | 0 | } |
219 | 41 | if( *item != NULL ) |
220 | 41 | { |
221 | 41 | internal_item = (libfwsi_internal_item_t *) *item; |
222 | | |
223 | 41 | if( internal_item->is_managed == 0 ) |
224 | 41 | { |
225 | 41 | if( libfwsi_internal_item_free( |
226 | 41 | &internal_item, |
227 | 41 | error ) != 1 ) |
228 | 0 | { |
229 | 0 | libcerror_error_set( |
230 | 0 | error, |
231 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
232 | 0 | LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, |
233 | 0 | "%s: unable to free item.", |
234 | 0 | function ); |
235 | |
|
236 | 0 | result = -1; |
237 | 0 | } |
238 | 41 | } |
239 | 41 | *item = NULL; |
240 | 41 | } |
241 | 41 | return( result ); |
242 | 41 | } |
243 | | |
244 | | /* Frees an item |
245 | | * Returns 1 if successful or -1 on error |
246 | | */ |
247 | | int libfwsi_internal_item_free( |
248 | | libfwsi_internal_item_t **internal_item, |
249 | | libcerror_error_t **error ) |
250 | 41 | { |
251 | 41 | static char *function = "libfwsi_internal_item_free"; |
252 | 41 | int result = 1; |
253 | | |
254 | 41 | if( internal_item == NULL ) |
255 | 0 | { |
256 | 0 | libcerror_error_set( |
257 | 0 | error, |
258 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
259 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
260 | 0 | "%s: invalid item.", |
261 | 0 | function ); |
262 | |
|
263 | 0 | return( -1 ); |
264 | 0 | } |
265 | 41 | if( *internal_item != NULL ) |
266 | 41 | { |
267 | 41 | if( ( *internal_item )->value != NULL ) |
268 | 0 | { |
269 | 0 | if( ( *internal_item )->free_value != NULL ) |
270 | 0 | { |
271 | 0 | if( ( *internal_item )->free_value( |
272 | 0 | &( ( *internal_item )->value ), |
273 | 0 | error ) != 1 ) |
274 | 0 | { |
275 | 0 | libcerror_error_set( |
276 | 0 | error, |
277 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
278 | 0 | LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, |
279 | 0 | "%s: unable to free item value.", |
280 | 0 | function ); |
281 | |
|
282 | 0 | result = -1; |
283 | 0 | } |
284 | 0 | } |
285 | 0 | } |
286 | 41 | if( libcdata_array_free( |
287 | 41 | &( ( *internal_item )->extension_blocks_array ), |
288 | 41 | (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_internal_extension_block_free, |
289 | 41 | error ) != 1 ) |
290 | 0 | { |
291 | 0 | libcerror_error_set( |
292 | 0 | error, |
293 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
294 | 0 | LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, |
295 | 0 | "%s: unable to free extension blocks array.", |
296 | 0 | function ); |
297 | |
|
298 | 0 | result = -1; |
299 | 0 | } |
300 | 41 | memory_free( |
301 | 41 | *internal_item ); |
302 | | |
303 | 41 | *internal_item = NULL; |
304 | 41 | } |
305 | 41 | return( result ); |
306 | 41 | } |
307 | | |
308 | | /* Copies a shell item from a byte stream |
309 | | * Returns 1 if successful or -1 on error |
310 | | */ |
311 | | int libfwsi_item_copy_from_byte_stream( |
312 | | libfwsi_item_t *item, |
313 | | const uint8_t *byte_stream, |
314 | | size_t byte_stream_size, |
315 | | int ascii_codepage, |
316 | | libcerror_error_t **error ) |
317 | 41 | { |
318 | 41 | libfwsi_delegate_folder_values_t *delegate_folder_values = NULL; |
319 | 41 | libfwsi_internal_extension_block_t *extension_block = NULL; |
320 | 41 | libfwsi_internal_item_t *internal_item = NULL; |
321 | 41 | libfwsi_internal_item_t *internal_parent_item = NULL; |
322 | 41 | static char *function = "libfwsi_item_copy_from_byte_stream"; |
323 | 41 | const uint8_t *shell_item_data = NULL; |
324 | 41 | size_t byte_stream_offset = 0; |
325 | 41 | size_t delegate_class_identifier_offset = 0; |
326 | 41 | size_t delegate_shell_item_data_size = 0; |
327 | 41 | size_t shell_item_data_size = 0; |
328 | 41 | uint32_t signature = 0; |
329 | 41 | uint16_t first_extension_block_offset = 0; |
330 | 41 | int entry_index = 0; |
331 | 41 | int number_of_extension_blocks = 0; |
332 | 41 | int result = 0; |
333 | | |
334 | 41 | if( item == NULL ) |
335 | 0 | { |
336 | 0 | libcerror_error_set( |
337 | 0 | error, |
338 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
339 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
340 | 0 | "%s: invalid item.", |
341 | 0 | function ); |
342 | |
|
343 | 0 | return( -1 ); |
344 | 0 | } |
345 | 41 | internal_item = (libfwsi_internal_item_t *) item; |
346 | | |
347 | 41 | if( byte_stream == NULL ) |
348 | 0 | { |
349 | 0 | libcerror_error_set( |
350 | 0 | error, |
351 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
352 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
353 | 0 | "%s: invalid byte stream.", |
354 | 0 | function ); |
355 | |
|
356 | 0 | return( -1 ); |
357 | 0 | } |
358 | 41 | if( ( byte_stream_size < 2 ) |
359 | 41 | || ( byte_stream_size > (size_t) SSIZE_MAX ) ) |
360 | 1 | { |
361 | 1 | libcerror_error_set( |
362 | 1 | error, |
363 | 1 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
364 | 1 | LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, |
365 | 1 | "%s: byte stream size value out of bounds.", |
366 | 1 | function ); |
367 | | |
368 | 1 | return( -1 ); |
369 | 1 | } |
370 | 40 | if( ( ascii_codepage != LIBFWSI_CODEPAGE_ASCII ) |
371 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_874 ) |
372 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_932 ) |
373 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_936 ) |
374 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_949 ) |
375 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_950 ) |
376 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_1250 ) |
377 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_1251 ) |
378 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_1252 ) |
379 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_1253 ) |
380 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_1254 ) |
381 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_1255 ) |
382 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_1256 ) |
383 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_1257 ) |
384 | 40 | && ( ascii_codepage != LIBFWSI_CODEPAGE_WINDOWS_1258 ) ) |
385 | 40 | { |
386 | 40 | libcerror_error_set( |
387 | 40 | error, |
388 | 40 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
389 | 40 | LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, |
390 | 40 | "%s: unsupported ASCII codepage.", |
391 | 40 | function ); |
392 | | |
393 | 40 | return( -1 ); |
394 | 40 | } |
395 | 0 | byte_stream_copy_to_uint16_little_endian( |
396 | 0 | byte_stream, |
397 | 0 | internal_item->data_size ); |
398 | |
|
399 | | #if defined( HAVE_DEBUG_OUTPUT ) |
400 | | if( libcnotify_verbose != 0 ) |
401 | | { |
402 | | libcnotify_printf( |
403 | | "%s: size\t\t\t\t: %" PRIu16 "\n", |
404 | | function, |
405 | | internal_item->data_size ); |
406 | | } |
407 | | #endif |
408 | 0 | if( internal_item->data_size == 0 ) |
409 | 0 | { |
410 | 0 | return( 1 ); |
411 | 0 | } |
412 | 0 | if( ( internal_item->data_size < 4 ) |
413 | 0 | || ( (size_t) internal_item->data_size > byte_stream_size ) ) |
414 | 0 | { |
415 | 0 | libcerror_error_set( |
416 | 0 | error, |
417 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
418 | 0 | LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, |
419 | 0 | "%s: invalid shell item size value out of bounds.", |
420 | 0 | function ); |
421 | |
|
422 | 0 | goto on_error; |
423 | 0 | } |
424 | 0 | shell_item_data = byte_stream; |
425 | 0 | shell_item_data_size = internal_item->data_size; |
426 | |
|
427 | | #if defined( HAVE_DEBUG_OUTPUT ) |
428 | | if( libcnotify_verbose != 0 ) |
429 | | { |
430 | | libcnotify_printf( |
431 | | "%s: data:\n", |
432 | | function ); |
433 | | libcnotify_print_data( |
434 | | &( shell_item_data[ 2 ] ), |
435 | | shell_item_data_size - 2, |
436 | | LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); |
437 | | } |
438 | | #endif |
439 | 0 | if( shell_item_data_size >= 38 ) |
440 | 0 | { |
441 | 0 | byte_stream_copy_to_uint16_little_endian( |
442 | 0 | &( byte_stream[ internal_item->data_size - 2 ] ), |
443 | 0 | delegate_class_identifier_offset ); |
444 | |
|
445 | 0 | if( ( delegate_class_identifier_offset >= 32 ) |
446 | 0 | && ( delegate_class_identifier_offset < ( shell_item_data_size - 2 ) ) ) |
447 | 0 | { |
448 | 0 | delegate_shell_item_data_size = delegate_class_identifier_offset; |
449 | 0 | } |
450 | 0 | else |
451 | 0 | { |
452 | 0 | delegate_class_identifier_offset = shell_item_data_size; |
453 | 0 | delegate_shell_item_data_size = shell_item_data_size; |
454 | 0 | } |
455 | 0 | delegate_class_identifier_offset -= 32; |
456 | |
|
457 | 0 | if( memory_compare( |
458 | 0 | &( shell_item_data[ delegate_class_identifier_offset ] ), |
459 | 0 | libfwsi_delegate_class_identifier, |
460 | 0 | 16 ) == 0 ) |
461 | 0 | { |
462 | 0 | if( libfwsi_delegate_folder_values_initialize( |
463 | 0 | &delegate_folder_values, |
464 | 0 | error ) != 1 ) |
465 | 0 | { |
466 | 0 | libcerror_error_set( |
467 | 0 | error, |
468 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
469 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
470 | 0 | "%s: unable to create delegate folder values.", |
471 | 0 | function ); |
472 | |
|
473 | 0 | goto on_error; |
474 | 0 | } |
475 | 0 | if( libfwsi_delegate_folder_values_read_data( |
476 | 0 | delegate_folder_values, |
477 | 0 | shell_item_data, |
478 | 0 | delegate_shell_item_data_size, |
479 | 0 | error ) != 1 ) |
480 | 0 | { |
481 | 0 | libcerror_error_set( |
482 | 0 | error, |
483 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
484 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
485 | 0 | "%s: unable to read delegate folder values.", |
486 | 0 | function ); |
487 | |
|
488 | 0 | goto on_error; |
489 | 0 | } |
490 | 0 | if( memory_copy( |
491 | 0 | internal_item->delegate_folder_identifier, |
492 | 0 | delegate_folder_values->identifier, |
493 | 0 | 16 ) == NULL ) |
494 | 0 | { |
495 | 0 | libcerror_error_set( |
496 | 0 | error, |
497 | 0 | LIBCERROR_ERROR_DOMAIN_MEMORY, |
498 | 0 | LIBCERROR_MEMORY_ERROR_COPY_FAILED, |
499 | 0 | "%s: unable to copy delegate folder identifier.", |
500 | 0 | function ); |
501 | |
|
502 | 0 | goto on_error; |
503 | 0 | } |
504 | 0 | internal_item->has_delegate_folder_identifier = 1; |
505 | |
|
506 | 0 | if( memory_compare( |
507 | 0 | delegate_folder_values->identifier, |
508 | 0 | libfwsi_shell_folder_identifier_search_folder, |
509 | 0 | 16 ) == 0 ) |
510 | 0 | { |
511 | | /* Do not realign shell_item_data */ |
512 | 0 | } |
513 | 0 | else if( memory_compare( |
514 | 0 | delegate_folder_values->identifier, |
515 | 0 | libfwsi_shell_folder_identifier_users_files_folder_delegate_folder, |
516 | 0 | 16 ) == 0 ) |
517 | 0 | { |
518 | | /* TODO debug print unknown data */ |
519 | 0 | shell_item_data = &( delegate_folder_values->inner_data[ 4 ] ); |
520 | 0 | shell_item_data_size = delegate_folder_values->inner_data_size - 4; |
521 | 0 | } |
522 | 0 | else if( memory_compare( |
523 | 0 | delegate_folder_values->identifier, |
524 | 0 | libfwsi_shell_folder_identifier_removable_drives, |
525 | 0 | 16 ) == 0 ) |
526 | 0 | { |
527 | | /* TODO debug print unknown data */ |
528 | 0 | shell_item_data = &( delegate_folder_values->inner_data[ 4 ] ); |
529 | 0 | shell_item_data_size = delegate_folder_values->inner_data_size - 4; |
530 | 0 | } |
531 | 0 | else |
532 | 0 | { |
533 | 0 | shell_item_data = delegate_folder_values->inner_data; |
534 | 0 | shell_item_data_size = delegate_folder_values->inner_data_size; |
535 | 0 | } |
536 | 0 | if( libfwsi_delegate_folder_values_free( |
537 | 0 | &delegate_folder_values, |
538 | 0 | error ) != 1 ) |
539 | 0 | { |
540 | 0 | libcerror_error_set( |
541 | 0 | error, |
542 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
543 | 0 | LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, |
544 | 0 | "%s: unable to free delegate folder values.", |
545 | 0 | function ); |
546 | |
|
547 | 0 | goto on_error; |
548 | 0 | } |
549 | 0 | } |
550 | 0 | } |
551 | 0 | if( ( internal_item->type == 0 ) |
552 | 0 | && ( shell_item_data_size >= 6 ) ) |
553 | 0 | { |
554 | 0 | byte_stream_copy_to_uint32_little_endian( |
555 | 0 | &( shell_item_data[ 2 ] ), |
556 | 0 | signature ); |
557 | |
|
558 | 0 | switch( signature ) |
559 | 0 | { |
560 | 0 | case 0xacb16752UL: |
561 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_ACRONIS_TIB_FILE; |
562 | 0 | break; |
563 | | |
564 | 0 | default: |
565 | 0 | break; |
566 | 0 | } |
567 | 0 | } |
568 | 0 | if( ( internal_item->type == 0 ) |
569 | 0 | && ( shell_item_data_size >= 8 ) ) |
570 | 0 | { |
571 | 0 | byte_stream_copy_to_uint32_little_endian( |
572 | 0 | &( shell_item_data[ 4 ] ), |
573 | 0 | signature ); |
574 | |
|
575 | 0 | switch( signature ) |
576 | 0 | { |
577 | 0 | case 0x39de2184UL: |
578 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_CONTROL_PANEL_CATEGORY; |
579 | 0 | break; |
580 | | |
581 | | /* "AugM" */ |
582 | 0 | case 0x4d677541UL: |
583 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_CDBURN; |
584 | 0 | break; |
585 | | |
586 | | /* "GFSI" */ |
587 | 0 | case 0x49534647UL: |
588 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_GAME_FOLDER; |
589 | 0 | break; |
590 | | |
591 | 0 | case 0xc001b000UL: |
592 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_WEB_SITE; |
593 | 0 | break; |
594 | | |
595 | 0 | case 0xffffff38UL: |
596 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_CONTROL_PANEL_CPL_FILE; |
597 | 0 | break; |
598 | | |
599 | 0 | default: |
600 | 0 | break; |
601 | 0 | } |
602 | 0 | } |
603 | 0 | if( ( internal_item->type == 0 ) |
604 | 0 | && ( shell_item_data_size >= 10 ) ) |
605 | 0 | { |
606 | 0 | byte_stream_copy_to_uint32_little_endian( |
607 | 0 | &( shell_item_data[ 6 ] ), |
608 | 0 | signature ); |
609 | |
|
610 | 0 | switch( signature ) |
611 | 0 | { |
612 | 0 | case 0x07192006UL: |
613 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_MTP_FILE_ENTRY; |
614 | 0 | break; |
615 | | |
616 | 0 | case 0x10312005UL: |
617 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_MTP_VOLUME; |
618 | 0 | break; |
619 | | |
620 | 0 | case 0x10141981UL: |
621 | 0 | case 0x23a3dfd5UL: |
622 | 0 | case 0x23febbeeUL: |
623 | 0 | case 0x3b93afbbUL: |
624 | 0 | case 0x49505241UL: |
625 | 0 | case 0xbeebee00UL: |
626 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_USERS_PROPERTY_VIEW; |
627 | 0 | break; |
628 | | |
629 | 0 | default: |
630 | 0 | break; |
631 | 0 | } |
632 | 0 | } |
633 | 0 | if( ( internal_item->type == 0 ) |
634 | 0 | && ( shell_item_data_size >= 56 ) ) |
635 | 0 | { |
636 | 0 | if( ( shell_item_data[ 28 ] == (uint8_t) '/' ) |
637 | 0 | && ( shell_item_data[ 29 ] == (uint8_t) 0 ) |
638 | 0 | && ( shell_item_data[ 34 ] == (uint8_t) '/' ) |
639 | 0 | && ( shell_item_data[ 35 ] == (uint8_t) 0 ) |
640 | 0 | && ( shell_item_data[ 40 ] == (uint8_t) ' ' ) |
641 | 0 | && ( shell_item_data[ 41 ] == (uint8_t) 0 ) |
642 | 0 | && ( shell_item_data[ 42 ] == (uint8_t) ' ' ) |
643 | 0 | && ( shell_item_data[ 43 ] == (uint8_t) 0 ) |
644 | 0 | && ( shell_item_data[ 48 ] == (uint8_t) ':' ) |
645 | 0 | && ( shell_item_data[ 49 ] == (uint8_t) 0 ) |
646 | 0 | && ( shell_item_data[ 54 ] == (uint8_t) 0 ) |
647 | 0 | && ( shell_item_data[ 55 ] == (uint8_t) 0 ) ) |
648 | 0 | { |
649 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_COMPRESSED_FOLDER; |
650 | 0 | } |
651 | 0 | } |
652 | 0 | if( ( internal_item->type == 0 ) |
653 | 0 | && ( shell_item_data_size >= 78 ) ) |
654 | 0 | { |
655 | 0 | if( ( shell_item_data[ 36 ] == (uint8_t) 'N' ) |
656 | 0 | && ( shell_item_data[ 37 ] == (uint8_t) 0 ) |
657 | 0 | && ( shell_item_data[ 38 ] == (uint8_t) '/' ) |
658 | 0 | && ( shell_item_data[ 39 ] == (uint8_t) 0 ) |
659 | 0 | && ( shell_item_data[ 40 ] == (uint8_t) 'A' ) |
660 | 0 | && ( shell_item_data[ 41 ] == (uint8_t) 0 ) |
661 | 0 | && ( shell_item_data[ 42 ] == (uint8_t) 0 ) |
662 | 0 | && ( shell_item_data[ 43 ] == (uint8_t) 0 ) ) |
663 | 0 | { |
664 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_COMPRESSED_FOLDER; |
665 | 0 | } |
666 | 0 | else if( ( shell_item_data[ 40 ] == (uint8_t) '/' ) |
667 | 0 | && ( shell_item_data[ 41 ] == (uint8_t) 0 ) |
668 | 0 | && ( shell_item_data[ 46 ] == (uint8_t) '/' ) |
669 | 0 | && ( shell_item_data[ 47 ] == (uint8_t) 0 ) |
670 | 0 | && ( shell_item_data[ 56 ] == (uint8_t) ' ' ) |
671 | 0 | && ( shell_item_data[ 57 ] == (uint8_t) 0 ) |
672 | 0 | && ( shell_item_data[ 58 ] == (uint8_t) ' ' ) |
673 | 0 | && ( shell_item_data[ 59 ] == (uint8_t) 0 ) |
674 | 0 | && ( shell_item_data[ 64 ] == (uint8_t) ':' ) |
675 | 0 | && ( shell_item_data[ 65 ] == (uint8_t) 0 ) |
676 | 0 | && ( shell_item_data[ 70 ] == (uint8_t) ':' ) |
677 | 0 | && ( shell_item_data[ 71 ] == (uint8_t) 0 ) |
678 | 0 | && ( shell_item_data[ 76 ] == (uint8_t) 0 ) |
679 | 0 | && ( shell_item_data[ 77 ] == (uint8_t) 0 ) ) |
680 | 0 | { |
681 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_COMPRESSED_FOLDER; |
682 | 0 | } |
683 | 0 | } |
684 | 0 | if( ( internal_item->type == 0 ) |
685 | 0 | && ( shell_item_data_size >= 3 ) ) |
686 | 0 | { |
687 | 0 | internal_item->class_type = shell_item_data[ 2 ]; |
688 | |
|
689 | | #if defined( HAVE_DEBUG_OUTPUT ) |
690 | | if( libcnotify_verbose != 0 ) |
691 | | { |
692 | | libcnotify_printf( |
693 | | "%s: class type indicator\t\t: 0x%02" PRIx8 "\n", |
694 | | function, |
695 | | internal_item->class_type ); |
696 | | } |
697 | | #endif |
698 | 0 | switch( internal_item->class_type & 0x70 ) |
699 | 0 | { |
700 | 0 | case 0x10: |
701 | 0 | if( internal_item->class_type == 0x1f ) |
702 | 0 | { |
703 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_ROOT_FOLDER; |
704 | 0 | } |
705 | 0 | break; |
706 | | |
707 | 0 | case 0x20: |
708 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_VOLUME; |
709 | 0 | break; |
710 | | |
711 | 0 | case 0x30: |
712 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_FILE_ENTRY; |
713 | 0 | break; |
714 | | |
715 | 0 | case 0x40: |
716 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_NETWORK_LOCATION; |
717 | 0 | break; |
718 | | |
719 | 0 | case 0x60: |
720 | 0 | if( internal_item->class_type == 0x61 ) |
721 | 0 | { |
722 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_URI; |
723 | 0 | } |
724 | 0 | break; |
725 | | |
726 | 0 | case 0x70: |
727 | 0 | if( internal_item->class_type == 0x71 ) |
728 | 0 | { |
729 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_CONTROL_PANEL_ITEM; |
730 | 0 | } |
731 | 0 | break; |
732 | | |
733 | 0 | default: |
734 | 0 | break; |
735 | 0 | } |
736 | 0 | } |
737 | 0 | if( libfwsi_item_get_parent_item( |
738 | 0 | (libfwsi_item_t *) internal_item, |
739 | 0 | (libfwsi_item_t **) &internal_parent_item, |
740 | 0 | error ) != 1 ) |
741 | 0 | { |
742 | 0 | libcerror_error_set( |
743 | 0 | error, |
744 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
745 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
746 | 0 | "%s: unable to retrieve parent shell item.", |
747 | 0 | function ); |
748 | |
|
749 | 0 | goto on_error; |
750 | 0 | } |
751 | 0 | if( internal_parent_item != NULL ) |
752 | 0 | { |
753 | 0 | switch( internal_parent_item->type ) |
754 | 0 | { |
755 | 0 | case LIBFWSI_ITEM_TYPE_COMPRESSED_FOLDER: |
756 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_COMPRESSED_FOLDER; |
757 | 0 | break; |
758 | | |
759 | 0 | case LIBFWSI_ITEM_TYPE_URI: |
760 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_URI_SUB_VALUES; |
761 | 0 | break; |
762 | 0 | } |
763 | 0 | } |
764 | 0 | switch( internal_item->type ) |
765 | 0 | { |
766 | 0 | case LIBFWSI_ITEM_TYPE_ACRONIS_TIB_FILE: |
767 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_acronis_tib_file_values_free; |
768 | |
|
769 | 0 | if( libfwsi_acronis_tib_file_values_initialize( |
770 | 0 | (libfwsi_acronis_tib_file_values_t **) &( internal_item->value ), |
771 | 0 | error ) != 1 ) |
772 | 0 | { |
773 | 0 | libcerror_error_set( |
774 | 0 | error, |
775 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
776 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
777 | 0 | "%s: unable to create Acronis True Image (TIB) file values.", |
778 | 0 | function ); |
779 | |
|
780 | 0 | goto on_error; |
781 | 0 | } |
782 | 0 | result = libfwsi_acronis_tib_file_values_read_data( |
783 | 0 | (libfwsi_acronis_tib_file_values_t *) internal_item->value, |
784 | 0 | shell_item_data, |
785 | 0 | shell_item_data_size, |
786 | 0 | error ); |
787 | |
|
788 | 0 | if( result == -1 ) |
789 | 0 | { |
790 | 0 | libcerror_error_set( |
791 | 0 | error, |
792 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
793 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
794 | 0 | "%s: unable to read Acronis True Image (TIB) file values.", |
795 | 0 | function ); |
796 | |
|
797 | 0 | goto on_error; |
798 | 0 | } |
799 | 0 | break; |
800 | | |
801 | 0 | case LIBFWSI_ITEM_TYPE_CDBURN: |
802 | 0 | internal_item->signature = signature; |
803 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_cdburn_values_free; |
804 | |
|
805 | 0 | if( libfwsi_cdburn_values_initialize( |
806 | 0 | (libfwsi_cdburn_values_t **) &( internal_item->value ), |
807 | 0 | error ) != 1 ) |
808 | 0 | { |
809 | 0 | libcerror_error_set( |
810 | 0 | error, |
811 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
812 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
813 | 0 | "%s: unable to create CD burn values.", |
814 | 0 | function ); |
815 | |
|
816 | 0 | goto on_error; |
817 | 0 | } |
818 | 0 | result = libfwsi_cdburn_values_read_data( |
819 | 0 | (libfwsi_cdburn_values_t *) internal_item->value, |
820 | 0 | shell_item_data, |
821 | 0 | shell_item_data_size, |
822 | 0 | error ); |
823 | |
|
824 | 0 | if( result == -1 ) |
825 | 0 | { |
826 | 0 | libcerror_error_set( |
827 | 0 | error, |
828 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
829 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
830 | 0 | "%s: unable to read CD burn values.", |
831 | 0 | function ); |
832 | |
|
833 | 0 | goto on_error; |
834 | 0 | } |
835 | 0 | break; |
836 | | |
837 | 0 | case LIBFWSI_ITEM_TYPE_COMPRESSED_FOLDER: |
838 | 0 | internal_item->signature = signature; |
839 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_compressed_folder_values_free; |
840 | |
|
841 | 0 | if( libfwsi_compressed_folder_values_initialize( |
842 | 0 | (libfwsi_compressed_folder_values_t **) &( internal_item->value ), |
843 | 0 | error ) != 1 ) |
844 | 0 | { |
845 | 0 | libcerror_error_set( |
846 | 0 | error, |
847 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
848 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
849 | 0 | "%s: unable to create compressed folder values.", |
850 | 0 | function ); |
851 | |
|
852 | 0 | goto on_error; |
853 | 0 | } |
854 | 0 | result = libfwsi_compressed_folder_values_read_data( |
855 | 0 | (libfwsi_compressed_folder_values_t *) internal_item->value, |
856 | 0 | shell_item_data, |
857 | 0 | shell_item_data_size, |
858 | 0 | error ); |
859 | |
|
860 | 0 | if( result == -1 ) |
861 | 0 | { |
862 | 0 | libcerror_error_set( |
863 | 0 | error, |
864 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
865 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
866 | 0 | "%s: unable to read compressed folder values.", |
867 | 0 | function ); |
868 | |
|
869 | 0 | goto on_error; |
870 | 0 | } |
871 | 0 | break; |
872 | | |
873 | 0 | case LIBFWSI_ITEM_TYPE_CONTROL_PANEL_ITEM: |
874 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_control_panel_item_values_free; |
875 | |
|
876 | 0 | if( libfwsi_control_panel_item_values_initialize( |
877 | 0 | (libfwsi_control_panel_item_values_t **) &( internal_item->value ), |
878 | 0 | error ) != 1 ) |
879 | 0 | { |
880 | 0 | libcerror_error_set( |
881 | 0 | error, |
882 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
883 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
884 | 0 | "%s: unable to create control panel item values.", |
885 | 0 | function ); |
886 | |
|
887 | 0 | goto on_error; |
888 | 0 | } |
889 | 0 | result = libfwsi_control_panel_item_values_read_data( |
890 | 0 | (libfwsi_control_panel_item_values_t *) internal_item->value, |
891 | 0 | shell_item_data, |
892 | 0 | shell_item_data_size, |
893 | 0 | error ); |
894 | |
|
895 | 0 | if( result == -1 ) |
896 | 0 | { |
897 | 0 | libcerror_error_set( |
898 | 0 | error, |
899 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
900 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
901 | 0 | "%s: unable to read control panel item values.", |
902 | 0 | function ); |
903 | |
|
904 | 0 | goto on_error; |
905 | 0 | } |
906 | 0 | break; |
907 | | |
908 | 0 | case LIBFWSI_ITEM_TYPE_CONTROL_PANEL_CATEGORY: |
909 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_control_panel_category_values_free; |
910 | |
|
911 | 0 | if( libfwsi_control_panel_category_values_initialize( |
912 | 0 | (libfwsi_control_panel_category_values_t **) &( internal_item->value ), |
913 | 0 | error ) != 1 ) |
914 | 0 | { |
915 | 0 | libcerror_error_set( |
916 | 0 | error, |
917 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
918 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
919 | 0 | "%s: unable to create control panel category values.", |
920 | 0 | function ); |
921 | |
|
922 | 0 | goto on_error; |
923 | 0 | } |
924 | 0 | result = libfwsi_control_panel_category_values_read_data( |
925 | 0 | (libfwsi_control_panel_category_values_t *) internal_item->value, |
926 | 0 | shell_item_data, |
927 | 0 | shell_item_data_size, |
928 | 0 | error ); |
929 | |
|
930 | 0 | if( result == -1 ) |
931 | 0 | { |
932 | 0 | libcerror_error_set( |
933 | 0 | error, |
934 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
935 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
936 | 0 | "%s: unable to read control panel category values.", |
937 | 0 | function ); |
938 | |
|
939 | 0 | goto on_error; |
940 | 0 | } |
941 | 0 | break; |
942 | | |
943 | 0 | case LIBFWSI_ITEM_TYPE_CONTROL_PANEL_CPL_FILE: |
944 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_control_panel_cpl_file_values_free; |
945 | |
|
946 | 0 | if( libfwsi_control_panel_cpl_file_values_initialize( |
947 | 0 | (libfwsi_control_panel_cpl_file_values_t **) &( internal_item->value ), |
948 | 0 | error ) != 1 ) |
949 | 0 | { |
950 | 0 | libcerror_error_set( |
951 | 0 | error, |
952 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
953 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
954 | 0 | "%s: unable to create control panel CPL file values.", |
955 | 0 | function ); |
956 | |
|
957 | 0 | goto on_error; |
958 | 0 | } |
959 | 0 | result = libfwsi_control_panel_cpl_file_values_read_data( |
960 | 0 | (libfwsi_control_panel_cpl_file_values_t *) internal_item->value, |
961 | 0 | shell_item_data, |
962 | 0 | shell_item_data_size, |
963 | 0 | error ); |
964 | |
|
965 | 0 | if( result == -1 ) |
966 | 0 | { |
967 | 0 | libcerror_error_set( |
968 | 0 | error, |
969 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
970 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
971 | 0 | "%s: unable to read control panel CPL file values.", |
972 | 0 | function ); |
973 | |
|
974 | 0 | goto on_error; |
975 | 0 | } |
976 | 0 | break; |
977 | | |
978 | 0 | case LIBFWSI_ITEM_TYPE_FILE_ENTRY: |
979 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_file_entry_values_free; |
980 | |
|
981 | 0 | if( libfwsi_file_entry_values_initialize( |
982 | 0 | (libfwsi_file_entry_values_t **) &( internal_item->value ), |
983 | 0 | error ) != 1 ) |
984 | 0 | { |
985 | 0 | libcerror_error_set( |
986 | 0 | error, |
987 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
988 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
989 | 0 | "%s: unable to create file entry values.", |
990 | 0 | function ); |
991 | |
|
992 | 0 | goto on_error; |
993 | 0 | } |
994 | 0 | result = libfwsi_file_entry_values_read_data( |
995 | 0 | (libfwsi_file_entry_values_t *) internal_item->value, |
996 | 0 | shell_item_data, |
997 | 0 | shell_item_data_size, |
998 | 0 | ascii_codepage, |
999 | 0 | error ); |
1000 | |
|
1001 | 0 | if( result == -1 ) |
1002 | 0 | { |
1003 | 0 | libcerror_error_set( |
1004 | 0 | error, |
1005 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
1006 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
1007 | 0 | "%s: unable to read file entry values.", |
1008 | 0 | function ); |
1009 | |
|
1010 | 0 | goto on_error; |
1011 | 0 | } |
1012 | 0 | break; |
1013 | | |
1014 | 0 | case LIBFWSI_ITEM_TYPE_GAME_FOLDER: |
1015 | 0 | internal_item->signature = signature; |
1016 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_game_folder_values_free; |
1017 | |
|
1018 | 0 | if( libfwsi_game_folder_values_initialize( |
1019 | 0 | (libfwsi_game_folder_values_t **) &( internal_item->value ), |
1020 | 0 | error ) != 1 ) |
1021 | 0 | { |
1022 | 0 | libcerror_error_set( |
1023 | 0 | error, |
1024 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1025 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
1026 | 0 | "%s: unable to create game folder values.", |
1027 | 0 | function ); |
1028 | |
|
1029 | 0 | goto on_error; |
1030 | 0 | } |
1031 | 0 | result = libfwsi_game_folder_values_read_data( |
1032 | 0 | (libfwsi_game_folder_values_t *) internal_item->value, |
1033 | 0 | shell_item_data, |
1034 | 0 | shell_item_data_size, |
1035 | 0 | error ); |
1036 | |
|
1037 | 0 | if( result == -1 ) |
1038 | 0 | { |
1039 | 0 | libcerror_error_set( |
1040 | 0 | error, |
1041 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
1042 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
1043 | 0 | "%s: unable to read game folder values.", |
1044 | 0 | function ); |
1045 | |
|
1046 | 0 | goto on_error; |
1047 | 0 | } |
1048 | 0 | break; |
1049 | | |
1050 | 0 | case LIBFWSI_ITEM_TYPE_MTP_FILE_ENTRY: |
1051 | 0 | internal_item->signature = signature; |
1052 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_mtp_file_entry_values_free; |
1053 | |
|
1054 | 0 | if( libfwsi_mtp_file_entry_values_initialize( |
1055 | 0 | (libfwsi_mtp_file_entry_values_t **) &( internal_item->value ), |
1056 | 0 | error ) != 1 ) |
1057 | 0 | { |
1058 | 0 | libcerror_error_set( |
1059 | 0 | error, |
1060 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1061 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
1062 | 0 | "%s: unable to create MTP file entry values.", |
1063 | 0 | function ); |
1064 | |
|
1065 | 0 | goto on_error; |
1066 | 0 | } |
1067 | 0 | result = libfwsi_mtp_file_entry_values_read_data( |
1068 | 0 | (libfwsi_mtp_file_entry_values_t *) internal_item->value, |
1069 | 0 | shell_item_data, |
1070 | 0 | shell_item_data_size, |
1071 | 0 | error ); |
1072 | |
|
1073 | 0 | if( result == -1 ) |
1074 | 0 | { |
1075 | 0 | libcerror_error_set( |
1076 | 0 | error, |
1077 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
1078 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
1079 | 0 | "%s: unable to read MTP file entry values.", |
1080 | 0 | function ); |
1081 | |
|
1082 | 0 | goto on_error; |
1083 | 0 | } |
1084 | 0 | break; |
1085 | | |
1086 | 0 | case LIBFWSI_ITEM_TYPE_MTP_VOLUME: |
1087 | 0 | internal_item->signature = signature; |
1088 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_mtp_volume_values_free; |
1089 | |
|
1090 | 0 | if( libfwsi_mtp_volume_values_initialize( |
1091 | 0 | (libfwsi_mtp_volume_values_t **) &( internal_item->value ), |
1092 | 0 | error ) != 1 ) |
1093 | 0 | { |
1094 | 0 | libcerror_error_set( |
1095 | 0 | error, |
1096 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1097 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
1098 | 0 | "%s: unable to create MTP volume values.", |
1099 | 0 | function ); |
1100 | |
|
1101 | 0 | goto on_error; |
1102 | 0 | } |
1103 | 0 | result = libfwsi_mtp_volume_values_read_data( |
1104 | 0 | (libfwsi_mtp_volume_values_t *) internal_item->value, |
1105 | 0 | shell_item_data, |
1106 | 0 | shell_item_data_size, |
1107 | 0 | error ); |
1108 | |
|
1109 | 0 | if( result == -1 ) |
1110 | 0 | { |
1111 | 0 | libcerror_error_set( |
1112 | 0 | error, |
1113 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
1114 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
1115 | 0 | "%s: unable to read MTP volume values.", |
1116 | 0 | function ); |
1117 | |
|
1118 | 0 | goto on_error; |
1119 | 0 | } |
1120 | 0 | break; |
1121 | | |
1122 | 0 | case LIBFWSI_ITEM_TYPE_NETWORK_LOCATION: |
1123 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_network_location_values_free; |
1124 | |
|
1125 | 0 | if( libfwsi_network_location_values_initialize( |
1126 | 0 | (libfwsi_network_location_values_t **) &( internal_item->value ), |
1127 | 0 | error ) != 1 ) |
1128 | 0 | { |
1129 | 0 | libcerror_error_set( |
1130 | 0 | error, |
1131 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1132 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
1133 | 0 | "%s: unable to create network location values.", |
1134 | 0 | function ); |
1135 | |
|
1136 | 0 | goto on_error; |
1137 | 0 | } |
1138 | 0 | result = libfwsi_network_location_values_read_data( |
1139 | 0 | (libfwsi_network_location_values_t *) internal_item->value, |
1140 | 0 | shell_item_data, |
1141 | 0 | shell_item_data_size, |
1142 | 0 | ascii_codepage, |
1143 | 0 | error ); |
1144 | |
|
1145 | 0 | if( result == -1 ) |
1146 | 0 | { |
1147 | 0 | libcerror_error_set( |
1148 | 0 | error, |
1149 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
1150 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
1151 | 0 | "%s: unable to read network location values.", |
1152 | 0 | function ); |
1153 | |
|
1154 | 0 | goto on_error; |
1155 | 0 | } |
1156 | 0 | break; |
1157 | | |
1158 | 0 | case LIBFWSI_ITEM_TYPE_ROOT_FOLDER: |
1159 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_root_folder_values_free; |
1160 | |
|
1161 | 0 | if( libfwsi_root_folder_values_initialize( |
1162 | 0 | (libfwsi_root_folder_values_t **) &( internal_item->value ), |
1163 | 0 | error ) != 1 ) |
1164 | 0 | { |
1165 | 0 | libcerror_error_set( |
1166 | 0 | error, |
1167 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1168 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
1169 | 0 | "%s: unable to create root folder values.", |
1170 | 0 | function ); |
1171 | |
|
1172 | 0 | goto on_error; |
1173 | 0 | } |
1174 | 0 | result = libfwsi_root_folder_values_read_data( |
1175 | 0 | (libfwsi_root_folder_values_t *) internal_item->value, |
1176 | 0 | shell_item_data, |
1177 | 0 | shell_item_data_size, |
1178 | 0 | error ); |
1179 | |
|
1180 | 0 | if( result == -1 ) |
1181 | 0 | { |
1182 | 0 | libcerror_error_set( |
1183 | 0 | error, |
1184 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
1185 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
1186 | 0 | "%s: unable to read root folder values.", |
1187 | 0 | function ); |
1188 | |
|
1189 | 0 | goto on_error; |
1190 | 0 | } |
1191 | 0 | break; |
1192 | | |
1193 | 0 | case LIBFWSI_ITEM_TYPE_URI: |
1194 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_uri_values_free; |
1195 | |
|
1196 | 0 | if( libfwsi_uri_values_initialize( |
1197 | 0 | (libfwsi_uri_values_t **) &( internal_item->value ), |
1198 | 0 | error ) != 1 ) |
1199 | 0 | { |
1200 | 0 | libcerror_error_set( |
1201 | 0 | error, |
1202 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1203 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
1204 | 0 | "%s: unable to create URI values.", |
1205 | 0 | function ); |
1206 | |
|
1207 | 0 | goto on_error; |
1208 | 0 | } |
1209 | 0 | result = libfwsi_uri_values_read_data( |
1210 | 0 | (libfwsi_uri_values_t *) internal_item->value, |
1211 | 0 | shell_item_data, |
1212 | 0 | shell_item_data_size, |
1213 | 0 | ascii_codepage, |
1214 | 0 | error ); |
1215 | |
|
1216 | 0 | if( result == -1 ) |
1217 | 0 | { |
1218 | 0 | libcerror_error_set( |
1219 | 0 | error, |
1220 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
1221 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
1222 | 0 | "%s: unable to read URI values.", |
1223 | 0 | function ); |
1224 | |
|
1225 | 0 | goto on_error; |
1226 | 0 | } |
1227 | 0 | break; |
1228 | | |
1229 | 0 | case LIBFWSI_ITEM_TYPE_URI_SUB_VALUES: |
1230 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_uri_sub_values_free; |
1231 | |
|
1232 | 0 | if( libfwsi_uri_sub_values_initialize( |
1233 | 0 | (libfwsi_uri_sub_values_t **) &( internal_item->value ), |
1234 | 0 | error ) != 1 ) |
1235 | 0 | { |
1236 | 0 | libcerror_error_set( |
1237 | 0 | error, |
1238 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1239 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
1240 | 0 | "%s: unable to create URI sub values.", |
1241 | 0 | function ); |
1242 | |
|
1243 | 0 | goto on_error; |
1244 | 0 | } |
1245 | 0 | result = libfwsi_uri_sub_values_read_data( |
1246 | 0 | (libfwsi_uri_sub_values_t *) internal_item->value, |
1247 | 0 | shell_item_data, |
1248 | 0 | shell_item_data_size, |
1249 | 0 | ascii_codepage, |
1250 | 0 | error ); |
1251 | |
|
1252 | 0 | if( result == -1 ) |
1253 | 0 | { |
1254 | 0 | libcerror_error_set( |
1255 | 0 | error, |
1256 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
1257 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
1258 | 0 | "%s: unable to read URI sub values.", |
1259 | 0 | function ); |
1260 | |
|
1261 | 0 | goto on_error; |
1262 | 0 | } |
1263 | 0 | break; |
1264 | | |
1265 | 0 | case LIBFWSI_ITEM_TYPE_USERS_PROPERTY_VIEW: |
1266 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_users_property_view_values_free; |
1267 | |
|
1268 | 0 | if( libfwsi_users_property_view_values_initialize( |
1269 | 0 | (libfwsi_users_property_view_values_t **) &( internal_item->value ), |
1270 | 0 | error ) != 1 ) |
1271 | 0 | { |
1272 | 0 | libcerror_error_set( |
1273 | 0 | error, |
1274 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1275 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
1276 | 0 | "%s: unable to create users property view values.", |
1277 | 0 | function ); |
1278 | |
|
1279 | 0 | goto on_error; |
1280 | 0 | } |
1281 | 0 | result = libfwsi_users_property_view_values_read_data( |
1282 | 0 | (libfwsi_users_property_view_values_t *) internal_item->value, |
1283 | 0 | shell_item_data, |
1284 | 0 | shell_item_data_size, |
1285 | 0 | ascii_codepage, |
1286 | 0 | error ); |
1287 | |
|
1288 | 0 | if( result == -1 ) |
1289 | 0 | { |
1290 | 0 | libcerror_error_set( |
1291 | 0 | error, |
1292 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
1293 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
1294 | 0 | "%s: unable to read users property view values.", |
1295 | 0 | function ); |
1296 | |
|
1297 | 0 | goto on_error; |
1298 | 0 | } |
1299 | 0 | break; |
1300 | | |
1301 | 0 | case LIBFWSI_ITEM_TYPE_VOLUME: |
1302 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_volume_values_free; |
1303 | |
|
1304 | 0 | if( libfwsi_volume_values_initialize( |
1305 | 0 | (libfwsi_volume_values_t **) &( internal_item->value ), |
1306 | 0 | error ) != 1 ) |
1307 | 0 | { |
1308 | 0 | libcerror_error_set( |
1309 | 0 | error, |
1310 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1311 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
1312 | 0 | "%s: unable to create volume values.", |
1313 | 0 | function ); |
1314 | |
|
1315 | 0 | goto on_error; |
1316 | 0 | } |
1317 | 0 | result = libfwsi_volume_values_read_data( |
1318 | 0 | (libfwsi_volume_values_t *) internal_item->value, |
1319 | 0 | shell_item_data, |
1320 | 0 | shell_item_data_size, |
1321 | 0 | ascii_codepage, |
1322 | 0 | error ); |
1323 | |
|
1324 | 0 | if( result == -1 ) |
1325 | 0 | { |
1326 | 0 | libcerror_error_set( |
1327 | 0 | error, |
1328 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
1329 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
1330 | 0 | "%s: unable to read volume values.", |
1331 | 0 | function ); |
1332 | |
|
1333 | 0 | goto on_error; |
1334 | 0 | } |
1335 | 0 | break; |
1336 | | |
1337 | 0 | case LIBFWSI_ITEM_TYPE_WEB_SITE: |
1338 | 0 | internal_item->free_value = (int (*)(intptr_t **, libcerror_error_t **)) &libfwsi_web_site_values_free; |
1339 | |
|
1340 | 0 | if( libfwsi_web_site_values_initialize( |
1341 | 0 | (libfwsi_web_site_values_t **) &( internal_item->value ), |
1342 | 0 | error ) != 1 ) |
1343 | 0 | { |
1344 | 0 | libcerror_error_set( |
1345 | 0 | error, |
1346 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1347 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
1348 | 0 | "%s: unable to create web site values.", |
1349 | 0 | function ); |
1350 | |
|
1351 | 0 | goto on_error; |
1352 | 0 | } |
1353 | 0 | result = libfwsi_web_site_values_read_data( |
1354 | 0 | (libfwsi_web_site_values_t *) internal_item->value, |
1355 | 0 | shell_item_data, |
1356 | 0 | shell_item_data_size, |
1357 | 0 | error ); |
1358 | |
|
1359 | 0 | if( result == -1 ) |
1360 | 0 | { |
1361 | 0 | libcerror_error_set( |
1362 | 0 | error, |
1363 | 0 | LIBCERROR_ERROR_DOMAIN_IO, |
1364 | 0 | LIBCERROR_IO_ERROR_READ_FAILED, |
1365 | 0 | "%s: unable to read web site values.", |
1366 | 0 | function ); |
1367 | |
|
1368 | 0 | goto on_error; |
1369 | 0 | } |
1370 | 0 | break; |
1371 | | |
1372 | 0 | case LIBFWSI_ITEM_TYPE_UNKNOWN: |
1373 | 0 | default: |
1374 | 0 | break; |
1375 | 0 | } |
1376 | 0 | if( result == 0 ) |
1377 | 0 | { |
1378 | | #if defined( HAVE_DEBUG_OUTPUT ) |
1379 | | if( libcnotify_verbose != 0 ) |
1380 | | { |
1381 | | libcnotify_printf( |
1382 | | "%s: unsupported shell item type.\n", |
1383 | | function ); |
1384 | | } |
1385 | | #endif |
1386 | 0 | internal_item->type = LIBFWSI_ITEM_TYPE_UNKNOWN; |
1387 | 0 | internal_item->class_type = 0; |
1388 | 0 | internal_item->signature = 0; |
1389 | 0 | } |
1390 | 0 | byte_stream_copy_to_uint16_little_endian( |
1391 | 0 | &( byte_stream[ internal_item->data_size - 2 ] ), |
1392 | 0 | first_extension_block_offset ); |
1393 | |
|
1394 | 0 | if( ( first_extension_block_offset >= 4 ) |
1395 | 0 | && ( first_extension_block_offset < ( internal_item->data_size - 2 ) ) ) |
1396 | 0 | { |
1397 | 0 | byte_stream_offset = (size_t) first_extension_block_offset; |
1398 | 0 | shell_item_data_size = internal_item->data_size - byte_stream_offset; |
1399 | |
|
1400 | 0 | while( shell_item_data_size > 2 ) |
1401 | 0 | { |
1402 | 0 | if( libfwsi_extension_block_initialize( |
1403 | 0 | (libfwsi_extension_block_t **) &extension_block, |
1404 | 0 | error ) != 1 ) |
1405 | 0 | { |
1406 | 0 | libcerror_error_set( |
1407 | 0 | error, |
1408 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1409 | 0 | LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, |
1410 | 0 | "%s: unable to create extension block.", |
1411 | 0 | function ); |
1412 | |
|
1413 | 0 | goto on_error; |
1414 | 0 | } |
1415 | 0 | result = libfwsi_extension_block_copy_from_byte_stream( |
1416 | 0 | extension_block, |
1417 | 0 | &( byte_stream[ byte_stream_offset ] ), |
1418 | 0 | shell_item_data_size, |
1419 | 0 | ascii_codepage, |
1420 | 0 | error ); |
1421 | |
|
1422 | 0 | if( result == -1 ) |
1423 | 0 | { |
1424 | 0 | libcerror_error_set( |
1425 | 0 | error, |
1426 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1427 | 0 | LIBCERROR_RUNTIME_ERROR_COPY_FAILED, |
1428 | 0 | "%s: unable to copy byte stream to extension block.", |
1429 | 0 | function ); |
1430 | |
|
1431 | 0 | goto on_error; |
1432 | 0 | } |
1433 | 0 | else if( result == 0 ) |
1434 | 0 | { |
1435 | 0 | break; |
1436 | 0 | } |
1437 | 0 | byte_stream_offset += extension_block->data_size; |
1438 | 0 | shell_item_data_size -= extension_block->data_size; |
1439 | |
|
1440 | 0 | if( extension_block->data_size == 2 ) |
1441 | 0 | { |
1442 | 0 | break; |
1443 | 0 | } |
1444 | 0 | if( libcdata_array_append_entry( |
1445 | 0 | internal_item->extension_blocks_array, |
1446 | 0 | &entry_index, |
1447 | 0 | (intptr_t *) extension_block, |
1448 | 0 | error ) != 1 ) |
1449 | 0 | { |
1450 | 0 | libcerror_error_set( |
1451 | 0 | error, |
1452 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1453 | 0 | LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, |
1454 | 0 | "%s: unable to append extension block.", |
1455 | 0 | function ); |
1456 | |
|
1457 | 0 | goto on_error; |
1458 | 0 | } |
1459 | 0 | extension_block = NULL; |
1460 | |
|
1461 | 0 | number_of_extension_blocks++; |
1462 | 0 | } |
1463 | 0 | if( extension_block != NULL ) |
1464 | 0 | { |
1465 | 0 | if( libfwsi_internal_extension_block_free( |
1466 | 0 | &extension_block, |
1467 | 0 | error ) != 1 ) |
1468 | 0 | { |
1469 | 0 | libcerror_error_set( |
1470 | 0 | error, |
1471 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1472 | 0 | LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, |
1473 | 0 | "%s: unable to free extension block.", |
1474 | 0 | function ); |
1475 | |
|
1476 | 0 | goto on_error; |
1477 | 0 | } |
1478 | 0 | } |
1479 | | #if defined( HAVE_DEBUG_OUTPUT ) |
1480 | | if( libcnotify_verbose != 0 ) |
1481 | | { |
1482 | | if( ( number_of_extension_blocks > 0 ) |
1483 | | && ( shell_item_data_size > 0 ) ) |
1484 | | { |
1485 | | libcnotify_printf( |
1486 | | "%s: trailing data:\n", |
1487 | | function ); |
1488 | | libcnotify_print_data( |
1489 | | &( byte_stream[ byte_stream_offset ] ), |
1490 | | shell_item_data_size, |
1491 | | LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); |
1492 | | } |
1493 | | } |
1494 | | #endif /* defined( HAVE_DEBUG_OUTPUT ) */ |
1495 | 0 | } |
1496 | 0 | internal_item->ascii_codepage = ascii_codepage; |
1497 | |
|
1498 | 0 | return( 1 ); |
1499 | | |
1500 | 0 | on_error: |
1501 | 0 | if( extension_block != NULL ) |
1502 | 0 | { |
1503 | 0 | libfwsi_internal_extension_block_free( |
1504 | 0 | &extension_block, |
1505 | 0 | NULL ); |
1506 | 0 | } |
1507 | 0 | if( delegate_folder_values != NULL ) |
1508 | 0 | { |
1509 | 0 | libfwsi_delegate_folder_values_free( |
1510 | 0 | &delegate_folder_values, |
1511 | 0 | NULL ); |
1512 | 0 | } |
1513 | 0 | if( ( internal_item->value != NULL ) |
1514 | 0 | && ( internal_item->free_value != NULL ) ) |
1515 | 0 | { |
1516 | 0 | internal_item->free_value( |
1517 | 0 | &( internal_item->value ), |
1518 | 0 | NULL ); |
1519 | 0 | } |
1520 | 0 | return( -1 ); |
1521 | 0 | } |
1522 | | |
1523 | | /* Retrieves the type |
1524 | | * Returns 1 if successful or -1 on error |
1525 | | */ |
1526 | | int libfwsi_item_get_type( |
1527 | | libfwsi_item_t *item, |
1528 | | int *type, |
1529 | | libcerror_error_t **error ) |
1530 | 0 | { |
1531 | 0 | libfwsi_internal_item_t *internal_item = NULL; |
1532 | 0 | static char *function = "libfwsi_item_get_type"; |
1533 | |
|
1534 | 0 | if( item == NULL ) |
1535 | 0 | { |
1536 | 0 | libcerror_error_set( |
1537 | 0 | error, |
1538 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1539 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1540 | 0 | "%s: invalid item.", |
1541 | 0 | function ); |
1542 | |
|
1543 | 0 | return( -1 ); |
1544 | 0 | } |
1545 | 0 | internal_item = (libfwsi_internal_item_t *) item; |
1546 | |
|
1547 | 0 | if( type == 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 type.", |
1554 | 0 | function ); |
1555 | |
|
1556 | 0 | return( -1 ); |
1557 | 0 | } |
1558 | 0 | *type = internal_item->type; |
1559 | |
|
1560 | 0 | return( 1 ); |
1561 | 0 | } |
1562 | | |
1563 | | /* Retrieves the class type |
1564 | | * Returns 1 if successful or -1 on error |
1565 | | */ |
1566 | | int libfwsi_item_get_class_type( |
1567 | | libfwsi_item_t *item, |
1568 | | uint8_t *class_type, |
1569 | | libcerror_error_t **error ) |
1570 | 0 | { |
1571 | 0 | libfwsi_internal_item_t *internal_item = NULL; |
1572 | 0 | static char *function = "libfwsi_item_get_class_type"; |
1573 | |
|
1574 | 0 | if( item == NULL ) |
1575 | 0 | { |
1576 | 0 | libcerror_error_set( |
1577 | 0 | error, |
1578 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1579 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1580 | 0 | "%s: invalid item.", |
1581 | 0 | function ); |
1582 | |
|
1583 | 0 | return( -1 ); |
1584 | 0 | } |
1585 | 0 | internal_item = (libfwsi_internal_item_t *) item; |
1586 | |
|
1587 | 0 | if( class_type == NULL ) |
1588 | 0 | { |
1589 | 0 | libcerror_error_set( |
1590 | 0 | error, |
1591 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1592 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1593 | 0 | "%s: invalid class type.", |
1594 | 0 | function ); |
1595 | |
|
1596 | 0 | return( -1 ); |
1597 | 0 | } |
1598 | 0 | *class_type = internal_item->class_type; |
1599 | |
|
1600 | 0 | return( 1 ); |
1601 | 0 | } |
1602 | | |
1603 | | /* Retrieves the signature |
1604 | | * Returns 1 if successful or -1 on error |
1605 | | */ |
1606 | | int libfwsi_item_get_signature( |
1607 | | libfwsi_item_t *item, |
1608 | | uint32_t *signature, |
1609 | | libcerror_error_t **error ) |
1610 | 0 | { |
1611 | 0 | libfwsi_internal_item_t *internal_item = NULL; |
1612 | 0 | static char *function = "libfwsi_item_get_signature"; |
1613 | |
|
1614 | 0 | if( item == NULL ) |
1615 | 0 | { |
1616 | 0 | libcerror_error_set( |
1617 | 0 | error, |
1618 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1619 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1620 | 0 | "%s: invalid item.", |
1621 | 0 | function ); |
1622 | |
|
1623 | 0 | return( -1 ); |
1624 | 0 | } |
1625 | 0 | internal_item = (libfwsi_internal_item_t *) item; |
1626 | |
|
1627 | 0 | if( signature == NULL ) |
1628 | 0 | { |
1629 | 0 | libcerror_error_set( |
1630 | 0 | error, |
1631 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1632 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1633 | 0 | "%s: invalid signature.", |
1634 | 0 | function ); |
1635 | |
|
1636 | 0 | return( -1 ); |
1637 | 0 | } |
1638 | 0 | *signature = internal_item->signature; |
1639 | |
|
1640 | 0 | return( 1 ); |
1641 | 0 | } |
1642 | | |
1643 | | /* Retrieves the data size |
1644 | | * Returns 1 if successful or -1 on error |
1645 | | */ |
1646 | | int libfwsi_item_get_data_size( |
1647 | | libfwsi_item_t *item, |
1648 | | size_t *data_size, |
1649 | | libcerror_error_t **error ) |
1650 | 0 | { |
1651 | 0 | libfwsi_internal_item_t *internal_item = NULL; |
1652 | 0 | static char *function = "libfwsi_item_get_data_size"; |
1653 | |
|
1654 | 0 | if( item == NULL ) |
1655 | 0 | { |
1656 | 0 | libcerror_error_set( |
1657 | 0 | error, |
1658 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1659 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1660 | 0 | "%s: invalid item.", |
1661 | 0 | function ); |
1662 | |
|
1663 | 0 | return( -1 ); |
1664 | 0 | } |
1665 | 0 | internal_item = (libfwsi_internal_item_t *) item; |
1666 | |
|
1667 | 0 | if( data_size == NULL ) |
1668 | 0 | { |
1669 | 0 | libcerror_error_set( |
1670 | 0 | error, |
1671 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1672 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1673 | 0 | "%s: invalid data size.", |
1674 | 0 | function ); |
1675 | |
|
1676 | 0 | return( -1 ); |
1677 | 0 | } |
1678 | 0 | *data_size = (size_t) internal_item->data_size; |
1679 | |
|
1680 | 0 | return( 1 ); |
1681 | 0 | } |
1682 | | |
1683 | | /* Retrieves the delegate folder identifier |
1684 | | * The identifier is a GUID and is 16 bytes of size |
1685 | | * Returns 1 if successful, 0 if not available or -1 on error |
1686 | | */ |
1687 | | int libfwsi_item_get_delegate_folder_identifier( |
1688 | | libfwsi_item_t *item, |
1689 | | uint8_t *guid_data, |
1690 | | size_t guid_data_size, |
1691 | | libcerror_error_t **error ) |
1692 | 0 | { |
1693 | 0 | libfwsi_internal_item_t *internal_item = NULL; |
1694 | 0 | static char *function = "libfwsi_item_get_delegate_folder_identifier"; |
1695 | |
|
1696 | 0 | if( item == NULL ) |
1697 | 0 | { |
1698 | 0 | libcerror_error_set( |
1699 | 0 | error, |
1700 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1701 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1702 | 0 | "%s: invalid item.", |
1703 | 0 | function ); |
1704 | |
|
1705 | 0 | return( -1 ); |
1706 | 0 | } |
1707 | 0 | internal_item = (libfwsi_internal_item_t *) item; |
1708 | |
|
1709 | 0 | if( guid_data == NULL ) |
1710 | 0 | { |
1711 | 0 | libcerror_error_set( |
1712 | 0 | error, |
1713 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1714 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1715 | 0 | "%s: invalid GUID data.", |
1716 | 0 | function ); |
1717 | |
|
1718 | 0 | return( -1 ); |
1719 | 0 | } |
1720 | 0 | if( guid_data_size < 16 ) |
1721 | 0 | { |
1722 | 0 | libcerror_error_set( |
1723 | 0 | error, |
1724 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1725 | 0 | LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, |
1726 | 0 | "%s: GUID data size too small.", |
1727 | 0 | function ); |
1728 | |
|
1729 | 0 | return( -1 ); |
1730 | 0 | } |
1731 | 0 | if( internal_item->has_delegate_folder_identifier == 0 ) |
1732 | 0 | { |
1733 | 0 | return( 0 ); |
1734 | 0 | } |
1735 | 0 | if( memory_copy( |
1736 | 0 | guid_data, |
1737 | 0 | internal_item->delegate_folder_identifier, |
1738 | 0 | 16 ) == NULL ) |
1739 | 0 | { |
1740 | 0 | libcerror_error_set( |
1741 | 0 | error, |
1742 | 0 | LIBCERROR_ERROR_DOMAIN_MEMORY, |
1743 | 0 | LIBCERROR_MEMORY_ERROR_COPY_FAILED, |
1744 | 0 | "%s: unable to copy delegate folder identifier.", |
1745 | 0 | function ); |
1746 | |
|
1747 | 0 | return( -1 ); |
1748 | 0 | } |
1749 | 0 | return( 1 ); |
1750 | 0 | } |
1751 | | |
1752 | | /* Retrieves the number of extension blocks |
1753 | | * Returns 1 if successful or -1 on error |
1754 | | */ |
1755 | | int libfwsi_item_get_number_of_extension_blocks( |
1756 | | libfwsi_item_t *item, |
1757 | | int *number_of_extension_blocks, |
1758 | | libcerror_error_t **error ) |
1759 | 0 | { |
1760 | 0 | libfwsi_internal_item_t *internal_item = NULL; |
1761 | 0 | static char *function = "libfwsi_item_get_number_of_extension_blocks"; |
1762 | |
|
1763 | 0 | if( item == NULL ) |
1764 | 0 | { |
1765 | 0 | libcerror_error_set( |
1766 | 0 | error, |
1767 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1768 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1769 | 0 | "%s: invalid item.", |
1770 | 0 | function ); |
1771 | |
|
1772 | 0 | return( -1 ); |
1773 | 0 | } |
1774 | 0 | internal_item = (libfwsi_internal_item_t *) item; |
1775 | |
|
1776 | 0 | if( libcdata_array_get_number_of_entries( |
1777 | 0 | internal_item->extension_blocks_array, |
1778 | 0 | number_of_extension_blocks, |
1779 | 0 | error ) != 1 ) |
1780 | 0 | { |
1781 | 0 | libcerror_error_set( |
1782 | 0 | error, |
1783 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1784 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1785 | 0 | "%s: unable to retrieve number of entries.", |
1786 | 0 | function ); |
1787 | |
|
1788 | 0 | return( -1 ); |
1789 | 0 | } |
1790 | 0 | return( 1 ); |
1791 | 0 | } |
1792 | | |
1793 | | /* Retrieves a specific extension block |
1794 | | * Returns 1 if successful or -1 on error |
1795 | | */ |
1796 | | int libfwsi_item_get_extension_block( |
1797 | | libfwsi_item_t *item, |
1798 | | int extension_block_index, |
1799 | | libfwsi_extension_block_t **extension_block, |
1800 | | libcerror_error_t **error ) |
1801 | 0 | { |
1802 | 0 | libfwsi_internal_item_t *internal_item = NULL; |
1803 | 0 | static char *function = "libfwsi_item_get_extension_block"; |
1804 | |
|
1805 | 0 | if( item == 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 item.", |
1812 | 0 | function ); |
1813 | |
|
1814 | 0 | return( -1 ); |
1815 | 0 | } |
1816 | 0 | internal_item = (libfwsi_internal_item_t *) item; |
1817 | |
|
1818 | 0 | if( libcdata_array_get_entry_by_index( |
1819 | 0 | internal_item->extension_blocks_array, |
1820 | 0 | extension_block_index, |
1821 | 0 | (intptr_t **) extension_block, |
1822 | 0 | error ) != 1 ) |
1823 | 0 | { |
1824 | 0 | libcerror_error_set( |
1825 | 0 | error, |
1826 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
1827 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
1828 | 0 | "%s: unable to retrieve extension block: %d.", |
1829 | 0 | function, |
1830 | 0 | extension_block_index ); |
1831 | |
|
1832 | 0 | return( -1 ); |
1833 | 0 | } |
1834 | 0 | return( 1 ); |
1835 | 0 | } |
1836 | | |
1837 | | /* Retrieves the parent shell item |
1838 | | * Returns 1 if successful or -1 on error |
1839 | | */ |
1840 | | int libfwsi_item_get_parent_item( |
1841 | | libfwsi_item_t *item, |
1842 | | libfwsi_item_t **parent_item, |
1843 | | libcerror_error_t **error ) |
1844 | 0 | { |
1845 | 0 | libfwsi_internal_item_t *internal_item = NULL; |
1846 | 0 | static char *function = "libfwsi_item_get_parent_item"; |
1847 | |
|
1848 | 0 | if( item == 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 item.", |
1855 | 0 | function ); |
1856 | |
|
1857 | 0 | return( -1 ); |
1858 | 0 | } |
1859 | 0 | internal_item = (libfwsi_internal_item_t *) item; |
1860 | |
|
1861 | 0 | if( parent_item == NULL ) |
1862 | 0 | { |
1863 | 0 | libcerror_error_set( |
1864 | 0 | error, |
1865 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1866 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1867 | 0 | "%s: invalid parent item.", |
1868 | 0 | function ); |
1869 | |
|
1870 | 0 | return( -1 ); |
1871 | 0 | } |
1872 | 0 | *parent_item = internal_item->parent_item; |
1873 | |
|
1874 | 0 | return( 1 ); |
1875 | 0 | } |
1876 | | |
1877 | | /* Sets the parent shell item |
1878 | | * Returns 1 if successful or -1 on error |
1879 | | */ |
1880 | | int libfwsi_item_set_parent_item( |
1881 | | libfwsi_item_t *item, |
1882 | | libfwsi_item_t *parent_item, |
1883 | | libcerror_error_t **error ) |
1884 | 0 | { |
1885 | 0 | libfwsi_internal_item_t *internal_item = NULL; |
1886 | 0 | static char *function = "libfwsi_item_set_parent_item"; |
1887 | |
|
1888 | 0 | if( item == NULL ) |
1889 | 0 | { |
1890 | 0 | libcerror_error_set( |
1891 | 0 | error, |
1892 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
1893 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
1894 | 0 | "%s: invalid item.", |
1895 | 0 | function ); |
1896 | |
|
1897 | 0 | return( -1 ); |
1898 | 0 | } |
1899 | 0 | internal_item = (libfwsi_internal_item_t *) item; |
1900 | |
|
1901 | 0 | internal_item->parent_item = parent_item; |
1902 | |
|
1903 | 0 | return( 1 ); |
1904 | 0 | } |
1905 | | |