Giter Site home page Giter Site logo

jasonpang / interceptor Goto Github PK

View Code? Open in Web Editor NEW
291.0 291.0 84.0 59 KB

C# wrapper for a Windows keyboard driver. Can simulate keystrokes and mouse clicks in protected areas like the Windows logon screen (and yes, even in games). Wrapping http://oblita.com/Interception

License: MIT License

C# 100.00%

interceptor's People

Contributors

jasonpang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

interceptor's Issues

When Mouse Filter is set to all, The physical mouse begins acting weird. Possibly because Interceptor thread does not terminate properly.

I have a problem where, when I set the mouse filter to All, the mouse begins to act up in really weird ways.

For example, even after I closed my program. It is as though the Interceptor is still intercepting the mouse inputs. When I try to click on a button, the click is not detected by windows, or a control that would be say highlighted if the mouse came over it, would not be highlighted if the mouse came over it.

The only way to bring the mouse back to normal is to completely restart the computer.

I did a little bit of digging and I suspect that one of the reasons why this problem might occur is because the thread become hostile and cannot terminate properly.

If you look at the Unload() method, these lines

            callbackThread.Abort(); // This line is not guaranteed to safely abort the thread
            MouseFilterMode = MouseFilterMode.None;
            KeyboardFilterMode = KeyboardFilterMode.None;

            InterceptionDriver.DestroyContext(context); // I also suspect this does not work as it should
            IsLoaded = false;

If anyone knows the problem Im talking about and how to solve it, please let me know.

Thanks

How to reference Input class?

Im a new developer in cpp, and im trying to use this project. How do i reference Input class from another project? There is no .h file!

Arrow key

How I send arrow key non by Numpad ?

Win 10 Compatability

Any chance this can get an update for win10 compatibility? The referenced library is win10 compat,

License?

I am using this wrapper and would like to credit whoever made it / include your license in my project - but I don't see what license it is. I would prefer a BSD or MIT license, which would be distributed with my binary and displayed in the about dialog.

My project: https://github.com/krisives/GRemote

Cheers & Thanks!

how can i use it in vb.net?

  • I compile the project and reference the dll
  • I add the creator dll to the executable directory
  • I install interception

When I try to run my code I get this error

BC30182: Type expected

on the line Dim input As Input = New Input()

Imports Interceptor
Dim input As Input = New Input()

Private Sub Entrar_Click(sender As Object, e As EventArgs) Handles Entrar.Click
        ' Be sure to set your keyboard filter to be able to capture key presses And simulate key presses
        ' KeyboardFilterMode.All captures all events; 'Down' only captures presses for non-special keys; 'Up' only captures releases for non-special keys; 'E0' and 'E1' capture presses/releases for special keys
        input.KeyboardFilterMode = input.KeyboardFilterMode.All
        ' You can set a MouseFilterMode as well, but you don't need to set a MouseFilterMode to simulate mouse clicks
        ' Finally, load the driver
        input.Load()
        input.MoveMouseTo(5, 5)
End Sub

any solution?
Thank you all

Does it work with x64 windows7

Does this work with 64 bit windows?
Until now I had a 32 bit windows 7, and I was using http://yorick.oblita.com/downloads to intercept keyboard inputs for a small C# app.
But after I switched to 64 bit , I am unable to install those drivers and my app does not work. Don't know why? ๐Ÿ˜“ Could you give me any insights on that?
would http://www.oblita.com/interception be a better choice or they are just the same thing?

Any help would be appreciated. ๐Ÿ™„

Unable to load DLL

I added the DLL like it was mentioned in the description and got the error at Line 64 in the Input.cs class: System.DllNotFoundException: 'Unable to load DLL 'interception.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)' .. Did anyone got the same issue and have a solution for me ?

How can I send arrow buttons?

I can't send any arrow buttons into somewhere? How can fix that issue?

_interceptionContext.SendKey(Keys.Down); await Task.Delay(100);

Can't send mouse message

Hi, anyone knows a guide or something like that on how to send mouse clicks with interceptor?
I'm able to send keypress to games pretty well, but when I set the mouse filter on and perform a real click in order to activate the interception, it starts left-clicking continously, completely ignoring the rest of the code. I think it starts doing like that when the code hit a SendKey() statement but I can't figure out why.
Every thought will be helpful since I'm pretty new to this type of "low-level/driver" input sending methods :)

How to solve mouse freeze / windows freeze / you can not click on any after playing around with interceptor?

If you tried to use input.MouseFilterMode = MouseFilterMode.All;
And everything worked but after that you could not use your mouse to click on anything?
The problem is caused by "Thread.Sleep".
If you are the one who use "await Task.Delay" instead to make a delay and never use the "Thread.Sleep", since the Thread.Sleep(x) will freeze your GUI for x millisecond, well, this is the solution for you.
Here is the things you can try:
Solution 1: Remove the Thread.Sleep in SendLeftClick() and SendRightClick() function - for those who didn't use the Thread.Sleep:

        public void SendLeftClick()
        {
            SendMouseEvent(MouseState.LeftDown);
            //Thread.Sleep(ClickDelay);
            SendMouseEvent(MouseState.LeftUp);
        }

        public void SendRightClick()
        {
            SendMouseEvent(MouseState.RightDown);
            //Thread.Sleep(ClickDelay);
            SendMouseEvent(MouseState.RightUp);
        }

Solution 2: Add "using System.Threading;" in your main code.

About does not function reliably and often moves the mouse in unpredictable vectors.

I had a deep study on C++ sample source and found all the location(mean x,y) changed to device location such as
int x = static_cast((0xFFFF * (center.x + position.x)) / screen_width);
This means the X and y which is passed to the two function MoveMouseTo and MoveMouseBy are not correctly or unclear. So I did some change, it works perfectly.
here is my change:
Point point = ConvertDevicePoint(x, y); mouseStroke.X = point.X; mouseStroke.Y = point.Y;
The function ConvertDevicePoint code is the following:
private static Point ConvertDevicePoint(int x,int y) { int SH = Screen.PrimaryScreen.Bounds.Height; int SW = Screen.PrimaryScreen.Bounds.Width; return new Point(0xFFFF * x / SW, 0xFFFF * y / SH); }
Then it works.

Thanks a lot for your code and help me a lot.

How to get Hardware ID of Keyboard?

I want to get the Hardware ID of the Keyboard in the OnKeyPressed Event. In interception there's a method called interception_get_hardware_id and there's an example for it. How can I use it?

Some part in the sample code didn't work.

Capture
I copied exactly the same code from the example. but some of them didn't work and I don't know why. The following code didn't working (with error explanation)

input.KeyDelay = 1;
// 'Input' does not contain a definition for 'KeyDelay' and no accessible extension method 'KeyDelay' accepting a first argument of type 'Input' could be found (are you missing a using directive or an assembly reference?)

input.SendKeys(Keys.Enter, KeyState.Down);
//cannot convert from 'Interceptor.KeyState' to 'Interceptor.Keys'	

input.SendKeys(Keys.Enter, KeyState.Up);
// cannot convert from 'Interceptor.KeyState' to 'Interceptor.Keys'

input.Unload();
// not support on this platform

Context does not load

Hello, I have a problem with this library. My context is not loading. I installed the Interception and put it in the folder with the executable file.
image

Windows 10

This is not work on Windows 10

I had done follow the instruction. My code can build without problems, but it has no effect. Nothing happens, keystroke or mouse click not work on any app: games, chrome or notepad...
I did active the target app using SetForegroundWindow() before sending keystroke or mouseclick.
Is there anyone could make it work on windows10? Please give me some advice!

how to use it into button1_click and timer

using Interceptor;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

    private void button1_Click(object sender, EventArgs e)
    {

        timer1.Enabled = true;
        timer1.Interval = 1000;

    }

    private void timer1_Tick(object sender, EventArgs e)
    {
        Input input = new Input();

        // Be sure to set your keyboard filter to be able to capture key presses and simulate key presses
        // KeyboardFilterMode.All captures all events; 'Down' only captures presses for non-special keys; 'Up' only captures releases for non-special keys; 'E0' and 'E1' capture presses/releases for special keys
        input.KeyboardFilterMode = KeyboardFilterMode.All;
        // You can set a MouseFilterMode as well, but you don't need to set a MouseFilterMode to simulate mouse clicks

        // Finally, load the driver
        input.Load();

        input.SendKeys(Interceptor.Keys.Enter);
        input.SendText("hello, I am typing!");
        input.Unload();
    }
}

}

it is not working , any suggestion please ? (on windows 8)

Cant send Keys and input.SendKey does right click

Hi, this is my code. When I try SendKey it right clicks.

            Input input = new Input();
            input.KeyboardFilterMode = KeyboardFilterMode.All;
            input.MouseFilterMode = MouseFilterMode.All;
            input.Load();

            Thread.Sleep(2000);

            input.SendLeftClick();

            Thread.Sleep(2000);

            input.KeyPressDelay = 10;
            input.SendKey(Interceptor.Keys.C, KeyState.Down);
            Thread.Sleep(100);
            input.SendKey(Interceptor.Keys.C, KeyState.Up);

            input.SendKeys(Interceptor.Keys.A);

            input.Unload();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.