unsigned char LancerExecutable(unsigned char *exe_name_str) { char *pOriginalExec,*pCopiedExec,isarchived; HARDWARE_PARM_BLOCK *hpb; short hardwareVersion; long ghost_offset; unsigned short ExecLength; HANDLE CopieHdl,ExecHdl; SYM_ENTRY *SymPtr; isarchived=0; SymPtr=DerefSym(SymFind(SYMSTR (exe_name_str))); ExecHdl=SymPtr->handle; isarchived=SymPtr->flags.bits.archived; if (HeapGetLock(ExecHdl)) { pCopiedExec= pOriginalExec= HeapDeref(ExecHdl); ExecHdl= 0; } else { HeapMoveHigh(ExecHdl); pCopiedExec= pOriginalExec= HLock(ExecHdl); } ExecLength= *(unsigned short *)pCopiedExec + 3; if (isarchived) { CopieHdl= HeapAllocHigh(ExecLength); if (CopieHdl == H_NULL) { if (ExecHdl) HeapUnlock(ExecHdl); return 0; } pCopiedExec= HeapDeref(CopieHdl); memcpy(pCopiedExec, pOriginalExec, ExecLength); } else CopieHdl= H_NULL; hpb= (HARDWARE_PARM_BLOCK *)FL_getHardwareParmBlock(); if (hpb->len+2-4 < offsetof(HARDWARE_PARM_BLOCK,gateArray)) hardwareVersion= 1; else hardwareVersion= hpb->gateArray; ghost_offset= hardwareVersion == 2 ? 0x40000 : 0; EX_patch(pCopiedExec + 2 + ghost_offset, pCopiedExec + ExecLength + ghost_offset - 2); ASM_call(pCopiedExec + 2 + ghost_offset); if (ExecHdl) HeapUnlock(ExecHdl); if (isarchived) HeapFree(CopieHdl); return 1; } unsigned char f_runasm_(unsigned char *exe_name_str) { return LancerExecutable(exe_name_str); }