HydraHook
Direct3D and Core Audio hooking library for Windows
Loading...
Searching...
No Matches
HydraHookDirect3D11.h
Go to the documentation of this file.
1
14
15/*
16MIT License
17
18Copyright (c) 2018-2026 Benjamin Höglinger-Stelzer
19
20Permission is hereby granted, free of charge, to any person obtaining a copy
21of this software and associated documentation files (the "Software"), to deal
22in the Software without restriction, including without limitation the rights
23to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24copies of the Software, and to permit persons to whom the Software is
25furnished to do so, subject to the following conditions:
26
27The above copyright notice and this permission notice shall be included in all
28copies or substantial portions of the Software.
29
30THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36SOFTWARE.
37*/
38
39
40#ifndef HydraHookDirect3D11_h__
41#define HydraHookDirect3D11_h__
42
43#ifndef HYDRAHOOK_NO_D3D11
44
45#include "HydraHookCore.h"
46#include <dxgi.h>
47#include <d3d11.h>
48
50typedef
51_Function_class_(EVT_HYDRAHOOK_D3D11_PRE_PRESENT)
52VOID
54 IDXGISwapChain *pSwapChain,
55 UINT SyncInterval,
56 UINT Flags,
57 PHYDRAHOOK_EVT_PRE_EXTENSION Extension
58);
59
61
63typedef
65VOID
67 IDXGISwapChain *pSwapChain,
68 UINT SyncInterval,
69 UINT Flags,
70 PHYDRAHOOK_EVT_POST_EXTENSION Extension
71);
72
74
76typedef
77_Function_class_(EVT_HYDRAHOOK_D3D11_RESIZE_TARGET)
78VOID
80 IDXGISwapChain *pSwapChain,
81 const DXGI_MODE_DESC *pNewTargetParameters,
82 PHYDRAHOOK_EVT_PRE_EXTENSION Extension
83);
84
86
88typedef
90VOID
92 IDXGISwapChain *pSwapChain,
93 const DXGI_MODE_DESC *pNewTargetParameters,
94 PHYDRAHOOK_EVT_POST_EXTENSION Extension
95);
96
98
100typedef
102VOID
104 IDXGISwapChain *pSwapChain,
105 UINT BufferCount,
106 UINT Width,
107 UINT Height,
108 DXGI_FORMAT NewFormat,
109 UINT SwapChainFlags,
110 PHYDRAHOOK_EVT_PRE_EXTENSION Extension
111);
112
114
116typedef
118VOID
120 IDXGISwapChain *pSwapChain,
121 UINT BufferCount,
122 UINT Width,
123 UINT Height,
124 DXGI_FORMAT NewFormat,
125 UINT SwapChainFlags,
126 PHYDRAHOOK_EVT_POST_EXTENSION Extension
127);
128
130
137HRESULT
138FORCEINLINE
140 IDXGISwapChain *pSwapChain,
141 ID3D11Device **ppDevice
142)
143{
144 return pSwapChain->GetDevice(__uuidof(ID3D11Device), (PVOID*)ppDevice);
145}
146
154HRESULT
155FORCEINLINE
157 IDXGISwapChain *pSwapChain,
158 ID3D11Device **ppDevice,
159 ID3D11DeviceContext **ppContext
160)
161{
162 HRESULT ret = pSwapChain->GetDevice(__uuidof(ID3D11Device), (PVOID*)ppDevice);
163
164 if (SUCCEEDED(ret))
165 (*ppDevice)->GetImmediateContext(ppContext);
166
167 return ret;
168}
169
177HRESULT
178FORCEINLINE
180 IDXGISwapChain *pSwapChain,
181 ID3D11Texture2D **ppBackBuffer,
182 UINT uBuffer = 0
183)
184{
185 return pSwapChain->GetBuffer(uBuffer, __uuidof(ID3D11Texture2D), (PVOID*)ppBackBuffer);
186}
187
203
210)
211{
212 ZeroMemory(Callbacks, sizeof(HYDRAHOOK_D3D11_EVENT_CALLBACKS));
213}
214
215#endif
216
217#endif // HydraHookDirect3D11_h__
IDXGISwapChain vtable indices for D3D10/11/12 hooking.
Core engine API for HydraHook - Direct3D and Core Audio hooking library.
struct _HYDRAHOOK_D3D11_EVENT_CALLBACKS * PHYDRAHOOK_D3D11_EVENT_CALLBACKS
EVT_HYDRAHOOK_D3D11_PRE_PRESENT * PFN_HYDRAHOOK_D3D11_PRE_PRESENT
VOID EVT_HYDRAHOOK_D3D11_POST_RESIZE_TARGET(IDXGISwapChain *pSwapChain, const DXGI_MODE_DESC *pNewTargetParameters, PHYDRAHOOK_EVT_POST_EXTENSION Extension)
Post-ResizeTarget callback.
HRESULT D3D11_BACKBUFFER_FROM_SWAPCHAIN(IDXGISwapChain *pSwapChain, ID3D11Texture2D **ppBackBuffer, UINT uBuffer=0)
Retrieves back buffer texture from swap chain.
VOID EVT_HYDRAHOOK_D3D11_PRE_RESIZE_BUFFERS(IDXGISwapChain *pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags, PHYDRAHOOK_EVT_PRE_EXTENSION Extension)
Pre-ResizeBuffers callback.
EVT_HYDRAHOOK_D3D11_POST_PRESENT * PFN_HYDRAHOOK_D3D11_POST_PRESENT
EVT_HYDRAHOOK_D3D11_POST_RESIZE_TARGET * PFN_HYDRAHOOK_D3D11_POST_RESIZE_TARGET
EVT_HYDRAHOOK_D3D11_PRE_RESIZE_TARGET * PFN_HYDRAHOOK_D3D11_PRE_RESIZE_TARGET
VOID EVT_HYDRAHOOK_D3D11_PRE_RESIZE_TARGET(IDXGISwapChain *pSwapChain, const DXGI_MODE_DESC *pNewTargetParameters, PHYDRAHOOK_EVT_PRE_EXTENSION Extension)
Pre-ResizeTarget callback.
VOID EVT_HYDRAHOOK_D3D11_PRE_PRESENT(IDXGISwapChain *pSwapChain, UINT SyncInterval, UINT Flags, PHYDRAHOOK_EVT_PRE_EXTENSION Extension)
Pre-Present callback; receives extension with engine handle.
VOID HYDRAHOOK_D3D11_EVENT_CALLBACKS_INIT(_Out_ PHYDRAHOOK_D3D11_EVENT_CALLBACKS Callbacks)
Initializes Direct3D 11 callback collection (zeros all pointers).
VOID EVT_HYDRAHOOK_D3D11_POST_RESIZE_BUFFERS(IDXGISwapChain *pSwapChain, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags, PHYDRAHOOK_EVT_POST_EXTENSION Extension)
Post-ResizeBuffers callback.
EVT_HYDRAHOOK_D3D11_PRE_RESIZE_BUFFERS * PFN_HYDRAHOOK_D3D11_PRE_RESIZE_BUFFERS
EVT_HYDRAHOOK_D3D11_POST_RESIZE_BUFFERS * PFN_HYDRAHOOK_D3D11_POST_RESIZE_BUFFERS
VOID EVT_HYDRAHOOK_D3D11_POST_PRESENT(IDXGISwapChain *pSwapChain, UINT SyncInterval, UINT Flags, PHYDRAHOOK_EVT_POST_EXTENSION Extension)
Post-Present callback; receives extension with engine handle.
HRESULT D3D11_DEVICE_IMMEDIATE_CONTEXT_FROM_SWAPCHAIN(IDXGISwapChain *pSwapChain, ID3D11Device **ppDevice, ID3D11DeviceContext **ppContext)
Retrieves ID3D11Device and ID3D11DeviceContext from swap chain.
HRESULT D3D11_DEVICE_FROM_SWAPCHAIN(IDXGISwapChain *pSwapChain, ID3D11Device **ppDevice)
Retrieves ID3D11Device from IDXGISwapChain.
Direct3D 11 event callback collection.
PFN_HYDRAHOOK_D3D11_PRE_RESIZE_BUFFERS EvtHydraHookD3D11PreResizeBuffers
PFN_HYDRAHOOK_D3D11_PRE_PRESENT EvtHydraHookD3D11PrePresent
PFN_HYDRAHOOK_D3D11_PRE_RESIZE_TARGET EvtHydraHookD3D11PreResizeTarget
PFN_HYDRAHOOK_D3D11_POST_PRESENT EvtHydraHookD3D11PostPresent
PFN_HYDRAHOOK_D3D11_POST_RESIZE_TARGET EvtHydraHookD3D11PostResizeTarget
PFN_HYDRAHOOK_D3D11_POST_RESIZE_BUFFERS EvtHydraHookD3D11PostResizeBuffers