Summary of ActiveX controls for web-based cab file Packaging

Source: Internet
Author: User

I,ProgramDescription:
Program environment: Windows XP SP2, ie 6, Tomcat 5.5, VC ++ 6.0

Program process: the control is made into an ocx file for the client to call local hardware, which is useful to several third-party. DLL files. Windowsself-carried iexpress.exe is packaged into a cab file, and controls are called on the JSP page of the server side. The cab file is downloaded and automatically registered.

Ii. Program problems:
Problems:
1. The cab file cannot be downloaded, and no prompt is prompted.
2. The downloaded cab file can be seen in system32, but the page still cannot be displayed. It is a Red Cross and cannot be used.

Problem test:
1. There is no download prompt on the browser page. It should be considered the path of the cab or the security issue of the IE browser. Minimize security to test. Change the cab path repeatedly.
2. This problem has been the most depressing for a long time. The first consideration is the security issue. After searching the Internet, it is said that SP2 has increased the security policy. Some say that security is reduced, and some say that the program needs to be digitally signed.

solution:
1. The path is indeed incorrect and has nothing to do with security. In JSP, the Code is:

testcab. the cab file should be placed under Tomcat 5.5 installation directory Tomcat 5.5 \ webapps and the project where JSP is called.
2. You do not need to change the security level. Instead, add the server address to Internet Options> Security> trusted site> site. Note: Do not select the check box "server verification is required for all sites in the region ".

Iii. Summary:
1. Pack OCX files and third-party DLL files into cab files:
Internet software distribution is a "Software Package" that consists of a. cab file that contains a. inf file or a software distribution. OSD file (or both. A distribution unit can also contain software components, such as ActiveX controls (. ocx),. DLL files,. EXE files, Java class files, or applets. When the codebase feature reference of the object element on the web page contains. INF file. internet Explorer automatically changes. the cab file is downloaded and installed as a software distributor, and the version is automatically checked and updated each time you access it.
The inf file is a text file that specifies the files (such as. dll or other. ocx) to be downloaded or submitted to run the control ). A. inf file is bound to all the required files in the. Cab compressed file. By default, files with the same version number as existing hard disks are not downloaded.
First, write an INF file. The information includes packaging the. ocx file and related. dll file, and downloading it to the Folder \ windows \ system32. The details are as follows:
[Version]
Signature = "$ Chicago $"
Advancedinf = 2.0

[Defainstall install]
Copyfiles = install. Files
Registerocxs = registerfiles
[Rinstallapplicationfiles]
Copyfiles = install. Files
Registerocxs = registerfiles
[Destinationdirs]
Install. Files = 11
[Sourcedisksnames]
1 = % diskname %, testcab. Cab, 1

[Add. Code]
Pcpos. ocx = pcpos. ocx
Comm. dll = comm. dll
Pcpos. dll = pcpos. dll
Tcpclnt. dll = tcpclnt. dll

[Install. Files]
Pcpos. ocx = pcpos. ocx
Comm. dll = comm. dll
Pcpos. dll = pcpos. dll
Tcpclnt. dll = tcpclnt. dll

[Sourcedisksfiles]
Pcpos. ocx = 1
Comm. dll = 1
Pcpos. dll = 1
Tcpclnt. dll = 1

[Pcpos. ocx]
File-win32-x86 = thiscab
Registerserver = Yes
CLSID = {719a1d6e-7099-4123-9d63-f0118aff2d61}
Destdir = 11
Fileversion =

[Comm. dll]
File-win32-x86 = thiscab
Registerserver = Yes
Destdir = 11
Fileversion =

[Pcpos. dll]
File-win32-x86 = thiscab
Registerserver = Yes
Destdir = 11
Fileversion =

[Tcpclnt. dll]
File-win32-x86 = thiscab
Registerserver = Yes
Destdir = 11
Fileversion =

[Registerfiles]
% 11% \ pcpos. ocx

Note:
"Thiscab" is a keyword that indicates the cab file containing the INF. You can also download the required DLL file from the Internet by specifying an http url, for example:
File-win32-x86 = http://www.mysite.com/mydir/NEEDED.DLL
The keyword "file-win32-x86" specifies that the platform is x86.
The visible property of the file version number.
"Destdir" indicates the address of the mounted directory or file: 11. Specify it as the system directory windows // system32;
"CLSID" indicates the CLSID of the control to be installed.

Create a cab:
Use \ windows \ system32 \ iexpress.exe.
1) Select "create new self extraction directive file" and click Next.
2) Select "create compressed files only (ActiveX instils)" and click Next.
3) Click Add, add the file (pcpos. ocx, pcpos. dll, Comm. dll, tcpclnt. dll), and click Next.
4) Click Browse and enter the storage address of the. cab file (including the obtained file name). Here testcab. Cab is selected and "store files using long file name inside package" is selected ". Click Next.
5) Select "don't save" and click "Next" until the operation is completed.

Note:
If the control has been registered on the client and is not registered using. Cab, the control cannot be updated when it is automatically registered using. Cab. You must manually delete the file.

2. Digitally Sign the cab file
In the legend above, the digital signature is automatically downloaded without prompting, so try again:
There are three gadgets in the middle of \ Microsoft Visual Studio. NET 2003 \ SDK \ V1.1 \ bin to use them for digital signature.
1.makecert.exe --- certificate creation tool
2.cert2spc.exe --- issuer Certificate Test Tool
3.signcode.exe --- file signature Tool

Steps:
1) makecert-SS name-n "cn = company name"-sv d: \ pos. PVK-r d: \ pos. in CER, SK-indicates the key container location of the topic, the certificate storage name of the SS-topic, the N-certificate issuing object, and the R-certificate storage location, -SV: export the private key file (used for signature ). Note: At this time, the password will be entered three times, and the password will be exactly the same for three times.
2) use cert2spc to generate a SPC issuer certificate (optional): cert2spc D: \ pos. Cer c: \ pos. SPC
3) double-click signcode. The signature wizard is started without parameters. Select the file to be signed first, next, select "Custom", next, select "select from file", and add the newly generated POS. CER certificate. Next, select the newly generated private key POS. PVK. Next, you can use the SPC certificate and continue the next step. Add a timestamp and enter http: // timestamp.verisign.com/scripts/timstamp.dll testcab. Cab in the timestamp.

In this way, the cab file is signed. However, when you click this file, the certificate becomes unavailable because the certificate is not forwarded. File properties-> digital certificate-> details-> View Certificate-> install certificate, enter the certificate Installation Wizard, and select "Trusted Root Certificate Authority" in the storage area ", click Finish.

Test on the client:
1) Add the certificate, Browser> tool> Internet Options> content> certificate> trusted authority> import the certificate.
2) if a certificate is available, if the server does not add a "trusted Website", a message indicating that the certificate is signed is displayed during download. If no certificate is available, the message "unknown" is displayed ".
3) if the server has been added to the "trusted web site" and the certificate has been imported, no information is prompted and you can download it without feeling it. If the "trusted URL" is not added, the control can be downloaded normally but cannot be used normally, regardless of whether the signature is enabled.

Iv. Problems:
1. Do you want to add "trusted URLs ".
2. The role of digital signature, the difference between an authorization certificate and an unauthorized certificate.

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.