1 /*
2 * Python object definition of the libfsntfs standard information attribute
3 *
4 * Copyright (C) 2010-2021, 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 <types.h>
24
25 #if defined( HAVE_STDLIB_H ) || defined( HAVE_WINAPI )
26 #include <stdlib.h>
27 #endif
28
29 #include "pyfsntfs_attribute.h"
30 #include "pyfsntfs_datetime.h"
31 #include "pyfsntfs_error.h"
32 #include "pyfsntfs_integer.h"
33 #include "pyfsntfs_libcerror.h"
34 #include "pyfsntfs_libfsntfs.h"
35 #include "pyfsntfs_python.h"
36 #include "pyfsntfs_standard_information_attribute.h"
37 #include "pyfsntfs_unused.h"
38
39 PyMethodDef pyfsntfs_standard_information_attribute_object_methods[] = {
40
41 /* Functions to access the attribute values */
42
43 { "get_creation_time",
44 (PyCFunction) pyfsntfs_standard_information_attribute_get_creation_time,
45 METH_NOARGS,
46 "get_creation_time() -> Datetime or None\n"
47 "\n"
48 "Returns the creation date and time." },
49
50 { "get_creation_time_as_integer",
51 (PyCFunction) pyfsntfs_standard_information_attribute_get_creation_time_as_integer,
52 METH_NOARGS,
53 "get_creation_time_as_integer() -> Integer or None\n"
54 "\n"
55 "Returns the creation date and time as a 64-bit integer containing a FILETIME value." },
56
57 { "get_modification_time",
58 (PyCFunction) pyfsntfs_standard_information_attribute_get_modification_time,
59 METH_NOARGS,
60 "get_modification_time() -> Datetime or None\n"
61 "\n"
62 "Returns the modification date and time." },
63
64 { "get_modification_time_as_integer",
65 (PyCFunction) pyfsntfs_standard_information_attribute_get_modification_time_as_integer,
66 METH_NOARGS,
67 "get_modification_time_as_integer() -> Integer or None\n"
68 "\n"
69 "Returns the modification date and time as a 64-bit integer containing a FILETIME value." },
70
71 { "get_access_time",
72 (PyCFunction) pyfsntfs_standard_information_attribute_get_access_time,
73 METH_NOARGS,
74 "get_access_time() -> Datetime or None\n"
75 "\n"
76 "Returns the access date and time." },
77
78 { "get_access_time_as_integer",
79 (PyCFunction) pyfsntfs_standard_information_attribute_get_access_time_as_integer,
80 METH_NOARGS,
81 "get_access_time_as_integer() -> Integer or None\n"
82 "\n"
83 "Returns the access date and time as a 64-bit integer containing a FILETIME value." },
84
85 { "get_entry_modification_time",
86 (PyCFunction) pyfsntfs_standard_information_attribute_get_entry_modification_time,
87 METH_NOARGS,
88 "get_entry_modification_time() -> Datetime or None\n"
89 "\n"
90 "Returns the entry modification date and time." },
91
92 { "get_entry_modification_time_as_integer",
93 (PyCFunction) pyfsntfs_standard_information_attribute_get_entry_modification_time_as_integer,
94 METH_NOARGS,
95 "get_entry_modification_time_as_integer() -> Integer or None\n"
96 "\n"
97 "Returns the entry modification date and time as a 64-bit integer containing a FILETIME value." },
98
99 { "get_file_attribute_flags",
100 (PyCFunction) pyfsntfs_standard_information_attribute_get_file_attribute_flags,
101 METH_NOARGS,
102 "get_file_attribute_flags() -> Integer\n"
103 "\n"
104 "Returns the file attribute flags." },
105
106 { "get_owner_identifier",
107 (PyCFunction) pyfsntfs_standard_information_attribute_get_owner_identifier,
108 METH_NOARGS,
109 "get_owner_identifier() -> Integer\n"
110 "\n"
111 "Returns the owner identifier." },
112
113 { "get_security_descriptor_identifier",
114 (PyCFunction) pyfsntfs_standard_information_attribute_get_security_descriptor_identifier,
115 METH_NOARGS,
116 "get_security_descriptor_identifier() -> Integer\n"
117 "\n"
118 "Returns the security descriptor identifier." },
119
120 { "get_update_sequence_number",
121 (PyCFunction) pyfsntfs_standard_information_attribute_get_update_sequence_number,
122 METH_NOARGS,
123 "get_update_sequence_number() -> Integer\n"
124 "\n"
125 "Returns the update sequence number." },
126
127 /* Sentinel */
128 { NULL, NULL, 0, NULL }
129 };
130
131 PyGetSetDef pyfsntfs_standard_information_attribute_object_get_set_definitions[] = {
132
133 { "creation_time",
134 (getter) pyfsntfs_standard_information_attribute_get_creation_time,
135 (setter) 0,
136 "The creation date and time.",
137 NULL },
138
139 { "modification_time",
140 (getter) pyfsntfs_standard_information_attribute_get_modification_time,
141 (setter) 0,
142 "The modification date and time.",
143 NULL },
144
145 { "access_time",
146 (getter) pyfsntfs_standard_information_attribute_get_access_time,
147 (setter) 0,
148 "The access date and time.",
149 NULL },
150
151 { "entry_modification_time",
152 (getter) pyfsntfs_standard_information_attribute_get_entry_modification_time,
153 (setter) 0,
154 "The entry modification date and time.",
155 NULL },
156
157 { "file_attribute_flags",
158 (getter) pyfsntfs_standard_information_attribute_get_file_attribute_flags,
159 (setter) 0,
160 "The file attribute flags.",
161 NULL },
162
163 { "owner_identifier",
164 (getter) pyfsntfs_standard_information_attribute_get_owner_identifier,
165 (setter) 0,
166 "The owner identifier.",
167 NULL },
168
169 { "security_descriptor_identifier",
170 (getter) pyfsntfs_standard_information_attribute_get_security_descriptor_identifier,
171 (setter) 0,
172 "The security descriptor identifier.",
173 NULL },
174
175 { "update_sequence_number",
176 (getter) pyfsntfs_standard_information_attribute_get_update_sequence_number,
177 (setter) 0,
178 "The update sequence number.",
179 NULL },
180
181 /* Sentinel */
182 { NULL, NULL, NULL, NULL, NULL }
183 };
184
185 PyTypeObject pyfsntfs_standard_information_attribute_type_object = {
186 PyVarObject_HEAD_INIT( NULL, 0 )
187
188 /* tp_name */
189 "pyfsntfs.standard_information_attribute",
190 /* tp_basicsize */
191 sizeof( pyfsntfs_attribute_t ),
192 /* tp_itemsize */
193 0,
194 /* tp_dealloc */
195 0,
196 /* tp_print */
197 0,
198 /* tp_getattr */
199 0,
200 /* tp_setattr */
201 0,
202 /* tp_compare */
203 0,
204 /* tp_repr */
205 0,
206 /* tp_as_number */
207 0,
208 /* tp_as_sequence */
209 0,
210 /* tp_as_mapping */
211 0,
212 /* tp_hash */
213 0,
214 /* tp_call */
215 0,
216 /* tp_str */
217 0,
218 /* tp_getattro */
219 0,
220 /* tp_setattro */
221 0,
222 /* tp_as_buffer */
223 0,
224 /* tp_flags */
225 Py_TPFLAGS_DEFAULT,
226 /* tp_doc */
227 "pyfsntfs standard information attribute object (wraps libfsntfs_attribute_t type LIBFSNTFS_ATTRIBUTE_TYPE_STANDARD_INFORMATION)",
228 /* tp_traverse */
229 0,
230 /* tp_clear */
231 0,
232 /* tp_richcompare */
233 0,
234 /* tp_weaklistoffset */
235 0,
236 /* tp_iter */
237 0,
238 /* tp_iternext */
239 0,
240 /* tp_methods */
241 pyfsntfs_standard_information_attribute_object_methods,
242 /* tp_members */
243 0,
244 /* tp_getset */
245 pyfsntfs_standard_information_attribute_object_get_set_definitions,
246 /* tp_base */
247 &pyfsntfs_attribute_type_object,
248 /* tp_dict */
249 0,
250 /* tp_descr_get */
251 0,
252 /* tp_descr_set */
253 0,
254 /* tp_dictoffset */
255 0,
256 /* tp_init */
257 0,
258 /* tp_alloc */
259 0,
260 /* tp_new */
261 0,
262 /* tp_free */
263 0,
264 /* tp_is_gc */
265 0,
266 /* tp_bases */
267 NULL,
268 /* tp_mro */
269 NULL,
270 /* tp_cache */
271 NULL,
272 /* tp_subclasses */
273 NULL,
274 /* tp_weaklist */
275 NULL,
276 /* tp_del */
277 0
278 };
279
280 /* Retrieves the creation date and time
281 * Returns a Python object if successful or NULL on error
282 */
pyfsntfs_standard_information_attribute_get_creation_time(pyfsntfs_attribute_t * pyfsntfs_attribute,PyObject * arguments PYFSNTFS_ATTRIBUTE_UNUSED)283 PyObject *pyfsntfs_standard_information_attribute_get_creation_time(
284 pyfsntfs_attribute_t *pyfsntfs_attribute,
285 PyObject *arguments PYFSNTFS_ATTRIBUTE_UNUSED )
286 {
287 libcerror_error_t *error = NULL;
288 PyObject *date_time_object = NULL;
289 static char *function = "pyfsntfs_standard_information_attribute_get_creation_time";
290 uint64_t filetime = 0;
291 int result = 0;
292
293 PYFSNTFS_UNREFERENCED_PARAMETER( arguments )
294
295 if( pyfsntfs_attribute == NULL )
296 {
297 PyErr_Format(
298 PyExc_ValueError,
299 "%s: invalid attribute.",
300 function );
301
302 return( NULL );
303 }
304 Py_BEGIN_ALLOW_THREADS
305
306 result = libfsntfs_standard_information_attribute_get_creation_time(
307 pyfsntfs_attribute->attribute,
308 &filetime,
309 &error );
310
311 Py_END_ALLOW_THREADS
312
313 if( result == -1 )
314 {
315 pyfsntfs_error_raise(
316 error,
317 PyExc_IOError,
318 "%s: unable to retrieve creation time.",
319 function );
320
321 libcerror_error_free(
322 &error );
323
324 return( NULL );
325 }
326 else if( result == 0 )
327 {
328 Py_IncRef(
329 Py_None );
330
331 return( Py_None );
332 }
333 date_time_object = pyfsntfs_datetime_new_from_filetime(
334 filetime );
335
336 return( date_time_object );
337 }
338
339 /* Retrieves the creation date and time as an integer
340 * Returns a Python object if successful or NULL on error
341 */
pyfsntfs_standard_information_attribute_get_creation_time_as_integer(pyfsntfs_attribute_t * pyfsntfs_attribute,PyObject * arguments PYFSNTFS_ATTRIBUTE_UNUSED)342 PyObject *pyfsntfs_standard_information_attribute_get_creation_time_as_integer(
343 pyfsntfs_attribute_t *pyfsntfs_attribute,
344 PyObject *arguments PYFSNTFS_ATTRIBUTE_UNUSED )
345 {
346 libcerror_error_t *error = NULL;
347 PyObject *integer_object = NULL;
348 static char *function = "pyfsntfs_standard_information_attribute_get_creation_time_as_integer";
349 uint64_t filetime = 0;
350 int result = 0;
351
352 PYFSNTFS_UNREFERENCED_PARAMETER( arguments )
353
354 if( pyfsntfs_attribute == NULL )
355 {
356 PyErr_Format(
357 PyExc_ValueError,
358 "%s: invalid attribute.",
359 function );
360
361 return( NULL );
362 }
363 Py_BEGIN_ALLOW_THREADS
364
365 result = libfsntfs_standard_information_attribute_get_creation_time(
366 pyfsntfs_attribute->attribute,
367 &filetime,
368 &error );
369
370 Py_END_ALLOW_THREADS
371
372 if( result == -1 )
373 {
374 pyfsntfs_error_raise(
375 error,
376 PyExc_IOError,
377 "%s: unable to retrieve creation time.",
378 function );
379
380 libcerror_error_free(
381 &error );
382
383 return( NULL );
384 }
385 else if( result == 0 )
386 {
387 Py_IncRef(
388 Py_None );
389
390 return( Py_None );
391 }
392 integer_object = pyfsntfs_integer_unsigned_new_from_64bit(
393 filetime );
394
395 return( integer_object );
396 }
397
398 /* Retrieves the modification date and time
399 * Returns a Python object if successful or NULL on error
400 */
pyfsntfs_standard_information_attribute_get_modification_time(pyfsntfs_attribute_t * pyfsntfs_attribute,PyObject * arguments PYFSNTFS_ATTRIBUTE_UNUSED)401 PyObject *pyfsntfs_standard_information_attribute_get_modification_time(
402 pyfsntfs_attribute_t *pyfsntfs_attribute,
403 PyObject *arguments PYFSNTFS_ATTRIBUTE_UNUSED )
404 {
405 libcerror_error_t *error = NULL;
406 PyObject *date_time_object = NULL;
407 static char *function = "pyfsntfs_standard_information_attribute_get_modification_time";
408 uint64_t filetime = 0;
409 int result = 0;
410
411 PYFSNTFS_UNREFERENCED_PARAMETER( arguments )
412
413 if( pyfsntfs_attribute == NULL )
414 {
415 PyErr_Format(
416 PyExc_ValueError,
417 "%s: invalid attribute.",
418 function );
419
420 return( NULL );
421 }
422 Py_BEGIN_ALLOW_THREADS
423
424 result = libfsntfs_standard_information_attribute_get_modification_time(
425 pyfsntfs_attribute->attribute,
426 &filetime,
427 &error );
428
429 Py_END_ALLOW_THREADS
430
431 if( result == -1 )
432 {
433 pyfsntfs_error_raise(
434 error,
435 PyExc_IOError,
436 "%s: unable to retrieve modification time.",
437 function );
438
439 libcerror_error_free(
440 &error );
441
442 return( NULL );
443 }
444 else if( result == 0 )
445 {
446 Py_IncRef(
447 Py_None );
448
449 return( Py_None );
450 }
451 date_time_object = pyfsntfs_datetime_new_from_filetime(
452 filetime );
453
454 return( date_time_object );
455 }
456
457 /* Retrieves the modification date and time as an integer
458 * Returns a Python object if successful or NULL on error
459 */
pyfsntfs_standard_information_attribute_get_modification_time_as_integer(pyfsntfs_attribute_t * pyfsntfs_attribute,PyObject * arguments PYFSNTFS_ATTRIBUTE_UNUSED)460 PyObject *pyfsntfs_standard_information_attribute_get_modification_time_as_integer(
461 pyfsntfs_attribute_t *pyfsntfs_attribute,
462 PyObject *arguments PYFSNTFS_ATTRIBUTE_UNUSED )
463 {
464 libcerror_error_t *error = NULL;
465 PyObject *integer_object = NULL;
466 static char *function = "pyfsntfs_standard_information_attribute_get_modification_time_as_integer";
467 uint64_t filetime = 0;
468 int result = 0;
469
470 PYFSNTFS_UNREFERENCED_PARAMETER( arguments )
471
472 if( pyfsntfs_attribute == NULL )
473 {
474 PyErr_Format(
475 PyExc_ValueError,
476 "%s: invalid attribute.",
477 function );
478
479 return( NULL );
480 }
481 Py_BEGIN_ALLOW_THREADS
482
483 result = libfsntfs_standard_information_attribute_get_modification_time(
484 pyfsntfs_attribute->attribute,
485 &filetime,
486 &error );
487
488 Py_END_ALLOW_THREADS
489
490 if( result == -1 )
491 {
492 pyfsntfs_error_raise(
493 error,
494 PyExc_IOError,
495 "%s: unable to retrieve modification time.",
496 function );
497
498 libcerror_error_free(
499 &error );
500
501 return( NULL );
502 }
503 else if( result == 0 )
504 {
505 Py_IncRef(
506 Py_None );
507
508 return( Py_None );
509 }
510 integer_object = pyfsntfs_integer_unsigned_new_from_64bit(
511 filetime );
512
513 return( integer_object );
514 }
515
516 /* Retrieves the access date and time
517 * Returns a Python object if successful or NULL on error
518 */
pyfsntfs_standard_information_attribute_get_access_time(pyfsntfs_attribute_t * pyfsntfs_attribute,PyObject * arguments PYFSNTFS_ATTRIBUTE_UNUSED)519 PyObject *pyfsntfs_standard_information_attribute_get_access_time(
520 pyfsntfs_attribute_t *pyfsntfs_attribute,
521 PyObject *arguments PYFSNTFS_ATTRIBUTE_UNUSED )
522 {
523 libcerror_error_t *error = NULL;
524 PyObject *date_time_object = NULL;
525 static char *function = "pyfsntfs_standard_information_attribute_get_access_time";
526 uint64_t filetime = 0;
527 int result = 0;
528
529 PYFSNTFS_UNREFERENCED_PARAMETER( arguments )
530
531 if( pyfsntfs_attribute == NULL )
532 {
533 PyErr_Format(
534 PyExc_ValueError,
535 "%s: invalid attribute.",
536 function );
537
538 return( NULL );
539 }
540 Py_BEGIN_ALLOW_THREADS
541
542 result = libfsntfs_standard_information_attribute_get_access_time(
543 pyfsntfs_attribute->attribute,
544 &filetime,
545 &error );
546
547 Py_END_ALLOW_THREADS
548
549 if( result == -1 )
550 {
551 pyfsntfs_error_raise(
552 error,
553 PyExc_IOError,
554 "%s: unable to retrieve access time.",
555 function );
556
557 libcerror_error_free(
558 &error );
559
560 return( NULL );
561 }
562 else if( result == 0 )
563 {
564 Py_IncRef(
565 Py_None );
566
567 return( Py_None );
568 }
569 date_time_object = pyfsntfs_datetime_new_from_filetime(
570 filetime );
571
572 return( date_time_object );
573 }
574
575 /* Retrieves the access date and time as an integer
576 * Returns a Python object if successful or NULL on error
577 */
pyfsntfs_standard_information_attribute_get_access_time_as_integer(pyfsntfs_attribute_t * pyfsntfs_attribute,PyObject * arguments PYFSNTFS_ATTRIBUTE_UNUSED)578 PyObject *pyfsntfs_standard_information_attribute_get_access_time_as_integer(
579 pyfsntfs_attribute_t *pyfsntfs_attribute,
580 PyObject *arguments PYFSNTFS_ATTRIBUTE_UNUSED )
581 {
582 libcerror_error_t *error = NULL;
583 PyObject *integer_object = NULL;
584 static char *function = "pyfsntfs_standard_information_attribute_get_access_time_as_integer";
585 uint64_t filetime = 0;
586 int result = 0;
587
588 PYFSNTFS_UNREFERENCED_PARAMETER( arguments )
589
590 if( pyfsntfs_attribute == NULL )
591 {
592 PyErr_Format(
593 PyExc_ValueError,
594 "%s: invalid attribute.",
595 function );
596
597 return( NULL );
598 }
599 Py_BEGIN_ALLOW_THREADS
600
601 result = libfsntfs_standard_information_attribute_get_access_time(
602 pyfsntfs_attribute->attribute,
603 &filetime,
604 &error );
605
606 Py_END_ALLOW_THREADS
607
608 if( result == -1 )
609 {
610 pyfsntfs_error_raise(
611 error,
612 PyExc_IOError,
613 "%s: unable to retrieve access time.",
614 function );
615
616 libcerror_error_free(
617 &error );
618
619 return( NULL );
620 }
621 else if( result == 0 )
622 {
623 Py_IncRef(
624 Py_None );
625
626 return( Py_None );
627 }
628 integer_object = pyfsntfs_integer_unsigned_new_from_64bit(
629 filetime );
630
631 return( integer_object );
632 }
633
634 /* Retrieves the entry modification date and time
635 * Returns a Python object if successful or NULL on error
636 */
pyfsntfs_standard_information_attribute_get_entry_modification_time(pyfsntfs_attribute_t * pyfsntfs_attribute,PyObject * arguments PYFSNTFS_ATTRIBUTE_UNUSED)637 PyObject *pyfsntfs_standard_information_attribute_get_entry_modification_time(
638 pyfsntfs_attribute_t *pyfsntfs_attribute,
639 PyObject *arguments PYFSNTFS_ATTRIBUTE_UNUSED )
640 {
641 libcerror_error_t *error = NULL;
642 PyObject *date_time_object = NULL;
643 static char *function = "pyfsntfs_standard_information_attribute_get_entry_modification_time";
644 uint64_t filetime = 0;
645 int result = 0;
646
647 PYFSNTFS_UNREFERENCED_PARAMETER( arguments )
648
649 if( pyfsntfs_attribute == NULL )
650 {
651 PyErr_Format(
652 PyExc_ValueError,
653 "%s: invalid attribute.",
654 function );
655
656 return( NULL );
657 }
658 Py_BEGIN_ALLOW_THREADS
659
660 result = libfsntfs_standard_information_attribute_get_entry_modification_time(
661 pyfsntfs_attribute->attribute,
662 &filetime,
663 &error );
664
665 Py_END_ALLOW_THREADS
666
667 if( result == -1 )
668 {
669 pyfsntfs_error_raise(
670 error,
671 PyExc_IOError,
672 "%s: unable to retrieve entry modification time.",
673 function );
674
675 libcerror_error_free(
676 &error );
677
678 return( NULL );
679 }
680 else if( result == 0 )
681 {
682 Py_IncRef(
683 Py_None );
684
685 return( Py_None );
686 }
687 date_time_object = pyfsntfs_datetime_new_from_filetime(
688 filetime );
689
690 return( date_time_object );
691 }
692
693 /* Retrieves the entry modification date and time as an integer
694 * Returns a Python object if successful or NULL on error
695 */
pyfsntfs_standard_information_attribute_get_entry_modification_time_as_integer(pyfsntfs_attribute_t * pyfsntfs_attribute,PyObject * arguments PYFSNTFS_ATTRIBUTE_UNUSED)696 PyObject *pyfsntfs_standard_information_attribute_get_entry_modification_time_as_integer(
697 pyfsntfs_attribute_t *pyfsntfs_attribute,
698 PyObject *arguments PYFSNTFS_ATTRIBUTE_UNUSED )
699 {
700 libcerror_error_t *error = NULL;
701 PyObject *integer_object = NULL;
702 static char *function = "pyfsntfs_standard_information_attribute_get_entry_modification_time_as_integer";
703 uint64_t filetime = 0;
704 int result = 0;
705
706 PYFSNTFS_UNREFERENCED_PARAMETER( arguments )
707
708 if( pyfsntfs_attribute == NULL )
709 {
710 PyErr_Format(
711 PyExc_ValueError,
712 "%s: invalid attribute.",
713 function );
714
715 return( NULL );
716 }
717 Py_BEGIN_ALLOW_THREADS
718
719 result = libfsntfs_standard_information_attribute_get_entry_modification_time(
720 pyfsntfs_attribute->attribute,
721 &filetime,
722 &error );
723
724 Py_END_ALLOW_THREADS
725
726 if( result == -1 )
727 {
728 pyfsntfs_error_raise(
729 error,
730 PyExc_IOError,
731 "%s: unable to retrieve entry modification time.",
732 function );
733
734 libcerror_error_free(
735 &error );
736
737 return( NULL );
738 }
739 else if( result == 0 )
740 {
741 Py_IncRef(
742 Py_None );
743
744 return( Py_None );
745 }
746 integer_object = pyfsntfs_integer_signed_new_from_64bit(
747 filetime );
748
749 return( integer_object );
750 }
751
752 /* Retrieves the file attribute flags
753 * Returns a Python object if successful or NULL on error
754 */
pyfsntfs_standard_information_attribute_get_file_attribute_flags(pyfsntfs_attribute_t * pyfsntfs_attribute,PyObject * arguments PYFSNTFS_ATTRIBUTE_UNUSED)755 PyObject *pyfsntfs_standard_information_attribute_get_file_attribute_flags(
756 pyfsntfs_attribute_t *pyfsntfs_attribute,
757 PyObject *arguments PYFSNTFS_ATTRIBUTE_UNUSED )
758 {
759 libcerror_error_t *error = NULL;
760 PyObject *integer_object = NULL;
761 static char *function = "pyfsntfs_standard_information_attribute_get_file_attribute_flags";
762 uint32_t file_attribute_flags = 0;
763 int result = 0;
764
765 PYFSNTFS_UNREFERENCED_PARAMETER( arguments )
766
767 if( pyfsntfs_attribute == NULL )
768 {
769 PyErr_Format(
770 PyExc_TypeError,
771 "%s: invalid attribute.",
772 function );
773
774 return( NULL );
775 }
776 Py_BEGIN_ALLOW_THREADS
777
778 result = libfsntfs_standard_information_attribute_get_file_attribute_flags(
779 pyfsntfs_attribute->attribute,
780 &file_attribute_flags,
781 &error );
782
783 Py_END_ALLOW_THREADS
784
785 if( result != 1 )
786 {
787 pyfsntfs_error_raise(
788 error,
789 PyExc_IOError,
790 "%s: unable to retrieve file attribute flags.",
791 function );
792
793 libcerror_error_free(
794 &error );
795
796 return( NULL );
797 }
798 integer_object = pyfsntfs_integer_unsigned_new_from_64bit(
799 (uint64_t) file_attribute_flags );
800
801 return( integer_object );
802 }
803
804 /* Retrieves the owner identifier
805 * Returns a Python object if successful or NULL on error
806 */
pyfsntfs_standard_information_attribute_get_owner_identifier(pyfsntfs_attribute_t * pyfsntfs_attribute,PyObject * arguments PYFSNTFS_ATTRIBUTE_UNUSED)807 PyObject *pyfsntfs_standard_information_attribute_get_owner_identifier(
808 pyfsntfs_attribute_t *pyfsntfs_attribute,
809 PyObject *arguments PYFSNTFS_ATTRIBUTE_UNUSED )
810 {
811 libcerror_error_t *error = NULL;
812 PyObject *integer_object = NULL;
813 static char *function = "pyfsntfs_standard_information_attribute_get_owner_identifier";
814 uint32_t owner_identifier = 0;
815 int result = 0;
816
817 PYFSNTFS_UNREFERENCED_PARAMETER( arguments )
818
819 if( pyfsntfs_attribute == NULL )
820 {
821 PyErr_Format(
822 PyExc_TypeError,
823 "%s: invalid attribute.",
824 function );
825
826 return( NULL );
827 }
828 Py_BEGIN_ALLOW_THREADS
829
830 result = libfsntfs_standard_information_attribute_get_owner_identifier(
831 pyfsntfs_attribute->attribute,
832 &owner_identifier,
833 &error );
834
835 Py_END_ALLOW_THREADS
836
837 if( result != 1 )
838 {
839 pyfsntfs_error_raise(
840 error,
841 PyExc_IOError,
842 "%s: unable to retrieve owner identifier.",
843 function );
844
845 libcerror_error_free(
846 &error );
847
848 return( NULL );
849 }
850 integer_object = pyfsntfs_integer_unsigned_new_from_64bit(
851 (uint64_t) owner_identifier );
852
853 return( integer_object );
854 }
855
856 /* Retrieves the security identifier
857 * Returns a Python object if successful or NULL on error
858 */
pyfsntfs_standard_information_attribute_get_security_descriptor_identifier(pyfsntfs_attribute_t * pyfsntfs_attribute,PyObject * arguments PYFSNTFS_ATTRIBUTE_UNUSED)859 PyObject *pyfsntfs_standard_information_attribute_get_security_descriptor_identifier(
860 pyfsntfs_attribute_t *pyfsntfs_attribute,
861 PyObject *arguments PYFSNTFS_ATTRIBUTE_UNUSED )
862 {
863 libcerror_error_t *error = NULL;
864 PyObject *integer_object = NULL;
865 static char *function = "pyfsntfs_standard_information_attribute_get_security_descriptor_identifier";
866 uint32_t security_descriptor_identifier = 0;
867 int result = 0;
868
869 PYFSNTFS_UNREFERENCED_PARAMETER( arguments )
870
871 if( pyfsntfs_attribute == NULL )
872 {
873 PyErr_Format(
874 PyExc_TypeError,
875 "%s: invalid attribute.",
876 function );
877
878 return( NULL );
879 }
880 Py_BEGIN_ALLOW_THREADS
881
882 result = libfsntfs_standard_information_attribute_get_security_descriptor_identifier(
883 pyfsntfs_attribute->attribute,
884 &security_descriptor_identifier,
885 &error );
886
887 Py_END_ALLOW_THREADS
888
889 if( result != 1 )
890 {
891 pyfsntfs_error_raise(
892 error,
893 PyExc_IOError,
894 "%s: unable to retrieve security descriptor identifier.",
895 function );
896
897 libcerror_error_free(
898 &error );
899
900 return( NULL );
901 }
902 integer_object = pyfsntfs_integer_unsigned_new_from_64bit(
903 (uint64_t) security_descriptor_identifier );
904
905 return( integer_object );
906 }
907
908 /* Retrieves the update sequence number
909 * Returns a Python object if successful or NULL on error
910 */
pyfsntfs_standard_information_attribute_get_update_sequence_number(pyfsntfs_attribute_t * pyfsntfs_attribute,PyObject * arguments PYFSNTFS_ATTRIBUTE_UNUSED)911 PyObject *pyfsntfs_standard_information_attribute_get_update_sequence_number(
912 pyfsntfs_attribute_t *pyfsntfs_attribute,
913 PyObject *arguments PYFSNTFS_ATTRIBUTE_UNUSED )
914 {
915 libcerror_error_t *error = NULL;
916 PyObject *integer_object = NULL;
917 static char *function = "pyfsntfs_standard_information_attribute_get_update_sequence_number";
918 uint64_t update_sequence_number = 0;
919 int result = 0;
920
921 PYFSNTFS_UNREFERENCED_PARAMETER( arguments )
922
923 if( pyfsntfs_attribute == NULL )
924 {
925 PyErr_Format(
926 PyExc_TypeError,
927 "%s: invalid attribute.",
928 function );
929
930 return( NULL );
931 }
932 Py_BEGIN_ALLOW_THREADS
933
934 result = libfsntfs_standard_information_attribute_get_update_sequence_number(
935 pyfsntfs_attribute->attribute,
936 &update_sequence_number,
937 &error );
938
939 Py_END_ALLOW_THREADS
940
941 if( result != 1 )
942 {
943 pyfsntfs_error_raise(
944 error,
945 PyExc_IOError,
946 "%s: unable to retrieve update sequence number.",
947 function );
948
949 libcerror_error_free(
950 &error );
951
952 return( NULL );
953 }
954 integer_object = pyfsntfs_integer_unsigned_new_from_64bit(
955 update_sequence_number );
956
957 return( integer_object );
958 }
959
960