Mar 9th, 2013, 05:49 PM
VB6 - Msms2Libs: Extract VS6/VB6 MSMs to Libraries
Those who package and deploy VB6 Projects using Windows Installer tools that create MSI packages have the luxury of using Microsoft-built stable redistributable Merge Modules that contain the VB6-supplied OCXs and DLLs. But to get this stability when using a scripted setup maker such as the PDW it can be harder to come up with a source for them.
When you package applications you really don't want to use the "live" versions of these libraries, i.e. the versions installed and registered on your development system. The main reason is that you shouldn't try to install a version that is newer than the baseline version for the last Service Pack: now SP6 for VS6/VB6.
The PDW has a Redist folder, typically at:
C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\Redist
When you install VS/VB this folder gets created and a basic set of files is placed there, but you the programmer are supposed to ensure that these files are updated appropriately and new files added over time. When files are placed here the PDW will use these versions for packaging your application instead of taking them from the "live" locations (System32, Program Files\Common Files, etc.).
There are several MS KB articles that cover this as well as related issues. Here are a few:
Best practices for deploying Visual Basic 6.0 applications
INFO: PDW [Do Not Redistribute] Section of VB6DEP.INI
INFO: Support for Third-Party Installers
INFO: How Setup Wizard and PDW Use Dependency Files
To get a set of the current baseline libraries I have written a VB6 program "Msms2Libs."
What it does is:
- Run the merge modules package (msmenu.exe) to extract the MSMs to a subdirectory (Extracted) under the program's own directory (App.Path).
- Create a "queue" of MSM files to process by scanning the directory.
- Use the Windows Installer automation interface to extract the merge module CAB file from each merge module and into the same subdirectory.
- Run an instance of the Microsoft utility Extract.exe against each CAB file to extract the files from the CAB into the same subdirectory.
- Rename each extracted file from its name in the CAB file to its target name (the actual DLL or OCX name).
- Delete all of the MSM and CAB files from the subdirectory.
Once complete the Extracted subdirectory should have a set of the VB6 SP6 files contained in those MSM files. There will also be some VC6 files there that you can delete and ignore or use for VC6 projects (but that's a different subject).
Some MSMs are skipped, see the comments in Msms2Libs' UIForm.frm module for details.
The full Project source is in the attached archive. Unzip these to a Project folder.
Next you will need to put a copy of the Microsoft Cabinet SDK utility Extract.exe into this folder. This used to be easy: just download and run CabSDK.exe from Microsoft, then after the self-extractor runs copy the utility from the CabSDK folder created.
Microsoft no longer offers this download though. If you do not already have the Cabinet SDK on your computer you might try some web searches, some 3rd party sites may still host this download. Just be sure to run a good virus scan on it before running it.
Once you have the Project folder set up and Extract.exe copied there, you need to download the VS6 SP6 Merge Modules package:
Merge Modules for Service Pack 6 for Visual Basic 6.0 and Visual C++ 6.0
Put this in a safe place, and copy it into the Project folder as well so Msms2Libs can run it for you to extract the MSMs.
Now you can run Msms2Libs from within the VB6 IDE or compile it and run the EXE. This should perform the steps listed above for you, create a log.txt file listing its actions, and leave you with a set of libraries in the Extracted subfolder.
So to run Msms2Libs, at a minimum you'd have some read/write directory that contains:
- Compiled Msms2Libs.exe
- The Extract.exe utility
- The downloaded MSM distribution package MSMenu.exe
Be sure to read the comments at the head of UIForm.frm before running the program. There are some Consts you might want to alter and you might want to make additional changes too.
The entire process is non-destructive. If anything goes wrong just delete the Extracted subfolder or at least its contents, then you can re-run after making any changes that might be required.
These Merge Modules are meant for use by MSI packaging tools. This means they do not supply any .DEP files (since those are never deployed to target systems anyway). The equivalent of the .DEP file contents is embeeded in the MSMs themselves as "rules" for installing the libraries and registering them.
Ideally when you copy these extracted libraries into the PDW's Redist folder you will also either create new .DEP files for each one or else copy the existing .DEP from each library's "live" location and update it with new version and timestamp information.
It would be difficult to have Msms2Libs generate these for you since they normally contain information that Microsoft supplies in them regarding subdependencies and localization resource DLLs as wel as version numbers and dates.
Mar 14th, 2014, 08:02 AM
Re: VB6 - Msms2Libs: Extract VS6/VB6 MSMs to Libraries
The Internet Archive has a mirror of the original Microsoft-hosted file. I'm prepared to accept that as trustworthy, but of course YMMV.
Originally Posted by dilettante
Tags for this Thread
Click Here to Expand Forum to Full Width
Survey posted by VBForums.