User`s guide

Contents cxxxix
Storage Manager—Function 17
This function allows your application elementary control of blocks of memory for use with the
Windows HLLAPI function calls.
The Storage Manager (17) function allows easy migration of existing applications (typically BASIC
interpreter applications) that use Storage Manager (17) functions. The new BASIC applications can
use this function, but are not required to. The other supported languages may also use this function.
There are four available sub-functions to the Storage Manager (17) function:
u Get Storage
u Free Storage
u Free All Storage
u Query Free Storage
Each of the sub-functions has supplied parameters and returned parameters, and generates a set of
possible return codes. These sub-functions are discussed in detail in the following pages.
WinHLLAPI returns a return code of WHLLPARAMETERERROR for an invalid sub-function
number. The sub-functions are identified to WinHLLAPI by the sub-function number being placed in
the PS Position calling parameter.
Storage Manager (17) may allocate blocks from 16 bytes to 64 Kbytes in size. The Storage Manager
(17) function does not allocate shared memory.
WinHLLAPI lists the results of the Storage Manager (17) function and places them into a table. Once a
request to Get Storage is placed into the table, WinHLLAPI checks the table for free bytes to satisfy the
current request. If there is sufficient storage, the free block is marked allocated and is given to the user.
If there is not sufficient storage, the user should take what steps are necessary to allocate the memory
via normal operating system calls.
When a Free Storage call is made, the specified block is then marked as free in the table.
If a Free All Storage call is made, all blocks in the table are marked as free, and no more use may be
made by the application of blocks previously acquired from Get Storage.
A Query Free Storage call returns the size of the single largest area that is currently available.
None.
Get Storage
The Get Storage sub-function allocates a block of storage to be used by the calling Windows HLLAPI
application.
WinHLLAPI(STORAGEMGR,lpbyString,lpwLength,GETSTORAGE)
Parameter Description
Data String A 4-byte string.
Data Length Size (in bytes) of the requested storage area.
PS Position 01 (GETSTORAGE)
Parameter Description
Data String
The storage address is expressed as two binary words: offset
and selector. The offset first, then the selector.
Data Length Storage Block ID of the requested storage area.
Code Description
WHLLOK The requested storage was allocated.
Prerequisite
Functions
Function Call
Call Parameters
Return Parameters
Return Codes