Solved

Location of Drivers in .inf file

Posted on 2009-07-14
16
1,521 Views
Last Modified: 2013-12-04
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
Comment
Question by:B178
  • 8
  • 4
  • 4
16 Comments
 
LVL 41

Expert Comment

by:graye
ID: 24851108
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
 

Author Comment

by:B178
ID: 24853756
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
 
LVL 41

Expert Comment

by:graye
ID: 24854570
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
 

Author Comment

by:B178
ID: 24855272
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
 
LVL 41

Assisted Solution

by:graye
graye earned 120 total points
ID: 24855754
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
 

Author Comment

by:B178
ID: 24859080
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
 
LVL 41

Expert Comment

by:graye
ID: 24861854
Sorry, I don't know what to try next...
0
 
LVL 29

Assisted Solution

by:matrixnz
matrixnz earned 320 total points
ID: 24877997
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:B178
ID: 24895185
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
 
LVL 29

Expert Comment

by:matrixnz
ID: 24897660
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
 

Accepted Solution

by:
B178 earned 0 total points
ID: 24934699
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
 
LVL 29

Expert Comment

by:matrixnz
ID: 24934770
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
 

Author Comment

by:B178
ID: 24964747
I'm still working on the late suggestion from matrixnz.  I'd like to continue a bit longer.
B178
0
 

Author Comment

by:B178
ID: 24965284
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
 
LVL 29

Expert Comment

by:matrixnz
ID: 24966391
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
 

Author Comment

by:B178
ID: 24966727
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I have been scripting applications way too long and can never remember how to create an ISS file.  So I decided to write this article to act as my own knowledge base for future reference, and hope you will also benefit. An ISS file is a response …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now