Export (0) Print
Expand All
Expand Minimize

SetupGetSourceFileSize function

[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 SetupGetSourceFileSize function reads the uncompressed size of a source file listed in an INF file.


BOOL SetupGetSourceFileSize(
  _In_     HINF InfHandle,
  _In_     PINFCONTEXT InfContext,
  _In_     PCTSTR FileName,
  _In_     PCTSTR Section,
  _Inout_  PDWORD FileSize,
  _In_     UINT RoundingFactor


InfHandle [in]

Handle to the loaded INF file that contains the SourceDisksNames and SourceDisksFiles sections. If platform-specific sections exist for the user's system (for example, SourceDisksNames.x86 and SourceDisksFiles.x86), the platform-specific section will be used.

InfContext [in]

Optional pointer to a context for a line in a Copy Files section for which the size is to be retrieved. If InfContext is NULL, the FileName parameter is used.

FileName [in]

Optional pointer to a null-terminated string containing the filename (no path) for which to return the size. If this parameter is NULL as well as InfContext, then the Section parameter is used.

Section [in]

Optional pointer to a null-terminated string containing the name of a Copy Files section. If this parameter is specified, the total size of all files listed in the section is computed.

FileSize [in, out]

Pointer to a variable that receives the size, in bytes, of the specified file(s).

RoundingFactor [in]

Optional value for rounding file sizes. All file sizes are rounded up to a multiple of this number before being added to the total size. Rounding is useful for more exact determinations of the space that a file will occupy on a given volume, because it allows the caller to have file sizes rounded up to a multiple of the cluster size. Rounding does not occur unless RoundingFactor is specified.

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.


One and only one of the optional parameters, InfContext, FileName, and Section, must be specified.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]







Unicode and ANSI names

SetupGetSourceFileSizeW (Unicode) and SetupGetSourceFileSizeA (ANSI)

See also




Community Additions

© 2014 Microsoft