Newsgroups : Microsoft : microsoft.public.inetsdk.programming.wininet : 2004 Nov : How do I use an .inf file to copy a dll from a .cab to a specific folder and the
| Subject: | How do I use an .inf file to copy a dll from a .cab to a specific folder and the |
| Posted by: | hankdm..@hotmail.com |
| Date: | 3 Nov 2004 21:34:59 |
I'd like to include foo.dll in a cab file. Upon the user downloading
my .cab file, I'd like to copy foo.dll from the .cab to a specific
folder (i.e., "C:\Program Files\MyFolder") and then register the dll.
Say my .inf file, which is included in my .cab file, looks like this:
;installation information sections
[DestinationDirs]
InstallFilesSection = -1, "C:\Program Files\MyFolder"
[Add.Code]
foo.dll=foo.dll
;source location for specified platform version
[foo.dll]
file-win32-x86=thiscab
FileVersion=1,0,0,0
clsid={xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
RegisterServer=yes
The dll gets downloaded and registered all right, but it does not get
put into "C:\Program Files\MyFolder" as I'd like. As per the
documentation, files in the [Add.Code] section cannot be put in just
any location. The DestDir key can be used to specify that the file be
copied to either the \Windows directory, the \Windows\System directory
or the \Cache directory (the latter is the default).
Fine, suppose I change the .inf file to look like this:
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
;installation information sections
[DestinationDirs]
InstallFilesSection = -1, "C:\Program Files\MyFolder"
[DefaultInstall]
CopyFiles=InstallFilesSection
RegisterDlls=RegisterMyDll
;files to be copied to the user's machine
[InstallFilesSection]
foo.dll=foo.dll
;source location for specified platform version
[foo.dll]
file-win32-x86=thiscab
FileVersion=1,0,0,0
clsid={xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
[RegisterMyDll]
-1,"C:\Program Files\MyFolder",foo.dll,1
If I right-click on the .inf file and select "Install", everything
works like a charm. foo.dll is copied to "C:\Program Files\MyFolder"
and is registered.
However, if I use this inf in my cab and then download the cab from my
website, foo.dll is copied to the right place, but it is not
registered. I could manually register it via the setting of
individual registry keys, but I prefer to use the built in
registration mechanism (i.e., the call to DllRegisterServer). I tried
adding RegisterServer=yes to the foo.dll section above, but that
didn't work.
Any ideas? Any recommended reading on the topic? The information I
found on msdn wasn't helpful.
Thanks!