Skip to content

Commit

Permalink
Merge pull request #8 from matty45/missing-inline-specifiers
Browse files Browse the repository at this point in the history
add missing inline declarations
  • Loading branch information
kem0x authored Mar 6, 2023
2 parents 449232e + dba0722 commit 297028c
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions memcury.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace Memcury
{
extern "C" IMAGE_DOS_HEADER __ImageBase;

auto GetCurrentModule() -> HMODULE
inline auto GetCurrentModule() -> HMODULE
{
return reinterpret_cast<HMODULE>(&__ImageBase);
}
Expand All @@ -88,7 +88,7 @@ namespace Memcury
return !str[h] ? 5381 : (StrHash(str, h + 1) * 33) ^ str[h];
}

auto IsSamePage(void* A, void* B) -> bool
inline auto IsSamePage(void* A, void* B) -> bool
{
MEMORY_BASIC_INFORMATION InfoA;
if (!VirtualQuery(A, &InfoA, sizeof(InfoA)))
Expand All @@ -105,7 +105,7 @@ namespace Memcury
return InfoA.BaseAddress == InfoB.BaseAddress;
}

auto GetModuleStartAndEnd() -> std::pair<uintptr_t, uintptr_t>
inline auto GetModuleStartAndEnd() -> std::pair<uintptr_t, uintptr_t>
{
auto HModule = GetCurrentModule();
auto NTHeaders = reinterpret_cast<PIMAGE_NT_HEADERS>((uintptr_t)HModule + reinterpret_cast<PIMAGE_DOS_HEADER>((uintptr_t)HModule)->e_lfanew);
Expand All @@ -116,7 +116,7 @@ namespace Memcury
return { dllStart, dllEnd };
}

auto CopyToClipboard(std::string str)
inline auto CopyToClipboard(std::string str)
{
auto mem = GlobalAlloc(GMEM_FIXED, str.size() + 1);
memcpy(mem, str.c_str(), str.size() + 1);
Expand Down Expand Up @@ -331,12 +331,12 @@ namespace Memcury
}
}

auto byteIsA(uint8_t byte, MNEMONIC opcode) -> bool
inline auto byteIsA(uint8_t byte, MNEMONIC opcode) -> bool
{
return byte == opcode;
}

auto byteIsAscii(uint8_t byte) -> bool
inline auto byteIsAscii(uint8_t byte) -> bool
{
static constexpr bool isAscii[0x100] = {
false, false, false, false, false, false, false, false, false, true, true, false, false, true, false, false,
Expand All @@ -360,7 +360,7 @@ namespace Memcury
return isAscii[byte];
}

bool isJump(uint8_t byte)
inline bool isJump(uint8_t byte)
{
return byte >= 0x70 && byte <= 0x7F;
}
Expand Down Expand Up @@ -1114,11 +1114,11 @@ namespace Memcury
}
};

std::vector<HOOK_INFO> Hooks;
std::vector<DWORD> HookProtections;
HANDLE ExceptionHandler;
inline std::vector<HOOK_INFO> Hooks;
inline std::vector<DWORD> HookProtections;
inline HANDLE ExceptionHandler;

long Handler(EXCEPTION_POINTERS* Exception)
inline long Handler(EXCEPTION_POINTERS* Exception)
{
if (Exception->ExceptionRecord->ExceptionCode == STATUS_GUARD_PAGE_VIOLATION)
{
Expand Down Expand Up @@ -1148,7 +1148,7 @@ namespace Memcury
return EXCEPTION_CONTINUE_SEARCH;
}

bool Init()
inline bool Init()
{
if (ExceptionHandler == nullptr)
{
Expand All @@ -1157,7 +1157,7 @@ namespace Memcury
return ExceptionHandler != nullptr;
}

bool AddHook(void* Target, void* Detour)
inline bool AddHook(void* Target, void* Detour)
{
if (ExceptionHandler == nullptr)
{
Expand All @@ -1179,7 +1179,7 @@ namespace Memcury
return true;
}

bool RemoveHook(void* Original)
inline bool RemoveHook(void* Original)
{
auto Itr = std::find_if(Hooks.begin(), Hooks.end(), [Original](const HOOK_INFO& Hook)
{ return Hook.Original == Original; });
Expand Down

0 comments on commit 297028c

Please sign in to comment.