Previous Next

INF DelFiles Directive

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

 

Delfiles=file-list-section[, file-list-section]...
 
 

A DelFiles directive references an INF-writer-defined section elsewhere in the INF file, causing that list of files to be deleted in the context of operations on the section in which the referring DelFiles directive is specified.

A DelFiles 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-writer-defined sections:

Comments

This directive is rarely used. The only files that can be safely deleted are those that were used only in earlier versions of the operating system, and are thus never used for the currently installed version. (For Windows XP and later, you can use the TargetOSVersion decoration to control version-specific installation behavior. See INF Manufacturer Section.)

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. Such an INF-writer-defined section name must follow the general rules for defining section names. These rules 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 DelFiles directive has one or more entries of the following form:

[file-list-section]
 

destination-file-name[,,,flag]
...

A file-list-section can have any number of entries, each on a separate line.

DelFiles-Referenced Section Entries

destination-file-name
Specifies the name of the file to be deleted from the destination.

Do not specify a file that is listed in a CopyFiles directive. If a file is listed in both a CopyFiles-referenced and a DelFiles-referenced section, and the file is currently present on the system with a valid signature, the OS might optimize away the copy operation but perform the delete operation. This is very likely not what the INF writer intended.

flag
This optional value can be one of the following, expressed in hexadecimal notation as shown here or as a decimal value:
0x00000001 (DELFLG_IN_USE)
Delete the named file, possibly after it has been used during the installation process.

Setting this flag value in an INF queues the file-deletion operation until the system has restarted if the given file cannot be deleted because it is in use while this INF is being processed. Otherwise, such a file will not be deleted.

0x00010000 (DELFLG_IN_USE1)
This flag is a high-word version of the DELFLG_IN_USE flag, and it has the same purpose and effect. This flag should be used in only for installations on NT-based systems.

Setting this flag value in an INF prevents conflicts with the COPYFLG_WARN_IF_SKIP flag in an INF with both DelFiles and CopyFiles directives that reference the same file-list-section.

The DestinationDirs section of the INF file controls the destination for all file-deletion operations, whatever the section containing a particular DelFiles directive, as follows:

Example

This example shows how the DestinationDirs section specifies the path for a delete-file operation that occurs in processing a simple device-driver INF. (The same INF was also used previously as an example of the CopyFiles directive.)

[DestinationDirs]
ASPIDEV = 11  ; name of Win9x-specific delete-file section 
              ; delete existing files from DIRID_SYSTEM 
DefaultDestDir = 12  ; DIRID_DRIVERS 
 
; ... 
 
[AHA154X] ; Win9x-specific DDInstall section
CopyFiles=@AHA154x.MPD
DelFiles=ASPIDEV ; defines delete-files section name
; ... some other directives and sections omitted here
 
[ASPIDEV]
VASPID.VXD ; name of file to be deleted, if it exists on target 
; ...

See Also

AddInterface, ClassInstall32, CopyFiles, DDInstall, DDInstall.CoInstallers, DestinationDirs, InterfaceInstall32, RenFiles