UnlockSegment

Syntax

BOOL UnlockSegment(wSegment)

This function unlocks the segment whose segment address is specified by the wSegment parameter. If wSegment is –1, the UnlockSegment function unlocks the current data segment.

In real mode, or if the segment is discardable, UnlockSegment decreases the segment's lock count by one. In protected mode, UnlockSegment decreases the lock count of dis-cardable objects and automatic data segments only. The segment is completely unlocked and subject to moving or discarding if the lock count is decreased to zero. Other functions also can affect the lock count of a memory object. See the description of the GlobalFlags function for a list of the functions that affect the lock count.

In all cases, each time an application calls LockSegment for a segment, it must eventually call UnlockSegment for the segment.

Parameter Type/Description  

wSegment WORD Specifies the segment address of the segment to be unlocked. If wSegment is –1, the UnlockSegment function unlocks the current data segment.  

Return Value

The return value specifies the outcome of the function. It is zero if the segment's lock count was decreased to zero. Otherwise, the return value is nonzero. An application should not rely on the return value to determine the number of times it must subsequently call UnlockSegment for the segment.