[+] bool Aurora::AddBlockedDLL(...)
This commit is contained in:
parent
74b8910bf9
commit
6a3ff1c62f
@ -23,6 +23,46 @@ namespace Aurora
|
||||
LPCSTR lpProcName);
|
||||
#endif
|
||||
|
||||
static AuUInt32 gBlockedDLLTable[32] {};
|
||||
|
||||
AUKN_SYM bool AddBlockedDLL(const char *pString)
|
||||
{
|
||||
if (!pString)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto uHash = AuFnv1a32Runtime(pString, strlen(pString));
|
||||
|
||||
for (AU_ITERATE_N(i, AuArraySize(gBlockedDLLTable)))
|
||||
{
|
||||
if (gBlockedDLLTable[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
gBlockedDLLTable[i] = uHash;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsBlocked(const char *pString)
|
||||
{
|
||||
auto uHash = AuFnv1a32Runtime(pString, strlen(pString));
|
||||
|
||||
for (AU_ITERATE_N(i, AuArraySize(gBlockedDLLTable)))
|
||||
{
|
||||
if (gBlockedDLLTable[i] == uHash)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void InitNTAddresses()
|
||||
{
|
||||
#if defined(AURORA_PLATFORM_WIN32)
|
||||
@ -30,10 +70,15 @@ namespace Aurora
|
||||
pGetProcAddress = GetProcAddress;
|
||||
|
||||
#define ADD_LOAD_LIB(name) \
|
||||
auto h ## name = GetModuleHandleW(k## name ## DllName); \
|
||||
\
|
||||
HMODULE h ## name {}; \
|
||||
if (!IsBlocked(#name)) \
|
||||
{ \
|
||||
h ## name = GetModuleHandleW(k## name ## DllName); \
|
||||
if (!h ## name) \
|
||||
{ \
|
||||
h ## name = pLoadLibraryW(k## name ## DllName); \
|
||||
} \
|
||||
}
|
||||
|
||||
ADD_LOAD_LIB(Kernel32);
|
||||
|
Loading…
Reference in New Issue
Block a user