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
580 stars 178 forks source link

Injection to the target process failed. Unable to load DLL 'EasyHook32.dll' #31

Closed NitroXenon closed 8 years ago

NitroXenon commented 8 years ago

I cloned the project and compiled it. However when I entered the process name and click Inject, TestScreenshot.exe crashed. Here is the exception message:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
Capture.InjectionFailedException: Injection to the target process failed. See InnerException for more detail. ---> System.DllNotFoundException: Unable to load DLL 'EasyHook32.dll': The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)
   at EasyHook.NativeAPI_x86.RhInjectLibrary(Int32 InTargetPID, Int32 InWakeUpTID, Int32 InInjectionOptions, String InLibraryPath_x86, String InLibraryPath_x64, IntPtr InPassThruBuffer, Int32 InPassThruSize)
   at EasyHook.NativeAPI.RhInjectLibraryEx(Int32 InTargetPID, Int32 InWakeUpTID, Int32 InInjectionOptions, String InLibraryPath_x86, String InLibraryPath_x64, IntPtr InPassThruBuffer, Int32 InPassThruSize)
   at EasyHook.RemoteHooking.InjectEx(Int32 InHostPID, Int32 InTargetPID, Int32 InWakeUpTID, Int32 InNativeOptions, String InLibraryPath_x86, String InLibraryPath_x64, Boolean InCanBypassWOW64, Boolean InCanCreateService, Boolean InRequireStrongName, Object[] InPassThruArgs)
   at EasyHook.RemoteHooking.Inject(Int32 InTargetPID, InjectionOptions InOptions, String InLibraryPath_x86, String InLibraryPath_x64, Object[] InPassThruArgs)
   at Capture.CaptureProcess..ctor(Process process, CaptureConfig config, CaptureInterface captureInterface) in c:\Download\Direct3DHook-master\Direct3DHook-master\Capture\CaptureProcess.cs:line 67
   --- End of inner exception stack trace ---
   at Capture.CaptureProcess..ctor(Process process, CaptureConfig config, CaptureInterface captureInterface) in c:\Download\Direct3DHook-master\Direct3DHook-master\Capture\CaptureProcess.cs:line 79
   at TestScreenshot.Form1.AttachProcess() in c:\Download\Direct3DHook-master\Direct3DHook-master\TestScreenshot\Form1.cs:line 131
   at TestScreenshot.Form1.btnInject_Click(Object sender, EventArgs e) in c:\Download\Direct3DHook-master\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.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.2034 (RTMLDR.030319-2000)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
TestScreenshot
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Download/Direct3DHook-master/Direct3DHook-master/bin/TestScreenshot.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.2003 built by: RTMLDR
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.2001 built by: RTMLDR
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.2001 built by: RTMLDR
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
Capture
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Download/Direct3DHook-master/Direct3DHook-master/bin/Capture.DLL
----------------------------------------
EasyHook
    Assembly Version: 2.7.5726.0
    Win32 Version: 2.7.5726.0
    CodeBase: file:///C:/Download/Direct3DHook-master/Direct3DHook-master/bin/EasyHook.DLL
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

I am sure that the directory of TestScreenshot.exe has the dll "EasyHook32.dll". So why would this happened?

SammyROCK commented 8 years ago

I have this exact same issue when compiling EasyHook, did you manage to find out what was wrong?