Windows Driver Kit: Installable File System Drivers
RtlDecompressBuffer
The RtlDecompressBuffer function decompresses an entire compressed buffer.
NTSTATUS
RtlDecompressBuffer (
__in USHORT CompressionFormat,
__out PUCHAR UncompressedBuffer,
__in ULONG UncompressedBufferSize,
__in PUCHAR CompressedBuffer,
__in ULONG CompressedBufferSize,
__out PULONG FinalUncompressedSize
);
Parameters
- CompressionFormat
- Bitmask specifying the compression format of the compressed buffer. This parameter must be set to COMPRESSION_FORMAT_LZNT1. The meaning of this and other related compression format values are as follows:
| Value | Meaning |
| COMPRESSION_FORMAT_NONE | Not supported by this function. |
| COMPRESSION_FORMAT_DEFAULT | Not supported by this function. |
| COMPRESSION_FORMAT_LZNT1 | Specifies that compression should be performed. This value is required. |
- UncompressedBuffer
- Pointer to a caller-allocated buffer (allocated from paged or non-paged pool) receiving the decompressed data from CompressedBuffer. This parameter is required and cannot be NULL.
- UncompressedBufferSize
- The size, in bytes, of the UncompressedBuffer buffer.
- CompressedBuffer
- A pointer to the buffer containing the data to decompress. This parameter is required and cannot be NULL.
- CompressedBufferSize
- The size, in bytes, of the CompressedBuffer buffer.
- FinalUncompressedSize
- A pointer to a caller-allocated variable which receives the size, in bytes, of the decompressed data stored in UncompressedBuffer. This parameter is required and cannot be NULL.
Return Value
RtlDecompressBuffer returns an appropriate error status value, such as one of the following:
- STATUS_SUCCESS
- The CompressedBuffer buffer was successfully decompressed.
- STATUS_INVALID_PARAMETER
- An invalid compression format was specified via the CompressionFormat parameter. If CompressionFormat is either COMPRESSION_FORMAT_NONE or COMPRESSION_FORMAT_DEFAULT (but not both), this value is returned.
- STATUS_UNSUPPORTED_COMPRESSION
- An invalid compression format was specified via the CompressionFormat parameter. If CompressionFormat is not one of the following, STATUS_UNSUPPORTED_COMPRESSION is returned:
- COMPRESSION_FORMAT_LZNT1
- COMPRESSION_FORMAT_NONE (in this case, STATUS_INVALID_PARAMETER is returned).
- COMPRESSION_FORMAT_DEFAULT (in this case, STATUS_INVALID_PARAMETER is returned).
- STATUS_BAD_COMPRESSION_BUFFER
- UncompressedBuffer is not large enough to contain the uncompressed data.
Comments
The RtlDecompressBuffer function takes as input an entire compressed buffer and produces its decompressed equivalent provided that the uncompressed data fits within the specified destination buffer.
To decompress only a portion of a compressed buffer (that is, a "fragment" of the buffer), use the RtlDecompressFragment function.
To compress an uncompressed buffer, use the RtlCompressBuffer function.
Requirements
Versions: Available in Microsoft Windows XP and later versions of all Windows operating systems.
IRQL: <= APC_LEVEL
Headers: Declared in Ntifs.h. Include Fltkernel.h or Ntifs.h.
Library: Contained in Ntoskrnl.lib.
See Also
FILE_COMPRESSION_INFORMATION, RtlCompressBuffer, RtlDecompressFragment, RtlGetCompressionWorkSpaceSize