|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
#include <Zydis/Zydis.h>
|
|
|
|
|
#include <xmmintrin.h>
|
|
|
|
|
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <optional>
|
|
|
|
|
#include <vector>
|
|
|
|
@ -94,6 +95,23 @@ inline void init() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline bool open_binary_file(const std::string &file,
|
|
|
|
|
std::vector<uint8_t> &data) {
|
|
|
|
|
std::ifstream fstr(file, std::ios::binary);
|
|
|
|
|
if (!fstr.is_open()) return false;
|
|
|
|
|
|
|
|
|
|
fstr.unsetf(std::ios::skipws);
|
|
|
|
|
fstr.seekg(0, std::ios::end);
|
|
|
|
|
|
|
|
|
|
const auto file_size = fstr.tellg();
|
|
|
|
|
|
|
|
|
|
fstr.seekg(NULL, std::ios::beg);
|
|
|
|
|
data.reserve(static_cast<uint32_t>(file_size));
|
|
|
|
|
data.insert(data.begin(), std::istream_iterator<uint8_t>(fstr),
|
|
|
|
|
std::istream_iterator<uint8_t>());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// utils pertaining to native registers...
|
|
|
|
|
/// </summary>
|
|
|
|
|