will these two be compatable if not give me fixes #include <ntifs.h> #include <ntddk.h>…
- User
will these two be compatable if not give me fixes
#include <ntifs.h> #include <ntddk.h>
// ========================================================== // Definitions and Macros // ==========================================================
#define TARGET_PROCESS_NAME L"notepad.exe" // Replace with your target process name #define MY_WNF_STATE_NAME 0x41C64E6DA3BC1074ULL // WNF_AUDC_CAPTURE
// Windows Build Numbers #define WINDOWS_1803 17134 #define WINDOWS_1809 17763 #define WINDOWS_1903 18362 #define WINDOWS_1909 18363 #define WINDOWS_2004 19041 #define WINDOWS_20H2 19569 #define WINDOWS_21H1 20180
// Page size definitions #define PAGE_OFFSET_SIZE 12 #define PMASK 0x000FFFFFFFFFF000ull // Corrected PMASK for x64
// ========================================================== // Function Pointer Types for WNF (Undocumented APIs) // ==========================================================
typedef ULONG64 WNF_STATE_NAME; typedef ULONG64 WNF_CHANGE_STAMP;
typedef enum _WNF_SUBSCRIPTION_FLAG { WnfSubscriptionNone = 0x0, WnfSubscriptionPublishCurrentState = 0x1, // Add other flags as needed } WNF_SUBSCRIPTION_FLAG;
typedef struct _WNF_SUBSCRIPTION { // Define necessary fields based on WNF structures } WNF_SUBSCRIPTION, PWNF_SUBSCRIPTION;
typedef struct _WNF_TYPE_ID { // Define Type ID structure based on WNF specifications } WNF_TYPE_ID, PCWNF_TYPE_ID;
// Function pointer typedefs typedef NTSTATUS(PExSubscribeWnfStateChange)( PWNF_SUBSCRIPTION Subscription, WNF_STATE_NAME StateName, WNF_SUBSCRIPTION_FLAG SubscriptionFlag, PVOID Callback, PVOID CallbackContext, PCWNF_TYPE_ID TypeId, PVOID DeliveryDescriptor, ULONG DeliveryDescriptorSize );
typedef NTSTATUS(PExPublishWnfStateData)( PCWNF_STATE_NAME StateName, PVOID Buffer, ULONG Length, PCWNF_TYPE_ID TypeId, PVOID ExplicitScope, ULONG MatchingChangeStamp );
typedef NTSTATUS(PExUnsubscribeWnfStateChange)( PWNF_SUBSCRIPTION Subscription );
// Global function pointers PExPublishWnfStateData ExPublishWnfStateDataFunc = NULL; PExUnsubscribeWnfStateChange ExUnsubscribeWnfStateChangeFunc = NULL;
// ========================================================== // Data Structures // ==========================================================
typedef struct _INSTRUCTIONS { BOOLEAN close; BOOLEAN read; BOOLEAN write; BOOLEAN reqBase; UINT_PTR processId; UINT_PTR address; ULONGLONG size; PVOID bufferAddress; PVOID output; ULONG64 baseAddress; char moduleName[256]; char data[1024]; // Added to match user-mode } INSTRUCTIONS, PINSTRUCTIONS;
// ========================================================== // Function Declarations // ==========================================================
NTKERNELAPI PVOID PsGetProcessSectionBaseAddress( __in PEPROCESS Process );
PVOID GetProcessBaseAddress(HANDLE pid); DWORD GetUserDirectoryTableBaseOffset(); ULONG_PTR GetProcessCr3(PEPROCESS pProcess); ULONG_PTR GetKernelDirBase(); NTSTATUS ReadVirtual(uint64_t dirbase, uint64_t address, uint8_t buffer, SIZE_T size, SIZE_T read); NTSTATUS WriteVirtual(uint64_t dirbase, uint64_t address, uint8_t buffer, SIZE_T size, SIZE_T written); NTSTATUS ReadPhysicalAddress(PVOID TargetAddress, PVOID lpBuffer, SIZE_T Size, SIZE_T BytesRead); NTSTATUS WritePhysicalAddress(PVOID TargetAddress, PVOID lpBuffer, SIZE_T Size, SIZE_T BytesWritten); uint64_t TranslateLinearAddress(uint64_t directoryTableBase, uint64_t virtualAddress); NTSTATUS ReadProcessMemory(int pid, PVOID Address, PVOID AllocatedBuffer, SIZE_T size, SIZE_T* read); NTSTATUS WriteProcessMemory(int pid, PVOID Address, PVOID AllocatedBuffer, SIZE_T size, SIZE_T* written); VOID ProcessNotifyCallback( __in HANDLE ParentId, __in HANDLE ProcessId, __in BOOLEAN Create ); VOID DriverUnload(PDRIVER_OBJECT DriverObject);
- Assistant