From 2e1eb418478b4e5c789d9332da3919b682edcd92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Sun, 13 Aug 2023 14:44:48 +0200 Subject: [PATCH] Minor code clean-up --- Injector/Injector.cpp | 15 +++++++++++++++ Injector/Injector.h | 16 ++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Injector/Injector.cpp b/Injector/Injector.cpp index 118f504..fc43494 100644 --- a/Injector/Injector.cpp +++ b/Injector/Injector.cpp @@ -27,6 +27,21 @@ Injector* Injector::Get() Injector::Injector() { } +bool Injector::icompare_pred(const unsigned char a, const unsigned char b) +{ + return std::tolower(a) == std::tolower(b); +} + +bool Injector::icompare(const std::wstring& a, const std::wstring& b) const +{ + if (a.length() == b.length()) + { + return std::equal(b.begin(), b.end(), + a.begin(), icompare_pred); + } + return false; +} + // Injects a module (fully qualified path) via process id void Injector::InjectLib(DWORD ProcID, const std::wstring& Path) { diff --git a/Injector/Injector.h b/Injector/Injector.h index 3e80186..5e5100e 100644 --- a/Injector/Injector.h +++ b/Injector/Injector.h @@ -49,19 +49,7 @@ class Injector // Case-insensitive string comparison utility functions // - static bool icompare_pred(unsigned char a, unsigned char b) - { - return std::tolower(a) == std::tolower(b); - } + static bool icompare_pred(unsigned char a, unsigned char b); - bool icompare(std::wstring const& a, std::wstring const& b) const - { - if (a.length() == b.length()) { - return std::equal(b.begin(), b.end(), - a.begin(), icompare_pred); - } - else { - return false; - } - } + bool icompare(std::wstring const& a, std::wstring const& b) const; };