BOOL LocalInit(wSegment,pStart,pEnd)
This function initializes a local heap in the segment specified by the wSegment parameter.
Parameter | Type/Description |
wSegment | WORD Specifies the segment address of the segment that is to contain the local heap. | |
pStart | PSTR Specifies the address of the start of the local heap within the segment. | |
pEnd | PSTR Specifies the address of the end of the local heap within the segment. |
The return value specifies a Boolean value that is nonzero if the heap is initialized. Otherwise, it is zero.
If the pStart parameter is zero, the pEnd parameter specifies the offset of the last byte of the global heap from the end of the segment. For example, to initialize a 4096-byte heap with the first byte at byte 0, set pStart to 0 and pEnd to 4095.
LocalInit calls the GlobalLock function for the data segment that contains the local heap. This ensures that the data segment will not be moved in memory. However, the memory will be moved if both of these conditions are true:
1.The data segment is moveable.
2.The application calls the LocalAlloc or LocalReAlloc function and, as a result, Windows must increase the size of the heap. If Windows cannot increase the size of the data segment that contains the local heap without moving it, Windows will move the data segment.
An application can explicitly prevent Windows from moving the data segment by calling the LockData function to lock the data segment.
An application can remove this initial lock count by calling the UnlockData function.