#ifndef LIBRARIES_XFDMASTER_H #define LIBRARIES_XFDMASTER_H /* ** $VER: xfdmaster.h 39.5 (31.08.2002) ** ** Copyright © 1994-2002 by Georg Hörmann, Dirk Stöcker ** All Rights Reserved. */ #ifndef EXEC_LIBRARIES_H #include #endif /********************* * * * Library Base * * * *********************/ struct xfdMasterBase { struct Library LibNode; ULONG xfdm_SegList; /* PRIVATE! */ struct DosLibrary * xfdm_DosBase; /* May be used for I/O etc. */ struct xfdSlave * xfdm_FirstSlave; /* List of available slaves */ struct xfdForeMan * xfdm_FirstForeMan; /* PRIVATE! */ ULONG xfdm_MinBufferSize;/* (V36) Min. BufSize for xfdRecogBuffer() */ ULONG xfdm_MinLinkerSize;/* (V36) Min. BufSize for xfdRecogLinker() */ struct ExecBase * xfdm_ExecBase; /* (V38.2) Cached for fast access */ }; #define XFDM_VERSION 39 /* for OpenLibrary() */ #define XFDM_NAME "xfdmaster.library" /*************************** * * * Object Types (V36) * * * ***************************/ #define XFDOBJ_BUFFERINFO 1 /* xfdBufferInfo structure */ #define XFDOBJ_SEGMENTINFO 2 /* xfdSegmentInfo structure */ #define XFDOBJ_LINKERINFO 3 /* xfdLinkerInfo structure */ #define XFDOBJ_SCANNODE 4 /* (V37) xfdScanNode structure */ #define XFDOBJ_SCANHOOK 5 /* (V37) xfdScanHook structure */ #define XFDOBJ_MAX 5 /* PRIVATE! */ /******************** * * * Buffer Info * * * ********************/ struct xfdBufferInfo { APTR xfdbi_SourceBuffer; /* Pointer to source buffer */ ULONG xfdbi_SourceBufLen; /* Length of source buffer */ struct xfdSlave *xfdbi_Slave; /* PRIVATE! */ STRPTR xfdbi_PackerName; /* Name of recognized packer */ UWORD xfdbi_PackerFlags; /* Flags for recognized packer */ UWORD xfdbi_Error; /* Error return code */ APTR xfdbi_TargetBuffer; /* Pointer to target buffer */ ULONG xfdbi_TargetBufMemType;/* Memtype of target buffer */ ULONG xfdbi_TargetBufLen; /* Full length of buffer */ ULONG xfdbi_TargetBufSaveLen;/* Used length of buffer */ ULONG xfdbi_DecrAddress; /* Address to load decrunched file */ ULONG xfdbi_JmpAddress; /* Address to jump in file */ APTR xfdbi_Special; /* Special decrunch info (eg. password) */ UWORD xfdbi_Flags; /* (V37) Flags to influence recog/decr */ UWORD xfdbi_Reserved0; /* (V38) PRIVATE! */ ULONG xfdbi_MinTargetLen; /* (V38) Required length of target buffer */ ULONG xfdbi_FinalTargetLen; /* (V38) Final length of decrunched file */ APTR xfdbi_UserTargetBuf; /* (V38) Target buffer allocated by user */ ULONG xfdbi_UserTargetBufLen;/* (V38) Target buffer length */ ULONG xfdbi_MinSourceLen; /* (V39) minimum source length (tested by master library */ }; #define xfdbi_MaxSpecialLen xfdbi_Error /* Max. length of special info */ /********************* * * * Segment Info * * * *********************/ struct xfdSegmentInfo { ULONG xfdsi_SegList; /* BPTR to segment list */ struct xfdSlave *xfdsi_Slave; /* PRIVATE! */ STRPTR xfdsi_PackerName; /* Name of recognized packer */ UWORD xfdsi_PackerFlags; /* Flags for recognized packer */ UWORD xfdsi_Error; /* Error return code */ APTR xfdsi_Special; /* Special decrunch info (eg. password) */ UWORD xfdsi_RelMode; /* (V34) Relocation mode */ UWORD xfdsi_Flags; /* (V37) Flags to influence recog/decr */ }; #define xfdsi_MaxSpecialLen xfdsi_Error /* Max. length of special info */ /************************** * * * Linker Info (V36) * * * **************************/ struct xfdLinkerInfo { APTR xfdli_Buffer; /* Pointer to buffer */ ULONG xfdli_BufLen; /* Length of buffer */ STRPTR xfdli_LinkerName; /* Name of recognized linker */ APTR xfdli_Unlink; /* PRIVATE! */ UWORD xfdli_Reserved; /* Set to NULL */ UWORD xfdli_Error; /* Error return code */ ULONG xfdli_Hunk1; /* PRIVATE! */ ULONG xfdli_Hunk2; /* PRIVATE! */ ULONG xfdli_Amount1; /* PRIVATE! */ ULONG xfdli_Amount2; /* PRIVATE! */ APTR xfdli_Save1; /* Pointer to first unlinked file */ APTR xfdli_Save2; /* Pointer to second unlinked file */ ULONG xfdli_SaveLen1; /* Length of first unlinked file */ ULONG xfdli_SaveLen2; /* Length of second unlinked file */ }; /************************ * * * Scan Node (V37) * * * ************************/ struct xfdScanNode { struct xfdScanNode *xfdsn_Next; /* Pointer to next xfdScanNode or NULL */ APTR xfdsn_Save; /* Pointer to data */ ULONG xfdsn_SaveLen; /* Length of data */ STRPTR xfdsn_PackerName; /* Name of recognized packer */ UWORD xfdsn_PackerFlags;/* Flags for recognized packer */ }; /************************ * * * Scan Hook (V37) * * * ************************/ struct xfdScanHook { BOOL (* xfdsh_Entry)(); /* Entrypoint of hook code */ APTR xfdsh_Data; /* Private data of hook */ ULONG xfdsh_ToDo; /* Bytes still to scan (READ ONLY) */ ULONG xfdsh_ScanNode; /* Found data right now (or NULL) (READ ONLY) */ }; /******************** * * * Error Codes * * * ********************/ #define XFDERR_OK 0x0000 /* No errors */ #define XFDERR_NOMEMORY 0x0001 /* Error allocating memory */ #define XFDERR_NOSLAVE 0x0002 /* No slave entry in info structure */ #define XFDERR_NOTSUPPORTED 0x0003 /* Slave doesn't support called function */ #define XFDERR_UNKNOWN 0x0004 /* Unknown file */ #define XFDERR_NOSOURCE 0x0005 /* No sourcebuffer/seglist specified */ #define XFDERR_WRONGPASSWORD 0x0006 /* Wrong password for decrunching */ #define XFDERR_BADHUNK 0x0007 /* Bad hunk structure */ #define XFDERR_CORRUPTEDDATA 0x0008 /* Crunched data is corrupted */ #define XFDERR_MISSINGRESOURCE 0x0009 /* (V34) Missing resource (eg. library) */ #define XFDERR_WRONGKEY 0x000a /* (V35) Wrong 16/32 bit key */ #define XFDERR_BETTERCPU 0x000b /* (V37) Better CPU required */ #define XFDERR_HOOKBREAK 0x000c /* (V37) Hook caused break */ #define XFDERR_DOSERROR 0x000d /* (V37) Dos error */ #define XFDERR_NOTARGET 0x000e /* (V38) No user target given */ #define XFDERR_TARGETTOOSMALL 0x000f /* (V38) User target is too small */ #define XFDERR_TARGETNOTSUPPORTED 0x0010 /* (V38) User target not supported */ #define XFDERR_UNDEFINEDHUNK 0x1000 /* (V34) Undefined hunk type */ #define XFDERR_NOHUNKHEADER 0x1001 /* (V34) File is not executable */ #define XFDERR_BADEXTTYPE 0x1002 /* (V34) Bad hunk_ext type */ #define XFDERR_BUFFERTRUNCATED 0x1003 /* (V34) Unexpected end of file */ #define XFDERR_WRONGHUNKAMOUNT 0x1004 /* (V34) Wrong amount of hunks */ #define XFDERR_NOOVERLAYS 0x1005 /* (V36) Overlays not allowed */ #define XFDERR_UNSUPPORTEDHUNK 0x2000 /* (V34) Hunk type not supported */ #define XFDERR_BADRELMODE 0x2001 /* (V34) Unknown XFDREL_#? mode */ /******************************* * * * Relocation Modes (V34) * * * *******************************/ #define XFDREL_DEFAULT 0x0000 /* Use memory types given by hunk_header */ #define XFDREL_FORCECHIP 0x0001 /* Force all hunks to chip ram */ #define XFDREL_FORCEFAST 0x0002 /* Force all hunks to fast ram */ /************************************* * * * Values for xfd??_PackerFlags * * * *************************************/ /* Bit numbers */ #define XFDPFB_RELOC 0 /* Relocatible file packer */ #define XFDPFB_ADDR 1 /* Absolute address file packer */ #define XFDPFB_DATA 2 /* Data file packer */ #define XFDPFB_PASSWORD 4 /* Packer requires password */ #define XFDPFB_RELMODE 5 /* (V34) Decruncher supports xfdsi_RelMode */ #define XFDPFB_KEY16 6 /* (V35) Packer requires 16 bit key */ #define XFDPFB_KEY32 7 /* (V35) Packer requires 32 bit key */ #define XFDPFB_RECOGLEN 8 /* (V38) slave recognizes target lengths */ #define XFDPFB_USERTARGET 9 /* (V38) slave supports user target buffer */ #define XFDPFB_EXTERN 15 /* (V37) PRIVATE */ /* Bit masks */ #define XFDPFF_RELOC (1<