locked
Can we disable devices in the KMDF driver development? RRS feed

Answers

  • by default you can disable a KMDF driver with devcon (assuming if there open handles, the apps close them). if you want the driver to disable itself, there is nothing in WDM or KMDF to change the state to disabled. the best you can do is call WdfDeviceSetFailed(no restart) and it will tear down the device stack. from there you can disable the device with devcon and then reenable it if desired

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, January 21, 2016 6:27 PM

All replies

  • No, but you can report a device as having a problem or non-present so it will be eventually stopped.

    - pa

    Thursday, January 21, 2016 10:25 AM
  • Dear Mr. Pavel:

    Thanks to your answer.

    We are wondering whether you could provide more information about the function whch reports a device as having a problem or non-present , i.e. its function name. Then we can google it.

    Besides, if we want to enable devices, is there a similar function to do so?

    Sincerely,

    Zale Yu

    Thursday, January 21, 2016 11:21 AM
  • Take a look at IoRaiseHardError https://msdn.microsoft.com/en-us/library/windows/hardware/ff549482%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 and IoSetHardErrorOrVerifyDevice https://msdn.microsoft.com/en-us/library/windows/hardware/ff549707(v=vs.85).aspx


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Thursday, January 21, 2016 11:48 AM
  • by default you can disable a KMDF driver with devcon (assuming if there open handles, the apps close them). if you want the driver to disable itself, there is nothing in WDM or KMDF to change the state to disabled. the best you can do is call WdfDeviceSetFailed(no restart) and it will tear down the device stack. from there you can disable the device with devcon and then reenable it if desired

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, January 21, 2016 6:27 PM