How to unload a Windows driver?

23,162

Solution 1

IF
it is an actual driver not a service
and
You can disable/enable it in the device manager without problems
Then
You could probably use "Devcon" to disable and enable it in batches and cmd prompts.
Else
If it is a service then it is good to know the actual service name, as seen in the properties for the service.
For
Services with drivers , disabling the driver might occur easier than disabling the service.

sorry I got confused by the code :-) This thing sounds like a real stickey one, which might require setting something different in the registry for it , or understanding it much better than my post here.
Finding devcon proper for 64bit isnt easy, and the wrong versions for the OS or the Bits do not work at all, so if you try devcon, you must have the right one for the exact system, which you did not reveal.

Is it really called Mydrv? because it might help to know any actual name or product , obfusticating(sp) the driver for the purpose of getting answers is probably not usefull here.

Solution 2

The app that installed it is probably calling a special function in the driver or sending it a carefully crafted message to tell it to shut down gracefully.

Share:
23,162

Related videos on Youtube

karlphillip
Author by

karlphillip

Updated on September 18, 2022

Comments

  • karlphillip
    karlphillip over 1 year

    I'm looking for a cmd-line solution to stop a Windows driver that I had installed manually.

    The installing procedure was the following:

    sc create MyDrv type= kernel start= demand binPath= "C:\MyDrv.sys"
    net start MyDrv
    

    Querying info on the driver outputs:

    C:\>sc query MyDrv
    
    SERVICE_NAME: MyDrv
            TYPE               : 1  KERNEL_DRIVER
            STATE              : 4  RUNNING
                                    (NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
            WIN32_EXIT_CODE    : 0  (0x0)
            SERVICE_EXIT_CODE  : 0  (0x0)
            CHECKPOINT         : 0x0
            WAIT_HINT          : 0x0
    

    The NOT_STOPPABLE flag seems like a huge indicator that what I'm trying to accomplish can't be done. However, this driver belongs to a application that manages to stop and remove it when I uninstall the application from my PC. So, is there any way I can kill this bastard? (I don't have the source code of the driver, unfortunately).

    If you are wondering, yes I tried:

    C:\>net stop MyDrv
    The requested pause or stop is not valid for this service.
    More help is available by typing NET HELPMSG 2191.