WhiteKnight - Block games from being able to see sticks using ViGEm

Post gaming related scripts
User avatar
evilC
Posts: 3414
Joined: 27 Feb 2014, 12:30

WhiteKnight - Block games from being able to see sticks using ViGEm

23 Jul 2017, 10:19

This is a solution for stopping games from seeing a DirectInput stick (Basically any stick except Xbox controllers) on your system.

For ages we have been able to create virtual controllers and remap a stick to that, but in the past we have not been able to stop the game from seeing the physical stick.

Well now we have a proper solution: The HidGuardian / HidCerberus components from ViGEm. HidGuardian is a device driver that you install which can hide sticks from the system. HidCerberus is a windows service that allows you to "whitelist" a process (eg your AHK script) so that your script is the ONLY thing on the system that can see through HidGuardian and read the stick. The stick even disappears from the joystick control panel in windows!

Download

There are two tools in the zip - a ready made Auto-Whitelister app, and a library if you wish to write your own solution.

Auto-Whitelister
(A pre-compiled version of this is provided, you do not need AutoHotkey installed to use it)
Image
This is used to whitelist an app of your choice (eg UJR, UCR, Joy2Key, GlovePIE maybe) with the ability to see through the HidGuardian block.
Click the button, click a window, and it will whitelist that app for you.
It keeps checking for the existence of the specified window, and tries to always keep the PID of the specified application in the whitelist up-to-date.
It will also install / uninstall HG or HC for you. It requires admin rights to run, but you will only get a UAC popup the first time.

Library
Usage is super simple - two lines of code: One to include the library, and one to initialize:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Setup
Download the attached ZIP and extract
Run the included WhiteKnight.ahk or WhiteKnight.exe and follow the instructions
Open an Administrator command prompt
Navigate to the Resources\1 HidGuardian folder from the zip
run HidGuardian Install.bat
Navigate to the Resources\2 HidCerberus folder from the zip
Navigate to the x86 folder on a 32-bit system, or the x64 folder if your system is 64-bit
run HidCerberus Install.bat

Check in your windows Services dialog if the HidCerberus service is running (Start->Services.msc)


Hiding sticks
Navigate to the HidGuardian config page (This is a link to a web server now running on your local system)
Find the stick you wish to hide from the list, and click the Hide button next to it.
Unplug the stick and plug it back in. It should now be gone from the Joystick control panel (Start->joy.cpl)
Note that in order to revert back to normal usage, you need to use this page to unhide the stick, then unplug and plug back in again.

Once a stick is hidden and you use the library from the zip, you can use normal AHK commands (eg GetKeyState) to read the state of the stick.
Last edited by evilC on 12 Aug 2017, 12:22, edited 11 times in total.
User avatar
evilC
Posts: 3414
Joined: 27 Feb 2014, 12:30

Re: WhiteKnight - Block games from being able to see sticks using ViGEm

24 Jul 2017, 13:37

FYI, all this library does is this:

When you start the script and load the library, it gets the PID (Process ID) of the AHK script, and adds it to the HidGuardian whitelist by making an HTTP request to http://localhost:26762/api/v1/hidguardian/whitelist/add/<PID of the script>".

When the script exits, it makes a call to http://localhost:26762/api/v1/hidguardian/whitelist/remove/<PID of the script>" to remove it from the whitelist.

This process is totally do-able manually - as long as you can find the PID of a process you want to whitelist, then you can just open a web browser and hit the appropriate URL.
cuyo001
Posts: 7
Joined: 12 Dec 2016, 20:25

Re: WhiteKnight - Block games from being able to see sticks using ViGEm

12 Aug 2017, 07:03

there must be something wrong with my sigth becausce i cant see the atachment zip
User avatar
evilC
Posts: 3414
Joined: 27 Feb 2014, 12:30

Re: WhiteKnight - Block games from being able to see sticks using ViGEm

12 Aug 2017, 12:23

Thanks for pointing that out, it seems that the edit post form allowed me to attach the zip, but when I submitted it, I guess it was too big or something and it removed it.
I uploaded it to my website instead and added a download link.

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 3 guests