#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/zucchini/reloc_win32.h"
#include <algorithm>
#include <tuple>
#include <utility>
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "components/zucchini/algorithm.h"
#include "components/zucchini/io_utils.h"
#include "components/zucchini/type_win_pe.h"
namespace zucchini {
RelocUnitWin32::RelocUnitWin32() = default;
RelocUnitWin32::RelocUnitWin32(uint8_t type_in,
offset_t location_in,
rva_t target_rva_in)
: … { … }
bool operator==(const RelocUnitWin32& a, const RelocUnitWin32& b) { … }
bool RelocRvaReaderWin32::FindRelocBlocks(
ConstBufferView image,
BufferRegion reloc_region,
std::vector<offset_t>* reloc_block_offsets) { … }
RelocRvaReaderWin32::RelocRvaReaderWin32(
ConstBufferView image,
BufferRegion reloc_region,
const std::vector<offset_t>& reloc_block_offsets,
offset_t lo,
offset_t hi)
: … { … }
RelocRvaReaderWin32::RelocRvaReaderWin32(RelocRvaReaderWin32&&) = default;
RelocRvaReaderWin32::~RelocRvaReaderWin32() = default;
std::optional<RelocUnitWin32> RelocRvaReaderWin32::GetNext() { … }
bool RelocRvaReaderWin32::LoadRelocBlock(
ConstBufferView::const_iterator block_begin) { … }
RelocReaderWin32::RelocReaderWin32(RelocRvaReaderWin32&& reloc_rva_reader,
uint16_t reloc_type,
offset_t offset_bound,
const AddressTranslator& translator)
: … { … }
RelocReaderWin32::~RelocReaderWin32() = default;
std::optional<Reference> RelocReaderWin32::GetNext() { … }
RelocWriterWin32::RelocWriterWin32(
uint16_t reloc_type,
MutableBufferView image,
BufferRegion reloc_region,
const std::vector<offset_t>& reloc_block_offsets,
const AddressTranslator& translator)
: … { … }
RelocWriterWin32::~RelocWriterWin32() = default;
void RelocWriterWin32::PutNext(Reference ref) { … }
}