├── .deepsource.toml ├── .gitignore ├── IOCTL.png ├── arial.ttf ├── flow-chart.png ├── KernelReadWriteDriver_UserMode_IMGUI ├── x64 │ └── Release │ │ ├── KernelReadWriteDriver_UserMode_IMGUI.vcxproj.FileListAbsolute.txt │ │ ├── Utils.obj │ │ ├── imgui.obj │ │ ├── main.obj │ │ ├── vc143.pdb │ │ ├── global.obj │ │ ├── TextEditor.obj │ │ ├── imgui_demo.obj │ │ ├── imgui_draw.obj │ │ ├── imgui_impl_dx9.obj │ │ ├── imgui_widgets.obj │ │ ├── imgui_impl_win32.obj │ │ ├── KernelRe.d0ff7ecf.tlog │ │ ├── CL.read.1.tlog │ │ ├── CL.write.1.tlog │ │ ├── link.read.1.tlog │ │ ├── CL.command.1.tlog │ │ ├── link.write.1.tlog │ │ ├── link.command.1.tlog │ │ ├── KernelReadWriteDriver_UserMode_IMGUI.lastbuildstate │ │ └── Cl.items.tlog │ │ ├── KernelReadWriteDriver_UserMode_IMGUI.iobj │ │ ├── KernelReadWriteDriver_UserMode_IMGUI.ipdb │ │ ├── KernelReadWriteDriver_UserMode_IMGUI.Build.CppClean.log │ │ ├── KernelReadWriteDriver_UserMode_IMGUI.exe.recipe │ │ └── KernelReadWriteDriver_UserMode_IMGUI.log ├── global.cpp ├── curl │ ├── libcurl.lib │ ├── libcurl_debug.lib │ ├── stdcheaders.h │ ├── mprintf.h │ ├── options.h │ ├── header.h │ ├── curlver.h │ ├── easy.h │ ├── urlapi.h │ └── multi.h ├── directx │ ├── d3dx9.lib │ ├── d3dx9.h │ ├── d3dx9shape.h │ └── d3dx9xof.h ├── global.h ├── KernelReadWriteDriver_UserMode_IMGUI.vcxproj.user ├── Utils.h ├── Communications.hpp ├── Theme │ └── Theme.h ├── imgui │ ├── imgui_impl_dx9.h │ ├── imgui_impl_win32.h │ ├── imconfig.h │ └── TextEditor.h ├── Structs.h ├── Memory.h ├── guidev.h ├── Utils.cpp ├── Kernelinterface.hpp ├── KernelReadWriteDriver_UserMode_IMGUI.vcxproj.filters ├── KernelReadWriteDriver_UserMode_IMGUI.vcxproj └── main.cpp ├── KernelReadWriteDriver ├── messages.h ├── Events.h ├── events.h ├── Data.h ├── data.h ├── KernelReadWrite.h ├── KernelReadWriteDriver.vcxproj.user ├── memory.h ├── memory.c ├── Communication.h ├── Events.c ├── events.c ├── KernelReadWriteDriver.vcxproj.filters ├── KernelReadWriteDriver.inf ├── KernelReadWrite.c ├── KernelReadWriteDriver.vcxproj └── Communication.c ├── IOCTL.dot ├── flow-chart.dot ├── autoinstall.ps1 ├── KernelReadWriteDriver.sln ├── cheat-entries.md └── README.md /.deepsource.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[analyzers]] 4 | name = "cxx" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/* 2 | .vs 3 | KernelReadWriteDriver/KernelReadWriteDriver.vcxproj.user -------------------------------------------------------------------------------- /IOCTL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/IOCTL.png -------------------------------------------------------------------------------- /arial.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/arial.ttf -------------------------------------------------------------------------------- /flow-chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/flow-chart.png -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelReadWriteDriver_UserMode_IMGUI.vcxproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /KernelReadWriteDriver/messages.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define DebugMessage(x, ...) DbgPrintEx(0,0,x,__VA_ARGS__) 4 | 5 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/global.cpp: -------------------------------------------------------------------------------- 1 | #include "global.h" 2 | 3 | KernelInterface Driver = KernelInterface("\\\\.\\RWDriver"); -------------------------------------------------------------------------------- /KernelReadWriteDriver/Events.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | PLOAD_IMAGE_NOTIFY_ROUTINE ImageLoadCB(PUNICODE_STRING FullImgName, HANDLE ProcId, PIMAGE_INFO ImgInfo); -------------------------------------------------------------------------------- /KernelReadWriteDriver/events.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | PLOAD_IMAGE_NOTIFY_ROUTINE ImageLoadCB(PUNICODE_STRING FullImgName, HANDLE ProcId, PIMAGE_INFO ImgInfo); -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/curl/libcurl.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/curl/libcurl.lib -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/directx/d3dx9.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/directx/d3dx9.lib -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/global.h: -------------------------------------------------------------------------------- 1 | #ifndef MY_GLOBALS_H 2 | #define MY_GLOBALS_H 3 | 4 | #include "Kernelinterface.hpp" 5 | 6 | extern KernelInterface Driver; 7 | 8 | #endif -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/Utils.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/Utils.obj -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/imgui.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/imgui.obj -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/main.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/main.obj -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/vc143.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/vc143.pdb -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/curl/libcurl_debug.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/curl/libcurl_debug.lib -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/global.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/global.obj -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/TextEditor.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/TextEditor.obj -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/imgui_demo.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/imgui_demo.obj -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/imgui_draw.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/imgui_draw.obj -------------------------------------------------------------------------------- /KernelReadWriteDriver/Data.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | wchar_t * ImageBuffer; 5 | ULONG ProcessId; 6 | ULONG BaseModuleAdress; 7 | PDEVICE_OBJECT pDeviceObject; 8 | UNICODE_STRING dev, dos; 9 | -------------------------------------------------------------------------------- /KernelReadWriteDriver/data.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | wchar_t * ImageBuffer; 5 | ULONG ProcessId; 6 | ULONG BaseModuleAdress; 7 | PDEVICE_OBJECT pDeviceObject; 8 | UNICODE_STRING dev, dos; 9 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/imgui_impl_dx9.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/imgui_impl_dx9.obj -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/imgui_widgets.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/imgui_widgets.obj -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/imgui_impl_win32.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/imgui_impl_win32.obj -------------------------------------------------------------------------------- /KernelReadWriteDriver/KernelReadWrite.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pRegistryPath); 5 | NTSTATUS UnloadDriver(PDRIVER_OBJECT pDriverObject); -------------------------------------------------------------------------------- /KernelReadWriteDriver/KernelReadWriteDriver.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelReadWriteDriver_UserMode_IMGUI.iobj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelReadWriteDriver_UserMode_IMGUI.iobj -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelReadWriteDriver_UserMode_IMGUI.ipdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelReadWriteDriver_UserMode_IMGUI.ipdb -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/KernelReadWriteDriver_UserMode_IMGUI.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbn-code/The-Kernel-Driver-Guide-External/HEAD/KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/KernelReadWriteDriver_UserMode_IMGUI.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.38.33130:TargetPlatformVersion=10.0.22621.0: 2 | Release|x64|C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\| 3 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelReadWriteDriver_UserMode_IMGUI.Build.CppClean.log: -------------------------------------------------------------------------------- 1 | c:\users\redhat\documents\github\the-kernel-driver-guide\x64\release\kernelreadwritedriver_usermode_imgui.pdb 2 | c:\users\redhat\documents\github\the-kernel-driver-guide\x64\release\kernelreadwritedriver_usermode_imgui.exe 3 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelReadWriteDriver_UserMode_IMGUI.exe.recipe: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\x64\Release\KernelReadWriteDriver_UserMode_IMGUI.exe 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/Utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "Structs.h" 4 | #include 5 | 6 | extern std::map keyStates; 7 | 8 | struct WindowSize { 9 | int width; 10 | int height; 11 | }; 12 | 13 | 14 | bool IsKeyPressed(int vkCode); 15 | 16 | void SetupHook(); 17 | 18 | bool WorldToScreen(Vec3 pos, Vec2& screen, float matrix[16], int windowWidth, int windowHeight); 19 | 20 | void Simulate_LeftClick(); 21 | 22 | void SimulateSpacebarPress(); 23 | 24 | WindowSize GetWinSize(DWORD ProcessId); -------------------------------------------------------------------------------- /IOCTL.dot: -------------------------------------------------------------------------------- 1 | digraph IOCTL { 2 | rankdir=LR; 3 | node [shape=box, style=filled, color=lightblue]; 4 | edge [color=blue]; 5 | 6 | "User Application" -> "CreateFile" [label="Open Device"]; 7 | "CreateFile" -> "Device Handle" [label="Returns Handle"]; 8 | "User Application" -> "DeviceIoControl" [label="Submit IOCTL Request"]; 9 | "DeviceIoControl" -> "Device Driver" [label="Passes IOCTL Request"]; 10 | "Device Driver" -> "DeviceIoControl" [label="Handles Request, Returns Result"]; 11 | "DeviceIoControl" -> "User Application" [label="Returns Result"]; 12 | } -------------------------------------------------------------------------------- /KernelReadWriteDriver/memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma warning (disable : 4047 4024 4022) 3 | #include "ntifs.h" 4 | 5 | NTSTATUS NTAPI MmCopyVirtualMemory 6 | ( 7 | PEPROCESS SourceProcess, 8 | PVOID SourceAdress, 9 | PEPROCESS TargetProcess, 10 | PVOID TargetAdress, 11 | SIZE_T BufferSize, 12 | KPROCESSOR_MODE PreviousMode, // KernelMode for Kernel 13 | PSIZE_T ReturnSize 14 | ); 15 | 16 | NTSTATUS KernelReadVirtualMemory(PEPROCESS Process, PVOID SourceAddress, PVOID TargetAdress, SIZE_T Size); 17 | NTSTATUS KernelWriteVirtualMemory(PEPROCESS Process, PVOID SourceAddress, PVOID TargetAdress, SIZE_T Size); -------------------------------------------------------------------------------- /KernelReadWriteDriver/memory.c: -------------------------------------------------------------------------------- 1 | #pragma warning (disable : 4047 4024 4022) 2 | 3 | #include "memory.h" 4 | 5 | NTSTATUS KernelReadVirtualMemory(PEPROCESS Process, PVOID SourceAddress, PVOID TargetAdress, SIZE_T Size) 6 | { 7 | PSIZE_T Bytes; 8 | 9 | return MmCopyVirtualMemory(Process, SourceAddress, PsGetCurrentProcess(), TargetAdress, Size, KernelMode, &Bytes); 10 | } 11 | 12 | NTSTATUS KernelWriteVirtualMemory(PEPROCESS Process, PVOID SourceAddress, PVOID TargetAdress, SIZE_T Size) 13 | { 14 | PSIZE_T Bytes; 15 | 16 | return MmCopyVirtualMemory(PsGetCurrentProcess(), SourceAddress, Process, TargetAdress, Size, KernelMode, &Bytes); 17 | } -------------------------------------------------------------------------------- /flow-chart.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | rankdir=LR; 3 | node [shape=box, style=filled, color="lightblue"]; 4 | edge [color="black"]; 5 | labelloc="t"; 6 | label="Process Flow"; 7 | 8 | StartDriver [label="Start the Driver"]; 9 | DriverRunning [label="Driver is Running", color="lightgreen"]; 10 | RunGame [label="Run the Game"]; 11 | GameRunning [label="Game is Running", color="lightgreen"]; 12 | StartUserModeApp [label="Start the User Mode Application"]; 13 | UserModeAppRunning [label="User Mode Application is Running", color="lightgreen"]; 14 | 15 | StartDriver -> DriverRunning; 16 | DriverRunning -> RunGame; 17 | RunGame -> GameRunning; 18 | GameRunning -> StartUserModeApp; 19 | StartUserModeApp -> UserModeAppRunning; 20 | } -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/Communications.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #define IO_SET_IMAGEBUFFER CTL_CODE(FILE_DEVICE_UNKNOWN, 0x666, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 5 | #define IO_GET_CLIENTADRESS CTL_CODE(FILE_DEVICE_UNKNOWN, 0x667, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 6 | #define IO_GET_PROCESSID CTL_CODE(FILE_DEVICE_UNKNOWN, 0x668, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 7 | #define IO_READ_REQUEST CTL_CODE(FILE_DEVICE_UNKNOWN, 0x669, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 8 | #define IO_WRITE_REQUEST CTL_CODE(FILE_DEVICE_UNKNOWN, 0x670, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 9 | 10 | typedef struct _KERNEL_READ_REQUEST 11 | { 12 | ULONG ProcessId; 13 | ULONG Address; 14 | PVOID pBuff; 15 | ULONG Size; 16 | } KERNEL_READ_REQUEST, * PKERNEL_READ_REQUEST; 17 | 18 | typedef struct _KERNEL_WRITE_REQUEST 19 | { 20 | ULONG ProcessId; 21 | ULONG Address; 22 | PVOID pBuff; 23 | ULONG Size; 24 | } KERNEL_WRITE_REQUEST, * PKERNEL_WRITE_REQUEST; 25 | -------------------------------------------------------------------------------- /KernelReadWriteDriver/Communication.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #define IO_SET_IMAGEBUFFER CTL_CODE(FILE_DEVICE_UNKNOWN, 0x666, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 5 | #define IO_GET_CLIENTADRESS CTL_CODE(FILE_DEVICE_UNKNOWN, 0x667, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 6 | #define IO_GET_PROCESSID CTL_CODE(FILE_DEVICE_UNKNOWN, 0x668, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 7 | #define IO_READ_REQUEST CTL_CODE(FILE_DEVICE_UNKNOWN, 0x669, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 8 | #define IO_WRITE_REQUEST CTL_CODE(FILE_DEVICE_UNKNOWN, 0x670, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) 9 | 10 | NTSTATUS IoControl(PDEVICE_OBJECT DeviceObject, PIRP Irp); 11 | NTSTATUS CloseCall(PDEVICE_OBJECT DeviceObject, PIRP Irp); 12 | NTSTATUS CreateCall(PDEVICE_OBJECT DeviceObject, PIRP Irp); 13 | 14 | typedef struct _KERNEL_READ_REQUEST 15 | { 16 | ULONG ProcessId; 17 | ULONG Address; 18 | PVOID pBuff; 19 | ULONG Size; 20 | } KERNEL_READ_REQUEST, * PKERNEL_READ_REQUEST; 21 | 22 | typedef struct _KERNEL_WRITE_REQUEST 23 | { 24 | ULONG ProcessId; 25 | ULONG Address; 26 | PVOID pBuff; 27 | ULONG Size; 28 | } KERNEL_WRITE_REQUEST, * PKERNEL_WRITE_REQUEST; 29 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/Theme/Theme.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "font.h" 3 | #include "fonts.hpp" 4 | 5 | class Theme { 6 | public: 7 | ImFont *font, *font1, *font2, *font3, *font4, *fontsp, *arial; 8 | void Register(ImGuiIO& io) { 9 | 10 | static const ImWchar icons_ranges[] = { ICON_MIN_FA, ICON_MAX_16_FA, 0 }; 11 | ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true; 12 | icons_config.FontDataOwnedByAtlas = false; 13 | 14 | ImFontConfig CustomFont; 15 | CustomFont.FontDataOwnedByAtlas = false; 16 | 17 | ImFontConfig font_cfg; 18 | font_cfg.FontDataOwnedByAtlas = false; 19 | 20 | arial = io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\Arial.ttf", 16); 21 | //font1 = io.Fonts->AddFontFromMemoryTTF(const_cast(Custom), sizeof(Custom), 16.f, &font_cfg); 22 | //font2 = io.Fonts->AddFontFromMemoryCompressedTTF(poppinsFont, 158240, 19.0f, &icons_config, icons_ranges); 23 | //font3 = io.Fonts->AddFontFromMemoryTTF(const_cast(Custom), sizeof(Custom), 17.5, &CustomFont); 24 | 25 | font = io.Fonts->AddFontFromMemoryTTF((void*)fontAwesome, sizeof(fontAwesome), 16.f, &icons_config, icons_ranges); 26 | 27 | } 28 | 29 | }; -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/imgui/imgui_impl_dx9.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX9 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 7 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 8 | 9 | // You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 10 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 11 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 12 | 13 | #pragma once 14 | #include "imgui.h" // IMGUI_IMPL_API 15 | 16 | struct IDirect3DDevice9; 17 | 18 | IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device); 19 | IMGUI_IMPL_API void ImGui_ImplDX9_Shutdown(); 20 | IMGUI_IMPL_API void ImGui_ImplDX9_NewFrame(); 21 | IMGUI_IMPL_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data); 22 | 23 | // Use if you want to reset your rendering device without losing Dear ImGui state. 24 | IMGUI_IMPL_API bool ImGui_ImplDX9_CreateDeviceObjects(); 25 | IMGUI_IMPL_API void ImGui_ImplDX9_InvalidateDeviceObjects(); 26 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/curl/stdcheaders.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_STDCHEADERS_H 2 | #define CURLINC_STDCHEADERS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include 28 | 29 | size_t fread(void *, size_t, size_t, FILE *); 30 | size_t fwrite(const void *, size_t, size_t, FILE *); 31 | 32 | int strcasecmp(const char *, const char *); 33 | int strncasecmp(const char *, const char *, size_t); 34 | 35 | #endif /* CURLINC_STDCHEADERS_H */ 36 | -------------------------------------------------------------------------------- /KernelReadWriteDriver/Events.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Callback function called when a new image is loaded into a process. 3 | * 4 | * This function is registered as a callback routine using the PLOAD_IMAGE_NOTIFY_ROUTINE type. 5 | * It is called whenever a new image is loaded into a process. In this case, the function checks 6 | * if the loaded image corresponds to the "ac_client.exe" process. If it does, it retrieves the 7 | * process ID and the base module address of the loaded image and stores them in the global variables 8 | * BaseModuleAdress and ProcessId respectively. 9 | * 10 | * @param FullImgName A pointer to a UNICODE_STRING structure that contains the full path of the loaded image. 11 | * @param ProcId The process ID of the process into which the image is loaded. 12 | * @param ImgInfo A pointer to an IMAGE_INFO structure that contains information about the loaded image. 13 | * @return STATUS_SUCCESS indicating that the callback was successful. 14 | */ 15 | 16 | #pragma warning (disable : 4047 4024 4311 4189) 17 | 18 | #include "Events.h" 19 | #include "messages.h" 20 | #include "Data.h" 21 | 22 | PLOAD_IMAGE_NOTIFY_ROUTINE ImageLoadCB(PUNICODE_STRING FullImgName, HANDLE ProcId, PIMAGE_INFO ImgInfo) 23 | { 24 | // Check if the loaded image corresponds to the "ac_client.exe" process 25 | if (wcsstr(FullImgName->Buffer, L"ac_client.exe")) 26 | { 27 | //DebugMessage("Image Found"); 28 | DebugMessage("Process Id Found: %d", ImgInfo->ImageBase); 29 | DebugMessage("BaseModuleAdress Found: %d", (ULONG)ProcId); 30 | 31 | // Store the base module address and the process ID in global variables 32 | BaseModuleAdress = ImgInfo->ImageBase; 33 | ProcessId = (ULONG)ProcId; 34 | } 35 | 36 | return STATUS_SUCCESS; 37 | } 38 | -------------------------------------------------------------------------------- /KernelReadWriteDriver/events.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Callback function called when a new image is loaded into a process. 3 | * 4 | * This function is registered as a callback routine using the PLOAD_IMAGE_NOTIFY_ROUTINE type. 5 | * It is called whenever a new image is loaded into a process. In this case, the function checks 6 | * if the loaded image corresponds to the "ac_client.exe" process. If it does, it retrieves the 7 | * process ID and the base module address of the loaded image and stores them in the global variables 8 | * BaseModuleAdress and ProcessId respectively. 9 | * 10 | * @param FullImgName A pointer to a UNICODE_STRING structure that contains the full path of the loaded image. 11 | * @param ProcId The process ID of the process into which the image is loaded. 12 | * @param ImgInfo A pointer to an IMAGE_INFO structure that contains information about the loaded image. 13 | * @return STATUS_SUCCESS indicating that the callback was successful. 14 | */ 15 | 16 | #pragma warning (disable : 4047 4024 4311 4189) 17 | 18 | #include "Events.h" 19 | #include "messages.h" 20 | #include "Data.h" 21 | 22 | PLOAD_IMAGE_NOTIFY_ROUTINE ImageLoadCB(PUNICODE_STRING FullImgName, HANDLE ProcId, PIMAGE_INFO ImgInfo) 23 | { 24 | // Check if the loaded image corresponds to the "ac_client.exe" process 25 | if (wcsstr(FullImgName->Buffer, L"ac_client.exe")) 26 | { 27 | //DebugMessage("Image Found"); 28 | DebugMessage("Process Id Found: %d", ImgInfo->ImageBase); 29 | DebugMessage("BaseModuleAdress Found: %d", (ULONG)ProcId); 30 | 31 | // Store the base module address and the process ID in global variables 32 | BaseModuleAdress = ImgInfo->ImageBase; 33 | ProcessId = (ULONG)ProcId; 34 | } 35 | 36 | return STATUS_SUCCESS; 37 | } 38 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/Structs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | struct Vec3 { 5 | float x = 0.0f; 6 | float y = 0.0f; 7 | float z = 0.0f; 8 | Vec3(float x, float y, float z) { 9 | this->x = x; 10 | this->y = y; 11 | this->z = z; 12 | } 13 | Vec3() {} 14 | 15 | Vec3 operator+ (Vec3& a) { 16 | return Vec3(x + a.x, y + a.y, z + a.z); 17 | } 18 | 19 | Vec3 operator- (Vec3& a) { 20 | return Vec3(x - a.x, y - a.y, z - a.z); 21 | } 22 | 23 | Vec3 operator/ (Vec3& a) { 24 | return Vec3(x / a.x, y / a.y, z / a.z); 25 | } 26 | 27 | Vec3 operator* (Vec3& a) { 28 | return Vec3(x * a.x, y * a.y, z * a.z); 29 | } 30 | 31 | float hypo3() { 32 | return sqrt(((x * x) + (y * y) + (z * z))); 33 | } 34 | }; 35 | 36 | struct Vec2 { 37 | float x = 0.0f; 38 | float y = 0.0f; 39 | Vec2(float x, float y) { 40 | this->x = x; 41 | this->y = y; 42 | } 43 | Vec2() {} 44 | 45 | Vec2 operator+ (Vec2& a) { 46 | return Vec2(x + a.x, y + a.y); 47 | } 48 | 49 | Vec2 operator- (Vec2& a) { 50 | return Vec2(x - a.x, y - a.y); 51 | } 52 | 53 | Vec2 operator/ (Vec2& a) { 54 | return Vec2(x / a.x, y / a.y); 55 | } 56 | 57 | Vec2 operator* (Vec2& a) { 58 | return Vec2(x * a.x, y * a.y); 59 | } 60 | 61 | float hypo3() { 62 | return sqrt(((x * x) + (y * y))); 63 | } 64 | }; 65 | 66 | struct Vec4 { 67 | float x = 0.0f; 68 | float y = 0.0f; 69 | float z = 0.0f; 70 | float w = 0.0f; 71 | 72 | Vec4(float x, float y, float z, float w) { 73 | this->x = x; 74 | this->y = y; 75 | this->z = z; 76 | this->w = w; 77 | } 78 | 79 | Vec4() {} 80 | }; 81 | 82 | struct ViewMat { 83 | float Matrix[16]{}; 84 | }; -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/directx/d3dx9.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (C) Microsoft Corporation. All Rights Reserved. 4 | // 5 | // File: d3dx9.h 6 | // Content: D3DX utility library 7 | // 8 | ////////////////////////////////////////////////////////////////////////////// 9 | 10 | #ifdef __D3DX_INTERNAL__ 11 | #error Incorrect D3DX header used 12 | #endif 13 | 14 | #ifndef __D3DX9_H__ 15 | #define __D3DX9_H__ 16 | 17 | 18 | // Defines 19 | #include 20 | 21 | #define D3DX_DEFAULT ((UINT) -1) 22 | #define D3DX_DEFAULT_NONPOW2 ((UINT) -2) 23 | #define D3DX_DEFAULT_FLOAT FLT_MAX 24 | #define D3DX_FROM_FILE ((UINT) -3) 25 | #define D3DFMT_FROM_FILE ((D3DFORMAT) -3) 26 | 27 | #ifndef D3DXINLINE 28 | #ifdef _MSC_VER 29 | #if (_MSC_VER >= 1200) 30 | #define D3DXINLINE __forceinline 31 | #else 32 | #define D3DXINLINE __inline 33 | #endif 34 | #else 35 | #ifdef __cplusplus 36 | #define D3DXINLINE inline 37 | #else 38 | #define D3DXINLINE 39 | #endif 40 | #endif 41 | #endif 42 | 43 | 44 | 45 | // Includes 46 | #include "d3d9.h" 47 | #include "d3dx9math.h" 48 | #include "d3dx9core.h" 49 | #include "d3dx9xof.h" 50 | #include "d3dx9mesh.h" 51 | #include "d3dx9shader.h" 52 | #include "d3dx9effect.h" 53 | 54 | #include "d3dx9tex.h" 55 | #include "d3dx9shape.h" 56 | #include "d3dx9anim.h" 57 | 58 | 59 | 60 | // Errors 61 | #define _FACDD 0x876 62 | #define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) 63 | 64 | enum _D3DXERR { 65 | D3DXERR_CANNOTMODIFYINDEXBUFFER = MAKE_DDHRESULT(2900), 66 | D3DXERR_INVALIDMESH = MAKE_DDHRESULT(2901), 67 | D3DXERR_CANNOTATTRSORT = MAKE_DDHRESULT(2902), 68 | D3DXERR_SKINNINGNOTSUPPORTED = MAKE_DDHRESULT(2903), 69 | D3DXERR_TOOMANYINFLUENCES = MAKE_DDHRESULT(2904), 70 | D3DXERR_INVALIDDATA = MAKE_DDHRESULT(2905), 71 | D3DXERR_LOADEDMESHASNODATA = MAKE_DDHRESULT(2906), 72 | D3DXERR_DUPLICATENAMEDFRAGMENT = MAKE_DDHRESULT(2907), 73 | D3DXERR_CANNOTREMOVELASTITEM = MAKE_DDHRESULT(2908), 74 | }; 75 | 76 | 77 | #endif //__D3DX9_H__ 78 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/curl/mprintf.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_MPRINTF_H 2 | #define CURLINC_MPRINTF_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include 28 | #include /* needed for FILE */ 29 | #include "curl.h" /* for CURL_EXTERN */ 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | CURL_EXTERN int curl_mprintf(const char *format, ...); 36 | CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...); 37 | CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...); 38 | CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, 39 | const char *format, ...); 40 | CURL_EXTERN int curl_mvprintf(const char *format, va_list args); 41 | CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args); 42 | CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args); 43 | CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, 44 | const char *format, va_list args); 45 | CURL_EXTERN char *curl_maprintf(const char *format, ...); 46 | CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* CURLINC_MPRINTF_H */ 53 | -------------------------------------------------------------------------------- /KernelReadWriteDriver/KernelReadWriteDriver.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {8E41214B-6785-4CFE-B992-037D68949A14} 18 | inf;inv;inx;mof;mc; 19 | 20 | 21 | 22 | 23 | Driver Files 24 | 25 | 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelRe.d0ff7ecf.tlog/Cl.items.tlog: -------------------------------------------------------------------------------- 1 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\global.cpp;C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\x64\Release\global.obj 2 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\imgui\imgui.cpp;C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\x64\Release\imgui.obj 3 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\imgui\imgui_demo.cpp;C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\x64\Release\imgui_demo.obj 4 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\imgui\imgui_draw.cpp;C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\x64\Release\imgui_draw.obj 5 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\imgui\imgui_impl_dx9.cpp;C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\x64\Release\imgui_impl_dx9.obj 6 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\imgui\imgui_impl_win32.cpp;C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\x64\Release\imgui_impl_win32.obj 7 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\imgui\imgui_widgets.cpp;C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\x64\Release\imgui_widgets.obj 8 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\imgui\TextEditor.cpp;C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\x64\Release\TextEditor.obj 9 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\main.cpp;C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\x64\Release\main.obj 10 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\Utils.cpp;C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\x64\Release\Utils.obj 11 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/Memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "Structs.h" 4 | 5 | namespace Memory 6 | { 7 | namespace Adress { 8 | ULONG LocalPlayerAdress = 0x17E0A8; 9 | ULONG EntityList = 0x18AC04; 10 | ULONG PlayerCount = 0x18AC0C; 11 | } 12 | 13 | namespace EntityOffsets { /* Alle er offsets til en Entity */ 14 | ULONG HeadX = 0x04; // float 15 | ULONG HeadY = 0x08; // float 16 | ULONG HeadZ = 0x0C; // float 17 | ULONG X = 0x28; // float 18 | ULONG Y = 0x2C; // float 19 | ULONG Z = 0x30; // float 20 | ULONG ViewAngleX = 0x34; // float 21 | ULONG ViewAngleY = 0x38; // float 22 | ULONG HP = 0xEC; // int 23 | ULONG Armor = 0xF0; // int 24 | ULONG Name = 0x205; // char[16] 25 | ULONG Team = 0x30C; // int 26 | 27 | ULONG CurrentWeaponStruct = 0xC; 28 | 29 | namespace Weapon { /*Alle er offsets til CurrentWeaponStruct */ 30 | USHORT Name = 0x0; // char[16] 31 | USHORT Recoil1 = 0x5E; // int16 32 | USHORT Recoil2 = 0x60; // int16 33 | USHORT MovementX = 0x5A; // int16 34 | USHORT MovementY = 0x58; // int16 35 | USHORT MaxAmmoInMag = 0x56; // int16 36 | USHORT WeaponKickBack = 0x54; // int16 37 | USHORT TimeBetweenShots = 0x48; // int16 38 | USHORT ReloadTime = 0x46; // int16 39 | USHORT Damage = 0x4A; // int16 40 | } 41 | 42 | namespace AssaultRifle { 43 | ULONG ReserveAmmo = 0x11C; // int 44 | ULONG CurrentAmmo = 0x140; // int 45 | } 46 | 47 | namespace Pistol { 48 | ULONG ReserveAmmo = 0x108; // int 49 | ULONG CurrentAmmo = 0x12C; // int 50 | } 51 | 52 | namespace SMG { 53 | ULONG ReserveAmmo = 0x114; // int 54 | ULONG CurrentAmmo = 0x138; // int 55 | } 56 | 57 | namespace CarbineRifle { 58 | ULONG ReserveAmmo = 0x10C; // int 59 | ULONG CurrentAmmo = 0x130; // int 60 | } 61 | 62 | namespace Shotgun { 63 | ULONG ReserveAmmo = 0x110; // int 64 | ULONG CurrentAmmo = 0x134; // int 65 | } 66 | 67 | namespace Sniper { 68 | ULONG ReserveAmmo = 0x118; // int 69 | ULONG CurrentAmmo = 0x13C; // int 70 | } 71 | 72 | namespace Grenade { 73 | ULONG CurrentAmmo = 0x144; // int 74 | } 75 | } 76 | } 77 | 78 | /*struct Entity { 79 | char padding_0000[0x4]; // 00 - 04 80 | Vec3 headPos; // 04 - 0C 81 | char padding_000C[0x24]; // 0C - 34 82 | Vec2 viewAngle; // 34 - 3C 83 | char padding_0038[0xB0]; // 3C - EC 84 | int health; // EC - F0 85 | int armor; // F0 - F4 86 | char padding_00F4[0x111]; // F4 - 205 87 | char name[16]; // 205 - 221 88 | char padding_0219[0xF7]; // 221 - 30C 89 | int team; // 30C - 310 90 | }; <-- Til Internal */ 91 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/curl/options.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_OPTIONS_H 2 | #define CURLINC_OPTIONS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2018 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | typedef enum { 32 | CURLOT_LONG, /* long (a range of values) */ 33 | CURLOT_VALUES, /* (a defined set or bitmask) */ 34 | CURLOT_OFF_T, /* curl_off_t (a range of values) */ 35 | CURLOT_OBJECT, /* pointer (void *) */ 36 | CURLOT_STRING, /* (char * to zero terminated buffer) */ 37 | CURLOT_SLIST, /* (struct curl_slist *) */ 38 | CURLOT_CBPTR, /* (void * passed as-is to a callback) */ 39 | CURLOT_BLOB, /* blob (struct curl_blob *) */ 40 | CURLOT_FUNCTION /* function pointer */ 41 | } curl_easytype; 42 | 43 | /* Flag bits */ 44 | 45 | /* "alias" means it is provided for old programs to remain functional, 46 | we prefer another name */ 47 | #define CURLOT_FLAG_ALIAS (1<<0) 48 | 49 | /* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size 50 | to use for curl_easy_setopt() for the given id */ 51 | struct curl_easyoption { 52 | const char *name; 53 | CURLoption id; 54 | curl_easytype type; 55 | unsigned int flags; 56 | }; 57 | 58 | CURL_EXTERN const struct curl_easyoption * 59 | curl_easy_option_by_name(const char *name); 60 | 61 | CURL_EXTERN const struct curl_easyoption * 62 | curl_easy_option_by_id(CURLoption id); 63 | 64 | CURL_EXTERN const struct curl_easyoption * 65 | curl_easy_option_next(const struct curl_easyoption *prev); 66 | 67 | #ifdef __cplusplus 68 | } /* end of extern "C" */ 69 | #endif 70 | #endif /* CURLINC_OPTIONS_H */ 71 | -------------------------------------------------------------------------------- /KernelReadWriteDriver/KernelReadWriteDriver.inf: -------------------------------------------------------------------------------- 1 | ; 2 | ; KernelReadWriteDriver.inf 3 | ; 4 | 5 | [Version] 6 | Signature="$WINDOWS NT$" 7 | Class=System ; TODO: specify appropriate Class 8 | ClassGuid={4d36e97d-e325-11ce-bfc1-08002be10318} ; TODO: specify appropriate ClassGuid 9 | Provider=%ManufacturerName% 10 | CatalogFile=KernelReadWriteDriver.cat 11 | DriverVer= ; TODO: set DriverVer in stampinf property pages 12 | PnpLockdown=1 13 | 14 | [DestinationDirs] 15 | DefaultDestDir = 12 16 | KernelReadWriteDriver_Device_CoInstaller_CopyFiles = 11 17 | 18 | [SourceDisksNames] 19 | 1 = %DiskName%,,,"" 20 | 21 | [SourceDisksFiles] 22 | KernelReadWriteDriver.sys = 1,, 23 | WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with SourceDisksNames 24 | 25 | ;***************************************** 26 | ; Install Section 27 | ;***************************************** 28 | 29 | [Manufacturer] 30 | %ManufacturerName%=Standard,NT$ARCH$ 31 | 32 | [Standard.NT$ARCH$] 33 | %KernelReadWriteDriver.DeviceDesc%=KernelReadWriteDriver_Device, Root\KernelReadWriteDriver ; TODO: edit hw-id 34 | 35 | [KernelReadWriteDriver_Device.NT] 36 | CopyFiles=Drivers_Dir 37 | 38 | [Drivers_Dir] 39 | KernelReadWriteDriver.sys 40 | 41 | ;-------------- Service installation 42 | [KernelReadWriteDriver_Device.NT.Services] 43 | AddService = KernelReadWriteDriver,%SPSVCINST_ASSOCSERVICE%, KernelReadWriteDriver_Service_Inst 44 | 45 | ; -------------- KernelReadWriteDriver driver install sections 46 | [KernelReadWriteDriver_Service_Inst] 47 | DisplayName = %KernelReadWriteDriver.SVCDESC% 48 | ServiceType = 1 ; SERVICE_KERNEL_DRIVER 49 | StartType = 3 ; SERVICE_DEMAND_START 50 | ErrorControl = 1 ; SERVICE_ERROR_NORMAL 51 | ServiceBinary = %12%\KernelReadWriteDriver.sys 52 | 53 | ; 54 | ;--- KernelReadWriteDriver_Device Coinstaller installation ------ 55 | ; 56 | 57 | [KernelReadWriteDriver_Device.NT.CoInstallers] 58 | AddReg=KernelReadWriteDriver_Device_CoInstaller_AddReg 59 | CopyFiles=KernelReadWriteDriver_Device_CoInstaller_CopyFiles 60 | 61 | [KernelReadWriteDriver_Device_CoInstaller_AddReg] 62 | HKR,,CoInstallers32,0x00010000, "WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller" 63 | 64 | [KernelReadWriteDriver_Device_CoInstaller_CopyFiles] 65 | WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll 66 | 67 | [KernelReadWriteDriver_Device.NT.Wdf] 68 | KmdfService = KernelReadWriteDriver, KernelReadWriteDriver_wdfsect 69 | [KernelReadWriteDriver_wdfsect] 70 | KmdfLibraryVersion = $KMDFVERSION$ 71 | 72 | [Strings] 73 | SPSVCINST_ASSOCSERVICE= 0x00000002 74 | ManufacturerName="" ;TODO: Replace with your manufacturer name 75 | DiskName = "KernelReadWriteDriver Installation Disk" 76 | KernelReadWriteDriver.DeviceDesc = "KernelReadWriteDriver Device" 77 | KernelReadWriteDriver.SVCDESC = "KernelReadWriteDriver Service" 78 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/imgui/imgui_impl_win32.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for Windows (standard windows API for 32 and 64 bits applications) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | 4 | // Implemented features: 5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core dear imgui) 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE). 8 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 9 | // [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 10 | 11 | // You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 12 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 13 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 14 | 15 | #pragma once 16 | #include "imgui.h" // IMGUI_IMPL_API 17 | 18 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 19 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 20 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 21 | 22 | // Configuration 23 | // - Disable gamepad support or linking with xinput.lib 24 | //#define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD 25 | //#define IMGUI_IMPL_WIN32_DISABLE_LINKING_XINPUT 26 | 27 | // Win32 message handler your application need to call. 28 | // - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on from this helper. 29 | // - You should COPY the line below into your .cpp code to forward declare the function and then you can call it. 30 | #if 0 31 | extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 32 | #endif 33 | 34 | // DPI-related helpers (optional) 35 | // - Use to enable DPI awareness without having to create an application manifest. 36 | // - Your own app may already do this via a manifest or explicit calls. This is mostly useful for our examples/ apps. 37 | // - In theory we could call simple functions from Windows SDK such as SetProcessDPIAware(), SetProcessDpiAwareness(), etc. 38 | // but most of the functions provided by Microsoft require Windows 8.1/10+ SDK at compile time and Windows 8/10+ at runtime, 39 | // neither we want to require the user to have. So we dynamically select and load those functions to avoid dependencies. 40 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableDpiAwareness(); 41 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd); // HWND hwnd 42 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor 43 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/curl/header.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_HEADER_H 2 | #define CURLINC_HEADER_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2018 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | struct curl_header { 28 | char *name; /* this might not use the same case */ 29 | char *value; 30 | size_t amount; /* number of headers using this name */ 31 | size_t index; /* ... of this instance, 0 or higher */ 32 | unsigned int origin; /* see bits below */ 33 | void *anchor; /* handle privately used by libcurl */ 34 | }; 35 | 36 | /* 'origin' bits */ 37 | #define CURLH_HEADER (1<<0) /* plain server header */ 38 | #define CURLH_TRAILER (1<<1) /* trailers */ 39 | #define CURLH_CONNECT (1<<2) /* CONNECT headers */ 40 | #define CURLH_1XX (1<<3) /* 1xx headers */ 41 | #define CURLH_PSEUDO (1<<4) /* pseudo headers */ 42 | 43 | typedef enum { 44 | CURLHE_OK, 45 | CURLHE_BADINDEX, /* header exists but not with this index */ 46 | CURLHE_MISSING, /* no such header exists */ 47 | CURLHE_NOHEADERS, /* no headers at all exist (yet) */ 48 | CURLHE_NOREQUEST, /* no request with this number was used */ 49 | CURLHE_OUT_OF_MEMORY, /* out of memory while processing */ 50 | CURLHE_BAD_ARGUMENT, /* a function argument was not okay */ 51 | CURLHE_NOT_BUILT_IN /* if API was disabled in the build */ 52 | } CURLHcode; 53 | 54 | CURL_EXTERN CURLHcode curl_easy_header(CURL *easy, 55 | const char *name, 56 | size_t index, 57 | unsigned int origin, 58 | int request, 59 | struct curl_header **hout); 60 | 61 | CURL_EXTERN struct curl_header *curl_easy_nextheader(CURL *easy, 62 | unsigned int origin, 63 | int request, 64 | struct curl_header *prev); 65 | 66 | #endif /* CURLINC_HEADER_H */ 67 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/curl/curlver.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_CURLVER_H 2 | #define CURLINC_CURLVER_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | /* This header file contains nothing but libcurl version info, generated by 28 | a script at release-time. This was made its own header file in 7.11.2 */ 29 | 30 | /* This is the global package copyright */ 31 | #define LIBCURL_COPYRIGHT "1996 - 2022 Daniel Stenberg, ." 32 | 33 | /* This is the version number of the libcurl package from which this header 34 | file origins: */ 35 | #define LIBCURL_VERSION "7.84.0" 36 | 37 | /* The numeric version number is also available "in parts" by using these 38 | defines: */ 39 | #define LIBCURL_VERSION_MAJOR 7 40 | #define LIBCURL_VERSION_MINOR 84 41 | #define LIBCURL_VERSION_PATCH 0 42 | 43 | /* This is the numeric version of the libcurl version number, meant for easier 44 | parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will 45 | always follow this syntax: 46 | 47 | 0xXXYYZZ 48 | 49 | Where XX, YY and ZZ are the main version, release and patch numbers in 50 | hexadecimal (using 8 bits each). All three numbers are always represented 51 | using two digits. 1.2 would appear as "0x010200" while version 9.11.7 52 | appears as "0x090b07". 53 | 54 | This 6-digit (24 bits) hexadecimal number does not show pre-release number, 55 | and it is always a greater number in a more recent release. It makes 56 | comparisons with greater than and less than work. 57 | 58 | Note: This define is the full hex number and _does not_ use the 59 | CURL_VERSION_BITS() macro since curl's own configure script greps for it 60 | and needs it to contain the full number. 61 | */ 62 | #define LIBCURL_VERSION_NUM 0x075400 63 | 64 | /* 65 | * This is the date and time when the full source package was created. The 66 | * timestamp is not stored in git, as the timestamp is properly set in the 67 | * tarballs by the maketgz script. 68 | * 69 | * The format of the date follows this template: 70 | * 71 | * "2007-11-23" 72 | */ 73 | #define LIBCURL_TIMESTAMP "2022-06-27" 74 | 75 | #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z)) 76 | #define CURL_AT_LEAST_VERSION(x,y,z) \ 77 | (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) 78 | 79 | #endif /* CURLINC_CURLVER_H */ 80 | -------------------------------------------------------------------------------- /autoinstall.ps1: -------------------------------------------------------------------------------- 1 | # The-Kernel-Driver-Automation Script 2 | 3 | # Prompt user for confirmation 4 | $confirmation = Read-Host "This script will automate the setup process for The Kernel Driver Guide. Do you want to proceed? (Y/N)" 5 | 6 | if ($confirmation -ne 'Y') { 7 | Write-Host "Setup aborted." 8 | exit 9 | } 10 | 11 | # Download prerequisites 12 | Write-Host "Downloading prerequisites..." 13 | Invoke-WebRequest -Uri "https://download.visualstudio.microsoft.com/download/pr/a061be25-c14a-489a-8c7c-bb72adfb3cab/4DFE83C91124CD542F4222FE2C396CABEAC617BB6F59BDCBDF89FD6F0DF0A32F/VC_redist.x64.exe" -OutFile "VC_redist.x64.exe" 14 | Invoke-WebRequest -Uri "https://download.microsoft.com/download/1/7/1/1718CCC4-6315-4D8E-9543-8E28A4E18C4C/dxwebsetup.exe" -OutFile "dxwebsetup.exe" 15 | Invoke-WebRequest -Uri "https://download.sysinternals.com/files/DebugView.zip" -OutFile "DebugView.zip" 16 | 17 | # Install prerequisites 18 | Write-Host "Installing prerequisites..." 19 | Start-Process -FilePath ".\VC_redist.x64.exe" -Wait 20 | Start-Process -FilePath ".\dxwebsetup.exe" -Wait 21 | Expand-Archive -Path ".\DebugView.zip" -DestinationPath ".\DebugView" 22 | 23 | # Download and install Visual Studio 2022 24 | Write-Host "Downloading Visual Studio 2022..." 25 | Invoke-WebRequest -Uri "https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=17" -OutFile "vs_community.exe" 26 | Start-Process -FilePath ".\vs_community.exe" -Wait 27 | 28 | # Download and install Windows SDK 29 | Write-Host "Downloading Windows SDK..." 30 | Invoke-WebRequest -Uri "https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/" -OutFile "sdksetup.exe" 31 | Start-Process -FilePath ".\sdksetup.exe" -Wait 32 | 33 | # Download and install Windows Driver Kit (WDK) 34 | Write-Host "Downloading Windows Driver Kit (WDK)..." 35 | Invoke-WebRequest -Uri "https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk" -OutFile "wdksetup.exe" 36 | Start-Process -FilePath ".\wdksetup.exe" -Wait 37 | 38 | # Download Debug View 39 | Write-Host "Downloading Debug View..." 40 | Invoke-WebRequest -Uri "https://download.sysinternals.com/files/DebugView.zip" -OutFile "DebugView.zip" 41 | Expand-Archive -Path ".\DebugView.zip" -DestinationPath ".\DebugView" 42 | 43 | # Display completion message 44 | Write-Host "Setup completed successfully!" 45 | 46 | # Additional steps 47 | Write-Host "Performing additional steps..." 48 | 49 | # Set Kernel driver Bin Path using sc create command 50 | $computerName = Read-Host "Enter your computer name:" 51 | $sysFilePath = "C:\Users\$computerName\source\repos\KernelReadWriteDriver\x64\Release\KernelReadWriteDriver.sys" 52 | sc create KernelReadWriteDriver type= Kernel binPath=$sysFilePath 53 | 54 | # Enable test signing 55 | bcdedit /set testsigning on 56 | 57 | # Start DebugView in ADMIN mode 58 | Start-Process -FilePath ".\DebugView\Dbgview.exe" -Verb RunAs 59 | 60 | # Enable Capture Kernel In Debug View 61 | # Note: This step may need manual intervention as it requires user interaction within DebugView. 62 | 63 | # Load the driver using the sc command 64 | $kernelDriverName = Read-Host "Enter the kernel driver name:" 65 | sc start "$kernelDriverName" 66 | 67 | # If encountering an error, run the following command in ADMIN cmd and restart 68 | # bcdedit /set nointegritychecks on 69 | 70 | # Stop the driver using the sc command 71 | sc stop "$kernelDriverName" 72 | 73 | Write-Host "Additional steps completed." 74 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/guidev.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "imgui/imgui.h" 7 | #include "imgui/imgui_impl_dx9.h" 8 | 9 | 10 | static LPDIRECT3D9 g_pD3D = NULL; 11 | static LPDIRECT3DDEVICE9 g_pd3dDevice = NULL; 12 | static D3DPRESENT_PARAMETERS g_d3dpp = {}; 13 | 14 | bool CreateDeviceD3D(HWND hWnd); 15 | void CleanupDeviceD3D(); 16 | void ResetDevice(); 17 | LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 18 | 19 | bool CreateDeviceD3D(HWND hWnd) 20 | { 21 | if ((g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL) 22 | return false; 23 | ZeroMemory(&g_d3dpp, sizeof(g_d3dpp)); 24 | g_d3dpp.Windowed = TRUE; 25 | g_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; 26 | g_d3dpp.BackBufferFormat = D3DFMT_UNKNOWN; 27 | g_d3dpp.EnableAutoDepthStencil = TRUE; 28 | g_d3dpp.AutoDepthStencilFormat = D3DFMT_D16; 29 | g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; // Present with vsync 30 | //g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Present without vsync, maximum unthrottled framerate 31 | if (g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_d3dpp, &g_pd3dDevice) < 0) 32 | return false; 33 | 34 | return true; 35 | } 36 | 37 | void CleanupDeviceD3D() 38 | { 39 | if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; } 40 | if (g_pD3D) { g_pD3D->Release(); g_pD3D = NULL; } 41 | } 42 | 43 | void ResetDevice() 44 | { 45 | ImGui_ImplDX9_InvalidateDeviceObjects(); 46 | HRESULT hr = g_pd3dDevice->Reset(&g_d3dpp); 47 | if (hr == D3DERR_INVALIDCALL) 48 | IM_ASSERT(0); 49 | ImGui_ImplDX9_CreateDeviceObjects(); 50 | } 51 | 52 | #ifndef WM_DPICHANGED 53 | #define WM_DPICHANGED 0x02E0 // From Windows SDK 8.1+ headers 54 | #endif 55 | 56 | extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 57 | 58 | LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) 59 | { 60 | if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam)) 61 | return true; 62 | 63 | switch (msg) 64 | { 65 | case WM_SIZE: 66 | if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED) 67 | { 68 | g_d3dpp.BackBufferWidth = LOWORD(lParam); 69 | g_d3dpp.BackBufferHeight = HIWORD(lParam); 70 | ResetDevice(); 71 | } 72 | return 0; 73 | case WM_SYSCOMMAND: 74 | if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu 75 | return 0; 76 | break; 77 | case WM_DESTROY: 78 | ::PostQuitMessage(0); 79 | return 0; 80 | case WM_DPICHANGED: 81 | if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_DpiEnableScaleViewports) 82 | { 83 | //const int dpi = HIWORD(wParam); 84 | //printf("WM_DPICHANGED to %d (%.0f%%)\n", dpi, (float)dpi / 96.0f * 100.0f); 85 | const RECT* suggested_rect = (RECT*)lParam; 86 | ::SetWindowPos(hWnd, NULL, suggested_rect->left, suggested_rect->top, suggested_rect->right - suggested_rect->left, suggested_rect->bottom - suggested_rect->top, SWP_NOZORDER | SWP_NOACTIVATE); 87 | } 88 | break; 89 | } 90 | return DefWindowProc(hWnd, msg, wParam, lParam); 91 | } 92 | -------------------------------------------------------------------------------- /KernelReadWriteDriver/KernelReadWrite.c: -------------------------------------------------------------------------------- 1 | /* 2 | * RWDriver - Kernel Read/Write Driver 3 | * Author: Oskar Stefanski & Malthe Bang Norengaard 4 | * Language: C (Kernel Driver), C++ (User Mode application) 5 | * 6 | * Description: 7 | * This kernel driver, written in C, is designed for read and write operations. The associated User Mode application will be written in C++. 8 | * 9 | * Disclaimer: 10 | * This code is provided as-is, without any warranty or support. Use it at your own risk. The authors are not responsible for any damage or loss resulting from the use of this code. 11 | * 12 | * Notes: 13 | * - Disable ligegyldig error --- Da det er en driver will alle warnings blive treated som errors for at undgå BSOD f.eks. 14 | * - To build the kernel service, use the command: sc create RWDriver type= kernel binpath="\RWDriver.sys" 15 | * - Ensure SecureBoot is disabled in BIOS if there are issues. 16 | * - To allow the driver, run: bcdedit /set testsigning on 17 | * - Start/stop the driver with: sc stop/start RWDriver 18 | */ 19 | 20 | 21 | #pragma warning (disable : 4100 4047 4024) 22 | 23 | #include "KernelReadWrite.h" 24 | #include "messages.h" 25 | #include "Events.h" 26 | #include "Data.h" 27 | #include "Communication.h" 28 | 29 | #define IOCTL_READ_MEMORY CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_BUFFERED, FILE_READ_ACCESS) 30 | #define IOCTL_WRITE_MEMORY CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_BUFFERED, FILE_WRITE_ACCESS) 31 | 32 | 33 | NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pRegistryPath) { 34 | 35 | UNREFERENCED_PARAMETER(pRegistryPath); 36 | 37 | // Assign Driverens Unload function til UnloadDriver functionen. 38 | pDriverObject->DriverUnload = UnloadDriver; 39 | 40 | // Log Welcome to this kernel driver 41 | DebugMessage("Welcome to this Kernel Driver"); 42 | 43 | RtlInitUnicodeString(&dev, L"\\Device\\RWDriver"); 44 | RtlInitUnicodeString(&dos, L"\\DosDevices\\RWDriver"); 45 | 46 | IoCreateDevice(pDriverObject, 0, &dev, FILE_DEVICE_UNKNOWN, FILE_DEVICE_SECURE_OPEN, FALSE, &pDeviceObject); 47 | IoCreateSymbolicLink(&dos, &dev); 48 | 49 | PsSetLoadImageNotifyRoutine(ImageLoadCB); 50 | 51 | pDriverObject->MajorFunction[IRP_MJ_CREATE] = CreateCall; 52 | pDriverObject->MajorFunction[IRP_MJ_CLOSE] = CloseCall; 53 | pDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = IoControl; 54 | 55 | pDeviceObject->Flags |= DO_DIRECT_IO; 56 | pDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; 57 | 58 | return STATUS_SUCCESS; 59 | } 60 | 61 | /** 62 | * @brief Unloads the driver and performs necessary cleanup operations. 63 | * 64 | * This function is called when the driver is being unloaded. It removes the LoadImageNotifyRoutine 65 | * callback, deletes the symbolic link, and deletes the device object. 66 | * 67 | * @param pDriverObject Pointer to the DRIVER_OBJECT structure representing the driver. 68 | * @return NTSTATUS Returns STATUS_SUCCESS if the driver is unloaded successfully. 69 | */ 70 | NTSTATUS UnloadDriver(PDRIVER_OBJECT pDriverObject) { 71 | 72 | UNREFERENCED_PARAMETER(pDriverObject); 73 | 74 | // log Goodbye from this driver 75 | DebugMessage("Goodbye from this driver"); 76 | 77 | // Remove the LoadImageNotifyRoutine to our Callback 78 | PsRemoveLoadImageNotifyRoutine(ImageLoadCB); 79 | 80 | // Delete the symbolic link 81 | IoDeleteSymbolicLink(&dos); 82 | 83 | // Delete the device object 84 | IoDeleteDevice(pDriverObject->DeviceObject); 85 | 86 | return STATUS_SUCCESS; 87 | } 88 | -------------------------------------------------------------------------------- /KernelReadWriteDriver.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.8.34330.188 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KernelReadWriteDriver", "KernelReadWriteDriver\KernelReadWriteDriver.vcxproj", "{81B303F8-A07F-4CA0-BF02-AF95F2314F65}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KernelReadWriteDriver_UserMode_IMGUI", "KernelReadWriteDriver_UserMode_IMGUI\KernelReadWriteDriver_UserMode_IMGUI.vcxproj", "{D0FF7ECF-244B-40CC-8ECA-B9B408E24260}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|ARM64 = Debug|ARM64 13 | Debug|x64 = Debug|x64 14 | Debug|x86 = Debug|x86 15 | Release|ARM64 = Release|ARM64 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Debug|ARM64.ActiveCfg = Debug|ARM64 21 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Debug|ARM64.Build.0 = Debug|ARM64 22 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Debug|ARM64.Deploy.0 = Debug|ARM64 23 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Debug|x64.ActiveCfg = Debug|x64 24 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Debug|x64.Build.0 = Debug|x64 25 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Debug|x64.Deploy.0 = Debug|x64 26 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Debug|x86.ActiveCfg = Debug|x64 27 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Debug|x86.Build.0 = Debug|x64 28 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Debug|x86.Deploy.0 = Debug|x64 29 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Release|ARM64.ActiveCfg = Release|ARM64 30 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Release|ARM64.Build.0 = Release|ARM64 31 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Release|ARM64.Deploy.0 = Release|ARM64 32 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Release|x64.ActiveCfg = Release|x64 33 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Release|x64.Build.0 = Release|x64 34 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Release|x64.Deploy.0 = Release|x64 35 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Release|x86.ActiveCfg = Release|x64 36 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Release|x86.Build.0 = Release|x64 37 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65}.Release|x86.Deploy.0 = Release|x64 38 | {D0FF7ECF-244B-40CC-8ECA-B9B408E24260}.Debug|ARM64.ActiveCfg = Debug|x64 39 | {D0FF7ECF-244B-40CC-8ECA-B9B408E24260}.Debug|ARM64.Build.0 = Debug|x64 40 | {D0FF7ECF-244B-40CC-8ECA-B9B408E24260}.Debug|x64.ActiveCfg = Debug|x64 41 | {D0FF7ECF-244B-40CC-8ECA-B9B408E24260}.Debug|x64.Build.0 = Debug|x64 42 | {D0FF7ECF-244B-40CC-8ECA-B9B408E24260}.Debug|x86.ActiveCfg = Debug|Win32 43 | {D0FF7ECF-244B-40CC-8ECA-B9B408E24260}.Debug|x86.Build.0 = Debug|Win32 44 | {D0FF7ECF-244B-40CC-8ECA-B9B408E24260}.Release|ARM64.ActiveCfg = Release|x64 45 | {D0FF7ECF-244B-40CC-8ECA-B9B408E24260}.Release|ARM64.Build.0 = Release|x64 46 | {D0FF7ECF-244B-40CC-8ECA-B9B408E24260}.Release|x64.ActiveCfg = Release|x64 47 | {D0FF7ECF-244B-40CC-8ECA-B9B408E24260}.Release|x64.Build.0 = Release|x64 48 | {D0FF7ECF-244B-40CC-8ECA-B9B408E24260}.Release|x86.ActiveCfg = Release|Win32 49 | {D0FF7ECF-244B-40CC-8ECA-B9B408E24260}.Release|x86.Build.0 = Release|Win32 50 | EndGlobalSection 51 | GlobalSection(SolutionProperties) = preSolution 52 | HideSolutionNode = FALSE 53 | EndGlobalSection 54 | GlobalSection(ExtensibilityGlobals) = postSolution 55 | SolutionGuid = {8A55D4DF-B76F-4C9D-BFDC-D0DCF1AAD921} 56 | EndGlobalSection 57 | EndGlobal 58 | -------------------------------------------------------------------------------- /cheat-entries.md: -------------------------------------------------------------------------------- 1 | # cheat entries 2 | 3 | ## 1. Local Entity Pointer 4 | 5 | - **ID:** 14 6 | - **Description:** "Local Entity Pointer" 7 | - **Last State:** 8 | - Value: 00911BF8 9 | - Real Address: 0057E0A8 10 | - **Show As Hex:** 1 11 | - **Show As Signed:** 0 12 | - **Variable Type:** 4 Bytes 13 | - **Address:** ac_client.exe+17E0A8 14 | 15 | ## 2. HP Pointer 16 | 17 | - **ID:** 18 18 | - **Description:** "HP Pointer" 19 | - **Last State:** 20 | - Value: 100 21 | - Real Address: 00911CE4 22 | - **Show As Signed:** 0 23 | - **Variable Type:** 4 Bytes 24 | - **Address:** ac_client.exe+17E0A8 25 | - **Offsets:** 26 | - Offset: EC 27 | 28 | ## 3. Armor Pointer 29 | 30 | - **ID:** 19 31 | - **Description:** "Armor Pointer" 32 | - **Last State:** 33 | - Value: 0 34 | - Real Address: 00911CE8 35 | - **Show As Signed:** 0 36 | - **Variable Type:** 4 Bytes 37 | - **Address:** ac_client.exe+17E0A8 38 | - **Offsets:** 39 | - Offset: F0 40 | 41 | ## 4. AR Ammo 42 | 43 | - **ID:** 20 44 | - **Description:** "AR Ammo" 45 | - **Last State:** 46 | - Value: 20 47 | - Real Address: 00911D38 48 | - **Show As Signed:** 0 49 | - **Variable Type:** 4 Bytes 50 | - **Address:** ac_client.exe+17E0A8 51 | - **Offsets:** 52 | - Offset: 140 53 | 54 | ## 5. AR Reserve 55 | 56 | - **ID:** 21 57 | - **Description:** "AR Reserve" 58 | - **Last State:** 59 | - Value: 40 60 | - Real Address: 00911D14 61 | - **Show As Signed:** 0 62 | - **Variable Type:** 4 Bytes 63 | - **Address:** ac_client.exe+17E0A8 64 | - **Offsets:** 65 | - Offset: 11C 66 | 67 | ## 6. Pistol Ammo 68 | 69 | - **ID:** 22 70 | - **Description:** "Pistol Ammo" 71 | - **Last State:** 72 | - Value: 10 73 | - Real Address: 00911D24 74 | - **Show As Signed:** 0 75 | - **Variable Type:** 4 Bytes 76 | - **Address:** ac_client.exe+17E0A8 77 | - **Offsets:** 78 | - Offset: 12C 79 | 80 | ## 7. Pistol Reserve 81 | 82 | - **ID:** 23 83 | - **Description:** "Pistol Reserve" 84 | - **Last State:** 85 | - Value: 50 86 | - Real Address: 00911D00 87 | - **Show As Signed:** 0 88 | - **Variable Type:** 4 Bytes 89 | - **Address:** ac_client.exe+17E0A8 90 | - **Offsets:** 91 | - Offset: 108 92 | 93 | ## 8. Grenade Count 94 | 95 | - **ID:** 24 96 | - **Description:** "Grenade Count" 97 | - **Last State:** 98 | - Value: 0 99 | - Real Address: 00911D3C 100 | - **Show As Signed:** 0 101 | - **Variable Type:** 4 Bytes 102 | - **Address:** ac_client.exe+17E0A8 103 | - **Offsets:** 104 | - Offset: 144 105 | 106 | ## 9. Ply Name 107 | 108 | - **ID:** 25 109 | - **Description:** "Ply Name" 110 | - **Last State:** 111 | - Real Address: 00911DFD 112 | - **Show As Signed:** 0 113 | - **Variable Type:** String 114 | - **Length:** 10 115 | - **Unicode:** 0 116 | - **Code Page:** 0 117 | - **Zero Terminate:** 1 118 | - **Address:** ac_client.exe+17E0A8 119 | - **Offsets:** 120 | - Offset: 205 121 | 122 | ## 10. Player X 123 | 124 | - **ID:** 26 125 | - **Description:** "Player X" 126 | - **Last State:** 127 | - Value: 135.8831635 128 | - Real Address: 00911C20 129 | - **Show As Signed:** 0 130 | - **Variable Type:** Float 131 | - **Address:** ac_client.exe+17E0A8 132 | - **Offsets:** 133 | - Offset: 28 134 | 135 | ## 11. Player Y 136 | 137 | - **ID:** 27 138 | - **Description:** "Player Y" 139 | - **Last State:** 140 | - Value: 57.57709122 141 | - Real Address: 00911C24 142 | - **Show As Signed:** 0 143 | - **Variable Type:** Float 144 | - **Address:** ac_client.exe+17E0A8 145 | - **Offsets:** 146 | - Offset: 2C 147 | 148 | ## 12. Player Z 149 | 150 | - **ID:** 28 151 | - **Description:** "Player Z" 152 | - **Last State:** 153 | - Value: 8 154 | - Real Address: 00911C28 155 | - **Show As Signed:** 0 156 | - **Variable Type:** Float 157 | - **Address:** ac_client.exe+17E0A8 158 | - **Offsets:** 159 | - Offset: 30 160 | 161 | ## 13. Pointer to Entity List 162 | 163 | - **ID:** 29 164 | - **Description:** "Pointer to Entity List" 165 | - **Last State:** 166 | - Value: 00000000 167 | - Real Address: 0058AC04 168 | - **Show As Hex:** 1 169 | - **Show As Signed:** 0 170 | - **Variable Type:** 4 Bytes 171 | - **Address:** ac_client.exe+18AC04 172 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/curl/easy.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_EASY_H 2 | #define CURLINC_EASY_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Flag bits in the curl_blob struct: */ 31 | #define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */ 32 | #define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */ 33 | 34 | struct curl_blob { 35 | void *data; 36 | size_t len; 37 | unsigned int flags; /* bit 0 is defined, the rest are reserved and should be 38 | left zeroes */ 39 | }; 40 | 41 | CURL_EXTERN CURL *curl_easy_init(void); 42 | CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); 43 | CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); 44 | CURL_EXTERN void curl_easy_cleanup(CURL *curl); 45 | 46 | /* 47 | * NAME curl_easy_getinfo() 48 | * 49 | * DESCRIPTION 50 | * 51 | * Request internal information from the curl session with this function. The 52 | * third argument MUST be a pointer to a long, a pointer to a char * or a 53 | * pointer to a double (as the documentation describes elsewhere). The data 54 | * pointed to will be filled in accordingly and can be relied upon only if the 55 | * function returns CURLE_OK. This function is intended to get used *AFTER* a 56 | * performed transfer, all results from this function are undefined until the 57 | * transfer is completed. 58 | */ 59 | CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); 60 | 61 | 62 | /* 63 | * NAME curl_easy_duphandle() 64 | * 65 | * DESCRIPTION 66 | * 67 | * Creates a new curl session handle with the same options set for the handle 68 | * passed in. Duplicating a handle could only be a matter of cloning data and 69 | * options, internal state info and things like persistent connections cannot 70 | * be transferred. It is useful in multithreaded applications when you can run 71 | * curl_easy_duphandle() for each new thread to avoid a series of identical 72 | * curl_easy_setopt() invokes in every thread. 73 | */ 74 | CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl); 75 | 76 | /* 77 | * NAME curl_easy_reset() 78 | * 79 | * DESCRIPTION 80 | * 81 | * Re-initializes a CURL handle to the default values. This puts back the 82 | * handle to the same state as it was in when it was just created. 83 | * 84 | * It does keep: live connections, the Session ID cache, the DNS cache and the 85 | * cookies. 86 | */ 87 | CURL_EXTERN void curl_easy_reset(CURL *curl); 88 | 89 | /* 90 | * NAME curl_easy_recv() 91 | * 92 | * DESCRIPTION 93 | * 94 | * Receives data from the connected socket. Use after successful 95 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 96 | */ 97 | CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, 98 | size_t *n); 99 | 100 | /* 101 | * NAME curl_easy_send() 102 | * 103 | * DESCRIPTION 104 | * 105 | * Sends data over the connected socket. Use after successful 106 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 107 | */ 108 | CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, 109 | size_t buflen, size_t *n); 110 | 111 | 112 | /* 113 | * NAME curl_easy_upkeep() 114 | * 115 | * DESCRIPTION 116 | * 117 | * Performs connection upkeep for the given session handle. 118 | */ 119 | CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl); 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/x64/Release/KernelReadWriteDriver_UserMode_IMGUI.log: -------------------------------------------------------------------------------- 1 | main.cpp 2 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\Kernelinterface.hpp(43,98): warning C4267: 'argument': conversion from 'size_t' to 'DWORD', possible loss of data 3 | (compiling source file 'main.cpp') 4 | 5 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\main.cpp(85,83): warning C4244: 'argument': conversion from 'uintptr_t' to 'ULONG', possible loss of data 6 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\main.cpp(88,76): warning C4244: 'argument': conversion from 'uintptr_t' to 'ULONG', possible loss of data 7 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\main.cpp(90,73): warning C4244: 'argument': conversion from 'uintptr_t' to 'ULONG', possible loss of data 8 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\main.cpp(91,71): warning C4244: 'argument': conversion from 'uintptr_t' to 'ULONG', possible loss of data 9 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\main.cpp(125,81): warning C4244: 'argument': conversion from 'uintptr_t' to 'ULONG', possible loss of data 10 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\main.cpp(132,15): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data 11 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\main.cpp(134,17): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data 12 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\main.cpp(136,11): warning C4552: '+': result of expression not used 13 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\Kernelinterface.hpp(105,24): warning C4244: '=': conversion from 'SIZE_T' to 'ULONG', possible loss of data 14 | (compiling source file 'main.cpp') 15 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\Kernelinterface.hpp(105,24): 16 | the template instantiation context (the oldest one first) is 17 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\main.cpp(73,33): 18 | see reference to function template instantiation 'type KernelInterface::ReadVirtualMemory(ULONG,ULONG,SIZE_T)' being compiled 19 | with 20 | [ 21 | type=uintptr_t 22 | ] 23 | 24 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\Kernelinterface.hpp(147,25): warning C4244: '=': conversion from 'SIZE_T' to 'ULONG', possible loss of data 25 | (compiling source file 'main.cpp') 26 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\Kernelinterface.hpp(147,25): 27 | the template instantiation context (the oldest one first) is 28 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\main.cpp(141,13): 29 | see reference to function template instantiation 'bool KernelInterface::WriteVirtualMemory(ULONG,ULONG,type,SIZE_T)' being compiled 30 | with 31 | [ 32 | type=float 33 | ] 34 | 35 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\Kernelinterface.hpp(126,24): warning C4244: '=': conversion from 'SIZE_T' to 'ULONG', possible loss of data 36 | (compiling source file 'main.cpp') 37 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\Kernelinterface.hpp(126,24): 38 | the template instantiation context (the oldest one first) is 39 | C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\KernelReadWriteDriver_UserMode_IMGUI\main.cpp(231,8): 40 | see reference to function template instantiation 'void KernelInterface::ReadVirtualMemory(DWORD,DWORD,T *,SIZE_T)' being compiled 41 | with 42 | [ 43 | T=char 44 | ] 45 | 46 | Generating code 47 | 3 of 2113 functions ( 0.1%) were compiled, the rest were copied from previous compilation. 48 | 0 functions were new in current compilation 49 | 21 functions had inline decision re-evaluated but remain unchanged 50 | Finished generating code 51 | KernelReadWriteDriver_UserMode_IMGUI.vcxproj -> C:\Users\redhat\Documents\GitHub\The-Kernel-Driver-Guide\x64\Release\KernelReadWriteDriver_UserMode_IMGUI.exe 52 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/Utils.cpp: -------------------------------------------------------------------------------- 1 | #include "Utils.h" 2 | #include 3 | #include 4 | #include 5 | 6 | #define MSGBOX(x) \ 7 | { \ 8 | std::ostringstream oss; \ 9 | oss << x; \ 10 | std::string str = oss.str(); \ 11 | std::wstring stemp = std::wstring(str.begin(), str.end()); \ 12 | LPCWSTR sw = stemp.c_str(); \ 13 | MessageBox(NULL, sw, L"Msg Title", MB_OK | MB_ICONQUESTION); \ 14 | } 15 | 16 | 17 | HHOOK hHook = NULL; 18 | std::map keyStates; 19 | extern DWORD ProcessId; 20 | 21 | struct Params 22 | { 23 | DWORD pid; 24 | HWND hwnd; 25 | }; 26 | 27 | HWND FindWindowByProcessId(DWORD processId) 28 | { 29 | Params params = { processId, NULL }; 30 | 31 | EnumWindows([](HWND handle, LPARAM lParam) -> BOOL { 32 | DWORD processId; 33 | GetWindowThreadProcessId(handle, &processId); 34 | Params* params = (Params*)lParam; 35 | 36 | // If the process ID matches, set the HWND and return FALSE to stop enumeration 37 | if (processId == params->pid) 38 | { 39 | params->hwnd = handle; // Set hwnd 40 | return FALSE; 41 | } 42 | 43 | return TRUE; // Continue enumeration 44 | }, (LPARAM)¶ms); 45 | 46 | return params.hwnd; 47 | } 48 | 49 | LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) 50 | { 51 | if (nCode == HC_ACTION) 52 | { 53 | HWND hCurrentWindow = GetForegroundWindow(); 54 | HWND hGameWindow = FindWindowByProcessId(ProcessId); 55 | 56 | if (hCurrentWindow == hGameWindow) 57 | { 58 | KBDLLHOOKSTRUCT* p = (KBDLLHOOKSTRUCT*)lParam; 59 | if (wParam == WM_KEYDOWN) 60 | { 61 | keyStates[p->vkCode] = true; 62 | } 63 | else if (wParam == WM_KEYUP) 64 | { 65 | keyStates[p->vkCode] = false; 66 | } 67 | } 68 | } 69 | 70 | return CallNextHookEx(hHook, nCode, wParam, lParam); 71 | } 72 | 73 | void SimulateSpacebarPress() 74 | { 75 | INPUT input[2] = { 0 }; 76 | 77 | // Set up the INPUT structures for a keydown and keyup event 78 | input[0].type = INPUT_KEYBOARD; 79 | input[0].ki.wVk = VK_SPACE; 80 | 81 | input[1].type = INPUT_KEYBOARD; 82 | input[1].ki.wVk = VK_SPACE; 83 | input[1].ki.dwFlags = KEYEVENTF_KEYUP; 84 | 85 | // Send the input 86 | 87 | HWND hCurrentWindow = GetForegroundWindow(); 88 | HWND hGameWindow = FindWindowByProcessId(ProcessId); 89 | 90 | // Check if the game is in focus 91 | if (hCurrentWindow == hGameWindow) 92 | { 93 | SendInput(2, input, sizeof(INPUT)); 94 | } 95 | } 96 | 97 | void Simulate_LeftClick() 98 | { 99 | INPUT Input = { 0 }; 100 | 101 | // Set up a generic mouse event. 102 | Input.type = INPUT_MOUSE; 103 | Input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN; 104 | //SendInput(1, &Input, sizeof(INPUT)); 105 | 106 | // Zero the memory 107 | ZeroMemory(&Input, sizeof(INPUT)); 108 | 109 | // Set up a generic mouse event. 110 | Input.type = INPUT_MOUSE; 111 | Input.mi.dwFlags = MOUSEEVENTF_LEFTUP; 112 | 113 | HWND hCurrentWindow = GetForegroundWindow(); 114 | HWND hGameWindow = FindWindowByProcessId(ProcessId); 115 | 116 | // Check if the game is in focus <--- To prevent the mouse from clicking on other windows 117 | if (hCurrentWindow == hGameWindow) 118 | { 119 | SendInput(1, &Input, sizeof(INPUT)); 120 | } 121 | } 122 | 123 | 124 | WindowSize GetWinSize(DWORD ProcessId) 125 | { 126 | WindowSize WinSize = { 0, 0 }; 127 | 128 | HWND hGameWindow = FindWindowByProcessId(ProcessId); 129 | 130 | RECT rect; 131 | if (GetWindowRect(hGameWindow, &rect)) 132 | { 133 | WinSize.width = rect.right - rect.left; 134 | WinSize.height = rect.bottom - rect.top; 135 | } 136 | 137 | return WinSize; 138 | } 139 | 140 | bool IsKeyPressed(int vkCode) 141 | { 142 | return keyStates[vkCode]; 143 | } 144 | 145 | void SetupHook() { 146 | //MSGBOX("SetupHook"); 147 | hHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardProc, NULL, 0); 148 | } 149 | 150 | bool WorldToScreen(Vec3 pos, Vec2& screen, float matrix[16], int windowWidth, int windowHeight) 151 | { 152 | Vec4 clipCoords = {}; 153 | 154 | clipCoords.x = pos.x * matrix[0] + pos.y * matrix[4] + pos.z * matrix[8] + matrix[12]; 155 | clipCoords.y = pos.x * matrix[1] + pos.y * matrix[5] + pos.z * matrix[9] + matrix[13]; 156 | clipCoords.z = pos.x * matrix[2] + pos.y * matrix[6] + pos.z * matrix[10] + matrix[14]; 157 | clipCoords.w = pos.x * matrix[3] + pos.y * matrix[7] + pos.z * matrix[11] + matrix[15]; 158 | 159 | if (clipCoords.w < 0.1f) 160 | { 161 | return false; 162 | } 163 | 164 | Vec3 NDC; 165 | NDC.x = clipCoords.x / clipCoords.w; 166 | NDC.y = clipCoords.y / clipCoords.w; 167 | NDC.z = clipCoords.z / clipCoords.w; 168 | 169 | screen.x = (windowWidth / 2 * NDC.x) + (NDC.x + windowWidth / 2); 170 | screen.y = -(windowHeight / 2 * NDC.y) + (NDC.y + windowHeight / 2); 171 | 172 | return true; 173 | } -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/Kernelinterface.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Communications.hpp" 4 | #include 5 | 6 | class KernelInterface 7 | { 8 | public: 9 | HANDLE hDriver; 10 | 11 | // Constructor 12 | KernelInterface(LPCSTR RegistryPath) : hDriver(INVALID_HANDLE_VALUE) 13 | { 14 | hDriver = CreateFileA(RegistryPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0); 15 | if (hDriver == INVALID_HANDLE_VALUE) 16 | { 17 | // Print the path for debugging 18 | std::cerr << "Failed to open driver at path: " << RegistryPath << " with error: " << GetLastError() << std::endl; 19 | } 20 | } 21 | 22 | 23 | // Destructor 24 | ~KernelInterface() 25 | { 26 | if (hDriver != INVALID_HANDLE_VALUE) 27 | { 28 | CloseHandle(hDriver); 29 | } 30 | } 31 | 32 | // Function to set image buffer 33 | bool SetImageBuffer(const wchar_t* ImageBuffer) 34 | { 35 | if (hDriver == INVALID_HANDLE_VALUE) 36 | { 37 | return false; 38 | } 39 | 40 | DWORD Bytes; 41 | size_t Size = wcslen(ImageBuffer); 42 | 43 | if (DeviceIoControl(hDriver, IO_SET_IMAGEBUFFER, const_cast(ImageBuffer), Size * sizeof(wchar_t), nullptr, 0, &Bytes, nullptr)) 44 | { 45 | return true; 46 | } 47 | 48 | // Add error handling if necessary 49 | std::cerr << "SetImageBuffer failed: " << GetLastError() << std::endl; 50 | return false; 51 | } 52 | 53 | // Function to get client address 54 | DWORD GetClientAdress() 55 | { 56 | if (hDriver == INVALID_HANDLE_VALUE) 57 | { 58 | return 0; 59 | } 60 | 61 | ULONG ReturnAddress; 62 | DWORD Bytes; 63 | 64 | if (DeviceIoControl(hDriver, IO_GET_CLIENTADRESS, nullptr, 0, &ReturnAddress, sizeof(ReturnAddress), &Bytes, nullptr)) 65 | { 66 | return ReturnAddress; 67 | } 68 | 69 | // Add error handling if necessary 70 | std::cerr << "GetClientAdress failed: " << GetLastError() << std::endl; 71 | return 0; 72 | } 73 | 74 | // Function to get process ID 75 | DWORD GetProcessId() 76 | { 77 | if (hDriver == INVALID_HANDLE_VALUE) 78 | { 79 | return 0; 80 | } 81 | 82 | ULONG ProcessId; 83 | DWORD Bytes; 84 | 85 | if (DeviceIoControl(hDriver, IO_GET_PROCESSID, nullptr, 0, &ProcessId, sizeof(ProcessId), &Bytes, nullptr)) 86 | { 87 | return ProcessId; 88 | } 89 | 90 | // Add error handling if necessary 91 | std::cerr << "GetProcessId failed: " << GetLastError() << std::endl; 92 | return 0; 93 | } 94 | 95 | // Function to read virtual memory 96 | template 97 | type ReadVirtualMemory(ULONG ProcessId, ULONG ReadAddress, SIZE_T Size) 98 | { 99 | type Buffer = {}; 100 | 101 | KERNEL_READ_REQUEST ReadReq; 102 | ReadReq.ProcessId = ProcessId; 103 | ReadReq.Address = ReadAddress; 104 | ReadReq.pBuff = &Buffer; 105 | ReadReq.Size = Size; 106 | 107 | DWORD Bytes; 108 | 109 | if (DeviceIoControl(hDriver, IO_READ_REQUEST, &ReadReq, sizeof(ReadReq), &ReadReq, sizeof(ReadReq), &Bytes, nullptr)) 110 | { 111 | return Buffer; 112 | } 113 | 114 | // Add error handling if necessary 115 | std::cerr << "ReadVirtualMemory failed: " << GetLastError() << std::endl; 116 | return Buffer; 117 | } 118 | 119 | template 120 | void ReadVirtualMemory(DWORD ProcessId, DWORD Address, T* Buffer, SIZE_T Size) 121 | { 122 | KERNEL_READ_REQUEST ReadReq; 123 | ReadReq.ProcessId = ProcessId; 124 | ReadReq.Address = Address; 125 | ReadReq.pBuff = Buffer; 126 | ReadReq.Size = Size; 127 | 128 | DeviceIoControl(hDriver, IO_READ_REQUEST, &ReadReq, sizeof(ReadReq), nullptr, 0, nullptr, nullptr); 129 | } 130 | 131 | 132 | // Function to write virtual memory 133 | template 134 | bool WriteVirtualMemory(ULONG ProcessId, ULONG WriteAddress, type WriteValue, SIZE_T Size) 135 | { 136 | if (hDriver == INVALID_HANDLE_VALUE) 137 | { 138 | return false; 139 | } 140 | 141 | DWORD Bytes; 142 | 143 | KERNEL_WRITE_REQUEST WriteReq; 144 | WriteReq.ProcessId = ProcessId; 145 | WriteReq.Address = WriteAddress; 146 | WriteReq.pBuff = &WriteValue; 147 | WriteReq.Size = Size; 148 | 149 | if (DeviceIoControl(hDriver, IO_WRITE_REQUEST, &WriteReq, sizeof(WriteReq), nullptr, 0, &Bytes, nullptr)) 150 | { 151 | return true; 152 | } 153 | 154 | // Add error handling if necessary 155 | std::cerr << "WriteVirtualMemory failed: " << GetLastError() << std::endl; 156 | return false; 157 | } 158 | }; 159 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/curl/urlapi.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_URLAPI_H 2 | #define CURLINC_URLAPI_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 2018 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | 27 | #include "curl.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | /* the error codes for the URL API */ 34 | typedef enum { 35 | CURLUE_OK, 36 | CURLUE_BAD_HANDLE, /* 1 */ 37 | CURLUE_BAD_PARTPOINTER, /* 2 */ 38 | CURLUE_MALFORMED_INPUT, /* 3 */ 39 | CURLUE_BAD_PORT_NUMBER, /* 4 */ 40 | CURLUE_UNSUPPORTED_SCHEME, /* 5 */ 41 | CURLUE_URLDECODE, /* 6 */ 42 | CURLUE_OUT_OF_MEMORY, /* 7 */ 43 | CURLUE_USER_NOT_ALLOWED, /* 8 */ 44 | CURLUE_UNKNOWN_PART, /* 9 */ 45 | CURLUE_NO_SCHEME, /* 10 */ 46 | CURLUE_NO_USER, /* 11 */ 47 | CURLUE_NO_PASSWORD, /* 12 */ 48 | CURLUE_NO_OPTIONS, /* 13 */ 49 | CURLUE_NO_HOST, /* 14 */ 50 | CURLUE_NO_PORT, /* 15 */ 51 | CURLUE_NO_QUERY, /* 16 */ 52 | CURLUE_NO_FRAGMENT, /* 17 */ 53 | CURLUE_NO_ZONEID, /* 18 */ 54 | CURLUE_BAD_FILE_URL, /* 19 */ 55 | CURLUE_BAD_FRAGMENT, /* 20 */ 56 | CURLUE_BAD_HOSTNAME, /* 21 */ 57 | CURLUE_BAD_IPV6, /* 22 */ 58 | CURLUE_BAD_LOGIN, /* 23 */ 59 | CURLUE_BAD_PASSWORD, /* 24 */ 60 | CURLUE_BAD_PATH, /* 25 */ 61 | CURLUE_BAD_QUERY, /* 26 */ 62 | CURLUE_BAD_SCHEME, /* 27 */ 63 | CURLUE_BAD_SLASHES, /* 28 */ 64 | CURLUE_BAD_USER, /* 29 */ 65 | CURLUE_LAST 66 | } CURLUcode; 67 | 68 | typedef enum { 69 | CURLUPART_URL, 70 | CURLUPART_SCHEME, 71 | CURLUPART_USER, 72 | CURLUPART_PASSWORD, 73 | CURLUPART_OPTIONS, 74 | CURLUPART_HOST, 75 | CURLUPART_PORT, 76 | CURLUPART_PATH, 77 | CURLUPART_QUERY, 78 | CURLUPART_FRAGMENT, 79 | CURLUPART_ZONEID /* added in 7.65.0 */ 80 | } CURLUPart; 81 | 82 | #define CURLU_DEFAULT_PORT (1<<0) /* return default port number */ 83 | #define CURLU_NO_DEFAULT_PORT (1<<1) /* act as if no port number was set, 84 | if the port number matches the 85 | default for the scheme */ 86 | #define CURLU_DEFAULT_SCHEME (1<<2) /* return default scheme if 87 | missing */ 88 | #define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */ 89 | #define CURLU_PATH_AS_IS (1<<4) /* leave dot sequences */ 90 | #define CURLU_DISALLOW_USER (1<<5) /* no user+password allowed */ 91 | #define CURLU_URLDECODE (1<<6) /* URL decode on get */ 92 | #define CURLU_URLENCODE (1<<7) /* URL encode on set */ 93 | #define CURLU_APPENDQUERY (1<<8) /* append a form style part */ 94 | #define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */ 95 | #define CURLU_NO_AUTHORITY (1<<10) /* Allow empty authority when the 96 | scheme is unknown. */ 97 | #define CURLU_ALLOW_SPACE (1<<11) /* Allow spaces in the URL */ 98 | 99 | typedef struct Curl_URL CURLU; 100 | 101 | /* 102 | * curl_url() creates a new CURLU handle and returns a pointer to it. 103 | * Must be freed with curl_url_cleanup(). 104 | */ 105 | CURL_EXTERN CURLU *curl_url(void); 106 | 107 | /* 108 | * curl_url_cleanup() frees the CURLU handle and related resources used for 109 | * the URL parsing. It will not free strings previously returned with the URL 110 | * API. 111 | */ 112 | CURL_EXTERN void curl_url_cleanup(CURLU *handle); 113 | 114 | /* 115 | * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new 116 | * handle must also be freed with curl_url_cleanup(). 117 | */ 118 | CURL_EXTERN CURLU *curl_url_dup(CURLU *in); 119 | 120 | /* 121 | * curl_url_get() extracts a specific part of the URL from a CURLU 122 | * handle. Returns error code. The returned pointer MUST be freed with 123 | * curl_free() afterwards. 124 | */ 125 | CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what, 126 | char **part, unsigned int flags); 127 | 128 | /* 129 | * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns 130 | * error code. The passed in string will be copied. Passing a NULL instead of 131 | * a part string, clears that part. 132 | */ 133 | CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what, 134 | const char *part, unsigned int flags); 135 | 136 | /* 137 | * curl_url_strerror() turns a CURLUcode value into the equivalent human 138 | * readable error string. This is useful for printing meaningful error 139 | * messages. 140 | */ 141 | CURL_EXTERN const char *curl_url_strerror(CURLUcode); 142 | 143 | #ifdef __cplusplus 144 | } /* end of extern "C" */ 145 | #endif 146 | 147 | #endif /* CURLINC_URLAPI_H */ 148 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/KernelReadWriteDriver_UserMode_IMGUI.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | imgui 7 | 8 | 9 | imgui 10 | 11 | 12 | imgui 13 | 14 | 15 | imgui 16 | 17 | 18 | imgui 19 | 20 | 21 | imgui 22 | 23 | 24 | imgui 25 | 26 | 27 | 28 | 29 | 30 | 31 | imgui 32 | 33 | 34 | imgui 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | imgui 47 | 48 | 49 | imgui 50 | 51 | 52 | imgui 53 | 54 | 55 | imgui 56 | 57 | 58 | curl 59 | 60 | 61 | curl 62 | 63 | 64 | curl 65 | 66 | 67 | curl 68 | 69 | 70 | directx 71 | 72 | 73 | directx 74 | 75 | 76 | directx 77 | 78 | 79 | directx 80 | 81 | 82 | directx 83 | 84 | 85 | directx 86 | 87 | 88 | directx 89 | 90 | 91 | directx 92 | 93 | 94 | directx 95 | 96 | 97 | directx 98 | 99 | 100 | curl 101 | 102 | 103 | curl 104 | 105 | 106 | curl 107 | 108 | 109 | curl 110 | 111 | 112 | curl 113 | 114 | 115 | curl 116 | 117 | 118 | curl 119 | 120 | 121 | Theme 122 | 123 | 124 | Theme 125 | 126 | 127 | Theme 128 | 129 | 130 | 131 | rw 132 | 133 | 134 | rw 135 | 136 | 137 | rw 138 | 139 | 140 | rw 141 | 142 | 143 | 144 | 145 | 146 | 147 | {2f553555-495a-4ce5-ba06-7aca11d6d2ba} 148 | 149 | 150 | {6f494de5-f5ff-4fe6-b8c3-8ddc81a3835c} 151 | 152 | 153 | {101003f1-8032-4bdd-a7b3-84888c4b6e6d} 154 | 155 | 156 | {b987ca70-8078-41c6-8bec-b86657e9c3b3} 157 | 158 | 159 | {1c7ad53f-acb8-4737-a391-80fc8f4a1bd6} 160 | 161 | 162 | 163 | 164 | directx 165 | 166 | 167 | -------------------------------------------------------------------------------- /KernelReadWriteDriver/KernelReadWriteDriver.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | Debug 14 | ARM64 15 | 16 | 17 | Release 18 | ARM64 19 | 20 | 21 | 22 | {81B303F8-A07F-4CA0-BF02-AF95F2314F65} 23 | {1bc93793-694f-48fe-9372-81e2b05556fd} 24 | v4.5 25 | 12.0 26 | Debug 27 | x64 28 | KernelReadWriteDriver 29 | 30 | 31 | 32 | Windows10 33 | true 34 | WindowsKernelModeDriver10.0 35 | Driver 36 | KMDF 37 | Universal 38 | 39 | 40 | Windows10 41 | false 42 | WindowsKernelModeDriver10.0 43 | Driver 44 | KMDF 45 | Universal 46 | 47 | 48 | Windows10 49 | true 50 | WindowsKernelModeDriver10.0 51 | Driver 52 | KMDF 53 | Universal 54 | 55 | 56 | Windows10 57 | false 58 | WindowsKernelModeDriver10.0 59 | Driver 60 | KMDF 61 | Universal 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | DbgengKernelDebugger 73 | 74 | 75 | DbgengKernelDebugger 76 | true 77 | 78 | 79 | DbgengKernelDebugger 80 | 81 | 82 | DbgengKernelDebugger 83 | 84 | 85 | 86 | sha256 87 | 88 | 89 | 90 | 91 | sha256 92 | 93 | 94 | /INTEGRITYCHECK %(AdditionalOptions) 95 | 96 | 97 | 98 | 99 | sha256 100 | 101 | 102 | 103 | 104 | sha256 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /KernelReadWriteDriver/Communication.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Håndterer IOCTL-forespørgsler, der sendes til enhedsdriveren. 3 | * 4 | * Denne funktion er ansvarlig for at håndtere forskellige IOCTL-forespørgsler, der sendes til enhedsdriveren. 5 | * Den udfører forskellige operationer baseret på kontrolkoden angivet i IOCTL-forespørgslen. 6 | * 7 | * @param DeviceObject Pegeren til enhedsobjektet. 8 | * @param Irp Pegeren til IRP (I/O Request Packet), der repræsenterer IOCTL-forespørgslen. 9 | * @return NTSTATUS Statussen for håndtering af IOCTL-forespørgslen. 10 | */ 11 | NTSTATUS IoControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) 12 | { 13 | // Implementering af funktionen 14 | } 15 | 16 | /** 17 | * @brief Håndterer lukkeopkaldsforespørgslen, der sendes til enhedsdriveren. 18 | * 19 | * Denne funktion er ansvarlig for at håndtere lukkeopkaldsforespørgslen, der sendes til enhedsdriveren. 20 | * Den sætter statussen for IRP til succes og fuldfører forespørgslen. 21 | * 22 | * @param DeviceObject Pegeren til enhedsobjektet. 23 | * @param Irp Pegeren til IRP (I/O Request Packet), der repræsenterer lukkeopkaldsforespørgslen. 24 | * @return NTSTATUS Statussen for håndtering af lukkeopkaldsforespørgslen. 25 | */ 26 | NTSTATUS CloseCall(PDEVICE_OBJECT DeviceObject, PIRP Irp) 27 | { 28 | // Implementering af funktionen 29 | } 30 | 31 | /** 32 | * @brief Håndterer oprettelsesopkaldsforespørgslen, der sendes til enhedsdriveren. 33 | * 34 | * Denne funktion er ansvarlig for at håndtere oprettelsesopkaldsforespørgslen, der sendes til enhedsdriveren. 35 | * Den sætter statussen for IRP til succes og fuldfører forespørgslen. 36 | * 37 | * @param DeviceObject Pegeren til enhedsobjektet. 38 | * @param Irp Pegeren til IRP (I/O Request Packet), der repræsenterer oprettelsesopkaldsforespørgslen. 39 | * @return NTSTATUS Statussen for håndtering af oprettelsesopkaldsforespørgslen. 40 | */ 41 | 42 | #pragma warning (disable : 4100 4047 4024 4022) 43 | 44 | #include "Communication.h" 45 | #include "messages.h" 46 | #include "Data.h" 47 | #include "Events.h" 48 | #include "memory.h" 49 | 50 | // Definerer funktionen IoControl, der håndterer IO-kontrol kald. 51 | NTSTATUS IoControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) 52 | { 53 | // Ignorerer uanvendte parametre. 54 | UNREFERENCED_PARAMETER(DeviceObject); 55 | 56 | // Initialiserer variabler. 57 | NTSTATUS CurrentStatus = STATUS_UNSUCCESSFUL; 58 | ULONG ByteIO = 0; 59 | 60 | // Henter information om IRP-stakken. 61 | PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); 62 | 63 | // Henter kontrolkoden for IO-kontrol. 64 | ULONG ControlCode = Stack->Parameters.DeviceIoControl.IoControlCode; 65 | 66 | // Håndterer forskellige kontrolkoder. 67 | if (ControlCode == IO_GET_CLIENTADRESS) 68 | { 69 | // Henter output-bufferen. 70 | PULONG OutPut = (PULONG)Irp->AssociatedIrp.SystemBuffer; 71 | 72 | // Skriver besked til debugging. 73 | DebugMessage("ClientAdress: %d", BaseModuleAdress); 74 | 75 | // Gemmer adressen i output-bufferen. 76 | *OutPut = BaseModuleAdress; 77 | 78 | // Opdaterer antallet af bytes læst/skrevet. 79 | ByteIO = sizeof(*OutPut); 80 | 81 | // Opdaterer statussen til succes. 82 | CurrentStatus = STATUS_SUCCESS; 83 | } 84 | else if (ControlCode == IO_GET_PROCESSID) 85 | { 86 | // Henter output-bufferen. 87 | PULONG OutPut = (PULONG)Irp->AssociatedIrp.SystemBuffer; 88 | 89 | // Skriver besked til debugging. 90 | DebugMessage("ProcessId: %d", ProcessId); 91 | 92 | // Gemmer process-id i output-bufferen. 93 | *OutPut = ProcessId; 94 | 95 | // Opdaterer antallet af bytes læst/skrevet. 96 | ByteIO = sizeof(*OutPut); 97 | 98 | // Opdaterer statussen til succes. 99 | CurrentStatus = STATUS_SUCCESS; 100 | } 101 | else if (ControlCode == IO_SET_IMAGEBUFFER) 102 | { 103 | // Henter den nye billedbuffer. 104 | wchar_t *NewImgBuffer = (wchar_t*)Irp->AssociatedIrp.SystemBuffer; 105 | 106 | // Opdaterer billedbufferen. 107 | ImageBuffer = NewImgBuffer; 108 | 109 | // Opdaterer statussen til succes. 110 | CurrentStatus = STATUS_SUCCESS; 111 | } 112 | else if (ControlCode == IO_READ_REQUEST) 113 | { 114 | // Henter input-data til læseanmodningen. 115 | PKERNEL_READ_REQUEST ReadInput = (PKERNEL_READ_REQUEST)Irp->AssociatedIrp.SystemBuffer; 116 | PEPROCESS Process; 117 | 118 | // Slår processen op baseret på dens id. 119 | if (NT_SUCCESS(PsLookupProcessByProcessId(ReadInput->ProcessId, &Process))) 120 | { 121 | // Læser virtuel hukommelse fra processen. 122 | KernelReadVirtualMemory(Process, ReadInput->Address, ReadInput->pBuff, ReadInput->Size); 123 | 124 | // Opdaterer statussen til succes. 125 | CurrentStatus = STATUS_SUCCESS; 126 | 127 | // Opdaterer antallet af bytes læst/skrevet. 128 | ByteIO = sizeof(KERNEL_READ_REQUEST); 129 | } 130 | } 131 | else if (ControlCode == IO_WRITE_REQUEST) 132 | { 133 | // Henter input-data til skriveanmodningen. 134 | PKERNEL_WRITE_REQUEST WriteInput = (PKERNEL_WRITE_REQUEST)Irp->AssociatedIrp.SystemBuffer; 135 | PEPROCESS Process; 136 | 137 | // Slår processen op baseret på dens id. 138 | if (NT_SUCCESS(PsLookupProcessByProcessId(WriteInput->ProcessId, &Process))) 139 | { 140 | // Skriver til virtuel hukommelse i processen. 141 | KernelWriteVirtualMemory(Process, WriteInput->pBuff, WriteInput->Address, WriteInput->Size); 142 | 143 | // Opdaterer statussen til succes. 144 | CurrentStatus = STATUS_SUCCESS; 145 | 146 | // Opdaterer antallet af bytes læst/skrevet. 147 | ByteIO = sizeof(KERNEL_READ_REQUEST); 148 | } 149 | } 150 | else 151 | { 152 | // Hvis kontrolkoden ikke genkendes, sættes ByteIO til 0. 153 | ByteIO = 0; 154 | } 155 | 156 | // Opdaterer status og antal bytes for IRP'en. 157 | Irp->IoStatus.Status = CurrentStatus; 158 | Irp->IoStatus.Information = ByteIO; 159 | 160 | // Fuldfører IRP'en og frigiver ressourcer. 161 | IoCompleteRequest(Irp, IO_NO_INCREMENT); 162 | 163 | // Returnerer statussen for operationen. 164 | return CurrentStatus; 165 | } 166 | 167 | // Definerer funktionen CloseCall, der kaldes når en forbindelse lukkes. 168 | NTSTATUS CloseCall(PDEVICE_OBJECT DeviceObject, PIRP Irp) 169 | { 170 | // Ignorerer uanvendte parametre. 171 | UNREFERENCED_PARAMETER(DeviceObject); 172 | 173 | // Sætter statussen til succes. 174 | Irp->IoStatus.Status = STATUS_SUCCESS; 175 | Irp->IoStatus.Information = 0; 176 | 177 | // Fuldfører IRP'en og frigiver ressourcer. 178 | IoCompleteRequest(Irp, IO_NO_INCREMENT); 179 | 180 | // Skriver besked til debugging. 181 | DebugMessage("Forbindelse afsluttet\n"); 182 | 183 | // Returnerer statussen for operationen. 184 | return STATUS_SUCCESS; 185 | } 186 | 187 | // Definerer funktionen CreateCall, der kaldes når en forbindelse oprettes. 188 | NTSTATUS CreateCall(PDEVICE_OBJECT DeviceObject, PIRP Irp) 189 | { 190 | // Ignorerer uanvendte parametre. 191 | UNREFERENCED_PARAMETER(DeviceObject); 192 | 193 | // Sætter statussen til succes. 194 | Irp->IoStatus.Status = STATUS_SUCCESS; 195 | Irp->IoStatus.Information = 0; 196 | 197 | // Fuldfører IRP'en og frigiver ressourcer. 198 | IoCompleteRequest(Irp, IO_NO_INCREMENT); 199 | 200 | // Skriver besked til debugging. 201 | DebugMessage("Forbindelse etableret\n"); 202 | 203 | // Returnerer statussen for operationen. 204 | return STATUS_SUCCESS; 205 | } 206 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/imgui/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it) 7 | // B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template. 8 | //----------------------------------------------------------------------------- 9 | // You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp 10 | // files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures. 11 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 12 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using. 13 | //----------------------------------------------------------------------------- 14 | 15 | #pragma once 16 | 17 | //---- Define assertion handler. Defaults to calling assert(). 18 | // If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement. 19 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 20 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts 21 | 22 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows 23 | // Using dear imgui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility. 24 | //#define IMGUI_API __declspec( dllexport ) 25 | //#define IMGUI_API __declspec( dllimport ) 26 | 27 | //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. 28 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 29 | 30 | //---- Disable all of Dear ImGui or don't implement standard windows. 31 | // It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp. 32 | //#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. 33 | //#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended. 34 | //#define IMGUI_DISABLE_METRICS_WINDOW // Disable debug/metrics window: ShowMetricsWindow() will be empty. 35 | 36 | //---- Don't implement some functions to reduce linkage requirements. 37 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. 38 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow. 39 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime). 40 | //#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default). 41 | //#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf) 42 | //#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself. 43 | //#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function. 44 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). 45 | 46 | //---- Include imgui_user.h at the end of imgui.h as a convenience 47 | //#define IMGUI_INCLUDE_IMGUI_USER_H 48 | 49 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another) 50 | //#define IMGUI_USE_BGRA_PACKED_COLOR 51 | 52 | //---- Use 32-bit for ImWchar (default is 16-bit) to support unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...) 53 | //#define IMGUI_USE_WCHAR32 54 | 55 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 56 | // By default the embedded implementations are declared static and not available outside of imgui cpp files. 57 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 58 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 59 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 60 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 61 | 62 | //---- Unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined, use the much faster STB sprintf library implementation of vsnprintf instead of the one from the default C library. 63 | // Note that stb_sprintf.h is meant to be provided by the user and available in the include path at compile time. Also, the compatibility checks of the arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by STB sprintf. 64 | // #define IMGUI_USE_STB_SPRINTF 65 | 66 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. 67 | // This will be inlined as part of ImVec2 and ImVec4 class declarations. 68 | /* 69 | #define IM_VEC2_CLASS_EXTRA \ 70 | ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ 71 | operator MyVec2() const { return MyVec2(x,y); } 72 | 73 | #define IM_VEC4_CLASS_EXTRA \ 74 | ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \ 75 | operator MyVec4() const { return MyVec4(x,y,z,w); } 76 | */ 77 | 78 | //---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices. 79 | // Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices). 80 | // Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer. 81 | // Read about ImGuiBackendFlags_RendererHasVtxOffset for details. 82 | //#define ImDrawIdx unsigned int 83 | 84 | //---- Override ImDrawCallback signature (will need to modify renderer backends accordingly) 85 | //struct ImDrawList; 86 | //struct ImDrawCmd; 87 | //typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data); 88 | //#define ImDrawCallback MyImDrawCallback 89 | 90 | //---- Debug Tools: Macro to break in Debugger 91 | // (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.) 92 | //#define IM_DEBUG_BREAK IM_ASSERT(0) 93 | //#define IM_DEBUG_BREAK __debugbreak() 94 | 95 | //---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(), 96 | // (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.) 97 | // This adds a small runtime cost which is why it is not enabled by default. 98 | //#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX 99 | 100 | //---- Debug Tools: Enable slower asserts 101 | //#define IMGUI_DEBUG_PARANOID 102 | 103 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 104 | /* 105 | namespace ImGui 106 | { 107 | void MyFunction(const char* name, const MyMatrix44& v); 108 | } 109 | */ 110 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/directx/d3dx9shape.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (C) Microsoft Corporation. All Rights Reserved. 4 | // 5 | // File: d3dx9shapes.h 6 | // Content: D3DX simple shapes 7 | // 8 | /////////////////////////////////////////////////////////////////////////// 9 | 10 | #include "d3dx9.h" 11 | 12 | #ifndef __D3DX9SHAPES_H__ 13 | #define __D3DX9SHAPES_H__ 14 | 15 | /////////////////////////////////////////////////////////////////////////// 16 | // Functions: 17 | /////////////////////////////////////////////////////////////////////////// 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif //__cplusplus 22 | 23 | 24 | //------------------------------------------------------------------------- 25 | // D3DXCreatePolygon: 26 | // ------------------ 27 | // Creates a mesh containing an n-sided polygon. The polygon is centered 28 | // at the origin. 29 | // 30 | // Parameters: 31 | // 32 | // pDevice The D3D device with which the mesh is going to be used. 33 | // Length Length of each side. 34 | // Sides Number of sides the polygon has. (Must be >= 3) 35 | // ppMesh The mesh object which will be created 36 | // ppAdjacency Returns a buffer containing adjacency info. Can be NULL. 37 | //------------------------------------------------------------------------- 38 | HRESULT WINAPI 39 | D3DXCreatePolygon( 40 | LPDIRECT3DDEVICE9 pDevice, 41 | FLOAT Length, 42 | UINT Sides, 43 | LPD3DXMESH* ppMesh, 44 | LPD3DXBUFFER* ppAdjacency); 45 | 46 | 47 | //------------------------------------------------------------------------- 48 | // D3DXCreateBox: 49 | // -------------- 50 | // Creates a mesh containing an axis-aligned box. The box is centered at 51 | // the origin. 52 | // 53 | // Parameters: 54 | // 55 | // pDevice The D3D device with which the mesh is going to be used. 56 | // Width Width of box (along X-axis) 57 | // Height Height of box (along Y-axis) 58 | // Depth Depth of box (along Z-axis) 59 | // ppMesh The mesh object which will be created 60 | // ppAdjacency Returns a buffer containing adjacency info. Can be NULL. 61 | //------------------------------------------------------------------------- 62 | HRESULT WINAPI 63 | D3DXCreateBox( 64 | LPDIRECT3DDEVICE9 pDevice, 65 | FLOAT Width, 66 | FLOAT Height, 67 | FLOAT Depth, 68 | LPD3DXMESH* ppMesh, 69 | LPD3DXBUFFER* ppAdjacency); 70 | 71 | 72 | //------------------------------------------------------------------------- 73 | // D3DXCreateCylinder: 74 | // ------------------- 75 | // Creates a mesh containing a cylinder. The generated cylinder is 76 | // centered at the origin, and its axis is aligned with the Z-axis. 77 | // 78 | // Parameters: 79 | // 80 | // pDevice The D3D device with which the mesh is going to be used. 81 | // Radius1 Radius at -Z end (should be >= 0.0f) 82 | // Radius2 Radius at +Z end (should be >= 0.0f) 83 | // Length Length of cylinder (along Z-axis) 84 | // Slices Number of slices about the main axis 85 | // Stacks Number of stacks along the main axis 86 | // ppMesh The mesh object which will be created 87 | // ppAdjacency Returns a buffer containing adjacency info. Can be NULL. 88 | //------------------------------------------------------------------------- 89 | HRESULT WINAPI 90 | D3DXCreateCylinder( 91 | LPDIRECT3DDEVICE9 pDevice, 92 | FLOAT Radius1, 93 | FLOAT Radius2, 94 | FLOAT Length, 95 | UINT Slices, 96 | UINT Stacks, 97 | LPD3DXMESH* ppMesh, 98 | LPD3DXBUFFER* ppAdjacency); 99 | 100 | 101 | //------------------------------------------------------------------------- 102 | // D3DXCreateSphere: 103 | // ----------------- 104 | // Creates a mesh containing a sphere. The sphere is centered at the 105 | // origin. 106 | // 107 | // Parameters: 108 | // 109 | // pDevice The D3D device with which the mesh is going to be used. 110 | // Radius Radius of the sphere (should be >= 0.0f) 111 | // Slices Number of slices about the main axis 112 | // Stacks Number of stacks along the main axis 113 | // ppMesh The mesh object which will be created 114 | // ppAdjacency Returns a buffer containing adjacency info. Can be NULL. 115 | //------------------------------------------------------------------------- 116 | HRESULT WINAPI 117 | D3DXCreateSphere( 118 | LPDIRECT3DDEVICE9 pDevice, 119 | FLOAT Radius, 120 | UINT Slices, 121 | UINT Stacks, 122 | LPD3DXMESH* ppMesh, 123 | LPD3DXBUFFER* ppAdjacency); 124 | 125 | 126 | //------------------------------------------------------------------------- 127 | // D3DXCreateTorus: 128 | // ---------------- 129 | // Creates a mesh containing a torus. The generated torus is centered at 130 | // the origin, and its axis is aligned with the Z-axis. 131 | // 132 | // Parameters: 133 | // 134 | // pDevice The D3D device with which the mesh is going to be used. 135 | // InnerRadius Inner radius of the torus (should be >= 0.0f) 136 | // OuterRadius Outer radius of the torue (should be >= 0.0f) 137 | // Sides Number of sides in a cross-section (must be >= 3) 138 | // Rings Number of rings making up the torus (must be >= 3) 139 | // ppMesh The mesh object which will be created 140 | // ppAdjacency Returns a buffer containing adjacency info. Can be NULL. 141 | //------------------------------------------------------------------------- 142 | HRESULT WINAPI 143 | D3DXCreateTorus( 144 | LPDIRECT3DDEVICE9 pDevice, 145 | FLOAT InnerRadius, 146 | FLOAT OuterRadius, 147 | UINT Sides, 148 | UINT Rings, 149 | LPD3DXMESH* ppMesh, 150 | LPD3DXBUFFER* ppAdjacency); 151 | 152 | 153 | //------------------------------------------------------------------------- 154 | // D3DXCreateTeapot: 155 | // ----------------- 156 | // Creates a mesh containing a teapot. 157 | // 158 | // Parameters: 159 | // 160 | // pDevice The D3D device with which the mesh is going to be used. 161 | // ppMesh The mesh object which will be created 162 | // ppAdjacency Returns a buffer containing adjacency info. Can be NULL. 163 | //------------------------------------------------------------------------- 164 | HRESULT WINAPI 165 | D3DXCreateTeapot( 166 | LPDIRECT3DDEVICE9 pDevice, 167 | LPD3DXMESH* ppMesh, 168 | LPD3DXBUFFER* ppAdjacency); 169 | 170 | 171 | //------------------------------------------------------------------------- 172 | // D3DXCreateText: 173 | // --------------- 174 | // Creates a mesh containing the specified text using the font associated 175 | // with the device context. 176 | // 177 | // Parameters: 178 | // 179 | // pDevice The D3D device with which the mesh is going to be used. 180 | // hDC Device context, with desired font selected 181 | // pText Text to generate 182 | // Deviation Maximum chordal deviation from true font outlines 183 | // Extrusion Amount to extrude text in -Z direction 184 | // ppMesh The mesh object which will be created 185 | // pGlyphMetrics Address of buffer to receive glyph metric data (or NULL) 186 | //------------------------------------------------------------------------- 187 | HRESULT WINAPI 188 | D3DXCreateTextA( 189 | LPDIRECT3DDEVICE9 pDevice, 190 | HDC hDC, 191 | LPCSTR pText, 192 | FLOAT Deviation, 193 | FLOAT Extrusion, 194 | LPD3DXMESH* ppMesh, 195 | LPD3DXBUFFER* ppAdjacency, 196 | LPGLYPHMETRICSFLOAT pGlyphMetrics); 197 | 198 | HRESULT WINAPI 199 | D3DXCreateTextW( 200 | LPDIRECT3DDEVICE9 pDevice, 201 | HDC hDC, 202 | LPCWSTR pText, 203 | FLOAT Deviation, 204 | FLOAT Extrusion, 205 | LPD3DXMESH* ppMesh, 206 | LPD3DXBUFFER* ppAdjacency, 207 | LPGLYPHMETRICSFLOAT pGlyphMetrics); 208 | 209 | #ifdef UNICODE 210 | #define D3DXCreateText D3DXCreateTextW 211 | #else 212 | #define D3DXCreateText D3DXCreateTextA 213 | #endif 214 | 215 | 216 | #ifdef __cplusplus 217 | } 218 | #endif //__cplusplus 219 | 220 | #endif //__D3DX9SHAPES_H__ 221 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The-Kernel-Driver-GUIDE 2 | 3 | ![banner](https://github.com/CollinEdward/The-Kernel-Driver-Tutorial/assets/66748817/998669c2-d062-4ce0-a671-2917e84058ca) 4 | 5 | ![C](https://img.shields.io/badge/C-00599C?style=for-the-badge&logo=c&logoColor=white) 6 | ![C++](https://img.shields.io/badge/C++-00599C?style=for-the-badge&logo=c%2B%2B&logoColor=white) 7 | 8 | # What this project is 9 | 10 | This project is a comprehensive tool designed for interacting with a game at a low level, primarily intended for creating cheats or mods. It consists of a kernel driver located in the "KernelReadWriteDriver" directory and a user mode application with a graphical user interface, located in the "KernelReadWriteDriver_UserMode_IMGUI" directory. 11 | 12 | The kernel driver provides essential functionality for reading from and writing to virtual memory, enabling users to manipulate various aspects of the game's state. Meanwhile, the user mode application utilizes this functionality to implement a range of features, including an aimbot, while also offering a user-friendly interface for configuring these features. 13 | 14 | To maintain organization and ease of use, the project is neatly structured with separate directories for the kernel driver and the user mode application. Additionally, it comes with several supplementary resources, such as a font file named "arial.ttf", a Cheat Engine table named "assaultcube.CT", and a PowerShell script for automated installation labeled "autoinstall.ps1". 15 | 16 | ## Welcome to The Kernel Driver Guide 17 | 18 | Hello and welcome to this comprehensive guide. Please read through carefully to avoid any mistakes. This guide is designed to provide a straightforward walkthrough for creating a simple kernel driver for Windows. 19 | If you would like to support this project and don't feel like compiling the binaries yourself, go to [patreon](https://www.patreon.com/icysponge/shop) to get the pre-compiled binaries. 20 | 21 | ### Showcase Video 22 | 23 | You can watch a showcase video [here](https://www.youtube.com/watch?v=uPxO-6N00NI&ab_channel=CollinEdward). 24 | 25 | ## Sequence of running the application in the right order 26 | 27 | The process of running the applications in the correct order involves the following steps: 28 | 29 | 1. Start the Driver 30 | 2. Run the Game 31 | 3. Start the User Mode Application 32 | 33 | The flowchart below illustrates this process: 34 | 35 | ![Flowchart](flow-chart.png) 36 | 37 | Each step is represented by a box, and the arrows represent the flow from one step to the next. The boxes filled with light green color indicate that the corresponding application is running. 38 | 39 | --- 40 | 41 | ## Prerequisites 42 | 43 | > [!IMPORTANT] 44 | Before you begin, ensure that you have the following: 45 | 46 | - A Windows machine with Secure Boot disabled 47 | - At least 4 GB RAM on your Windows machine 48 | - [Windows Redistributable](https://download.visualstudio.microsoft.com/download/pr/a061be25-c14a-489a-8c7c-bb72adfb3cab/4DFE83C91124CD542F4222FE2C396CABEAC617BB6F59BDCBDF89FD6F0DF0A32F/VC_redist.x64.exe) 49 | - [DirectX]([https://download.microsoft.com/download/1/7/1/1718CCC4-6315-4D8E-9543-8E28A4E18C4C/dxwebsetup.exe](https://www.microsoft.com/en-us/download/details.aspx?id=6812)) 50 | 51 | ### Disabling Secure Boot 52 | 53 | 1. **Restart your computer:** Access the BIOS/UEFI settings by pressing F2, F10, or Delete (based on your computer's manufacturer). 54 | 2. **Locate Secure Boot:** Find the Secure Boot setting in the "Security" or "Trusted Platform Module (TPM)" section. 55 | 3. **Disable Secure Boot:** Save the settings and boot into Windows. 56 | 57 | ## Additional Tips for Disabling Secure Boot 58 | 59 | > [!TIP] 60 | Back up your data before disabling Secure Boot. 61 | 62 | > [!IMPORTANT] 63 | > Disable Secure Boot only when necessary, such as running virtual machines or specific software. 64 | 65 | > [!CAUTION] 66 | > Re-enable Secure Boot to protect your computer once done with the required tasks. 67 | 68 | 69 | 70 | ## Download and Setup 71 | 72 | To develop a kernel driver, set up your environment by downloading the following requirements: 73 | 74 | 1.1 **Install Visual Studio 2022:** [Download Link](https://visualstudio.microsoft.com/downloads/) 75 | 76 | 1.2 - Install Desktop Development With C++ 77 | 1.3 Install Individual components listed: 78 | - C++ ATL for latest v143 build tools with Spectre Mitigations (ARM64/ARM64EC) 79 | - C++ ATL for latest v143 build tools with Spectre Mitigations (x86 & x86) 80 | - C++ MFC for latest v143 build tools with Spectre Mitigations (ARM64/ARM64EC) 81 | - MSVC v143 - VS 2022 C++ ARM64/ARM64EC Spectre-mitigated libs (Latest) 82 | - MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest) 83 | 84 | 85 | 2 **Install Windows SDK:** [Download Link](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/) 86 | 3 **Install Windows Driver Kit (WDK):** [Download Link](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) 87 | 88 | - Follow [this tutorial](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) if the above WDK link is outdated. 89 | - When installing components for Visual Studio 2022, select "Desktop development with C++" and specific individual components as listed in the guide. 90 | 91 | #### Installing Debug View 92 | 93 | - Download Debug View: [Direct Link](https://download.sysinternals.com/files/DebugView.zip) or [Sysinternals Website](https://learn.microsoft.com/en-us/sysinternals/downloads/debugview) 94 | 95 | --- 96 | 97 | ## Visual Studio 2022 Project Setup 98 | 99 | 1. **Create a new kernel mode driver project:** Choose "Kernel Mode Driver, Empty (KMDF)" in Visual Studio. 100 | - Right-click on the project. 101 | - Activate "Use Local Time" and Enable Active(Release). 102 | - Navigate to "Linker" -> "Command Line" and add "/INTEGRITYCHECK". 103 | - Add a class with the same name as the project. 104 | 105 | --- 106 | 107 | ## Creating and Running the Driver (Using Debug View) 108 | 109 | 1. **Add a new header file:** Name it "messages.h" in the Header Files folder. 110 | 2. **Define a function:** Create a function called `debug_message` that takes a string and extra parameters. 111 | 3. **Include the header file:** Add "messages.h" in your source file. 112 | 4. **Create functions:** 113 | - `driver_entry` that takes a `PDRIVER_OBJECT` and a `PUNICODE_STRING`. 114 | - `unload_driver` that takes a `PDRIVER_OBJECT`. 115 | - Call `debug_message` to print a message when the driver starts and stops. 116 | 5. **Compile the driver.** 117 | 118 | --- 119 | 120 | ## Setting Up Kernel Driver (Using `sc create` command) 121 | 122 | 1. **Set Kernel driver Bin Path:** Use `sc create` command. 123 | - Replace "computer name" with your actual computer name and "KernelReadWriteDriver.sys" with your .sys file name. 124 | 125 | ``` 126 | sc create KernelReadWriteDriver type= Kernel Binpath="C:\Users\computer name\source\repos\KernelReadWriteDriver\x64\Release\KernelReadWriteDriver.sys" 127 | ``` 128 | 129 | 2. **Enable test signing:** Use the command: 130 | ``` 131 | bcdedit /set testsigning on 132 | ``` 133 | 134 | 3. **Start DebugView in ADMIN mode.** 135 | 4. **Enable Capture Kernel In Debug View.** 136 | 137 | 5. **Load the driver using the sc command:** 138 | ``` 139 | sc start "kernel driver name" 140 | ``` 141 | 142 | > [!TIP] 143 | > When and if encountering an error do the following: 144 | 145 | 5.1 146 | Run the following command in ADMIN cmd and restart: 147 | ``` 148 | bcdedit /set nointegritychecks on 149 | ``` 150 | 151 | 6. **Stop the driver using the sc command:** 152 | ``` 153 | sc stop "kernel driver name" 154 | ``` 155 | 156 | ## Sequence of running the application in the right order 157 | 158 | 159 | --- 160 | 161 | ## How Everything in it Works 162 | 163 | Before we congratulate you on completing The-Kernel-Driver-Tutorial, let's understand how everything works: 164 | 165 | - **Secure Boot:** Disabled to allow the execution of kernel drivers. 166 | - **Visual Studio Setup:** Establishes a development environment. 167 | - **WDK and SDK:** Essential tools for kernel mode driver development. 168 | - **Debug View:** Monitors debug output from the driver. 169 | 170 | ### Driver Functionality 171 | 172 | - **Driver Entry:** Initializes the kernel driver when loaded into the Windows kernel. 173 | - **Unload Driver:** Handles cleanup when the driver is unloaded. 174 | - **Debug Message:** Prints diagnostic messages for debugging purposes. 175 | 176 | ### Kernel-to-User Communication 177 | 178 | 1. **Driver Setup:** The kernel driver is compiled and integrated into the Windows kernel using `sc create` command. 179 | 2. **User Space Application:** Develop a user-space application that communicates with the kernel driver. 180 | 3. **Communication Mechanism:** Use Windows API or custom communication mechanisms like IOCTLs for communication between user and kernel space. 181 | 182 | ### Driver Execution 183 | 184 | 1. **Test Signing:** Enabled to allow the loading of the kernel driver during development. 185 | 2. **DebugView:** Captures debug messages for monitoring driver execution. 186 | 3. **Driver Load and Unload:** The driver is loaded and unloaded using the `sc start` and `sc stop` commands. 187 | 188 | --- 189 | 190 | ## Congratulations! 191 | 192 | Congratulations on completing The-Kernel-Driver-Tutorial! You've successfully set up your development environment, disabled Secure Boot, created a simple kernel driver for Windows, and gained insights into kernel-to-user communication. This foundation opens doors to advanced driver development and system-level interactions. 193 | 194 | --- 195 | 196 | ## Cheat Table Content for Assaulted Cube Process 197 | 198 | - Cheat entries can be found in [cheat-entries.md](cheat-entries.md) or by downloading the [assaultcube.CT](assaultcube.CT) file. Run it with Cheat Engine while playing the [game](https://github.com/assaultcube/AC/releases/tag/v1.3.0.2). 199 | 200 | --- 201 | 202 | ## Honorable Mentions 203 | 204 | Special thanks to the following resources and explanation videos: 205 | 206 | - [Video 1](https://www.youtube.com/watch?v=6TBQ7lWYQ0g) 207 | - [Video 2](https://www.youtube.com/watch?v=EaxaQYESDlM) 208 | - [Video 3](https://www.youtube.com/watch?v=KzD_nc5B_8w) 209 | - [Video 4](https://www.youtube.com/watch?v=eumG222Efzs) 210 | - [Video 5](https://www.youtube.com/watch?v=8oC0w6WhZ1E) 211 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/KernelReadWriteDriver_UserMode_IMGUI.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {d0ff7ecf-244b-40cc-8eca-b9b408e24260} 25 | Socks5Bot 26 | 10.0 27 | KernelReadWriteDriver_UserMode_IMGUI 28 | 29 | 30 | 31 | Application 32 | true 33 | v143 34 | Unicode 35 | 36 | 37 | Application 38 | false 39 | v143 40 | true 41 | Unicode 42 | 43 | 44 | Application 45 | true 46 | v143 47 | Unicode 48 | 49 | 50 | Application 51 | false 52 | v143 53 | true 54 | Unicode 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | C:\Users\Oskar\Documents\GitHub\The-Kernel-Driver-Tutorial\KernelReadWriteDriver_UserMode_IMGUI\;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include\;$(IncludePath) 76 | $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(DXSDK_DIR)LIB\x86 77 | 78 | 79 | C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) 80 | false 81 | C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) 82 | 83 | 84 | 85 | Level3 86 | true 87 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 88 | true 89 | 90 | 91 | Console 92 | true 93 | 94 | 95 | 96 | 97 | Level3 98 | true 99 | true 100 | true 101 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 102 | true 103 | 104 | 105 | Console 106 | true 107 | true 108 | true 109 | 110 | 111 | 112 | 113 | Level3 114 | true 115 | _CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;CURL_DISABLE_LDAP;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 116 | true 117 | stdcpp20 118 | stdc17 119 | $(DXSDK_DIR)LIB\x86 120 | 121 | 122 | Console 123 | true 124 | d3d9.lib;ws2_32.lib;winmm.lib;Wldap32.lib;advapi32.lib;crypt32.lib;Normaliz.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) 125 | 126 | 127 | 128 | 129 | Level3 130 | true 131 | true 132 | true 133 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 134 | true 135 | stdcpp20 136 | stdc17 137 | Disabled 138 | 139 | 140 | Console 141 | true 142 | true 143 | true 144 | d3d9.lib;ws2_32.lib;winmm.lib;Wldap32.lib;advapi32.lib;crypt32.lib;Normaliz.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/directx/d3dx9xof.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (C) Microsoft Corporation. All Rights Reserved. 4 | // 5 | // File: d3dx9xof.h 6 | // Content: D3DX .X File types and functions 7 | // 8 | /////////////////////////////////////////////////////////////////////////// 9 | 10 | #include "d3dx9.h" 11 | 12 | #if !defined( __D3DX9XOF_H__ ) 13 | #define __D3DX9XOF_H__ 14 | 15 | #if defined( __cplusplus ) 16 | extern "C" { 17 | #endif // defined( __cplusplus ) 18 | 19 | //---------------------------------------------------------------------------- 20 | // D3DXF_FILEFORMAT 21 | // This flag is used to specify what file type to use when saving to disk. 22 | // _BINARY, and _TEXT are mutually exclusive, while 23 | // _COMPRESSED is an optional setting that works with all file types. 24 | //---------------------------------------------------------------------------- 25 | typedef DWORD D3DXF_FILEFORMAT; 26 | 27 | #define D3DXF_FILEFORMAT_BINARY 0 28 | #define D3DXF_FILEFORMAT_TEXT 1 29 | #define D3DXF_FILEFORMAT_COMPRESSED 2 30 | 31 | //---------------------------------------------------------------------------- 32 | // D3DXF_FILESAVEOPTIONS 33 | // This flag is used to specify where to save the file to. Each flag is 34 | // mutually exclusive, indicates the data location of the file, and also 35 | // chooses which additional data will specify the location. 36 | // _TOFILE is paired with a filename (LPCSTR) 37 | // _TOWFILE is paired with a filename (LPWSTR) 38 | //---------------------------------------------------------------------------- 39 | typedef DWORD D3DXF_FILESAVEOPTIONS; 40 | 41 | #define D3DXF_FILESAVE_TOFILE 0x00L 42 | #define D3DXF_FILESAVE_TOWFILE 0x01L 43 | 44 | //---------------------------------------------------------------------------- 45 | // D3DXF_FILELOADOPTIONS 46 | // This flag is used to specify where to load the file from. Each flag is 47 | // mutually exclusive, indicates the data location of the file, and also 48 | // chooses which additional data will specify the location. 49 | // _FROMFILE is paired with a filename (LPCSTR) 50 | // _FROMWFILE is paired with a filename (LPWSTR) 51 | // _FROMRESOURCE is paired with a (D3DXF_FILELOADRESOUCE*) description. 52 | // _FROMMEMORY is paired with a (D3DXF_FILELOADMEMORY*) description. 53 | //---------------------------------------------------------------------------- 54 | typedef DWORD D3DXF_FILELOADOPTIONS; 55 | 56 | #define D3DXF_FILELOAD_FROMFILE 0x00L 57 | #define D3DXF_FILELOAD_FROMWFILE 0x01L 58 | #define D3DXF_FILELOAD_FROMRESOURCE 0x02L 59 | #define D3DXF_FILELOAD_FROMMEMORY 0x03L 60 | 61 | //---------------------------------------------------------------------------- 62 | // D3DXF_FILELOADRESOURCE: 63 | //---------------------------------------------------------------------------- 64 | 65 | typedef struct _D3DXF_FILELOADRESOURCE 66 | { 67 | HMODULE hModule; // Desc 68 | LPCSTR lpName; // Desc 69 | LPCSTR lpType; // Desc 70 | } D3DXF_FILELOADRESOURCE; 71 | 72 | //---------------------------------------------------------------------------- 73 | // D3DXF_FILELOADMEMORY: 74 | //---------------------------------------------------------------------------- 75 | 76 | typedef struct _D3DXF_FILELOADMEMORY 77 | { 78 | LPCVOID lpMemory; // Desc 79 | SIZE_T dSize; // Desc 80 | } D3DXF_FILELOADMEMORY; 81 | 82 | #if defined( _WIN32 ) && !defined( _NO_COM ) 83 | 84 | // {cef08cf9-7b4f-4429-9624-2a690a933201} 85 | DEFINE_GUID( IID_ID3DXFile, 86 | 0xcef08cf9, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); 87 | 88 | // {cef08cfa-7b4f-4429-9624-2a690a933201} 89 | DEFINE_GUID( IID_ID3DXFileSaveObject, 90 | 0xcef08cfa, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); 91 | 92 | // {cef08cfb-7b4f-4429-9624-2a690a933201} 93 | DEFINE_GUID( IID_ID3DXFileSaveData, 94 | 0xcef08cfb, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); 95 | 96 | // {cef08cfc-7b4f-4429-9624-2a690a933201} 97 | DEFINE_GUID( IID_ID3DXFileEnumObject, 98 | 0xcef08cfc, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); 99 | 100 | // {cef08cfd-7b4f-4429-9624-2a690a933201} 101 | DEFINE_GUID( IID_ID3DXFileData, 102 | 0xcef08cfd, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); 103 | 104 | #endif // defined( _WIN32 ) && !defined( _NO_COM ) 105 | 106 | #if defined( __cplusplus ) 107 | #if !defined( DECLSPEC_UUID ) 108 | #if _MSC_VER >= 1100 109 | #define DECLSPEC_UUID( x ) __declspec( uuid( x ) ) 110 | #else // !( _MSC_VER >= 1100 ) 111 | #define DECLSPEC_UUID( x ) 112 | #endif // !( _MSC_VER >= 1100 ) 113 | #endif // !defined( DECLSPEC_UUID ) 114 | 115 | interface DECLSPEC_UUID( "cef08cf9-7b4f-4429-9624-2a690a933201" ) 116 | ID3DXFile; 117 | interface DECLSPEC_UUID( "cef08cfa-7b4f-4429-9624-2a690a933201" ) 118 | ID3DXFileSaveObject; 119 | interface DECLSPEC_UUID( "cef08cfb-7b4f-4429-9624-2a690a933201" ) 120 | ID3DXFileSaveData; 121 | interface DECLSPEC_UUID( "cef08cfc-7b4f-4429-9624-2a690a933201" ) 122 | ID3DXFileEnumObject; 123 | interface DECLSPEC_UUID( "cef08cfd-7b4f-4429-9624-2a690a933201" ) 124 | ID3DXFileData; 125 | 126 | #if defined( _COM_SMARTPTR_TYPEDEF ) 127 | _COM_SMARTPTR_TYPEDEF( ID3DXFile, 128 | __uuidof( ID3DXFile ) ); 129 | _COM_SMARTPTR_TYPEDEF( ID3DXFileSaveObject, 130 | __uuidof( ID3DXFileSaveObject ) ); 131 | _COM_SMARTPTR_TYPEDEF( ID3DXFileSaveData, 132 | __uuidof( ID3DXFileSaveData ) ); 133 | _COM_SMARTPTR_TYPEDEF( ID3DXFileEnumObject, 134 | __uuidof( ID3DXFileEnumObject ) ); 135 | _COM_SMARTPTR_TYPEDEF( ID3DXFileData, 136 | __uuidof( ID3DXFileData ) ); 137 | #endif // defined( _COM_SMARTPTR_TYPEDEF ) 138 | #endif // defined( __cplusplus ) 139 | 140 | typedef interface ID3DXFile ID3DXFile; 141 | typedef interface ID3DXFileSaveObject ID3DXFileSaveObject; 142 | typedef interface ID3DXFileSaveData ID3DXFileSaveData; 143 | typedef interface ID3DXFileEnumObject ID3DXFileEnumObject; 144 | typedef interface ID3DXFileData ID3DXFileData; 145 | 146 | ////////////////////////////////////////////////////////////////////////////// 147 | // ID3DXFile ///////////////////////////////////////////////////////////////// 148 | ////////////////////////////////////////////////////////////////////////////// 149 | 150 | #undef INTERFACE 151 | #define INTERFACE ID3DXFile 152 | 153 | DECLARE_INTERFACE_( ID3DXFile, IUnknown ) 154 | { 155 | STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; 156 | STDMETHOD_( ULONG, AddRef )( THIS ) PURE; 157 | STDMETHOD_( ULONG, Release )( THIS ) PURE; 158 | 159 | STDMETHOD( CreateEnumObject )( THIS_ LPCVOID, D3DXF_FILELOADOPTIONS, 160 | ID3DXFileEnumObject** ) PURE; 161 | STDMETHOD( CreateSaveObject )( THIS_ LPCVOID, D3DXF_FILESAVEOPTIONS, 162 | D3DXF_FILEFORMAT, ID3DXFileSaveObject** ) PURE; 163 | STDMETHOD( RegisterTemplates )( THIS_ LPCVOID, SIZE_T ) PURE; 164 | STDMETHOD( RegisterEnumTemplates )( THIS_ ID3DXFileEnumObject* ) PURE; 165 | }; 166 | 167 | ////////////////////////////////////////////////////////////////////////////// 168 | // ID3DXFileSaveObject /////////////////////////////////////////////////////// 169 | ////////////////////////////////////////////////////////////////////////////// 170 | 171 | #undef INTERFACE 172 | #define INTERFACE ID3DXFileSaveObject 173 | 174 | DECLARE_INTERFACE_( ID3DXFileSaveObject, IUnknown ) 175 | { 176 | STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; 177 | STDMETHOD_( ULONG, AddRef )( THIS ) PURE; 178 | STDMETHOD_( ULONG, Release )( THIS ) PURE; 179 | 180 | STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE; 181 | STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*, 182 | SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE; 183 | STDMETHOD( Save )( THIS ) PURE; 184 | }; 185 | 186 | ////////////////////////////////////////////////////////////////////////////// 187 | // ID3DXFileSaveData ///////////////////////////////////////////////////////// 188 | ////////////////////////////////////////////////////////////////////////////// 189 | 190 | #undef INTERFACE 191 | #define INTERFACE ID3DXFileSaveData 192 | 193 | DECLARE_INTERFACE_( ID3DXFileSaveData, IUnknown ) 194 | { 195 | STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; 196 | STDMETHOD_( ULONG, AddRef )( THIS ) PURE; 197 | STDMETHOD_( ULONG, Release )( THIS ) PURE; 198 | 199 | STDMETHOD( GetSave )( THIS_ ID3DXFileSaveObject** ) PURE; 200 | STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE; 201 | STDMETHOD( GetId )( THIS_ LPGUID ) PURE; 202 | STDMETHOD( GetType )( THIS_ GUID* ) PURE; 203 | STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*, 204 | SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE; 205 | STDMETHOD( AddDataReference )( THIS_ LPCSTR, CONST GUID* ) PURE; 206 | }; 207 | 208 | ////////////////////////////////////////////////////////////////////////////// 209 | // ID3DXFileEnumObject /////////////////////////////////////////////////////// 210 | ////////////////////////////////////////////////////////////////////////////// 211 | 212 | #undef INTERFACE 213 | #define INTERFACE ID3DXFileEnumObject 214 | 215 | DECLARE_INTERFACE_( ID3DXFileEnumObject, IUnknown ) 216 | { 217 | STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; 218 | STDMETHOD_( ULONG, AddRef )( THIS ) PURE; 219 | STDMETHOD_( ULONG, Release )( THIS ) PURE; 220 | 221 | STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE; 222 | STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE; 223 | STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE; 224 | STDMETHOD( GetDataObjectById )( THIS_ REFGUID, ID3DXFileData** ) PURE; 225 | STDMETHOD( GetDataObjectByName )( THIS_ LPCSTR, ID3DXFileData** ) PURE; 226 | }; 227 | 228 | ////////////////////////////////////////////////////////////////////////////// 229 | // ID3DXFileData ///////////////////////////////////////////////////////////// 230 | ////////////////////////////////////////////////////////////////////////////// 231 | 232 | #undef INTERFACE 233 | #define INTERFACE ID3DXFileData 234 | 235 | DECLARE_INTERFACE_( ID3DXFileData, IUnknown ) 236 | { 237 | STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; 238 | STDMETHOD_( ULONG, AddRef )( THIS ) PURE; 239 | STDMETHOD_( ULONG, Release )( THIS ) PURE; 240 | 241 | STDMETHOD( GetEnum )( THIS_ ID3DXFileEnumObject** ) PURE; 242 | STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE; 243 | STDMETHOD( GetId )( THIS_ LPGUID ) PURE; 244 | STDMETHOD( Lock )( THIS_ SIZE_T*, LPCVOID* ) PURE; 245 | STDMETHOD( Unlock )( THIS ) PURE; 246 | STDMETHOD( GetType )( THIS_ GUID* ) PURE; 247 | STDMETHOD_( BOOL, IsReference )( THIS ) PURE; 248 | STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE; 249 | STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE; 250 | }; 251 | 252 | STDAPI D3DXFileCreate( ID3DXFile** lplpDirectXFile ); 253 | 254 | /* 255 | * DirectX File errors. 256 | */ 257 | 258 | #define _FACD3DXF 0x876 259 | 260 | #define D3DXFERR_BADOBJECT MAKE_HRESULT( 1, _FACD3DXF, 900 ) 261 | #define D3DXFERR_BADVALUE MAKE_HRESULT( 1, _FACD3DXF, 901 ) 262 | #define D3DXFERR_BADTYPE MAKE_HRESULT( 1, _FACD3DXF, 902 ) 263 | #define D3DXFERR_NOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 903 ) 264 | #define D3DXFERR_NOTDONEYET MAKE_HRESULT( 1, _FACD3DXF, 904 ) 265 | #define D3DXFERR_FILENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 905 ) 266 | #define D3DXFERR_RESOURCENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 906 ) 267 | #define D3DXFERR_BADRESOURCE MAKE_HRESULT( 1, _FACD3DXF, 907 ) 268 | #define D3DXFERR_BADFILETYPE MAKE_HRESULT( 1, _FACD3DXF, 908 ) 269 | #define D3DXFERR_BADFILEVERSION MAKE_HRESULT( 1, _FACD3DXF, 909 ) 270 | #define D3DXFERR_BADFILEFLOATSIZE MAKE_HRESULT( 1, _FACD3DXF, 910 ) 271 | #define D3DXFERR_BADFILE MAKE_HRESULT( 1, _FACD3DXF, 911 ) 272 | #define D3DXFERR_PARSEERROR MAKE_HRESULT( 1, _FACD3DXF, 912 ) 273 | #define D3DXFERR_BADARRAYSIZE MAKE_HRESULT( 1, _FACD3DXF, 913 ) 274 | #define D3DXFERR_BADDATAREFERENCE MAKE_HRESULT( 1, _FACD3DXF, 914 ) 275 | #define D3DXFERR_NOMOREOBJECTS MAKE_HRESULT( 1, _FACD3DXF, 915 ) 276 | #define D3DXFERR_NOMOREDATA MAKE_HRESULT( 1, _FACD3DXF, 916 ) 277 | #define D3DXFERR_BADCACHEFILE MAKE_HRESULT( 1, _FACD3DXF, 917 ) 278 | 279 | /* 280 | * DirectX File object types. 281 | */ 282 | 283 | #ifndef WIN_TYPES 284 | #define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype 285 | #endif 286 | 287 | WIN_TYPES(ID3DXFile, D3DXFILE); 288 | WIN_TYPES(ID3DXFileEnumObject, D3DXFILEENUMOBJECT); 289 | WIN_TYPES(ID3DXFileSaveObject, D3DXFILESAVEOBJECT); 290 | WIN_TYPES(ID3DXFileData, D3DXFILEDATA); 291 | WIN_TYPES(ID3DXFileSaveData, D3DXFILESAVEDATA); 292 | 293 | #if defined( __cplusplus ) 294 | } // extern "C" 295 | #endif // defined( __cplusplus ) 296 | 297 | #endif // !defined( __D3DX9XOF_H__ ) 298 | 299 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/imgui/TextEditor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include "imgui.h" 12 | 13 | 14 | class TextEditor { 15 | public: 16 | enum class PaletteIndex { 17 | Default, 18 | Keyword, 19 | Number, 20 | String, 21 | CharLiteral, 22 | Punctuation, 23 | Preprocessor, 24 | Identifier, 25 | KnownIdentifier, 26 | PreprocIdentifier, 27 | Comment, 28 | MultiLineComment, 29 | Background, 30 | Cursor, 31 | Selection, 32 | ErrorMarker, 33 | Breakpoint, 34 | LineNumber, 35 | CurrentLineFill, 36 | CurrentLineFillInactive, 37 | CurrentLineEdge, 38 | Max 39 | }; 40 | 41 | enum class SelectionMode { Normal, Word, Line }; 42 | 43 | struct Breakpoint { 44 | int mLine; 45 | bool mEnabled; 46 | std::string mCondition; 47 | 48 | Breakpoint() : mLine(-1), mEnabled(false) { 49 | } 50 | }; 51 | 52 | // Represents a character coordinate from the user's point of view, 53 | // i. e. consider an uniform grid (assuming fixed-width font) on the 54 | // screen as it is rendered, and each cell has its own coordinate, starting from 0. 55 | // Tabs are counted as [1..mTabSize] count empty spaces, depending on 56 | // how many space is necessary to reach the next tab stop. 57 | // For example, coordinate (1, 5) represents the character 'B' in a line "\tABC", when mTabSize = 4, 58 | // because it is rendered as " ABC" on the screen. 59 | struct Coordinates { 60 | int mLine, mColumn; 61 | Coordinates() : mLine(0), mColumn(0) { 62 | } 63 | Coordinates(int aLine, int aColumn) : mLine(aLine), mColumn(aColumn) { 64 | assert(aLine >= 0); 65 | assert(aColumn >= 0); 66 | } 67 | static Coordinates Invalid() { 68 | static Coordinates invalid(-1, -1); 69 | return invalid; 70 | } 71 | 72 | bool operator==(const Coordinates& o) const { 73 | return mLine == o.mLine && mColumn == o.mColumn; 74 | } 75 | 76 | bool operator!=(const Coordinates& o) const { 77 | return mLine != o.mLine || mColumn != o.mColumn; 78 | } 79 | 80 | bool operator<(const Coordinates& o) const { 81 | if (mLine != o.mLine) 82 | return mLine < o.mLine; 83 | return mColumn < o.mColumn; 84 | } 85 | 86 | bool operator>(const Coordinates& o) const { 87 | if (mLine != o.mLine) 88 | return mLine > o.mLine; 89 | return mColumn > o.mColumn; 90 | } 91 | 92 | bool operator<=(const Coordinates& o) const { 93 | if (mLine != o.mLine) 94 | return mLine < o.mLine; 95 | return mColumn <= o.mColumn; 96 | } 97 | 98 | bool operator>=(const Coordinates& o) const { 99 | if (mLine != o.mLine) 100 | return mLine > o.mLine; 101 | return mColumn >= o.mColumn; 102 | } 103 | }; 104 | 105 | struct Identifier { 106 | Coordinates mLocation; 107 | std::string mDeclaration; 108 | }; 109 | 110 | typedef std::string String; 111 | typedef std::unordered_map Identifiers; 112 | typedef std::unordered_set Keywords; 113 | typedef std::map ErrorMarkers; 114 | typedef std::unordered_set Breakpoints; 115 | typedef std::array Palette; 116 | typedef uint8_t Char; 117 | 118 | struct Glyph { 119 | Char mChar; 120 | PaletteIndex mColorIndex = PaletteIndex::Default; 121 | bool mComment : 1; 122 | bool mMultiLineComment : 1; 123 | bool mPreprocessor : 1; 124 | 125 | Glyph(Char aChar, PaletteIndex aColorIndex) : mChar(aChar), mColorIndex(aColorIndex), mComment(false), mMultiLineComment(false), mPreprocessor(false) { 126 | } 127 | }; 128 | 129 | typedef std::vector Line; 130 | typedef std::vector Lines; 131 | 132 | struct LanguageDefinition { 133 | typedef std::pair TokenRegexString; 134 | typedef std::vector TokenRegexStrings; 135 | typedef bool (*TokenizeCallback)(const char* in_begin, const char* in_end, const char*& out_begin, const char*& out_end, PaletteIndex& paletteIndex); 136 | 137 | std::string mName; 138 | Keywords mKeywords; 139 | Identifiers mIdentifiers; 140 | Identifiers mPreprocIdentifiers; 141 | std::string mCommentStart, mCommentEnd, mSingleLineComment; 142 | char mPreprocChar; 143 | bool mAutoIndentation; 144 | 145 | TokenizeCallback mTokenize; 146 | 147 | TokenRegexStrings mTokenRegexStrings; 148 | 149 | bool mCaseSensitive; 150 | 151 | LanguageDefinition() : mPreprocChar('#'), mAutoIndentation(true), mTokenize(nullptr), mCaseSensitive(true) { 152 | } 153 | 154 | static const LanguageDefinition& CPlusPlus(); 155 | static const LanguageDefinition& HLSL(); 156 | static const LanguageDefinition& GLSL(); 157 | static const LanguageDefinition& C(); 158 | static const LanguageDefinition& SQL(); 159 | static const LanguageDefinition& AngelScript(); 160 | static const LanguageDefinition& Lua(); 161 | }; 162 | 163 | TextEditor(); 164 | ~TextEditor(); 165 | 166 | void SetLanguageDefinition(const LanguageDefinition& aLanguageDef); 167 | const LanguageDefinition& GetLanguageDefinition() const { 168 | return mLanguageDefinition; 169 | } 170 | 171 | const Palette& GetPalette() const { 172 | return mPaletteBase; 173 | } 174 | void SetPalette(const Palette& aValue); 175 | 176 | void SetErrorMarkers(const ErrorMarkers& aMarkers) { 177 | mErrorMarkers = aMarkers; 178 | } 179 | void SetBreakpoints(const Breakpoints& aMarkers) { 180 | mBreakpoints = aMarkers; 181 | } 182 | 183 | void Render(const char* aTitle, const ImVec2& aSize = ImVec2(), bool aBorder = false); 184 | void SetText(const std::string& aText); 185 | std::string GetText() const; 186 | 187 | void SetTextLines(const std::vector& aLines); 188 | std::vector GetTextLines() const; 189 | 190 | std::string GetSelectedText() const; 191 | std::string GetCurrentLineText() const; 192 | 193 | int GetTotalLines() const { 194 | return (int)mLines.size(); 195 | } 196 | bool IsOverwrite() const { 197 | return mOverwrite; 198 | } 199 | 200 | void SetReadOnly(bool aValue); 201 | bool IsReadOnly() const { 202 | return mReadOnly; 203 | } 204 | bool IsTextChanged() const { 205 | return mTextChanged; 206 | } 207 | bool IsCursorPositionChanged() const { 208 | return mCursorPositionChanged; 209 | } 210 | 211 | bool IsColorizerEnabled() const { 212 | return mColorizerEnabled; 213 | } 214 | void SetColorizerEnable(bool aValue); 215 | 216 | Coordinates GetCursorPosition() const { 217 | return GetActualCursorCoordinates(); 218 | } 219 | void SetCursorPosition(const Coordinates& aPosition); 220 | 221 | inline void SetHandleMouseInputs(bool aValue) { 222 | mHandleMouseInputs = aValue; 223 | } 224 | inline bool IsHandleMouseInputsEnabled() const { 225 | return mHandleKeyboardInputs; 226 | } 227 | 228 | inline void SetHandleKeyboardInputs(bool aValue) { 229 | mHandleKeyboardInputs = aValue; 230 | } 231 | inline bool IsHandleKeyboardInputsEnabled() const { 232 | return mHandleKeyboardInputs; 233 | } 234 | 235 | inline void SetImGuiChildIgnored(bool aValue) { 236 | mIgnoreImGuiChild = aValue; 237 | } 238 | inline bool IsImGuiChildIgnored() const { 239 | return mIgnoreImGuiChild; 240 | } 241 | 242 | inline void SetShowWhitespaces(bool aValue) { 243 | mShowWhitespaces = aValue; 244 | } 245 | inline bool IsShowingWhitespaces() const { 246 | return mShowWhitespaces; 247 | } 248 | 249 | void SetTabSize(int aValue); 250 | inline int GetTabSize() const { 251 | return mTabSize; 252 | } 253 | 254 | void InsertText(const std::string& aValue); 255 | void InsertText(const char* aValue); 256 | 257 | void MoveUp(int aAmount = 1, bool aSelect = false); 258 | void MoveDown(int aAmount = 1, bool aSelect = false); 259 | void MoveLeft(int aAmount = 1, bool aSelect = false, bool aWordMode = false); 260 | void MoveRight(int aAmount = 1, bool aSelect = false, bool aWordMode = false); 261 | void MoveTop(bool aSelect = false); 262 | void MoveBottom(bool aSelect = false); 263 | void MoveHome(bool aSelect = false); 264 | void MoveEnd(bool aSelect = false); 265 | 266 | void SetSelectionStart(const Coordinates& aPosition); 267 | void SetSelectionEnd(const Coordinates& aPosition); 268 | void SetSelection(const Coordinates& aStart, const Coordinates& aEnd, SelectionMode aMode = SelectionMode::Normal); 269 | void SelectWordUnderCursor(); 270 | void SelectAll(); 271 | bool HasSelection() const; 272 | 273 | void Copy(); 274 | void Cut(); 275 | void Paste(); 276 | void Delete(); 277 | 278 | bool CanUndo() const; 279 | bool CanRedo() const; 280 | void Undo(int aSteps = 1); 281 | void Redo(int aSteps = 1); 282 | 283 | static const Palette& GetDarkPalette(); 284 | static const Palette& GetLightPalette(); 285 | static const Palette& GetRetroBluePalette(); 286 | 287 | private: 288 | typedef std::vector> RegexList; 289 | 290 | struct EditorState { 291 | Coordinates mSelectionStart; 292 | Coordinates mSelectionEnd; 293 | Coordinates mCursorPosition; 294 | }; 295 | 296 | class UndoRecord { 297 | public: 298 | UndoRecord() { 299 | } 300 | ~UndoRecord() { 301 | } 302 | 303 | UndoRecord(const std::string& aAdded, const TextEditor::Coordinates aAddedStart, const TextEditor::Coordinates aAddedEnd, 304 | 305 | const std::string& aRemoved, const TextEditor::Coordinates aRemovedStart, const TextEditor::Coordinates aRemovedEnd, 306 | 307 | TextEditor::EditorState& aBefore, TextEditor::EditorState& aAfter); 308 | 309 | void Undo(TextEditor* aEditor); 310 | void Redo(TextEditor* aEditor); 311 | 312 | std::string mAdded; 313 | Coordinates mAddedStart; 314 | Coordinates mAddedEnd; 315 | 316 | std::string mRemoved; 317 | Coordinates mRemovedStart; 318 | Coordinates mRemovedEnd; 319 | 320 | EditorState mBefore; 321 | EditorState mAfter; 322 | }; 323 | 324 | typedef std::vector UndoBuffer; 325 | 326 | void ProcessInputs(); 327 | void Colorize(int aFromLine = 0, int aCount = -1); 328 | void ColorizeRange(int aFromLine = 0, int aToLine = 0); 329 | void ColorizeInternal(); 330 | float TextDistanceToLineStart(const Coordinates& aFrom) const; 331 | void EnsureCursorVisible(); 332 | int GetPageSize() const; 333 | std::string GetText(const Coordinates& aStart, const Coordinates& aEnd) const; 334 | Coordinates GetActualCursorCoordinates() const; 335 | Coordinates SanitizeCoordinates(const Coordinates& aValue) const; 336 | void Advance(Coordinates& aCoordinates) const; 337 | void DeleteRange(const Coordinates& aStart, const Coordinates& aEnd); 338 | int InsertTextAt(Coordinates& aWhere, const char* aValue); 339 | void AddUndo(UndoRecord& aValue); 340 | Coordinates ScreenPosToCoordinates(const ImVec2& aPosition) const; 341 | Coordinates FindWordStart(const Coordinates& aFrom) const; 342 | Coordinates FindWordEnd(const Coordinates& aFrom) const; 343 | Coordinates FindNextWord(const Coordinates& aFrom) const; 344 | int GetCharacterIndex(const Coordinates& aCoordinates) const; 345 | int GetCharacterColumn(int aLine, int aIndex) const; 346 | int GetLineCharacterCount(int aLine) const; 347 | int GetLineMaxColumn(int aLine) const; 348 | bool IsOnWordBoundary(const Coordinates& aAt) const; 349 | void RemoveLine(int aStart, int aEnd); 350 | void RemoveLine(int aIndex); 351 | Line& InsertLine(int aIndex); 352 | void EnterCharacter(ImWchar aChar, bool aShift); 353 | void Backspace(); 354 | void DeleteSelection(); 355 | std::string GetWordUnderCursor() const; 356 | std::string GetWordAt(const Coordinates& aCoords) const; 357 | ImU32 GetGlyphColor(const Glyph& aGlyph) const; 358 | 359 | void HandleKeyboardInputs(); 360 | void HandleMouseInputs(); 361 | void Render(); 362 | 363 | float mLineSpacing; 364 | Lines mLines; 365 | EditorState mState; 366 | UndoBuffer mUndoBuffer; 367 | int mUndoIndex; 368 | 369 | int mTabSize; 370 | bool mOverwrite; 371 | bool mReadOnly; 372 | bool mWithinRender; 373 | bool mScrollToCursor; 374 | bool mScrollToTop; 375 | bool mTextChanged; 376 | bool mColorizerEnabled; 377 | float mTextStart; // position (in pixels) where a code line starts relative to the left of the TextEditor. 378 | int mLeftMargin; 379 | bool mCursorPositionChanged; 380 | int mColorRangeMin, mColorRangeMax; 381 | SelectionMode mSelectionMode; 382 | bool mHandleKeyboardInputs; 383 | bool mHandleMouseInputs; 384 | bool mIgnoreImGuiChild; 385 | bool mShowWhitespaces; 386 | 387 | Palette mPaletteBase; 388 | Palette mPalette; 389 | LanguageDefinition mLanguageDefinition; 390 | RegexList mRegexList; 391 | 392 | bool mCheckComments; 393 | Breakpoints mBreakpoints; 394 | ErrorMarkers mErrorMarkers; 395 | ImVec2 mCharAdvance; 396 | Coordinates mInteractiveStart, mInteractiveEnd; 397 | std::string mLineBuffer; 398 | uint64_t mStartTime; 399 | 400 | float mLastClick; 401 | }; -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "guidev.h" 9 | #include "Theme/Theme.h" 10 | #include "imgui/imgui_impl_win32.h" 11 | 12 | #include "global.h" 13 | #include "Memory.h" 14 | #include "Utils.h" 15 | 16 | #define MSGBOX(x) \ 17 | { \ 18 | std::ostringstream oss; \ 19 | oss << x; \ 20 | std::string str = oss.str(); \ 21 | std::wstring stemp = std::wstring(str.begin(), str.end()); \ 22 | LPCWSTR sw = stemp.c_str(); \ 23 | MessageBox(NULL, sw, L"Msg Title", MB_OK | MB_ICONQUESTION); \ 24 | } 25 | 26 | 27 | 28 | // Static Pointers // 29 | 30 | uint32_t LocalPlayerAdress; 31 | 32 | // Static Pointers End // 33 | 34 | DWORD BaseModuleAdress; 35 | DWORD ProcessId; 36 | 37 | bool SimulateLeftClick = false; 38 | char nameBuffer[16]; // Buffer for Player Name 39 | char weaponnameBuffer[16]; // Buffer for Weapon Name 40 | 41 | bool reset_size = true; 42 | bool mainWindow = true; 43 | int tabs = 1; 44 | Theme theme; 45 | 46 | /* RW/ImGUI Variable Handle Area */ 47 | 48 | bool showBoxESP = false; 49 | bool showNameESP = false; 50 | bool showHealthESP = false; 51 | bool showDistanceESP = false; 52 | 53 | // legit aimbot variables 54 | bool enableLegitAimbot = false; 55 | bool aimbotVisibleCheck = false; 56 | bool aimbotSmoothing = false; 57 | float aimbotSmoothingFactor = 0.5f; 58 | 59 | 60 | // Rage aimbot variables 61 | // enable = nick shoot everything 62 | bool enableRageAimbot = false; 63 | 64 | /* RW/ImGUI Variable Handle Area End */ 65 | 66 | 67 | void ReadWriteThreadController() 68 | { 69 | while (true) { 70 | if (enableLegitAimbot || enableRageAimbot) { // Aimbot <- Legit / Rage 71 | uintptr_t EntityList = Driver.ReadVirtualMemory(ProcessId, BaseModuleAdress + Memory::Adress::EntityList, sizeof(uintptr_t)); 72 | 73 | if (EntityList) { // Check for null 74 | float Dist = 1000; 75 | 76 | uintptr_t TargetEntity = LocalPlayerAdress; 77 | 78 | int CurrentPlayerCount = Driver.ReadVirtualMemory(ProcessId, BaseModuleAdress + 0x18AC0C, sizeof(int)); 79 | 80 | //MSGBOX(CurrentPlayerCount); 81 | 82 | for (int i = 1; i < CurrentPlayerCount; i++) { 83 | uintptr_t Entity = Driver.ReadVirtualMemory(ProcessId, EntityList + (i * 0x4), sizeof(uintptr_t)); 84 | 85 | /* Assign Vars */ 86 | Vec3 EntityHeadPos = Driver.ReadVirtualMemory(ProcessId, Entity + Memory::EntityOffsets::HeadX, sizeof(Vec3)); 87 | Vec3 LocalPlayerHeadPos = Driver.ReadVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::HeadX, sizeof(Vec3)); 88 | int EntityHealth = Driver.ReadVirtualMemory(ProcessId, Entity + Memory::EntityOffsets::HP, sizeof(int)); 89 | int EntityTeam = Driver.ReadVirtualMemory(ProcessId, Entity + Memory::EntityOffsets::Team, sizeof(int)); 90 | int LocalPlayerTeam = Driver.ReadVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::Team, sizeof(int)); 91 | 92 | //MSGBOX("Entity: 0x" << std::hex << Entity << " EntityHealth: " << EntityHealth << " EntityTeam: " << EntityTeam << " LocalPlayerTeam: " << LocalPlayerTeam) 93 | 94 | //MSGBOX("Local Player Head Pos: " << LocalPlayerHeadPos.x << ", " << LocalPlayerHeadPos.y << ", " << LocalPlayerHeadPos.z << "\nEntity Head Pos: " << EntityHeadPos.x << ", " << EntityHeadPos.y << ", " << EntityHeadPos.z); 95 | 96 | if (enableLegitAimbot) { /* Legit Targetter kun on screen */ 97 | ViewMat ViewMatrix = Driver.ReadVirtualMemory(ProcessId, BaseModuleAdress + 0x17DFD0, sizeof(ViewMat)); // Get ViewMatrix 98 | Vec2 screen; // This will hold the 2D screen position if the conversion is successful 99 | WindowSize windowSize = GetWinSize(ProcessId); // Get the window size 100 | 101 | bool isOnScreen = WorldToScreen(EntityHeadPos, screen, ViewMatrix.Matrix, windowSize.width, windowSize.height); 102 | 103 | if ((LocalPlayerHeadPos - EntityHeadPos).hypo3() < Dist && EntityHealth > 0 && EntityTeam != LocalPlayerTeam && isOnScreen && screen.x != 0.f && screen.y != 0.f) // Do Checks 104 | { 105 | TargetEntity = Entity; // Set Target 106 | Dist = (LocalPlayerHeadPos - EntityHeadPos).hypo3(); // Set Distance 107 | 108 | //MSGBOX("Target Entity: 0x" << std::hex << TargetEntity << " Dist: " << Dist); 109 | } 110 | } 111 | 112 | if (enableRageAimbot) { /* Rage Targetter Alt */ 113 | if ((LocalPlayerHeadPos - EntityHeadPos).hypo3() < Dist && EntityHealth > 0 && EntityTeam != LocalPlayerTeam) // Do Checks 114 | { 115 | TargetEntity = Entity; // Set Target 116 | Dist = (LocalPlayerHeadPos - EntityHeadPos).hypo3(); // Set Distance 117 | 118 | //MSGBOX("Target Entity: 0x" << std::hex << TargetEntity << " Dist: " << Dist); 119 | } 120 | } 121 | } 122 | 123 | Vec3 EntityHeadPos = Driver.ReadVirtualMemory(ProcessId, TargetEntity + Memory::EntityOffsets::HeadX, sizeof(Vec3)); 124 | Vec3 LocalPlayerHeadPos = Driver.ReadVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::HeadX, sizeof(Vec3)); 125 | 126 | //MSGBOX("Local Player Head Pos: " << LocalPlayerHeadPos.x << ", " << LocalPlayerHeadPos.y << ", " << LocalPlayerHeadPos.z << "\nEntity Head Pos: " << EntityHeadPos.x << ", " << EntityHeadPos.y << ", " << EntityHeadPos.z); 127 | 128 | Vec3 Delta = EntityHeadPos - LocalPlayerHeadPos; // Get Delta 129 | 130 | float yaw = atan2f(Delta.y, Delta.x) * 180 / 3.141592653589793238463; // Get Yaw 131 | float hyp = sqrt(Delta.x * Delta.x + Delta.y * Delta.y); // Get Hypo 132 | float pitch = atan2f(Delta.z, hyp) * 180 / 3.141592653589793238463; // Get Pitch 133 | 134 | pitch + 90; // 90 til pitch eller kigger man det forkerte sted af en grund?? 135 | 136 | if (enableLegitAimbot) { 137 | if (IsKeyPressed(VK_LCONTROL) && TargetEntity != LocalPlayerAdress) { 138 | // Check if aimbot key is pressed 139 | Driver.WriteVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::ViewAngleX, yaw + 90, sizeof(float)); // Write Pitch 140 | Driver.WriteVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::ViewAngleY, pitch, sizeof(float)); // Write Yaw 141 | } 142 | } 143 | 144 | if (enableRageAimbot) { 145 | Driver.WriteVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::ViewAngleX, yaw + 90, sizeof(float)); // Write Pitch 146 | Driver.WriteVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::ViewAngleY, pitch, sizeof(float)); // Write Yaw 147 | 148 | SimulateLeftClick = true; 149 | //Simulate_LeftClick(); 150 | } 151 | } 152 | } 153 | 154 | if (!enableRageAimbot) { 155 | if (SimulateLeftClick) { 156 | SimulateLeftClick = false; 157 | } 158 | } 159 | } 160 | 161 | return; 162 | } 163 | 164 | 165 | 166 | void ClickThread() { 167 | while (true) { 168 | if (SimulateLeftClick) { 169 | Simulate_LeftClick(); 170 | Sleep(1000); 171 | } 172 | } 173 | 174 | return; 175 | } 176 | 177 | enum class WindowState { 178 | Main, 179 | INFO, 180 | Aimbot, 181 | Rage, 182 | Legit, 183 | 184 | }; 185 | 186 | WindowState currentWindowState = WindowState::Main; // Init currentWindowState to the MainWindow 187 | 188 | void RenderMainWindow() { 189 | // Set a fixed size for buttons 190 | const ImVec2 buttonSize(150.0f, 100.0f); 191 | 192 | if (currentWindowState == WindowState::Main) { 193 | 194 | ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(5, -5)); 195 | 196 | ImGui::Button("INFO Menu", buttonSize); 197 | if (ImGui::IsItemClicked()) { 198 | currentWindowState = WindowState::INFO; 199 | 200 | } 201 | 202 | ImGui::SameLine(); 203 | 204 | ImGui::Button("Aimbot", buttonSize); 205 | if (ImGui::IsItemClicked()) { 206 | currentWindowState = WindowState::Aimbot; 207 | } 208 | 209 | ImGui::PopStyleVar(); 210 | } 211 | } 212 | 213 | void RenderINFOMenu(){ 214 | 215 | ImGui::Text("INFO Menu"); 216 | 217 | int Health = Driver.ReadVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::HP, sizeof(int)); 218 | int Armour = Driver.ReadVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::Armor, sizeof(int)); 219 | 220 | float HeadX = Driver.ReadVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::HeadX, sizeof(float)); 221 | float HeadY = Driver.ReadVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::HeadY, sizeof(float)); 222 | float HeadZ = Driver.ReadVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::HeadZ, sizeof(float)); 223 | float X = Driver.ReadVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::X, sizeof(float)); 224 | float Y = Driver.ReadVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::Y, sizeof(float)); 225 | float Z = Driver.ReadVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::Z, sizeof(float)); 226 | Driver.ReadVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::Name, nameBuffer, sizeof(nameBuffer)); 227 | int Team = Driver.ReadVirtualMemory(ProcessId, LocalPlayerAdress + Memory::EntityOffsets::Team, sizeof(int)); 228 | int CurrentPlayerCount = Driver.ReadVirtualMemory(ProcessId, BaseModuleAdress + 0x18AC0C, sizeof(int)); 229 | 230 | // Display player information 231 | ImGui::Text("Player Count: %d", CurrentPlayerCount); 232 | ImGui::Text("Local Player Address: 0x%X", LocalPlayerAdress); 233 | ImGui::Text("Head Position: %.2f, %.2f, %.2f", HeadX, HeadY, HeadZ); 234 | ImGui::Text("Position: %.2f, %.2f, %.2f", X, Y, Z); 235 | ImGui::Text("Health: %d", Health); 236 | ImGui::Text("Armor: %d", Armour); 237 | ImGui::Text("Player Name: %s", nameBuffer); 238 | ImGui::Text("Team: %d", Team); 239 | 240 | if (ImGui::Button("Back")) { 241 | currentWindowState = WindowState::Main; 242 | } 243 | 244 | } 245 | 246 | void RenderAimbotLegitMenu() { 247 | // Checkbox for Enable Aimbot 248 | ImGui::Checkbox2("Enable Aimbot", &enableLegitAimbot); 249 | 250 | // Checkbox for Aimbot Visibility Check 251 | ImGui::Checkbox2("Aimbot Visibility Check", &aimbotVisibleCheck); 252 | 253 | // Checkbox for Aimbot Smoothing 254 | ImGui::Checkbox2("Aimbot Smoothing", &aimbotSmoothing); 255 | 256 | if (aimbotSmoothing) { 257 | // Slider for Aimbot Smoothing Factor 258 | 259 | ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f); 260 | ImGui::SliderFloat("Smoothing", &aimbotSmoothingFactor, 0, 1); 261 | ImGui::PopItemWidth(); // Reset item width to default 262 | 263 | } 264 | 265 | if (ImGui::Button("Back")) { 266 | currentWindowState = WindowState::Aimbot; 267 | } 268 | } 269 | 270 | void RenderAimbotRageMenu() { 271 | // Checkbox for Enable Aimbot 272 | 273 | if (enableLegitAimbot) { 274 | ImGui::Text("Legit aimbnot already on, turn that off to use this."); 275 | } 276 | 277 | if (ImGui::Checkbox2("Enable Aimbot", &enableRageAimbot)) { 278 | enableRageAimbot = true; 279 | } 280 | 281 | if (ImGui::Button("Back")) { 282 | currentWindowState = WindowState::Aimbot; 283 | } 284 | 285 | } 286 | 287 | 288 | void RenderAimbotMainMenu() { 289 | ImGui::Text("Aimbot Menu"); 290 | 291 | 292 | if (ImGui::Button("Legit Aimbot")){ 293 | currentWindowState = WindowState::Legit; 294 | } 295 | 296 | if (ImGui::Button("Rage Aimbot")){ 297 | currentWindowState = WindowState::Rage; 298 | } 299 | 300 | 301 | 302 | if (ImGui::Button("Back")) { 303 | currentWindowState = WindowState::Main; 304 | } 305 | } 306 | 307 | 308 | int main() 309 | { 310 | // Make BaseModuleAdress + ProcessId Available 311 | BaseModuleAdress = Driver.GetClientAdress(); 312 | ProcessId = Driver.GetProcessId(); 313 | 314 | SetupHook(); 315 | 316 | LocalPlayerAdress = Driver.ReadVirtualMemory(ProcessId, BaseModuleAdress + Memory::Adress::LocalPlayerAdress, sizeof(uint32_t)); 317 | 318 | ShowWindow(GetConsoleWindow(), SW_HIDE); 319 | 320 | std::thread RWThread(ReadWriteThreadController); // Start RW Thread to run alongisde ImGui 321 | 322 | std::thread ClThread(ClickThread); // Start RW Thread to run alongisde ImGui 323 | 324 | 325 | HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE); 326 | SetConsoleTextAttribute(console, 1); 327 | 328 | WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ExternalProB1"), NULL }; 329 | RegisterClassEx(&wc); 330 | HWND hwnd = CreateWindow(wc.lpszClassName, _T("ExternalProB1"), WS_OVERLAPPEDWINDOW, 0, 0, 50, 50, NULL, NULL, wc.hInstance, NULL); 331 | 332 | if (!CreateDeviceD3D(hwnd)) 333 | { 334 | CleanupDeviceD3D(); 335 | UnregisterClass(wc.lpszClassName, wc.hInstance); 336 | return 1; 337 | } 338 | 339 | UpdateWindow(hwnd); 340 | 341 | IMGUI_CHECKVERSION(); 342 | ImGui::CreateContext(); 343 | ImGuiIO& io = ImGui::GetIO(); (void)io; 344 | io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; 345 | 346 | theme.Register(io); 347 | 348 | ImGuiStyle& style = ImGui::GetStyle(); 349 | style.FramePadding = ImVec2(20, 20); 350 | // new line padding style 351 | //style.ItemSpacing = ImVec2(5, -5); 352 | 353 | 354 | if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) 355 | { 356 | style.WindowRounding = 4.0f; 357 | style.Colors[ImGuiCol_WindowBg].w = 1.0f; 358 | } 359 | 360 | ImVec4 mainColor = ImVec4(0.2f, 0.2f, 0.2f, 1.0f); 361 | ImVec4 accentColor = ImVec4(0.5f, 0.5f, 0.8f, 1.0f); 362 | ImVec4 textColor = ImVec4(0.9f, 0.9f, 0.9f, 1.0f); 363 | 364 | style.Colors[ImGuiCol_Text] = textColor; 365 | style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.5f, 0.5f, 0.5f, 1.0f); 366 | style.Colors[ImGuiCol_WindowBg] = mainColor; 367 | style.Colors[ImGuiCol_Border] = accentColor; 368 | style.Colors[ImGuiCol_FrameBg] = ImVec4(0.3f, 0.3f, 0.3f, 1.0f); 369 | style.Colors[ImGuiCol_FrameBgHovered] = accentColor; 370 | style.Colors[ImGuiCol_FrameBgActive] = accentColor; 371 | style.Colors[ImGuiCol_TitleBg] = mainColor; 372 | style.Colors[ImGuiCol_TitleBgActive] = accentColor; 373 | style.Colors[ImGuiCol_TitleBgCollapsed] = mainColor; 374 | style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.2f, 0.2f, 0.2f, 1.0f); 375 | style.Colors[ImGuiCol_ScrollbarGrab] = accentColor; 376 | style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.4f, 0.4f, 0.4f, 1.0f); 377 | style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.6f, 0.6f, 0.6f, 1.0f); 378 | style.Colors[ImGuiCol_Button] = accentColor; 379 | style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.6f, 0.6f, 0.6f, 1.0f); 380 | style.Colors[ImGuiCol_ButtonActive] = ImVec4(0.8f, 0.8f, 0.8f, 1.0f); 381 | style.Colors[ImGuiCol_Header] = accentColor; 382 | style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.6f, 0.6f, 0.6f, 1.0f); 383 | style.Colors[ImGuiCol_HeaderActive] = ImVec4(0.8f, 0.8f, 0.8f, 1.0f); 384 | style.Colors[ImGuiCol_Separator] = accentColor; 385 | 386 | ImGuiStyle& TitlteBarStyle = ImGui::GetStyle(); 387 | style.FramePadding = ImVec2(0, 0); 388 | 389 | 390 | ImGui_ImplWin32_Init(hwnd); 391 | ImGui_ImplDX9_Init(g_pd3dDevice); 392 | 393 | bool done = true; 394 | 395 | std::string str_window_title = "Kernel Read Write Driver - User Mode"; 396 | const char* window_title = str_window_title.c_str(); 397 | 398 | DWORD window_flags = ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiWindowFlags_NoResize; 399 | 400 | ImGui::StyleColorsRed(); 401 | 402 | 403 | while (done) 404 | { 405 | MSG msg; 406 | while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) 407 | { 408 | TranslateMessage(&msg); 409 | DispatchMessage(&msg); 410 | if (msg.message == WM_QUIT) 411 | done = false; 412 | } 413 | if (!done) 414 | break; 415 | 416 | ImGuiStyle* style = &ImGui::GetStyle(); 417 | 418 | ImGui_ImplDX9_NewFrame(); 419 | ImGui_ImplWin32_NewFrame(); 420 | ImGui::NewFrame(); 421 | { 422 | if (mainWindow) 423 | { 424 | if (reset_size) { 425 | ImGui::SetNextWindowSize(ImVec2(0,0), ImGuiCond_Always); 426 | reset_size = false; 427 | } 428 | 429 | /* RENDER START */ 430 | 431 | //ImGui::ShowDemoWindow(); 432 | 433 | 434 | ImGui::PushStyleVar(ImGuiStyleVar_WindowTitleAlign, ImVec2(0.5f,0.5f)); 435 | ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4.5f, 4.5f)); 436 | ImGui::Begin(window_title, &mainWindow, window_flags); 437 | 438 | if (currentWindowState == WindowState::Main) { 439 | RenderMainWindow(); 440 | } 441 | else if (currentWindowState == WindowState::INFO) { 442 | RenderINFOMenu(); 443 | } 444 | else if (currentWindowState == WindowState::Aimbot) { 445 | RenderAimbotMainMenu(); 446 | } 447 | else if (currentWindowState == WindowState::Rage) { 448 | RenderAimbotRageMenu(); 449 | } 450 | else if (currentWindowState == WindowState::Legit) { 451 | RenderAimbotLegitMenu(); 452 | }; 453 | 454 | ImGui::PopStyleVar(2); 455 | 456 | ImGui::End(); 457 | 458 | 459 | /* RENDER DONE */ 460 | } 461 | else { 462 | exit(0); 463 | } 464 | } 465 | ImGui::EndFrame(); 466 | g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, FALSE); 467 | g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); 468 | g_pd3dDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); 469 | g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, NULL, 1.0f, 0); 470 | if (g_pd3dDevice->BeginScene() >= 0) 471 | { 472 | ImGui::Render(); 473 | ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData()); 474 | g_pd3dDevice->EndScene(); 475 | } 476 | 477 | if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) 478 | { 479 | ImGui::UpdatePlatformWindows(); 480 | ImGui::RenderPlatformWindowsDefault(); 481 | } 482 | 483 | HRESULT result = g_pd3dDevice->Present(NULL, NULL, NULL, NULL); 484 | 485 | if (result == D3DERR_DEVICELOST && g_pd3dDevice->TestCooperativeLevel() == D3DERR_DEVICENOTRESET) 486 | ResetDevice(); 487 | } 488 | ImGui_ImplDX9_Shutdown(); 489 | ImGui_ImplWin32_Shutdown(); 490 | ImGui::DestroyContext(); 491 | 492 | CleanupDeviceD3D(); 493 | DestroyWindow(hwnd); 494 | UnregisterClass(wc.lpszClassName, wc.hInstance); 495 | 496 | return 0; 497 | } 498 | -------------------------------------------------------------------------------- /KernelReadWriteDriver_UserMode_IMGUI/curl/multi.h: -------------------------------------------------------------------------------- 1 | #ifndef CURLINC_MULTI_H 2 | #define CURLINC_MULTI_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at https://curl.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | * SPDX-License-Identifier: curl 24 | * 25 | ***************************************************************************/ 26 | /* 27 | This is an "external" header file. Don't give away any internals here! 28 | 29 | GOALS 30 | 31 | o Enable a "pull" interface. The application that uses libcurl decides where 32 | and when to ask libcurl to get/send data. 33 | 34 | o Enable multiple simultaneous transfers in the same thread without making it 35 | complicated for the application. 36 | 37 | o Enable the application to select() on its own file descriptors and curl's 38 | file descriptors simultaneous easily. 39 | 40 | */ 41 | 42 | /* 43 | * This header file should not really need to include "curl.h" since curl.h 44 | * itself includes this file and we expect user applications to do #include 45 | * without the need for especially including multi.h. 46 | * 47 | * For some reason we added this include here at one point, and rather than to 48 | * break existing (wrongly written) libcurl applications, we leave it as-is 49 | * but with this warning attached. 50 | */ 51 | #include "curl.h" 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | #if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER) 58 | typedef struct Curl_multi CURLM; 59 | #else 60 | typedef void CURLM; 61 | #endif 62 | 63 | typedef enum { 64 | CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or 65 | curl_multi_socket*() soon */ 66 | CURLM_OK, 67 | CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */ 68 | CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */ 69 | CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */ 70 | CURLM_INTERNAL_ERROR, /* this is a libcurl bug */ 71 | CURLM_BAD_SOCKET, /* the passed in socket argument did not match */ 72 | CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */ 73 | CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was 74 | attempted to get added - again */ 75 | CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a 76 | callback */ 77 | CURLM_WAKEUP_FAILURE, /* wakeup is unavailable or failed */ 78 | CURLM_BAD_FUNCTION_ARGUMENT, /* function called with a bad parameter */ 79 | CURLM_ABORTED_BY_CALLBACK, 80 | CURLM_UNRECOVERABLE_POLL, 81 | CURLM_LAST 82 | } CURLMcode; 83 | 84 | /* just to make code nicer when using curl_multi_socket() you can now check 85 | for CURLM_CALL_MULTI_SOCKET too in the same style it works for 86 | curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ 87 | #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM 88 | 89 | /* bitmask bits for CURLMOPT_PIPELINING */ 90 | #define CURLPIPE_NOTHING 0L 91 | #define CURLPIPE_HTTP1 1L 92 | #define CURLPIPE_MULTIPLEX 2L 93 | 94 | typedef enum { 95 | CURLMSG_NONE, /* first, not used */ 96 | CURLMSG_DONE, /* This easy handle has completed. 'result' contains 97 | the CURLcode of the transfer */ 98 | CURLMSG_LAST /* last, not used */ 99 | } CURLMSG; 100 | 101 | struct CURLMsg { 102 | CURLMSG msg; /* what this message means */ 103 | CURL *easy_handle; /* the handle it concerns */ 104 | union { 105 | void *whatever; /* message-specific data */ 106 | CURLcode result; /* return code for transfer */ 107 | } data; 108 | }; 109 | typedef struct CURLMsg CURLMsg; 110 | 111 | /* Based on poll(2) structure and values. 112 | * We don't use pollfd and POLL* constants explicitly 113 | * to cover platforms without poll(). */ 114 | #define CURL_WAIT_POLLIN 0x0001 115 | #define CURL_WAIT_POLLPRI 0x0002 116 | #define CURL_WAIT_POLLOUT 0x0004 117 | 118 | struct curl_waitfd { 119 | curl_socket_t fd; 120 | short events; 121 | short revents; /* not supported yet */ 122 | }; 123 | 124 | /* 125 | * Name: curl_multi_init() 126 | * 127 | * Desc: inititalize multi-style curl usage 128 | * 129 | * Returns: a new CURLM handle to use in all 'curl_multi' functions. 130 | */ 131 | CURL_EXTERN CURLM *curl_multi_init(void); 132 | 133 | /* 134 | * Name: curl_multi_add_handle() 135 | * 136 | * Desc: add a standard curl handle to the multi stack 137 | * 138 | * Returns: CURLMcode type, general multi error code. 139 | */ 140 | CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, 141 | CURL *curl_handle); 142 | 143 | /* 144 | * Name: curl_multi_remove_handle() 145 | * 146 | * Desc: removes a curl handle from the multi stack again 147 | * 148 | * Returns: CURLMcode type, general multi error code. 149 | */ 150 | CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, 151 | CURL *curl_handle); 152 | 153 | /* 154 | * Name: curl_multi_fdset() 155 | * 156 | * Desc: Ask curl for its fd_set sets. The app can use these to select() or 157 | * poll() on. We want curl_multi_perform() called as soon as one of 158 | * them are ready. 159 | * 160 | * Returns: CURLMcode type, general multi error code. 161 | */ 162 | CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, 163 | fd_set *read_fd_set, 164 | fd_set *write_fd_set, 165 | fd_set *exc_fd_set, 166 | int *max_fd); 167 | 168 | /* 169 | * Name: curl_multi_wait() 170 | * 171 | * Desc: Poll on all fds within a CURLM set as well as any 172 | * additional fds passed to the function. 173 | * 174 | * Returns: CURLMcode type, general multi error code. 175 | */ 176 | CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle, 177 | struct curl_waitfd extra_fds[], 178 | unsigned int extra_nfds, 179 | int timeout_ms, 180 | int *ret); 181 | 182 | /* 183 | * Name: curl_multi_poll() 184 | * 185 | * Desc: Poll on all fds within a CURLM set as well as any 186 | * additional fds passed to the function. 187 | * 188 | * Returns: CURLMcode type, general multi error code. 189 | */ 190 | CURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle, 191 | struct curl_waitfd extra_fds[], 192 | unsigned int extra_nfds, 193 | int timeout_ms, 194 | int *ret); 195 | 196 | /* 197 | * Name: curl_multi_wakeup() 198 | * 199 | * Desc: wakes up a sleeping curl_multi_poll call. 200 | * 201 | * Returns: CURLMcode type, general multi error code. 202 | */ 203 | CURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle); 204 | 205 | /* 206 | * Name: curl_multi_perform() 207 | * 208 | * Desc: When the app thinks there's data available for curl it calls this 209 | * function to read/write whatever there is right now. This returns 210 | * as soon as the reads and writes are done. This function does not 211 | * require that there actually is data available for reading or that 212 | * data can be written, it can be called just in case. It returns 213 | * the number of handles that still transfer data in the second 214 | * argument's integer-pointer. 215 | * 216 | * Returns: CURLMcode type, general multi error code. *NOTE* that this only 217 | * returns errors etc regarding the whole multi stack. There might 218 | * still have occurred problems on individual transfers even when 219 | * this returns OK. 220 | */ 221 | CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, 222 | int *running_handles); 223 | 224 | /* 225 | * Name: curl_multi_cleanup() 226 | * 227 | * Desc: Cleans up and removes a whole multi stack. It does not free or 228 | * touch any individual easy handles in any way. We need to define 229 | * in what state those handles will be if this function is called 230 | * in the middle of a transfer. 231 | * 232 | * Returns: CURLMcode type, general multi error code. 233 | */ 234 | CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); 235 | 236 | /* 237 | * Name: curl_multi_info_read() 238 | * 239 | * Desc: Ask the multi handle if there's any messages/informationals from 240 | * the individual transfers. Messages include informationals such as 241 | * error code from the transfer or just the fact that a transfer is 242 | * completed. More details on these should be written down as well. 243 | * 244 | * Repeated calls to this function will return a new struct each 245 | * time, until a special "end of msgs" struct is returned as a signal 246 | * that there is no more to get at this point. 247 | * 248 | * The data the returned pointer points to will not survive calling 249 | * curl_multi_cleanup(). 250 | * 251 | * The 'CURLMsg' struct is meant to be very simple and only contain 252 | * very basic information. If more involved information is wanted, 253 | * we will provide the particular "transfer handle" in that struct 254 | * and that should/could/would be used in subsequent 255 | * curl_easy_getinfo() calls (or similar). The point being that we 256 | * must never expose complex structs to applications, as then we'll 257 | * undoubtably get backwards compatibility problems in the future. 258 | * 259 | * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out 260 | * of structs. It also writes the number of messages left in the 261 | * queue (after this read) in the integer the second argument points 262 | * to. 263 | */ 264 | CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle, 265 | int *msgs_in_queue); 266 | 267 | /* 268 | * Name: curl_multi_strerror() 269 | * 270 | * Desc: The curl_multi_strerror function may be used to turn a CURLMcode 271 | * value into the equivalent human readable error string. This is 272 | * useful for printing meaningful error messages. 273 | * 274 | * Returns: A pointer to a null-terminated error message. 275 | */ 276 | CURL_EXTERN const char *curl_multi_strerror(CURLMcode); 277 | 278 | /* 279 | * Name: curl_multi_socket() and 280 | * curl_multi_socket_all() 281 | * 282 | * Desc: An alternative version of curl_multi_perform() that allows the 283 | * application to pass in one of the file descriptors that have been 284 | * detected to have "action" on them and let libcurl perform. 285 | * See man page for details. 286 | */ 287 | #define CURL_POLL_NONE 0 288 | #define CURL_POLL_IN 1 289 | #define CURL_POLL_OUT 2 290 | #define CURL_POLL_INOUT 3 291 | #define CURL_POLL_REMOVE 4 292 | 293 | #define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD 294 | 295 | #define CURL_CSELECT_IN 0x01 296 | #define CURL_CSELECT_OUT 0x02 297 | #define CURL_CSELECT_ERR 0x04 298 | 299 | typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */ 300 | curl_socket_t s, /* socket */ 301 | int what, /* see above */ 302 | void *userp, /* private callback 303 | pointer */ 304 | void *socketp); /* private socket 305 | pointer */ 306 | /* 307 | * Name: curl_multi_timer_callback 308 | * 309 | * Desc: Called by libcurl whenever the library detects a change in the 310 | * maximum number of milliseconds the app is allowed to wait before 311 | * curl_multi_socket() or curl_multi_perform() must be called 312 | * (to allow libcurl's timed events to take place). 313 | * 314 | * Returns: The callback should return zero. 315 | */ 316 | typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */ 317 | long timeout_ms, /* see above */ 318 | void *userp); /* private callback 319 | pointer */ 320 | 321 | CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, 322 | int *running_handles); 323 | 324 | CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle, 325 | curl_socket_t s, 326 | int ev_bitmask, 327 | int *running_handles); 328 | 329 | CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle, 330 | int *running_handles); 331 | 332 | #ifndef CURL_ALLOW_OLD_MULTI_SOCKET 333 | /* This macro below was added in 7.16.3 to push users who recompile to use 334 | the new curl_multi_socket_action() instead of the old curl_multi_socket() 335 | */ 336 | #define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z) 337 | #endif 338 | 339 | /* 340 | * Name: curl_multi_timeout() 341 | * 342 | * Desc: Returns the maximum number of milliseconds the app is allowed to 343 | * wait before curl_multi_socket() or curl_multi_perform() must be 344 | * called (to allow libcurl's timed events to take place). 345 | * 346 | * Returns: CURLM error code. 347 | */ 348 | CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, 349 | long *milliseconds); 350 | 351 | typedef enum { 352 | /* This is the socket callback function pointer */ 353 | CURLOPT(CURLMOPT_SOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 1), 354 | 355 | /* This is the argument passed to the socket callback */ 356 | CURLOPT(CURLMOPT_SOCKETDATA, CURLOPTTYPE_OBJECTPOINT, 2), 357 | 358 | /* set to 1 to enable pipelining for this multi handle */ 359 | CURLOPT(CURLMOPT_PIPELINING, CURLOPTTYPE_LONG, 3), 360 | 361 | /* This is the timer callback function pointer */ 362 | CURLOPT(CURLMOPT_TIMERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 4), 363 | 364 | /* This is the argument passed to the timer callback */ 365 | CURLOPT(CURLMOPT_TIMERDATA, CURLOPTTYPE_OBJECTPOINT, 5), 366 | 367 | /* maximum number of entries in the connection cache */ 368 | CURLOPT(CURLMOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 6), 369 | 370 | /* maximum number of (pipelining) connections to one host */ 371 | CURLOPT(CURLMOPT_MAX_HOST_CONNECTIONS, CURLOPTTYPE_LONG, 7), 372 | 373 | /* maximum number of requests in a pipeline */ 374 | CURLOPT(CURLMOPT_MAX_PIPELINE_LENGTH, CURLOPTTYPE_LONG, 8), 375 | 376 | /* a connection with a content-length longer than this 377 | will not be considered for pipelining */ 378 | CURLOPT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 9), 379 | 380 | /* a connection with a chunk length longer than this 381 | will not be considered for pipelining */ 382 | CURLOPT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 10), 383 | 384 | /* a list of site names(+port) that are blocked from pipelining */ 385 | CURLOPT(CURLMOPT_PIPELINING_SITE_BL, CURLOPTTYPE_OBJECTPOINT, 11), 386 | 387 | /* a list of server types that are blocked from pipelining */ 388 | CURLOPT(CURLMOPT_PIPELINING_SERVER_BL, CURLOPTTYPE_OBJECTPOINT, 12), 389 | 390 | /* maximum number of open connections in total */ 391 | CURLOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, CURLOPTTYPE_LONG, 13), 392 | 393 | /* This is the server push callback function pointer */ 394 | CURLOPT(CURLMOPT_PUSHFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 14), 395 | 396 | /* This is the argument passed to the server push callback */ 397 | CURLOPT(CURLMOPT_PUSHDATA, CURLOPTTYPE_OBJECTPOINT, 15), 398 | 399 | /* maximum number of concurrent streams to support on a connection */ 400 | CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16), 401 | 402 | CURLMOPT_LASTENTRY /* the last unused */ 403 | } CURLMoption; 404 | 405 | 406 | /* 407 | * Name: curl_multi_setopt() 408 | * 409 | * Desc: Sets options for the multi handle. 410 | * 411 | * Returns: CURLM error code. 412 | */ 413 | CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, 414 | CURLMoption option, ...); 415 | 416 | 417 | /* 418 | * Name: curl_multi_assign() 419 | * 420 | * Desc: This function sets an association in the multi handle between the 421 | * given socket and a private pointer of the application. This is 422 | * (only) useful for curl_multi_socket uses. 423 | * 424 | * Returns: CURLM error code. 425 | */ 426 | CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, 427 | curl_socket_t sockfd, void *sockp); 428 | 429 | 430 | /* 431 | * Name: curl_push_callback 432 | * 433 | * Desc: This callback gets called when a new stream is being pushed by the 434 | * server. It approves or denies the new stream. It can also decide 435 | * to completely fail the connection. 436 | * 437 | * Returns: CURL_PUSH_OK, CURL_PUSH_DENY or CURL_PUSH_ERROROUT 438 | */ 439 | #define CURL_PUSH_OK 0 440 | #define CURL_PUSH_DENY 1 441 | #define CURL_PUSH_ERROROUT 2 /* added in 7.72.0 */ 442 | 443 | struct curl_pushheaders; /* forward declaration only */ 444 | 445 | CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h, 446 | size_t num); 447 | CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h, 448 | const char *name); 449 | 450 | typedef int (*curl_push_callback)(CURL *parent, 451 | CURL *easy, 452 | size_t num_headers, 453 | struct curl_pushheaders *headers, 454 | void *userp); 455 | 456 | #ifdef __cplusplus 457 | } /* end of extern "C" */ 458 | #endif 459 | 460 | #endif 461 | --------------------------------------------------------------------------------