justinstenning / Direct3DHook

DirectX Capture and Overlays by using Direct3D API hooks
http://spazzarama.com/2011/03/14/c-screen-capture-and-overlays-for-direct3d-9-10-and-11-using-api-hooks
MIT License
584 stars 176 forks source link

Test Screenshot crashes with Overwatch #56

Closed dogdogdog-1 closed 7 years ago

dogdogdog-1 commented 7 years ago

When trying to inject into Overwatch Test Screenshot produces the following exception and fails, but when injecting into CS:GO it works completely fine.

Capture.InjectionFailedException occurred
  HResult=0x80131500
  Message=Injection to the target process failed. See InnerException for more detail.
  Source=Capture
  StackTrace:
   at Capture.CaptureProcess..ctor(Process process, CaptureConfig config, CaptureInterface captureInterface) in C:\Users\Che\Documents\Visual Studio 2017\Projects\Direct3DHook-master\Capture\CaptureProcess.cs:line 79
   at TestScreenshot.Form1.AttachProcess() in C:\Users\Che\Documents\Visual Studio 2017\Projects\Direct3DHook-master\TestScreenshot\Form1.cs:line 131
   at TestScreenshot.Form1.btnInject_Click(Object sender, EventArgs e) in C:\Users\Che\Documents\Visual Studio 2017\Projects\Direct3DHook-master\TestScreenshot\Form1.cs:line 52
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at TestScreenshot.Program.Main() in C:\Users\Che\Documents\Visual Studio 2017\Projects\Direct3DHook-master\TestScreenshot\Program.cs:line 18

Inner Exception 1:
ApplicationException: STATUS_INTERNAL_ERROR: Unknown error in injected assembler code. (Code: 6553600)
Shawak commented 7 years ago

Getting the same error on serveral applications (Overwatch, Discord, CurseClient).

justinstenning commented 7 years ago

Some games require different approaches to injection, one such approach is to use SetWindowsHookEx to load your DLL, then use EasyHook LocalHook.