Apply structure format to raw data. Returns an unpacked structure object if successful, None otherwise.
(self, format, data, file_offset)
| 2798 | del self.__data__ |
| 2799 | |
| 2800 | def __unpack_data__(self, format, data, file_offset): |
| 2801 | """Apply structure format to raw data. |
| 2802 | |
| 2803 | Returns an unpacked structure object if successful, None otherwise. |
| 2804 | """ |
| 2805 | |
| 2806 | structure = Structure(format, file_offset=file_offset) |
| 2807 | |
| 2808 | try: |
| 2809 | structure.__unpack__(data) |
| 2810 | except PEFormatError as err: |
| 2811 | self.__warnings.append( |
| 2812 | 'Corrupt header "{0}" at file offset {1}. Exception: {2}'.format( |
| 2813 | format[0], file_offset, err |
| 2814 | ) |
| 2815 | ) |
| 2816 | return None |
| 2817 | |
| 2818 | self.__structures__.append(structure) |
| 2819 | |
| 2820 | return structure |
| 2821 | |
| 2822 | def __parse__(self, fname, data, fast_load): |
| 2823 | """Parse a Portable Executable file. |
no test coverage detected