minor improvements

This commit is contained in:
Akash Mozumdar 2021-03-08 08:41:34 -07:00
parent 54a285b53b
commit acc85f3a86
5 changed files with 16 additions and 15 deletions

View File

@ -5,7 +5,7 @@ namespace
{ {
char* GetCppExceptionInfo(EXCEPTION_POINTERS* exception) char* GetCppExceptionInfo(EXCEPTION_POINTERS* exception)
{ {
// See https://blogs.msdn.microsoft.com/oldnewthing/20100730-00/?p=13273 // https://blogs.msdn.microsoft.com/oldnewthing/20100730-00/?p=13273
// Not very reliable so use __try // Not very reliable so use __try
__try { return ((char****)exception->ExceptionRecord->ExceptionInformation[2])[3][1][1] + 8; } __try { return ((char****)exception->ExceptionRecord->ExceptionInformation[2])[3][1][1] + 8; }
__except (EXCEPTION_EXECUTE_HANDLER) { return "Could not find"; } __except (EXCEPTION_EXECUTE_HANDLER) { return "Could not find"; }

View File

@ -47,7 +47,7 @@ struct PrettyWindow : QDialog, Localizer
PrettyWindow(const char* name) PrettyWindow(const char* name)
{ {
ui.setupUi(this); ui.setupUi(this);
ui.display->setGraphicsEffect(&outliner); ui.display->setGraphicsEffect(outliner = new Outliner);
setWindowFlags(Qt::FramelessWindowHint); setWindowFlags(Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_TranslucentBackground);
@ -56,14 +56,14 @@ struct PrettyWindow : QDialog, Localizer
if (font.fromString(settings.value(FONT, font.toString()).toString())) ui.display->setFont(font); if (font.fromString(settings.value(FONT, font.toString()).toString())) ui.display->setFont(font);
SetBackgroundColor(settings.value(BG_COLOR, backgroundColor).value<QColor>()); SetBackgroundColor(settings.value(BG_COLOR, backgroundColor).value<QColor>());
SetTextColor(settings.value(TEXT_COLOR, TextColor()).value<QColor>()); SetTextColor(settings.value(TEXT_COLOR, TextColor()).value<QColor>());
outliner.color = settings.value(OUTLINE_COLOR, outliner.color).value<QColor>(); outliner->color = settings.value(OUTLINE_COLOR, outliner->color).value<QColor>();
outliner.size = settings.value(OUTLINE_SIZE, outliner.size).toDouble(); outliner->size = settings.value(OUTLINE_SIZE, outliner->size).toDouble();
menu.addAction(FONT, this, &PrettyWindow::RequestFont); menu.addAction(FONT, this, &PrettyWindow::RequestFont);
menu.addAction(BG_COLOR, [this] { SetBackgroundColor(colorPrompt(this, backgroundColor, BG_COLOR)); }); menu.addAction(BG_COLOR, [this] { SetBackgroundColor(colorPrompt(this, backgroundColor, BG_COLOR)); });
menu.addAction(TEXT_COLOR, [this] { SetTextColor(colorPrompt(this, TextColor(), TEXT_COLOR)); }); menu.addAction(TEXT_COLOR, [this] { SetTextColor(colorPrompt(this, TextColor(), TEXT_COLOR)); });
QAction* outlineAction = menu.addAction(TEXT_OUTLINE, this, &PrettyWindow::SetOutline); QAction* outlineAction = menu.addAction(TEXT_OUTLINE, this, &PrettyWindow::SetOutline);
outlineAction->setCheckable(true); outlineAction->setCheckable(true);
outlineAction->setChecked(outliner.size >= 0); outlineAction->setChecked(outliner->size >= 0);
connect(ui.display, &QLabel::customContextMenuRequested, [this](QPoint point) { menu.exec(mapToGlobal(point)); }); connect(ui.display, &QLabel::customContextMenuRequested, [this](QPoint point) { menu.exec(mapToGlobal(point)); });
} }
@ -113,13 +113,13 @@ private:
{ {
if (enable) if (enable)
{ {
QColor color = colorPrompt(this, outliner.color, OUTLINE_COLOR); QColor color = colorPrompt(this, outliner->color, OUTLINE_COLOR);
if (color.isValid()) outliner.color = color; if (color.isValid()) outliner->color = color;
outliner.size = QInputDialog::getDouble(this, OUTLINE_SIZE, OUTLINE_SIZE_INFO, 0.5, 0, INT_MAX, 2, nullptr, Qt::WindowCloseButtonHint); outliner->size = QInputDialog::getDouble(this, OUTLINE_SIZE, OUTLINE_SIZE_INFO, 0.5, 0, INT_MAX, 2, nullptr, Qt::WindowCloseButtonHint);
} }
else outliner.size = -1; else outliner->size = -1;
settings.setValue(OUTLINE_COLOR, outliner.color.name(QColor::HexArgb)); settings.setValue(OUTLINE_COLOR, outliner->color.name(QColor::HexArgb));
settings.setValue(OUTLINE_SIZE, outliner.size); settings.setValue(OUTLINE_SIZE, outliner->size);
} }
void paintEvent(QPaintEvent*) override void paintEvent(QPaintEvent*) override
@ -128,7 +128,7 @@ private:
} }
QColor backgroundColor{ palette().window().color() }; QColor backgroundColor{ palette().window().color() };
struct : QGraphicsEffect struct Outliner : QGraphicsEffect
{ {
void draw(QPainter* painter) override void draw(QPainter* painter) override
{ {
@ -148,7 +148,7 @@ private:
} }
QColor color{ Qt::black }; QColor color{ Qt::black };
double size = -1; double size = -1;
} outliner; }* outliner;
}; };
class ExtraWindow : public PrettyWindow class ExtraWindow : public PrettyWindow

View File

@ -58,7 +58,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
{ {
static auto _ = GetSelectedProcessId = (DWORD(*)())sentenceInfo["DWORD (*GetSelectedProcessId)()"]; static auto _ = GetSelectedProcessId = (DWORD(*)())sentenceInfo["DWORD (*GetSelectedProcessId)()"];
if (sentenceInfo["text number"] == 0) return false; if (sentenceInfo["text number"] == 0) return false;
if (sentenceInfo["current select"] && !regex) if (auto processName = GetModuleFilename(sentenceInfo["process id"])) if (/*sentenceInfo["current select"] && */!regex) if (auto processName = GetModuleFilename(sentenceInfo["process id"]))
{ {
std::ifstream stream(REGEX_SAVE_FILE, std::ios::binary); std::ifstream stream(REGEX_SAVE_FILE, std::ios::binary);
BlockMarkupIterator savedFilters(stream, Array<std::wstring_view>{ L"|PROCESS|", L"|FILTER|" }); BlockMarkupIterator savedFilters(stream, Array<std::wstring_view>{ L"|PROCESS|", L"|FILTER|" });

View File

@ -62,7 +62,7 @@ struct SearchParam
BYTE pattern[PATTERN_SIZE] = { x64 ? 0xcc : 0x55, x64 ? 0xcc : 0x8b, x64 ? 0x48 : 0xec, 0x89 }; // pattern in memory to search for BYTE pattern[PATTERN_SIZE] = { x64 ? 0xcc : 0x55, x64 ? 0xcc : 0x8b, x64 ? 0x48 : 0xec, 0x89 }; // pattern in memory to search for
int length = x64 ? 4 : 3, // length of pattern (zero means this SearchParam is invalid and the default should be used) int length = x64 ? 4 : 3, // length of pattern (zero means this SearchParam is invalid and the default should be used)
offset = x64 ? 2 : 0, // offset from start of pattern to add hook offset = x64 ? 2 : 0, // offset from start of pattern to add hook
searchTime = 20000, // ms searchTime = 30000, // ms
maxRecords = 100000, maxRecords = 100000,
codepage = SHIFT_JIS; codepage = SHIFT_JIS;
uintptr_t padding = 0, // same as hook param padding uintptr_t padding = 0, // same as hook param padding

View File

@ -68,6 +68,7 @@ namespace Engine
ConsoleOutput("Textractor: hijacking process located from 0x%p to 0x%p", processStartAddress, processStopAddress); ConsoleOutput("Textractor: hijacking process located from 0x%p to 0x%p", processStartAddress, processStopAddress);
DetermineEngineType(); DetermineEngineType();
if (processStartAddress + 0x40000 > processStopAddress) ConsoleOutput("Textractor: WARNING injected process is very small, possibly a dummy!");
}(), 0); }(), 0);
} }