/************************************************************************* *** segha.c (JJB TEMPLAR) *** *** Date begun: 18/8/89. *** *** Last modified: 18/8/89. *** *************************************************************************/ /*** Something cunning, or a mass of GURUs? *** *************************************************************************/ #include #include #include #include #include #include #include extern struct WBStartup *WBenchMsg; extern struct DOSBase *DOSBase; extern BPTR far myseg; /* What to return for mLoadSeg */ extern __fptr far realLoadSeg; /* Thank you for __fptr Lattice! */ extern __fptr far realUnLoadSeg; extern void mLoadSeg(); extern void mUnLoadSeg(); void onseg() /*=======================================================*/ { return; if (!WBenchMsg) return; /* Do nothing if not from WB */ myseg = WBenchMsg->sm_Segment; Disable(); realLoadSeg = SetFunction(DOSBase,-0x0096,mLoadSeg); realUnLoadSeg = SetFunction(DOSBase,-0x009c,mUnLoadSeg); Enable(); } void offseg() /*======================================================*/ { return; if (!WBenchMsg) return; /* Nothing from WB */ Disable(); SetFunction(DOSBase,-0x009c,realUnLoadSeg); SetFunction(DOSBase,-0x0096,realLoadSeg); Enable(); }