Target Program crashes on Inject (during debug) and Unload

Sep 27, 2012 at 4:52 PM
Edited Sep 27, 2012 at 4:55 PM

I seem to have a strange issue.

At home I have a Win7 64bit OS and can perfectly load and debug my app which uses EasyHook on a 32-bit target executable ("putty.exe") using Visual Studio 2010 (running under Administator).


However on another machine I have Win7 32bit OS VS2010 and whenever I try to Debug the injector, the call to "NativeAPI.RhInjectLibraryEx" seems to throw an exception and crash my target 32-bit application (putty.exe) [running under administator].

  • InTargetPID = 9204
  • InWakeUpTID = 0
  • InNativeOptions = 536870912
  • AssemblyLocation = C:\Users\user1\Documents\Visual Studio 2010\Projects\Injector\bin\Debug\EasyHook.dll
  • AssemblyLocation = C:\Users\user1\Documents\Visual Studio 2010\Projects\Injector\bin\Debug\EasyHook.dll
  • PassThru.Size= 358

After that call executes putty.exe then crashes with the following:

Unhandled exception at 0x75155e25 in putty.exe: 0xC0000005: Access violation reading location 0x75155e25.

The RemoteHook.cs then continues with an STATUS_INTERNAL_ERROR


Oddly enough, if I don't debug my application and just right click the Run as Administrator on the Injector application, this crash does not happen when I inject the DLL (everything works fine) except when I close putty.exe while the injector application is still running; that causes putty.exe to crash with the following:

Unhandled exception at 0x59215f3b (EasyHook32.dll) in putty.exe: 0xC0000005: Access violation reading location 0x766d47df. (when catching with debugger, it seems to be caused where EasyHook.dll is trying to restore the original API call)


If I perform the opposite, close the injector then close putty.exe then putty does not crash.

Any ideas on what I'm doing wrong and why I can't debug on that machine?


Also, I want to say this is a great product! I am amazed at how easy this is to do within .NET