Ejemplo n.º 1
0
void UndetourD3D9(bool remove)
{
  auto& module = GetD3D9Module();
  auto& helper = GetHelperInterface();
  if (helper.CommonUndetourModule(L"D3D9", module))
  {
    UndetourFunc(
      L"IDirect3DDevice9::AddRef", GetIDirect3DDevice9AddRefDetour(), remove);
    UndetourFunc(
      L"IDirect3DDevice9::Release", GetIDirect3DDevice9ReleaseDetour(), remove);
    UndetourFunc(
      L"IDirect3DDevice9::Present", GetIDirect3DDevice9PresentDetour(), remove);
    UndetourFunc(
      L"IDirect3DDevice9::Reset", GetIDirect3DDevice9ResetDetour(), remove);
    UndetourFunc(L"IDirect3DDevice9::EndScene",
                 GetIDirect3DDevice9EndSceneDetour(),
                 remove);
    UndetourFunc(L"IDirect3DDevice9Ex::PresentEx",
                 GetIDirect3DDevice9ExPresentExDetour(),
                 remove);
    UndetourFunc(L"IDirect3DDevice9Ex::ResetEx",
                 GetIDirect3DDevice9ExResetExDetour(),
                 remove);
    UndetourFunc(L"IDirect3DSwapChain9::Present",
                 GetIDirect3DSwapChain9PresentDetour(),
                 remove);

    module = std::make_pair(nullptr, 0);
  }
}
Ejemplo n.º 2
0
void UndetourUser32ForRawInput(bool remove)
{
  auto& module = GetUser32Module();
  auto& helper = GetHelperInterface();
  if (helper.CommonUndetourModule(L"user32", module))
  {
    UndetourFunc(L"GetRawInputBuffer", GetGetRawInputBufferDetour(), remove);
    UndetourFunc(L"GetRawInputData", GetGetRawInputDataDetour(), remove);
    UndetourFunc(
      L"RegisterRawInputDevices", GetRegisterRawInputDevicesDetour(), remove);

    module = std::make_pair(nullptr, 0);
  }
}
Ejemplo n.º 3
0
void UndetourD3D101(bool remove)
{
  auto& module = GetD3D10Module();
  auto& helper = GetHelperInterface();
  if (helper.CommonUndetourModule(L"D3D10_1", module))
  {
    UndetourFunc(L"D3D10CreateDeviceAndSwapChain1",
                 GetD3D10CreateDeviceAndSwapChain1Detour(),
                 remove);
    UndetourFunc(L"D3D10CreateDevice1", GetD3D10CreateDevice1Detour(), remove);

    module = std::make_pair(nullptr, 0);
  }
}
Ejemplo n.º 4
0
void UndetourNtdllForModule(bool remove)
{
  auto& module = GetNtdllModule();
  auto& helper = GetHelperInterface();
  if (helper.CommonUndetourModule(L"ntdll", module))
  {
    UndetourFunc(L"NtMapViewOfSection", GetNtMapViewOfSectionDetour(), remove);
    UndetourFunc(
      L"NtUnmapViewOfSection", GetNtUnmapViewOfSectionDetour(), remove);
    UndetourFunc(L"LdrLoadDll", GetLdrLoadDllDetour(), remove);
    UndetourFunc(L"LdrUnloadDll", GetLdrUnloadDllDetour(), remove);

    module = std::make_pair(nullptr, 0);
  }
}
Ejemplo n.º 5
0
void UndetourDXGI(bool remove)
{
  auto& module = GetDXGIModule();
  auto& helper = GetHelperInterface();
  if (helper.CommonUndetourModule(L"DXGI", module))
  {
    UndetourFunc(
      L"IDXGISwapChain::Present", GetIDXGISwapChainPresentDetour(), remove);
    UndetourFunc(L"IDXGISwapChain::ResizeBuffers",
                 GetIDXGISwapChainResizeBuffersDetour(),
                 remove);
    UndetourFunc(
      L"IDXGISwapChain::Present1", GetIDXGISwapChain1Present1Detour(), remove);

    module = std::make_pair(nullptr, 0);
  }
}
Ejemplo n.º 6
0
void UndetourOpenGL32(bool remove)
{
  auto& module = GetOpenGL32Module();
  auto& helper = GetHelperInterface();
  if (helper.CommonUndetourModule(L"OpenGL32", module))
  {
    UndetourFunc(L"wglSwapBuffers", GetWglSwapBuffersDetour(), remove);

    module = std::make_pair(nullptr, 0);
  }
}
Ejemplo n.º 7
0
void UndetourUser32ForWindow(bool remove)
{
  auto& module = GetUser32Module();
  auto& helper = GetHelperInterface();
  if (helper.CommonUndetourModule(L"user32", module))
  {
    UndetourFunc(
      L"GetForegroundWindow", GetGetForegroundWindowDetour(), remove);

    module = std::make_pair(nullptr, 0);
  }
}
Ejemplo n.º 8
0
void UndetourKernelBaseForException(bool remove)
{
  auto& module = GetKernelBaseModule();
  auto& helper = GetHelperInterface();
  if (helper.CommonUndetourModule(L"kernelbase", module))
  {
    UndetourFunc(L"SetUnhandledExceptionFilter",
                 GetSetUnhandledExceptionFilterDetour(),
                 remove);

    module = std::make_pair(nullptr, 0);
  }
}
Ejemplo n.º 9
0
void UndetourNtdllForException(bool remove)
{
  auto& module = GetNtdllModule();
  auto& helper = GetHelperInterface();
  if (helper.CommonUndetourModule(L"ntdll", module))
  {
    UndetourFunc(L"RtlAddVectoredExceptionHandler",
                 GetRtlAddVectoredExceptionHandlerDetour(),
                 remove);

    module = std::make_pair(nullptr, 0);
  }
}
Ejemplo n.º 10
0
void UndetourNtUnmapViewOfSection()
{
  UndetourFunc(L"NtUnmapViewOfSection", GetNtUnmapViewOfSectionDetour(), true);
}