The way to Unity, pt.1 (#1659)

This commit is contained in:
Daniel R.
2024-12-05 17:21:35 +01:00
committed by GitHub
parent 2380f2f9c9
commit 98f0cb65d7
8 changed files with 564 additions and 29 deletions

View File

@@ -5,8 +5,11 @@
#include "ntapi.h"
NtClose_t NtClose = nullptr;
NtDelayExecution_t NtDelayExecution = nullptr;
NtSetInformationFile_t NtSetInformationFile = nullptr;
NtCreateThread_t NtCreateThread = nullptr;
NtTerminateThread_t NtTerminateThread = nullptr;
namespace Common::NtApi {
@@ -14,9 +17,12 @@ void Initialize() {
HMODULE nt_handle = GetModuleHandleA("ntdll.dll");
// http://stackoverflow.com/a/31411628/4725495
NtClose = (NtClose_t)GetProcAddress(nt_handle, "NtClose");
NtDelayExecution = (NtDelayExecution_t)GetProcAddress(nt_handle, "NtDelayExecution");
NtSetInformationFile =
(NtSetInformationFile_t)GetProcAddress(nt_handle, "NtSetInformationFile");
NtCreateThread = (NtCreateThread_t)GetProcAddress(nt_handle, "NtCreateThread");
NtTerminateThread = (NtTerminateThread_t)GetProcAddress(nt_handle, "NtTerminateThread");
}
} // namespace Common::NtApi