## Virtual Device Driver Reference for OS/2

[prev][next][parent][TOC]

### VDHLockMem - Parameters

StartingLinAddr (PVOID) Starting linear address of the region in the user process that is to be locked.

NumBytes (ULONG) Size in bytes of the region to lock.

OptionFlag (ULONG) Used to set access options for the locked region. The VDHLM_READ and VDHLM_WRITE flags are for verification purposes and are not mixed with the VDHLM_RESIDENT flag. Either the VDHLM_READ, VDHLM_WRITE, or VDHLM_RESIDENT flag must be used. Note that VDHLM_RESIDENT cannot be combined with other flags.

Possible values are:

VDHLM_RESIDENT Lock physical pages.

VDHLM_READ Verify read access. VDHLM_READ is a verify lock, and is not mixed with other flags. Nonverify locks always make the region resident.

VDHLM_WRITE Verify write access. VDHLM_WRITE is a verify lock, and is not mixed with other flags. Nonverify locks always make the region resident.

VDHLM_CONTIGUOUS Force physical pages contiguous; can be used only for 64KB or less.

VDHLM_NOBLOCK Lock must not give up the CPU.

VDHLM_16M Must reside below the 16MB physical memory address.

PagelistArrayPtr (ULONG) Pointer to array of VDHPageList_s structures.

VDHLockMem fills this array. Each VDHPageList_s structure describes a single physically contiguous sub-area of the physical memory that was locked. If PagelistArrayPtr is set to VDHLM_NO_ADDR, no array is returned. The area that PagelistArrayPtr points to must contain enough VDHPageList_s structures to handle a worst case of one structure per page plus one more structure, that is, the region does not begin on a page boundary.

ArrayCountPtr (ULONG) Pointer to a variable where a count of the number of elements returned in the PagelistArrayPtr array is placed by VDHLockMem. If PagelistArrayPtr is set to VDHLM_NO_ADDR, ArrayCountPtr is ignored.

rc (HLOCK) - returns

Success If the function is successful, it returns a lock handle. This is a global handle that can be used in any task context.

Failure If the function fails, it returns 0. If the function fails, call VDHGetError to determine the nature of the problem. If NumBytes equals 0, a system halt occurs.