x86BiosAllocateBuffer

This function allocates a transfer buffer in the shadow memory of the x86 BIOS emulator.

Declaration

NTSTATUS
x86BiosAllocateBuffer (
    ULONG *Size,
    USHORT *Segment,
    USHORT *Offset);

Parameters

The Size argument is the address of a variable that provides the size (in bytes) that is wanted for the buffer, and which provides on output the size that is allocated. If the function succeeds, the size allocated will be at least as many as requested.

The Segment and Offset arguments provide the address of variables that are to receive a real-mode segment and offset for the allocated buffer.

Return Value

The function returns zero (STATUS_SUCCESS) for success, else a status code.

Behaviour

This function accesses a simple memory manager which has just one buffer. This buffer is 4KB at the real-mode address 2000:0000.

It is an error (STATUS_INSUFFICIENT_RESOURCES) if this simple memory manager is not initialised or if the buffer is already allocated or if the request is too large for the one buffer. Otherwise, the caller is allocated the whole buffer, at the real-mode address 2000:0000, and the function succeeds.

The allocated buffer can be returned to the memory manager by calling the x86BiosFreeBuffer function.

Availability

The x86BiosAllocateBuffer function is exported by name from the HAL in version 6.0 and higher. It is undocumented.