Skip to content

Let Windows' own kernel-mode opens through, so an unhidden controller comes back in Raw Input - #226

Draft
EvoJocys wants to merge 4 commits into
nefarius:masterfrom
EvoJocys:fix/restart-device-on-cloak-change
Draft

EvoJocys wants to merge 4 commits into
nefarius:masterfrom
EvoJocys:fix/restart-device-on-cloak-change

Conversation

@EvoJocys

@EvoJocys EvoJocys commented Nov 10, 2026 •

Copy link
Copy Markdown

ISSUE

People hide a controller, later unhide it, and games that read controllers through Raw Input still cannot see it. The
controller looks fine in Device Manager, and turning hiding off does not help. Only unplugging it and plugging it in
again brings it back. The opposite also happens: a hidden controller still shows up in some games, depending on what
opened it first. To the user, HidHide seems to work on some days and not on others.

PROBLEM

OnDeviceFileCreate allows an open only when the caller is the System process (SYSTEM_PID) or a program on the
application list. The comment above the check says that a system-level process is always granted access.

Windows opens each game controller for Raw Input itself, from kernel mode, and keeps that handle open for every program
that reads Raw Input. The open runs inside csrss.exe rather than the System process, so HidHide refuses it. Adding the
reading program or csrss.exe to the application list did not change this.

After a refused open, Windows does not try again, and the controller stays out of Raw Input until the device is plugged
in again. This was tested with HidHide 1.5.230 on Windows 11 build 26200, and master has the same check:

  1. If the controller is hidden after Raw Input has opened it, Raw Input keeps reading it for every program. A DualSense
    kept sending about 250 reports a second. This matches the FAQ, which says HidHide cannot block Raw Input.
  2. If the controller is hidden at the moment Raw Input opens it, it disappears from GetRawInputDeviceList, and
    unhiding it does not bring it back. Turning hiding off and on, starting another program that reads Raw Input, and
    calling CM_Reenumerate_DevNode as a standard user (it returns CR_ACCESS_DENIED) do not bring it back either. Only
    plugging it in again, or restarting the device as administrator, does.

To reproduce, with no program reading Raw Input:

  1. Hide a gamepad, and turn hiding on.
  2. Start any program that reads gamepads through Raw Input. It gets no input, and the gamepad is missing from
    GetRawInputDeviceList.
  3. Unhide the gamepad, and turn hiding off. It is still missing from Raw Input until you plug it in again.

SOLUTION

This pull request changes the check in OnDeviceFileCreate so that an open coming from kernel mode is allowed, the same
way an open from the System process already is:

if ((SYSTEM_PID != PROCESS_HANDLE_TO_PROCESS_ID(processId)) && (UserMode == WdfRequestGetRequestorMode(wdfRequest)) && (GetActive()) && (Blacklisted(&deviceInstancePath, sessionId)))

Programs, including games, open devices from user mode, so they are checked exactly as before. Raw Input's own open
always succeeds, so Windows keeps the controller, and case 1 above applies whatever the order. The change is three lines
in HidHide/src/Logic.c: the condition and two comments.

PROS

  • After it is unhidden, a controller works in Raw Input games straight away. Nobody has to plug it in again, restart it,
    or have administrator rights.
  • Raw Input behaves the same whether a controller was hidden before or after Raw Input opened it, which is what the FAQ
    already describes.
  • Programs are refused hidden devices exactly as before. Kernel code running in the System process already passes the
    check today, so allowing kernel-mode opens extends an existing exception rather than adding a new kind.
  • The change is small, so it is easy to review and easy to revert.
  • Programs that hide controllers for their users, such as x360ce, would no longer need to unhide controllers while
    their Raw Input reader starts, or ask users to plug a controller in again.

CONS

  • HidHide would never hide a controller from Raw Input. Today a controller that was hidden before Raw Input opened it,
    for example at boot, is missing from Raw Input, and some users may depend on that. As long as HidHide checks access
    only when a device is opened, hiding from Raw Input and unhiding cleanly cannot both work, because Windows opens the
    device once for all programs and does not retry after a refusal.
  • A kernel-mode driver that opens a hidden device and passes its input on to a program would let that program see the
    device. Whether any such driver is in use has not been checked; the review below asks about it.
  • That Raw Input's open comes from kernel mode is inferred from the tests above and has not been confirmed with a trace.
    A HidHide trace of the reproduction would show it.
  • The patch has not been built or tested yet.

Weighing it up

People who unhide a controller, or whose controller was hidden at boot, currently have to plug it in again, and this
change removes that. People who relied on HidHide hiding a controller from Raw Input only got it when the device happened
to be hidden before Raw Input opened it, and the FAQ already says it is not supported.

The first version of this pull request restarted the device on every hide and unhide instead. That kept Raw Input
hiding, but it disconnected the controller each time and needed a new setting, two IOCTLs, three CLI commands, and a
device list with its own lock. This version changes one condition.

Conclusion: it solves more than it breaks.

Testing still to do

  • Builds for x64, x86 and ARM64.
  • Driver Verifier (standard checks plus IRQL checking) while hiding and unhiding.
  • The reproduction above: the gamepad stays in Raw Input after unhiding.
  • A hidden gamepad is still refused to programs through DirectInput and HID (CreateFile), also with the inverse
    application list.
  • Programs on the application list still get access.
  • A controller hidden at boot is present in Raw Input after logon and refused to programs.

Review

Please have your AI reviewer check this as well as a human, in particular:

  • that every user-mode open still reaches the check;
  • which kernel-mode opens other than Raw Input now get through, and whether any of them act for a program, for example
    opens made with OBJ_FORCE_ACCESS_CHECK.

@coderabbitai review

EvoJocys added 2 commits November 10, 2026 00:02
…ng and unhiding

A handle opened before a change of cloaking keeps its access. Windows opens a game controller for Raw Input itself and keeps it open: a controller hidden after that stays readable to every Raw Input client, and one hidden when Raw Input opens it is dropped from Raw Input and stays out after it is unhidden, until it is replugged.

The driver now keeps its filter devices and, when the blacklist, the active state or the session blacklist changes, restarts each device whose cloaking changed (WdfDeviceSetFailed with WdfDeviceFailedAttemptRestart). The new device object starts with the cloaking it then has.

Not built yet: written without the WDK.
Adds the RestartOnChange driver parameter, IOCTL_GET_RESTART_ON_CHANGE and IOCTL_SET_RESTART_ON_CHANGE, and the CLI commands --restart-on, --restart-off and --restart-state, following the inverse application list. While it is off, HidHide behaves as before; turning it on restarts the devices hidden or shown while it was off.

Not built yet: written without the WDK.
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

OnDeviceFileCreate now grants kernel-mode requests access without applying the blacklist and whitelist check. That check now applies only to user-mode requests from non-system processes when the service is active and the device is blacklisted.

Changes: File Access Control

Layer / File(s) Summary
Request-mode access check
HidHide/src/Logic.c
The access-control comment states that kernel-mode opens are always granted access. The blacklist and whitelist check now also requires a user-mode request.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related issues

  • nefarius/HidHide#223 reports a HIDClass device start failure and identifies filter file-create handling as one possible cause. This change affects that path, but the issue does not establish that the changed behavior resolves the failure.

Possibly related PRs

  • nefarius/HidHide#201: Adds session-blacklist entries to the driver’s blacklist decision; this change narrows when that decision blocks a file open.
  • nefarius/HidHide#204: Documents session-blacklist IOCTLs and device hiding; this change allows kernel-mode opens through despite blacklist entries.

Suggested reviewers: black-seraph

Merge Risk: Minimal · up to 57fdc

This change lets Windows-initiated kernel-mode opens through, so an unhidden controller can return to Raw Input without a device restart. The stated tradeoff is that HidHide no longer blocks Raw Input in cases where it did before. No concrete defect was established. Before merging, build on x64, x86 and ARM64, run Driver Verifier, and confirm the Raw Input behavior with a trace.

Security architecture risk: Low · up to 57fdc

Direct application filtering is preserved, but privileged opens receive a broader exemption. Whether that exemption also exposes hidden-device input through shared Windows services remains unverified. No new privilege escalation is established.

Retained concerns

  • Low · security · observed: The exemption applies to every kernel-mode request, not specifically Windows Raw Input. Non-SYSTEM kernel brokers now bypass application and device-policy evaluation, leaving authorization of any downstream user consumers to those brokers. This is an observed trust expansion, not a verified unprivileged bypass.
Security review details

Security Blast Radius

  • observed — The relaxation applies to devices evaluated by this callback whenever a non-SYSTEM kernel-mode request would previously have failed the active blacklist and application allowlist decision. It is not limited to one controller or one kernel broker. Lower-stack failure can still prevent an open from succeeding.

Security Findings and Attack Paths

  • inferred — If an admitted kernel broker shares controller reports with non-allowlisted applications, those consumers can receive input without an application decision in this callback. The PR describes Raw Input sharing and pre-existing order-dependent access, but the actual broker-to-consumer path and its before/after exposure remain unverified; an ordinary-user exploit is not established.

Trust Boundaries and Controls

  • observed — Direct non-SYSTEM user-mode opens remain subject to the existing active-state, blacklist, and application allowlist controls. SYSTEM-process exemption already existed. These controls narrow the demonstrated change to non-SYSTEM kernel-mode admission rather than removal of ordinary application filtering.

Hardening Proposals

  • proposed — Document whether broker-delivered input is outside the hiding guarantee, and validate the claimed Raw Input requestor mode and downstream access with a non-allowlisted consumer when hiding is active before device arrival. This would distinguish the intended compatibility exception from an unsupported isolation expectation.
Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: allowing Windows kernel-mode opens so an unhidden controller can return in Raw Input.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the open gate,
Kernel callers pass through straight.
User-mode checks still guard the way,
When service and blacklist hold sway.
The bunny hops, its work complete.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b957e3db-8cca-4304-b593-d50eb683d632
Commits

Reviewing files that changed from the base of the PR and between 5aba4b1 and 57fdcb7.

Files selected for processing: 1

  • HidHide/src/Logic.c

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

EvoJocys added 2 commits November 10, 2026 00:46
Turns the restart on change setting on and off, as Enable device hiding does for hiding. Not built yet: written without the WDK and the client toolchain.
Windows opens each game controller for Raw Input from kernel mode, inside csrss.exe rather than the System process.
OnDeviceFileCreate refused that open for a hidden device, and Windows then dropped the controller from Raw Input until
it was plugged in again, so unhiding it did nothing. A kernel-mode open is now granted like one from the System
process; every user-mode open is checked as before. That fixes the cause, so the restart on change, its setting, IOCTLs,
CLI commands and check box are removed.
@EvoJocys EvoJocys changed the title Optional: restart a device when it is hidden or shown, so Raw Input follows the change Let Windows' own kernel-mode opens through, so an unhidden controller comes back in Raw Input Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant