Create a signed CAB file for the MFC and ATL controls

xiaoxiao2021-03-06  43

[text]

This thing has a detailed process (E text) in MSDN, and this article on the sky is MSDN translation (

http://www.yesky.com/20011220/210737.shtml), but I didn't succeed in the steps above, but also said that the digital signature is required (this is not my life), then look for Ah, find it, I finally let me find a simple way.

Below is the step of creating a CAB file:

1 Get a software publisher certificate (you only need this application to be permanently used)

2 Create a CAB file

3 sign your file

4 Embed a web page (optional) to get a software publisher certificate

Step 1. Digital certificate

Everyone can

Apply for a free in www.ca365.com, you can use it for a month, how to do it, you can view the instructions for the website.

Step 2 Create your CAB file

The most important thing in this is to make the INF file.

I didn't work in accordance with the production of MSDN, I don't know how to do it.

Taking the Active controls I develop as an example to explain the manufacturing of the INF. I did 4 files: Display.dll, Comm.dll, VideoCodec.dll, and vStar.ocx

Where vStar.ocx calls the other three DLLs to run.

Note: The following is a comment

INF file content:

Start

[Version]

Signature = $ chicago $; this part is fixed

[DestinationDIRS]

Dllsyscopy = 11

Ocxcopy = 11; Indicates that the following two copies to the folder are the system folder (Winnt / System32 in 2000)

[DefaultInstall]

CopyFiles = Dllsyscopy, Ocxcopy; Indicates that there are two part files to be copy

AddReg = VideoReoreg; content to be added in the registry, control registration

[DLLSYSCOPY]

Comm.dll = comm.dll

Display.dll = display.dll

VideoCodec.dll = videoCodec.dll

[Ocxcopy]

VStar.ocx = vStar.ocx

The following content is the control in the registry, registration has content

You can use the regvr32 command to register the control on this unit. Then get its hkey_classes_root / clsid in regedit

; Your control's registration item (vstar). Let's take the first first as an example.

The first row of the first row represents hkey_classes_root / clsid / {50B6327F-AFD1-11D2-9CB9-0000F87A369E}

There is a table entry named "default", type "reg_sz", and data is "vstar property page".

[videoreg]

HKCR, CLSID / {5046E7B8-E5DA-4C12-A90B-5A6A776163A6}, "",% reg_sz%, "vStar Property Page"

HKCR, CLSID / {5046E7B8-E5DA-4C12-A90B-5A6A776163A6} / Inprocserver32, "",% REG_SZ%, "% 11% / vStar.ocx"

HKCR, CLSID / {765048AA-4E5F-4D9E-AA2E-F2B364497D8D}, "",% reg_sz%, "vStar Control"

HKCR, CLSID / {765048AA-4E5F-4D9E-AA2E-F2B364497D8D} / control, "",% reg_sz%

HKCR, CLSID / {765048AA-4E5F-4D9E-AA2E-F2B364497D8D} / Implemented Categories, "",% REG_SZ% HKCR, CLSID / {765048AA-4E5F-4D9E-AA2E-F2B364497D8D} / Implemented Categories / {7DD95801-9882-11CF -9fa9-00aa006c42c4}, "",% reg_sz%

HKCR, CLSID / {765048AA-4E5F-4D9E-AA2E-F2B364497D8D} / {7DD95802-9882-11CF-9FA9-00AA006C42C4}, "",% reg_sz%

HKCR, CLSID / {765048AA-4E5F-4D9E-AA2E-F2B364497D8D} / inprocserver32, "" ",% reg_sz%,"% 11% / vStar.ocx "

HKCR, CLSID / {765048AA-4E5F-4D9E-AA2E-F2B364497D8D} / inprocserVer32, "ThreadingModel",% reg_sz%, "Apartment"

HKCR, CLSID / {765048AA-4E5F-4D9E-AA2E-F2B364497D8D} / miscStatus, "",% reg_sz%, "0"

HKCR, CLSID / {765048AA-4E5F-4D9E-AA2E-F2B364497D8D} / miscStatus / 1, "" ",% reg_sz%," 131473 "

HKCR, CLSID / {765048AA-4E5F-4D9E-AA2E-F2B364497D8D} / progid, "",% reg_sz%, "vStar.VStarCtrl.1"

HKCR, CLSID / {765048AA-4E5F-4D9E-AA2E-F2B364497D8D} / ToolboxBitmap32, "" ",% reg_sz%,"% 11% / vStar.ocx, 1 "

HKCR, CLSID / {765048AA-4E5F-4D9E-AA2E-F2B364497D8D} / typelib, "",% reg_sz%, "{430FD5DC-47AE-4AB8-970C-B64DC9155F22}"

HKCR, CLSID / {765048AA-4E5F-4D9E-AA2E-F2B364497D8D} / Version, "",% reg_sz%, "1.0"

; END

After doing your INF file, you can start package, put the control program and INF file in a directory in a directory, use WinCab to put the package, WinCAB is relatively simple.

Step three. Sign your files

This step is to tell the person who uses your control. "This is the control I release. You can believe me, if you have, you can find me"

In this step you can use the "ChinaATCP Personal Control Digital Signature System", which has a very detailed way to use, not introduced here. It can also make digital signatures, but its digital signature is not so detailed.

Step 4. Embed a Signed CAB file into a web page (optional) to get a software publisher certificate

To automatically download the control on the HTML page, you need to use the tag of the CodeBase feature. Here is the code in my control in the web page.

The CodeBase feature tells Microsoft Internet Explorer to download and install what. The CodeBase property contains a reference, which is used to find and download the address of the control and its supported files. If the control needs to support files, the CodeBase feature points to the CAB file.

After the above steps you can use the control's automatic download feature on the Internet and you can safely use this control (if you have installed this control is not downloaded).

postscript:

When the security level in IE is set to low, the control can be used if there is no digital signature. But each time runs out of the running script unsafe prompt. (If you want to shield it in your code, you can see "

http://www.vckbase.com/document/viewdoc/?id=728 ")

In order to mix in the brother's blog, write a number of articles. The first time I wrote that many places are not all. If there is a place, that one is not what I wrote :), I will say it again, if there is anything unclear, please contact me.

转载请注明原文地址:https://www.9cbs.com/read-57896.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.039, SQL: 9