From 2650202bc5a29d51bedc62fbb6c3c12ee6fba427 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 2 Nov 2022 04:13:43 +0200 Subject: [PATCH] Added IOCB function --- Core/Driver.cpp | 11 +++++++++++ include/driver.hpp | 2 ++ 2 files changed, 13 insertions(+) diff --git a/Core/Driver.cpp b/Core/Driver.cpp index 1a7ed1b..517168d 100644 --- a/Core/Driver.cpp +++ b/Core/Driver.cpp @@ -114,6 +114,17 @@ namespace Driver }, }; + int Driver::IOCB(unsigned long DUID, void *KCB) + { + foreach (auto var in Drivers) + if (var->DriverUID == DUID) + { + FexExtended *DrvExtHdr = (FexExtended *)((uint64_t)var->Address + EXTENDED_SECTION_ADDRESS); + return ((int (*)(void *))((uint64_t)DrvExtHdr->Driver.Callback + (uint64_t)var->Address))(KCB); + } + return -1; + } + DriverCode Driver::CallDriverEntryPoint(void *fex) { KernelAPI *API = (KernelAPI *)KernelAllocator.RequestPages(TO_PAGES(sizeof(KernelAPI))); diff --git a/include/driver.hpp b/include/driver.hpp index 75c1856..2a78bc9 100644 --- a/include/driver.hpp +++ b/include/driver.hpp @@ -57,6 +57,8 @@ namespace Driver DriverCode CallDriverEntryPoint(void *fex); public: + Vector GetDrivers() { return Drivers; } + int IOCB(unsigned long DUID, /* KernelCallback */ void *KCB); DriverCode LoadDriver(uint64_t DriverAddress, uint64_t Size); DriverCode StartDrivers(); Driver();