0

I'm using EasyHook to inject a DLL into a process (Duh!) However, when the Inject function is called, I get this error message:

"The given user library does not export a proper Run(EasyHook.InjectionLoader+REMOTE_ENTRY_INFO) method in the 'EasyHook.IEntryPoint' interface."

And I'm sure it does.

Here's the DLL code:

using System;
using EasyHook;
using System.Windows.Forms;

namespace EasyHookDLL
{
    public class Main : IEntryPoint
    {
        public Main(RemoteHooking.IContext IContext, String InChannelName)
        {
            MessageBox.Show("Constructor called");
        }

        public void Run(RemoteHooking.IContext IContext, String InChannelName)
        {
            MessageBox.Show("Run method called");
        }
    }
}

And here's my Injector:

using System;
using EasyHook;
using System.Diagnostics;
using System.Threading;

namespace EasyHookInjector
{
    class Program
    {
        static void Main(string[] args)
        {
            System.EnterpriseServices.Internal.Publish publish = new System.EnterpriseServices.Internal.Publish();
            publish.GacInstall("EasyHook.dll");
            publish.GacInstall("EasyHook32.dll");
            publish.GacInstall("EasyHook64.dll");
            publish.GacInstall("EasyLoad32.dll");
            publish.GacInstall("EasyLoad64.dll");

            Console.WriteLine("Waiting for process to start...");
            Process[] processes;
            while ((processes = Process.GetProcessesByName("Process name")).Length == 0)
            {
                Thread.Sleep(500);
            }

            Console.WriteLine("Injecting...");

            RemoteHooking.Inject(processes[0].Id, 
                @"dll path.dll", 
                @"dll path.dll", 
                null);
        }
    }
}

I have also tried adding all EasyHook files into the debug folder, but that didn't help.

  • I know for sure some of those DLL files you have listed in `GacInstall` are native libraries (I think `EasyHook32.dll` and `EasyHook64.dll`). I have never used EnterpriseServices but normally the GAC is associated with managed libraries, not native ones. – Scott Chamberlain Aug 31 '15 at 17:57
  • Okay then, I just saw that code in a tutorial on EasyHook somewhere and thought I had to add that for it to work. It still doesn't work when I remove it though. – Ralph Jaeger Aug 31 '15 at 18:19
  • What version of EasyHook? Later versions do not require GAC installation, and rely on another intermediate DLL "EasyLoad32/64" – Justin Stenning Dec 05 '15 at 08:32

0 Answers0