Add Insyde Flash Device Map parser

This commit is contained in:
Nikolaj Schlej 2025-03-03 01:27:24 +07:00
parent b98edf6944
commit 58366f48fe
28 changed files with 1361 additions and 230 deletions

View file

@ -19,6 +19,7 @@ public:
class evsa_body_t;
class evsa_name_t;
class evsa_guid_t;
class evsa_variable_attributes_t;
class evsa_data_t;
phoenix_evsa_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, phoenix_evsa_t* p__root = nullptr);
@ -44,17 +45,29 @@ public:
~evsa_entry_t();
private:
uint8_t m_type;
uint8_t m_entry_type;
uint8_t m_checksum;
uint16_t m_size;
bool n_checksum;
public:
bool _is_null_checksum() { checksum(); return n_checksum; };
private:
uint16_t m_len_evsa_entry;
bool n_len_evsa_entry;
public:
bool _is_null_len_evsa_entry() { len_evsa_entry(); return n_len_evsa_entry; };
private:
std::unique_ptr<kaitai::kstruct> m_body;
phoenix_evsa_t* m__root;
phoenix_evsa_t::evsa_body_t* m__parent;
public:
uint8_t type() const { return m_type; }
uint8_t entry_type() const { return m_entry_type; }
uint8_t checksum() const { return m_checksum; }
uint16_t size() const { return m_size; }
uint16_t len_evsa_entry() const { return m_len_evsa_entry; }
kaitai::kstruct* body() const { return m_body.get(); }
phoenix_evsa_t* _root() const { return m__root; }
phoenix_evsa_t::evsa_body_t* _parent() const { return m__parent; }
@ -99,11 +112,13 @@ public:
private:
std::unique_ptr<std::vector<std::unique_ptr<evsa_entry_t>>> m_entries;
std::unique_ptr<std::vector<uint8_t>> m_free_space;
phoenix_evsa_t* m__root;
phoenix_evsa_t* m__parent;
public:
std::vector<std::unique_ptr<evsa_entry_t>>* entries() const { return m_entries.get(); }
std::vector<uint8_t>* free_space() const { return m_free_space.get(); }
phoenix_evsa_t* _root() const { return m__root; }
phoenix_evsa_t* _parent() const { return m__parent; }
};
@ -160,6 +175,48 @@ public:
phoenix_evsa_t::evsa_entry_t* _parent() const { return m__parent; }
};
class evsa_variable_attributes_t : public kaitai::kstruct {
public:
evsa_variable_attributes_t(kaitai::kstream* p__io, phoenix_evsa_t::evsa_data_t* p__parent = nullptr, phoenix_evsa_t* p__root = nullptr);
private:
void _read();
void _clean_up();
public:
~evsa_variable_attributes_t();
private:
bool m_non_volatile;
bool m_boot_service;
bool m_runtime;
bool m_hw_error_record;
bool m_auth_write;
bool m_time_based_auth;
bool m_append_write;
uint64_t m_reserved;
bool m_extended_header;
uint64_t m_reserved1;
phoenix_evsa_t* m__root;
phoenix_evsa_t::evsa_data_t* m__parent;
public:
bool non_volatile() const { return m_non_volatile; }
bool boot_service() const { return m_boot_service; }
bool runtime() const { return m_runtime; }
bool hw_error_record() const { return m_hw_error_record; }
bool auth_write() const { return m_auth_write; }
bool time_based_auth() const { return m_time_based_auth; }
bool append_write() const { return m_append_write; }
uint64_t reserved() const { return m_reserved; }
bool extended_header() const { return m_extended_header; }
uint64_t reserved1() const { return m_reserved1; }
phoenix_evsa_t* _root() const { return m__root; }
phoenix_evsa_t::evsa_data_t* _parent() const { return m__parent; }
};
class evsa_data_t : public kaitai::kstruct {
public:
@ -176,12 +233,12 @@ public:
private:
uint16_t m_guid_id;
uint16_t m_var_id;
uint32_t m_attributes;
uint32_t m_data_size;
bool n_data_size;
std::unique_ptr<evsa_variable_attributes_t> m_attributes;
uint32_t m_len_data_ext;
bool n_len_data_ext;
public:
bool _is_null_data_size() { data_size(); return n_data_size; };
bool _is_null_len_data_ext() { len_data_ext(); return n_len_data_ext; };
private:
std::string m_data;
@ -204,8 +261,8 @@ public:
public:
uint16_t guid_id() const { return m_guid_id; }
uint16_t var_id() const { return m_var_id; }
uint32_t attributes() const { return m_attributes; }
uint32_t data_size() const { return m_data_size; }
evsa_variable_attributes_t* attributes() const { return m_attributes.get(); }
uint32_t len_data_ext() const { return m_len_data_ext; }
std::string data() const { return m_data; }
std::string data_ext() const { return m_data_ext; }
phoenix_evsa_t* _root() const { return m__root; }
@ -215,10 +272,10 @@ public:
private:
uint8_t m_type;
uint8_t m_checksum;
uint16_t m_size;
uint16_t m_len_evsa_store_header;
uint32_t m_signature;
uint32_t m_attributes;
uint32_t m_store_size;
uint32_t m_len_evsa_store;
uint32_t m_reserved;
std::unique_ptr<evsa_body_t> m_body;
phoenix_evsa_t* m__root;
@ -229,10 +286,10 @@ private:
public:
uint8_t type() const { return m_type; }
uint8_t checksum() const { return m_checksum; }
uint16_t size() const { return m_size; }
uint16_t len_evsa_store_header() const { return m_len_evsa_store_header; }
uint32_t signature() const { return m_signature; }
uint32_t attributes() const { return m_attributes; }
uint32_t store_size() const { return m_store_size; }
uint32_t len_evsa_store() const { return m_len_evsa_store; }
uint32_t reserved() const { return m_reserved; }
evsa_body_t* body() const { return m_body.get(); }
phoenix_evsa_t* _root() const { return m__root; }