Simulation support:
None.
Description
GreEscape DEVESC_VRAMALLOC is called by EnDIVE users to allocate off-screen video memory, into which the function puts images. The driver is responsible for allocating and deallocating memory from its available video memory. The VRAMALLOCIN data structure contains a function code (ulFunction), which specifies allocation or deallocation. If video memory is not supported or available, the EnDIVE user is responsible for allocating system memory used to hold the image for output by the driver.
Two types of memory allocation can be requested: shared or private. Shared memory reuses memory that is shared among all EnDIVE users in the system. Users of shared memory must assume that it is valid only when bracketed betweenDEVESC_HWREQUEST calls. Private or unshared memory is assumed by the EnDIVE user to be retained solely for its use until the memory is deallocated.
For the user of GreEscape DEVESC_VRAMALLOC, the information in GreEscape DEVESC_EXTQUERY is assumed to correctly describe off-screen VRAM. However, a duplicate ulScanLineBytes field is provided here in GreEscape DEVESC_VRAMALLOC, in case the memory allocated by this function has a different scanline length.
The ulSize field in the VRAMALLOCIN data structure is modified by the display driver to reflect the exact number of bytes allocated (will be DWORD aligned). A nonzero return code indicates the allocation failed.
#define INCL_GRE_DEVICE #include <os2.h> HDC hdc; /* Device context handle. */ LONG ICODE; /* DEVESC_VRAMALLOC escape code. */ LONG lInCount; /* Number of bytes pointed to by pbInData. */ PBYTE pbInData; /* Pointer to VRAMALLOCIN data structure. */ PLONG plOutCount; /* Number of bytes pointed to by pbOutData. */ PLONG pbOutData; /* Pointer to VRAMALLOCOUT data structure. */ LONG rc; /* Return Codes. */ rc = GreEscape(hdc, ICODE, lInCount, pbInData, plOutCount, pbOutData);