C# app to drive HidCerberus / HidGuardian?



  • Originally posted by evilC


    Hey Nefarius,
    As I mentioned to you before, I am just starting to get into C# coding, so I was wondering if you are still working towards providing some kind of API so that we can whitelist / blacklist devices?
    I had a look through the HidCerberus project, and saw some stuff related to the service, couldn't quite work out how to get what appeared to be the service installer builder to work. The regular build seemed to work and spat out an EXE, can I just run it? Didn't know if there were even any useful endpoints to hit anyway, so I gave up on my tinkering efforts.
    Anything worth playing around with in regards to blocking? If so, any pointers?



  • Originally posted by nefarius


    Ey,

    it's - like nearly everything here 😆 - a big pile of sh... erm, work in progress. I try to improve the user-mode samples so you can use it. But currently not much magic is happening there; I simply use a Windows Service as a trampoline so an unprivileged user-mode process can change the necessary registry keys read by the driver.



  • Originally posted by evilC


    Orly?
    So app whitelisting / blacklisting is working now?
    Are the reg keys documented somewhere?



  • Originally posted by nefarius


    There is now 😆



  • Originally posted by evilC


    Yeah I know about those keys, but they are for global whitelisting / blacklisting.
    I thought you meant that control over which apps could see which devices was working...



  • Originally posted by JoshWobbles


    @evilC#62 That's the general idea, PIDs in the whitelist key are able to access the devices, others are not.



  • Originally posted by evilC


    What whitelist key? There is no mention of one.
    All the linked documentation tells you are the AffectedDevices and ExemptedDevices keys, which only appear to let you globally whitelist / blacklist devices, which serves no practical purpose.
    I see no mention of a reg key which will whitelist / blacklist on a per-PID basis.



  • Originally posted by evilC


    Oh, and @JoshWobbles - I see in another thread you have been tinkering around yourself in this area - it seems to me that we probably only need one application to handle HG/HC interaction - I am not really sure that I see any benefit in building our own implementation into our various feeder apps.
    So the basic workflow that I envisage would be a Gui app that you can run, click "Add Rule", and it pops up a list of all devices, allowing you to select one and configure various options (whitelist / blacklist apps etc) and also handle the "replug device to take effect" dialogs etc. It may need to be running all the time, as if white/blacklisting is based upon PID, I suppose you would need something that detects when your feeder app is launched, gets it's PID and hands it to HC.
    Do any other consumers of ViGEm feel the same? Is anyone else interested in pitching in on a community-driven effort do develop such an app?
    Would be happy to pitch in on coding / QA / design ideas etc.



  • Originally posted by nefarius


    Currently working in a more user (and developer) friendly API, UI and documentation:



  • Originally posted by evilC


    @nefarius#73
    Awesome news!
    What would happen if you whitelisted a specific mouse to only be able to send input to my feeder app?

    I take it I would just read it via RawInput as normal? Would windows move the mouse pointer in response to this mouse at all? Ideally we would love a solution where we can read input from a mouse without it having any effect on the OS - there are a bunch of input devices for disabled people that report as a mouse, and we want to be able to totally transform the input from them, without having to hook all mice on the system.



  • Originally posted by nefarius


    You white-list the **process** which wants to access it. Mice are tricky; AFAIK the OS picks up their input in stages the guardian can't block - which is expected behavior since I designed it for user-mode processes to get blocked access to the device. And yes, you should be able to use RawInput right after you called HidGuardianOpen.



  • Originally posted by evilC


    Bummer, I was hoping that since HG appears to be able to stop joy.cpl from being able to see a stick, that a similar thing might be possible with mice.


Log in to reply