RtlGetCompressionWorkSpaceSize function (ntifs.h)
The RtlGetCompressionWorkSpaceSize function is used to determine the correct size of the WorkSpace buffer for the RtlCompressBuffer and RtlDecompressFragment functions.
Syntax
NT_RTL_COMPRESS_API NTSTATUS RtlGetCompressionWorkSpaceSize(
[in] USHORT CompressionFormatAndEngine,
[out] PULONG CompressBufferWorkSpaceSize,
[out] PULONG CompressFragmentWorkSpaceSize
);
Parameters
[in] CompressionFormatAndEngine
Bitmask specifying the compression format and engine type. This parameter must be set to a valid bitwise OR combination of one format type and one engine type. For example, COMPRESSION_FORMAT_LZNT1 | COMPRESSION_ENGINE_STANDARD.
The meanings of these, and other related values, are as follows:
[out] CompressBufferWorkSpaceSize
A pointer to a caller-allocated buffer receiving the size, in bytes, required to compress a buffer. This value is used to determine the correct size of RtlCompressBuffer's WorkSpace buffer.
[out] CompressFragmentWorkSpaceSize
A pointer to a caller-allocated buffer receiving the size, in bytes, required to decompress a compressed buffer to a fragment. This value is used to determine the correct size of RtlDecompressFragment's WorkSpace buffer. Note that the RtlCompressFragment function does not currently exist.
Return value
RtlGetCompressionWorkSpaceSizereturns an appropriate error status, such as one of the following:
| Return code | Description |
|---|---|
|
The required buffer sizes, in bytes, were successfully returned. |
|
An invalid compression format was specified via the CompressionFormatAndEngine parameter. If CompressionFormatAndEngine is either COMPRESSION_FORMAT_NONE or COMPRESSION_FORMAT_DEFAULT (but not both), this value is returned. |
|
An invalid compression format was specified via the CompressionFormatAndEngine parameter. If CompressionFormatAndEngine is not one of the following, STATUS_UNSUPPORTED_COMPRESSION is returned:
|
|
An invalid compression engine was specified via the CompressionFormatAndEngine parameter. If CompressionFormatAndEngine is not COMPRESSION_ENGINE_STANDARD or COMPRESSION_ENGINE_MAXIMUM (but not both), this value is returned. |
Remarks
The RtlCompressBuffer and RtlDecompressFragmentfunctions require an appropriately sized work space buffer to compress and decompress successfully. To determine the correct work space buffer size, in bytes, call the RtlGetCompressionWorkSpaceSize function.
As an example, the WorkSpace parameter of the RtlCompressBuffer function must point to an adequately sized work space buffer. The CompressBufferWorkSpaceSize parameter of the RtlGetCompressionWorkSpaceSize provides this size.
To compress an uncompressed buffer, use the RtlCompressBuffer function.
To decompress a compressed buffer, use the RtlDecompressBuffer function.
To decompress only a portion of a compressed buffer (that is, a "fragment" of the buffer), use the RtlDecompressFragment function.
Requirements
| Minimum supported client | Windows XP |
| Target Platform | Universal |
| Header | ntifs.h (include Fltkernel.h, Ntifs.h) |
| Library | NtosKrnl.lib |
| DLL | NtosKrnl.exe |
| IRQL | <= APC_LEVEL |
See also
Feedback
Submit and view feedback for