2024-07-11 12:35:58 +00:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
2024-07-11 13:16:50 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
2024-07-11 12:35:58 +00:00
|
|
|
#include "ntapi.h"
|
|
|
|
|
2024-12-05 16:21:35 +00:00
|
|
|
NtClose_t NtClose = nullptr;
|
2024-07-11 12:35:58 +00:00
|
|
|
NtSetInformationFile_t NtSetInformationFile = nullptr;
|
2024-12-05 16:21:35 +00:00
|
|
|
NtCreateThread_t NtCreateThread = nullptr;
|
|
|
|
NtTerminateThread_t NtTerminateThread = nullptr;
|
2024-12-08 16:30:33 +00:00
|
|
|
NtQueueApcThreadEx_t NtQueueApcThreadEx = nullptr;
|
2024-07-11 12:35:58 +00:00
|
|
|
|
|
|
|
namespace Common::NtApi {
|
|
|
|
|
|
|
|
void Initialize() {
|
|
|
|
HMODULE nt_handle = GetModuleHandleA("ntdll.dll");
|
|
|
|
|
|
|
|
// http://stackoverflow.com/a/31411628/4725495
|
2024-12-05 16:21:35 +00:00
|
|
|
NtClose = (NtClose_t)GetProcAddress(nt_handle, "NtClose");
|
2024-07-11 12:35:58 +00:00
|
|
|
NtSetInformationFile =
|
|
|
|
(NtSetInformationFile_t)GetProcAddress(nt_handle, "NtSetInformationFile");
|
2024-12-05 16:21:35 +00:00
|
|
|
NtCreateThread = (NtCreateThread_t)GetProcAddress(nt_handle, "NtCreateThread");
|
|
|
|
NtTerminateThread = (NtTerminateThread_t)GetProcAddress(nt_handle, "NtTerminateThread");
|
2024-12-08 16:30:33 +00:00
|
|
|
NtQueueApcThreadEx = (NtQueueApcThreadEx_t)GetProcAddress(nt_handle, "NtQueueApcThreadEx");
|
2024-07-11 12:35:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Common::NtApi
|
2024-07-11 13:16:50 +00:00
|
|
|
|
|
|
|
#endif
|