Skip to content

Commit 6e45e35

Browse files
authored
Merge pull request #204 from anagnorisis2peripeteia/docs/programmatic-api
docs: add programmatic integration (IOCTL API) to README
2 parents 44f98af + 3ac8e21 commit 6e45e35

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

DEVELOPER.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# HidHide Developer Guide
2+
3+
## Programmatic integration
4+
5+
Applications that need to communicate with *HidHide* at runtime can do so through a WDM control device that the driver
6+
exposes under the symbolic link `\\.\HidHide` (DOS device name). The same device can alternatively be opened by the
7+
interface GUID `{0C320FF7-BD9B-42B6-BDAF-49FEB9C91649}` via `SetupDiGetClassDevs` or `CM_Get_Device_Interface_List`.
8+
9+
Once opened, the device accepts a set of I/O control codes constructed with `CTL_CODE(32769, N, METHOD_BUFFERED,
10+
FILE_READ_DATA)`. Function numbers 2048 through 2055 correspond to the get and set operations for the whitelist,
11+
blacklist, active state, and whitelist-inverse flag respectively. List payloads are exchanged as `MULTI_SZ` buffers —
12+
a sequence of null-terminated wide-character strings with an additional null terminator to close the list — and the
13+
buffer size supplied to `DeviceIoControl` must be an even number of bytes and include all terminators. Device instance
14+
paths should be in the format returned by `SetupDiGetDeviceInstanceId`, for example
15+
`HID\VID_054C&PID_09CC&MI_03\7&...`.
16+
17+
Functions 2056 and 2057 expose the *session blacklist*, which is intended for feeder applications — programs that
18+
exclusively own one or more physical devices and re-expose them as virtual controllers. Unlike the persistent blacklist
19+
managed through functions 2050 and 2051, session blacklist entries live only in kernel memory and are never written to
20+
the registry, leaving the user's permanent *HidHide* configuration untouched. Each entry is owned by the process that
21+
issued the `ADD_SESSION_BLACKLIST` request. When that process exits for any reason — clean shutdown, crash, or forced
22+
termination — the driver automatically removes all of its entries within its process-notify callback registered via
23+
`PsSetCreateProcessNotifyRoutine`, so no cleanup code is required in the application. On a clean exit one may optionally issue `CLR_SESSION_BLACKLIST` to release the
24+
devices immediately, but this is not required. This approach is preferable to temporarily mutating the persistent
25+
blacklist because it requires no rollback logic and is inherently safe against unexpected termination.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ Third-party software deployment may benefit from the *HidHide Command Line Inter
102102
Please be conservative while altering a clients' configuration and only extend the configuration with new features offered.
103103
Don't assume exclusive ownership of the configuration settings as a recovery typically requires manual actions by the user.
104104

105+
See [DEVELOPER.md](DEVELOPER.md) for programmatic integration (IOCTL API) details for feeder applications.
106+
105107
## Bugs & Features
106108

107109
~~Found a bug and want it fixed? Feel free to open a detailed issue on the [GitHub issue tracker](../../issues)!~~

0 commit comments

Comments
 (0)