SetupGetSourceFileSize

The SetupGetSourceFileSize function reads the uncompressed size of a source file listed in an INF file.

BOOL SetupGetSourceFileSize(
  HINF InfHandle,      // handle of the INF file
  PINFCONTEXT InfContext,  // optional, context of the INF file
  PCTSTR FileName,     // optional, filename to find size of
  PCTSTR Section,      //optional, section in an INF file
  PDWORD FileSize,     // receives the size of the file
  UINT RoundingFactor  // optional, round to a muliple of this
);
 

Parameters

InfHandle
Handle of the loaded INF file that contains the SourceDisksNames and SourceDisksFiles sections. If platform-specific sections exist for the user's system (for example, SourceDisksNames.mips and SourceDisksFiles.mips), the platform-specific section will be used.
InfContext
This optional parameter points 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
This optional parameter points 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
This optional parameter points 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
Pointer to a caller-supplied variable that receives the size, in bytes, of the specified file(s).
RoundingFactor
This optional parameter supplies a 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 Values

If the function succeeds, the return value is a non-zero 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.

QuickInfo

  Windows NT: Use version 4.0 and later.
  Windows: Use Windows 95 and later.
  Windows CE: Unsupported.
  Header: Declared in setupapi.h.
  Import Library: Link with setupapi.lib.

See Also

Overview, Functions, SetupGetSourceFileLocation