RtlpEnsureBufferSize

Go to Home Page

Ensures a RTL_BUFFER's dynamic buffer is big enough to accommodate a specified size

Syntax

NTSTATUS WINAPI RtlpEnsureBufferSize (
    ULONG flags,
    PRTL_BUFFER pBuffer,
    SIZE_T requiredSize
)

Parameters

flags
Bit flags modifying the behaviour of the function. This can be 0 or the following value:
RTLP_SKIP_BUFFER_COPY (0x1)
If a new buffer is allocated, don't copy over the original contents of pBuffer->Buffer
pBuffer
The buffer whose dynamic size is to be ensured
requiredSize
Buffer size required

Return Value

STATUS_SUCCESS if all went well, an error code otherwise

Remarks

The memory buffer is allocated by RtlAllocateHeap with the process heap.

If the current size of the dynamic portion of the RTL_BUFFER is more than requiredSize, the function does nothing.

RTL_BUFFERs are used in such functions as RtlNtPathNameToDosPathName and RtlAppendPathElement, sometimes wrapped in other structures. The definition of an RTL_BUFFER is:

typedef struct _RTL_BUFFER 
{
    PUCHAR Buffer;
    PUCHAR StaticBuffer;
    SIZE_T Size;
    SIZE_T StaticSize;
    SIZE_T ReservedForAllocatedSize;
    PVOID ReservedForIMalloc;
} RTL_BUFFER, *PRTL_BUFFER;