Install usb driver using InstallShield

  1. I am trying to register the Dll in Installshield based on the Hardware
    Info(USB\VID_12C1).

-> I want to know the device ID of the USB device connected to PC.
Then I want to fetch the USB device info into separate file.

-> From installshield I will pass the USB vendor ID to text file
and fetch the USB info.

-> Whether it is possible to do it in Installshield.

In following way trying to get the device ID.

-> While installing the Installer trying to execute “devcon.exe hwids *”
through LaunchAppandwait Api. It will list the number of devices connected
to my PC. I want to save the device list in text file.

szProgram = WINDIR ^ “temp” ^ “New” ^ “devcon.exe”;
szCmdLine = " hwids *";
nvResult = LaunchAppAndWait(szProgram, szCmdLine, LAAW_OPTION_WAIT);
if (nvResult = 0) then
MessageBox (“ERROR: application created successfully”, INFORMATION);
// ;
else
MessageBox (“ERROR: application”, INFORMATION);
endif;

ISSUE: -> Unable to store the result in text file.

Please provide some ideas to store the device list into file and fetch
the required device list.

Are you trying to install a driver that matches a specific piece of hardware? If yes, just import the driver package. There is no need to scan the system.

And you are not allowed to redistribute devcon.

d

Bent from my phone


From: xxxxx@lists.osr.com on behalf of xxxxx@gmail.com
Sent: Thursday, June 8, 2017 5:31:55 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Install usb driver using InstallShield

1) I am trying to register the Dll in Installshield based on the Hardware
Info(USB\VID_12C1).

-> I want to know the device ID of the USB device connected to PC.
Then I want to fetch the USB device info into separate file.

-> From installshield I will pass the USB vendor ID to text file
and fetch the USB info.

-> Whether it is possible to do it in Installshield.

In following way trying to get the device ID.

-> While installing the Installer trying to execute “devcon.exe hwids *”
through LaunchAppandwait Api. It will list the number of devices connected
to my PC. I want to save the device list in text file.

szProgram = WINDIR ^ “temp” ^ “New” ^ “devcon.exe”;
szCmdLine = " hwids *";
nvResult = LaunchAppAndWait(szProgram, szCmdLine, LAAW_OPTION_WAIT);
if (nvResult = 0) then
MessageBox (“ERROR: application created successfully”, INFORMATION);
// ;
else
MessageBox (“ERROR: application”, INFORMATION);
endif;

ISSUE: -> Unable to store the result in text file.

Please provide some ideas to store the device list into file and fetch
the required device list.


NTDEV is sponsored by OSR

Visit the list online at: https:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at https:

To unsubscribe, visit the List Server section of OSR Online at https:</https:></https:></https:>

xxxxx@gmail.com wrote:

  1. I am trying to register the Dll in Installshield based on the Hardware
    Info(USB\VID_12C1).

-> I want to know the device ID of the USB device connected to PC.
Then I want to fetch the USB device info into separate file.

-> From installshield I will pass the USB vendor ID to text file
and fetch the USB info.

-> Whether it is possible to do it in Installshield.

What are you actually writing here? Is this an installer for an
application? Or is this the installer for your driver? If this is the
installer for your driver, then why don’t you have the INF copy the DLL
into place and do the registration? That way, selection by VID and PID
comes automatically.

If this is an installer for an application, then why not just do the
registration unconditionally, and make the DLL respond reasonably if the
device is not present? What happens if they run your installer, then
unplug the device? The DLL has to be able to handle a missing device
anyway.

You could, I suppose, add code in your DLL in DllRegisterServer. Use
the SetupDi APIs to enumerate the USB devices, and if you don’t find one
you like, just return without doing any registration, but that would
break the scenario where they plug the device in later.

As a final alternative, you can certainly add an additional entry point
to your DLL that searches for the device using the SetupDi APIs and
returns a value, and then call that DLL entry point from InstallShield.
That way, you have the full power of C++.

In following way trying to get the device ID.

-> While installing the Installer trying to execute “devcon.exe hwids *”
through LaunchAppandwait Api. It will list the number of devices connected
to my PC. I want to save the device list in text file.

As opposed to, say, “devcon find USB\VID_12C1*”?

szProgram = WINDIR ^ “temp” ^ “New” ^ “devcon.exe”;
szCmdLine = " hwids *";
nvResult = LaunchAppAndWait(szProgram, szCmdLine, LAAW_OPTION_WAIT);
if (nvResult = 0) then
MessageBox (“ERROR: application created successfully”, INFORMATION);

Why is having the application created successfully an ERROR?

Please provide some ideas to store the device list into file and fetch
the required device list.

InstallShield was not designed to do this kind of processing. And as
Doron said, you’re not allowed to distribute “devcon” with your package.


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

PCI\VEN_8086&DEV_3B56&SUBSYS_304A103C\3&21436425&0&D8
Name: High Definition Audio Controller
Hardware ID’s:
PCI\VEN_8086&DEV_3B56&SUBSYS_304A103C&REV_05
PCI\VEN_8086&DEV_3B56&SUBSYS_304A103C
PCI\VEN_8086&DEV_3B56&CC_040300
PCI\VEN_8086&DEV_3B56&CC_0403

USB\VID_046D&PID_C31D\6&339B49C&0&4
Name: USB Composite Device
USB\VID_046D&PID_C31D&REV_6601
USB\VID_046D&PID_C31D
USB\DevClass_00&SubClass_00&Prot_00
USB\DevClass_00&SubClass_00
USB\DevClass_00
USB\COMPOSITE

What I am trying to do is I want to read the “Revision(REV_05)” from text file
by passing the hardware ID as “PCI\VEN_8086&DEV_3B56&SUBSYS_304A103C&”.

I opened the opened the sample.txt
szDevID1 = “PCI\VEN_8086&DEV_3B56&SUBSYS_304A103C”;
OpenFileMode(FILE_MODE_NORMAL);
OpenFile(FileHandle,TempDir, “sample.txt”);
while(GetLine(FileHandle, ReturnLine) = 0)
nvPosition = StrFind(svReturnLine, szDevID1);
lsTokens = ListCreate (STRINGLIST);
StrGetTokens (lsToken, svReturnLine, “&”);
ListSetIndex (lsToken, 1);
nresult = ListCurrentString (lsTokens_t, szsample);
if(nresult = 0)then
MessageBox(":FINAL: szsample " + szsample, INFORMATION);
/* I am expecting szsample as REV_05 */
endif;
end while;

Provide any ideas to get the revision ID by passing the “PCI\VEN_8086&DEV_3B56&SUBSYS_304A103C&” to the text file.

xxxxx@gmail.com wrote:

PCI\VEN_8086&DEV_3B56&SUBSYS_304A103C\3&21436425&0&D8
Name: High Definition Audio Controller
Hardware ID’s:
PCI\VEN_8086&DEV_3B56&SUBSYS_304A103C&REV_05
PCI\VEN_8086&DEV_3B56&SUBSYS_304A103C
PCI\VEN_8086&DEV_3B56&CC_040300
PCI\VEN_8086&DEV_3B56&CC_0403

What I am trying to do is I want to read the “Revision(REV_05)” from text file
by passing the hardware ID as “PCI\VEN_8086&DEV_3B56&SUBSYS_304A103C&”.

If you are installing a USB driver, why do you care about the revision
of the HDAudio controller?

szDevID1 = “PCI\VEN_8086&DEV_3B56&SUBSYS_304A103C”;
OpenFileMode(FILE_MODE_NORMAL);
OpenFile(FileHandle,TempDir, “sample.txt”);
while(GetLine(FileHandle, ReturnLine) = 0)
nvPosition = StrFind(svReturnLine, szDevID1);

You don’t ever check the result of the StrFind operation here. I assume
you actually want this instead:
if( svReturnLine % szDevID1 )

lsTokens = ListCreate (STRINGLIST);
StrGetTokens (lsToken, svReturnLine, “&”);
ListSetIndex (lsToken, 1);
nresult = ListCurrentString (lsTokens_t, szsample);
if(nresult = 0)then
MessageBox(":FINAL: szsample " + szsample, INFORMATION);
/* I am expecting szsample as REV_05 */

Why would you be expecting that? You told it you wanted the second
token, which would be DEV_3B56. If you want the last token, then you
need to do
ListSetIndex (lsToken, LISTLAST);

I hope you have been paying attention to the multiple people who have
told you that it is illegal for you to ship devcon.exe with your installer.


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