Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to install drivers from .inf file?

847 views
Skip to first unread message

siedem

unread,
Jan 7, 2004, 11:09:31 AM1/7/04
to
Hi

I have to prepare .msi install file. I have to put some drivers into system.
Drivers has .inf files. I tried to prepare .bat file with sth like this:
%SystemRoot%\System32\rundll32.exe setupapi,InstallHinfSection
DefaultInstall 132 ftdibus.inf

but it doesn't work. I got an error: Installation failed
What's wrong with that and how to do it?

thanks in advance
P.


Stefan Krueger [MVP]

unread,
Jan 7, 2004, 2:35:44 PM1/7/04
to
Does that bat file work outside of yur setup?
Did you specify to ignore the return value from the bat when you created the
custom action?

--
Stefan Krueger
Microsoft Windows Installer MVP

Please post your questions in the newsgroup or vist one of these web sites:

Windows Installer FAQ
http://www.msifaq.com - http://www.msifaq.de

InstallSite - Resources for Setup Developers
http://www.installsite.org
http://www.installsite.de (GERMAN)

"siedem" <psio...@aiut.com.pl> schrieb im Newsbeitrag
news:ON8fkiT1...@TK2MSFTNGP11.phx.gbl...

Darin Rousseau

unread,
Jan 7, 2004, 8:15:40 PM1/7/04
to
I have done this numerous times; it took me a couple of days to figure out
the exact routine...

First, use SetupCopyOEMInfA to copy the INF file into windows.
Then, use SetupOpenInfFileA to open the file.
Use the handle in a call to SetupInstallFromInfSection, and tell it to
install SPINST_ALL.
If you have any services in the INF file, use
SetupInstallServicesFromInfSection to install them.

and then use SetupDiInstallClass (if you have any custom device classes to
install. If you are using a standard device class, the class installer for
that device will do the job for you). Let me know if you are installing a
device with a new class, and I can go through the installation methods for a
class installer.

I have tested this with W2K and WXP. It should also work for W2K3, but
hasn't been thoroughly tested yet.

--

Darin Rousseau
DarinR...@fssinet.net
Fundamental Software Solutions Inc
http://www.fssinet.net/

"siedem" <psio...@aiut.com.pl> wrote in message
news:ON8fkiT1...@TK2MSFTNGP11.phx.gbl...

siedem

unread,
Jan 8, 2004, 2:35:48 AM1/8/04
to
well, i have corrected my script to:
%SystemRoot%\System32\rundll32.exe setupapi,InstallHinfSection
DefaultInstall 132 .\ftdibus.inf

and it works - i don't get any error, but i have still problem,
this inf isn't full - i think - and it doesn't execute proper actions like
copying files and writting to registry...
mayby i need any special section in .inf file to do this actions? inf looks
like this:

; FTDIBUS.INF
; Copyright (c) 2000-2003 FTDI Ltd.

[Version]
signature="$CHICAGO$"
Class=USB
ClassGUID={36fc9e60-c465-11cf-8056-444553540000}
Provider=%FTDI%
CatalogFile=ftdibus.cat
DriverVer=02/25/2003,1.00.2115

[SourceDisksNames]
1=%DriversDisk%,,,

[SourceDisksFiles]
ftcomms.vxd = 1
ftserial.sys = 1
ftsenum.vxd = 1
ftsenum.sys = 1
ftsermou.vxd = 1
ftserui.dll = 1
ftdibus.sys = 1
ftdiunin.exe = 1
ftdiunin.ini = 1
ftdiun2k.ini = 1

[DestinationDirs]
FtdiBus.Copy1 = 11
FtdiBus.Copy2 = 17
FtdiBus.NT.Copy = 10,system32\drivers
FtdiBus.NT.Copy2 = 11

[Manufacturer]
%Ftdi%=FtdiHw

[FtdiHw]
%USB\VID_0403&PID_8372.DeviceDesc%=FtdiBus,USB\VID_0403&PID_8372
%USB\VID_0403&PID_6001.DeviceDesc%=FtdiBus,USB\VID_0403&PID_6001

[ControlFlags]
ExcludeFromSelect=USB\VID_0403&PID_8372
ExcludeFromSelect=USB\VID_0403&PID_6001

[FtdiBus]
CopyFiles=FtdiBus.Copy1,FtdiBus.Copy2
AddReg=FtdiBus.AddReg, FtdiBusUnInst.Reg
RemoveDevice=FtdiBus.RemDev

[FtdiBus.HW]
AddReg=FtdiBus.AddReg.HW

[FtdiBus.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,ftserial.sys

[FtdiBus.AddReg.HW]
HKR,,"UpperFilters",0x00010000,"ftsenum.sys"

[FtdiBus.Copy1]
ftcomms.vxd
ftsenum.vxd
ftsermou.vxd
ftserial.sys
ftsenum.sys
ftserui.dll
ftdiunin.exe
ftdiunin.ini

[FtdiBus.Copy2]
ftdibus.inf
ftdiport.inf
ftsermou.inf

[FtdiBus.RemDev]
DelFiles=FtdiBus.Delfiles
DELKEY=HKLM,%WINUN%\FTDICOMM

[FtdiBusUnInst.Reg]
HKLM,%WINUN%,"FTDICOMM"
HKLM,%WINUN%\FTDICOMM , "UninstallString",,"%11%\ftdiunin.exe
%11%\ftdiunin.ini"
HKLM,%WINUN%\FTDICOMM , "DisplayName",,"FTDI USB-to-Serial Converter
Drivers"

[FtdiBus.DelFiles]
FTCOMMS.VXD
ftsenum.vxd
ftsermou.vxd
FTSERIAL.SYS
FTPORTS.INF
FTDICOM.INF
ftdibus.inf
ftdiport.inf
ftsenum.sys
ftserui.dll
ftdiunin.exe
ftdiunin.ini

;---------------------------------------------------------------;
; For Win2000 ...
;

[FtdiBus.NT]
CopyFiles=FtdiBus.NT.Copy,FtdiBus.NT.Copy2
AddReg=FtdiBus.NT.AddReg,FtdiBusUnInst.NT.Reg

[FtdiBus.NT.Services]
AddService = FTDIBUS, 0x00000002, FtdiBus_AddService

[FtdiBus_AddService]
DisplayName = %FtdiBus.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\system32\drivers\ftdibus.sys
LoadOrderGroup = Base
AddReg = FtdiBus_AddService.AddReg

[FtdiBus.NT.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,ftdibus.sys

[FtdiBus_AddService.AddReg]
HKR,Parameters,"MaximumTransferSize",0x10001,4096
HKR,Parameters,"DebugLevel",0x10001,2

[FtdiBus.NT.Copy]
ftdibus.sys

[FtdiBus.NT.Copy2]
ftdiunin.exe
ftdiun2k.ini

[FtdiBusUnInst.NT.Reg]
HKLM,%WINUN%,"FTDICOMM"
HKLM,%WINUN%\FTDICOMM , "UninstallString",,"%11%\ftdiunin.exe
%11%\ftdiun2k.ini"
HKLM,%WINUN%\FTDICOMM , "DisplayName",,"FTDI USB Serial Converter Drivers"

;---------------------------------------------------------------;

[Strings]
Ftdi="FTDI"
DriversDisk="FTDI USB Drivers Disk"
USB\VID_0403&PID_8372.DeviceDesc="USB Serial Converter"
USB\VID_0403&PID_6001.DeviceDesc="USB High Speed Serial Converter"
WINUN="Software\Microsoft\Windows\CurrentVersion\Uninstall"
FtdiBus.SvcDesc="USB Serial Converter Driver"

"Stefan Krueger [MVP]" <ms0...@nwsgrp.REMOVETHIS.installsite.net> wrote in
message news:u2sCnXV1...@tk2msftngp13.phx.gbl...

siedem

unread,
Jan 8, 2004, 2:49:31 AM1/8/04
to
well. a wouldn't like to do this from c++, c code, I would prefer use shell
commands
is it possible?

"Darin Rousseau" <DSR.N...@fssinet.net> wrote in message
news:%233lkmTY...@TK2MSFTNGP09.phx.gbl...

Stefan Krueger [MVP]

unread,
Jan 8, 2004, 9:54:58 AM1/8/04
to
There are two different kinds of .inf files. Some are used for installation
of tools or small updates (but this kind is getting rare these days). They
include a [DefaultInstall] section.
The other kind is used for driver installation and doesn't include a
[DefaultInstall] section.
Only the first kind can be run using rundll32/setupapi, not the second kind.
Your .inf file appears to be of the second kind so this method doesn't work.

You could use the method that Darin has suggested. For plug&play devices it
may be sufficient to copy the .inf file to the INF folder _before_
connecting the device. Windows will then automatically install the driver
when you connect the device.

--
Stefan Krueger
Microsoft Windows Installer MVP

Please post your questions in the newsgroup or vist one of these web sites:

InstallSite - Resources for Setup Developers
http://www.installsite.org
http://www.installsite.de (GERMAN)


"siedem" <psio...@aiut.com.pl> schrieb im Newsbeitrag

news:uQkiMob1...@TK2MSFTNGP12.phx.gbl...

Darin Rousseau

unread,
Jan 9, 2004, 2:47:05 AM1/9/04
to
I thought the exact same way you did originally, and only after a half-day
of inspection on the Rundll methods did I determine that if there was a way,
it wasn't going to announce itself to me. Installing the INF, installing
the driver, and then finally PNP enumeration to load the driver were very
different and only the first seemed to be accomplished by the Rundll methods
you mentioned previously.

I know that many INF's can be installed with shell commands, but
unfortunately my customers' drivers or INF's never seemed to work with a
single simple call like that. (no matter how much I prayed to the PNP gods)

Although I haven't worked on USB devices, your INF has the same components
as my class driver, with the exception of the Windows 9x drivers. The
compatibility for that platform would have to be checked against the
SetupDDI functions, but I think a corresponding call is available for each
(they are all pretty standard)


PS, any thought about contracting out the job?
--

Darin Rousseau
DarinR...@fssinet.net
Fundamental Software Solutions Inc
http://www.fssinet.net/

"siedem" <psio...@aiut.com.pl> wrote in message

news:Oy423vb1...@TK2MSFTNGP09.phx.gbl...

siedem

unread,
Jan 9, 2004, 10:26:13 AM1/9/04
to
well i did installing drivers - added section [DefaultInstall.NT] to inf
file
but now i have other problem - i can't create modem in system, i tried do it
with .inf file but it didn't worked
could you help me with this?

"Darin Rousseau" <DSR.N...@fssinet.net> wrote in message

news:%23VFM8So...@TK2MSFTNGP10.phx.gbl...

Darin Rousseau

unread,
Jan 9, 2004, 3:09:23 PM1/9/04
to
The only way I know of to do that manually is with a tool like DevCon (in
the WinXP DDK), which allows you to install a device, with the following:

devcon INSTALL <inf file> <device id>

The source code is available for devcon in the DDK, so you can tailor that
as required for an MSI custom action. Unfortunately that doesn't really
solve the problem with a rundll command or other shell command as you
requested earlier.

--

Darin Rousseau
DarinR...@fssinet.net
Fundamental Software Solutions Inc
http://www.fssinet.net/

"siedem" <psio...@aiut.com.pl> wrote in message

news:%2308FuTs...@TK2MSFTNGP11.phx.gbl...

siedem

unread,
Jan 12, 2004, 3:57:12 AM1/12/04
to
ok, i will try id, mayby it helps
and another one question:
how to create dial up connections? also manually....

"Darin Rousseau" <DSR.N...@fssinet.net> wrote in message

news:uC$bsxu1D...@TK2MSFTNGP10.phx.gbl...

siedem

unread,
Jan 12, 2004, 6:41:16 AM1/12/04
to
well, i have prepared .inf file
it works if i use add new modem wizard, it's adding a modem and everyging
seems to be ok
but i can't do it with devcon....
i got error: devcon failed
after using: devcon install modem_light.inf gprs

"siedem" <psio...@aiut.com.pl> wrote in message

news:%238ovXoO...@tk2msftngp13.phx.gbl...

siedem

unread,
Jan 12, 2004, 9:06:50 AM1/12/04
to
could you send me an example using this functions?

"Darin Rousseau" <DSR.N...@fssinet.net> wrote in message
news:%233lkmTY...@TK2MSFTNGP09.phx.gbl...

0 new messages