forked from Public-Mirror/Textractor
small refactor
This commit is contained in:
parent
19e7df5631
commit
1817a3ac53
12
GUI/misc.cpp
12
GUI/misc.cpp
@ -4,16 +4,6 @@
|
||||
#include <Psapi.h>
|
||||
#include <QTextStream>
|
||||
|
||||
std::wstring S(const QString& S)
|
||||
{
|
||||
return S.toStdWString();
|
||||
}
|
||||
|
||||
QString S(const std::wstring& S)
|
||||
{
|
||||
return QString::fromStdWString(S);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
std::optional<HookParam> ParseRCode(QString RCode)
|
||||
@ -221,7 +211,7 @@ namespace
|
||||
if (!(hp.type & MODULE_OFFSET))
|
||||
if (AutoHandle<> process = OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, FALSE, processId))
|
||||
if (MEMORY_BASIC_INFORMATION info = {}; VirtualQueryEx(process, (LPCVOID)hp.address, &info, sizeof(info)))
|
||||
if (auto moduleName = Util::GetModuleFileName(processId, (HMODULE)info.AllocationBase))
|
||||
if (auto moduleName = Util::GetModuleFilename(processId, (HMODULE)info.AllocationBase))
|
||||
{
|
||||
hp.type |= MODULE_OFFSET;
|
||||
hp.address -= (uint64_t)info.AllocationBase;
|
||||
|
@ -6,13 +6,14 @@
|
||||
class QAutoFile
|
||||
{
|
||||
public:
|
||||
QAutoFile(QString name, QIODevice::OpenMode mode) : f(name) { f.open(mode); }
|
||||
QAutoFile(const QString& name, QIODevice::OpenMode mode) : f(name) { f.open(mode); }
|
||||
QFile* operator->() { return &f; }
|
||||
|
||||
private:
|
||||
QFile f;
|
||||
};
|
||||
|
||||
std::wstring S(const QString& S);
|
||||
QString S(const std::wstring& S);
|
||||
inline std::wstring S(const QString& S) { return { S.toStdWString() }; }
|
||||
inline QString S(const std::wstring& S) { return QString::fromStdWString(S); }
|
||||
std::optional<HookParam> ParseCode(QString HCode);
|
||||
QString GenerateCode(HookParam hp, DWORD processId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user