共用方式為


Using INF Files

An information file (.inf) provides installation instructions that the Internet Component Download service provided in Microsoft Internet Explorer 3.0 or later uses to install and register software components downloaded from the Internet, as well as any files required by the components. The INF file is a text file that specifies the files that need to be present or downloaded for your component to run.

Internet software distribution units are "packages" consisting of a cabinet file (.cab) that contains an INF file or an Open Software Description (OSD) file (or both). Distribution units may also contain a software component, such as an Microsoft ActiveX Control (.ocx), a .dll, an .exe, a Java class file, or an applet.

When a cabinet file containing an INF file is referenced by the CODEBASE attribute of an object element, Internet Explorer 3.0 and later automatically treats the cabinet file as a software distribution unit.

  • Benefits of INF Files
  • Complex Setup Instructions
  • What is a Hook?
  • Platform Independence and HTTP
  • Platform Independence in INF Files
  • Related topics

Benefits of INF Files

INF files provide the ability to create customized software installation instructions, which include registry entries and destination directories. By pointing to the URLs of files to download, an INF file provides instructions that Windows Internet Explorer uses to install your software components.

The INF file specifies the files that need to be downloaded and set up for the component to run. INF files can provide limited platform independence and specify limited software dependencies.

INF files are compatible with Internet Explorer 3.0 and later. Support for OSD files began with Microsoft Internet Explorer 4.0.

Complex Setup Instructions

Complex setup instructions, such as for adding/modifying registry entries, creating advanced setup functionality in custom destination directories, and so on, are not possible using OSD syntax alone. An INF file is required for such complex setup functionality.

What is a Hook?

A hook is a way to override or customize the installation process of one or more pieces required for a component. There are two types of hooks—unconditional and conditional. Unconditional hooks are hooks that always get executed. Conditional hooks are run only when a certain condition evaluates as TRUE.

For more information about using hooks in INF files, see Using Hooks.

Platform Independence and HTTP

When code to be downloaded is on an HTTP server, the HTTP Accept header information can be used to specify which platform the code is to run on, thus allowing platform independence of the CODEBASE URL.

The following MIME types are used to describe portable executable image files (.exe, .dll, .ocx), cabinet files (.cab), and setup scripts (.inf).

File description MIME type
PE files - .exe, .dll, .ocx application/x-pe-%opersys%-%cpu%
Cabinet files - .cab application/x-cabinet-%opersys%-%cpu%
Setup scripts - .inf (platform independent) application/x-setupscript
Macintosh Binhex files application/mac-binhex-40

 

%opersys% and %cpu% specify the operating system and CPU for the platform on which downloaded components will be executed. For example, the MIME type for a Microsoft Win32; cabinet file running on an Intel x86-architecture processor would be:

application/x-cabinet-win32-x86

The following are valid values for %opersys% and %cpu%.

Values for %opersys% Meaning
win32 32-bit Windows operating systems (like Windows 95 or Microsoft Windows NT 4.0)
Values for %cpu% Meaning
x86 Intel x86 family of processors
ppc (Obsolete as of Microsoft Internet Explorer 6.) Motorola PowerPC architecture
mips (Obsolete as of Internet Explorer 6.) MIPS architecture processors
alpha (Obsolete as of Internet Explorer 6.) DEC Alpha architecture
68k (Obsolete as of Internet Explorer 6.) Motorola 68k CPU
ia64 Intel Itanium architecture
amd64 AMD x86-64/Intel 64 architecture

 

When the code is on a non-HTTP server (for example, at a local LAN location), an INF file can be used to achieve platform independence by specifying different URLs for files to be downloaded for different platforms.

Platform Independence in INF Files

It is possible to create platform-independent setup scripts that pull files from different locations depending on the desired platform. Internet Component Download INF files use a scheme similar to the one described above in Platform Independence and HTTP. Specifically, a sample platform-independent INF file would include text such as the following:

[circ3.ocx]
; Lines below specify that the specified circ3.ocx (clsid, version) needs to be
; installed on the system. If it doesn't exist already, can be downloaded from
; the given location (a .CAB).
file-win32-x86=file://products/release/circ3/x86/circ3.cab
file-win32-amd64=file://products/release/circ3/amd64/circ3.cab
file-win32-mips=file://products/release/circ3/mips/circ3.cab
file-mac-ppc=ignore
; The 'ignore' keyword means that this file is not needed for this platform.

clsid={9DBAFCCF-592F-101B-85CE-00608CEC297B}
FileVersion=1,0,0,143

Thus the "file=" syntax used in the INF file is expanded to "file-%opersys%-%cpu =", allowing the INF file to specify multiple locations where various platform-dependent modules can be found and downloaded. See the previous section for valid values for %opersys% and %cpu%.

Conceptual

Choosing a Packaging and Distribution Method

About INF File Architecture

Introduction to Internet Component Download

Introduction to Open Software Description

Microsoft Internet Component Download Reference

Open Software Description Element Reference

Registry Details

Using Hooks