How to package controls into cab files

Source: Internet
Author: User

Create a signed cab package leechy [original]

1. Create a cab package:
Run
Cabarc-s 6144 n remtcardsetup. Cab remtcard. dll remtcard. inf
-S 6144: Leave 6 K space for the signature
. Inf file format
[Version]
Signature = "$ Chicago $"
Advancedinf = 2.0

[Remtcard. Code]
Remtcard. dll = remtcard. dll

[Autolive. dll]
File-win32-x86 = thiscab
CLSID = {0914929f-9755-47e9-9a85-df53d1a59961}
Fileversion =
Registerserver = Yes

Ii. certificate creation:
First download Authenticode for Internet Explorer 5.0
Run
Makecert-SK mynewkey-r-n "cn = Name of the issuing authority, ou = certification, O = company name, E = name@email.com"
-SS my mynew. Cer
Cert2spc mynew. Cer mynew. SPC

3. Sign the cab package:
Run
Signcode
Then enter signcodewizard:
Step1. select the cab file to be signed.
Step2. custom
Step3. select mynew. SPC from the file
Private Key/key container in step 4.csp: mynewkey
Step5.sha1
Step6.next
Step7. Description: plug-in name/Web: www.yourcompany.com
Step8.http: // timestamp.verisign.com/scripts/timstamp.dll

Finally, you can add such code to the HTML file to download the control from IE.
Object ID = remtcardctl codebase = "http: // 192.168.0.20./ remtcard/remtcardsetup. Cab"
Classid = "CLSID: 0914929f-9755-47e9-9a85-df53d1a59961" viewastext



Reference:
Packaging ActiveX Controls

Digital code signing step-by-step guide

Issuer: lye

You can use the package & Deployment wizard tool that comes with vs6.0 to package the package. However, you must sign the package file. If you do not sign the package, you can also use it, but it is limited!

Issuer: vagabondkq

1. If you need to create a cab file, you must first install cabarc or makecab with the cabinet SDK. The Cabinet SDK is http://msdn.microsoft.com/workshop/management/cab/cabdl.asp.
Cabarc can create, view, or work out files in the cab, while makecab can only be used to create the cab file.
2. When creating a cab file, you must include all relevant files. You can use depends to check the required files. Use the INF file to write these items.
3. inf method: The inf file describes all OCX and DLL files in the cab. inf provides the required information through some naming regions.

How to Write INF
Generally, it is in the [version] area at the beginning:
Eg: [version]
Signature = "$ XXXX $"
Advancedinf = 2.0
Next is the most important [Add. Code] area:
Eg: [Add. Code]
Ctrl1.dll = c1section
Ctrl2.dll = ctrl2.dll
The above is the file name to be downloaded, followed by the region name corresponding to the file, which can be any name, but it is generally the same as the file name, so it is easy to maintain. Note that files in the [Add. Code] area should be sorted by dependencies. For example, if ctrl1.dll is dependent on ctrl2.dll, ctrl2.dll must appear before ctrl1.dll. Because the installation is performed in the opposite order, that is to say, you must first install ctrl2.dll, then ctrl1.dll and zookeeper. Remember clearly and do not reverse it.
Next is the area of each file.
[Ctrl1.dll]
File-win32-x86 = thiscab
Registerserver = Yes
CLSID = {.....}
Destdir =
Fileversion = 1, 0, 0
The first file value in the [ctrl1.dll] area tells ie where to get the DLL. The file contains three parts. The first part is file, which will always be like this; the second part tells the declared supported OS. Win32 indicates windows, and Mac indicates Apple Mac ox. The third part is the CPU type, such as x86, PPC (Power PC), MIPS, or alpha.
The file value can be set to three URLs, ignore, and thiscab. If it is a URL, it indicates the location of the URL. If it is ignore, it indicates the OS and CPU, you do not need to download this file (ctrl1.dll); if it is thiscab, it is obviously in the current cab file.
The following is the registerserver. You can obtain two values: Yes and no. If yes, it indicates that IE wants to register the DLL. If no, it is unnecessary;
The next step is destdir, whose value is the location where the DLL will be saved to the local hard disk. If its value is 10, place the DLL in/Windows or/winnt; if it is 11, to/Windows/system or
/Winnt/system32; if it is null, It will be placed in the/Windows or/winnt Downloaded Program Files directory;
The last is fileversion, which is more obvious. It illustrates the version number of ctrl1.dll.
Sometimes when we use VB to develop controls, we need to install the Virtual Machine of VB. It requires some other instructions. Let's just give a brief introduction:
Add msvbvm60.dll = msvbvm60.dll in [Add. Code ].
Msvbvm60.dll:
[Msvbvm60.dll]
Hook = msvbvm60.cab _ Installer
Fileversion = 6, 0
Fileversion is obvious. If it is a version number, let's talk about Hook.
The hook area is the area to be executed during installation. It is divided into two types: conditional and unconditional. The unconditional hook area must be executed, otherwise, the execution is determined based on the conditions. The region marked with [setup hooks] is an unconditional region, as shown below:
[Setup hooks]
Hookname = Section-name

[Section-name]
Run = % extract_dir %/setup.exe
The unconditional region is often used to execute an installer through an INF file, which is why such a menu is installed when we right-click an INF file in the resource manager.
When ie downloads a cab file, if the file does not contain [Add. Code], it processes the [setup hooksruntime program, runs the program specified by runtime, and then processes setup.exe;
The condition area is executed under certain conditions, and the hook area specified in msvbvm60.dll is a condition area. If the CLSID or version specified in msvbvm60.dll cannot meet the requirements and the file name is not specified, the area specified by the hook.
[Msvbvm60.cab _ installer]
File-win32-x86 = http://activex.microsoft.com/controls/vb6/vbrun60.cab
Run = % extract_dir %/vbrun60.exe
The above [msvbvm60.cab _ installer] is a hook area, which also contains a file value. specifying a URL indicates that msvbvm60.dll can be downloaded from this URL. Run indicates which file to execute.
It is worth noting that, Ms has some common redistributable Microsoft DLLs
You can specify the codebase attribute as Microsoft DLLs


Create a cab file:
Cabarc n ctrl1.cab ctrl1.inf ctrl1.dll
N indicates that a new file is to be created. ctrl1.cab is the file name, ctrl1.inf is the INF of the cab, and then the file to be added to the cab. Wildcards can be used.
Then you can put the cab file on the webpage.
<Object ID = "ctrl1obj"
Classid = "CLSID :................................... .."
Codebase = "http://server.com/ctrl1.cab#version=8,0,0,5007">
</Object>
Here is also a version, but the version here refers to the control version, while the INF is the file version.


Make an electronic signature:
Download the signing tool signcode from the following URL. The address is
Http://msdn.microsoft.com/workshop/gallery/tools/authenticode/authcode.asp
From the signature authorization center such as Verisign or Microsoft Certificate running on your LAN
The server authorizes the server to get a certificate. You will get a private key when applying for authorization.
You can also use the private key created by makecert.exeand cert2spc.exe to test the function by using makecert to create an X.509 Certificate.
Makecert-SV mykey. pvk n "cn = my software company" mycert. Cer
Then use cert2spc to convert the. Cer file into PKCS #7 software and publish the certificate (. SPC file ),
Cert2spc mycert. Cer mycert. SPC
Use the signcode you downloaded to electronically sign your cab file
Signcode-SPC mycert. SPC-V mykey. PVK-T http ://
Timestamp.verisign.com/scripts/timstamp.dll ctrl1.cab
Signcode can also specify some other parameters. It is too long, too long.
Although the tested. CER and. SPC files can be used, you must apply for them at the time of release.

In fact, things are described in the SDK, but they are all in E.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.