none
How can I set my driver to be enabled only manually? RRS feed

  • Question

  • Hi,

    I have a KMDF driver that is defined on the ACPI tables. for debug purposes, I want that the OS (win8.1) will not enable the device automatically at boot. Instead, I want it to appear as "disabled" (or preferably "Unknown device") in the device manager, and enable it manually by myself.

    How can I do that? I tried:

    1. create a _STA method that returns 0x05.

    2. change inf service to SERVICE_DISABLED (0x04)

    Both didn't work.

    Thanks,

    Tali Perry,

    Nuvoton Technologies


    Tali Perry

    Tuesday, November 4, 2014 1:09 PM

Answers

  • This sounds like you are trying to disable the driver for debugging purposes.  If that is the case, put a break point on DriverEntry and then in WinDBG force the driver entry routine to return a failure status.  There are several ways to do this depending on how your DriverEntry function is written.  The most general is to change the instruction pointer to cause the function to proceed through the return with the return value register set to an error.


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

    Tuesday, November 4, 2014 1:35 PM
  • Glad your problem is solved. Regarding:

    'Change PnP ID option - did not work. The OS refused to install the driver if there is no match on the PnP ID between the inf file and the ACPI entry. '

    You would have to manually select the driver in that case and force install it.

    Device Manager -> Right click on the device --> Update driver --> Browse my computer ... -> Let me pick from a list.. -> <Select your class> --> Pick the device.


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

    • Marked as answer by Tali Perry Sunday, November 16, 2014 9:40 AM
    Thursday, November 13, 2014 7:47 PM
  • Well your other approach is to use F8 to specify safe boot, then update the driver before rebooting without Safe Mode so that your driver runs.


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

    Tuesday, November 4, 2014 1:45 PM

All replies

  • Because I want that even if my driver did something wrong, like causing a BSOD,

    when I reset my PC the OS will not try to reload the faulty driver before I figured out what went wrong and fix it.


    Tali Perry

    Tuesday, November 4, 2014 1:27 PM
  • This sounds like you are trying to disable the driver for debugging purposes.  If that is the case, put a break point on DriverEntry and then in WinDBG force the driver entry routine to return a failure status.  There are several ways to do this depending on how your DriverEntry function is written.  The most general is to change the instruction pointer to cause the function to proceed through the return with the return value register set to an error.


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

    Tuesday, November 4, 2014 1:35 PM
  • Thanks for the quick replies !

    For most of the time ( and I'm not a great expert on the drivers, this the second one I'm writing), I don't do live debug from a remote PC . Most of the time I use tracing alone for debug.

    I use WinDbg only for analyzing a memory dump file.

    Isn't there a way to prevent it from loading at boot? Or am I using the WDK tools in the wrong way... ?


    Tali Perry

    Tuesday, November 4, 2014 1:41 PM
  • Well your other approach is to use F8 to specify safe boot, then update the driver before rebooting without Safe Mode so that your driver runs.


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

    Tuesday, November 4, 2014 1:45 PM
  • Thanks Don!

    I was trying to avoid this option since getting to safe mode takes a long time on Win8.1 ,

    as depicted in :

    http://www.howtogeek.com/107511/how-to-boot-into-safe-mode-on-windows-8-the-easy-way/

    This work, but it's time consuming. I'd rather not mix debugging my driver with booting the OS when the driver is still not stable. 


    Tali Perry

    Tuesday, November 4, 2014 2:00 PM
  • Looks like you are able to modify ACPI tables, how about changing the hardware id of your device in ACPI tables for debugging so that it wont find any matching device. 

    Then later you can force install your driver when you want on that unknown device. 


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

    Wednesday, November 5, 2014 2:18 AM
  • PJ - That's a good idea, I'll try both this and the WinDbg option. Thanks !

    Tali Perry

    Thursday, November 6, 2014 5:10 AM
  • Hi,

    Just wanted to catch up on this issue:

    1. Change PnP ID option - did not work. The OS refused to install the driver if there is no match on the PnP ID between the inf file and the ACPI entry. 

    2. WinDbg option, worked but...

      - NET option failed (maybe because my Network card does not support this).

     - USB option failed ( no kernel debug external port).

     - Serial option OK. However, connection is slow (115200), often the host fails to break into the target. Restart the target gets stuck too, before the host manages to break into the target.

    All in all, it worked, I cleared some silly bugs and now my driver is working, but it took a lot of time to debug this, most of it spent on environment issues,  and I still rather had my driver not to be loaded in the first place, unless I install it manually.. 

    Thanks everyone for the great support !


    Tali Perry

    Thursday, November 13, 2014 6:51 AM
  • Glad your problem is solved. Regarding:

    'Change PnP ID option - did not work. The OS refused to install the driver if there is no match on the PnP ID between the inf file and the ACPI entry. '

    You would have to manually select the driver in that case and force install it.

    Device Manager -> Right click on the device --> Update driver --> Browse my computer ... -> Let me pick from a list.. -> <Select your class> --> Pick the device.


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

    • Marked as answer by Tali Perry Sunday, November 16, 2014 9:40 AM
    Thursday, November 13, 2014 7:47 PM
  • Now this DID work :)

    Thanks!


    Tali Perry

    Sunday, November 16, 2014 9:39 AM