Distributing Black Ice Imaging Components through the Internet

When using the Black Ice Imaging Toolkits for web based applications, the most direct way to provide your users with required Black Ice Imaging components is through a CAB file.

Developers can create CAB files containing just the components that they require for their web based application to run from the client machine. The user simply navigates to the URL of your web based application and will be prompted to download the CAB file. Upon completion of the download, the CAB file will automatically copy and register the contents and your user will be immediately ready to use your application.

Creating a custom CAB file for your application can be easily accomplished by performing the following steps;

Create an INF file
The INF file is a text file that specifies the files (such as DLLs or other OCXs) that need to be present or downloaded for your control to run. An INF file allows you to bundle all the needed files in one compressed CAB file. By default, files with the same version numbers as existing files on the user’s hard disk will not be downloaded.

[version]
Signature=”$CHICAGO$”
AdvancedINF=2.0

[Add.Code]
BiDib.ocx=BiDib.ocx
BiDib.dll=BiDib.dll

[BiDib.ocx]
file-win32-x86=thiscab
clsid={D2797899-BE27-4CDB-892F-4FDC26EA9BA9}
FileVersion=10,4,4,0
ReisterServer=yes
DestDir=11

[BiDib.dll]
file-win32-x86=thiscab
FileVersion=10,4,4,0
DestDir=11

The [version] section defines the version of the INF file used.
The [Add.Code] section is composed of a list of all of the files that are included in the CAB file.
After the [Add.Code] section is a listing of the details for each file to be included in the CAB file. If a file doesn’t exist already on the system, it will be downloaded from the CAB file created with the INF. “thiscab” is a keyword meaning the CAB containing this INF.

“file-win32-x86” means that the CAB file is specific to x86 platforms.
The “clsid” is the CLSID of the control to be installed.

You can get the version number of a file by right clicking the file and selecting Properties and then select the Version tab. If the file on the system is an older version of the file in the CAB, it will be replaced.

RegisterServer indicates whether or not to register the component on the target system. In order to use any of the Black Ice ActiveX controls from a web page, the control must be registered. Please note that the Black Ice DLLS do not have to be registered.

The “DestDir” is the directory where the file will be copied: 11 specifies the system directory WINDOWS/SYSTEM or WINNT/SYSTEM32.

Build the CAB file
CAB files can be built by running the CABARC Utility. The CABARC utility is available from the Platform SDK. CABARC should be run from the directory containing the INF, OCX, and DLL files. The files should be listen on the command line in the same order as listed in the INF file. For example;

C:\Black Ice\ CABARC –s 6144 n BlackIce.CAB BiDib.ocx BiDib.dll BlackIce.INF

Running CABARC with the above parameters will create a CAB file called BlackIce.CAB