HeapVidMemAllocAligned function (dmemmgr.h)

The HeapVidMemAllocAligned function allocates off_screen_memory for a display driver by using the DirectDraw video memory heap manager.


FLATPTR HeapVidMemAllocAligned(
  [in]  LPVIDMEM           lpVidMem,
  [in]  DWORD              dwWidth,
  [in]  DWORD              dwHeight,
  [in]  LPSURFACEALIGNMENT lpAlignment,
  [out] LPLONG             lpNewPitch


[in] lpVidMem

Pointer to a VIDEOMEMORY structure that represents the DirectDraw heap from which to allocate the surface.

[in] dwWidth

Is the width in bytes of the requested surface.

[in] dwHeight

Is the height in scan lines of the requested surface.

[in] lpAlignment

Pointer to a SURFACEALIGNMENT structure that describes the alignment restrictions for the surface.

[out] lpNewPitch

Is the location in which the resulting pitch value is written. This information is relevant only to linear (nonrectangular) off-screen heaps.

Return value

HeapVidMemAllocAligned returns the FLATPTR offset of the resulting allocation upon success. Otherwise, it returns zero.


The driver should use the array of VIDEOMEMORY structures its DrvGetDirectDrawInfo function receives to determine the value of lpVidMem with which to call HeapVidMemAllocAligned. The driver receives this array in the pvmList parameter during the second call to DrvGetDirectDrawInfo. It is possible that DrvGetDirectDrawInfo might not be called when low memory conditions exist on the system. Consequently, the driver should always check to ensure that it has a non-NULL pointer in pvmList.


Minimum supported client Available in Windows 2000 and later versions of the Windows operating systems.
Target Platform Universal
Header dmemmgr.h (include Winddi.h)
Library Win32k.lib
DLL Win32k.sys

See also