pub fn apply_hook(render_loop: Box<dyn RenderLoop>) -> Result<IDXGISwapChainPresent> {
  trace!("Starting hook");
  let present_original = get_present_address()?;
  let mut present_trampoline: MaybeUninit<IDXGISwapChainPresent> = MaybeUninit::uninit();
  trace!("Initializing MH");
  let mut status: mh::MH_STATUS = unsafe { mh::MH_Initialize() };
  trace!("MH_Initialize status: {:?}", status);
  status = unsafe {
    mh::MH_CreateHook(
      present_original as LPVOID,
      present_impl as LPVOID,
      &mut present_trampoline as *mut _ as _,
    )
  };
  let present_trampoline = unsafe { present_trampoline.assume_init() };
  unsafe {
    DXGI_HOOK_STATE.replace(DxgiHookState::Hooked(present_trampoline, render_loop));
  }
  trace!("MH_CreateHook status: {:?}", status);
  status = unsafe { mh::MH_EnableHook(present_original as LPVOID) };
  trace!("MH_EnableHook status: {:?}", status);

  Ok(present_trampoline)
}
/// Inner entry point for the library.
///
/// Should not be invoked directly, but via the `hook!` macro which will
/// also provide the `WinMain` entry point.
///
/// This function finds the `IDXGISwapChain::Present` function address,
/// creates and enables the hook via `MinHook`. Returns the callback to the
/// trampoline function, if successful.
Inner entry point for the library.
Should not be invoked directly, but via the `hook!` macro which will
also provide the `WinMain` entry point.

This function finds the `IDXGISwapChain::Present` function address,
creates and enables the hook via `MinHook`. Returns the callback to the
trampoline function, if successful.
Inner entry point for the library . Should not be invoked directly but via the ` hook! ` macro which will also provide the ` WinMain ` entry point . This function finds the ` IDXGISwapChain :: Present ` function address creates and enables the hook via ` MinHook ` . Returns the callback to the trampoline function if successful .
pub fn apply_hook(render_loop: Box<dyn RenderLoop>) -> Result<IDXGISwapChainPresent> {
  trace!("Starting hook");
  let present_original = get_present_address()?;
  let mut present_trampoline: MaybeUninit<IDXGISwapChainPresent> = MaybeUninit::uninit();
  trace!("Initializing MH");
  let mut status: mh::MH_STATUS = unsafe { mh::MH_Initialize() };
  trace!("MH_Initialize status: {:?}", status);
  status = unsafe {
    mh::MH_CreateHook(
      present_original as LPVOID,
      present_impl as LPVOID,
      &mut present_trampoline as *mut _ as _,
    )
  };
  let present_trampoline = unsafe { present_trampoline.assume_init() };
  unsafe {
    DXGI_HOOK_STATE.replace(DxgiHookState::Hooked(present_trampoline, render_loop));
  }
  trace!("MH_CreateHook status: {:?}", status);
  status = unsafe { mh::MH_EnableHook(present_original as LPVOID) };
  trace!("MH_EnableHook status: {:?}", status);
  Ok(present_trampoline)
}
pub fn apply_hook ( render_loop : Box < dyn RenderLoop > ) -> Result < IDXGISwapChainPresent > { trace ! ( " " ) ; let present_original = get_present_address ( ) ? ; let mut present_trampoline : MaybeUninit < IDXGISwapChainPresent > = MaybeUninit :: uninit ( ) ; trace ! ( " " ) ; let mut status : mh :: MH_STATUS = unsafe { mh :: MH_Initialize ( ) } ; trace ! ( " " status ) ; status = unsafe { mh :: MH_CreateHook ( present_original as LPVOID , present_impl as LPVOID , & mut present_trampoline as * mut _ as _ , ) } ; let present_trampoline = unsafe { present_trampoline . assume_init ( ) } ; unsafe { DXGI_HOOK_STATE . replace ( DxgiHookState :: Hooked ( present_trampoline , render_loop ) ) ; } trace ! ( " " status ) ; status = unsafe { mh :: MH_EnableHook ( present_original as LPVOID ) } ; trace ! ( " " status ) ; Ok ( present_trampoline ) }
Inner entry point for the library.
Inner entry point for the library .
render_loop
Box<dyn RenderLoop>