24.3.1 Loading Segments

The kernel calls the BootApp function supplied by the application developer, instead of loading the application in the normal manner, if the 16-bit value in the information block for the Windows header contains the value 0x0800 (that is, bit 11 is set). The BootApp function allocates memory for all segments by calling the kernel-supplied MyAlloc function. If the segment is identified as a PRELOAD or FIXED type, BootApp also calls the LoadAppSeg function (another function supplied by the application developer). The BootApp function also calls SetOwner, a kernel-supplied function, to associate the correct information block with each segment handle.

The first segment that the BootApp function should allocate is the application's automatic data segment. This data segment contains the application's stack. The automatic data segment must be allocated before the BootApp function calls the Windows PatchCodeHandle function. For more information about the PatchCodeHandle function, see the Microsoft Windows Programmer's Reference, Volume 2.