A tool for deriving PKG packet encryption keys for ps4 written in c++
| 1 | // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #ifdef _WIN32 |
| 5 | |
| 6 | #include "ntapi.h" |
| 7 | |
| 8 | NtClose_t NtClose = nullptr; |
| 9 | NtSetInformationFile_t NtSetInformationFile = nullptr; |
| 10 | NtCreateThread_t NtCreateThread = nullptr; |
| 11 | NtTerminateThread_t NtTerminateThread = nullptr; |
| 12 | NtQueueApcThreadEx_t NtQueueApcThreadEx = nullptr; |
| 13 | |
| 14 | namespace Common::NtApi { |
| 15 | |
| 16 | void Initialize() { |
| 17 | HMODULE nt_handle = GetModuleHandleA("ntdll.dll"); |
| 18 | |
| 19 | // http://stackoverflow.com/a/31411628/4725495 |
| 20 | NtClose = (NtClose_t)GetProcAddress(nt_handle, "NtClose"); |
| 21 | NtSetInformationFile = |
| 22 | (NtSetInformationFile_t)GetProcAddress(nt_handle, "NtSetInformationFile"); |
| 23 | NtCreateThread = (NtCreateThread_t)GetProcAddress(nt_handle, "NtCreateThread"); |
| 24 | NtTerminateThread = (NtTerminateThread_t)GetProcAddress(nt_handle, "NtTerminateThread"); |
| 25 | NtQueueApcThreadEx = (NtQueueApcThreadEx_t)GetProcAddress(nt_handle, "NtQueueApcThreadEx"); |
| 26 | } |
| 27 | |
| 28 | } // namespace Common::NtApi |
| 29 | |
| 30 | #endif |
| 31 |