Link to home
Start Free TrialLog in
Avatar of B178
B178Flag for United States of America

asked on

Location of Drivers in .inf file

This question was asked in 2002, but no satisfactory solution was offered.  I would like it re-visited.

I'm trying to include USB drivers from a third party in my VB6 Package and Deployment Wizard generated setup.  I would like the drivers to automatically install when the Hardware Wizard is initiated by plugging in the device.

I am using setup to put the .inf file in the ...\Inf directory.  By doing this I can get the Hardware Wizard to read the .inf file but I cannot seem to figure out how to modify the [SourceDisksNames] section of the .inf file to cause the installation to proceed from the hard disk.  The Hardware Wizard always asks for removable media (an installation CD).  Using setup or directly placing the .sys file in ...\system32\drivers

MSDN offers the format of the .inf file Section: [SourceDisksNames] for this type of installation as:

   diskid = disk-description[,[tag-or-cab-file],[unused,path],[flags][,tag-file]]  

But I can't get it to work.  Typically my efforts have been some permutation of:

   1="DV19_Lam2 Prompt", DV19_Lam2.,,,0x10,DV19_Lam2.CAB

I'm not sure of the syntax so I have tried most permutations of this.  And I have placed the refereced CAB file in the ....\Inf directory.  Also I have placed the files named in [SourceDisksFiles] section of the .inf file into the .../Inf folder.  The CAB file I'm using is the one generated by the VB6 Deployment Wizard and includes all the files needed for the installation.

As I mentioned this question has already been asked in 2002, but no complete or useful answer was offered:
https://www.experts-exchange.com/questions/20393962/Location-of-Drivers-in-inf-file.html

Avatar of graye
graye
Flag of United States of America image

Hang on.... INF files don't use CAB files.   They typically point directly to the *.SYS file (plus lot of other stuff, typically related to the registry keys)
So, a typical device driver installation would include putting the INF in the C:\windows\inf directory and putting the SYS file in c:\windows\system32\drivers.
To look at it another way, CAB are to be processes so the files within them are installed... but the CAB file itself is never "installed"
Avatar of B178

ASKER

The MSDN knowledge Base article that I have been reading suggests the use of .cab files for this task.
http://msdn.microsoft.com/en-us/library/ms794354.aspx

I'm not sure if they are referring to the CAB file that I have from my Deployment Wizard or if there is some other CAB and/or TAG file.  I don't know how to make a TAG file.

I have tried manually putting the necessary .SYS file into the c:\windows\system32\drivers folder but that does not seem to do the trick.  It must need to be registered or something?  This is what I don't know how to do.  The Hardware Wizard is ignoring the *.sys file no matter where I put it (except on the external media).
Consider the CAB file as a container for other files...   Sure,  you can put the INF and SYS files into a CAB file.... then later  you can install the *contents* of the CAB file into their appropriate locations.   But you'd never need to put the CAB file in c:\windows\system32\drivers
So show us the contents of the INF file you've got now....  
Avatar of B178

ASKER

The installation .inf provided by Mightex is attached.  

The lines I have been working with are in the code snippet.

The Mightex install software does not include MtUsbMe.sys, or MtUsb.spd.  The only file that seems important is MtUsb.sys.  Which as I mentioned, only seems to be useful if it has been put into ...\system32\dirvers at the behest of Mtusb.inf.
[SourceDisksNames]
1=%MTUSB_INSTALL%,,,
 
[SourceDisksFiles]
MtUsbME.sys = 1
MtUsb.sys = 1
MtUsb.spd = 1

Open in new window

Mtusb.txt
SOLUTION
Avatar of graye
graye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of B178

ASKER

As you suggested:
I took out the SourceDiskNames and SourceDiskFiles sections completely.  I used the setup.exe / setup.lst / .CAB files as generated by my Deployment Wizard to install the Mtusb.inf  into \Windows\INF and Mtusb.sys into \Windows\system32\drivers.  I verified the placement of files after running setup.exe and made the changes to Mtusb.inf before running plugging in my USB Video camera that causes the Hardware Wizard to run.

The Hardware Install Wizard worked until it was time to get the .sys file then it reports:
The file 'Mtusb.sys' on [Unknown] is needed.
Type the path where the file is located, and then click OK

By the way, I'm using a cloned version of XPpro SP2 as an installation workbench.  So the OS has not been corrupted by other installation attempts.  I have attached my setup.lst file.  The lines in the .lst file that place the MtUsb.sys and Mtusb.inf files are shown in the code snippet.
File21=@MtUsb.sys,$(WinSysPath)\DRIVERS,,$(Shared),1/24/08 9:17:33 AM,31872,1.7.0.0
File22=@Mtusb.inf,$(WinPath)\INF,,,1/24/08 9:17:33 AM,2114,0.0.0.0

Open in new window

SETUP-lst.txt
Sorry, I don't know what to try next...
SOLUTION
Avatar of matrixnz
matrixnz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of B178

ASKER

matrixnz, thank you for your suggestion.  The drivers are pnp.

Sound like what I'm looking for, but I'm not sure how to make the registry entry.  I know how to make entries with VB6 code, but is there a simple way to do it with the setup package (say with an entry into setup.lst)?  Or is there a way to use the VB6 Package and Deployment wizard to cause the registry key entry?  Of course, I can look elsewhere for the answers to these questions, but I thought you might be able to say a few quick words that would save me lots of work.

Cheers
Avatar of matrixnz
matrixnz

Hi B178

Don't really know VB6 very well, just enough to get by =)

Anyway hopefully the code below will give you a couple of ideas, basically:
Read the Registry
Check for Semicolon ";"
 - If no SemiColon append it along with your PnP Drivers Path
 - If SemiColon is present just append the PnP Drivers Path

Hope that made sense.

Cheers
Dim Var1, Var2, Var3
Var1 = RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\DevicePath")
Var2 = Right(Var1, 1)
If Not Var2 = ";" Then
	Var3 = RegWrite("HKLM\Software\Microsoft\Windows\CurrentVersion\DevicePath",Var1 & ";<Path To PnP Driver>;")
Else
	Var3 = RegWrite("HKLM\Software\Microsoft\Windows\CurrentVersion\DevicePath",Var1 & "<Path To PnP Driver>;")
End If
 
Private Function RegRead(regpath)
    Dim objShl
    Set objShl = CreateObject("wscript.shell")
    RegRead = objShl.RegRead(regpath)
    Set objShl = Nothing
End Function
 
Private Function RegWrite(regpath,regvalue)
    Dim objShl
    Set objShl = CreateObject("wscript.shell")
    RegWrite = objShl.RegWrite(regpath,regvalue)
    Set objShl = Nothing
End Function

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi B178

I'd suggest you leave the SourceDiskName and SourceDiskFiles in place, than it will be completely plug n play, the end user shouldn't have to answer any questions. Usually if I'm releasing a piece of hardware for example a USB Camera or a Video Card I place the driver into a directory in Windows for example:
C:\Windows\Logitech
The Logitech folder should include the Cat file, the inf file and any Sys Files, than change the DevicePath key with your driver folder.  Than as soon as the user plugs in their device Plug n Play should kick in and install the hardware automatically.

Cheers
Avatar of B178

ASKER

I'm still working on the late suggestion from matrixnz.  I'd like to continue a bit longer.
B178
Avatar of B178

ASKER

Hi,

As long as I make the change to the DevicePath it does not matter wether I have the SourceDiskName and SourceDiskFiles in place or not.  I get the same action& the Hardware Wizard starts, you answer with the defaults, the Wizard installs everything and off you go.  Im not sure what advantage there is to leaving the SourceDiskName and SourceDiskFiles in place.

Cheers
So are you saying without the SourceDiskname and SourceDiskFiles it still works?  I wouldn't think it would, you may want to try this on a clean machine without the driver installed previously.  I know that the SourcediskFiles section tells the OS where and what files to copy into the System32 and inf directories, (that is during plug n play) the inf uses relavant paths to point to the files requiring copying.

Cheers
Avatar of B178

ASKER

I have been working on my installation test bench.  I have a multiple drive machine with an ability to clone the OS to get a fresh start for each installation trial.  All my installation attempts have had the benefit of the clearity this tool can provide.

So I have have been able to try clean installations with and without the SourceDiskName and SourceDiskFiles.  Seems to make no difference.  I'm thinking that the once the Hardware Wiz gets to the .inf file on its own terms (through DevicePath) and finds .sys in the same location, then pretty much the rest does not matter.

Cheers