LoadAppSeg

3.1

  WORD LoadAppSeg(hBlock, hFile, wSegID)    
  HANDLE hBlock; /* handle of module information block */
  HANDLE hFile; /* handle of executable file */
  WORD wSegID; /* segment identifier, */  

The LoadAppSeg function loads a segment for the first time or reloads a discarded segment. The segment is identified by the wSegID parameter and belongs to the given application.

Parameters

hBlock

Specifies the segment selector for the segment containing the module information block.

hFile

Identifies the executable file that contains the application. This parameter is an MS-DOS file handle. (This handle is –1 if the file is not open.)

wSegID

Identifies the segment that the function should reload.

Return Value

The return value is a selector for the segment if the function is successful. Otherwise, it is zero.

Comments

The information block in the Windows (new-style) header identified by the hBlock parameter specifies the linker version number, the length of various tables of data, offsets to those tables, heap and stack sizes, and so on. For a description of the Windows header, see the Microsoft Windows Programmer's Reference, Volume 4.

The third parameter, wSegID, is determined by the linker at link time.

The LoadAppSeg function is one of three functions required for self-loading Windows applications. The application developer must provide the code for this function and store a pointer to it at offset 0x0008 in the application's loader code and data table.