Use the Master.inf file in the %SDKDIR%\Readmes directory as a template for creating a .inf file. The Master.inf file is heavily commented and includes placeholders for required information.
To create your .inf file
run=extrac32.exe /e /a /y /l %49000% CabFileName.cab
[hook2] ; Change the name of master.inf to the name you are assigning this ; file. Leave the second line alone. InfFile=master.inf InfSection=RegistryData
[Strings] ; Running guidgen in the SDK generates the ClassId you need to fill ; in here. This classId also goes in the OBJECT tag. ; Don't forget the set braces! ClassId="{99999999-9999-9999-9999-999999999999}"
; Put the name by which your packages should be referred to ; (for example, "My Text Viewer") here. PackageName="name"
; If you use one of these, you will use exactly one. HKLM,"SOFTWARE\Classes\CLSID\%ClassId%\InProcServer32","Lib",, "%49000%" ;HKLM,"SOFTWARE\Classes\CLSID\%ClassId%\InProcServer32", "TrustedLib",,"%49000%"
; Replace <aa...> with the version number (like 1,0,0,1) of this ; version of your library. This is so that when you want to update ; your libraries, you can change the version rather than the ; classId and its associated problems. If the version number here ; and in the OBJECT tag match the version already stored on the ; user's computer, it will not download the classes again, which ; also saves time and energy. HKLM,"SOFTWARE\Classes\CLSID\%ClassId%\InstalledVersion",,, "aa,bb,cc,dd"
; Here, replace <file name> with the name of one of the ; class files in your package, including the virtual path ; (specified in classpck.ddf) ; to that file. This will make sure that the classes exist on the ; user's system; if they don't, they will be downloaded, ; regardless of version numbers. HKLM,"Software\Classes\CLSID\%ClassId%\InstalledVersion","Path",, "%49000%\<filename>"
;; If you are installing native code, you will want to uncomment ;; all the lines in the remainder of this section, except for the ;; ones that are descriptive (and have two semicolons). ; CopyFiles=OtherFiles ;[DestinationDirs] ;OtherFiles=11 ;[OtherFiles] ;; List the name of each file (delimited by returns) here. ;; Just list the local name--no need for paths, and so on. Example: ;; foo1.dll,,,32 ;; foo2.dll,,,32 ;[SourceDisksFiles] ;; For each name listed in the above section, you will want to put ;; <file name>=1 on this list. So it would look like this: ;; foo1.dll=1 ;; foo2.dll=1 ;[SourceDisksNames] ;1=%PackageName%,"",0
The following code excerpt shows the mandatory edits made in a .inf file called Sample.inf:
[hook1] ; In this line, replace CabFileName.cab with the inner .cab file name ; that contains your classes. run=extrac32.exe /e /a /y /l %49000% MyClasses.cab [hook2] ; Change the name of master.inf to the name you are assigning to this ; file. Leave the second line alone. InfFile=Sample.inf InfSection=RegistryData [Strings] ; Running Guidgen in the SDK generates the ClassId you need to fill ; in here. This classId also goes in the OBJECT tag. ; Don't forget the set braces! ClassId="{4439E200-6FCC-11d0-89AA-00A0C9054129}" ; Put the name by which your packages should be referred to ; (for example, "My Text Viewer") here. PackageName="My Sample Java Classes"