SetupGetFileCompressionInfoExW 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 SetupGetFileCompressionInfoEx function examines a potentially compressed file and gets the type of compression, the file's full path (including file name), the compressed size, and the size of the uncompressed target file. The caller of the function passes in the name of the file to be examined and pointers to locations for the buffer and buffer size to receive the returned file name and path.
To determine the size of the buffer for the returned path and file name, you can call SetupGetFileCompressionInfoEx with ActualSourceFileNameBuffer specified Null and ActualSourceFileNameLen containing 0. The function succeeds and on return fills in RequiredBufferLen.
Syntax
WINSETUPAPI BOOL SetupGetFileCompressionInfoExW(
[in] PCWSTR SourceFileName,
[in, out] PWSTR ActualSourceFileNameBuffer,
[in, out] DWORD ActualSourceFileNameBufferLen,
[out] PDWORD RequiredBufferLen,
[out] PDWORD SourceFileSize,
[out] PDWORD TargetFileSize,
[out] PUINT CompressionType
);
Parameters
[in] SourceFileName
File name of the potentially compressed file to be examined. If the file is not found on the source media exactly as named, Setup searches for up to two alternate names. For example; if Setup does not find F:\x86\cmd.exe, it searches for F:\mpis\cmd.ex_ and if that name is not found, it searches for F:\x86\cmd.ex$.
[in, out] ActualSourceFileNameBuffer
Pointer to a buffer that receives the actual file name and path if this parameter is not NULL. This is valid only if the function returns NO_ERROR.
[in, out] ActualSourceFileNameBufferLen
Size of the buffer specified by ActualSourceFileNameBuffer, in characters. You would typically use a buffer size of MAX_PATH. If ActualSourceFileNameLen is too small, the function fails with ERROR_INSUFFICIENT_BUFFER. ActualSourceFileNameLen must contain zero if ActualSourceFileNameBuffer is NULL.
[out] RequiredBufferLen
Size of the file name and full path including the terminating NULL, if this parameter is not NULL. If ActualSourceFileNameBuffer is NULL and ActualSourceFileNameLen is zero, the function succeeds but fills in RequiredBufferLen. This parameter is valid only if the function returns NO_ERROR or ERROR_INSUFFICIENT_BUFFER.
[out] SourceFileSize
Pointer to a variable in which this function returns the size of the file in its current form, which is the current size of the file named by ActualSourceFileNameBuffer. 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 or ERROR_INSUFFICIENT_BUFFER.
[out] TargetFileSize
Pointer to a variable in which this function returns the size that 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 or ERROR_INSUFFICIENT_BUFFER.
[out] CompressionType
Pointer to a 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 or ERROR_INSUFFICIENT_BUFFER. This parameter 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 LZ compression.
FILE_COMPRESSION_MSZIP
The source file is compressed with MSZIP compression.
Return value
If the function succeeds, the return value is TRUE (nonzero).
If the function fails, the return value is FALSE (zero). The function can also return one of the following system error codes.
To get extended error information, call GetLastError.
Remarks
Because SetupGetFileCompressionInfoEx determines the compression by examining the physical file, your setup application should ensure that the file is present before calling SetupGetFileCompressionInfoEx.
Note
The setupapi.h header defines SetupGetFileCompressionInfoEx as an alias that 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 is 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 |