LocalLock

更新时间:2022-07-07 00:45

LocalLock是锁定一个本地内存项目 并且 返回一个指向内存块第一个Byte的指针

简介

.

NoteThe local functions have greater overhead and provide fewer features than other memory management functions. New applications should use the heap functionsunless documentation states that a local function should be used. For more information, see Global and Local Functions.

格式

LPVOID WINAPI LocalLock( __in HLOCAL hMem );

参数

hMem[in] 本地内存的句柄 这个句柄要么被 LocalAlloc返回,要么被 LocalReAlloc返回.

说明

如果函数执行成功, 返回值将是一个指向内存块第一个Byte的指针

如果函数失败,返回值将是NULL. To get extended error information, call GetLastError.

Remarks

The internal data structures for each memory object include a lock count that is initially zero. For movable memory objects, LocalLockincrements the count by one, and the LocalUnlockfunction decrements the count by one. Each successful call that a process makes toLocalLockfor an object must be matched by a corresponding call to LocalUnlock. Locked memory will not be moved or discarded unless the memory object is reallocated by using the LocalReAllocfunction. The memory block of a locked memory object remains locked in memory until its lock count is decremented to zero, at which time it can be moved or discarded.

Memory objects allocated with LMEM_FIXEDalways have a lock count of zero. For these objects, the value of the returned pointer is equal to the value of the specified handle.

If the specified memory block has been discarded or if the memory block has a zero-byte size, this function returns NULL.

Discarded objects always have a lock count of zero.

免责声明
隐私政策
用户协议
目录 22
0{{catalogNumber[index]}}. {{item.title}}
{{item.title}}