MCPcopy Create free account
hub / github.com/aliasIsolation/aliasIsolation / hookRendering

Function hookRendering

src/dll/rendering.cpp:363–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361// ----------------------------------------------------------------------------------------------------------------
362
363void hookRendering()
364{
365 ZoneScopedN(__FUNCTION__);
366
367 int minhookRet;
368
369 HMODULE hModule = GetModuleHandleA("d3d11");
370 if (hModule)
371 {
372 g_d3dHooks.D3D11CreateDeviceAndSwapChain = (LPVOID)GetProcAddress(hModule, "D3D11CreateDeviceAndSwapChain");
373 if (g_d3dHooks.D3D11CreateDeviceAndSwapChain)
374 {
375 minhookRet = MH_CreateHook(g_d3dHooks.D3D11CreateDeviceAndSwapChain, &D3D11CreateDeviceAndSwapChain_hook,
376 (LPVOID *)&D3D11CreateDeviceAndSwapChain_orig);
377 }
378 else
379 {
380 minhookRet = MH_ERROR_FUNCTION_NOT_FOUND;
381 }
382 }
383 else
384 {
385 // ret = MH_ERROR_MODULE_NOT_FOUND;
386 LOG_MSG("[aliasIsolation::rendering] GetModuleHandleA(\"d3d11\") failed: MH_ERROR_MODULE_NOT_FOUND\n", "");
387 return;
388 }
389
390 if (minhookRet != MH_OK)
391 {
392 char buf[256];
393 sprintf_s(buf, "MH_CreateHookApi() failed: %d\n", minhookRet);
394 MessageBoxA(NULL, buf, NULL, NULL);
395 return;
396 }
397
398 MH_CHECK(MH_EnableHook(g_d3dHooks.D3D11CreateDeviceAndSwapChain));
399 LOG_MSG("[aliasIsolation::rendering] MH_EnableHook(g_d3dHooks.D3d11CreateDeviceAndSwapChain)\n", "");
400
401 ShaderRegistry::startCompilerThread();
402 LOG_MSG("[aliasIsolation::rendering] ShaderRegistry::startCompilerThread()\n", "");
403}
404
405void unhookRendering()
406{

Callers 1

DllMainFunction · 0.85

Calls 1

startCompilerThreadFunction · 0.85

Tested by

no test coverage detected