Esempio n. 1
0
        public EntryPoint(
            RemoteHooking.IContext context,
            string channelName,
            OverlayConfig config)
        {
            // Get reference to IPC to host application
            // Note: any methods called or events triggered against _interface will execute in the host process.
            _interface = RemoteHooking.IpcConnectClient <OverlayInterface>(channelName);

            // We try to ping immediately, if it fails then injection fails
            _interface.Ping();

            #region Allow client event handlers (bi-directional IPC)

            // Attempt to create a IpcServerChannel so that any event handlers on the client will function correctly
            IDictionary properties = new Hashtable();
            properties["name"]     = channelName;
            properties["portName"] = channelName + Guid.NewGuid().ToString("N"); // random portName so no conflict with existing channels of channelName

            var binaryProv = new BinaryServerFormatterSinkProvider();
            binaryProv.TypeFilterLevel = TypeFilterLevel.Full;

            var clientServerChannel = new IpcServerChannel(properties, binaryProv);
            ChannelServices.RegisterChannel(clientServerChannel, false);

            #endregion
        }
Esempio n. 2
0
        /// <summary>
        /// Prepares capturing in the target process. Note that the process must not already be hooked, and must have a <see cref="Process.MainWindowHandle"/>.
        /// </summary>
        /// <param name="process">The process to inject into</param>
        /// <exception cref="ProcessHasNoWindowHandleException">Thrown if the <paramref name="process"/> does not have a window handle. This could mean that the process does not have a UI, or that the process has not yet finished starting.</exception>
        /// <exception cref="ProcessAlreadyHookedException">Thrown if the <paramref name="process"/> is already hooked</exception>
        /// <exception cref="InjectionFailedException">Thrown if the injection failed - see the InnerException for more details.</exception>
        /// <remarks>The target process will have its main window brought to the foreground after successful injection.</remarks>
        public OverlayProcess(Process process, OverlayConfig config, OverlayInterface overlayInterface)
        {
            // If the process doesn't have a mainwindowhandle yet, skip it (we need to be able to get the hwnd to set foreground etc)
            if (process.MainWindowHandle == IntPtr.Zero)
            {
                throw new ProcessHasNoWindowHandleException();
            }

            // Skip if the process is already hooked (and we want to hook multiple applications)
            if (HookManager.IsHooked(process.Id))
            {
                throw new ProcessAlreadyHookedException();
            }

            _serverInterface = overlayInterface;
            //_serverInterface = new OverlayInterface() { ProcessId = process.Id };

            // Initialise the IPC server (with our instance of _serverInterface)
            RemoteHooking.IpcCreateServer(
                ref _channelName,
                WellKnownObjectMode.Singleton,
                _serverInterface);

            try
            {
                var libPath = typeof(OverlayInterface).Assembly.Location;

                RemoteHooking.Inject(
                    process.Id,
                    InjectionOptions.Default,
                    libPath,
                    libPath,
                    _channelName,
                    config
                    );
            }
            catch (Exception e)
            {
                throw new InjectionFailedException(e);
            }

            HookManager.AddHookedProcess(process.Id);

            Process = process;

            // Ensure the target process is in the foreground,
            // this prevents an issue where the target app appears to be in
            // the foreground but does not receive any user inputs.
            // Note: the first Alt+Tab out of the target application after injection
            //       may still be an issue - switching between windowed and
            //       fullscreen fixes the issue however (see ScreenshotInjection.cs for another option)
            BringProcessWindowToFront();
        }
Esempio n. 3
0
        public DirectX11(OverlayInterface overlayInterface)
            : base(overlayInterface)
        {
            OverlayInterface = overlayInterface;

            OverlayInterface.DisplayText += OverlayInterfaceProxy.DisplayTextProxyHandler;
            OverlayInterfaceProxy.DisplayText += OverlayInterfaceProxy_DisplayText;

            OverlayInterface.AddOrUpdateOverylay += OverlayInterfaceProxy.AddOrUpdateOverlayProxyHandler;
            OverlayInterfaceProxy.AddOrUpdateOverylay += OverlayInterfaceProxy_AddOrUpdateOverylay;

            OverlayInterface.RemoveOverylay += OverlayInterfaceProxy.RemoveOverlayProxyHandler;
            OverlayInterfaceProxy.RemoveOverylay += OverlayInterfaceProxy_RemoveOverylay;
        }
Esempio n. 4
0
 public NodeTool(OverlayInterface overlay) : base(overlay) { }
Esempio n. 5
0
 public EllipseTool(OverlayInterface overlay)
     : base(overlay)
 {
     PreviewEllipse = overlay.ShapeFactory.GetPreviewEllipse();
 }
 public GridTool(OverlayInterface overlay)
     : base(overlay)
 {
     codeToInsert = " grid ";
     ForcePointsBLTR = true;
 }
 public EllipseTool(OverlayInterface overlay)
     : base(overlay)
 {
     PreviewEllipse = overlay.ShapeFactory.GetPreviewEllipse();
 }
Esempio n. 8
0
 public OverlayAdderTool(OverlayInterface overlay) : base(overlay)
 {
 }
Esempio n. 9
0
 public OverlayTool(OverlayInterface overlay)
 {
     this.overlay = overlay;
 }
Esempio n. 10
0
 public PathTool(OverlayInterface overlay) : base(overlay)
 {
 }
Esempio n. 11
0
 public ArcEditTool(OverlayInterface overlay)
     : base(overlay)
 {
     PreviewArc = overlay.ShapeFactory.GetPreviewFan();
 }
Esempio n. 12
0
 public Memory(Font font, OverlayInterface Interface) : base(font)
 {
     Init();
     this.Interface = Interface;
 }
Esempio n. 13
0
 public SelectionTool(OverlayInterface overlay) : base(overlay)
 {
     SelectionRect = overlay.ShapeFactory.GetSelectionRect();
 }
Esempio n. 14
0
 public OverlayAdderTool(OverlayInterface overlay) : base(overlay) { } 
Esempio n. 15
0
 public OverlayTool(OverlayInterface overlay)
 {
     this.overlay = overlay;
 }
Esempio n. 16
0
 public EdgeTool(OverlayInterface overlay) : base(overlay) { }
Esempio n. 17
0
 public SelectionTool(OverlayInterface overlay) : base(overlay)
 {
     SelectionRect = overlay.ShapeFactory.GetSelectionRect();
 }
Esempio n. 18
0
 public ArcEditTool(OverlayInterface overlay)
     : base(overlay)
 {
     PreviewArc = overlay.ShapeFactory.GetPreviewFan();
 }
Esempio n. 19
0
 public SmoothCurveTool(OverlayInterface overlay) : base(overlay) { }
Esempio n. 20
0
 public NodeTool(OverlayInterface overlay) : base(overlay)
 {
 }
Esempio n. 21
0
 public DxHookD3D9(OverlayInterface ssInterface)
     : base(ssInterface)
 {
 }
Esempio n. 22
0
 public EdgeTool(OverlayInterface overlay) : base(overlay)
 {
 }
Esempio n. 23
0
 public BezierTool(OverlayInterface overlay) : base(overlay)
 {
     Preview_CP1 = overlay.ShapeFactory.GetCPCircle();
     Preview_CP2 = overlay.ShapeFactory.GetCPCircle();
 }
Esempio n. 24
0
 public SmoothCurveTool(OverlayInterface overlay) : base(overlay)
 {
 }
Esempio n. 25
0
 protected BaseDxHook(OverlayInterface ssInterface)
 {
     Interface = ssInterface;
 }
 public RectangleTool(OverlayInterface overlay) : base(overlay)
 {
     PreviewRect = CreatePreviewShape();
 }
Esempio n. 27
0
 public GridTool(OverlayInterface overlay)
     : base(overlay)
 {
     codeToInsert    = " grid ";
     ForcePointsBLTR = true;
 }
Esempio n. 28
0
 public ArcTool(OverlayInterface overlay) : base(overlay)
 {
     PreviewArc = overlay.ShapeFactory.GetPreviewArc();
     PreviewPie = overlay.ShapeFactory.GetPreviewPie();
 }
Esempio n. 29
0
 public BezierTool(OverlayInterface overlay) : base(overlay)
 {
     Preview_CP1 = overlay.ShapeFactory.GetCPCircle();
     Preview_CP2 = overlay.ShapeFactory.GetCPCircle();
 }
Esempio n. 30
0
 public RectangleTool(OverlayInterface overlay) : base(overlay)
 {
     PreviewRect = CreatePreviewShape();
 }
Esempio n. 31
0
 public PathTool(OverlayInterface overlay) : base(overlay) { }
Esempio n. 32
0
 public ArcTool(OverlayInterface overlay) : base(overlay)
 {
     PreviewArc = overlay.ShapeFactory.GetPreviewArc();
     PreviewPie = overlay.ShapeFactory.GetPreviewPie();
 }
Esempio n. 33
0
 public DXBase(OverlayInterface overlayInterface)
 {
 }