Question about driver installation and removal in Vista

I have written a mobile phone driver for Vista,it includes a virual modem and a another device.

The first time I install the driver and plug the mobile phone, it works correct.

When I removed the driver in the Add or Romove Programs.and then plug the mobile .In the Device Manager I still see a modem device with a small yellow interrogation mark.If I install the driver again and then plug the mobile phone, I see a modem device with a small yellow interrogation mark, so the driver can not work correct.

I reastart the computer and then plug the mobile phone, remove the modem in Device Manager, after it I install the driver,plug the mobile phone, the driver work correct.

I test the same driver in Windows Xp,and it works correct.there is no problem.

So what is the problem of the driver? Is there something else I should do in the driver?

Maybe the problem is the difference between Windows Vista and Windows Xp?

Thanks!

huaping jiang wrote:

When I removed the driver in the Add or Romove Programs.and
then plug the mobile .In the Device Manager I still see a modem
device with a small yellow interrogation mark.If I install the driver
again and then plug the mobile phone, I see a modem device with
a small yellow interrogation mark, so the driver can not work
correct.

Well, you either need to do one of two things in your uninstaller (I don’t think this is a problem with the “driver” as you say):

  1. It sounds like your uninstaller is removing .sys (or other important) files directly from Windows\System32\drivers, which is causing your device to bang out when you plug it in after the uninstall. So stop doing that if you want it to still work afterward.

  2. If you don’t want your device to work after you uninstall the drivers, then you’ll need to make sure you clean up/uninstall/mark for reinstallation all the devnodes relating to your device when you reinstall the driver package.

I have the same problem.that when i remove the driver in Add or Romove Programs,then install
the driver,plug the moblie phone,I see a modem device with a small yellow
interrogation mark.if I remove the modem in the Device Manager and plug the moblie phone again,it is correct.
everytime i install the driver,then I need plug the moblie phone and remove the modem in Device Manager ,after it I plug the moblie phone again, it is correct.
so maybe something I have to do in the driver,
what the OS do when I remove the modem in Device Manager?
how can I sovle the problem,Thanks a million.

Jianwu He wrote:

what the OS do when I remove the modem in Device Manager?

It essentially invokes DIF_REMOVE on the devnode in question. This means the class installers, etc., do any necessary cleanup, and then Setup removes the device from the system.

Thus if the same device appears on the system again, it’s reinstalled versus using an existing devnode.

Chris Aseltine,thank you ,
and I have a question ,what can I do in the diver like the OS do ,that so If i install the driver,then the first time I plug the moblie phone, it will be work correct?

Jianwu He wrote:

and I have a question ,what can I do in the diver like the OS do ,that
so If i install the driver,then the first time I plug the moblie phone,
it will be work correct?

If the machine really is “clean” (you said “first time I plug in the phone,”), then you simply need to preinstall the drivers, i.e. SetupCopyOEMInf() or DriverPackagePreinstall().

If you suspect it’s not clean, you’ll need to remove all the existing device instances first, or at least mark them for reinstallation, then preinstall the drivers as above.