programmatically uninstalling drivers

hi all:

I need to programmatically uninstall my virtual com port drivers. (The driver for the 4 com ports have to be uninstalled followed by the bus driver that created the PDOs corresponding to the 4 virtual com ports). Note that manual install (user going into Device Manager and right clicking on the ports and then the bus components) works fine.

Since I know nothing about installers and uninstallers or setup programs, what normally has to happen here? Do I need to write a program that calls a bunch of SetupDi* APIs? Or is there a exe already in existence that does this for me? Devcon.exe? Some other program? Is there something that just will work with minimal effort?

If I need to use devcon.exe, is it going to be pretty cut and dry? Can I pass it a HW ID wildcard to with some arguments, and it will do the rest? I’ll also need to force a reboot, I saw something about reboots in devcon source code. If you happen to know what the command line parameters need to be passed, that would be appreciated as well.

If I have to write the code myself using the SetupDi* commands, do you have suggestions of which of these APIs I have to call?

Also, in general, what approaches do you all normally take when putting together uninstall programs to uninstall drivers? Do you tend to stick with one way of doing this? And, if so, why? Pros and Cons?

much thanks

I wouldn’t use devcon directly in a commercial program as it is shipped with
the ddk. Instead use the devcon source as a reference for implementing your
own uninstall application. You also might want to look into the driver
installer framework to see if you can use it with your set of drivers rather
than re-inventing the wheel here.
http://www.microsoft.com/whdc/driver/install/default.mspx


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Monday, May 22, 2006 11:26 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] programmatically uninstalling drivers

hi all:

I need to programmatically uninstall my virtual com port drivers. (The
driver for the 4 com ports have to be uninstalled followed by the bus driver
that created the PDOs corresponding to the 4 virtual com ports). Note that
manual install (user going into Device Manager and right clicking on the
ports and then the bus components) works fine.

Since I know nothing about installers and uninstallers or setup programs,
what normally has to happen here? Do I need to write a program that calls a
bunch of SetupDi* APIs? Or is there a exe already in existence that does
this for me? Devcon.exe? Some other program? Is there something that just
will work with minimal effort?

If I need to use devcon.exe, is it going to be pretty cut and dry? Can I
pass it a HW ID wildcard to with some arguments, and it will do the rest?
I’ll also need to force a reboot, I saw something about reboots in devcon
source code. If you happen to know what the command line parameters need to
be passed, that would be appreciated as well.

If I have to write the code myself using the SetupDi* commands, do you have
suggestions of which of these APIs I have to call?

Also, in general, what approaches do you all normally take when putting
together uninstall programs to uninstall drivers? Do you tend to stick with
one way of doing this? And, if so, why? Pros and Cons?

much thanks


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer