/
githubmirror
/
x64dbg
Обзор
Документация
Войти
/
githubmirror
/
x64dbg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
development
src/cross/hex_viewer/File.cpp
56 строк
1 KB
Duncan Ogilvie
Fix formatting
17 авг 2025, 22:08
17 авг 2025, 22:08
b5f6df7
Код
Авторство
О чём код?
#include "File.h" File::File(duint virtualBase, const QString & fileName) : mVirtualBase(virtualBase) { mFile = new QFile(fileName, this); if(!mFile->open(QIODevice::ReadOnly)) { throw std::runtime_error("Failed to open file: " + fileName.toUtf8().toStdString()); } mSize = mFile->size(); } File::~File() { if(mFile != nullptr) { mFile->close(); delete mFile; mFile = nullptr; } } bool File::read(duint addr, void* dest, duint size) { if(addr < mVirtualBase || addr + size > mVirtualBase + mSize) { return false; } auto offset = addr - mVirtualBase; mFile->seek(offset); return mFile->read((char*)dest, size) == size; } bool File::getRange(duint addr, duint & base, duint & size) { if(!isValidPtr(addr)) { return false; } base = mVirtualBase; size = mSize; return true; } bool File::isCodePtr(duint addr) { return false; } bool File::isValidPtr(duint addr) { return addr >= mVirtualBase && addr < mVirtualBase + mSize; }