예제 #1
0
 void BossKey_KeyPressed(object sender, KeyPressedEventArgs e)
 {
     if (Blinder == null)
     {
         Blinder = new FileNameHooker();
     }
     Blinder.SetHookState(!Blinder.IsHooking);
 }
예제 #2
0
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>   Fake name. It cannot be obfuscated due to WCF protocol. </summary>
 ///
 /// <param name="request">  true if enable request. </param>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 public void ToggleHook(bool request)
 {
     if (Blinder == null)
     {
         Blinder = new FileNameHooker();
     }
     Blinder.SetHookState(request);
 }
예제 #3
0
        public void Run(RemoteHooking.IContext context)
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.AssemblyResolve += (sender, args) =>
            {
                return(this.GetType().Assembly.FullName == args.Name ? this.GetType().Assembly : null);
            };

            HookingThreadIds.Add((int)GetCurrentThreadId());

            try
            {
                try
                {
                    // opengl32.dll loaded lazily. wait it.
                    while (Process.GetCurrentProcess().MainWindowHandle == IntPtr.Zero)
                    {
                        Thread.Sleep(100);
                    }

                    // d3d9.dll load always. so tests with opengl32.dll.
                    if (GetModuleHandle("opengl32.dll") == IntPtr.Zero)
                    {
                        var hooker = new D3D9Hooker();

                        // If hook failed, pass to window notifier by exception.
                        hooker.SetHookState(true);

                        // Accepts D3 hook if test passes.
                        Overlayer = hooker;
                    }
                    else
                    {
                        throw new ApplicationException("DirectX9 hook seems unavailable.");
                    }
                }
                catch
                {
                    Overlayer = new WPFOverlayer();
                }
                if (Overlayer != null)
                {
                    InvokeUrlHooker.Overlayer = Overlayer;
                    Overlayer.AddMessage(new object(), new NoticeEntry()
                    {
                        Begin    = DateTime.Now,
                        Duration = TimeSpan.FromSeconds(5),
                        Message  = "비트맵 다운로더가 동작합니다."
                    });
                }

                Downloader = new InvokeUrlHooker();
                Downloader.SetHookState(true);

                RegisterBossKey();

                Foregrounder = new WinEventHooker();
                Foregrounder.OnForegroundChanged += Foregrounder_OnForegroundChanged;
            }
            catch (Exception extInfo)
            {
                MainWindowViewModel.LogException(extInfo);
            }

            RemoteHooking.WakeUpProcess();

            // wait for host process termination...
            try
            {
                new Application().Run();
            }
            catch (Exception e)
            {
                MainWindowViewModel.LogException(e);
            }
            finally
            {
                if (Downloader != null)
                {
                    Downloader.Dispose();
                    Downloader = null;
                }
                if (Blinder != null)
                {
                    Blinder.Dispose();
                    Blinder = null;
                }
                InjecteeHost.Abort();
                InjecteeHost = null;
            }
        }