Allocating and Using Memory
You can allocate either local memory or global memory for use at interrupt time.
Local Memory
To allocate local memory for use at interrupt time, follow these steps:
- Use LocalAlloc with the LMEM_FIXED flag to get a handle to the memory block. (This assumes fixed data segments.)
- Pass this handle to LocalLock to get a near pointer to the memory block.
Global Memory
Any global memory a driver uses at interrupt time must be page-locked. To allocate and page-lock global memory, follow these steps:
- Use GlobalAlloc with the GMEM_MOVEABLE and GMEM_SHARE flags to get a handle to the memory block.
- Pass this handle to GlobalLock to get a far pointer to the memory block.
- Pass the high-order word of the far pointer to GlobalPageLock to page-lock the memory block.