3.3 Segment Functions

Segment functions allocate, free, and convert selectors; lock and unlock memory blocks referenced by selectors; and retrieve information about segments. The following list briefly describes each selector function:

Function Description  
AllocDStoCSAlias Accepts a data-segment selector and returns a code-segment selector that can be used to execute code in a data segment.  
AllocSelector Allocates a new selector.  
ChangeSelector Generates a temporary code selector that corresponds to a given data selector, or a temporary data selector that corresponds to a given code selector.  
DefineHandleTable Creates a private handle table which Windows updates automatically.  
FreeSelector Frees a selector originally allocated by the
AllocSelector
or AllocDStoCSAlias functions.
 
GetCodeInfo Retrieves information about a code segment.  
GlobalFix Prevents a global memory block from moving in linear memory.  
GlobalPageLock    
  Page-locks the memory associated with the specified global selector and increments its page-lock count. Memory that is page-locked cannot be moved or paged out to disk.  
Function Description  
GlobalPageUnlock Decrements the page-lock count for a block of memory. If the page-lock count reaches zero, the memory can be moved and paged out to disk.  
GlobalUnfix Unlocks a global memory block previously fixed
by the GlobalFix function.
 
LockSegment Locks a segment in memory.  
UnlockSegment Unlocks a segment previously locked by the
LockSegment function.
 

NOTE:

An application should not use these functions unless it is absolutely necessary. Use of these functions violates preferred Windows programming practices.