mirror of
https://github.com/fancycode/MemoryModule
synced 2026-06-06 15:44:28 +00:00
Replace defines with static consts.
This commit is contained in:
+2
-6
@@ -257,7 +257,7 @@ FinalizeSections(PMEMORYMODULE module)
|
|||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
uintptr_t imageOffset = (module->headers->OptionalHeader.ImageBase & 0xffffffff00000000);
|
uintptr_t imageOffset = (module->headers->OptionalHeader.ImageBase & 0xffffffff00000000);
|
||||||
#else
|
#else
|
||||||
#define imageOffset 0
|
static const uintptr_t imageOffset = 0;
|
||||||
#endif
|
#endif
|
||||||
SECTIONFINALIZEDATA sectionData;
|
SECTIONFINALIZEDATA sectionData;
|
||||||
sectionData.address = (LPVOID)((uintptr_t)section->Misc.PhysicalAddress | imageOffset);
|
sectionData.address = (LPVOID)((uintptr_t)section->Misc.PhysicalAddress | imageOffset);
|
||||||
@@ -298,9 +298,6 @@ FinalizeSections(PMEMORYMODULE module)
|
|||||||
if (!FinalizeSection(module, §ionData)) {
|
if (!FinalizeSection(module, §ionData)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#ifndef _WIN64
|
|
||||||
#undef imageOffset
|
|
||||||
#endif
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -838,7 +835,7 @@ static PIMAGE_RESOURCE_DIRECTORY_ENTRY _MemorySearchResourceEntry(
|
|||||||
#else
|
#else
|
||||||
// Resource names are always stored using 16bit characters, need to
|
// Resource names are always stored using 16bit characters, need to
|
||||||
// convert string we search for.
|
// convert string we search for.
|
||||||
#define MAX_LOCAL_KEY_LENGTH 2048
|
static const size_t MAX_LOCAL_KEY_LENGTH = 2048;
|
||||||
// In most cases resource names are short, so optimize for that by
|
// In most cases resource names are short, so optimize for that by
|
||||||
// using a pre-allocated array.
|
// using a pre-allocated array.
|
||||||
wchar_t _searchKeySpace[MAX_LOCAL_KEY_LENGTH+1];
|
wchar_t _searchKeySpace[MAX_LOCAL_KEY_LENGTH+1];
|
||||||
@@ -887,7 +884,6 @@ static PIMAGE_RESOURCE_DIRECTORY_ENTRY _MemorySearchResourceEntry(
|
|||||||
if (searchKeyLen > MAX_LOCAL_KEY_LENGTH) {
|
if (searchKeyLen > MAX_LOCAL_KEY_LENGTH) {
|
||||||
free(_searchKey);
|
free(_searchKey);
|
||||||
}
|
}
|
||||||
#undef MAX_LOCAL_KEY_LENGTH
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user