00000001.htm
来自「水木清华BBS」· HTM 代码 · 共 220 行 · 第 1/2 页
HTM
220 行
want to create a CAB file. For a list of CABARC commands and options, type CABARC alone on <BR>the command line: <BR> <BR> C:\CAB&SIGN\CABARC <BR> <BR>Creating an INF File <BR> <BR>The INF file is a text file that specifies the files (such as DLLs or other OCXs) that need to be <BR>present or downloaded for your control to run. An INF file allows you to bundle all the needed <BR>files in one compressed CAB file. By default, files with the same version numbers as existing files <BR>on the user's hard disk will not be downloaded. For more information about INF files and their <BR>options, including how to create platform-independent INF files, see Packaging Component Code <BR>for Automatic Download on the World Wide Web, or the Platform SDK section Setup and System <BR>management Services\Setup API\Overview\INF Files. The Platform SDK is included with the <BR>Visual C++ 5.0 online documentation. <BR> <BR>As an example, the following INF will be used to create a CAB file for the ATL Polygon control. <BR>You can build POLYGON.DLL by downloading the ATL POLYGON sample files from the <BR>Visual C++ 5.0 CD and building a MinSize version. If you build a MinSize version of the Polygon <BR>control, you need one additional DLL, ATL.DLL. Since ATL.DLL needs to be registered before <BR>POLYGON.DLL, put ATL.DLL first in the INF. <BR> <BR>; Sample INF file for POLYGON.DLL <BR>[version] <BR>; version signature (same for both NT and Win95) do not remove <BR>signature="$CHICAGO$" <BR>AdvancedINF=2.0 <BR> <BR>[Add.Code] <BR>polygon.dll=polygon.dll <BR>atl.dll=atl.dll <BR> <BR>; needed DLL <BR>[atl.dll] <BR>file-win32-x86=thiscab <BR>FileVersion=2,00,0,7024 <BR>DestDir=11 <BR>RegisterServer=yes <BR> <BR>[polygon.dll] <BR>file-win32-x86=thiscab <BR>clsid={4CBBC676-507F-11D0-B98B-000000000000} <BR>FileVersion=1,0,0,1 <BR>RegisterServer=yes <BR>; end of INF file <BR> <BR>This INF specifies that ATL.DLL with the given version needs to be installed on the system. If <BR>ATL.DLL doesn't exist already on the system, it will be downloaded from the CAB file created <BR>with this INF. "thiscab" is a keyword meaning the CAB containing this INF. You can also <BR>download a needed DLL from an HTTP location by specifying an absolute or relative path, for <BR>example: <BR> <BR>file-win32-x86=<A HREF="http://www.mysite.com/mydir/NEEDED.DLL">http://www.mysite.com/mydir/NEEDED.DLL</A> <BR> <BR>The keyword "file-win32-x86" identifies the platform as x86 specific. <BR> <BR>You can get the version number of a file by clicking the right mouse button on the file in Windows <BR>NT or Windows 95 Explorer. Select Properties from the list that appears, then select the Version <BR>tab on the dialog box that appears. You will sometimes need to insert an extra 0 in the file version. <BR>For example, the version number for the ATL.DLL is shown as 2.00.7024 in the dialog box. This <BR>becomes 2, 00, 0, 7024 in the INF file. <BR> <BR>The "DestDir" is where the directory where the file will be loaded: 11 specifies the system <BR>directory WINDOWS/SYSTEM or WINNT/SYSTEM32; 10 specifies the windows directory, <BR>WINDOWS or WINNT. If no DestDir is specified (typical case), code is installed in the fixed <BR>OCCACHE directory. <BR> <BR>The "clsid" is the CLSID of the control to be installed. <BR> <BR>Once you have created an INF file, run the CABARC utility (available in the CAB&SIGN <BR>directory on the Visual C++ 5.0 CD) to create the CAB file. You should run CABARC in the <BR>directory that contains your source files. Put the source files in the order they appear in the INF <BR>and the INF file last. For example, to make a CAB file for the Polygon control from the INF <BR>above, use the following command: <BR> <BR> C:\CAB&SIGN\CABARC -s 6144 POLYGON.CAB ATL.DLL POLYGON.DLL POLYGON.INF <BR> <BR>This CAB file contains a compressed version of ATL.DLL and POLYGON.DLL along with the <BR>information needed to extract them in the POLYGON.INF file. <BR> <BR>For an example of building a CAB file that downloads an MFC control, see MFC 4.2b Component <BR>Download Information. The DLL files you need to include with an MFC control are <BR>MSVCRT.DLL, MFC42.DLL, and OLEPRO32.DLL. <BR> <BR> <BR> <BR>Signing a CAB File <BR> <BR>To sign a CAB file using the Code Signing Wizard: <BR> <BR>1. Run the SIGNCODE utility (available in the CAB&SIGN directory on the Visual C++ 5.0 CD) <BR>to launch the Code Signing Wizard. <BR> <BR> C:\CAB&SIGN\SIGNCODE <BR> <BR>2. In the Code Signing Wizard dialog box, click Next to advance to the next page. <BR>3. In the Which program would you like to sign? edit box, enter the name of the CAB file you <BR>want to sign. <BR>4. In the What would you like to call this program? edit box, enter the name as you want it to <BR>appear on the certificate. <BR>5. Click Next to advance to the next page. <BR>6. In the Under which Software Publishing Credentials would you like to sign this program? <BR>edit box, enter the name of the Software Publisher Certificate (SPC) file. <BR>7. In the Where can you find the secret, private key that goes with these credentials? edit <BR>box, enter the name of the private key (PVK) file. <BR>8. Click Next twice to advance to the last page. <BR>9. Click Sign to sign the CAB file. Your file will be digitally signed. <BR> <BR>You can sign your DLLs and OCXs directly, without using a CAB file. The advantages of a CAB <BR>file are compression and, if used with an INF file, the bundling of all necessary code together.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?