mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-22 05:22:32 +01:00
Make hInstance local, it doesn't need to be global
This commit is contained in:
parent
6bcd33ea54
commit
d767bf9766
@ -6,7 +6,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <Shlwapi.h>
|
#include <Shlwapi.h>
|
||||||
#include <ShlObj.h>
|
#include <ShlObj.h>
|
||||||
#include <cstdint>
|
|
||||||
#define _MEMORY_NO_CRT
|
#define _MEMORY_NO_CRT
|
||||||
#include "MemoryMgr.h"
|
#include "MemoryMgr.h"
|
||||||
|
|
||||||
@ -186,9 +185,9 @@ VOID WINAPI GetStartupInfoA_Hook(LPSTARTUPINFOA lpStartupInfo)
|
|||||||
pOrgGetStartupInfoA(lpStartupInfo);
|
pOrgGetStartupInfoA(lpStartupInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HINSTANCE hInstance;
|
|
||||||
void PatchIAT()
|
void PatchIAT()
|
||||||
{
|
{
|
||||||
|
HINSTANCE hInstance = GetModuleHandle(nullptr);
|
||||||
IMAGE_NT_HEADERS* ntHeader = (IMAGE_NT_HEADERS*)((DWORD)hInstance + ((IMAGE_DOS_HEADER*)hInstance)->e_lfanew);
|
IMAGE_NT_HEADERS* ntHeader = (IMAGE_NT_HEADERS*)((DWORD)hInstance + ((IMAGE_DOS_HEADER*)hInstance)->e_lfanew);
|
||||||
|
|
||||||
// Give _rwcseg proper access rights
|
// Give _rwcseg proper access rights
|
||||||
@ -260,7 +259,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|||||||
{
|
{
|
||||||
DisableThreadLibraryCalls(hinstDLL);
|
DisableThreadLibraryCalls(hinstDLL);
|
||||||
|
|
||||||
hInstance = GetModuleHandle(nullptr);
|
|
||||||
PatchIAT();
|
PatchIAT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user