Refactored dynamically linking ntdll

This commit is contained in:
mkrsym1
2024-01-07 20:51:55 +02:00
parent 9f011ff103
commit 35cd117ffc
4 changed files with 31 additions and 19 deletions

View File

@ -1,6 +1,5 @@
#include <windows.h>
#include <ntdll.h>
#include <ace.h>
#include <game.h>
#include <core.h>
@ -8,6 +7,9 @@
#include <msg.h>
#include <tx.h>
#define NTDLL_DYNAMIC_LINK_IMPL
#include <ntdll.h>
#include <main.h>
HMODULE this_module;
@ -76,7 +78,7 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) {
this_module = instance;
// Dynamically link functions from ntdll
ntdll_link();
_ntdll_link();
// Detect which game the user is trying to run
struct game_data game;

View File

@ -1,11 +0,0 @@
#include <ntdll.h>
LdrRegisterDllNotification_t LdrRegisterDllNotification;
LdrUnregisterDllNotification_t LdrUnregisterDllNotification;
void ntdll_link() {
HMODULE ntdll = GetModuleHandleA("ntdll.dll");
LdrRegisterDllNotification = (LdrRegisterDllNotification_t)GetProcAddress(ntdll, "LdrRegisterDllNotification");
LdrUnregisterDllNotification = (LdrUnregisterDllNotification_t)GetProcAddress(ntdll, "LdrUnregisterDllNotification");
}