wert@titan.rice.edu@rice.EDU (Scott Comer) (05/28/87)
The old Warp 9 hard disk INIT code (INIT 16) has two problems that should be considered: Number one is that it incorrectly sets the default volume when it switch launches to the hard disk. The default volume should be the blessed folder, but was set to the root of the volume instead. This causes any file based INITs that should be executed via INIT 31 to be missed. Number two is that it frees itself upon exit, which causes the system heap to become trashed. This is because the INIT mechanism takes the following steps to run an INIT: h := GetIndResource(...) if (h <> nil) then begin DetachResource(h) call it trash the first two words into NOPs end etc. If an INIT disposes of itself, the handle will be put onto the free list of handles. Specifically, the first handle on the free list is stored in the handle being freed and that handle becomes the first on the free list. So, trashing the first two words of the handle into NOPs results in the original first handle on the free list being filled with 4E714E71. You can then allocate two handles from the system heap without problem. The third causes a access violation or bus error or whatever. And the rest of the free handles in the system zone are lost. This only applies to system file resident INITs, not those executed via INIT 31. That is not to say that those INITs do not suffer from this same malady, just that I haven't looked at them. Apparently system file INITs are not supposed to be freed. I finally unlocked the block and made it purgeable, but that still wastes a handle. Anyone know anything more about this? Anyone that wants corrected Warp 9 INIT code, just ask. scott out