mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 17:04:12 +08:00
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 <Psapi.h>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
std::wstring S(const QString& S)
|
|
||||||
{
|
|
||||||
return S.toStdWString();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString S(const std::wstring& S)
|
|
||||||
{
|
|
||||||
return QString::fromStdWString(S);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
std::optional<HookParam> ParseRCode(QString RCode)
|
std::optional<HookParam> ParseRCode(QString RCode)
|
||||||
@ -221,7 +211,7 @@ namespace
|
|||||||
if (!(hp.type & MODULE_OFFSET))
|
if (!(hp.type & MODULE_OFFSET))
|
||||||
if (AutoHandle<> process = OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, FALSE, processId))
|
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 (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.type |= MODULE_OFFSET;
|
||||||
hp.address -= (uint64_t)info.AllocationBase;
|
hp.address -= (uint64_t)info.AllocationBase;
|
||||||
|
@ -6,13 +6,14 @@
|
|||||||
class QAutoFile
|
class QAutoFile
|
||||||
{
|
{
|
||||||
public:
|
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; }
|
QFile* operator->() { return &f; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QFile f;
|
QFile f;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::wstring S(const QString& S);
|
inline std::wstring S(const QString& S) { return { S.toStdWString() }; }
|
||||||
QString S(const std::wstring& S);
|
inline QString S(const std::wstring& S) { return QString::fromStdWString(S); }
|
||||||
std::optional<HookParam> ParseCode(QString HCode);
|
std::optional<HookParam> ParseCode(QString HCode);
|
||||||
QString GenerateCode(HookParam hp, DWORD processId);
|
QString GenerateCode(HookParam hp, DWORD processId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user