|
| 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. |
0 commit comments