Driver loading

Hi all,

I’ve written a bus driver, that enumerates a number of devices. I’ve
also written the driver that drives the devices it enumerates. After
the bus driver discovers the devices I get the “Windows has found new
hardware wizard…”, and I have to go though and let it search for the
driver.

How can I stop this from happening? Windows really doesn’t need to look
for other matches, there is only one possible match. In fact, the same
‘.sys’ file drives both the bus device, and the devices it enumerates.

I am thinking/hoping that I can just make a small adjustment to the INF
file, or perhaps the code that handles the IRP_MJ_PNP message.

SetupCopyOEMInf with the right parameters will copy the inf file, and also
set the locations in the copied inf of the drivers. They will then be
silently copied in if necessary. Which in your case won’t be necessary.

Loren

----- Original Message -----
From: “Cliff Russell”
To: “NT Developers Interest List”
Sent: Sunday, May 25, 2003 10:52 AM
Subject: [ntdev] Driver loading

> Hi all,
>
> I’ve written a bus driver, that enumerates a number of devices. I’ve
> also written the driver that drives the devices it enumerates. After
> the bus driver discovers the devices I get the “Windows has found new
> hardware wizard…”, and I have to go though and let it search for the
> driver.
>
> How can I stop this from happening? Windows really doesn’t need to look
> for other matches, there is only one possible match. In fact, the same
> ‘.sys’ file drives both the bus device, and the devices it enumerates.
>
> I am thinking/hoping that I can just make a small adjustment to the INF
> file, or perhaps the code that handles the IRP_MJ_PNP message.
>
> - Cliff
> xxxxx@telus.net
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@earthlink.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

On Sunday, May 25, 2003, at 11:42 AM, Loren Wilton wrote:

SetupCopyOEMInf with the right parameters will copy the inf file, and
also
set the locations in the copied inf of the drivers. They will then be
silently copied in if necessary. Which in your case won’t be
necessary.

Yes, I was going to use SetupCopyOEMInf to install the INF - but even
after the INF is installed (and the driver files are copied into the
SYSTEM32\drivers folder), if I enumerate a device that windows hasn’t
seen before, The "Found new hardware wizard comes up and I have to
(more importantly the user has to) go through the steps. Basically it’s
just a matter of hitting next a bunch of times - but I’d like it if I
could avoid this all together.

Loren

----- Original Message -----
From: “Cliff Russell”
> To: “NT Developers Interest List”
> Sent: Sunday, May 25, 2003 10:52 AM
> Subject: [ntdev] Driver loading
>
>
>> Hi all,
>>
>> I’ve written a bus driver, that enumerates a number of devices. I’ve
>> also written the driver that drives the devices it enumerates. After
>> the bus driver discovers the devices I get the “Windows has found new
>> hardware wizard…”, and I have to go though and let it search for the
>> driver.
>>
>> How can I stop this from happening? Windows really doesn’t need to
>> look
>> for other matches, there is only one possible match. In fact, the same
>> ‘.sys’ file drives both the bus device, and the devices it enumerates.
>>
>> I am thinking/hoping that I can just make a small adjustment to the
>> INF
>> file, or perhaps the code that handles the IRP_MJ_PNP message.
>>
>> - Cliff
>> xxxxx@telus.net
>>
>>
>>
>> —
>> You are currently subscribed to ntdev as: xxxxx@earthlink.net
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@telus.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Maybe a driver signing issue?

Max

----- Original Message -----
From: “Cliff Russell”
To: “NT Developers Interest List”
Sent: Sunday, May 25, 2003 9:52 PM
Subject: [ntdev] Driver loading

> Hi all,
>
> I’ve written a bus driver, that enumerates a number of devices. I’ve
> also written the driver that drives the devices it enumerates. After
> the bus driver discovers the devices I get the “Windows has found
new
> hardware wizard…”, and I have to go though and let it search for
the
> driver.
>
> How can I stop this from happening? Windows really doesn’t need to
look
> for other matches, there is only one possible match. In fact, the
same
> ‘.sys’ file drives both the bus device, and the devices it
enumerates.
>
> I am thinking/hoping that I can just make a small adjustment to the
INF
> file, or perhaps the code that handles the IRP_MJ_PNP message.
>
> - Cliff
> xxxxx@telus.net
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to
xxxxx@lists.osr.com

I’ve seen similar problems which disappeared when the driver was signed.

----- Original Message -----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Sent: Sunday, May 25, 2003 4:51 PM
Subject: [ntdev] Re: Driver loading

> Maybe a driver signing issue?
>
> Max
>
> ----- Original Message -----
> From: “Cliff Russell”
> To: “NT Developers Interest List”
> Sent: Sunday, May 25, 2003 9:52 PM
> Subject: [ntdev] Driver loading
>
>
> > Hi all,
> >
> > I’ve written a bus driver, that enumerates a number of devices. I’ve
> > also written the driver that drives the devices it enumerates. After
> > the bus driver discovers the devices I get the “Windows has found
> new
> > hardware wizard…”, and I have to go though and let it search for
> the
> > driver.
> >
> > How can I stop this from happening? Windows really doesn’t need to
> look
> > for other matches, there is only one possible match. In fact, the
> same
> > ‘.sys’ file drives both the bus device, and the devices it
> enumerates.
> >
> > I am thinking/hoping that I can just make a small adjustment to the
> INF
> > file, or perhaps the code that handles the IRP_MJ_PNP message.
> >
> > - Cliff
> > xxxxx@telus.net
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@hotmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Perhaps it is signing related as others have mentioned. However, I had the
same problem and fixed it by fiddling the parameters.

BOOL WINAPI SetupCopyOEMInf(
PCTSTR SourceInfFileName,
PCTSTR OEMSourceMediaLocation,
DWORD OEMSourceMediaType,
DWORD CopyStyle,
PTSTR DestinationInfFileName,
DWORD DestinationInfFileNameSize,
PDWORD RequiredSize,
PTSTR DestinationInfFileNameComponent
);

The important trick here is to put both your inf and the driver files in a
directory somewhere on the user’s system. Then point the first parameter at
that inf, and the important one, the second parameter at the *directory*
containing the inf and the drivers themselves. You have to leave these
files lying around in this directory after the install, because you don’t
know when the hardware will first be plugged in.

You can leave the second parameter null and the inf will be copied, but then
you get the “where’s the drivers?” complaint when you add the hardware. If
you set the second parameter correctly, the system finds the drivers and
copies them silently, only giving the “found new hardware, installing
drivers” popup while it does the copy.

The third parameter wants to be SPOST_PATH.

The fourth parameter wants to be 0.

The reamining 4 parameters can all be zero or null.

This worked for me with a couple of different USB devices. I can’t say that
it will work in all cases, but it seems to work for USB things.

Loren

----- Original Message -----
From: “Cliff Russell”
To: “NT Developers Interest List”
Sent: Sunday, May 25, 2003 1:33 PM
Subject: [ntdev] Re: Driver loading

>
> On Sunday, May 25, 2003, at 11:42 AM, Loren Wilton wrote:
>
> > SetupCopyOEMInf with the right parameters will copy the inf file, and
> > also
> > set the locations in the copied inf of the drivers. They will then be
> > silently copied in if necessary. Which in your case won’t be
> > necessary.
>
> Yes, I was going to use SetupCopyOEMInf to install the INF - but even
> after the INF is installed (and the driver files are copied into the
> SYSTEM32\drivers folder), if I enumerate a device that windows hasn’t
> seen before, The "Found new hardware wizard comes up and I have to
> (more importantly the user has to) go through the steps. Basically it’s
> just a matter of hitting next a bunch of times - but I’d like it if I
> could avoid this all together.
>
> >
> > Loren
> >
> > ----- Original Message -----
> > From: “Cliff Russell”
> > To: “NT Developers Interest List”
> > Sent: Sunday, May 25, 2003 10:52 AM
> > Subject: [ntdev] Driver loading
> >
> >
> >> Hi all,
> >>
> >> I’ve written a bus driver, that enumerates a number of devices. I’ve
> >> also written the driver that drives the devices it enumerates. After
> >> the bus driver discovers the devices I get the “Windows has found new
> >> hardware wizard…”, and I have to go though and let it search for the
> >> driver.
> >>
> >> How can I stop this from happening? Windows really doesn’t need to
> >> look
> >> for other matches, there is only one possible match. In fact, the same
> >> ‘.sys’ file drives both the bus device, and the devices it enumerates.
> >>
> >> I am thinking/hoping that I can just make a small adjustment to the
> >> INF
> >> file, or perhaps the code that handles the IRP_MJ_PNP message.
> >>
> >> - Cliff
> >> xxxxx@telus.net
> >>
> >>
> >>
> >> —
> >> You are currently subscribed to ntdev as: xxxxx@earthlink.net
> >> To unsubscribe send a blank email to xxxxx@lists.osr.com
> >>
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@telus.net
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@earthlink.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

I suspect it’s defiantly because the driver is not signed. I pretty
sure the answer to my next question is no, but I will ask anyway. Even
though the driver is not signed, can I prevent the dialog from
appearing for the child devices? Is there someway of manually loading
the driver for the devices?

Cliff

On Monday, May 26, 2003, at 01:18 AM, Loren Wilton wrote:

Perhaps it is signing related as others have mentioned. However, I
had the
same problem and fixed it by fiddling the parameters.

BOOL WINAPI SetupCopyOEMInf(
PCTSTR SourceInfFileName,
PCTSTR OEMSourceMediaLocation,
DWORD OEMSourceMediaType,
DWORD CopyStyle,
PTSTR DestinationInfFileName,
DWORD DestinationInfFileNameSize,
PDWORD RequiredSize,
PTSTR DestinationInfFileNameComponent
);

The important trick here is to put both your inf and the driver files
in a
directory somewhere on the user’s system. Then point the first
parameter at
that inf, and the important one, the second parameter at the
*directory*
containing the inf and the drivers themselves. You have to leave these
files lying around in this directory after the install, because you
don’t
know when the hardware will first be plugged in.

You can leave the second parameter null and the inf will be copied,
but then
you get the “where’s the drivers?” complaint when you add the
hardware. If
you set the second parameter correctly, the system finds the drivers
and
copies them silently, only giving the “found new hardware, installing
drivers” popup while it does the copy.

The third parameter wants to be SPOST_PATH.

The fourth parameter wants to be 0.

The reamining 4 parameters can all be zero or null.

This worked for me with a couple of different USB devices. I can’t
say that
it will work in all cases, but it seems to work for USB things.

Loren

----- Original Message -----
From: “Cliff Russell”
> To: “NT Developers Interest List”
> Sent: Sunday, May 25, 2003 1:33 PM
> Subject: [ntdev] Re: Driver loading
>
>
>>
>> On Sunday, May 25, 2003, at 11:42 AM, Loren Wilton wrote:
>>
>>> SetupCopyOEMInf with the right parameters will copy the inf file, and
>>> also
>>> set the locations in the copied inf of the drivers. They will then
>>> be
>>> silently copied in if necessary. Which in your case won’t be
>>> necessary.
>>
>> Yes, I was going to use SetupCopyOEMInf to install the INF - but even
>> after the INF is installed (and the driver files are copied into the
>> SYSTEM32\drivers folder), if I enumerate a device that windows hasn’t
>> seen before, The "Found new hardware wizard comes up and I have to
>> (more importantly the user has to) go through the steps. Basically
>> it’s
>> just a matter of hitting next a bunch of times - but I’d like it if I
>> could avoid this all together.
>>
>>>
>>> Loren
>>>
>>> ----- Original Message -----
>>> From: “Cliff Russell”
>>> To: “NT Developers Interest List”
>>> Sent: Sunday, May 25, 2003 10:52 AM
>>> Subject: [ntdev] Driver loading
>>>
>>>
>>>> Hi all,
>>>>
>>>> I’ve written a bus driver, that enumerates a number of devices. I’ve
>>>> also written the driver that drives the devices it enumerates. After
>>>> the bus driver discovers the devices I get the “Windows has found
>>>> new
>>>> hardware wizard…”, and I have to go though and let it search for
>>>> the
>>>> driver.
>>>>
>>>> How can I stop this from happening? Windows really doesn’t need to
>>>> look
>>>> for other matches, there is only one possible match. In fact, the
>>>> same
>>>> ‘.sys’ file drives both the bus device, and the devices it
>>>> enumerates.
>>>>
>>>> I am thinking/hoping that I can just make a small adjustment to the
>>>> INF
>>>> file, or perhaps the code that handles the IRP_MJ_PNP message.
>>>>
>>>> - Cliff
>>>> xxxxx@telus.net
>>>>
>>>>
>>>>
>>>> —
>>>> You are currently subscribed to ntdev as: xxxxx@earthlink.net
>>>> To unsubscribe send a blank email to
>>>> xxxxx@lists.osr.com
>>>>
>>>
>>>
>>>
>>> —
>>> You are currently subscribed to ntdev as: xxxxx@telus.net
>>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>>
>>
>>
>>
>> —
>> You are currently subscribed to ntdev as: xxxxx@earthlink.net
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@telus.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

The first case I had was installing FTDI USB serial port drivers. There is
a bus driver and an inf, and a port driver and an inf. I developed this
technique using an older unsigned version of the driver, and it worked. I
then updated to the latest drivers, which are signed. However, I had to
modify the inf files to add a new OEM hardware id, and it is my
understanding this kills the signing. So I think I can definately say that
it will work with unsigned drivers. Now, you still get a popup or two about
“you idiot, you are installing an unsigned driver and the world will end!”
that the user has to deal with, but all else is automatic.

You can look at these inf files and see if they correspond to your case.
www.ftdichip.com, and dig around to download the latest windows drivers for
their serial port chip. Since they only have two products this is pretty
easy to find.

What I do is stick the drivers and infs (and an additional root enumerated
driver and inf) into a subdirectory in \Program Files\myproduct, then do
SetupCopyOEMInf on both the ftdibus.inf and ftdiport.inf files, using the
setup I described before. I then install the root driver using a somewhat
modified version of the Install.exe program from the ddk. The root driver
will later open the serial port driver when things are in use.

At that point everything works like magic on W2K and XP. Now, this doesn’t
work at all on WinME or Win98, which is a big pain, since my device has to
work on all of these systems.

Loren

----- Original Message -----
From: “Cliff Russell”
To: “NT Developers Interest List”
Sent: Monday, May 26, 2003 1:31 AM
Subject: [ntdev] Re: Driver loading

> I suspect it’s defiantly because the driver is not signed. I pretty
> sure the answer to my next question is no, but I will ask anyway. Even
> though the driver is not signed, can I prevent the dialog from
> appearing for the child devices? Is there someway of manually loading
> the driver for the devices?
>
> Cliff
>
> On Monday, May 26, 2003, at 01:18 AM, Loren Wilton wrote:
>
> > Perhaps it is signing related as others have mentioned. However, I
> > had the
> > same problem and fixed it by fiddling the parameters.
> >
> > BOOL WINAPI SetupCopyOEMInf(
> > PCTSTR SourceInfFileName,
> > PCTSTR OEMSourceMediaLocation,
> > DWORD OEMSourceMediaType,
> > DWORD CopyStyle,
> > PTSTR DestinationInfFileName,
> > DWORD DestinationInfFileNameSize,
> > PDWORD RequiredSize,
> > PTSTR DestinationInfFileNameComponent
> > );
> >
> >
> > The important trick here is to put both your inf and the driver files
> > in a
> > directory somewhere on the user’s system. Then point the first
> > parameter at
> > that inf, and the important one, the second parameter at the
> > directory
> > containing the inf and the drivers themselves. You have to leave these
> > files lying around in this directory after the install, because you
> > don’t
> > know when the hardware will first be plugged in.
> >
> > You can leave the second parameter null and the inf will be copied,
> > but then
> > you get the “where’s the drivers?” complaint when you add the
> > hardware. If
> > you set the second parameter correctly, the system finds the drivers
> > and
> > copies them silently, only giving the “found new hardware, installing
> > drivers” popup while it does the copy.
> >
> > The third parameter wants to be SPOST_PATH.
> >
> > The fourth parameter wants to be 0.
> >
> > The reamining 4 parameters can all be zero or null.
> >
> > This worked for me with a couple of different USB devices. I can’t
> > say that
> > it will work in all cases, but it seems to work for USB things.
> >
> > Loren
> >
> >
> > ----- Original Message -----
> > From: “Cliff Russell”
> > To: “NT Developers Interest List”
> > Sent: Sunday, May 25, 2003 1:33 PM
> > Subject: [ntdev] Re: Driver loading
> >
> >
> >>
> >> On Sunday, May 25, 2003, at 11:42 AM, Loren Wilton wrote:
> >>
> >>> SetupCopyOEMInf with the right parameters will copy the inf file, and
> >>> also
> >>> set the locations in the copied inf of the drivers. They will then
> >>> be
> >>> silently copied in if necessary. Which in your case won’t be
> >>> necessary.
> >>
> >> Yes, I was going to use SetupCopyOEMInf to install the INF - but even
> >> after the INF is installed (and the driver files are copied into the
> >> SYSTEM32\drivers folder), if I enumerate a device that windows hasn’t
> >> seen before, The "Found new hardware wizard comes up and I have to
> >> (more importantly the user has to) go through the steps. Basically
> >> it’s
> >> just a matter of hitting next a bunch of times - but I’d like it if I
> >> could avoid this all together.
> >>
> >>>
> >>> Loren
> >>>
> >>> ----- Original Message -----
> >>> From: “Cliff Russell”
> >>> To: “NT Developers Interest List”
> >>> Sent: Sunday, May 25, 2003 10:52 AM
> >>> Subject: [ntdev] Driver loading
> >>>
> >>>
> >>>> Hi all,
> >>>>
> >>>> I’ve written a bus driver, that enumerates a number of devices. I’ve
> >>>> also written the driver that drives the devices it enumerates. After
> >>>> the bus driver discovers the devices I get the “Windows has found
> >>>> new
> >>>> hardware wizard…”, and I have to go though and let it search for
> >>>> the
> >>>> driver.
> >>>>
> >>>> How can I stop this from happening? Windows really doesn’t need to
> >>>> look
> >>>> for other matches, there is only one possible match. In fact, the
> >>>> same
> >>>> ‘.sys’ file drives both the bus device, and the devices it
> >>>> enumerates.
> >>>>
> >>>> I am thinking/hoping that I can just make a small adjustment to the
> >>>> INF
> >>>> file, or perhaps the code that handles the IRP_MJ_PNP message.
> >>>>
> >>>> - Cliff
> >>>> xxxxx@telus.net
> >>>>
> >>>>
> >>>>
> >>>> —
> >>>> You are currently subscribed to ntdev as: xxxxx@earthlink.net
> >>>> To unsubscribe send a blank email to
> >>>> xxxxx@lists.osr.com
> >>>>
> >>>
> >>>
> >>>
> >>> —
> >>> You are currently subscribed to ntdev as: xxxxx@telus.net
> >>> To unsubscribe send a blank email to xxxxx@lists.osr.com
> >>>
> >>
> >>
> >>
> >> —
> >> You are currently subscribed to ntdev as: xxxxx@earthlink.net
> >> To unsubscribe send a blank email to xxxxx@lists.osr.com
> >>
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@telus.net
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@earthlink.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com