SetupGetFileCompressionInfo

The SetupGetFileCompressionInfo function examines a physical file to determine if it is compressed and gets its full path, size, and the size of the uncompressed target file.

DWORD SetupGetFileCompressionInfo(
  PCTSTR SourceFileName,        // file to investigate
  PTSTR *ActualSourceFileName,  // receives compressed name
  PDWORD SourceFileSize,        // receives compressed size
  PDWORD TargetFileSize,        // receives uncompressed size
  PUINT CompressionType         // receives compression type
);
 

Parameters

SourceFileName
Filename of the file about which information is required. If the file is not found on the source media exactly as named, the file is searched for with up to two alternate "compressed-form" names. For example, if the file is F:\mips\cmd.exe and it is not found, F:\mpis\cmd.ex_ is searched for and, if that is not found, F:\mips\cmd.ex$ is searched for.
ActualSourceFileName
Supplies a pointer to a caller-supplied variable in which this function returns the full path of the file that was actually located. The caller can free the pointer with a call to LocalFree. The path is valid only if the function returns NO_ERROR.
SourceFileSize
Supplies a pointer to a caller-supplied variable in which this function returns the size of the file in its current form which is the current size of the filenamed by ActualSourceFileName. The size is determined by examining the source file; it is not retrieved from an INF file. The source file size is valid only if the function returns NO_ERROR.
TargetFileSize
Supplies a pointer to a caller-supplied variable in which this function returns the size the file will occupy when it is uncompressed or copied. If the file is not compressed, this value will be the same as SourceFileSize. The size is determined by examining the file; it is not retrieved from an INF file. The target file size is valid only if the function returns NO_ERROR.
CompressionType
Supplies a pointer to a caller-supplied variable in which this function returns a value indicating the type of compression used on ActualSourceFileName. The compression type is valid only if the function returns NO_ERROR. The value can be one of the following flags:
FILE_COMPRESSION_NONE
The source file is not compressed with a recognized compression algorithm.
FILE_COMPRESSION_WINLZA
The source file is compressed with winlza (using compress.exe without the -z switch or LZXxx Win32 functions).
FILE_COMPRESSION_MSZIP
The source file is compressed with mszip (using compress.exe with the -z switch).

Return Values

The function returns a Win32 error code that indicates the outcome of the file search. The error code can be one of the following:

ERROR_FILE_NOT_FOUND
The file cannot be found.
NO_ERROR
The file was located and the output parameters were filled in.

To get extended error information, call GetLastError.

Remarks

Because SetupGetFileCompressionInfo determines the compression by referencing the physical file, your setup application should ensure that the file is present before calling SetupGetFileCompressionInfo.

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, SetupDecompressOrCopyFile