getEntryNameString(const coff_resource_dir_entry &Entry);
Expected<const coff_resource_dir_table &>
getEntrySubDir(const coff_resource_dir_entry &Entry);
+ Expected<const coff_resource_data_entry &>
+ getEntryData(const coff_resource_dir_entry &Entry);
Expected<const coff_resource_dir_table &> getBaseTable();
Expected<const coff_resource_dir_entry &>
getTableEntry(const coff_resource_dir_table &Table, uint32_t Index);
Expected<const coff_resource_dir_table &> getTableAtOffset(uint32_t Offset);
Expected<const coff_resource_dir_entry &>
getTableEntryAtOffset(uint32_t Offset);
+ Expected<const coff_resource_data_entry &>
+ getDataEntryAtOffset(uint32_t Offset);
Expected<ArrayRef<UTF16>> getDirStringAtOffset(uint32_t Offset);
};
return *Entry;
}
+Expected<const coff_resource_data_entry &>
+ResourceSectionRef::getDataEntryAtOffset(uint32_t Offset) {
+ const coff_resource_data_entry *Entry = nullptr;
+
+ BinaryStreamReader Reader(BBS);
+ Reader.setOffset(Offset);
+ RETURN_IF_ERROR(Reader.readObject(Entry));
+ assert(Entry != nullptr);
+ return *Entry;
+}
+
Expected<const coff_resource_dir_table &>
ResourceSectionRef::getEntrySubDir(const coff_resource_dir_entry &Entry) {
+ assert(Entry.Offset.isSubDir());
return getTableAtOffset(Entry.Offset.value());
}
+Expected<const coff_resource_data_entry &>
+ResourceSectionRef::getEntryData(const coff_resource_dir_entry &Entry) {
+ assert(!Entry.Offset.isSubDir());
+ return getDataEntryAtOffset(Entry.Offset.value());
+}
+
Expected<const coff_resource_dir_table &> ResourceSectionRef::getBaseTable() {
return getTableAtOffset(0);
}
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 57
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 808
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Name: OKAY [
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 808
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 48
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Name: (ID 14432) [
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 46
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 108
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 24
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Language: (ID 2052) [
CHECK-NEXT: Entry Offset: 0x248
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 24
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Name: (ID 12) [
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 24
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 54
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Language: (ID 2052) [
CHECK-NEXT: Entry Offset: 0x278
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 67
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Language: (ID 4103) [
CHECK-NEXT: Entry Offset: 0x288
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 66
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 57
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 808
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Name: OKAY [
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 808
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 48
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Name: (ID 14432) [
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 46
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 108
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 24
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: Name: (ID 12) [
CHECK-NEXT: Major Version: 0
CHECK-NEXT: Minor Version: 0
CHECK-NEXT: Characteristics: 0
+CHECK-NEXT: Data [
+CHECK-NEXT: DataRVA: 0x0
+CHECK-NEXT: DataSize: 24
+CHECK-NEXT: Codepage: 0
+CHECK-NEXT: Reserved: 0
+CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
CHECK-NEXT: ]
ZERO-NEXT: Major Version: 0
ZERO-NEXT: Minor Version: 0
ZERO-NEXT: Characteristics: 0
+ZERO-NEXT: Data [
+ZERO-NEXT: DataRVA: 0x0
+ZERO-NEXT: DataSize: 42
+ZERO-NEXT: Codepage: 0
+ZERO-NEXT: Reserved: 0
+ZERO-NEXT: ]
ZERO-NEXT: ]
ZERO-NEXT: ]
ZERO-NEXT: ]
TEST_RES-NEXT: Major Version: 0
TEST_RES-NEXT: Minor Version: 0
TEST_RES-NEXT: Characteristics: 0
+TEST_RES-NEXT: Data [
+TEST_RES-NEXT: DataRVA: 0x0
+TEST_RES-NEXT: DataSize: 808
+TEST_RES-NEXT: Codepage: 0
+TEST_RES-NEXT: Reserved: 0
+TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: Name: OKAY [
TEST_RES-NEXT: Major Version: 0
TEST_RES-NEXT: Minor Version: 0
TEST_RES-NEXT: Characteristics: 0
+TEST_RES-NEXT: Data [
+TEST_RES-NEXT: DataRVA: 0x0
+TEST_RES-NEXT: DataSize: 808
+TEST_RES-NEXT: Codepage: 0
+TEST_RES-NEXT: Reserved: 0
+TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: Major Version: 0
TEST_RES-NEXT: Minor Version: 0
TEST_RES-NEXT: Characteristics: 0
+TEST_RES-NEXT: Data [
+TEST_RES-NEXT: DataRVA: 0x0
+TEST_RES-NEXT: DataSize: 48
+TEST_RES-NEXT: Codepage: 0
+TEST_RES-NEXT: Reserved: 0
+TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: Name: (ID 14432) [
TEST_RES-NEXT: Major Version: 0
TEST_RES-NEXT: Minor Version: 0
TEST_RES-NEXT: Characteristics: 0
+TEST_RES-NEXT: Data [
+TEST_RES-NEXT: DataRVA: 0x0
+TEST_RES-NEXT: DataSize: 46
+TEST_RES-NEXT: Codepage: 0
+TEST_RES-NEXT: Reserved: 0
+TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: Major Version: 0
TEST_RES-NEXT: Minor Version: 0
TEST_RES-NEXT: Characteristics: 0
+TEST_RES-NEXT: Data [
+TEST_RES-NEXT: DataRVA: 0x0
+TEST_RES-NEXT: DataSize: 108
+TEST_RES-NEXT: Codepage: 0
+TEST_RES-NEXT: Reserved: 0
+TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: Major Version: 0
TEST_RES-NEXT: Minor Version: 0
TEST_RES-NEXT: Characteristics: 0
+TEST_RES-NEXT: Data [
+TEST_RES-NEXT: DataRVA: 0x0
+TEST_RES-NEXT: DataSize: 24
+TEST_RES-NEXT: Codepage: 0
+TEST_RES-NEXT: Reserved: 0
+TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: Name: (ID 12) [
TEST_RES-NEXT: Major Version: 0
TEST_RES-NEXT: Minor Version: 0
TEST_RES-NEXT: Characteristics: 0
+TEST_RES-NEXT: Data [
+TEST_RES-NEXT: DataRVA: 0x0
+TEST_RES-NEXT: DataSize: 24
+TEST_RES-NEXT: Codepage: 0
+TEST_RES-NEXT: Reserved: 0
+TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
TEST_RES-NEXT: ]
W.printNumber("Major Version", Table.MajorVersion);
W.printNumber("Minor Version", Table.MinorVersion);
W.printNumber("Characteristics", Table.Characteristics);
+ ListScope DataScope(W, "Data");
+ auto &DataEntry =
+ unwrapOrError(Obj->getFileName(), RSF.getEntryData(Entry));
+ W.printHex("DataRVA", DataEntry.DataRVA);
+ W.printNumber("DataSize", DataEntry.DataSize);
+ W.printNumber("Codepage", DataEntry.Codepage);
+ W.printNumber("Reserved", DataEntry.Reserved);
}
}
}