Exemplo n.º 1
0
    def testReadFileHeader(self):
        """Tests the _ReadFileHeader function."""
        output_writer = test_lib.TestOutputWriter()
        test_file = wmi_repository.MappingFile(output_writer=output_writer)

        test_file_path = self._GetTestFilePath(['cim', 'INDEX.MAP'])
        with open(test_file_path, 'rb') as file_object:
            test_file._ReadFileHeader(file_object)
Exemplo n.º 2
0
    def testDebugPrintFileFooter(self):
        """Tests the _DebugPrintFileFooter function."""
        output_writer = test_lib.TestOutputWriter()
        test_file = wmi_repository.MappingFile(output_writer=output_writer)

        data_type_map = test_file._FILE_FOOTER
        file_footer = data_type_map.CreateStructureValues(signature=0x0000dcba)

        test_file._DebugPrintFileFooter(file_footer)
Exemplo n.º 3
0
    def testReadFileObject(self):
        """Tests the ReadFileObject."""
        output_writer = test_lib.TestOutputWriter()
        test_file = wmi_repository.MappingFile(output_writer=output_writer)

        test_file_path = self._GetTestFilePath(['cim', 'INDEX.MAP'])
        test_file.Open(test_file_path)

        test_file.Close()
Exemplo n.º 4
0
    def testReadUnknownEntries(self):
        """Tests the _ReadUnknownEntries function."""
        output_writer = test_lib.TestOutputWriter()
        test_file = wmi_repository.MappingFile(output_writer=output_writer)

        test_file_path = self._GetTestFilePath(['cim', 'INDEX.MAP'])
        with open(test_file_path, 'rb') as file_object:
            file_object.seek(572, os.SEEK_SET)

            test_file._ReadUnknownEntries(file_object)
Exemplo n.º 5
0
    def testReadPageNumbersTable(self):
        """Tests the _ReadPageNumbersTable function."""
        output_writer = test_lib.TestOutputWriter()
        test_file = wmi_repository.MappingFile(output_writer=output_writer)

        test_file_path = self._GetTestFilePath(['cim', 'INDEX.MAP'])
        with open(test_file_path, 'rb') as file_object:
            file_offset = test_file._FILE_HEADER_SIZE
            test_file._ReadPageNumbersTable(file_object, file_offset,
                                            'mappings')
Exemplo n.º 6
0
    def testDebugPrintFileHeader(self):
        """Tests the _DebugPrintFileHeader function."""
        output_writer = test_lib.TestOutputWriter()
        test_file = wmi_repository.MappingFile(output_writer=output_writer)

        data_type_map = test_file._FILE_HEADER
        file_header = data_type_map.CreateStructureValues(format_version=1,
                                                          number_of_pages=2,
                                                          signature=0x0000abcd)

        test_file._DebugPrintFileHeader(file_header)
Exemplo n.º 7
0
    def testDebugPrintPageNumber(self):
        """Tests the _DebugPrintPageNumber function."""
        output_writer = test_lib.TestOutputWriter()
        test_file = wmi_repository.MappingFile(output_writer=output_writer)

        test_file._DebugPrintPageNumber('Page number', 0x00000001)

        test_file._DebugPrintPageNumber('Page number',
                                        0xffffffff,
                                        unavailable_page_numbers=set(
                                            [0xffffffff]))
Exemplo n.º 8
0
    def testReadFileObject(self):
        """Tests the ReadFileObject."""
        test_file_path = self._GetTestFilePath(['cim', 'OBJECTS.MAP'])
        mapping_file = wmi_repository.MappingFile(test_file_path)

        output_writer = test_lib.TestOutputWriter()
        test_file = wmi_repository.ObjectsDataFile(mapping_file,
                                                   output_writer=output_writer)

        test_file_path = self._GetTestFilePath(['cim', 'OBJECTS.DATA'])
        test_file.Open(test_file_path)
Exemplo n.º 9
0
    def testReadMappings(self):
        """Tests the _ReadMappings function."""
        output_writer = test_lib.TestOutputWriter()
        test_file = wmi_repository.MappingFile(output_writer=output_writer)

        test_file_path = self._GetTestFilePath(['cim', 'INDEX.MAP'])
        with open(test_file_path, 'rb') as file_object:
            file_offset = test_file._FILE_HEADER_SIZE
            file_object.seek(file_offset, os.SEEK_SET)

            test_file._ReadMappings(file_object)