#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/zucchini/disassembler_win32.h"
#include <stddef.h>
#include <algorithm>
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "components/zucchini/abs32_utils.h"
#include "components/zucchini/algorithm.h"
#include "components/zucchini/buffer_source.h"
#include "components/zucchini/rel32_finder.h"
#include "components/zucchini/rel32_utils.h"
#include "components/zucchini/reloc_win32.h"
namespace zucchini {
namespace {
bool ReadWin32Header(ConstBufferView image, BufferSource* source) { … }
template <class TRAITS>
const pe::ImageDataDirectory* ReadDataDirectory(
const typename TRAITS::ImageOptionalHeader* optional_header,
size_t index) { … }
template <class TRAITS>
bool IsWin32CodeSection(const pe::ImageSectionHeader& section) { … }
}
constexpr Bitness Win32X86Traits::kBitness;
constexpr ExecutableType Win32X86Traits::kExeType;
const char Win32X86Traits::kExeTypeString[] = …;
constexpr Bitness Win32X64Traits::kBitness;
constexpr ExecutableType Win32X64Traits::kExeType;
const char Win32X64Traits::kExeTypeString[] = …;
template <class TRAITS>
bool DisassemblerWin32<TRAITS>::QuickDetect(ConstBufferView image) { … }
template <class TRAITS>
DisassemblerWin32<TRAITS>::DisassemblerWin32() : … { … }
template <class TRAITS>
DisassemblerWin32<TRAITS>::~DisassemblerWin32() = default;
template <class TRAITS>
ExecutableType DisassemblerWin32<TRAITS>::GetExeType() const { … }
template <class TRAITS>
std::string DisassemblerWin32<TRAITS>::GetExeTypeString() const { … }
template <class TRAITS>
std::vector<ReferenceGroup> DisassemblerWin32<TRAITS>::MakeReferenceGroups()
const { … }
template <class TRAITS>
std::unique_ptr<ReferenceReader> DisassemblerWin32<TRAITS>::MakeReadRelocs(
offset_t lo,
offset_t hi) { … }
template <class TRAITS>
std::unique_ptr<ReferenceReader> DisassemblerWin32<TRAITS>::MakeReadAbs32(
offset_t lo,
offset_t hi) { … }
template <class TRAITS>
std::unique_ptr<ReferenceReader> DisassemblerWin32<TRAITS>::MakeReadRel32(
offset_t lo,
offset_t hi) { … }
template <class TRAITS>
std::unique_ptr<ReferenceWriter> DisassemblerWin32<TRAITS>::MakeWriteRelocs(
MutableBufferView image) { … }
template <class TRAITS>
std::unique_ptr<ReferenceWriter> DisassemblerWin32<TRAITS>::MakeWriteAbs32(
MutableBufferView image) { … }
template <class TRAITS>
std::unique_ptr<ReferenceWriter> DisassemblerWin32<TRAITS>::MakeWriteRel32(
MutableBufferView image) { … }
template <class TRAITS>
bool DisassemblerWin32<TRAITS>::Parse(ConstBufferView image) { … }
template <class TRAITS>
bool DisassemblerWin32<TRAITS>::ParseHeader() { … }
template <class TRAITS>
bool DisassemblerWin32<TRAITS>::ParseAndStoreRelocBlocks() { … }
template <class TRAITS>
bool DisassemblerWin32<TRAITS>::ParseAndStoreAbs32() { … }
template <class TRAITS>
bool DisassemblerWin32<TRAITS>::ParseAndStoreRel32() { … }
template class DisassemblerWin32<Win32X86Traits>;
template class DisassemblerWin32<Win32X64Traits>;
}