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:

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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"
B178Author Commented:
The MSDN knowledge Base article that I have been reading suggests the use of .cab files for this task.

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....  
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

B178Author Commented:
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.
MtUsbME.sys = 1
MtUsb.sys = 1
MtUsb.spd = 1

Open in new window

OK... let's try this...
Take out both the SourceDiskName and SourceDiskFiles sections completely...  and have the installer place the files in the correct locations
B178Author Commented:
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,
File22=@Mtusb.inf,$(WinPath)\INF,,,1/24/08 9:17:33 AM,2114,

Open in new window

Sorry, I don't know what to try next...
If the drivers are pnp then you could try the following, add the folder to your app directory or to another directory say in Windows then append the path to the end of the DevicePath under HKLM\Software\Microsoft\Windows\CurrentVersion than plug n play will find the drivers and install them correctly.

B178Author Commented:
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.

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.

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>;")
	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

B178Author Commented:
Matixnz, graye,
I'm almost there:

graye:  I took your suggestion to remove SourceDiskName and SourceDiskFiles sections completely.  

Matrixnz: I took your suggestion to use put the .inf and .sys files in a directory of my choosing (I used winpath\..\drivers aka c:\drivers) with my setup.lst generated the the VB Deployment Wizard. AND I modified the HKLM\......\devicepath to include c:\drivers.

Now all my customer needs to do is answer all the Hardware Install Wizard questions with the usual default answers.
I plan to modify setup1.vbp setup1.frm form_load event with code to make the registry entry.  After I win that battle I will have a complete solution to my whole problem.  
Meanwhile, I intend to close this thread because I found another that deals with modifying setup1.
Thanks to both of you.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day 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:
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.

B178Author Commented:
I'm still working on the late suggestion from matrixnz.  I'd like to continue a bit longer.
B178Author Commented:

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.

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.

B178Author Commented:
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.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.