Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1681
  • Last Modified:

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:
http://www.experts-exchange.com/Programming/System/Windows__Programming/Q_20393962.html

0
B178
Asked:
B178
  • 8
  • 4
  • 4
3 Solutions
 
grayeCommented:
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"
0
 
B178Author Commented:
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).
0
 
grayeCommented:
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....  
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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.
[SourceDisksNames]
1=%MTUSB_INSTALL%,,,
 
[SourceDisksFiles]
MtUsbME.sys = 1
MtUsb.sys = 1
MtUsb.spd = 1

Open in new window

Mtusb.txt
0
 
grayeCommented:
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
 
 
0
 
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,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
0
 
grayeCommented:
Sorry, I don't know what to try next...
0
 
matrixnzCommented:
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.

Cheers
0
 
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.

Cheers
0
 
matrixnzCommented:
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

0
 
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.
Cheers
0
 
matrixnzCommented:
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
0
 
B178Author Commented:
I'm still working on the late suggestion from matrixnz.  I'd like to continue a bit longer.
B178
0
 
B178Author Commented:
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
0
 
matrixnzCommented:
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
0
 
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.

Cheers
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now