GithubHelp home page GithubHelp logo

fcccode / hidguardian Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nefarius/hidguardian

0.0 0.0 0.0 339 KB

Windows kernel-mode driver for controlling access to various input devices.

Home Page: https://vigem.org/

License: MIT License

PowerShell 0.91% Shell 0.69% C# 1.43% C 35.30% C++ 61.68%

hidguardian's Introduction

HidGuardian

Blocks various input devices from being accessed by user-mode applications.

Build status

Disclaimer

Please consider the master branch unstable until the disclaimer disappears!

The Problem

Games and other user-mode applications enumerate Joysticks, Gamepads and similar devices through various well-known APIs (DirectInput, XInput, Raw Input) and continously read their reported input states. The primary collection of devices available through DirectInput are HID-Class based devices. When emulating virtual devices with ViGEm the system (and subsequently the application) may not be able to distinguish between e.g. a "real" physical HID Gamepad which acts as a "feeder" and the virtual ViGEm device, therefore suffer from side effects like doubled input. Since coming up with a solution for each application available would become quite tedious a more generalized approach was necessary to reliably solve these issues.

The Semi-Solution

A common way for intercepting the Game's communication with the input devices would be hooking the mentioned input APIs within the target process. While a stable and user-friendly implementation for the end-user might be achievable for some processes, targeting the wide variety of Games available on the market is a difficult task. Hooking APIs involves manipulating the target processes memory which also might falsely trigger Anti-Cheat systems and ban innocent users.

The Real Solution

HidGuardian is an upper filter driver for device classes like HIDClass, XnaComposite or XboxComposite therefore targeting and attaching itself to every input device connected to the system. On startup it queries the AffectedDevices value in the service's Parameters key to check if the current device in the driver stack is "blacklisted". If a matching Hardware ID is found, every call of the CreateFile(...) API will be queued until the user-mode service has decided if the request is allowed or shall be blocked. If the result of the decision denies access, the original open request will be answered with the status ERROR_ACCESS_DENIED thus failing the attempt to open a file handle and communicate with the affected device. If allowed the open request will simply get forwarded in the stack untouched. If the guardian is attached to a device which shouldn't get blocked it will unload itself from the driver stack.

Demo

Sony DualShock 4 and generic USB Gamepad connected:

HidGuardian.sys active and hiding the DualShock 4:

Manual Installation

devcon.exe install HidGuardian.inf Root\HidGuardian
devcon.exe classfilter HIDClass upper -HidGuardian

Manual Removal

devcon.exe remove Root\HidGuardian
devcon.exe classfilter HIDClass upper !HidGuardian

Re-plug your devices or reboot the system for the driver to get unloaded and removed.

hidguardian's People

Contributors

nefarius avatar

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.