From f5732e4d7ef9338fb066c36a1650afbf38450943 Mon Sep 17 00:00:00 2001 From: Brandon Date: Thu, 2 Jan 2014 12:00:10 -0500 Subject: [PATCH] Working Update Colour capture + plugin system in place. --- DXI/DXI.cbp | 57 +++++ DXI/DXI.depend | 15 ++ DXI/DXI.layout | 19 ++ DXI/SharedMemory.cpp | 238 ++++++++++++++++++ DXI/SharedMemory.hpp | 77 ++++++ DXI/main.cpp | 113 +++++++++ Other Hook Styles/Detour.cpp | 79 ++++++ Other Hook Styles/Detour.hpp | 41 +++ Other Hook Styles/Detours.txt | 30 +++ Other Hook Styles/Injector/Injector.cbp | 48 ++++ Other Hook Styles/Injector/Injector.depend | 6 + Other Hook Styles/Injector/Injector.layout | 9 + Other Hook Styles/Injector/main.cpp | 86 +++++++ ...VTable D3D9 Hook LoadLibrary Intercept.cpp | 56 +++++ Other Hook Styles/VTable D3D9 Hook.cpp | 96 +++++++ Other Hook Styles/VTable.cpp | 110 ++++++++ Other Hook Styles/VTableHook.cpp | 47 ++++ d3d9/Hooks/Exports.cpp | 43 ++-- d3d9/Hooks/Exports.hpp | 16 +- d3d9/Hooks/IDirect3D9Proxy.cpp | 12 +- d3d9/Hooks/IDirect3D9Proxy.hpp | 1 + d3d9/d3d9.def | 11 +- 22 files changed, 1170 insertions(+), 40 deletions(-) create mode 100644 DXI/DXI.cbp create mode 100644 DXI/DXI.depend create mode 100644 DXI/DXI.layout create mode 100644 DXI/SharedMemory.cpp create mode 100644 DXI/SharedMemory.hpp create mode 100644 DXI/main.cpp create mode 100644 Other Hook Styles/Detour.cpp create mode 100644 Other Hook Styles/Detour.hpp create mode 100644 Other Hook Styles/Detours.txt create mode 100644 Other Hook Styles/Injector/Injector.cbp create mode 100644 Other Hook Styles/Injector/Injector.depend create mode 100644 Other Hook Styles/Injector/Injector.layout create mode 100644 Other Hook Styles/Injector/main.cpp create mode 100644 Other Hook Styles/VTable D3D9 Hook LoadLibrary Intercept.cpp create mode 100644 Other Hook Styles/VTable D3D9 Hook.cpp create mode 100644 Other Hook Styles/VTable.cpp create mode 100644 Other Hook Styles/VTableHook.cpp diff --git a/DXI/DXI.cbp b/DXI/DXI.cbp new file mode 100644 index 0000000..41f72a4 --- /dev/null +++ b/DXI/DXI.cbp @@ -0,0 +1,57 @@ + + + + + + diff --git a/DXI/DXI.depend b/DXI/DXI.depend new file mode 100644 index 0000000..8a29e6f --- /dev/null +++ b/DXI/DXI.depend @@ -0,0 +1,15 @@ +# depslib dependency file v1.0 +1387667367 source:c:\users\brandon\desktop\dxi\sharedmemory.cpp + "SharedMemory.hpp" + +1387667354 c:\users\brandon\desktop\dxi\sharedmemory.hpp + + + + + + + + + + diff --git a/DXI/DXI.layout b/DXI/DXI.layout new file mode 100644 index 0000000..b7a5a70 --- /dev/null +++ b/DXI/DXI.layout @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/DXI/SharedMemory.cpp b/DXI/SharedMemory.cpp new file mode 100644 index 0000000..54a3aac --- /dev/null +++ b/DXI/SharedMemory.cpp @@ -0,0 +1,238 @@ +/** © 2013, Brandon T. All Rights Reserved. + * + * This file is part of the DXI Library. + * DXI is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * DXI is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with DXI. If not, see . + */ + +#include "SharedMemory.hpp" + +SharedMemory::SharedMemory(std::string MapName) : hFileMap(nullptr), pData(nullptr), MapName(MapName), Size(0), Debug(false), Events() {} +SharedMemory::SharedMemory(std::string MapName, std::size_t Size) : hFileMap(nullptr), pData(nullptr), MapName(MapName), Size(Size), Debug(false), Events() {} +SharedMemory::~SharedMemory() +{ + ReleaseMemory(); + DeleteAllEvents(); +} + +void* SharedMemory::GetDataPointer() +{ + void* Ptr = pData; + return Ptr; +} + +bool SharedMemory::OpenMemoryMap(std::size_t Size) +{ + this->Size = Size; + + #if defined _WIN32 || defined _WIN64 + if ((hFileMap = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, MapName.c_str())) == nullptr) + { + if (Debug) std::cout << _T("\nCould Not Open Shared Memory Map.\n"); + return false; + } + + if ((pData = MapViewOfFile(hFileMap, FILE_MAP_ALL_ACCESS, 0, 0, Size)) == nullptr) + { + if (Debug) std::cout << _T("\nCould Not Map View Of File.\n"); + CloseHandle(hFileMap); + return false; + } + + #else + + if ((hFileMap = open(MapName.c_str(), O_RDWR | O_CREAT, 438)) == -1) + { + if (Debug) std::cout << _T("\nCould Not Open Shared Memory Map.\n"); + return false; + } + + if ((pData = mmap(nullptr, Size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, hFileMap, 0)) == MAP_FAILED) + { + if (Debug) std::cout << _T("\nCould Not Map View Of File.\n"); + close(hFileMap); + return false; + } + #endif + + if (Debug) std::cout << _T("\nInter-Process Communication Successful.\n"); + return true; +} + +bool SharedMemory::MapMemory(std::size_t Size) +{ + this->Size = Size; + + #if defined _WIN32 || defined _WIN64 + if ((hFileMap = CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0, Size, MapName.c_str())) == nullptr) + { + if (Debug) std::cout << _T("\nCould Not Create Shared Memory Map.\n"); + return false; + } + + if ((pData = MapViewOfFile(hFileMap, FILE_MAP_ALL_ACCESS, 0, 0, Size)) == nullptr) + { + if (Debug) std::cout << _T("\nCould Not Map View Of File.\n"); + CloseHandle(hFileMap); + return false; + } + + #else + + if ((hFileMap = open(MapName.c_str(), O_RDWR | O_CREAT, 438)) == -1) + { + if (Debug) std::cout << _T("\nCould Not Create Shared Memory Map.\n"); + return false; + } + + if ((pData = mmap(nullptr, Size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, hFileMap, 0)) == MAP_FAILED) + { + if (Debug) std::cout << _T("\nCould Not Map View Of File.\n"); + close(hFileMap); + return false; + } + #endif + + if (Debug) std::cout << _T("\nMapped Shared Memory Successfully.\n"); + return true; +} + +bool SharedMemory::ReleaseMemory() +{ + bool Result = false; + #if defined _WIN32 || defined _WIN64 + if (pData) + { + Result = UnmapViewOfFile(pData); + pData = nullptr; + if (Result && Debug) + { + std::cout << _T("\nMemory Un-Mapped Successfully.\n"); + } + } + + if (hFileMap) + { + if (CloseHandle(hFileMap)) + { + hFileMap = nullptr; + Result = Result && true; + if (Debug) std::cout << _T("\nMemory Map Closed Successfully.\n"); + } + } + + #else + + if (pData) + { + Result = munmap(pData, Size); + if (!Result && Debug) + { + std::cout << _T("\nMemory Un-Mapped Successfully.\n"); + } + pData = nullptr; + return true; + } + + if (hFileMap) + { + if (!close(hFileMap)) + { + hFileMap = nullptr; + if (Debug) std::cout << _T("\nMemory Map Closed Successfully.\n"); + } + } + #endif + return Result; +} + +bool SharedMemory::CreateNewEvent(LPSECURITY_ATTRIBUTES lpEventAttributes, bool bManualReset, bool bInitialState, std::string EventName) +{ + std::map::iterator it = Events.find(EventName); + if (it != Events.end()) + { + if (Debug) + { + std::cout << _T("\nCreateNewEvent Error: An Event With That Key Already Exists!\n"); + } + return false; + } + + Events.insert(std::pair(EventName, CreateEvent(lpEventAttributes, bManualReset, bInitialState, EventName.c_str()))); + it = Events.end(); + return ((--it)->second != nullptr); +} + +std::uint32_t SharedMemory::OpenSingleEvent(std::string EventName, bool InheritHandle, bool SaveHandle, std::uint32_t dwDesiredAccess, std::uint32_t dwMilliseconds) +{ + void* hEvent = OpenEvent(dwDesiredAccess, InheritHandle, EventName.c_str()); + if (hEvent) + { + if (SaveHandle) + { + std::map::iterator it = Events.find(EventName); + if (it != Events.end()) + { + CloseHandle(it->second); + it->second = hEvent; + } + else + Events.insert(std::pair(EventName, hEvent)); + } + std::uint32_t Result = WaitForSingleObject(hEvent, dwMilliseconds); + if (!SaveHandle) CloseHandle(hEvent); + return Result; + } + CloseHandle(hEvent); + return WAIT_FAILED; +} + +bool SharedMemory::SetEventSignal(std::string EventName, bool Signaled) +{ + std::map::iterator it = Events.find(EventName); + if (it == Events.end()) + { + if (Debug) + { + std::cout << _T("\nSetEventSignal Error: No Event With That Key Exists!\n"); + } + return false; + } + if (Signaled) return SetEvent(it->second); + return ResetEvent(it->second); +} + +bool SharedMemory::DeleteSingleEvent(std::string EventName) +{ + std::map::iterator it = Events.find(EventName); + if (it == Events.end()) return true; + bool Result = CloseHandle(it->second); + Events.erase(it); + return Result; +} + +bool SharedMemory::DeleteAllEvents() +{ + bool Result = false; + for (std::map::iterator it = Events.begin(); it != Events.end(); ++it) + { + Result = Result && CloseHandle(it->second); + } + Events.clear(); + return Result; +} + +void SharedMemory::SetDebug(bool On) +{ + Debug = On; +} diff --git a/DXI/SharedMemory.hpp b/DXI/SharedMemory.hpp new file mode 100644 index 0000000..e0ef3be --- /dev/null +++ b/DXI/SharedMemory.hpp @@ -0,0 +1,77 @@ +/** © 2013, Brandon T. All Rights Reserved. + * + * This file is part of the DXI Library. + * DXI is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * DXI is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with DXI. If not, see . + */ + +#ifndef SHAREDMEMORY_HPP_INCLUDED +#define SHAREDMEMORY_HPP_INCLUDED + +#if defined _WIN32 || defined _WIN64 + #include +#else + #include + #include + #include + #include + #include +#endif + +#include +#include +#include + +class SharedMemory +{ + private: + void* FromFile; + void* hFileMap; + void* pData; + std::string MapName; + std::size_t Size; + bool Debug; + std::map Events; + + public: + SharedMemory(std::string MapName); + SharedMemory(std::string MapName, std::size_t Size); + ~SharedMemory(); + + SharedMemory(const SharedMemory& Shm) = delete; + SharedMemory(SharedMemory && Shm) = delete; + SharedMemory& operator = (const SharedMemory& Shm) = delete; + SharedMemory& operator = (SharedMemory && Shm) = delete; + + void* GetDataPointer(); + + bool OpenMemoryMap(std::size_t Size); + + bool MapMemory(std::size_t Size); + + bool ReleaseMemory(); + + bool CreateNewEvent(LPSECURITY_ATTRIBUTES lpEventAttributes, bool bManualReset, bool bInitialState, std::string EventName); + + std::uint32_t OpenSingleEvent(std::string EventName, bool InheritHandle, bool SaveHandle = false, std::uint32_t dwDesiredAccess = EVENT_ALL_ACCESS, std::uint32_t dwMilliseconds = INFINITE); + + bool SetEventSignal(std::string EventName, bool Signaled); + + bool DeleteSingleEvent(std::string EventName); + + bool DeleteAllEvents(); + + void SetDebug(bool On); +}; + +#endif // SHAREDMEMORY_HPP_INCLUDED diff --git a/DXI/main.cpp b/DXI/main.cpp new file mode 100644 index 0000000..168c94c --- /dev/null +++ b/DXI/main.cpp @@ -0,0 +1,113 @@ +#include +#include +#include "SharedMemory.hpp" + +#define ExportCount 3 +#define SharedImageSize 8294400 //Highest Resolution Support: 1920 x 1080 x sizeof(RGBA) +#define TotalImageSize (SharedImageSize * 2) //Image + DebugImage +#define SharedHookSize 5000000 + +HINSTANCE hInstance = nullptr; +std::unique_ptr SharedImageData; +std::unique_ptr SharedHookData; +std::string SharedImageName = "Local\\DXIImage_"; + +char* Exports[] = { + (char*)"DXISetup", (char*)"Function DXISetup(ProcessID: Integer): Boolean;", + (char*)"DXIImagePointer", (char*)"Function DXIImagePointer: Pointer;", + (char*)"DXIDebugPointer", (char*)"Function DXIDebugPointer: Pointer;" +}; + +extern "C" int __declspec(dllexport) GetPluginABIVersion() +{ + return 2; +} + +extern "C" int __declspec(dllexport) GetFunctionCount() +{ + return ExportCount; +} + +extern "C" int __declspec(dllexport) GetFunctionInfo(int Index, void* &Address, char* &Definition) +{ + if (Index < ExportCount) + { + Address = reinterpret_cast(GetProcAddress(hInstance, Exports[Index * 2])); + #ifdef _MSC_VER + #pragma warning(disable: 4996) + strcpy(Definition, Exports[Index * 2 + 1]); + //strcpy_s(Definition, Exports[Index * 2 + 1]); + #else + strcpy(Definition, Exports[Index * 2 + 1]); + #endif + return Index; + } + return -1; +} + +void GetDesktopResolution(int &width, int &height) +{ + #if defined _WIN32 || defined _WIN64 + RECT desktop = {0}; + const HWND hDesktop = GetDesktopWindow(); + GetWindowRect(hDesktop, &desktop); + width = desktop.right; + height = desktop.bottom; + #endif +} + +bool CreateSharedMemory(int ProcessID) +{ + int Width = 0, Height = 0; + GetDesktopResolution(Width, Height); + SharedImageData.reset(new SharedMemory(SharedImageName + std::to_string(ProcessID))); + return SharedImageData->MapMemory(Width || Height == 0 ? TotalImageSize : Width * Height * 4 * 2); +} + +bool OpenSharedMemory(int ProcessID) +{ + int Width = 0, Height = 0; + GetDesktopResolution(Width, Height); + SharedImageData.reset(new SharedMemory(SharedImageName + std::to_string(ProcessID))); + return SharedImageData->OpenMemoryMap(Width || Height == 0 ? SharedImageSize : Width * Height * 4 * 2); +} + +bool UnMapSharedMemory() +{ + SharedImageData.reset(nullptr); + return true; +} + +extern "C" bool __declspec(dllexport) DXISetup(int ProcessID) +{ + return (CreateSharedMemory(ProcessID) || OpenSharedMemory(ProcessID)); +} + +extern "C" void* __declspec(dllexport) DXIImagePointer() +{ + return SharedImageData ? SharedImageData->GetDataPointer() : nullptr; +} + +extern "C" void* __declspec(dllexport) DXIDebugPointer() +{ + return SharedImageData ? reinterpret_cast(SharedImageData->GetDataPointer()) + SharedImageSize : nullptr; +} + +extern "C" bool __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + hInstance = hinstDLL; + return true; + + case DLL_PROCESS_DETACH: + UnMapSharedMemory(); + break; + + default: + break; + } + return true; +} diff --git a/Other Hook Styles/Detour.cpp b/Other Hook Styles/Detour.cpp new file mode 100644 index 0000000..853a882 --- /dev/null +++ b/Other Hook Styles/Detour.cpp @@ -0,0 +1,79 @@ +#include "Detour.hpp" + +void Detour::InsertJmp(std::uint8_t* jmp, std::uint8_t* src, std::uint8_t* dest, const int len) +{ + *jmp = 0xE9; + *reinterpret_cast(jmp + 1) = static_cast(src + len - dest); +} + +void Detour::Patch() +{ + DWORD dwProt = 0; + std::uint8_t* jmp = new std::uint8_t[this->JumpLength + 5]; + VirtualProtect(this->OrigFunc, this->JumpLength, PAGE_READWRITE, &dwProt); + memcpy(jmp, this->OrigFunc, this->JumpLength); + + jmp += this->JumpLength; + jmp[0] = 0xE9; + *reinterpret_cast(jmp + 1) = static_cast(this->OrigFunc + this->JumpLength - jmp) - 5; + memset(this->OrigFunc, 0x90, this->JumpLength); + + this->OrigFunc[0] = 0xE9; + *reinterpret_cast(this->OrigFunc + 1) = static_cast(this->HookFunc - this->OrigFunc) - 5; + VirtualProtect(this->OrigFunc, this->JumpLength, dwProt, &dwProt); + this->HookJump = (jmp - this->JumpLength); +} + +void Detour::Remove() +{ + DWORD dwProt = 0; + VirtualProtect(this->OrigFunc, this->JumpLength, PAGE_READWRITE, &dwProt); + memcpy(this->OrigFunc, reinterpret_cast(this->HookJump), this->JumpLength); + VirtualProtect(this->OrigFunc, this->JumpLength, dwProt, &dwProt); +} + +void Detour::PatchEx() +{ + #ifndef __x86_64 + this->HookJump = new std::uint8_t[7]; + const static std::uint8_t jmp[] = {0xb8, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0}; /** movl $0x0, %eax ;;; jmp *%eax **/ + #else + const static std::uint8_t jmp[] = {0x48, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xe0, 0x90, 0x90}; /** movq $0x0, %rax ;;; jmp *%rax **/ + this->HookJump = new std::uint8_t[15]; + #endif + DWORD dwProtect = 0; + const static std::int8_t jmp_size = sizeof(jmp) / sizeof(std::uint8_t); + VirtualProtect(this->OrigFunc, jmp_size, PAGE_EXECUTE_READWRITE, &dwProtect); + memcpy(this->HookJump, this->OrigFunc, jmp_size); + memcpy(this->OrigFunc, jmp, jmp_size); + #ifndef __x86_64 + memcpy(this->OrigFunc + 1, &this->HookFunc, sizeof(void*)); + #else + memcpy(this->OrigFunc + 2, &this->HookFunc, sizeof(void*)); + #endif + VirtualProtect(this->OrigFunc, jmp_size, dwProtect, &dwProtect); +} + +void Detour::RemoveEx() +{ + #ifndef __x86_64 + const static std::int8_t jmp_size = 7; + #else + const static std::int8_t jmp_size = 14; + #endif + DWORD dwProtect = 0; + VirtualProtect(this->OrigFunc, jmp_size, PAGE_EXECUTE_READWRITE, &dwProtect); + memcpy(this->OrigFunc, this->HookJump, jmp_size); + VirtualProtect(this->OrigFunc, jmp_size, dwProtect, &dwProtect); + delete[] this->HookJump; + this->HookJump = nullptr; +} + +bool Detour::IsPatched() +{ + #ifndef __x86_64 + return this->OrigFunc[0] == 0xE9; + #else + return this->HookJump != nullptr && this->HookJump[0] == 0x48; + #endif +} diff --git a/Other Hook Styles/Detour.hpp b/Other Hook Styles/Detour.hpp new file mode 100644 index 0000000..b9b2c89 --- /dev/null +++ b/Other Hook Styles/Detour.hpp @@ -0,0 +1,41 @@ +#ifndef DETOUR_HPP_INCLUDED +#define DETOUR_HPP_INCLUDED + +#include +#include + +class Detour +{ + private: + std::uint8_t* OrigFunc; + std::uint8_t* HookFunc; + std::uint8_t* HookJump; + std::uint32_t* VTable; + int JumpLength; + + void InsertJmp(std::uint8_t* jmp, std::uint8_t* src, std::uint8_t* dest, const int len); + + public: + template + Detour(T OriginalFunction, T HookFunction, int JumpLength = 5); + + void Patch(); + void Remove(); + void PatchEx(); + void RemoveEx(); + bool IsPatched(); + + template + T OriginalFunction(); +}; + +template +Detour::Detour(T OriginalFunction, T HookFunction, int JumpLength) : OrigFunc(reinterpret_cast(OriginalFunction)), HookFunc(reinterpret_cast(HookFunction)), JumpLength(JumpLength) {} + +template +T Detour::OriginalFunction() +{ + return reinterpret_cast(this->HookJump); +} + +#endif // DETOUR_HPP_INCLUDED diff --git a/Other Hook Styles/Detours.txt b/Other Hook Styles/Detours.txt new file mode 100644 index 0000000..edf8398 --- /dev/null +++ b/Other Hook Styles/Detours.txt @@ -0,0 +1,30 @@ +void* DetourFunction (BYTE *src, const BYTE *dst, const int len) +{ + BYTE *jmp = (BYTE*)malloc(len+5); + DWORD dwBack; + + VirtualProtect(src, len, PAGE_EXECUTE_READWRITE, &dwBack); + memcpy(jmp, src, len); + jmp += len; + jmp[0] = 0xE9; + *(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5; + src[0] = 0xE9; + *(DWORD*)(src+1) = (DWORD)(dst - src) - 5; + for (int i=5; i + + + + + diff --git a/Other Hook Styles/Injector/Injector.depend b/Other Hook Styles/Injector/Injector.depend new file mode 100644 index 0000000..0ba05c9 --- /dev/null +++ b/Other Hook Styles/Injector/Injector.depend @@ -0,0 +1,6 @@ +# depslib dependency file v1.0 +1387569761 source:c:\users\brandon\desktop\llbhook\injector\main.cpp + + + + diff --git a/Other Hook Styles/Injector/Injector.layout b/Other Hook Styles/Injector/Injector.layout new file mode 100644 index 0000000..9032163 --- /dev/null +++ b/Other Hook Styles/Injector/Injector.layout @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Other Hook Styles/Injector/main.cpp b/Other Hook Styles/Injector/main.cpp new file mode 100644 index 0000000..7d7f104 --- /dev/null +++ b/Other Hook Styles/Injector/main.cpp @@ -0,0 +1,86 @@ +#include +#include +#include + +PROCESSENTRY32 GetProcessInfo(const char* ProcessName) +{ + void* hSnap = nullptr; + PROCESSENTRY32 Proc32 = {0}; + + if((hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)) == INVALID_HANDLE_VALUE) + return Proc32; + + Proc32.dwSize = sizeof(PROCESSENTRY32); + while(Process32Next(hSnap, &Proc32)) + { + if(_stricmp(ProcessName, Proc32.szExeFile) == 0) + { + CloseHandle(hSnap); + return Proc32; + } + } + CloseHandle(hSnap); + Proc32 = {0}; + return Proc32; +} + +bool IsProcessRunning(const char* pProcessName) +{ + return (GetProcessInfo(pProcessName).th32ProcessID != 0); +} + +void PrintProcessInfo(const char* ProcessName) +{ + PROCESSENTRY32 Proc32 = GetProcessInfo(ProcessName); + if (Proc32.th32ProcessID != 0) + { + std::cout << " =======================================================\n"; + std::cout << " Process Name: " << Proc32.szExeFile << "\n"; + std::cout << " =======================================================\n\n"; + std::cout << " Process ID: " << Proc32.th32ProcessID << "\n"; + std::cout << " Thread Count: " << Proc32.cntThreads << "\n"; + std::cout << " Priority Base: " << Proc32.pcPriClassBase << "\n"; + std::cout << " Parent Process ID: " << Proc32.th32ParentProcessID << "\n\n"; + std::cout << " =======================================================\n"; + } +} + +bool Inject(std::string Process, std::string File) +{ + if (IsProcessRunning(Process.c_str())) + { + HMODULE hKernel32 = nullptr; + void* RemoteAddress = nullptr; + char FilePath[MAX_PATH + 1] = {0}; + HANDLE ProcessHandle, hThread = nullptr; + LPTHREAD_START_ROUTINE LoadLibraryHandle = nullptr; + + PrintProcessInfo(Process.c_str()); + PROCESSENTRY32 ProcessInfo = GetProcessInfo(Process.c_str()); + _snprintf(FilePath, MAX_PATH, File.c_str()); + + if ((ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, false, ProcessInfo.th32ProcessID))) + { + if ((hKernel32 = GetModuleHandle("Kernel32.dll"))) + { + LoadLibraryHandle = reinterpret_cast(GetProcAddress(hKernel32, "LoadLibraryA")); + RemoteAddress = VirtualAllocEx(ProcessHandle, nullptr, File.size() * sizeof(TCHAR), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + WriteProcessMemory(ProcessHandle, RemoteAddress, FilePath, File.size() * sizeof(TCHAR), nullptr); + hThread = CreateRemoteThread(ProcessHandle, nullptr, 0, LoadLibraryHandle, RemoteAddress, 0, nullptr); + WaitForSingleObject(hThread, INFINITE); + VirtualFreeEx(ProcessHandle, RemoteAddress, File.size() * sizeof(TCHAR), MEM_RELEASE); + CloseHandle(ProcessHandle); + CloseHandle(hThread); + return true; + } + CloseHandle(ProcessHandle); + } + } + return false; +} + +int main() +{ + Inject("JagexLauncher.exe", "C:/Users/Brandon/Desktop/LHook.dll"); + std::cin.get(); +} diff --git a/Other Hook Styles/VTable D3D9 Hook LoadLibrary Intercept.cpp b/Other Hook Styles/VTable D3D9 Hook LoadLibrary Intercept.cpp new file mode 100644 index 0000000..b5fb53c --- /dev/null +++ b/Other Hook Styles/VTable D3D9 Hook LoadLibrary Intercept.cpp @@ -0,0 +1,56 @@ +#include +#include +#include +#include +#include +#include + +#pragma comment(lib, "detours.lib") + +typedef HMODULE (__stdcall *LoadLibrary_t)(LPCSTR dllName); +LoadLibrary_t o_LoadLibrary; + +HMODULE __stdcall DXI_LoadLibrary(LPCSTR dllName) +{ + if (std::string(dllName).find("jagdx") != std::string::npos) + { + MessageBoxA(NULL, "Direct-X Mode", "LoadLibrary", 0); + } + else if (std::string(dllName).find("jaggl") != std::string::npos) + { + MessageBoxA(NULL, "OpenGL Mode", "LoadLibrary", 0); + } + return o_LoadLibrary(dllName); +} + +#ifdef MS +template +void DetourFunction(T &OriginalFunction, U HookFunction) +{ + DetourTransactionBegin(); + DetourUpdateThread(GetCurrentThread()); + DetourAttach(&reinterpret_cast(OriginalFunction), reinterpret_cast(HookFunction)); + DetourTransactionCommit(); + DetourTransactionBegin(); + DetourUpdateThread(GetCurrentThread()); +} +#endif + +bool __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + o_LoadLibrary = (LoadLibrary_t) GetProcAddress(GetModuleHandleW(L"Kernel32.dll"), "LoadLibraryA"); + DetourFunction(o_LoadLibrary, DXI_LoadLibrary); + return true; + + case DLL_PROCESS_DETACH: + break; + + default: + break; + } + return true; +} diff --git a/Other Hook Styles/VTable D3D9 Hook.cpp b/Other Hook Styles/VTable D3D9 Hook.cpp new file mode 100644 index 0000000..266bb03 --- /dev/null +++ b/Other Hook Styles/VTable D3D9 Hook.cpp @@ -0,0 +1,96 @@ +#include +#include +#include +#include + +typedef HRESULT (__stdcall *EndScene_t)(IDirect3DSurface9* Surface); +EndScene_t o_EndScene; + +HRESULT __stdcall DXI_EndScene(IDirect3DSurface9* Surface) +{ + MessageBox(NULL, "EndScene Hook", "DXI_EndScene", 0); + return o_EndScene(Surface); +} + +bool InitialiseHooks(); + +bool __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + std::thread([&] {InitialiseHooks();}).detach(); + return true; + + case DLL_PROCESS_DETACH: + break; + + default: + break; + } + return true; +} + +DWORD FindPattern(DWORD dwAddress, DWORD dwLen, BYTE *bMask, const char* szMask) +{ + auto bCompare = [](const BYTE* pData, const BYTE* bMask, const char* szMask) -> bool + { + for(; *szMask; ++szMask, ++pData, ++bMask) + if(*szMask == 'x' && *pData != *bMask) + return 0; + return (*szMask) == 0; + }; + + for(DWORD i = 0; i < dwLen; ++i) + if (bCompare(reinterpret_cast(dwAddress + i), bMask, szMask)) + return static_cast(dwAddress + i); + return 0; +} + +void* DetourFunction(std::uint8_t* OrigFunc, std::uint8_t* HookFunc, int JumpLength) +{ + DWORD dwProt = 0; + std::uint8_t* jmp = new std::uint8_t[JumpLength + 5]; + VirtualProtect(OrigFunc, JumpLength, PAGE_READWRITE, &dwProt); + memcpy(jmp, OrigFunc, JumpLength); + + jmp += JumpLength; + jmp[0] = 0xE9; + *reinterpret_cast(jmp + 1) = static_cast(OrigFunc + JumpLength - jmp) - 5; + memset(OrigFunc, 0x90, JumpLength); + + OrigFunc[0] = 0xE9; + *reinterpret_cast(OrigFunc + 1) = static_cast(HookFunc - OrigFunc) - 5; + VirtualProtect(OrigFunc, JumpLength, dwProt, &dwProt); + return (jmp - JumpLength); +} + +DWORD WINAPI VTableRepatch() +{ + while(true) + { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + DetourFunction(reinterpret_cast(o_EndScene), reinterpret_cast(&DXI_EndScene), 5); + } + return 0; +} + +bool InitialiseHooks() +{ + while(!GetModuleHandle("d3d9.dll")) + { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + + DWORD* VTable = nullptr; + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + static std::uint8_t bMask[] = {0xC7, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x86, 0x00, 0x00, 0x00, 0x00, 0x89, 0x86}; + DWORD Address = FindPattern(reinterpret_cast(GetModuleHandle("d3d9.dll")), 0x128000, bMask, "xx????xx????xx"); + memcpy(&VTable, reinterpret_cast(Address + 2), 4); + + o_EndScene = reinterpret_cast(VTable[42]); + DetourFunction(reinterpret_cast(o_EndScene), reinterpret_cast(&DXI_EndScene), 5); + std::thread([&] {VTableRepatch();}).detach(); + return VTable != nullptr; +} diff --git a/Other Hook Styles/VTable.cpp b/Other Hook Styles/VTable.cpp new file mode 100644 index 0000000..b6accf2 --- /dev/null +++ b/Other Hook Styles/VTable.cpp @@ -0,0 +1,110 @@ +#include +#include +#include + +class VHook +{ + private: + std::uint32_t* VTable; + std::map HookFunctions; + std::map OrigFunctions; + DWORD* GetVTableAddress(void* pObject); + + public: + VHook(std::uint32_t* VTable); + VHook(DWORD* VTable); + + template + VHook(T* VTable); + + template + void Patch(T* HookFunction, int Index); + void Remove(int Index); + void Erase(int Index); +}; + +VHook::VHook(DWORD* VTable) : VTable(reinterpret_cast(VTable)) {} + +VHook::VHook(std::uint32_t* VTable) : VTable(VTable) {} + +template +VHook::VHook(T* VTable) : VTable(reinterpret_cast(this->GetVTableAddress(VTable))) {} + +DWORD* VHook::GetVTableAddress(void* pObject) +{ + return *reinterpret_cast(pObject); +} + +template +void VHook::Patch(T* HookFunction, int Index) +{ + DWORD dwOldProt = 0, *OrigFunction = nullptr; + VirtualProtect(&this->VTable[Index], sizeof(int), PAGE_EXECUTE_READWRITE, &dwOldProt); + OrigFunction = reinterpret_cast(this->VTable[Index]); + this->VTable[Index] = reinterpret_cast(HookFunction); + VirtualProtect(&this->VTable[Index], sizeof(int), dwOldProt, &dwOldProt); + this->OrigFunctions.insert( {Index, reinterpret_cast(OrigFunction)}); + this->HookFunctions.insert( {Index, reinterpret_cast(HookFunction)}); +} + +void VHook::Remove(int Index) +{ + DWORD dwOldProt = 0; + VirtualProtect(&this->VTable[Index], sizeof(int), PAGE_EXECUTE_READWRITE, &dwOldProt); + this->VTable[Index] = static_cast(this->OrigFunctions[Index]); + VirtualProtect(&this->VTable[Index], sizeof(int), dwOldProt, &dwOldProt); +} + +void VHook::Erase(int Index) +{ + DWORD dwOldProt = 0; + VirtualProtect(&this->VTable[Index], sizeof(int), PAGE_EXECUTE_READWRITE, &dwOldProt); + this->VTable[Index] = static_cast(this->OrigFunctions[Index]); + VirtualProtect(&this->VTable[Index], sizeof(int), dwOldProt, &dwOldProt); + this->OrigFunctions.erase(Index); + this->HookFunctions.erase(Index); +} + +typedef void (__stdcall *pSleep)(DWORD Milliseconds); +pSleep oSleep; + +void __stdcall hSleep(DWORD Milliseconds) +{ + std::cout << "Hooked!\n"; + //oSleep(Milliseconds); +} + +void* DetourFunction(std::uint8_t* OrigFunc, const std::uint8_t* HookFunc, const int JumpLength) +{ + DWORD dwProt = 0; + std::uint8_t* jmp = new std::uint8_t[JumpLength + 5]; + + VirtualProtect(OrigFunc, JumpLength, PAGE_EXECUTE_READWRITE, &dwProt); + memcpy(jmp, OrigFunc, JumpLength); + + jmp += JumpLength; + jmp[0] = 0xE9; + + *reinterpret_cast(jmp + 1) = static_cast(OrigFunc + JumpLength - jmp) - 5; + memset(OrigFunc, 0x90, JumpLength); + + OrigFunc[0] = 0xE9; + *reinterpret_cast(OrigFunc + 1) = static_cast(HookFunc - OrigFunc) - 5; + + VirtualProtect(OrigFunc, JumpLength, dwProt, &dwProt); + return (jmp - JumpLength); +} + +#include "Detour.hpp" + +int main() +{ + oSleep = reinterpret_cast(GetProcAddress(GetModuleHandle("kernel32.dll"), "Sleep")); + Detour D(oSleep, hSleep); + D.Patch(); + Sleep(1000); + oSleep = D.OriginalFunction(); + oSleep(1000); + + return 0; +} diff --git a/Other Hook Styles/VTableHook.cpp b/Other Hook Styles/VTableHook.cpp new file mode 100644 index 0000000..5872f8d --- /dev/null +++ b/Other Hook Styles/VTableHook.cpp @@ -0,0 +1,47 @@ +#include +#include + +std::uint32_t* GetVtableAddress(void* pObject) +{ + return reinterpret_cast(*(static_cast(pObject))); +} + +void HookFunction(DWORD* pVtable, void* pHookProc, void* pOldProc, int iIndex) +{ + // Enable writing to the vtable at address we aquired + DWORD lpflOldProtect; + VirtualProtect((void*)&pVtable[iIndex], sizeof(DWORD), PAGE_READWRITE, &lpflOldProtect); + + // Store old address + if (pOldProc) { + *(DWORD*)pOldProc = pVtable[iIndex]; + } + + // Overwrite original address + pVtable[iIndex] = reinterpret_cast(pHookProc); + + // Restore protection + VirtualProtect(pVtable, sizeof(DWORD), lpflOldProtect, &lpflOldProtect); +} + +class Test +{ + public: + virtual void Foo() {std::cout << "Foo\n";} + virtual void Meh() {std::cout << "Meh\n";} +}; + +typedef void (__cdecl *ptr_Foo)(Test* t); +typedef void (__cdecl *ptr_Meh)(Test* t); + +void Foo(Test* ptr) +{ + std::cout<<"Foo Hooked\n"; +} + +int main() +{ + Test T; + std::uint32_t* Ptr = GetVtableAddress(&T); + HookFunction(Ptr, &Foo, &T.Foo, 0); +} diff --git a/d3d9/Hooks/Exports.cpp b/d3d9/Hooks/Exports.cpp index 077a6f9..a2ea13d 100644 --- a/d3d9/Hooks/Exports.cpp +++ b/d3d9/Hooks/Exports.cpp @@ -23,10 +23,10 @@ bool __stdcall Initialize(void) OriginalDX->FunctionAddress(d3d9.D3DPERF_QueryRepeatFrame, "D3DPERF_QueryRepeatFrame"); OriginalDX->FunctionAddress(d3d9.D3DPERF_SetMarker, "D3DPERF_SetMarker"); OriginalDX->FunctionAddress(d3d9.D3DPERF_SetOptions, "D3DPERF_SetOptions"); - OriginalDX->FunctionAddress(d3d9.D3DPERF_SetRegion, "D3DPERF_Region"); + OriginalDX->FunctionAddress(d3d9.D3DPERF_SetRegion, "D3DPERF_SetRegion"); OriginalDX->FunctionAddress(d3d9.DebugSetLevel, "DebugSetLevel"); OriginalDX->FunctionAddress(d3d9.DebugSetMute, "DebugSetMute"); - OriginalDX->FunctionAddress(d3d9.Direct3D9EnableMaximizedWindowedModeShim, "Direct3D9EnableMaximizedWindowedModeShim"); + //OriginalDX->FunctionAddress(d3d9.Direct3D9EnableMaximizedWindowedModeShim, "Direct3D9EnableMaximizedWindowedModeShim"); OriginalDX->FunctionAddress(d3d9.Direct3DCreate9, "Direct3DCreate9"); OriginalDX->FunctionAddress(d3d9.Direct3DCreate9Ex, "Direct3DCreate9Ex"); OriginalDX->FunctionAddress(d3d9.Direct3DShaderValidatorCreate9, "Direct3DShaderValidatorCreate9"); @@ -52,7 +52,7 @@ bool __stdcall DeInitialize(void) return false; } -void DXHook_D3DPERF_BeginEvent() +void __stdcall DXHook_D3DPERF_BeginEvent() { #ifdef _MSC_VER _asm{jmp[d3d9.D3DPERF_BeginEvent]} @@ -61,7 +61,7 @@ void DXHook_D3DPERF_BeginEvent() #endif } -void DXHook_D3DPERF_EndEvent() +void __stdcall DXHook_D3DPERF_EndEvent() { #ifdef _MSC_VER _asm{jmp[d3d9.D3DPERF_EndEvent]} @@ -70,7 +70,7 @@ void DXHook_D3DPERF_EndEvent() #endif } -void DXHook_D3DPERF_GetStatus() +void __stdcall DXHook_D3DPERF_GetStatus() { #ifdef _MSC_VER _asm{jmp[d3d9.D3DPERF_GetStatus]} @@ -79,7 +79,7 @@ void DXHook_D3DPERF_GetStatus() #endif } -void DXHook_D3DPERF_QueryRepeatFrame() +void __stdcall DXHook_D3DPERF_QueryRepeatFrame() { #ifdef _MSC_VER _asm{jmp[d3d9.D3DPERF_QueryRepeatFrame]} @@ -88,7 +88,7 @@ void DXHook_D3DPERF_QueryRepeatFrame() #endif } -void DXHook_D3DPERF_SetMarker() +void __stdcall DXHook_D3DPERF_SetMarker() { #ifdef _MSC_VER _asm{jmp[d3d9.D3DPERF_SetMarker]} @@ -97,7 +97,7 @@ void DXHook_D3DPERF_SetMarker() #endif } -void DXHook_D3DPERF_SetOptions() +void __stdcall DXHook_D3DPERF_SetOptions() { #ifdef _MSC_VER _asm{jmp[d3d9.D3DPERF_SetOptions]} @@ -106,7 +106,7 @@ void DXHook_D3DPERF_SetOptions() #endif } -void DXHook_D3DPERF_SetRegion() +void __stdcall DXHook_D3DPERF_SetRegion() { #ifdef _MSC_VER _asm{jmp[d3d9.D3DPERF_SetRegion]} @@ -115,7 +115,7 @@ void DXHook_D3DPERF_SetRegion() #endif } -void DXHook_DebugSetLevel() +void __stdcall DXHook_DebugSetLevel() { #ifdef _MSC_VER _asm{jmp[d3d9.DebugSetLevel]} @@ -124,7 +124,7 @@ void DXHook_DebugSetLevel() #endif } -void DXHook_DebugSetMute() +void __stdcall DXHook_DebugSetMute() { #ifdef _MSC_VER _asm{jmp[d3d9.DebugSetMute]} @@ -133,23 +133,14 @@ void DXHook_DebugSetMute() #endif } -void DXHook_Direct3D9EnableMaximizedWindowedModeShim() -{ - #ifdef _MSC_VER - _asm{jmp[d3d9.Direct3D9EnableMaximizedWindowedModeShim]} - #else - __asm("jmp *%0":: "r" (d3d9.Direct3D9EnableMaximizedWindowedModeShim):); - #endif -} - -IDirect3D9* DXHook_Direct3DCreate9(UINT SDKVersion) +IDirect3D9* __stdcall DXHook_Direct3DCreate9(UINT SDKVersion) { typedef IDirect3D9* (__stdcall *D3D9_Type) (UINT SDKVersion); - IDirect3D9* pOriginal = reinterpret_cast(d3d9.Direct3DCreate9)(SDKVersion); + IDirect3D9* pOriginal = (reinterpret_cast(d3d9.Direct3DCreate9))(SDKVersion); return (D3D9Proxy = new IDirect3D9Proxy(pOriginal)); } -void DXHook_Direct3DCreate9Ex() +void __stdcall DXHook_Direct3DCreate9Ex() { #ifdef _MSC_VER _asm{jmp[d3d9.Direct3DCreate9Ex]} @@ -158,7 +149,7 @@ void DXHook_Direct3DCreate9Ex() #endif } -void DXHook_Direct3DShaderValidatorCreate9() +void __stdcall DXHook_Direct3DShaderValidatorCreate9() { #ifdef _MSC_VER _asm{jmp[d3d9.Direct3DShaderValidatorCreate9]} @@ -167,7 +158,7 @@ void DXHook_Direct3DShaderValidatorCreate9() #endif } -void DXHook_PSGPError() +void __stdcall DXHook_PSGPError() { #ifdef _MSC_VER _asm{jmp[d3d9.PSGPError]} @@ -176,7 +167,7 @@ void DXHook_PSGPError() #endif } -void DXHook_PSGPSampleTexture() +void __stdcall DXHook_PSGPSampleTexture() { #ifdef _MSC_VER _asm{jmp[d3d9.PSGPSampleTexture]} diff --git a/d3d9/Hooks/Exports.hpp b/d3d9/Hooks/Exports.hpp index af1966d..2779b8c 100644 --- a/d3d9/Hooks/Exports.hpp +++ b/d3d9/Hooks/Exports.hpp @@ -18,7 +18,6 @@ struct d3d9_dll FARPROC D3DPERF_SetRegion; FARPROC DebugSetLevel; FARPROC DebugSetMute; - FARPROC Direct3D9EnableMaximizedWindowedModeShim; FARPROC Direct3DCreate9; FARPROC Direct3DCreate9Ex; FARPROC Direct3DShaderValidatorCreate9; @@ -32,4 +31,19 @@ extern IDirect3D9Proxy* D3D9Proxy; extern "C" bool __stdcall Initialize(void); extern "C" bool __stdcall DeInitialize(void); +extern "C" void __stdcall DXHook_D3DPERF_BeginEvent(); +extern "C" void __stdcall DXHook_D3DPERF_EndEvent(); +extern "C" void __stdcall DXHook_D3DPERF_GetStatus(); +extern "C" void __stdcall DXHook_D3DPERF_QueryRepeatFrame(); +extern "C" void __stdcall DXHook_D3DPERF_SetMarker(); +extern "C" void __stdcall DXHook_D3DPERF_SetOptions(); +extern "C" void __stdcall DXHook_D3DPERF_SetRegion(); +extern "C" void __stdcall DXHook_DebugSetLevel(); +extern "C" void __stdcall DXHook_DebugSetMute(); +extern "C" IDirect3D9* __stdcall DXHook_Direct3DCreate9(UINT SDKVersion); +extern "C" void __stdcall DXHook_Direct3DCreate9Ex(); +extern "C" void __stdcall DXHook_Direct3DShaderValidatorCreate9(); +extern "C" void __stdcall DXHook_PSGPError(); +extern "C" void __stdcall DXHook_PSGPSampleTexture(); + #endif // EXPORTS_HPP_INCLUDED diff --git a/d3d9/Hooks/IDirect3D9Proxy.cpp b/d3d9/Hooks/IDirect3D9Proxy.cpp index c490499..18bf6b6 100644 --- a/d3d9/Hooks/IDirect3D9Proxy.cpp +++ b/d3d9/Hooks/IDirect3D9Proxy.cpp @@ -21,7 +21,12 @@ ULONG IDirect3D9Proxy::AddRef() ULONG IDirect3D9Proxy::Release() { - return ptr_IDirect3D9->Release(); + ULONG ReferenceCount = ptr_IDirect3D9->Release(); + if (ReferenceCount == 0) + { + delete this; + } + return ReferenceCount; } HRESULT IDirect3D9Proxy::RegisterSoftwareDevice(void* pInitializeFunction) @@ -91,8 +96,7 @@ HMONITOR IDirect3D9Proxy::GetAdapterMonitor(UINT Adapter) HRESULT IDirect3D9Proxy::CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface) { - IDirect3DDevice9* pDirect3DDevice9 = nullptr; - HRESULT hRes = ptr_IDirect3D9->CreateDevice(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, &pDirect3DDevice9); - *ppReturnedDeviceInterface = new Direct3DDevice9Proxy(ppReturnedDeviceInterface); + HRESULT hRes = ptr_IDirect3D9->CreateDevice(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface); + *ppReturnedDeviceInterface = hRes == S_OK ? new Direct3DDevice9Proxy(*ppReturnedDeviceInterface) : nullptr; return hRes; } diff --git a/d3d9/Hooks/IDirect3D9Proxy.hpp b/d3d9/Hooks/IDirect3D9Proxy.hpp index fd9b2cc..4257532 100644 --- a/d3d9/Hooks/IDirect3D9Proxy.hpp +++ b/d3d9/Hooks/IDirect3D9Proxy.hpp @@ -2,6 +2,7 @@ #define IDIRECT3D9PROXY_HPP_INCLUDED #include +#include "Direct3DDevice9Proxy.hpp" class IDirect3D9Proxy : public IDirect3D9 { diff --git a/d3d9/d3d9.def b/d3d9/d3d9.def index 3f6d9dd..47c6224 100644 --- a/d3d9/d3d9.def +++ b/d3d9/d3d9.def @@ -1,14 +1,8 @@ -; @Author : Brandon T. -; -; @param : D3D9 Definition File. -; @param : Info From MSDN Documentation. - - -LIBRARY d3d9 +LIBRARY "d3d9" DESCRIPTION "D3D9 Definition File" EXPORTS - +SMARTPluginInit D3DPERF_BeginEvent = DXHook_D3DPERF_BeginEvent D3DPERF_EndEvent = DXHook_D3DPERF_EndEvent D3DPERF_GetStatus = DXHook_D3DPERF_GetStatus @@ -18,7 +12,6 @@ D3DPERF_SetOptions = DXHook_D3DPERF_SetOptions D3DPERF_SetRegion = DXHook_D3DPERF_SetRegion DebugSetLevel = DXHook_DebugSetLevel DebugSetMute = DXHook_DebugSetMute -Direct3D9EnableMaximizedWindowedModeShim = DXHook_Direct3D9EnableMaximizedWindowedModeShim Direct3DCreate9 = DXHook_Direct3DCreate9 Direct3DCreate9Ex = DXHook_Direct3DCreate9Ex Direct3DShaderValidatorCreate9 = DXHook_Direct3DShaderValidatorCreate9