SetupAddToDiskSpaceListW function (setupapi.h)

[This function is available for use in the operating systems indicated in the Requirements section. It may be altered or unavailable in subsequent versions. SetupAPI should no longer be used for installing applications. Instead, use the Windows Installer for developing application installers. SetupAPI continues to be used for installing device drivers.]

The SetupAddToDiskSpaceList function adds a single delete or copy operation to a disk-space list. To add all the file operations in a section of an INF file, use either SetupAddSectionToDiskSpaceList, or SetupAddInstallSectionToDiskSpaceList.

Target disk compression is ignored by this function. Files are assumed to occupy their full size on the target disk.


  [in] HDSKSPC  DiskSpace,
  [in] PCWSTR   TargetFilespec,
  [in] LONGLONG FileSize,
  [in] UINT     Operation,
  [in] PVOID    Reserved1,
  [in] UINT     Reserved2


[in] DiskSpace

Handle to the disk-space list.

[in] TargetFilespec

File name of the file to be added to the disk-space list. You should use a null-terminated string that specifies a fully qualified path. Otherwise, the path must be relative to the current directory.

[in] FileSize

Uncompressed size of the file as it will exist in the target directory, in bytes. You can use SetupGetSourceFileSize to retrieve this information from an INF file. This parameter is ignored for FILEOP_DELETE operations.

[in] Operation

File operation to be added to the list. This parameter can be one of the following values.

Value Meaning
A file delete operation.
A file copy operation.

[in] Reserved1

Must be zero.

[in] Reserved2

Must be zero.

Return value

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.



The setupapi.h header defines SetupAddToDiskSpaceList as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header setupapi.h
Library Setupapi.lib
DLL Setupapi.dll

See also