Previous Next

INF CopyFiles Directive

[DDInstall] |
[DDInstall.CoInstallers] |
[ClassInstall32] |
[ClassInstall32.ntx86] |
[ClassInstall32.ntia64]

 

CopyFiles=@filename | file-list-section[, file-list-section]...
 
 

A CopyFiles directive can do either of the following:

The destination of copy operations is controlled by the INF DestinationDirs section. For more information see the following Comments section.

Do not use CopyFiles directives to copy INF files. See Copying INFs.

A CopyFiles directive can be specified within any of the sections shown in the formal syntax statement. This directive also can be specified within any of the following INF sections:

Comments

Any file-list-section name must be unique to the INF file, but it can be referenced by CopyFiles, DelFiles, or RenFiles directives elsewhere in the same INF file. The section name must follow the general rules that are described in General Syntax Rules for INF Files. For information about how to use the system-defined .nt, .ntx86, and .ntia64 extensions, see Creating INF Files for Multiple Platforms and Operating Systems.

Each named section referenced by a CopyFiles directive has one or more entries of the following form:

[file-list-section]
destination-file-name[,source-file-name][,temporary-file-name][,flag]
...

An INF-writer-defined file-list-section can have any number of entries, each on a separate line.

Each file-list-section can have an optional, associated file-list-section.security section of the following form:

[file-list-section.security]
"security-descriptor-string"

file-list-section Entries

destination-file-name
Specifies the name of the destination file. If no source-file-name is given, this specification is also the name of the source file.
source-file-name
Specifies the name of the source file. If the source and destination file names for the file copy operation are the same, source-file-name can be omitted.
temporary-file-name
Specifies the name of a temporary file to be created in the copy operation if a file of the same name on the destination is open or currently in use. Only used on Windows 9x/Me platforms. The NT-based OS automatically generates temporary file names when necessary and renames the copied source files the next time the OS is started.
flag
These optional flags, expressed in hexadecimal notation or as a decimal value in a section entry, can be used to control how (or whether) a particular source file is copied to the destination. One or more (ORed) values for the following system-defined flags can be specified, but some of these flags are mutually exclusive:
0x00000400 (COPYFLG_REPLACEONLY)
Copy the source file to the destination directory only if the file is already present in the destination directory.
0x00000800 (COPYFLG_NODECOMP)
Copy the source file to the destination directory without decompressing the source file if it is compressed.
0x00000008 (COPYFLG_FORCE_FILE_IN_USE)
Force file-in-use behavior: do not copy over an existing file of the same name if it is currently open. Instead, copy the given source file with a temporary name so that it can be renamed and used when the next reboot occurs.
0x00000010 (COPYFLG_NO_OVERWRITE)
Do not replace an existing file in the destination directory with a source file of the same name. This flag cannot be combined with any other flags.
0x00001000 (COPYFLG_REPLACE_BOOT_FILE)
This file is required by the system loader. The system will prompt the user to reboot the system.
0x00002000 (COPYFLG_NOPRUNE)
Do not delete this operation as a result of optimization.

For example, Setup might determine that the file copy operation is not necessary because the file already exists. However, the writer of the INF knows that the operation is required and directs Setup to override its optimization and perform the file operation. (This flag can be used to ensure that files are copied if they are also specified in an INF DelFiles directive or an INF RenFiles directive.)

0x00000020 (COPYFLG_NO_VERSION_DIALOG)
Do not write over a file in the destination directory with the source file if the existing file is newer than the source file.

This flag is irrelevant to digitally signed INF files. If a driver package is digitally signed, Setup installs the package as a whole and does not selectively omit files in the package based on other versions already present on the machine.

0x00000004 (COPYFLG_NOVERSIONCHECK)
Ignore file versions and write over existing files in the destination directory. This flag and the next two are mutually exclusive. This flag is irrelevant to digitally signed INF files.
0x00000040 (COPYFLG_OVERWRITE_OLDER_ONLY)
Copy the source file to the destination directory only if the file on the destination will be superseded by a newer version. This flag is irrelevant to digitally signed INF files.
0x00000001 (COPYFLG_WARN_IF_SKIP)
Send a warning if the user elects to not copy a file. This flag and the next are mutually exclusive, and both are irrelevant to INF files that are digitally signed.
0x00000002 (COPYFLG_NOSKIP)
Do not allow the user to skip copying a file. This flag is implied if the driver package is signed.
security-descriptor-string
Specifies a security descriptor, to be applied to all files copied by the named file-list-section. The security-descriptor-string is a string with tokens to indicate the DACL (D:) security component. See Platform SDK documentation for information about the format of security descriptor strings.

If an file-list-section.security section is not specified, files inherit the security characteristics of the directory into which the files are copied.

If an file-list-section.security section is specified, the following ACE's must be included so that installations and upgrades of devices and system service packs can occur:

(A;;GA;;;SY) – Grants all access to the local system.
(A;;GA;;;BA) – Grants all access to built-in administrators.

Do not specify ACE strings that grant write access to nonprivileged users.

For more information about specifying security descriptors, see Creating Secure Device Installations.

The INF DestinationDirs section controls the destination for all file-copy operations, as follows:

The INF file writer also supplies path specifications to files that are copied from source media in either of the following ways:

Example

This example shows how the SourceDisksNames, SourceDisksFiles, and DestinationDirs sections specify the paths for copy-file (and delete-file) operations that occur in processing a simple device-driver INF. (The same INF was also used previously as examples of Version, SourceDisksNames, and SourceDisksFiles sections.)

[SourceDisksNames]
1 = %Floppy_Description%,,,\Win98 ; path to Win98 source files
2 = %Floppy_Description%,,,\WinNT
 
[SourceDisksFiles]
aha154x.mpd = 1,, ; on distribution disk 1, in subdir \win98
 
[SourceDisksFiles.x86]
aha154x.sys = 2,\x86 ; on distribution disk 2, in subdir \WinNT\x86
 
[DestinationDirs]
ASPIDEV = 11  ; Win98-specific del-file section
              ; delete existing files from DIRID_SYSTEM 
DefaultDestDir = 12  ; DIRID_DRIVERS 
                     ; == \System32\Drivers on Windows NT platforms
                     ; == \System\IoSubsys on Win9x platforms
 
; ... Manufacturer and Models sections omitted here
 
; Win9x-specific DDInstall, given [AHA154X.NTx86] in this INF
[AHA154X] 
CopyFiles=@AHA154x.MPD
DelFiles=ASPIDEV ; defines a delete-files section not shown here
; ... some other directives and sections omitted here
 
[AHA154X.NTx86]
CopyFiles=@AHA154x.SYS 
; ... some other directives and sections omitted here
; ...

This example shows how a CopyFiles directive can be used in a DDInstall.CoInstallers section of an INF for a device driver that provides two device-specific co-installers to supplement the INF processing of the system device-type-specific class installer.

[DestinationDirs]
XxDev_Coinstallers_CopyFiles = 11  ; DIRID_SYSTEM
; ... other file-list entries and DefaultDestDirs omitted here
 
; ... Manufacturer, Models, and DDInstall sections omitted here
 
[XxDev_Install.CoInstallers] 
CopyFiles=XxDev_Coinstallers_CopyFiles
; ... AddReg omitted here
 
[XxDev_Coinstallers_CopyFiles]
XxPreInst.dll   ; dev-specific co-installer run before class installer
XxPostInst.dll  ; run after class installer (post processing)

As the preceding example suggests, the names of new device-specific co-installers can be constructed from the name of the provider (shown here as Xx) and the intended use for each such co-installer DLL (shown here as PreInst and PostInst).

See Also

AddInterface, ClassInstall32, DDInstall, DDInstall.CoInstallers, DDInstall.Interfaces, DelFiles, DestinationDirs, InterfaceInstall32, RenFiles, SourceDisksFiles, SourceDisksNames, Version