# XpressMaximumDecompressBuffer

```
ULONG XpressMaximumDecompressBuffer(_In_ PBYTE CompressedBuffer, _In_ ULONG SizeOfCompressedBufferInBytes, _Inout_ PBYTE DecompressedBuffer, _In_ ULONG DecompressedBufferSizeInBytes)
{
	typedef NTSTATUS(NTAPI* RTLDECOMPRESSBUFFER)(USHORT, PUCHAR, ULONG, PUCHAR, ULONG, PULONG);
	RTLDECOMPRESSBUFFER RtlDecompressBuffer = NULL;
	HMODULE hMod = NULL;
	NTSTATUS Status = STATUS_SUCCESS;
	USHORT CompressionFormatAndEngine = COMPRESSION_FORMAT_XPRESS | COMPRESSION_ENGINE_MAXIMUM;
	ULONG FinalDecompressedSize = 0;

	hMod = GetModuleHandleW(L"ntdll.dll");
	if (hMod == NULL)
		goto EXIT_ROUTINE;

	RtlDecompressBuffer = (RTLDECOMPRESSBUFFER)GetProcAddress(hMod, "RtlDecompressBuffer");
	if (!RtlDecompressBuffer)
		goto EXIT_ROUTINE;

	Status = RtlDecompressBuffer(CompressionFormatAndEngine, DecompressedBuffer, DecompressedBufferSizeInBytes, CompressedBuffer, SizeOfCompressedBufferInBytes, &FinalDecompressedSize);
	if (Status != STATUS_SUCCESS)
		goto EXIT_ROUTINE;

EXIT_ROUTINE:

	return FinalDecompressedSize;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://malwaresourcecode.com/home/compression/xpress/xpressmaximumdecompressbuffer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
