forderud / BatterySimulator

Driver to simulate multi-battery setups and test Windows power management
MIT License
14 stars 1 forks source link

Replace DevCon with DevGen #7

Closed forderud closed 9 months ago

forderud commented 11 months ago

Install & add:

:: Install driver
pnputil.exe /add-driver simbatt.inf /install /reboot

:: Add batteries
devgen /add /instanceid 0000 /hardwareid "{6B34C467-CE1F-4c0d-A3E4-F98A5718A9D6}\SimBatt"
devgen /add /instanceid 0001 /hardwareid "{6B34C467-CE1F-4c0d-A3E4-F98A5718A9D6}\SimBatt"

Remove & uninstall:

:: Works
devgen /remove SWD\DEVGEN\0000

pnputil.exe /delete-driver simbatt.inf /uninstall /force /reboot

Outstanding problem

CreateFile fails with err=1 (ERROR_INVALID_FUNCTION) when attempting to open the battery device.

Attempting to open \\?\GLOBALROOT\Device\0000006b
ERROR: CreateFileW (err=1).

Microsoft doc: NT Namespaces

DevCon baseline

image image image

DevGen alternative

image image image