Пример #1
0
 public Main(
     RemoteHooking.IContext context,
     string channelName
     , HookParameter parameter
     )
 {
     _server        = RemoteHooking.IpcConnectClient <HookServer>(channelName);
     _instance      = this;
     _server.isHook = false;
 }
Пример #2
0
        public void Run(
            RemoteHooking.IContext context,
            string channelName
            , HookParameter parameter
            )
        {
            try
            {
                var process = Process.GetCurrentProcess();
                var modules = process.Modules;
                foreach (ProcessModule item in modules)
                {
                    if (LocalHook.GetProcAddress(item.ModuleName, "luaL_newstate") != IntPtr.Zero)
                    {
                        HookLuaFun(item.ModuleName, string funName)
                        break;
                    }
                }

                MessageBoxWHook = LocalHook.Create(
                    LocalHook.GetProcAddress("user32.dll", "MessageBoxW"),
                    new DMessageBoxW(MessageBoxW_Hooked),
                    null);
                MessageBoxWHook.ThreadACL.SetExclusiveACL(new int[1]);

                MessageBoxAHook = LocalHook.Create(
                    LocalHook.GetProcAddress("user32.dll", "MessageBoxA"),
                    new DMessageBoxW(MessageBoxA_Hooked),
                    null);
                MessageBoxAHook.ThreadACL.SetExclusiveACL(new int[1]);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            _server.isHook = true;
            try
            {
                while (_server.isHook)
                {
                    Thread.Sleep(10);
                }
            }
            catch
            {
            }
            Uninstall();
        }
Пример #3
0
        public void Run(
            RemoteHooking.IContext context,
            string channelName
            , HookParameter parameter
            )
        {
            try
            {
                MessageBox.Show(parameter.Msg);
                MessageBoxWHook = LocalHook.Create(
                    LocalHook.GetProcAddress("user32.dll", "MessageBoxW"),
                    new DMessageBoxW(MessageBoxW_Hooked),
                    this);
                MessageBoxWHook.ThreadACL.SetExclusiveACL(new int[1]);

                MessageBoxAHook = LocalHook.Create(
                    LocalHook.GetProcAddress("user32.dll", "MessageBoxA"),
                    new DMessageBoxW(MessageBoxA_Hooked),
                    this);
                MessageBoxAHook.ThreadACL.SetExclusiveACL(new int[1]);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            _server.isHook = true;
            try
            {
                while (_server.isHook)
                {
                    Thread.Sleep(10);
                }
            }
            catch
            {
            }
            Uninstall();
        }