Question regarding building of the driver list for USB flash drives.

hi all,
In my PC, I inject 4 USB flash drives, say 1,2,3,4, and also install the vendor
driver for 1 (but not for the other three).
My first question is that which driver will be used by the drives 2,3,4. Will it be
the USBSTOR.sys driver or the vendor driver of 1.
After setting the DI_FLAGSEX_INSTALLEDDRIVER | DI_FLAGSEX_ALLOWEXCLUDEDDRVS flags by
calling SetupDiSetDeviceInstallParams(Devs, DevInfo, &deviceInstallParams), the driver list is built by using the API
WINSETUPAPI BOOL WINAPI
SetupDiBuildDriverInfoList(
IN HDEVINFO DeviceInfoSet,
IN OUT PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL
IN DWORD DriverType
);

for drive 1, will the resultant list contain two driver nodes or one.
In this case, if there is one node in the driver list, will it be regarding
USBSTOR.sys or the vendor driver or will there be two nodes.
Similarly, if the same is done for each of the 2,3,4 drives, will the resultant list
contain one driver node or two.
In the cases regarding drive nos. 2,3,4, if there is one node in the driver list,
will it be regarding USBSTOR.sys or the drive 1’s vendor driver. Otherwise can there be two nodes?
And if in all the above cases there is always one node in the driver list, then how can a driver list be produced, by using the above mentioned API, which has more than one node or in other words, can there ever be a case when the SetupDiBuildDriverInfoList AOI creates a list which contains more than one node.

Thanks & regards
Pankaj

P.S. : I have tried two build this list for a USB flash drive (without installing any vendor driver for it), and it contains one node.


Here’s a new way to find what you’re looking for - Yahoo! Answers

Pankaj Adlakha wrote:

In my PC, I inject 4 USB flash drives, say 1,2,3,4, and also install
the vendor
driver for 1 (but not for the other three).
My first question is that which driver will be used by the drives
2,3,4. Will it be
the USBSTOR.sys driver or the vendor driver of 1.

That depends on how stupid the vendor is.

The PnP system has an extensive algorithm to search for drivers. It
starts out looking for as specific a match as it can (for example, maybe
vendor ID plus product ID plus revision plus serial number). If it
doesn’t find a specific match in the INF files, it tries going more and
more general (maybe vendor ID plus product ID). If it doesn’t find a
match on the vendor and product, eventually it will try to find a match
for the device’s class (USB storage, in this case). You can actually
find the search order for a device in Device Manager, in properties, in
Details, under “Hardware Ids” and “Compatible Ids”.

If the vendor is smart, it wrote a device-specific driver that matches
just the vendor and product ID of stick #1. In that case, none of the
other devices will use it. If the vendor is stupid, it might have
written a driver for the USB storage class, in which it would be used by
all four. However, that seems quite unlikely. I’d bet money that the
vendor driver is only used for stick #1.

I’m surprised there is a vendor driver. Most USB sticks only need
vendor drivers on Windows 98.

After setting the DI_FLAGSEX_INSTALLEDDRIVER |
DI_FLAGSEX_ALLOWEXCLUDEDDRVS flags by
calling SetupDiSetDeviceInstallParams(Devs, DevInfo,
&deviceInstallParams), the driver list is built by using the API
WINSETUPAPI BOOL WINAPI
SetupDiBuildDriverInfoList(

for drive 1, will the resultant list contain two driver nodes or one.

I don’t believe that API will show you the whole stack. You’ll just see
the driver for the specific device you requested.

In this case, if there is one node in the driver list, will it be
regarding
USBSTOR.sys or the vendor driver or will there be two nodes.

I believe you’ll just see the vendor driver for stick #1, and
usbstor.sys for the others.

And if in all the above cases there is always one node in the driver
list, then how can a driver list be produced, by using the above
mentioned API, which has more than one node or in other words, can
there ever be a case when the SetupDiBuildDriverInfoList AOI creates a
list which contains more than one node.

Check the “devcon” utility in the DDK (source is included). The “devcon
stack” command will show you the driver stack for a given device. It
uses a different set of APIs.


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