Re: [OSR-DETECTED-SPAM] Re: BSOD on uninstall if multiple drivers were installed

as I’m new to drivers I may have mixed concepts.
I have one driver one sys כןךק and one inf file
but it is currently possible to install my driver manually twice and get 2
devices
that is what I want to prevent
I was thinking on in teh driverEntry to check by IOGetDeviceInterface if my
driver is already installed if yes to return error code and then the device
is created but with a yellow bang and won’t work.
is this the way to do it?

On Thu, Sep 18, 2014 at 7:57 PM, Tim Roberts wrote:

> NtDev mm wrote:
> > ok,
> > I think my solution is to enable installing only one of my drivers,
> > how can I prevent a second driver to be installed?
>
> You are still using the wrong terminology here, I think. Either that,
> or you have a most unusual situation.
>
> Do you really have two different DRIVERS (two different services, two
> different .sys files)? Or do you have one driver that happens to be
> driving two DEVICES?
>
> See if you can describe exactly how you get into this situation,
> including where you supply an INF and how the devices appear.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

DriverEntry will only be called once, and then AddDevice will be called twice, once for each device instance. The question is: who creates the PDO device for your device instance? If it’s root enumerated, you can’t really stop someone from creating two root enumerated PDOs that use your device id. You can fail the AddDevice to the second instance by checking a global flag, which will stop a second instance of your working FDO device from being created.

A PnP driver is like an object class, a PnP device is like an object instance.

Jan

On Sep 18, 2014, at 12:13 PM, NtDev mm > wrote:

as I’m new to drivers I may have mixed concepts.
I have one driver one sys כןךק and one inf file
but it is currently possible to install my driver manually twice and get 2 devices
that is what I want to prevent
I was thinking on in teh driverEntry to check by IOGetDeviceInterface if my driver is already installed if yes to return error code and then the device is created but with a yellow bang and won’t work.
is this the way to do it?

On Thu, Sep 18, 2014 at 7:57 PM, Tim Roberts > wrote:
NtDev mm wrote:
> ok,
> I think my solution is to enable installing only one of my drivers,
> how can I prevent a second driver to be installed?

You are still using the wrong terminology here, I think. Either that,
or you have a most unusual situation.

Do you really have two different DRIVERS (two different services, two
different .sys files)? Or do you have one driver that happens to be
driving two DEVICES?

See if you can describe exactly how you get into this situation,
including where you supply an INF and how the devices appear.


Tim Roberts, xxxxx@probo.commailto:xxxxx
Providenza & Boekelheide, Inc.</mailto:xxxxx>

NtDev mm wrote:

as I’m new to drivers I may have mixed concepts.
I have one driver one sys כןךק and one inf file
but it is currently possible to install my driver manually twice and
get 2 devices
that is what I want to prevent
I was thinking on in teh driverEntry to check by IOGetDeviceInterface
if my driver is already installed if yes to return error code and then
the device is created but with a yellow bang and won’t work.
is this the way to do it?

You still didn’t describe exactly how you get this to happen. The
phrase “install my driver manually” can mean a dozen different things.
So, let me hazard a guess.

I’m guessing you have a virtual device, so there is no real hardware.
You have some root-enumerated or software-enumerated ID in your INF
file. You install it by doing “devcon install”. Is that correct?
Because that would result in exactly the behavior you describe.

If that’s the case, then then answer is “don’t do that”. Each run of
“devcon install” creates a new fake device, and then asks the system to
load a driver to run it. Running “devcon install” three times is
exactly like plugging in three identical USB devices.

However, this is not a real-world problem, because you can’t distribute
“devcon” to your customers. You will need to have an installer app, and
that app can go out and check to see whether a device already exists
before creating a new one.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.