mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-05-19 17:55:20 -04:00
Add Insyde Flash Device Map parser
This commit is contained in:
parent
0b66c5c7ff
commit
b3c68b7006
28 changed files with 1361 additions and 230 deletions
|
@ -12,35 +12,11 @@ edk2_ftw_t::edk2_ftw_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, edk2_
|
|||
}
|
||||
|
||||
void edk2_ftw_t::_read() {
|
||||
m_signature = m__io->read_u4le();
|
||||
m_signature = m__io->read_bytes(16);
|
||||
{
|
||||
uint32_t _ = signature();
|
||||
if (!( ((_ == 4293995405UL) || (_ == 2656577835UL)) )) {
|
||||
throw kaitai::validation_expr_error<uint32_t>(signature(), _io(), std::string("/seq/0"));
|
||||
}
|
||||
}
|
||||
n_signature_main = true;
|
||||
if (signature() == 4293995405UL) {
|
||||
n_signature_main = false;
|
||||
m_signature_main = m__io->read_bytes(12);
|
||||
if (!(signature_main() == std::string("\x96\x76\x8B\x4C\xA9\x85\x27\x47\x07\x5B\x4F\x50", 12))) {
|
||||
throw kaitai::validation_not_equal_error<std::string>(std::string("\x96\x76\x8B\x4C\xA9\x85\x27\x47\x07\x5B\x4F\x50", 12), signature_main(), _io(), std::string("/seq/1"));
|
||||
}
|
||||
}
|
||||
n_signature_edk2_working_block = true;
|
||||
if (signature() == 2656577835UL) {
|
||||
n_signature_edk2_working_block = false;
|
||||
m_signature_edk2_working_block = m__io->read_bytes(12);
|
||||
if (!(signature_edk2_working_block() == std::string("\x68\x7C\x7D\x49\x0A\xCE\x65\x00\xFD\x9F\x1B\x95", 12))) {
|
||||
throw kaitai::validation_not_equal_error<std::string>(std::string("\x68\x7C\x7D\x49\x0A\xCE\x65\x00\xFD\x9F\x1B\x95", 12), signature_edk2_working_block(), _io(), std::string("/seq/2"));
|
||||
}
|
||||
}
|
||||
n_signature_vss2_working_block = true;
|
||||
if (signature() == 2656577835UL) {
|
||||
n_signature_vss2_working_block = false;
|
||||
m_signature_vss2_working_block = m__io->read_bytes(12);
|
||||
if (!(signature_vss2_working_block() == std::string("\x68\x7C\x7D\x49\xA0\xCE\x65\x00\xFD\x9F\x1B\x95", 12))) {
|
||||
throw kaitai::validation_not_equal_error<std::string>(std::string("\x68\x7C\x7D\x49\xA0\xCE\x65\x00\xFD\x9F\x1B\x95", 12), signature_vss2_working_block(), _io(), std::string("/seq/3"));
|
||||
std::string _ = signature();
|
||||
if (!( ((_ == std::string("\x8D\x2B\xF1\xFF\x96\x76\x8B\x4C\xA9\x85\x27\x47\x07\x5B\x4F\x50", 16)) || (_ == std::string("\x2B\x29\x58\x9E\x68\x7C\x7D\x49\x0A\xCE\x65\x00\xFD\x9F\x1B\x95", 16)) || (_ == std::string("\x2B\x29\x58\x9E\x68\x7C\x7D\x49\xA0\xCE\x65\x00\xFD\x9F\x1B\x95", 16))) )) {
|
||||
throw kaitai::validation_expr_error<std::string>(signature(), _io(), std::string("/seq/0"));
|
||||
}
|
||||
}
|
||||
m_crc = m__io->read_u4le();
|
||||
|
@ -69,12 +45,6 @@ edk2_ftw_t::~edk2_ftw_t() {
|
|||
}
|
||||
|
||||
void edk2_ftw_t::_clean_up() {
|
||||
if (!n_signature_main) {
|
||||
}
|
||||
if (!n_signature_edk2_working_block) {
|
||||
}
|
||||
if (!n_signature_vss2_working_block) {
|
||||
}
|
||||
if (!n_len_write_queue_64) {
|
||||
}
|
||||
if (!n_write_queue_32) {
|
||||
|
|
|
@ -38,28 +38,7 @@ public:
|
|||
int8_t len_ftw_store_header_64();
|
||||
|
||||
private:
|
||||
uint32_t m_signature;
|
||||
std::string m_signature_main;
|
||||
bool n_signature_main;
|
||||
|
||||
public:
|
||||
bool _is_null_signature_main() { signature_main(); return n_signature_main; };
|
||||
|
||||
private:
|
||||
std::string m_signature_edk2_working_block;
|
||||
bool n_signature_edk2_working_block;
|
||||
|
||||
public:
|
||||
bool _is_null_signature_edk2_working_block() { signature_edk2_working_block(); return n_signature_edk2_working_block; };
|
||||
|
||||
private:
|
||||
std::string m_signature_vss2_working_block;
|
||||
bool n_signature_vss2_working_block;
|
||||
|
||||
public:
|
||||
bool _is_null_signature_vss2_working_block() { signature_vss2_working_block(); return n_signature_vss2_working_block; };
|
||||
|
||||
private:
|
||||
std::string m_signature;
|
||||
uint32_t m_crc;
|
||||
uint8_t m_state;
|
||||
std::string m_reserved;
|
||||
|
@ -89,10 +68,7 @@ private:
|
|||
kaitai::kstruct* m__parent;
|
||||
|
||||
public:
|
||||
uint32_t signature() const { return m_signature; }
|
||||
std::string signature_main() const { return m_signature_main; }
|
||||
std::string signature_edk2_working_block() const { return m_signature_edk2_working_block; }
|
||||
std::string signature_vss2_working_block() const { return m_signature_vss2_working_block; }
|
||||
std::string signature() const { return m_signature; }
|
||||
uint32_t crc() const { return m_crc; }
|
||||
uint8_t state() const { return m_state; }
|
||||
std::string reserved() const { return m_reserved; }
|
||||
|
|
|
@ -354,7 +354,7 @@ int32_t edk2_vss2_t::vss2_variable_t::end_offset() {
|
|||
int32_t edk2_vss2_t::vss2_variable_t::len_alignment_padding_auth() {
|
||||
if (f_len_alignment_padding_auth)
|
||||
return m_len_alignment_padding_auth;
|
||||
m_len_alignment_padding_auth = ((((end_offset_auth() - offset()) + 3) & ~3) - (end_offset() - offset()));
|
||||
m_len_alignment_padding_auth = ((((end_offset_auth() - offset()) + 3) & ~3) - (end_offset_auth() - offset()));
|
||||
f_len_alignment_padding_auth = true;
|
||||
return m_len_alignment_padding_auth;
|
||||
}
|
||||
|
|
179
common/generated/insyde_fdm.cpp
Normal file
179
common/generated/insyde_fdm.cpp
Normal file
|
@ -0,0 +1,179 @@
|
|||
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
|
||||
|
||||
#include "insyde_fdm.h"
|
||||
#include "../kaitai/exceptions.h"
|
||||
|
||||
insyde_fdm_t::insyde_fdm_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, insyde_fdm_t* p__root) : kaitai::kstruct(p__io) {
|
||||
m__parent = p__parent;
|
||||
m__root = this; (void)p__root;
|
||||
m_extensions = nullptr;
|
||||
m__io__raw_extensions = nullptr;
|
||||
m_board_ids = nullptr;
|
||||
m_entries = nullptr;
|
||||
m__io__raw_entries = nullptr;
|
||||
_read();
|
||||
}
|
||||
|
||||
void insyde_fdm_t::_read() {
|
||||
m_signature = m__io->read_u4le();
|
||||
if (!(signature() == 1296320072)) {
|
||||
throw kaitai::validation_not_equal_error<uint32_t>(1296320072, signature(), _io(), std::string("/seq/0"));
|
||||
}
|
||||
m_store_size = m__io->read_u4le();
|
||||
m_data_offset = m__io->read_u4le();
|
||||
m_entry_size = m__io->read_u4le();
|
||||
m_entry_format = m__io->read_u1();
|
||||
m_revision = m__io->read_u1();
|
||||
m_num_extensions = m__io->read_u1();
|
||||
m_checksum = m__io->read_u1();
|
||||
m_fd_base_address = m__io->read_u8le();
|
||||
n_extensions = true;
|
||||
if (revision() == 3) {
|
||||
n_extensions = false;
|
||||
m__raw_extensions = m__io->read_bytes((num_extensions() * 4));
|
||||
m__io__raw_extensions = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_extensions));
|
||||
m_extensions = std::unique_ptr<fdm_extensions_t>(new fdm_extensions_t(m__io__raw_extensions.get(), this, m__root));
|
||||
}
|
||||
n_board_ids = true;
|
||||
if (revision() == 3) {
|
||||
n_board_ids = false;
|
||||
m_board_ids = std::unique_ptr<fdm_board_ids_t>(new fdm_board_ids_t(m__io, this, m__root));
|
||||
}
|
||||
m__raw_entries = m__io->read_bytes((store_size() - data_offset()));
|
||||
m__io__raw_entries = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_entries));
|
||||
m_entries = std::unique_ptr<fdm_entries_t>(new fdm_entries_t(m__io__raw_entries.get(), this, m__root));
|
||||
}
|
||||
|
||||
insyde_fdm_t::~insyde_fdm_t() {
|
||||
_clean_up();
|
||||
}
|
||||
|
||||
void insyde_fdm_t::_clean_up() {
|
||||
if (!n_extensions) {
|
||||
}
|
||||
if (!n_board_ids) {
|
||||
}
|
||||
}
|
||||
|
||||
insyde_fdm_t::fdm_entries_t::fdm_entries_t(kaitai::kstream* p__io, insyde_fdm_t* p__parent, insyde_fdm_t* p__root) : kaitai::kstruct(p__io) {
|
||||
m__parent = p__parent;
|
||||
m__root = p__root;
|
||||
m_entries = nullptr;
|
||||
_read();
|
||||
}
|
||||
|
||||
void insyde_fdm_t::fdm_entries_t::_read() {
|
||||
m_entries = std::unique_ptr<std::vector<std::unique_ptr<fdm_entry_t>>>(new std::vector<std::unique_ptr<fdm_entry_t>>());
|
||||
{
|
||||
int i = 0;
|
||||
while (!m__io->is_eof()) {
|
||||
m_entries->push_back(std::move(std::unique_ptr<fdm_entry_t>(new fdm_entry_t(m__io, this, m__root))));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
insyde_fdm_t::fdm_entries_t::~fdm_entries_t() {
|
||||
_clean_up();
|
||||
}
|
||||
|
||||
void insyde_fdm_t::fdm_entries_t::_clean_up() {
|
||||
}
|
||||
|
||||
insyde_fdm_t::fdm_extension_t::fdm_extension_t(kaitai::kstream* p__io, insyde_fdm_t::fdm_extensions_t* p__parent, insyde_fdm_t* p__root) : kaitai::kstruct(p__io) {
|
||||
m__parent = p__parent;
|
||||
m__root = p__root;
|
||||
_read();
|
||||
}
|
||||
|
||||
void insyde_fdm_t::fdm_extension_t::_read() {
|
||||
m_offset = m__io->read_u2le();
|
||||
m_count = m__io->read_u2le();
|
||||
}
|
||||
|
||||
insyde_fdm_t::fdm_extension_t::~fdm_extension_t() {
|
||||
_clean_up();
|
||||
}
|
||||
|
||||
void insyde_fdm_t::fdm_extension_t::_clean_up() {
|
||||
}
|
||||
|
||||
insyde_fdm_t::fdm_board_ids_t::fdm_board_ids_t(kaitai::kstream* p__io, insyde_fdm_t* p__parent, insyde_fdm_t* p__root) : kaitai::kstruct(p__io) {
|
||||
m__parent = p__parent;
|
||||
m__root = p__root;
|
||||
m_board_ids = nullptr;
|
||||
_read();
|
||||
}
|
||||
|
||||
void insyde_fdm_t::fdm_board_ids_t::_read() {
|
||||
m_region_index = m__io->read_u4le();
|
||||
m_num_board_ids = m__io->read_u4le();
|
||||
m_board_ids = std::unique_ptr<std::vector<uint64_t>>(new std::vector<uint64_t>());
|
||||
const int l_board_ids = num_board_ids();
|
||||
for (int i = 0; i < l_board_ids; i++) {
|
||||
m_board_ids->push_back(std::move(m__io->read_u8le()));
|
||||
}
|
||||
}
|
||||
|
||||
insyde_fdm_t::fdm_board_ids_t::~fdm_board_ids_t() {
|
||||
_clean_up();
|
||||
}
|
||||
|
||||
void insyde_fdm_t::fdm_board_ids_t::_clean_up() {
|
||||
}
|
||||
|
||||
insyde_fdm_t::fdm_extensions_t::fdm_extensions_t(kaitai::kstream* p__io, insyde_fdm_t* p__parent, insyde_fdm_t* p__root) : kaitai::kstruct(p__io) {
|
||||
m__parent = p__parent;
|
||||
m__root = p__root;
|
||||
m_extensions = nullptr;
|
||||
_read();
|
||||
}
|
||||
|
||||
void insyde_fdm_t::fdm_extensions_t::_read() {
|
||||
m_extensions = std::unique_ptr<std::vector<std::unique_ptr<fdm_extension_t>>>(new std::vector<std::unique_ptr<fdm_extension_t>>());
|
||||
{
|
||||
int i = 0;
|
||||
while (!m__io->is_eof()) {
|
||||
m_extensions->push_back(std::move(std::unique_ptr<fdm_extension_t>(new fdm_extension_t(m__io, this, m__root))));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
insyde_fdm_t::fdm_extensions_t::~fdm_extensions_t() {
|
||||
_clean_up();
|
||||
}
|
||||
|
||||
void insyde_fdm_t::fdm_extensions_t::_clean_up() {
|
||||
}
|
||||
|
||||
insyde_fdm_t::fdm_entry_t::fdm_entry_t(kaitai::kstream* p__io, insyde_fdm_t::fdm_entries_t* p__parent, insyde_fdm_t* p__root) : kaitai::kstruct(p__io) {
|
||||
m__parent = p__parent;
|
||||
m__root = p__root;
|
||||
f_region_base = false;
|
||||
_read();
|
||||
}
|
||||
|
||||
void insyde_fdm_t::fdm_entry_t::_read() {
|
||||
m_guid = m__io->read_bytes(16);
|
||||
m_region_id = m__io->read_bytes(16);
|
||||
m_region_offset = m__io->read_u8le();
|
||||
m_region_size = m__io->read_u8le();
|
||||
m_attributes = m__io->read_u4le();
|
||||
m_hash = m__io->read_bytes((((((_parent()->_parent()->entry_size() - 16) - 16) - 8) - 8) - 4));
|
||||
}
|
||||
|
||||
insyde_fdm_t::fdm_entry_t::~fdm_entry_t() {
|
||||
_clean_up();
|
||||
}
|
||||
|
||||
void insyde_fdm_t::fdm_entry_t::_clean_up() {
|
||||
}
|
||||
|
||||
int32_t insyde_fdm_t::fdm_entry_t::region_base() {
|
||||
if (f_region_base)
|
||||
return m_region_base;
|
||||
m_region_base = (static_cast<uint32_t>(_root()->fd_base_address()) + static_cast<uint32_t>(region_offset()));
|
||||
f_region_base = true;
|
||||
return m_region_base;
|
||||
}
|
232
common/generated/insyde_fdm.h
Normal file
232
common/generated/insyde_fdm.h
Normal file
|
@ -0,0 +1,232 @@
|
|||
#pragma once
|
||||
|
||||
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
|
||||
|
||||
#include "../kaitai/kaitaistruct.h"
|
||||
#include <stdint.h>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#if KAITAI_STRUCT_VERSION < 9000L
|
||||
#error "Incompatible Kaitai Struct C++/STL API: version 0.9 or later is required"
|
||||
#endif
|
||||
|
||||
class insyde_fdm_t : public kaitai::kstruct {
|
||||
|
||||
public:
|
||||
class fdm_entries_t;
|
||||
class fdm_extension_t;
|
||||
class fdm_board_ids_t;
|
||||
class fdm_extensions_t;
|
||||
class fdm_entry_t;
|
||||
|
||||
insyde_fdm_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, insyde_fdm_t* p__root = nullptr);
|
||||
|
||||
private:
|
||||
void _read();
|
||||
void _clean_up();
|
||||
|
||||
public:
|
||||
~insyde_fdm_t();
|
||||
|
||||
class fdm_entries_t : public kaitai::kstruct {
|
||||
|
||||
public:
|
||||
|
||||
fdm_entries_t(kaitai::kstream* p__io, insyde_fdm_t* p__parent = nullptr, insyde_fdm_t* p__root = nullptr);
|
||||
|
||||
private:
|
||||
void _read();
|
||||
void _clean_up();
|
||||
|
||||
public:
|
||||
~fdm_entries_t();
|
||||
|
||||
private:
|
||||
std::unique_ptr<std::vector<std::unique_ptr<fdm_entry_t>>> m_entries;
|
||||
insyde_fdm_t* m__root;
|
||||
insyde_fdm_t* m__parent;
|
||||
|
||||
public:
|
||||
std::vector<std::unique_ptr<fdm_entry_t>>* entries() const { return m_entries.get(); }
|
||||
insyde_fdm_t* _root() const { return m__root; }
|
||||
insyde_fdm_t* _parent() const { return m__parent; }
|
||||
};
|
||||
|
||||
class fdm_extension_t : public kaitai::kstruct {
|
||||
|
||||
public:
|
||||
|
||||
fdm_extension_t(kaitai::kstream* p__io, insyde_fdm_t::fdm_extensions_t* p__parent = nullptr, insyde_fdm_t* p__root = nullptr);
|
||||
|
||||
private:
|
||||
void _read();
|
||||
void _clean_up();
|
||||
|
||||
public:
|
||||
~fdm_extension_t();
|
||||
|
||||
private:
|
||||
uint16_t m_offset;
|
||||
uint16_t m_count;
|
||||
insyde_fdm_t* m__root;
|
||||
insyde_fdm_t::fdm_extensions_t* m__parent;
|
||||
|
||||
public:
|
||||
uint16_t offset() const { return m_offset; }
|
||||
uint16_t count() const { return m_count; }
|
||||
insyde_fdm_t* _root() const { return m__root; }
|
||||
insyde_fdm_t::fdm_extensions_t* _parent() const { return m__parent; }
|
||||
};
|
||||
|
||||
class fdm_board_ids_t : public kaitai::kstruct {
|
||||
|
||||
public:
|
||||
|
||||
fdm_board_ids_t(kaitai::kstream* p__io, insyde_fdm_t* p__parent = nullptr, insyde_fdm_t* p__root = nullptr);
|
||||
|
||||
private:
|
||||
void _read();
|
||||
void _clean_up();
|
||||
|
||||
public:
|
||||
~fdm_board_ids_t();
|
||||
|
||||
private:
|
||||
uint32_t m_region_index;
|
||||
uint32_t m_num_board_ids;
|
||||
std::unique_ptr<std::vector<uint64_t>> m_board_ids;
|
||||
insyde_fdm_t* m__root;
|
||||
insyde_fdm_t* m__parent;
|
||||
|
||||
public:
|
||||
uint32_t region_index() const { return m_region_index; }
|
||||
uint32_t num_board_ids() const { return m_num_board_ids; }
|
||||
std::vector<uint64_t>* board_ids() const { return m_board_ids.get(); }
|
||||
insyde_fdm_t* _root() const { return m__root; }
|
||||
insyde_fdm_t* _parent() const { return m__parent; }
|
||||
};
|
||||
|
||||
class fdm_extensions_t : public kaitai::kstruct {
|
||||
|
||||
public:
|
||||
|
||||
fdm_extensions_t(kaitai::kstream* p__io, insyde_fdm_t* p__parent = nullptr, insyde_fdm_t* p__root = nullptr);
|
||||
|
||||
private:
|
||||
void _read();
|
||||
void _clean_up();
|
||||
|
||||
public:
|
||||
~fdm_extensions_t();
|
||||
|
||||
private:
|
||||
std::unique_ptr<std::vector<std::unique_ptr<fdm_extension_t>>> m_extensions;
|
||||
insyde_fdm_t* m__root;
|
||||
insyde_fdm_t* m__parent;
|
||||
|
||||
public:
|
||||
std::vector<std::unique_ptr<fdm_extension_t>>* extensions() const { return m_extensions.get(); }
|
||||
insyde_fdm_t* _root() const { return m__root; }
|
||||
insyde_fdm_t* _parent() const { return m__parent; }
|
||||
};
|
||||
|
||||
class fdm_entry_t : public kaitai::kstruct {
|
||||
|
||||
public:
|
||||
|
||||
fdm_entry_t(kaitai::kstream* p__io, insyde_fdm_t::fdm_entries_t* p__parent = nullptr, insyde_fdm_t* p__root = nullptr);
|
||||
|
||||
private:
|
||||
void _read();
|
||||
void _clean_up();
|
||||
|
||||
public:
|
||||
~fdm_entry_t();
|
||||
|
||||
private:
|
||||
bool f_region_base;
|
||||
int32_t m_region_base;
|
||||
|
||||
public:
|
||||
int32_t region_base();
|
||||
|
||||
private:
|
||||
std::string m_guid;
|
||||
std::string m_region_id;
|
||||
uint64_t m_region_offset;
|
||||
uint64_t m_region_size;
|
||||
uint32_t m_attributes;
|
||||
std::string m_hash;
|
||||
insyde_fdm_t* m__root;
|
||||
insyde_fdm_t::fdm_entries_t* m__parent;
|
||||
|
||||
public:
|
||||
std::string guid() const { return m_guid; }
|
||||
std::string region_id() const { return m_region_id; }
|
||||
uint64_t region_offset() const { return m_region_offset; }
|
||||
uint64_t region_size() const { return m_region_size; }
|
||||
uint32_t attributes() const { return m_attributes; }
|
||||
std::string hash() const { return m_hash; }
|
||||
insyde_fdm_t* _root() const { return m__root; }
|
||||
insyde_fdm_t::fdm_entries_t* _parent() const { return m__parent; }
|
||||
};
|
||||
|
||||
private:
|
||||
uint32_t m_signature;
|
||||
uint32_t m_store_size;
|
||||
uint32_t m_data_offset;
|
||||
uint32_t m_entry_size;
|
||||
uint8_t m_entry_format;
|
||||
uint8_t m_revision;
|
||||
uint8_t m_num_extensions;
|
||||
uint8_t m_checksum;
|
||||
uint64_t m_fd_base_address;
|
||||
std::unique_ptr<fdm_extensions_t> m_extensions;
|
||||
bool n_extensions;
|
||||
|
||||
public:
|
||||
bool _is_null_extensions() { extensions(); return n_extensions; };
|
||||
|
||||
private:
|
||||
std::unique_ptr<fdm_board_ids_t> m_board_ids;
|
||||
bool n_board_ids;
|
||||
|
||||
public:
|
||||
bool _is_null_board_ids() { board_ids(); return n_board_ids; };
|
||||
|
||||
private:
|
||||
std::unique_ptr<fdm_entries_t> m_entries;
|
||||
insyde_fdm_t* m__root;
|
||||
kaitai::kstruct* m__parent;
|
||||
std::string m__raw_extensions;
|
||||
bool n__raw_extensions;
|
||||
|
||||
public:
|
||||
bool _is_null__raw_extensions() { _raw_extensions(); return n__raw_extensions; };
|
||||
|
||||
private:
|
||||
std::unique_ptr<kaitai::kstream> m__io__raw_extensions;
|
||||
std::string m__raw_entries;
|
||||
std::unique_ptr<kaitai::kstream> m__io__raw_entries;
|
||||
|
||||
public:
|
||||
uint32_t signature() const { return m_signature; }
|
||||
uint32_t store_size() const { return m_store_size; }
|
||||
uint32_t data_offset() const { return m_data_offset; }
|
||||
uint32_t entry_size() const { return m_entry_size; }
|
||||
uint8_t entry_format() const { return m_entry_format; }
|
||||
uint8_t revision() const { return m_revision; }
|
||||
uint8_t num_extensions() const { return m_num_extensions; }
|
||||
uint8_t checksum() const { return m_checksum; }
|
||||
uint64_t fd_base_address() const { return m_fd_base_address; }
|
||||
fdm_extensions_t* extensions() const { return m_extensions.get(); }
|
||||
fdm_board_ids_t* board_ids() const { return m_board_ids.get(); }
|
||||
fdm_entries_t* entries() const { return m_entries.get(); }
|
||||
insyde_fdm_t* _root() const { return m__root; }
|
||||
kaitai::kstruct* _parent() const { return m__parent; }
|
||||
std::string _raw_extensions() const { return m__raw_extensions; }
|
||||
kaitai::kstream* _io__raw_extensions() const { return m__io__raw_extensions.get(); }
|
||||
std::string _raw_entries() const { return m__raw_entries; }
|
||||
kaitai::kstream* _io__raw_entries() const { return m__io__raw_entries.get(); }
|
||||
};
|
|
@ -17,18 +17,18 @@ void phoenix_evsa_t::_read() {
|
|||
throw kaitai::validation_not_equal_error<uint8_t>(236, type(), _io(), std::string("/seq/0"));
|
||||
}
|
||||
m_checksum = m__io->read_u1();
|
||||
m_size = m__io->read_u2le();
|
||||
if (!(size() == 20)) {
|
||||
throw kaitai::validation_not_equal_error<uint16_t>(20, size(), _io(), std::string("/seq/2"));
|
||||
m_len_evsa_store_header = m__io->read_u2le();
|
||||
if (!(len_evsa_store_header() == 20)) {
|
||||
throw kaitai::validation_not_equal_error<uint16_t>(20, len_evsa_store_header(), _io(), std::string("/seq/2"));
|
||||
}
|
||||
m_signature = m__io->read_u4le();
|
||||
if (!(signature() == 1095980613)) {
|
||||
throw kaitai::validation_not_equal_error<uint32_t>(1095980613, signature(), _io(), std::string("/seq/3"));
|
||||
}
|
||||
m_attributes = m__io->read_u4le();
|
||||
m_store_size = m__io->read_u4le();
|
||||
m_len_evsa_store = m__io->read_u4le();
|
||||
m_reserved = m__io->read_u4le();
|
||||
m__raw_body = m__io->read_bytes((store_size() - 20));
|
||||
m__raw_body = m__io->read_bytes((len_evsa_store() - len_evsa_store_header()));
|
||||
m__io__raw_body = std::unique_ptr<kaitai::kstream>(new kaitai::kstream(m__raw_body));
|
||||
m_body = std::unique_ptr<evsa_body_t>(new evsa_body_t(m__io__raw_body.get(), this, m__root));
|
||||
}
|
||||
|
@ -47,10 +47,18 @@ phoenix_evsa_t::evsa_entry_t::evsa_entry_t(kaitai::kstream* p__io, phoenix_evsa_
|
|||
}
|
||||
|
||||
void phoenix_evsa_t::evsa_entry_t::_read() {
|
||||
m_type = m__io->read_u1();
|
||||
m_checksum = m__io->read_u1();
|
||||
m_size = m__io->read_u2le();
|
||||
switch (type()) {
|
||||
m_entry_type = m__io->read_u1();
|
||||
n_checksum = true;
|
||||
if ( ((entry_type() == 225) || (entry_type() == 226) || (entry_type() == 227) || (entry_type() == 237) || (entry_type() == 238) || (entry_type() == 239) || (entry_type() == 131)) ) {
|
||||
n_checksum = false;
|
||||
m_checksum = m__io->read_u1();
|
||||
}
|
||||
n_len_evsa_entry = true;
|
||||
if ( ((entry_type() == 225) || (entry_type() == 226) || (entry_type() == 227) || (entry_type() == 237) || (entry_type() == 238) || (entry_type() == 239) || (entry_type() == 131)) ) {
|
||||
n_len_evsa_entry = false;
|
||||
m_len_evsa_entry = m__io->read_u2le();
|
||||
}
|
||||
switch (entry_type()) {
|
||||
case 239: {
|
||||
m_body = std::unique_ptr<evsa_data_t>(new evsa_data_t(m__io, this, m__root));
|
||||
break;
|
||||
|
@ -91,6 +99,10 @@ phoenix_evsa_t::evsa_entry_t::~evsa_entry_t() {
|
|||
}
|
||||
|
||||
void phoenix_evsa_t::evsa_entry_t::_clean_up() {
|
||||
if (!n_checksum) {
|
||||
}
|
||||
if (!n_len_evsa_entry) {
|
||||
}
|
||||
}
|
||||
|
||||
phoenix_evsa_t::evsa_unknown_t::evsa_unknown_t(kaitai::kstream* p__io, phoenix_evsa_t::evsa_entry_t* p__parent, phoenix_evsa_t* p__root) : kaitai::kstruct(p__io) {
|
||||
|
@ -114,15 +126,26 @@ phoenix_evsa_t::evsa_body_t::evsa_body_t(kaitai::kstream* p__io, phoenix_evsa_t*
|
|||
m__parent = p__parent;
|
||||
m__root = p__root;
|
||||
m_entries = nullptr;
|
||||
m_free_space = nullptr;
|
||||
_read();
|
||||
}
|
||||
|
||||
void phoenix_evsa_t::evsa_body_t::_read() {
|
||||
m_entries = std::unique_ptr<std::vector<std::unique_ptr<evsa_entry_t>>>(new std::vector<std::unique_ptr<evsa_entry_t>>());
|
||||
{
|
||||
int i = 0;
|
||||
evsa_entry_t* _;
|
||||
do {
|
||||
_ = new evsa_entry_t(m__io, this, m__root);
|
||||
m_entries->push_back(std::move(std::unique_ptr<evsa_entry_t>(_)));
|
||||
i++;
|
||||
} while (!( (( ((_->entry_type() != 237) && (_->entry_type() != 238) && (_->entry_type() != 239) && (_->entry_type() != 225) && (_->entry_type() != 226) && (_->entry_type() != 227) && (_->entry_type() != 131)) ) || (_io()->is_eof())) ));
|
||||
}
|
||||
m_free_space = std::unique_ptr<std::vector<uint8_t>>(new std::vector<uint8_t>());
|
||||
{
|
||||
int i = 0;
|
||||
while (!m__io->is_eof()) {
|
||||
m_entries->push_back(std::move(std::unique_ptr<evsa_entry_t>(new evsa_entry_t(m__io, this, m__root))));
|
||||
m_free_space->push_back(std::move(m__io->read_u1()));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +166,7 @@ phoenix_evsa_t::evsa_name_t::evsa_name_t(kaitai::kstream* p__io, phoenix_evsa_t:
|
|||
|
||||
void phoenix_evsa_t::evsa_name_t::_read() {
|
||||
m_var_id = m__io->read_u2le();
|
||||
m_name = m__io->read_bytes((_parent()->size() - 6));
|
||||
m_name = m__io->read_bytes((_parent()->len_evsa_entry() - 6));
|
||||
}
|
||||
|
||||
phoenix_evsa_t::evsa_name_t::~evsa_name_t() {
|
||||
|
@ -162,6 +185,12 @@ phoenix_evsa_t::evsa_guid_t::evsa_guid_t(kaitai::kstream* p__io, phoenix_evsa_t:
|
|||
void phoenix_evsa_t::evsa_guid_t::_read() {
|
||||
m_guid_id = m__io->read_u2le();
|
||||
m_guid = m__io->read_bytes(16);
|
||||
{
|
||||
std::string _ = guid();
|
||||
if (!(_parent()->len_evsa_entry() == 22)) {
|
||||
throw kaitai::validation_expr_error<std::string>(guid(), _io(), std::string("/types/evsa_guid/seq/1"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
phoenix_evsa_t::evsa_guid_t::~evsa_guid_t() {
|
||||
|
@ -171,30 +200,57 @@ phoenix_evsa_t::evsa_guid_t::~evsa_guid_t() {
|
|||
void phoenix_evsa_t::evsa_guid_t::_clean_up() {
|
||||
}
|
||||
|
||||
phoenix_evsa_t::evsa_variable_attributes_t::evsa_variable_attributes_t(kaitai::kstream* p__io, phoenix_evsa_t::evsa_data_t* p__parent, phoenix_evsa_t* p__root) : kaitai::kstruct(p__io) {
|
||||
m__parent = p__parent;
|
||||
m__root = p__root;
|
||||
_read();
|
||||
}
|
||||
|
||||
void phoenix_evsa_t::evsa_variable_attributes_t::_read() {
|
||||
m_non_volatile = m__io->read_bits_int_le(1);
|
||||
m_boot_service = m__io->read_bits_int_le(1);
|
||||
m_runtime = m__io->read_bits_int_le(1);
|
||||
m_hw_error_record = m__io->read_bits_int_le(1);
|
||||
m_auth_write = m__io->read_bits_int_le(1);
|
||||
m_time_based_auth = m__io->read_bits_int_le(1);
|
||||
m_append_write = m__io->read_bits_int_le(1);
|
||||
m_reserved = m__io->read_bits_int_le(21);
|
||||
m_extended_header = m__io->read_bits_int_le(1);
|
||||
m_reserved1 = m__io->read_bits_int_le(3);
|
||||
}
|
||||
|
||||
phoenix_evsa_t::evsa_variable_attributes_t::~evsa_variable_attributes_t() {
|
||||
_clean_up();
|
||||
}
|
||||
|
||||
void phoenix_evsa_t::evsa_variable_attributes_t::_clean_up() {
|
||||
}
|
||||
|
||||
phoenix_evsa_t::evsa_data_t::evsa_data_t(kaitai::kstream* p__io, phoenix_evsa_t::evsa_entry_t* p__parent, phoenix_evsa_t* p__root) : kaitai::kstruct(p__io) {
|
||||
m__parent = p__parent;
|
||||
m__root = p__root;
|
||||
m_attributes = nullptr;
|
||||
_read();
|
||||
}
|
||||
|
||||
void phoenix_evsa_t::evsa_data_t::_read() {
|
||||
m_guid_id = m__io->read_u2le();
|
||||
m_var_id = m__io->read_u2le();
|
||||
m_attributes = m__io->read_u4le();
|
||||
n_data_size = true;
|
||||
if ((attributes() & 268435456) != 268435456) {
|
||||
n_data_size = false;
|
||||
m_data_size = m__io->read_u4le();
|
||||
m_attributes = std::unique_ptr<evsa_variable_attributes_t>(new evsa_variable_attributes_t(m__io, this, m__root));
|
||||
n_len_data_ext = true;
|
||||
if (attributes()->extended_header()) {
|
||||
n_len_data_ext = false;
|
||||
m_len_data_ext = m__io->read_u4le();
|
||||
}
|
||||
n_data = true;
|
||||
if ((attributes() & 268435456) == 268435456) {
|
||||
if (!(attributes()->extended_header())) {
|
||||
n_data = false;
|
||||
m_data = m__io->read_bytes((_parent()->size() - 12));
|
||||
m_data = m__io->read_bytes((_parent()->len_evsa_entry() - 12));
|
||||
}
|
||||
n_data_ext = true;
|
||||
if ((attributes() & 268435456) != 268435456) {
|
||||
if (attributes()->extended_header()) {
|
||||
n_data_ext = false;
|
||||
m_data_ext = m__io->read_bytes(data_size());
|
||||
m_data_ext = m__io->read_bytes(len_data_ext());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,7 +259,7 @@ phoenix_evsa_t::evsa_data_t::~evsa_data_t() {
|
|||
}
|
||||
|
||||
void phoenix_evsa_t::evsa_data_t::_clean_up() {
|
||||
if (!n_data_size) {
|
||||
if (!n_len_data_ext) {
|
||||
}
|
||||
if (!n_data) {
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue