feat(windows-drivers): adapter WDF context type + init-before-interface (match SudoVDA)

On-glass diagnosis narrowed decisively. PROVEN it is the driver, NOT the box:
enabling the installed SudoVDA devnode -> Status=OK (the box inits a self-signed
IddCx adapter right now). SudoVDA uses the IDENTICAL UmdfExtensions=IddCx0102 and is
built against IddCx 1.10 (DriverVer 1.10.9.289) — exactly our config.

Matched SudoVDA/the oracle on every inspectable dimension, none fixed the
IddCxAdapterInitAsync INVALID_PARAMETER: caps byte-perfect (offsets+sizes vs C +
framework table), minimal SDR adapter fails identically, dispatch byte-identical to
the oracle (IddFunctions[idx] + IddDriverGlobals), IddMinimumVersionRequired=4 (same
as oracle), version pointers, ObjectAttributes, init order, and now an adapter WDF
context type (this commit). The remaining difference is the Rust binary itself vs
SudoVDA C++. Next: capture IddCx ETW/WPP rejection reason (or kernel debugger), or
build the oracle (wdf-umdf Rust) on-glass to isolate Rust-wide vs wdk-sys-specific.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-24 18:25:07 +00:00
parent 5fc06247b7
commit 24f1a9de90
2 changed files with 27 additions and 7 deletions
@@ -92,6 +92,16 @@ extern "C" fn driver_add(_driver: WDFDRIVER, mut init: PWDFDEVICE_INIT) -> NTSTA
return status;
}
// IddCx must be initialized on the device BEFORE other device setup (the canonical IddCx sample order).
// We previously created the device interface first — which can leave IddCx not fully ready by D0Entry,
// making IddCxAdapterInitAsync reject (INVALID_PARAMETER) despite byte-perfect caps.
// SAFETY: device is the just-created WDFDEVICE.
let status = unsafe { wdk_iddcx::IddCxDeviceInitialize(device) };
dbglog!("[pf-vd] IddCxDeviceInitialize -> {status:#x}");
if !nt_success(status) {
return status;
}
// Expose the owned pf-vdisplay control interface (the host opens this GUID; STEP 4 wires the host
// side in lockstep). NOT SudoVDA's GUID.
let (d1, d2, d3, d4) = pf_vdisplay_proto::interface_guid_fields();
@@ -111,12 +121,5 @@ extern "C" fn driver_add(_driver: WDFDRIVER, mut init: PWDFDEVICE_INIT) -> NTSTA
)
};
dbglog!("[pf-vd] WdfDeviceCreateDeviceInterface -> {status:#x}");
if !nt_success(status) {
return status;
}
// SAFETY: device is the just-created WDFDEVICE.
let status = unsafe { wdk_iddcx::IddCxDeviceInitialize(device) };
dbglog!("[pf-vd] IddCxDeviceInitialize -> {status:#x}");
status
}