explicit DosHeader(Process const& process, PeFile const& pe_file) : process_{&process}, base_{static_cast<std::uint8_t*>(pe_file.GetBase())} { UpdateRead(); EnsureValid(); }
RelocationBlock(Process const& process, PeFile const& pe_file, PIMAGE_BASE_RELOCATION base, void const* reloc_dir_end) : process_{&process}, pe_file_{&pe_file}, base_{reinterpret_cast<std::uint8_t*>(base)}, reloc_dir_end_{reloc_dir_end} { UpdateRead(); }
explicit BoundImportForwarderRef(Process const& process, PeFile const& pe_file, PIMAGE_BOUND_IMPORT_DESCRIPTOR start, PIMAGE_BOUND_FORWARDER_REF fwd_ref) : process_{&process}, pe_file_{&pe_file}, start_{reinterpret_cast<std::uint8_t*>(start)}, base_{reinterpret_cast<std::uint8_t*>(fwd_ref)}, data_{} { HADESMEM_DETAIL_ASSERT(start_ && base_); UpdateRead(); }
explicit TlsDir(Process const& process, PeFile const& pe_file) : process_{&process}, pe_file_{&pe_file} { NtHeaders const nt_headers{process, pe_file}; DWORD const data_dir_va = nt_headers.GetDataDirectoryVirtualAddress(PeDataDir::TLS); // Windows will load images which don't specify a size for the // TLS directory. if (!data_dir_va) { HADESMEM_DETAIL_THROW_EXCEPTION( Error{} << ErrorString{"PE file has no TLS directory."}); } base_ = static_cast<std::uint8_t*>(RvaToVa(process, pe_file, data_dir_va)); if (!base_) { HADESMEM_DETAIL_THROW_EXCEPTION( Error{} << ErrorString{"TLS directory is invalid."}); } UpdateRead(); }