1 /**
2  * @namespace   biew_plugins_auto
3  * @file        plugins/bin/ne.h
4  * @brief       This file contains NE executable file definitions.
5  * @version     -
6  * @remark      this source file is part of Binary vIEW project (BIEW).
7  *              The Binary vIEW (BIEW) is copyright (C) 1995 Nickols_K.
8  *              All rights reserved. This software is redistributable under the
9  *              licence given in the file "Licence.en" ("Licence.ru" in russian
10  *              translation) distributed in the BIEW archive.
11  * @note        Requires POSIX compatible development system
12  *
13  * @author      Nickols_K
14  * @since       1995
15  * @note        Development, fixes and improvements
16 **/
17 #ifndef __NE_INC
18 #define __NE_INC
19 
20 #ifndef __BIEWUTIL__H
21 #include "biewutil.h"
22 #endif
23 
24 #ifndef __BBIO_H
25 #include "bbio.h"
26 #endif
27 
28 #ifdef __HAVE_PRAGMA_PACK__
29 #pragma pack(1)
30 #endif
31 
32 #define NE_WIN2X_ON_3X_PROTMODE 2
33 #define NE_WIN2X_PROPORTFONT    4
34 #define NE_FASTLOADAREA         8
35 
36 /** New EXE header */
37 typedef struct tagNEHEADER
38 {
39  tUInt8   neSignature[2];               /**< 'NE' */
40  tUInt8   neLinkerVersion;
41  tUInt8   neLinkerRevision;
42  tUInt16  neOffsetEntryTable;
43  tUInt16  neLengthEntryTable;
44  tUInt32  neChecksum;
45  tUInt16  neContestEXE;
46  tUInt16  neAutoDataSegmentCount;
47  tUInt16  neHeapSize;
48  tUInt16  neStackSize;
49  tUInt32  neCSIPvalue;
50  tUInt32  neSSSPvalue;
51  tUInt16  neSegmentTableCount;
52  tUInt16  neModuleReferenceTableCount;
53  tUInt16  neLengthNonResidentNameTable;
54  tUInt16  neOffsetSegmentTable;
55  tUInt16  neOffsetResourceTable;
56  tUInt16  neOffsetResidentNameTable;
57  tUInt16  neOffsetModuleReferenceTable;
58  tUInt16  neOffsetImportTable;
59  tUInt32  neOffsetNonResidentNameTable;
60  tUInt16  neMoveableEntryPointCount;
61  tUInt16  neLogicalSectorShiftCount;
62  tUInt16  neResourceSegmentCount;
63  tUInt8   neOperatingSystem;
64  tUInt8   neFlagsOther;
65  /* os depended 64 bytes struct */
66  tUInt16  neOffsetFastLoadArea;
67  tUInt16  neLengthFastLoadArea;
68  tUInt16  neReserved;
69  tUInt16  neWindowsVersion;
70 
71 }NEHEADER;
72 
73 typedef struct tagSEGDEF
74 {
75   tUInt16 sdOffset;
76   tUInt16 sdLength;
77   tUInt16 sdFlags;
78   tUInt16 sdMinMemory;
79 }SEGDEF;
80 
81 extern int ReadSegDef(SEGDEF *,tUInt16 numseg);
82 
83 typedef struct tagENTRY
84 {
85  tUInt8  eFlags;
86  tUInt8  eFixed; /**< 1 - fixed 0 - moveable */
87  /* tUInt16 eInt3F; */
88  tUInt8  eSegNum;
89  tUInt16 eSegOff;
90 }ENTRY;
91 
92 typedef struct tagNAMEINFO
93 {
94   tUInt16 rnOffset;
95   tUInt16 rnLength;
96   tUInt16 rnFlags;
97   tUInt16 rnID;
98   tUInt16 rnHandle;
99   tUInt16 rnUsage;
100 } NAMEINFO;
101 
102 extern int ReadEntry(ENTRY *,tUInt16 entnum);
103 
104 typedef struct tagRELOC_NE
105 {
106   tUInt8  AddrType;
107   tUInt8  Type;
108   tUInt16 RefOff;
109   tUInt16 idx;
110   tUInt16 ordinal;
111 }RELOC_NE;
112 
113 extern const char * __FASTCALL__ GetPMWinAPI(unsigned flag);
114 extern const char * __nedata[];
115 extern unsigned __FASTCALL__ GetNamCountNE(BGLOBAL,__filesize_t);
116 extern tBool __FASTCALL__ RNamesReadItems(BGLOBAL,memArray *,unsigned,__filesize_t);
117 
118 
119 #ifdef __HAVE_PRAGMA_PACK__
120 #pragma pack()
121 #endif
122 
123 #endif
124