43 lines
1.0 KiB
C++
43 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <Windows.h>
|
|
#include <winioctl.h>
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <Psapi.h>
|
|
#include <vector>
|
|
#include <string>
|
|
#include <stdexcept>
|
|
|
|
const ULONG IOCTL_AMDPDFW_MEMCPY = CTL_CODE(0x8000, 0x805, METHOD_BUFFERED, FILE_ANY_ACCESS);
|
|
|
|
typedef struct _PDFW_MEMCPY {
|
|
BYTE Reserved[16];
|
|
PVOID Destination;
|
|
PVOID Source;
|
|
PVOID Reserved2;
|
|
DWORD Size;
|
|
DWORD Reserved3;
|
|
} PDFW_MEMCPY, * PPDFW_MEMCPY;
|
|
|
|
inline class _pdfwkrnl {
|
|
private:
|
|
HANDLE hDevice;
|
|
|
|
public:
|
|
_pdfwkrnl();
|
|
~_pdfwkrnl();
|
|
bool attach();
|
|
void detach();
|
|
uint64_t get_ntoskrnl_base();
|
|
uint64_t get_ntoskrnl_export(const char* function);
|
|
bool read_virtual_memory(UINT64 address, void* buffer, ULONG size);
|
|
bool write_virtual_memory(UINT64 address, void* buffer, ULONG size);
|
|
|
|
template <typename T>
|
|
T read_virtual_memory(UINT64 address) {
|
|
T buffer{};
|
|
read_virtual_memory(address, &buffer, sizeof(T));
|
|
return buffer;
|
|
}
|
|
}pdfwkrnl; |