Changeset 129 for trunk/include/helpers


Ignore:
Timestamp:
Jan 8, 2002, 7:29:57 PM (24 years ago)
Author:
umoeller
Message:

Executable updates, mostly.

Location:
trunk/include/helpers
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/dosh.h

    r127 r129  
    360360        HFILE       hf;
    361361        ULONG       hmtx;       // a HMTX really
    362         ULONG       flOpenMode; // as given to doshOpen
     362
     363        PSZ         pszFilename;    // as given to doshOpen
     364        ULONG       flOpenMode;     // as given to doshOpen
     365
    363366        ULONG       cbInitial,  // intial file size on open (can be 0 if new)
    364367                    cbCurrent;  // current file size (raised with each write)
     368
     369        PBYTE       pbCache;    // if != NULL, cached data from doshReadAt
     370        ULONG       cbCache,    // size of data in cbCache
     371                    ulReadFrom; // file offset where pbCache was read from
    365372    } XFILE, *PXFILE;
    366373
     
    399406
    400407    APIRET doshLoadTextFile(PCSZ pcszFile,
    401                             PSZ* ppszContent);
     408                            PSZ* ppszContent,
     409                            PULONG pcbRead);
    402410
    403411    PSZ doshCreateBackupFileName(const char* pszExisting);
     
    463471                                 PUSHORT pusReturn);
    464472
    465     /********************************************************************
    466      *
    467      *   Executable helpers
    468      *
    469      ********************************************************************/
    470 
    471     #pragma pack(1)
    472 
    473     /*
    474      *@@ DOSEXEHEADER:
    475      *      old DOS EXE header at offset 0
    476      *      in any EXE file.
    477      *
    478      *@@changed V0.9.7 (2000-12-20) [umoeller]: fixed NE offset
    479      *@@changed V0.9.9 (2001-04-06) [lafaix]: additional fields defined
    480      */
    481 
    482     typedef struct _DOSEXEHEADER
    483     {
    484          USHORT usDosExeID;             // 00: DOS exeid (0x5a4d)
    485          USHORT usFileLenMod512;        // 02: filelen mod 512
    486          USHORT usFileLenDiv512;        // 04: filelen div 512
    487          USHORT usSegFix;               // 06: count of segment adds to fix
    488          USHORT usHdrPargCnt;           // 08: size of header in paragrphs
    489          USHORT usMinAddPargCnt;        // 0a: minimum addtl paragraphs count
    490          USHORT usMaxAddPargCnt;        // 0c: max addtl paragraphs count
    491          USHORT usSSStartup;            // 0e: SS at startup
    492          USHORT usSPStartup;            // 10: SP at startup
    493          USHORT usHdrChecksum;          // 12: header checksum
    494          USHORT usIPStartup;            // 14: IP at startup
    495          USHORT usCodeSegOfs;           // 16: code segment offset from EXE start
    496          USHORT usRelocTableOfs;        // 18: reloc table ofs.header (Win: >= 0x40)
    497          USHORT usOverlayNo;            // 1a: overlay no.
    498          USHORT usLinkerVersion;        // 1c: linker version (if 0x18 > 0x28)
    499          USHORT usUnused1;              // 1e: unused
    500          USHORT usBehaviorBits;         // 20: exe.h says this field contains
    501                                         //     'behavior bits'
    502          USHORT usUnused2;              // 22: unused
    503          USHORT usOEMIdentifier;        // 24: OEM identifier
    504          USHORT usOEMInformation;       // 26: OEM information
    505          ULONG  ulUnused3;              // 28:
    506          ULONG  ulUnused4;              // 2c:
    507          ULONG  ulUnused5;              // 30:
    508          ULONG  ulUnused6;              // 34:
    509          ULONG  ulUnused7;              // 38:
    510          ULONG  ulNewHeaderOfs;         // 3c: new header ofs (if 0x18 > 0x40)
    511                     // fixed this from USHORT, thanks Martin Lafaix
    512                     // V0.9.7 (2000-12-20) [umoeller]
    513     } DOSEXEHEADER, *PDOSEXEHEADER;
    514 
    515     // NE and LX OS types
    516     #define NEOS_UNKNOWN        0
    517     #define NEOS_OS2            1   // Win16 SDK says: "reserved"...
    518     #define NEOS_WIN16          2
    519     #define NEOS_DOS4           3   // Win16 SDK says: "reserved"...
    520     #define NEOS_WIN386         4   // Win16 SDK says: "reserved"...
    521 
    522     /*
    523      *@@ NEHEADER:
    524      *      linear executable (LX) header format,
    525      *      which comes after the DOS header in the
    526      *      EXE file (at DOSEXEHEADER.ulNewHeaderOfs).
    527      *
    528      *@@changed V0.9.9 (2001-04-06) [lafaix]: fixed typo in usMoveableEntries
    529      */
    530 
    531     typedef struct _NEHEADER
    532     {
    533         CHAR      achNE[2];             // 00: "NE" magic                       ne_magic
    534         BYTE      bLinkerVersion;       // 02: linker version                   ne_ver
    535         BYTE      bLinkerRevision;      // 03: linker revision                  ne_rev
    536         USHORT    usEntryTblOfs;        // 04: ofs from this to entrytable      ne_enttab
    537         USHORT    usEntryTblLen;        // 06: length of entrytable             ne_cbenttab
    538         ULONG     ulChecksum;           // 08: MS: reserved, OS/2: checksum     ne_crc
    539         USHORT    usFlags;              // 0c: flags                            ne_flags
    540                            /*
    541                               #define NENOTP          0x8000          // Not a process == library
    542                               #define NENOTMPSAFE     0x4000          // Process is not multi-processor safe
    543                                                                       // (Win3.1 SDK: "reserved")
    544                               #define NEIERR          0x2000          // Errors in image
    545                               #define NEBOUND         0x0800          // Bound Family/API
    546                                                                       // (Win3.1 SDK: "first segment contains code
    547                                                                       // that loads the application")
    548                               #define NEAPPTYP        0x0700          // Application type mask
    549                                                                       // (Win3.1 SDK: "reserved")
    550                               #define NENOTWINCOMPAT  0x0100          // Not compatible with P.M. Windowing
    551                                                                       // (Win3.1 SDK: "reserved")
    552                               #define NEWINCOMPAT     0x0200          // Compatible with P.M. Windowing
    553                                                                       // (Win3.1 SDK: "reserved")
    554                               #define NEWINAPI        0x0300          // Uses P.M. Windowing API
    555                                                                       // (Win3.1 SDK: "reserved")
    556                               #define NEFLTP          0x0080          // Floating-point instructions
    557                               #define NEI386          0x0040          // 386 instructions
    558                               #define NEI286          0x0020          // 286 instructions
    559                               #define NEI086          0x0010          // 8086 instructions
    560                               #define NEPROT          0x0008          // Runs in protected mode only
    561                                                                       // (Win3.1 SDK: "reserved")
    562                               #define NEPPLI          0x0004          // Per-Process Library Initialization
    563                                                                       // (Win3.1 SDK: "reserved")
    564                               #define NEINST          0x0002          // Instance data
    565                               #define NESOLO          0x0001          // Solo data (single data)
    566                            */
    567         USHORT    usAutoDataSegNo;      // 0e: auto-data seg no.                ne_autodata
    568                                         // (Win3.1 SDK: "0 if both NEINST and NESOLO are cleared")
    569         USHORT    usInitlHeapSize;      // 10: initl. heap size                 ne_heap
    570                                         // (Win3.1 SDK: "0 if no local allocation")
    571         USHORT    usInitlStackSize;     // 12: initl. stack size                ne_stack
    572                                         // (Win3.1 SDK: "0 if SS != DS")
    573         ULONG     ulCSIP;               // 14: CS:IP                            ne_csip
    574         ULONG     ulSSSP;               // 18: SS:SP                            ne_sssp
    575         USHORT    usSegTblEntries;      // 1c: segment tbl entry count          ne_cseg
    576         USHORT    usModuleTblEntries;   // 1e: module ref. table entry count    ne_cmod
    577         USHORT    usNonResdTblLen;      // 20: non-resd. name tbl length        ne_cbnrestab
    578         USHORT    usSegTblOfs;          // 22: segment tbl ofs                  ne_segtab
    579                                         // (from start of NEHEADER)
    580         USHORT    usResTblOfs;          // 24: resource tbl ofs                 ne_rsrctab
    581                                         // (from start of NEHEADER)
    582         USHORT    usResdNameTblOfs;     // 26: resd. name tbl ofs               ne_restab
    583                                         // (from start of NEHEADER)
    584         USHORT    usModRefTblOfs;       // 28: module ref. table ofs            ne_modtab
    585                                         // (from start of NEHEADER)
    586         USHORT    usImportTblOfs;       // 2a: import name tbl ofs              ne_imptab
    587                                         // (from start of NEHEADER)
    588         ULONG     ulNonResdTblOfs;      // 2c: non-resd. name tbl ofs           ne_nrestab
    589                                         // (from start of EXE!)
    590         USHORT    usMoveableEntries;    // 30: moveable entry points count      ne_cmovent
    591         USHORT    usLogicalSectShift;   // 32: logcl. sector shift              ne_align
    592                                         // (Win3.1 SDK: "typically 4, but default is 9")
    593         USHORT    usResSegmCount;       // 34: resource segm. count             ne_cres
    594         BYTE      bTargetOS;            // 36: target OS (NEOS_* flags)         ne_exetyp
    595         BYTE      bFlags2;              // 37: addtl. flags                     ne_flagsothers
    596                                         // Win3.1 SDK:
    597                                         //      bit 1 --> Win2.x, but runs in Win3.x protected mode
    598                                         //      bit 2 --> Win2.x that supports prop. fonts
    599                                         //      bit 3 --> exec contains fastload area
    600                                 /*
    601                                 #define NELONGNAMES     0x01
    602                                 #define NEWINISPROT     0x02
    603                                 #define NEWINGETPROPFON 0x04
    604                                 #define NEWLOAPPL       0x80
    605                                 */
    606         // the following are not listed in newexe.h, but are documented for Win3.x
    607         USHORT    usFastLoadOfs;        // 38: fast-load area ofs
    608         USHORT    usFastLoadLen;        // 3a: fast-load area length
    609         USHORT    usReserved;           // 3c: MS: 'reserved'
    610         USHORT    usReqWinVersion;      // 3e: Win-only: min. Win version
    611     } NEHEADER, *PNEHEADER;
    612 
    613     /*
    614      *@@ LXHEADER:
    615      *      linear executable (LX) header format,
    616      *      which comes after the DOS header in the
    617      *      EXE file (at DOSEXEHEADER.ulNewHeaderOfs).
    618      *
    619      *@@changed V0.9.9 (2001-04-06) [lafaix]: fixed auto data object and ulinstanceDemdCnt
    620      */
    621 
    622     typedef struct _LXHEADER
    623     {
    624         CHAR        achLX[2];           // 00: "LX" or "LE" magic
    625             // this is "LX" for 32-bit OS/2 programs, but
    626             // "LE" for MS-DOS progs which use this format
    627             // (e.g. WINDOWS\SMARTDRV.EXE). IBM says the
    628             // LE format was never released and superceded
    629             // by LX... I am unsure what the differences are.
    630         BYTE      fByteBigEndian;       // 02: byte ordering (1 = big endian)
    631         BYTE      fWordBigEndian;       // 03: word ordering (1 = big endian)
    632         ULONG     ulFormatLevel;        // 04: format level
    633         USHORT    usCPU;                // 08: CPU type
    634         USHORT    usTargetOS;           // 0a: OS type (NEOS_* flags)
    635         ULONG     ulModuleVersion;      // 0c: module version
    636         ULONG     ulFlags;              // 10: module flags
    637                           /* #define E32NOTP          0x8000L        // Library Module - used as NENOTP
    638                              #define E32NOLOAD        0x2000L        // Module not Loadable
    639                              #define E32PMAPI         0x0300L        // Uses PM Windowing API
    640                              #define E32PMW           0x0200L        // Compatible with PM Windowing
    641                              #define E32NOPMW         0x0100L        // Incompatible with PM Windowing
    642                              #define E32NOEXTFIX      0x0020L        // NO External Fixups in .EXE
    643                              #define E32NOINTFIX      0x0010L        // NO Internal Fixups in .EXE
    644                              #define E32SYSDLL        0x0008L        // System DLL, Internal Fixups discarded
    645                              #define E32LIBINIT       0x0004L        // Per-Process Library Initialization
    646                              #define E32LIBTERM       0x40000000L    // Per-Process Library Termination
    647                              #define E32APPMASK       0x0300L        // Application Type Mask
    648                           */
    649         ULONG     ulPageCount;          // 14: no. of pages in module
    650         ULONG     ulEIPRelObj;          // 18: object to which EIP is relative
    651         ULONG     ulEIPEntryAddr;       // 1c: EIP entry addr
    652         ULONG     ulESPObj;             // 20: ESP object
    653         ULONG     ulESP;                // 24: ESP
    654         ULONG     ulPageSize;           // 28: page size (4K)
    655         ULONG     ulPageLeftShift;      // 2c: page left-shift
    656         ULONG     ulFixupTblLen;        // 30: fixup section total size
    657         ULONG     ulFixupTblChecksum;   // 34: fixup section checksum
    658         ULONG     ulLoaderLen;          // 38: size req. for loader section
    659         ULONG     ulLoaderChecksum;     // 3c: loader section checksum
    660         ULONG     ulObjTblOfs;          // 40: object table offset
    661         ULONG     ulObjCount;           // 44: object count
    662         ULONG     ulObjPageTblOfs;      // 48: object page table ofs
    663         ULONG     ulObjIterPagesOfs;    // 4c: object iter pages ofs
    664         ULONG     ulResTblOfs;          // 50: resource table ofs
    665         ULONG     ulResTblCnt;          // 54: resource entry count
    666         ULONG     ulResdNameTblOfs;     // 58: resident name tbl ofs
    667         ULONG     ulEntryTblOfs;        // 5c: entry tbl ofs
    668         ULONG     ulModDirectivesOfs;   // 60: module directives ofs
    669         ULONG     ulModDirectivesCnt;   // 64: module directives count
    670         ULONG     ulFixupPagePageTblOfs;// 68: fixup page tbl ofs
    671         ULONG     ulFixupRecTblOfs;     // 6c: fixup record tbl ofs
    672         ULONG     ulImportModTblOfs;    // 70: import modl tbl ofs
    673         ULONG     ulImportModTblCnt;    // 74: import modl tbl count
    674         ULONG     ulImportProcTblOfs;   // 78: import proc tbl ofs
    675         ULONG     ulPerPageCSOfs;       // 7c: per page checksum ofs
    676         ULONG     ulDataPagesOfs;       // 80: data pages ofs
    677         ULONG     ulPreloadPagesCnt;    // 84: preload pages count
    678         ULONG     ulNonResdNameTblOfs;  // 88: non-resdnt name tbl ofs
    679         ULONG     ulNonResdNameTblLen;  // 8c: non-resdnt name tbl length
    680         ULONG     ulNonResdNameTblCS;   // 90: non-res name tbl checksum
    681         ULONG     ulAutoDataSegObj;     // 94: auto dataseg object
    682         ULONG     ulDebugOfs;           // 98: debug info ofs
    683         ULONG     ulDebugLen;           // 9c: debug info length
    684         ULONG     ulInstancePrelCnt;    // a0: instance preload count
    685         ULONG     ulInstanceDemdCnt;    // a0: instance demand count
    686         ULONG     ulHeapSize16;         // a8: heap size (16-bit)
    687         ULONG     ulStackSize;          // ac: stack size
    688     } LXHEADER, *PLXHEADER;
    689 
    690     /*
    691      *@@ PEHEADER:
    692      *      portable executable (PE) header format,
    693      *      which comes after the DOS header in the
    694      *      EXE file (at DOSEXEHEADER.ulNewHeaderOfs).
    695      *
    696      *@@added V0.9.10 (2001-04-08) [lafaix]
    697      */
    698 
    699     typedef struct _PEHEADER
    700     {
    701         // standard header
    702         ULONG     ulSignature;          // 00: 'P', 'E', 0, 0
    703         USHORT    usCPU;                // 04: CPU type
    704         USHORT    usObjCount;           // 06: number of object entries
    705         ULONG     ulTimeDateStamp;      // 08: store the time and date the
    706                                         //     file was created or modified
    707                                         //     by the linker
    708         ULONG     ulReserved1;          // 0c: reserved
    709         ULONG     ulReserved2;          // 10: reserved
    710         USHORT    usHeaderSize;         // 14: number of remaining bytes after
    711                                         //     usImageFlags
    712         USHORT    usImageFlags;         // 16: flags bits for the image
    713 
    714         // optional header (always present in valid Win32 files)
    715         USHORT    usReserved3;          // 18: reserved
    716         USHORT    usLinkerMajor;        // 1a: linker major version number
    717         USHORT    usLinkerMinor;        // 1c: linker minor version number
    718         USHORT    usReserved4;          // 1e: reserved
    719         ULONG     ulReserved5;          // 20: reserved
    720         ULONG     ulReserved6;          // 24: reserved
    721         ULONG     ulEntryPointRVA;      // 28: entry point relative virtual address
    722         ULONG     ulReserved7;          // 2c: reserved
    723         ULONG     ulReserved8;          // 30: reserved
    724         ULONG     ulImageBase;          // 34:
    725         ULONG     ulObjectAlign;        // 38:
    726         ULONG     ulFileAlign;          // 3c:
    727         USHORT    usOSMajor;            // 40:
    728         USHORT    usOSMinor;            // 42:
    729         USHORT    usUserMajor;          // 44:
    730         USHORT    usUserMinor;          // 46:
    731         USHORT    usSubSystemMajor;     // 48:
    732         USHORT    usSubSystemMinor;     // 4a:
    733         ULONG     ulReserved9;          // 4c: reserved
    734         ULONG     ulImageSize;          // 50:
    735         ULONG     ulHeaderSize;         // 54:
    736         ULONG     ulFileChecksum;       // 58:
    737         USHORT    usSubSystem;          // 5c:
    738         USHORT    usDLLFlags;           // 5e:
    739         ULONG     ulStackReserveSize;   // 60:
    740         ULONG     ulStackCommitSize;    // 64:
    741         ULONG     ulHeapReserveSize;    // 68:
    742         ULONG     ulHeapCommitSize;     // 6c:
    743         ULONG     ulReserved10;         // 70: reserved
    744         ULONG     ulInterestingRVACount;// 74:
    745         ULONG     aulRVASize[1];        // 78: array of RVA/Size entries
    746     } PEHEADER, *PPEHEADER;
    747 
    748     // additional LX structures
    749 
    750     /*
    751      *@@ RESOURCETABLEENTRY:
    752      *     LX resource table entry.
    753      *
    754      *@@added V0.9.16 (2001-12-08) [umoeller]
    755      */
    756 
    757     typedef struct _RESOURCETABLEENTRY     // rsrc32
    758     {
    759         unsigned short  type;   // Resource type
    760         unsigned short  name;   // Resource name
    761         unsigned long   cb;     // Resource size
    762         unsigned short  obj;    // Object number
    763         unsigned long   offset; // Offset within object
    764     } RESOURCETABLEENTRY;
    765 
    766     /*
    767      *@@ OBJECTTABLEENTRY:
    768      *     LX object table entry.
    769      *
    770      *@@added V0.9.16 (2001-12-08) [umoeller]
    771      */
    772 
    773     typedef struct _OBJECTTABLEENTRY       // o32_obj
    774     {
    775         unsigned long   o32_size;     // Object virtual size
    776         unsigned long   o32_base;     // Object base virtual address
    777         unsigned long   o32_flags;    // Attribute flags
    778         unsigned long   o32_pagemap;  // Object page map index
    779         unsigned long   o32_mapsize;  // Number of entries in object page map
    780         unsigned long   o32_reserved; // Reserved
    781     } OBJECTTABLEENTRY;
    782 
    783     /*
    784      *@@ OBJECTPAGETABLEENTRY:
    785      *     LX object _page_ table entry, sometimes
    786      *     referred to as map entry.
    787      *
    788      *@@added V0.9.16 (2001-12-08) [umoeller]
    789      */
    790 
    791     typedef struct _OBJECTPAGETABLEENTRY   // o32_map
    792     {
    793         unsigned long   o32_pagedataoffset;     // file offset of page
    794         unsigned short  o32_pagesize;           // # of real bytes of page data
    795         unsigned short  o32_pageflags;          // Per-Page attributes
    796     } OBJECTPAGETABLEENTRY;
    797 
    798     /*
    799      *@@ LXITER:
    800      *      iteration Record format for 'EXEPACK'ed pages.
    801      *
    802      *@@added V0.9.16 (2001-12-08) [umoeller]
    803      */
    804 
    805     typedef struct _LXITER
    806     {
    807         unsigned short LX_nIter;            // number of iterations
    808         unsigned short LX_nBytes;           // number of bytes
    809         unsigned char  LX_Iterdata;         // iterated data byte(s)
    810     } LXITER, *PLXITER;
    811 
    812     /*
    813      *@@ OS2NERESTBLENTRY:
    814      *      OS/2 NE resource table entry.
    815      *
    816      *@@added V0.9.16 (2001-12-08) [umoeller]
    817      */
    818 
    819     typedef struct _OS2NERESTBLENTRY
    820     {
    821         USHORT      usType;
    822         USHORT      usID;
    823     } OS2NERESTBLENTRY, *POS2NERESTBLENTRY;
    824 
    825     /*
    826      *@@ OS2NESEGMENT:
    827      *      OS/2 NE segment definition.
    828      *
    829      *@@added V0.9.16 (2001-12-08) [umoeller]
    830      */
    831 
    832     typedef struct _OS2NESEGMENT       // New .EXE segment table entry
    833     {
    834         unsigned short      ns_sector;      // File sector of start of segment
    835         unsigned short      ns_cbseg;       // Number of bytes in file
    836         unsigned short      ns_flags;       // Attribute flags
    837         unsigned short      ns_minalloc;    // Minimum allocation in bytes
    838     } OS2NESEGMENT, *POS2NESEGMENT;
    839 
    840     #pragma pack()
    841 
    842     // object/segment flags (in NE and LX)
    843     #define OBJWRITE         0x0002L    // Writeable Object
    844     #define OBJDISCARD       0x0010L    // Object is Discardable
    845     #define OBJSHARED        0x0020L    // Object is Shared
    846     #define OBJPRELOAD       0x0040L    // Object has preload pages
    847 
    848     // resource flags
    849     #define RNMOVE           0x0010     // Moveable resource
    850     #define RNPURE           0x0020     // Pure (read-only) resource
    851     #define RNPRELOAD        0x0040     // Preloaded resource
    852     #define RNDISCARD        0xF000     // Discard priority level for resource
    853 
    854     // EXE format
    855     #define EXEFORMAT_OLDDOS        1
    856     #define EXEFORMAT_NE            2
    857     #define EXEFORMAT_PE            3
    858     #define EXEFORMAT_LX            4
    859     #define EXEFORMAT_TEXT_BATCH    5
    860     #define EXEFORMAT_TEXT_CMD      6       // REXX or plain OS/2 batch
    861     #define EXEFORMAT_COM           7       // added V0.9.16 (2002-01-04) [umoeller]
    862 
    863     // target OS (in NE and LX)
    864     #define EXEOS_DOS3              1
    865     #define EXEOS_DOS4              2       // there is a flag for this in NE
    866     #define EXEOS_OS2               3
    867     #define EXEOS_WIN16             4
    868     #define EXEOS_WIN386            5       // according to IBM, there are flags
    869                                             // for this both in NE and LX
    870     #define EXEOS_WIN32             6
    871 
    872 #ifndef __STRIP_DOWN_EXECUTABLE__
    873 // for mini stubs in warpin, which has its own
    874 // implementation of this
    875 
    876     /*
    877      *@@ EXECUTABLE:
    878      *      structure used with all the doshExec*
    879      *      functions.
    880      */
    881 
    882     typedef struct _EXECUTABLE
    883     {
    884         // executable opened by doshOpen
    885         PXFILE              pFile;
    886 
    887         /* All the following fields are set by
    888            doshExecOpen if NO_ERROR is returned. */
    889 
    890         // old DOS EXE header;
    891         // note: before 0.9.12, this was ALWAYS valid,
    892         // but since we support NOSTUB executables now,
    893         // there may be situations where this is NULL,
    894         // but the other fields are valid! V0.9.12 (2001-05-03) [umoeller]
    895         PDOSEXEHEADER       pDosExeHeader;
    896         ULONG               cbDosExeHeader;
    897 
    898         // New Executable (NE) header, if ulExeFormat == EXEFORMAT_NE
    899         PNEHEADER           pNEHeader;
    900         ULONG               cbNEHeader;
    901 
    902         // Linear Executable (LX) header, if ulExeFormat == EXEFORMAT_LX
    903         PLXHEADER           pLXHeader;
    904         ULONG               cbLXHeader;
    905 
    906         // Portable Executable (PE) header, if ulExeFormat == EXEFORMAT_PE
    907         PPEHEADER           pPEHeader;
    908         ULONG               cbPEHeader;
    909 
    910         // module analysis (always set):
    911         ULONG               ulExeFormat;
    912                 // one of:
    913                 // EXEFORMAT_OLDDOS        1
    914                 // EXEFORMAT_NE            2
    915                 // EXEFORMAT_PE            3
    916                 // EXEFORMAT_LX            4
    917                 // EXEFORMAT_TEXT_BATCH    5
    918                 // EXEFORMAT_TEXT_CMD      6
    919                 // EXEFORMAT_COM           7
    920 
    921         BOOL                fLibrary,           // TRUE if this is a DLL
    922                             f32Bits;            // TRUE if this a 32-bits module
    923 
    924         ULONG               ulOS;
    925                 // target operating system as flagged in one of
    926                 // the EXE headers; one of:
    927                 // EXEOS_DOS3              1
    928                 // EXEOS_DOS4              2       // there is a flag for this in NE
    929                 // EXEOS_OS2               3
    930                 // EXEOS_WIN16             4
    931                 // EXEOS_WIN386            5       // according to IBM, there are flags
    932                                                    // for this both in NE and LX
    933                 // EXEOS_WIN32             6
    934 
    935         /* The following fields are only set after
    936            an extra call to doshExecQueryBldLevel. */
    937 
    938         PSZ                 pszDescription;
    939                 // whole string (first non-res name tbl entry)
    940         PSZ                 pszVendor;
    941                 // vendor substring (if IBM BLDLEVEL format)
    942         PSZ                 pszVersion;
    943                 // version substring (if IBM BLDLEVEL format)
    944 
    945         PSZ                 pszInfo;
    946                 // module info substring (if IBM BLDLEVEL format)
    947 
    948         // if pszInfo is extended DESCRIPTION field, the following
    949         // are set as well:
    950         PSZ                 pszBuildDateTime,
    951                             pszBuildMachine,
    952                             pszASD,
    953                             pszLanguage,
    954                             pszCountry,
    955                             pszRevision,
    956                             pszUnknown,
    957                             pszFixpak;
    958 
    959         // the following fields are set after doshLoadLXMaps
    960         BOOL                    fLXMapsLoaded;      // TRUE after doshLoadLXMaps
    961         RESOURCETABLEENTRY      *pRsTbl;        // pLXHeader->ulResTblCnt
    962         OBJECTTABLEENTRY        *pObjTbl;       // pLXHeader->ulObjCount
    963         OBJECTPAGETABLEENTRY    *pObjPageTbl;   // pLXHeader->ulPageCount
    964 
    965         // the following fields are set after doshLoadOS2NEMaps
    966         BOOL                    fOS2NEMapsLoaded;
    967         POS2NERESTBLENTRY       paOS2NEResTblEntry;
    968         POS2NESEGMENT           paOS2NESegments;
    969     } EXECUTABLE, *PEXECUTABLE;
    970 
    971     APIRET doshExecOpen(const char* pcszExecutable,
    972                         PEXECUTABLE* ppExec);
    973 
    974     APIRET doshExecQueryBldLevel(PEXECUTABLE pExec);
    975 
    976     /*
    977      *@@ FSYSMODULE:
    978      *
    979      *@@added V0.9.9 (2001-03-11) [lafaix]
    980      */
    981 
    982     typedef struct _FSYSMODULE
    983     {
    984         CHAR achModuleName[256];
    985     } FSYSMODULE, *PFSYSMODULE;
    986 
    987     APIRET doshExecQueryImportedModules(PEXECUTABLE pExec,
    988                                         PFSYSMODULE *ppaModules,
    989                                         PULONG pcModules);
    990 
    991     APIRET doshExecFreeImportedModules(PFSYSMODULE paModules);
    992 
    993     /*
    994      *@@ FSYSFUNCTION:
    995      *
    996      *@@added V0.9.9 (2001-03-11) [lafaix]
    997      */
    998 
    999     typedef struct _FSYSFUNCTION
    1000     {
    1001         ULONG ulOrdinal;
    1002         ULONG ulType;
    1003         CHAR achFunctionName[256];
    1004     } FSYSFUNCTION, *PFSYSFUNCTION;
    1005 
    1006     APIRET doshExecQueryExportedFunctions(PEXECUTABLE pExec,
    1007                                           PFSYSFUNCTION *ppaFunctions,
    1008                                           PULONG pcFunctions);
    1009 
    1010     APIRET doshExecFreeExportedFunctions(PFSYSFUNCTION paFunctions);
    1011 
    1012     #define WINRT_ACCELERATOR          9
    1013     #define WINRT_BITMAP               2
    1014     #define WINRT_CURSOR               1
    1015     #define WINRT_DIALOG               5
    1016     #define WINRT_FONT                 8
    1017     #define WINRT_FONTDIR              7
    1018     #define WINRT_ICON                 3
    1019     #define WINRT_MENU                 4
    1020     #define WINRT_RCDATA               10
    1021     #define WINRT_STRING               6
    1022 
    1023     /*
    1024      *@@ FSYSRESOURCE:
    1025      *
    1026      *@@added V0.9.7 (2000-12-18) [lafaix]
    1027      */
    1028 
    1029     typedef struct _FSYSRESOURCE
    1030     {
    1031         ULONG ulID;                     // resource ID
    1032         ULONG ulType;                   // resource type
    1033         ULONG ulSize;                   // resource size in bytes
    1034         ULONG ulFlag;                   // resource flags
    1035 
    1036     } FSYSRESOURCE, *PFSYSRESOURCE;
    1037 
    1038     APIRET doshExecQueryResources(PEXECUTABLE pExec,
    1039                                   PFSYSRESOURCE *ppaResources,
    1040                                   PULONG pcResources);
    1041 
    1042     APIRET doshExecFreeResources(PFSYSRESOURCE paResources);
    1043 
    1044     APIRET doshLoadLXMaps(PEXECUTABLE pExec);
    1045 
    1046     VOID doshFreeLXMaps(PEXECUTABLE pExec);
    1047 
    1048     APIRET doshLoadOS2NEMaps(PEXECUTABLE pExec);
    1049 
    1050     VOID doshFreeNEMaps(PEXECUTABLE pExec);
    1051 
    1052     APIRET doshExecClose(PEXECUTABLE *ppExec);
    1053 
    1054473    APIRET doshSearchPath(PCSZ pcszPath,
    1055474                          PCSZ pcszFile,
     
    1062481                              PCSZ *papcszExtensions,
    1063482                              ULONG cExtensions);
    1064 #endif
    1065483
    1066484    /********************************************************************
  • trunk/include/helpers/standards.h

    r123 r129  
    106106    #define ARRAYITEMCOUNT(array) sizeof(array) / sizeof(array[0])
    107107
     108    /*
     109     *@@ STRINGORNULL:
     110     *      helpful macro to avoid passing null strings
     111     *      to debugging printf calls.
     112     *
     113     *@@added V0.9.16 (2002-01-05) [umoeller]
     114     */
     115
     116    #define STRINGORNULL(s) (s) ? (s) : "NULL"
     117
    108118#endif
    109119
  • trunk/include/helpers/xstring.h

    r113 r129  
    9191    typedef XSTRINITSET *PXSTRINITSET;
    9292
    93     void XWPENTRY xstrInitCopy(PXSTRING pxstr, const char *pcszSource, ULONG ulExtraAllocate);
    94     typedef void XWPENTRY XSTRINITCOPY(PXSTRING pxstr, const char *pcszSource, ULONG ulExtraAllocate);
    95     typedef XSTRINITCOPY *PXSTRINITCOPY;
     93    #if defined(__DEBUG_MALLOC_ENABLED__) && !defined(DONT_REPLACE_XSTR_MALLOC) // setup.h, helpers\memdebug.c
     94        #define xstrInitCopy(a, b, c) xstrInitCopyDebug((a), (b), (c), __FILE__, __LINE__, __FUNCTION__)
     95        void XWPENTRY xstrInitCopyDebug(PXSTRING pxstr,
     96                                        const char *pcszSource,
     97                                        ULONG ulExtraAllocate,
     98                                        const char *file,
     99                                        unsigned long line,
     100                                        const char *function);
     101        typedef void XWPENTRY XSTRINITCOPYDEBUG(PXSTRING pxstr,
     102                                                const char *pcszSource,
     103                                                ULONG ulExtraAllocate,
     104                                                const char *file,
     105                                                unsigned long line,
     106                                                const char *function);
     107        typedef XSTRINITCOPYDEBUG *PXSTRINITCOPYDEBUG;
     108    #else
     109        void XWPENTRY xstrInitCopy(PXSTRING pxstr, const char *pcszSource, ULONG ulExtraAllocate);
     110        typedef void XWPENTRY XSTRINITCOPY(PXSTRING pxstr, const char *pcszSource, ULONG ulExtraAllocate);
     111        typedef XSTRINITCOPY *PXSTRINITCOPY;
     112    #endif
    96113
    97114    void XWPENTRY xstrClear(PXSTRING pxstr);
Note: See TracChangeset for help on using the changeset viewer.