/src/libfsntfs/libfsntfs/libfsntfs_standard_information_values.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Standard information attribute ($STANDARAD_INFORMATION) 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 <system_string.h> |
26 | | #include <types.h> |
27 | | |
28 | | #include "libfsntfs_debug.h" |
29 | | #include "libfsntfs_definitions.h" |
30 | | #include "libfsntfs_libcerror.h" |
31 | | #include "libfsntfs_libcnotify.h" |
32 | | #include "libfsntfs_libfdatetime.h" |
33 | | #include "libfsntfs_standard_information_values.h" |
34 | | |
35 | | #include "fsntfs_standard_information.h" |
36 | | |
37 | | /* Creates standard information values |
38 | | * Make sure the value standard_information_values is referencing, is set to NULL |
39 | | * Returns 1 if successful or -1 on error |
40 | | */ |
41 | | int libfsntfs_standard_information_values_initialize( |
42 | | libfsntfs_standard_information_values_t **standard_information_values, |
43 | | libcerror_error_t **error ) |
44 | 129 | { |
45 | 129 | static char *function = "libfsntfs_standard_information_values_initialize"; |
46 | | |
47 | 129 | if( standard_information_values == NULL ) |
48 | 0 | { |
49 | 0 | libcerror_error_set( |
50 | 0 | error, |
51 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
52 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
53 | 0 | "%s: invalid standard information values.", |
54 | 0 | function ); |
55 | |
|
56 | 0 | return( -1 ); |
57 | 0 | } |
58 | 129 | if( *standard_information_values != NULL ) |
59 | 0 | { |
60 | 0 | libcerror_error_set( |
61 | 0 | error, |
62 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
63 | 0 | LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, |
64 | 0 | "%s: invalid standard information values value already set.", |
65 | 0 | function ); |
66 | |
|
67 | 0 | return( -1 ); |
68 | 0 | } |
69 | 129 | *standard_information_values = memory_allocate_structure( |
70 | 129 | libfsntfs_standard_information_values_t ); |
71 | | |
72 | 129 | if( *standard_information_values == NULL ) |
73 | 0 | { |
74 | 0 | libcerror_error_set( |
75 | 0 | error, |
76 | 0 | LIBCERROR_ERROR_DOMAIN_MEMORY, |
77 | 0 | LIBCERROR_MEMORY_ERROR_INSUFFICIENT, |
78 | 0 | "%s: unable to create standard information values.", |
79 | 0 | function ); |
80 | |
|
81 | 0 | goto on_error; |
82 | 0 | } |
83 | 129 | if( memory_set( |
84 | 129 | *standard_information_values, |
85 | 129 | 0, |
86 | 129 | sizeof( libfsntfs_standard_information_values_t ) ) == NULL ) |
87 | 0 | { |
88 | 0 | libcerror_error_set( |
89 | 0 | error, |
90 | 0 | LIBCERROR_ERROR_DOMAIN_MEMORY, |
91 | 0 | LIBCERROR_MEMORY_ERROR_SET_FAILED, |
92 | 0 | "%s: unable to clear standard information values.", |
93 | 0 | function ); |
94 | |
|
95 | 0 | goto on_error; |
96 | 0 | } |
97 | 129 | return( 1 ); |
98 | | |
99 | 0 | on_error: |
100 | 0 | if( *standard_information_values != NULL ) |
101 | 0 | { |
102 | 0 | memory_free( |
103 | 0 | *standard_information_values ); |
104 | |
|
105 | 0 | *standard_information_values = NULL; |
106 | 0 | } |
107 | 0 | return( -1 ); |
108 | 129 | } |
109 | | |
110 | | /* Frees standard information values |
111 | | * Returns 1 if successful or -1 on error |
112 | | */ |
113 | | int libfsntfs_standard_information_values_free( |
114 | | libfsntfs_standard_information_values_t **standard_information_values, |
115 | | libcerror_error_t **error ) |
116 | 129 | { |
117 | 129 | static char *function = "libfsntfs_standard_information_values_free"; |
118 | | |
119 | 129 | if( standard_information_values == NULL ) |
120 | 0 | { |
121 | 0 | libcerror_error_set( |
122 | 0 | error, |
123 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
124 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
125 | 0 | "%s: invalid standard information values.", |
126 | 0 | function ); |
127 | |
|
128 | 0 | return( -1 ); |
129 | 0 | } |
130 | 129 | if( *standard_information_values != NULL ) |
131 | 129 | { |
132 | 129 | memory_free( |
133 | 129 | *standard_information_values ); |
134 | | |
135 | 129 | *standard_information_values = NULL; |
136 | 129 | } |
137 | 129 | return( 1 ); |
138 | 129 | } |
139 | | |
140 | | /* Reads the standard information values |
141 | | * Returns 1 if successful or -1 on error |
142 | | */ |
143 | | int libfsntfs_standard_information_values_read_data( |
144 | | libfsntfs_standard_information_values_t *standard_information_values, |
145 | | const uint8_t *data, |
146 | | size_t data_size, |
147 | | libcerror_error_t **error ) |
148 | 128 | { |
149 | 128 | static char *function = "libfsntfs_standard_information_values_read_data"; |
150 | 128 | uint32_t maximum_number_of_versions = 0; |
151 | 128 | uint32_t version_number = 0; |
152 | | |
153 | | #if defined( HAVE_DEBUG_OUTPUT ) |
154 | | uint64_t value_64bit = 0; |
155 | | uint32_t value_32bit = 0; |
156 | | #endif |
157 | | |
158 | 128 | if( standard_information_values == NULL ) |
159 | 0 | { |
160 | 0 | libcerror_error_set( |
161 | 0 | error, |
162 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
163 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
164 | 0 | "%s: invalid standard information values.", |
165 | 0 | function ); |
166 | |
|
167 | 0 | return( -1 ); |
168 | 0 | } |
169 | 128 | if( data == NULL ) |
170 | 4 | { |
171 | 4 | libcerror_error_set( |
172 | 4 | error, |
173 | 4 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
174 | 4 | LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, |
175 | 4 | "%s: invalid data.", |
176 | 4 | function ); |
177 | | |
178 | 4 | return( -1 ); |
179 | 4 | } |
180 | 124 | if( data_size > (size_t) SSIZE_MAX ) |
181 | 0 | { |
182 | 0 | libcerror_error_set( |
183 | 0 | error, |
184 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
185 | 0 | LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, |
186 | 0 | "%s: invalid data size value out of bounds.", |
187 | 0 | function ); |
188 | |
|
189 | 0 | return( -1 ); |
190 | 0 | } |
191 | | #if defined( HAVE_DEBUG_OUTPUT ) |
192 | | if( libcnotify_verbose != 0 ) |
193 | | { |
194 | | libcnotify_printf( |
195 | | "%s: standard information data:\n", |
196 | | function ); |
197 | | libcnotify_print_data( |
198 | | data, |
199 | | data_size, |
200 | | 0 ); |
201 | | } |
202 | | #endif |
203 | 124 | if( ( data_size != 48 ) |
204 | 124 | && ( data_size != 72 ) ) |
205 | 8 | { |
206 | 8 | libcerror_error_set( |
207 | 8 | error, |
208 | 8 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
209 | 8 | LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, |
210 | 8 | "%s: unsupported standard information data size: %" PRIzd "\n", |
211 | 8 | function, |
212 | 8 | data_size ); |
213 | | |
214 | 8 | return( -1 ); |
215 | 8 | } |
216 | 116 | byte_stream_copy_to_uint64_little_endian( |
217 | 116 | ( (fsntfs_standard_information_t *) data )->creation_time, |
218 | 116 | standard_information_values->creation_time ); |
219 | | |
220 | 116 | byte_stream_copy_to_uint64_little_endian( |
221 | 116 | ( (fsntfs_standard_information_t *) data )->modification_time, |
222 | 116 | standard_information_values->modification_time ); |
223 | | |
224 | 116 | byte_stream_copy_to_uint64_little_endian( |
225 | 116 | ( (fsntfs_standard_information_t *) data )->access_time, |
226 | 116 | standard_information_values->access_time ); |
227 | | |
228 | 116 | byte_stream_copy_to_uint64_little_endian( |
229 | 116 | ( (fsntfs_standard_information_t *) data )->entry_modification_time, |
230 | 116 | standard_information_values->entry_modification_time ); |
231 | | |
232 | 116 | byte_stream_copy_to_uint32_little_endian( |
233 | 116 | ( (fsntfs_standard_information_t *) data )->file_attribute_flags, |
234 | 116 | standard_information_values->file_attribute_flags ); |
235 | | |
236 | 116 | byte_stream_copy_to_uint32_little_endian( |
237 | 116 | ( (fsntfs_standard_information_t *) data )->maximum_number_of_versions, |
238 | 116 | maximum_number_of_versions ); |
239 | | |
240 | 116 | byte_stream_copy_to_uint32_little_endian( |
241 | 116 | ( (fsntfs_standard_information_t *) data )->version_number, |
242 | 116 | version_number ); |
243 | | |
244 | | #if defined( HAVE_DEBUG_OUTPUT ) |
245 | | if( libcnotify_verbose != 0 ) |
246 | | { |
247 | | if( libfsntfs_debug_print_filetime_value( |
248 | | function, |
249 | | "creation time\t\t\t", |
250 | | ( (fsntfs_standard_information_t *) data )->creation_time, |
251 | | 8, |
252 | | LIBFDATETIME_ENDIAN_LITTLE, |
253 | | LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME_NANO_SECONDS, |
254 | | error ) != 1 ) |
255 | | { |
256 | | libcerror_error_set( |
257 | | error, |
258 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
259 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
260 | | "%s: unable to print filetime value.", |
261 | | function ); |
262 | | |
263 | | return( -1 ); |
264 | | } |
265 | | if( libfsntfs_debug_print_filetime_value( |
266 | | function, |
267 | | "modification time\t\t", |
268 | | ( (fsntfs_standard_information_t *) data )->modification_time, |
269 | | 8, |
270 | | LIBFDATETIME_ENDIAN_LITTLE, |
271 | | LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME_NANO_SECONDS, |
272 | | error ) != 1 ) |
273 | | { |
274 | | libcerror_error_set( |
275 | | error, |
276 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
277 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
278 | | "%s: unable to print filetime value.", |
279 | | function ); |
280 | | |
281 | | return( -1 ); |
282 | | } |
283 | | if( libfsntfs_debug_print_filetime_value( |
284 | | function, |
285 | | "entry modification time\t", |
286 | | ( (fsntfs_standard_information_t *) data )->entry_modification_time, |
287 | | 8, |
288 | | LIBFDATETIME_ENDIAN_LITTLE, |
289 | | LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME_NANO_SECONDS, |
290 | | error ) != 1 ) |
291 | | { |
292 | | libcerror_error_set( |
293 | | error, |
294 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
295 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
296 | | "%s: unable to print filetime value.", |
297 | | function ); |
298 | | |
299 | | return( -1 ); |
300 | | } |
301 | | if( libfsntfs_debug_print_filetime_value( |
302 | | function, |
303 | | "access time\t\t\t", |
304 | | ( (fsntfs_standard_information_t *) data )->access_time, |
305 | | 8, |
306 | | LIBFDATETIME_ENDIAN_LITTLE, |
307 | | LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME_NANO_SECONDS, |
308 | | error ) != 1 ) |
309 | | { |
310 | | libcerror_error_set( |
311 | | error, |
312 | | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
313 | | LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, |
314 | | "%s: unable to print filetime value.", |
315 | | function ); |
316 | | |
317 | | return( -1 ); |
318 | | } |
319 | | libcnotify_printf( |
320 | | "%s: file attribute flags\t\t: 0x%08" PRIx32 "\n", |
321 | | function, |
322 | | standard_information_values->file_attribute_flags ); |
323 | | libfsntfs_debug_print_file_attribute_flags( |
324 | | standard_information_values->file_attribute_flags ); |
325 | | libcnotify_printf( |
326 | | "\n" ); |
327 | | |
328 | | libcnotify_printf( |
329 | | "%s: maximum number of versions\t: %" PRIu32 "\n", |
330 | | function, |
331 | | maximum_number_of_versions ); |
332 | | |
333 | | libcnotify_printf( |
334 | | "%s: version number\t\t\t: %" PRIu32 "\n", |
335 | | function, |
336 | | version_number ); |
337 | | |
338 | | byte_stream_copy_to_uint32_little_endian( |
339 | | ( (fsntfs_standard_information_t *) data )->class_identifier, |
340 | | value_32bit ); |
341 | | libcnotify_printf( |
342 | | "%s: class identifier\t\t: %" PRIu32 "\n", |
343 | | function, |
344 | | value_32bit ); |
345 | | } |
346 | | #endif /* defined( HAVE_DEBUG_OUTPUT ) */ |
347 | | |
348 | 116 | if( ( maximum_number_of_versions == 0 ) |
349 | 116 | && ( version_number == 1 ) ) |
350 | 3 | { |
351 | 3 | standard_information_values->is_case_sensitive = 1; |
352 | 3 | } |
353 | 116 | if( data_size > 48 ) |
354 | 1 | { |
355 | 1 | byte_stream_copy_to_uint32_little_endian( |
356 | 1 | ( (fsntfs_standard_information_t *) data )->owner_identifier, |
357 | 1 | standard_information_values->owner_identifier ); |
358 | | |
359 | 1 | byte_stream_copy_to_uint32_little_endian( |
360 | 1 | ( (fsntfs_standard_information_t *) data )->security_descriptor_identifier, |
361 | 1 | standard_information_values->security_descriptor_identifier ); |
362 | | |
363 | 1 | byte_stream_copy_to_uint64_little_endian( |
364 | 1 | ( (fsntfs_standard_information_t *) data )->update_sequence_number, |
365 | 1 | standard_information_values->update_sequence_number ); |
366 | | |
367 | | #if defined( HAVE_DEBUG_OUTPUT ) |
368 | | if( libcnotify_verbose != 0 ) |
369 | | { |
370 | | libcnotify_printf( |
371 | | "%s: owner identifier\t\t: %" PRIu32 "\n", |
372 | | function, |
373 | | standard_information_values->owner_identifier ); |
374 | | |
375 | | libcnotify_printf( |
376 | | "%s: security descriptor identifier\t: %" PRIu32 "\n", |
377 | | function, |
378 | | standard_information_values->security_descriptor_identifier ); |
379 | | |
380 | | byte_stream_copy_to_uint64_little_endian( |
381 | | ( (fsntfs_standard_information_t *) data )->quota_charged, |
382 | | value_64bit ); |
383 | | libcnotify_printf( |
384 | | "%s: quota charged\t\t\t: %" PRIu64 "\n", |
385 | | function, |
386 | | value_64bit ); |
387 | | |
388 | | libcnotify_printf( |
389 | | "%s: update sequence number\t\t: %" PRIu64 "\n", |
390 | | function, |
391 | | standard_information_values->update_sequence_number ); |
392 | | } |
393 | | #endif /* defined( HAVE_DEBUG_OUTPUT ) */ |
394 | 1 | } |
395 | | #if defined( HAVE_DEBUG_OUTPUT ) |
396 | | if( libcnotify_verbose != 0 ) |
397 | | { |
398 | | libcnotify_printf( |
399 | | "\n" ); |
400 | | } |
401 | | #endif |
402 | 116 | return( 1 ); |
403 | 124 | } |
404 | | |
405 | | /* Reads the standard information values from an MFT attribute |
406 | | * Returns 1 if successful or -1 on error |
407 | | */ |
408 | | int libfsntfs_standard_information_values_read_from_mft_attribute( |
409 | | libfsntfs_standard_information_values_t *standard_information_values, |
410 | | libfsntfs_mft_attribute_t *mft_attribute, |
411 | | libcerror_error_t **error ) |
412 | 129 | { |
413 | 129 | uint8_t *data = NULL; |
414 | 129 | static char *function = "libfsntfs_standard_information_values_read_from_mft_attribute"; |
415 | 129 | size_t data_size = 0; |
416 | 129 | uint32_t attribute_type = 0; |
417 | 129 | int result = 0; |
418 | | |
419 | 129 | if( standard_information_values == NULL ) |
420 | 0 | { |
421 | 0 | libcerror_error_set( |
422 | 0 | error, |
423 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
424 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
425 | 0 | "%s: invalid standard information values.", |
426 | 0 | function ); |
427 | |
|
428 | 0 | return( -1 ); |
429 | 0 | } |
430 | 129 | if( libfsntfs_mft_attribute_get_type( |
431 | 129 | mft_attribute, |
432 | 129 | &attribute_type, |
433 | 129 | error ) != 1 ) |
434 | 0 | { |
435 | 0 | libcerror_error_set( |
436 | 0 | error, |
437 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
438 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
439 | 0 | "%s: unable to retrieve type from attribute.", |
440 | 0 | function ); |
441 | |
|
442 | 0 | return( -1 ); |
443 | 0 | } |
444 | 129 | if( attribute_type != LIBFSNTFS_ATTRIBUTE_TYPE_STANDARD_INFORMATION ) |
445 | 0 | { |
446 | 0 | libcerror_error_set( |
447 | 0 | error, |
448 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
449 | 0 | LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, |
450 | 0 | "%s: unsupported attribute type.", |
451 | 0 | function ); |
452 | |
|
453 | 0 | return( -1 ); |
454 | 0 | } |
455 | 129 | result = libfsntfs_mft_attribute_data_is_resident( |
456 | 129 | mft_attribute, |
457 | 129 | error ); |
458 | | |
459 | 129 | if( result == -1 ) |
460 | 0 | { |
461 | 0 | libcerror_error_set( |
462 | 0 | error, |
463 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
464 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
465 | 0 | "%s: unable to determine if attribute data is resident.", |
466 | 0 | function ); |
467 | |
|
468 | 0 | return( -1 ); |
469 | 0 | } |
470 | 129 | else if( result == 0 ) |
471 | 1 | { |
472 | 1 | libcerror_error_set( |
473 | 1 | error, |
474 | 1 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
475 | 1 | LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, |
476 | 1 | "%s: unsupported non-resident attribute.", |
477 | 1 | function ); |
478 | | |
479 | 1 | return( 1 ); |
480 | 1 | } |
481 | 128 | if( libfsntfs_mft_attribute_get_resident_data( |
482 | 128 | mft_attribute, |
483 | 128 | &data, |
484 | 128 | &data_size, |
485 | 128 | error ) != 1 ) |
486 | 0 | { |
487 | 0 | libcerror_error_set( |
488 | 0 | error, |
489 | 0 | LIBCERROR_ERROR_DOMAIN_RUNTIME, |
490 | 0 | LIBCERROR_RUNTIME_ERROR_GET_FAILED, |
491 | 0 | "%s: unable to retrieve resident data from attribute.", |
492 | 0 | function ); |
493 | |
|
494 | 0 | return( -1 ); |
495 | 0 | } |
496 | 128 | if( libfsntfs_standard_information_values_read_data( |
497 | 128 | standard_information_values, |
498 | 128 | data, |
499 | 128 | data_size, |
500 | 128 | error ) != 1 ) |
501 | 12 | { |
502 | 12 | libcerror_error_set( |
503 | 12 | error, |
504 | 12 | LIBCERROR_ERROR_DOMAIN_IO, |
505 | 12 | LIBCERROR_IO_ERROR_READ_FAILED, |
506 | 12 | "%s: unable to read standard information values.", |
507 | 12 | function ); |
508 | | |
509 | 12 | return( -1 ); |
510 | 12 | } |
511 | 116 | return( 1 ); |
512 | 128 | } |
513 | | |
514 | | /* Retrieves the creation date and time |
515 | | * Returns 1 if successful or -1 on error |
516 | | */ |
517 | | int libfsntfs_standard_information_values_get_creation_time( |
518 | | libfsntfs_standard_information_values_t *standard_information_values, |
519 | | uint64_t *filetime, |
520 | | libcerror_error_t **error ) |
521 | 0 | { |
522 | 0 | static char *function = "libfsntfs_standard_information_values_get_creation_time"; |
523 | |
|
524 | 0 | if( standard_information_values == NULL ) |
525 | 0 | { |
526 | 0 | libcerror_error_set( |
527 | 0 | error, |
528 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
529 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
530 | 0 | "%s: invalid standard information values.", |
531 | 0 | function ); |
532 | |
|
533 | 0 | return( -1 ); |
534 | 0 | } |
535 | 0 | if( filetime == NULL ) |
536 | 0 | { |
537 | 0 | libcerror_error_set( |
538 | 0 | error, |
539 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
540 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
541 | 0 | "%s: invalid FILETIME.", |
542 | 0 | function ); |
543 | |
|
544 | 0 | return( -1 ); |
545 | 0 | } |
546 | 0 | *filetime = standard_information_values->creation_time; |
547 | |
|
548 | 0 | return( 1 ); |
549 | 0 | } |
550 | | |
551 | | /* Retrieves the (file) modification (last written) date and time |
552 | | * Returns 1 if successful or -1 on error |
553 | | */ |
554 | | int libfsntfs_standard_information_values_get_modification_time( |
555 | | libfsntfs_standard_information_values_t *standard_information_values, |
556 | | uint64_t *filetime, |
557 | | libcerror_error_t **error ) |
558 | 0 | { |
559 | 0 | static char *function = "libfsntfs_standard_information_values_get_modification_time"; |
560 | |
|
561 | 0 | if( standard_information_values == NULL ) |
562 | 0 | { |
563 | 0 | libcerror_error_set( |
564 | 0 | error, |
565 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
566 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
567 | 0 | "%s: invalid standard information values.", |
568 | 0 | function ); |
569 | |
|
570 | 0 | return( -1 ); |
571 | 0 | } |
572 | 0 | if( filetime == NULL ) |
573 | 0 | { |
574 | 0 | libcerror_error_set( |
575 | 0 | error, |
576 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
577 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
578 | 0 | "%s: invalid FILETIME.", |
579 | 0 | function ); |
580 | |
|
581 | 0 | return( -1 ); |
582 | 0 | } |
583 | 0 | *filetime = standard_information_values->modification_time; |
584 | |
|
585 | 0 | return( 1 ); |
586 | 0 | } |
587 | | |
588 | | /* Retrieves the access date and time |
589 | | * Returns 1 if successful or -1 on error |
590 | | */ |
591 | | int libfsntfs_standard_information_values_get_access_time( |
592 | | libfsntfs_standard_information_values_t *standard_information_values, |
593 | | uint64_t *filetime, |
594 | | libcerror_error_t **error ) |
595 | 0 | { |
596 | 0 | static char *function = "libfsntfs_standard_information_values_get_access_time"; |
597 | |
|
598 | 0 | if( standard_information_values == NULL ) |
599 | 0 | { |
600 | 0 | libcerror_error_set( |
601 | 0 | error, |
602 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
603 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
604 | 0 | "%s: invalid standard information values.", |
605 | 0 | function ); |
606 | |
|
607 | 0 | return( -1 ); |
608 | 0 | } |
609 | 0 | if( filetime == NULL ) |
610 | 0 | { |
611 | 0 | libcerror_error_set( |
612 | 0 | error, |
613 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
614 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
615 | 0 | "%s: invalid FILETIME.", |
616 | 0 | function ); |
617 | |
|
618 | 0 | return( -1 ); |
619 | 0 | } |
620 | 0 | *filetime = standard_information_values->access_time; |
621 | |
|
622 | 0 | return( 1 ); |
623 | 0 | } |
624 | | |
625 | | /* Retrieves the (file system entry) modification date and time |
626 | | * Returns 1 if successful or -1 on error |
627 | | */ |
628 | | int libfsntfs_standard_information_values_get_entry_modification_time( |
629 | | libfsntfs_standard_information_values_t *standard_information_values, |
630 | | uint64_t *filetime, |
631 | | libcerror_error_t **error ) |
632 | 0 | { |
633 | 0 | static char *function = "libfsntfs_standard_information_values_get_entry_modification_time"; |
634 | |
|
635 | 0 | if( standard_information_values == NULL ) |
636 | 0 | { |
637 | 0 | libcerror_error_set( |
638 | 0 | error, |
639 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
640 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
641 | 0 | "%s: invalid standard information values.", |
642 | 0 | function ); |
643 | |
|
644 | 0 | return( -1 ); |
645 | 0 | } |
646 | 0 | if( filetime == NULL ) |
647 | 0 | { |
648 | 0 | libcerror_error_set( |
649 | 0 | error, |
650 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
651 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
652 | 0 | "%s: invalid FILETIME.", |
653 | 0 | function ); |
654 | |
|
655 | 0 | return( -1 ); |
656 | 0 | } |
657 | 0 | *filetime = standard_information_values->entry_modification_time; |
658 | |
|
659 | 0 | return( 1 ); |
660 | 0 | } |
661 | | |
662 | | /* Retrieves the file attribute flags |
663 | | * Returns 1 if successful or -1 on error |
664 | | */ |
665 | | int libfsntfs_standard_information_values_get_file_attribute_flags( |
666 | | libfsntfs_standard_information_values_t *standard_information_values, |
667 | | uint32_t *file_attribute_flags, |
668 | | libcerror_error_t **error ) |
669 | 0 | { |
670 | 0 | static char *function = "libfsntfs_standard_information_values_get_file_attribute_flags"; |
671 | |
|
672 | 0 | if( standard_information_values == NULL ) |
673 | 0 | { |
674 | 0 | libcerror_error_set( |
675 | 0 | error, |
676 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
677 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
678 | 0 | "%s: invalid standard information values.", |
679 | 0 | function ); |
680 | |
|
681 | 0 | return( -1 ); |
682 | 0 | } |
683 | 0 | if( file_attribute_flags == NULL ) |
684 | 0 | { |
685 | 0 | libcerror_error_set( |
686 | 0 | error, |
687 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
688 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
689 | 0 | "%s: invalid file attribute flags.", |
690 | 0 | function ); |
691 | |
|
692 | 0 | return( -1 ); |
693 | 0 | } |
694 | 0 | *file_attribute_flags = standard_information_values->file_attribute_flags; |
695 | |
|
696 | 0 | return( 1 ); |
697 | 0 | } |
698 | | |
699 | | /* Retrieves the security descriptor identifier |
700 | | * Returns 1 if successful or -1 on error |
701 | | */ |
702 | | int libfsntfs_standard_information_values_get_security_descriptor_identifier( |
703 | | libfsntfs_standard_information_values_t *standard_information_values, |
704 | | uint32_t *security_descriptor_identifier, |
705 | | libcerror_error_t **error ) |
706 | 0 | { |
707 | 0 | static char *function = "libfsntfs_standard_information_values_get_security_descriptor_identifier"; |
708 | |
|
709 | 0 | if( standard_information_values == NULL ) |
710 | 0 | { |
711 | 0 | libcerror_error_set( |
712 | 0 | error, |
713 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
714 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
715 | 0 | "%s: invalid standard information values.", |
716 | 0 | function ); |
717 | |
|
718 | 0 | return( -1 ); |
719 | 0 | } |
720 | 0 | if( security_descriptor_identifier == NULL ) |
721 | 0 | { |
722 | 0 | libcerror_error_set( |
723 | 0 | error, |
724 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
725 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
726 | 0 | "%s: invalid security descriptor identifier.", |
727 | 0 | function ); |
728 | |
|
729 | 0 | return( -1 ); |
730 | 0 | } |
731 | 0 | *security_descriptor_identifier = standard_information_values->security_descriptor_identifier; |
732 | |
|
733 | 0 | return( 1 ); |
734 | 0 | } |
735 | | |
736 | | /* Retrieves the update sequence number |
737 | | * Returns 1 if successful or -1 on error |
738 | | */ |
739 | | int libfsntfs_standard_information_values_get_update_sequence_number( |
740 | | libfsntfs_standard_information_values_t *standard_information_values, |
741 | | uint64_t *update_sequence_number, |
742 | | libcerror_error_t **error ) |
743 | 0 | { |
744 | 0 | static char *function = "libfsntfs_standard_information_values_get_update_sequence_number"; |
745 | |
|
746 | 0 | if( standard_information_values == NULL ) |
747 | 0 | { |
748 | 0 | libcerror_error_set( |
749 | 0 | error, |
750 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
751 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
752 | 0 | "%s: invalid standard information values.", |
753 | 0 | function ); |
754 | |
|
755 | 0 | return( -1 ); |
756 | 0 | } |
757 | 0 | if( update_sequence_number == NULL ) |
758 | 0 | { |
759 | 0 | libcerror_error_set( |
760 | 0 | error, |
761 | 0 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, |
762 | 0 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, |
763 | 0 | "%s: invalid update sequence number.", |
764 | 0 | function ); |
765 | |
|
766 | 0 | return( -1 ); |
767 | 0 | } |
768 | 0 | *update_sequence_number = standard_information_values->update_sequence_number; |
769 | |
|
770 | 0 | return( 1 ); |
771 | 0 | } |
772 | | |