Skip to content

Commit

Permalink
Minor code clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
nefarius committed Aug 13, 2023
1 parent 671cad5 commit 2e1eb41
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
15 changes: 15 additions & 0 deletions Injector/Injector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
16 changes: 2 additions & 14 deletions Injector/Injector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

0 comments on commit 2e1eb41

Please sign in to comment.