19,468
社区成员
发帖
与我相关
我的任务
分享
// Detour function that replaces the D3D11CreateDeviceAndSwapChain() API
DllExport HRESULT __stdcall
hook_D3D11CreateDeviceAndSwapChain(
IDXGIAdapter *pAdapter,
D3D_DRIVER_TYPE DriverType,
HMODULE Software,
UINT Flags,
const D3D_FEATURE_LEVEL *pFeatureLevels,
UINT FeatureLevels,
UINT SDKVersion,
const DXGI_SWAP_CHAIN_DESC *pSwapChainDesc,
IDXGISwapChain **ppSwapChain,
ID3D11Device **ppDevice,
D3D_FEATURE_LEVEL *pFeatureLevel,
ID3D11DeviceContext **ppImmediateContext
)
{
Flags |= D3D11_CREATE_DEVICE_DEBUG;
HRESULT hr = pD3D11CreateDeviceAndSwapChain(pAdapter, DriverType, Software, Flags,
pFeatureLevels, FeatureLevels, SDKVersion, pSwapChainDesc,
ppSwapChain, ppDevice, pFeatureLevel, ppImmediateContext);
// added by houqd pAdapter
if(FAILED(hr)){
ga_error("pD3D11CreateDeviceAndSwapChain execute failed.\n");
return hr;
}
if(SUCCEEDED(hr)){
ga_error("pD3D11CreateDeviceAndSwapChain execute success. \n");
}
if (pDXGISwapChainPresent == NULL && pAdapter != NULL && ppSwapChain != NULL && ppDevice != NULL) {
//OutputDebugString("[D3D11CreateDeviceAndSwapChain]");
ga_error("I will jump into proc_hook_IDXGISwapChain_Present() function. \n");
proc_hook_IDXGISwapChain_Present(*ppSwapChain);
}
ga_error("pAdapter = %p and ppSwapChain = %p and ppDevice = %p.\n", pAdapter , ppSwapChain , ppDevice);
return hr;
}