MCPcopy Create free account
hub / github.com/D7EAD/mkPIVM / read_file_bytes

Function read_file_bytes

src/pe_embed.cpp:67–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65 }
66
67 std::vector<std::uint8_t> read_file_bytes(const std::string& path) {
68 std::ifstream in(path, std::ios::binary | std::ios::ate);
69 if (!in) throw Error("cannot open target PE: " + path);
70 const auto sz = static_cast<std::size_t>(in.tellg());
71 in.seekg(0);
72 std::vector<std::uint8_t> v(sz);
73 if (!in.read(reinterpret_cast<char*>(v.data()), static_cast<std::streamsize>(sz))) throw Error("read target PE failed: " + path);
74 return v;
75 }
76
77 // view into the PE. all offsets are file offsets.
78 struct PeView {

Callers 1

embed_vm_blobFunction · 0.85

Calls 1

ErrorClass · 0.85

Tested by

no test coverage detected