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

Syntax

WINSETUPAPI BOOL SetupGetSourceFileSizeA(
  [in]      HINF        InfHandle,
  [in]      PINFCONTEXT InfContext,
  [in]      PCSTR       FileName,
  [in]      PCSTR       Section,
  [in, out] PDWORD      FileSize,
  [in]      UINT        RoundingFactor
);

Parameters

[in] InfHandle

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.

[in] InfContext

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.

[in] FileName

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.

[in] Section

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.

[in, out] FileSize

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

[in] RoundingFactor

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.

Remarks

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

Note

The setupapi.h header defines SetupGetSourceFileSize 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.

Requirements

Requirement Value
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

Functions

Overview

SetupGetSourceFileLocation