| 1 | /* $Id: neexe.h,v 1.1 1999-05-24 20:19:15 ktk Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * Copyright Robert J. Amstadt, 1993
|
|---|
| 5 | */
|
|---|
| 6 | #ifndef __WINE_NEEXE_H
|
|---|
| 7 | #define __WINE_NEEXE_H
|
|---|
| 8 |
|
|---|
| 9 | #ifdef __WIN32OS2__
|
|---|
| 10 | #ifndef _OS2WIN_H
|
|---|
| 11 | #include <win32type.h>
|
|---|
| 12 | #endif
|
|---|
| 13 | #else
|
|---|
| 14 | #include "windef.h"
|
|---|
| 15 | #endif
|
|---|
| 16 |
|
|---|
| 17 | /*
|
|---|
| 18 | * Old MZ header for DOS programs.
|
|---|
| 19 | * We check only the magic and the e_lfanew offset to the new executable
|
|---|
| 20 | * header.
|
|---|
| 21 | */
|
|---|
| 22 | typedef struct
|
|---|
| 23 | {
|
|---|
| 24 | WORD e_magic; /* 00: MZ Header signature */
|
|---|
| 25 | WORD e_cblp; /* 02: Bytes on last page of file */
|
|---|
| 26 | WORD e_cp; /* 04: Pages in file */
|
|---|
| 27 | WORD e_crlc; /* 06: Relocations */
|
|---|
| 28 | WORD e_cparhdr; /* 08: Size of header in paragraphs */
|
|---|
| 29 | WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
|
|---|
| 30 | WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
|
|---|
| 31 | WORD e_ss; /* 0e: Initial (relative) SS value */
|
|---|
| 32 | WORD e_sp; /* 10: Initial SP value */
|
|---|
| 33 | WORD e_csum; /* 12: Checksum */
|
|---|
| 34 | WORD e_ip; /* 14: Initial IP value */
|
|---|
| 35 | WORD e_cs; /* 16: Initial (relative) CS value */
|
|---|
| 36 | WORD e_lfarlc; /* 18: File address of relocation table */
|
|---|
| 37 | WORD e_ovno; /* 1a: Overlay number */
|
|---|
| 38 | WORD e_res[4]; /* 1c: Reserved words */
|
|---|
| 39 | WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
|
|---|
| 40 | WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
|
|---|
| 41 | WORD e_res2[10]; /* 28: Reserved words */
|
|---|
| 42 | DWORD e_lfanew; /* 3c: Offset to extended header */
|
|---|
| 43 | } IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER;
|
|---|
| 44 |
|
|---|
| 45 | #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
|
|---|
| 46 | #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
|
|---|
| 47 | #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
|
|---|
| 48 | #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
|
|---|
| 49 | #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
|
|---|
| 50 | #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
|
|---|
| 51 |
|
|---|
| 52 | /*
|
|---|
| 53 | * This is the Windows executable (NE) header.
|
|---|
| 54 | * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
|
|---|
| 55 | */
|
|---|
| 56 | typedef struct
|
|---|
| 57 | {
|
|---|
| 58 | WORD ne_magic; /* 00 NE signature 'NE' */
|
|---|
| 59 | BYTE linker_version; /* 02 Linker version number */
|
|---|
| 60 | BYTE linker_revision; /* 03 Linker revision number */
|
|---|
| 61 | WORD entry_tab_offset; /* 04 Offset to entry table relative to NE */
|
|---|
| 62 | WORD entry_tab_length; /* 06 Length of entry table in bytes */
|
|---|
| 63 | DWORD reserved1; /* 08 Reserved by Microsoft */
|
|---|
| 64 | WORD format_flags; /* 0c Flags about segments in this file */
|
|---|
| 65 | WORD auto_data_seg; /* 0e Automatic data segment number */
|
|---|
| 66 | WORD local_heap_length; /* 10 Initial size of local heap */
|
|---|
| 67 | WORD stack_length; /* 12 Initial size of stack */
|
|---|
| 68 | WORD ip; /* 14 Initial IP */
|
|---|
| 69 | WORD cs; /* 16 Initial CS */
|
|---|
| 70 | WORD sp; /* 18 Initial SP */
|
|---|
| 71 | WORD ss; /* 1a Initial SS */
|
|---|
| 72 | WORD n_segment_tab; /* 1c # of entries in segment table */
|
|---|
| 73 | WORD n_mod_ref_tab; /* 1e # of entries in module reference tab. */
|
|---|
| 74 | WORD nrname_tab_length; /* 20 Length of nonresident-name table */
|
|---|
| 75 | WORD segment_tab_offset; /* 22 Offset to segment table */
|
|---|
| 76 | WORD resource_tab_offset; /* 24 Offset to resource table */
|
|---|
| 77 | WORD rname_tab_offset; /* 26 Offset to resident-name table */
|
|---|
| 78 | WORD moduleref_tab_offset; /* 28 Offset to module reference table */
|
|---|
| 79 | WORD iname_tab_offset; /* 2a Offset to imported name table */
|
|---|
| 80 | DWORD nrname_tab_offset; /* 2c Offset to nonresident-name table */
|
|---|
| 81 | WORD n_mov_entry_points; /* 30 # of movable entry points */
|
|---|
| 82 | WORD align_shift_count; /* 32 Logical sector alignment shift count */
|
|---|
| 83 | WORD n_resource_seg; /* 34 # of resource segments */
|
|---|
| 84 | BYTE operating_system; /* 36 Flags indicating target OS */
|
|---|
| 85 | BYTE additional_flags; /* 37 Additional information flags */
|
|---|
| 86 | WORD fastload_offset; /* 38 Offset to fast load area */
|
|---|
| 87 | WORD fastload_length; /* 3a Length of fast load area */
|
|---|
| 88 | WORD reserved2; /* 3c Reserved by Microsoft */
|
|---|
| 89 | WORD expect_version; /* 3e Expected Windows version number */
|
|---|
| 90 | } IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER;
|
|---|
| 91 |
|
|---|
| 92 | /*
|
|---|
| 93 | * NE Header FORMAT FLAGS
|
|---|
| 94 | */
|
|---|
| 95 | #define NE_FFLAGS_SINGLEDATA 0x0001
|
|---|
| 96 | #define NE_FFLAGS_MULTIPLEDATA 0x0002
|
|---|
| 97 | #define NE_FFLAGS_WIN32 0x0010
|
|---|
| 98 | #define NE_FFLAGS_BUILTIN 0x0020 /* Wine built-in module */
|
|---|
| 99 | #define NE_FFLAGS_FRAMEBUF 0x0100 /* OS/2 fullscreen app */
|
|---|
| 100 | #define NE_FFLAGS_CONSOLE 0x0200 /* OS/2 console app */
|
|---|
| 101 | #define NE_FFLAGS_GUI 0x0300 /* right, (NE_FFLAGS_FRAMEBUF | NE_FFLAGS_CONSOLE) */
|
|---|
| 102 | #define NE_FFLAGS_SELFLOAD 0x0800
|
|---|
| 103 | #define NE_FFLAGS_LINKERROR 0x2000
|
|---|
| 104 | #define NE_FFLAGS_CALLWEP 0x4000
|
|---|
| 105 | #define NE_FFLAGS_LIBMODULE 0x8000
|
|---|
| 106 |
|
|---|
| 107 | /*
|
|---|
| 108 | * NE Header OPERATING SYSTEM
|
|---|
| 109 | */
|
|---|
| 110 | #define NE_OSFLAGS_UNKNOWN 0x01
|
|---|
| 111 | #define NE_OSFLAGS_WINDOWS 0x04
|
|---|
| 112 |
|
|---|
| 113 | /*
|
|---|
| 114 | * NE Header ADDITIONAL FLAGS
|
|---|
| 115 | */
|
|---|
| 116 | #define NE_AFLAGS_WIN2_PROTMODE 0x02
|
|---|
| 117 | #define NE_AFLAGS_WIN2_PROFONTS 0x04
|
|---|
| 118 | #define NE_AFLAGS_FASTLOAD 0x08
|
|---|
| 119 |
|
|---|
| 120 | /*
|
|---|
| 121 | * Segment table entry
|
|---|
| 122 | */
|
|---|
| 123 | struct ne_segment_table_entry_s
|
|---|
| 124 | {
|
|---|
| 125 | WORD seg_data_offset; /* Sector offset of segment data */
|
|---|
| 126 | WORD seg_data_length; /* Length of segment data */
|
|---|
| 127 | WORD seg_flags; /* Flags associated with this segment */
|
|---|
| 128 | WORD min_alloc; /* Minimum allocation size for this */
|
|---|
| 129 | };
|
|---|
| 130 |
|
|---|
| 131 | /*
|
|---|
| 132 | * Segment Flags
|
|---|
| 133 | */
|
|---|
| 134 | #define NE_SEGFLAGS_DATA 0x0001
|
|---|
| 135 | #define NE_SEGFLAGS_ALLOCATED 0x0002
|
|---|
| 136 | #define NE_SEGFLAGS_LOADED 0x0004
|
|---|
| 137 | #define NE_SEGFLAGS_ITERATED 0x0008
|
|---|
| 138 | #define NE_SEGFLAGS_MOVEABLE 0x0010
|
|---|
| 139 | #define NE_SEGFLAGS_SHAREABLE 0x0020
|
|---|
| 140 | #define NE_SEGFLAGS_PRELOAD 0x0040
|
|---|
| 141 | #define NE_SEGFLAGS_EXECUTEONLY 0x0080
|
|---|
| 142 | #define NE_SEGFLAGS_READONLY 0x0080
|
|---|
| 143 | #define NE_SEGFLAGS_RELOC_DATA 0x0100
|
|---|
| 144 | #define NE_SEGFLAGS_SELFLOAD 0x0800
|
|---|
| 145 | #define NE_SEGFLAGS_DISCARDABLE 0x1000
|
|---|
| 146 |
|
|---|
| 147 | /*
|
|---|
| 148 | * Relocation table entry
|
|---|
| 149 | */
|
|---|
| 150 | struct relocation_entry_s
|
|---|
| 151 | {
|
|---|
| 152 | BYTE address_type; /* Relocation address type */
|
|---|
| 153 | BYTE relocation_type; /* Relocation type */
|
|---|
| 154 | WORD offset; /* Offset in segment to fixup */
|
|---|
| 155 | WORD target1; /* Target specification */
|
|---|
| 156 | WORD target2; /* Target specification */
|
|---|
| 157 | };
|
|---|
| 158 |
|
|---|
| 159 | /*
|
|---|
| 160 | * Relocation address types
|
|---|
| 161 | */
|
|---|
| 162 | #define NE_RADDR_LOWBYTE 0
|
|---|
| 163 | #define NE_RADDR_SELECTOR 2
|
|---|
| 164 | #define NE_RADDR_POINTER32 3
|
|---|
| 165 | #define NE_RADDR_OFFSET16 5
|
|---|
| 166 | #define NE_RADDR_POINTER48 11
|
|---|
| 167 | #define NE_RADDR_OFFSET32 13
|
|---|
| 168 |
|
|---|
| 169 | /*
|
|---|
| 170 | * Relocation types
|
|---|
| 171 | */
|
|---|
| 172 | #define NE_RELTYPE_INTERNAL 0
|
|---|
| 173 | #define NE_RELTYPE_ORDINAL 1
|
|---|
| 174 | #define NE_RELTYPE_NAME 2
|
|---|
| 175 | #define NE_RELTYPE_OSFIXUP 3
|
|---|
| 176 | #define NE_RELFLAG_ADDITIVE 4
|
|---|
| 177 |
|
|---|
| 178 | /*
|
|---|
| 179 | * Resource table structures.
|
|---|
| 180 | */
|
|---|
| 181 | struct resource_nameinfo_s
|
|---|
| 182 | {
|
|---|
| 183 | unsigned short offset;
|
|---|
| 184 | unsigned short length;
|
|---|
| 185 | unsigned short flags;
|
|---|
| 186 | unsigned short id;
|
|---|
| 187 | HANDLE16 handle;
|
|---|
| 188 | unsigned short usage;
|
|---|
| 189 | };
|
|---|
| 190 |
|
|---|
| 191 | struct resource_typeinfo_s
|
|---|
| 192 | {
|
|---|
| 193 | unsigned short type_id; /* Type identifier */
|
|---|
| 194 | unsigned short count; /* Number of resources of this type */
|
|---|
| 195 | FARPROC16 resloader; /* SetResourceHandler() */
|
|---|
| 196 | /*
|
|---|
| 197 | * Name info array.
|
|---|
| 198 | */
|
|---|
| 199 | };
|
|---|
| 200 |
|
|---|
| 201 | #define NE_RSCTYPE_ACCELERATOR 0x8009
|
|---|
| 202 | #define NE_RSCTYPE_BITMAP 0x8002
|
|---|
| 203 | #define NE_RSCTYPE_CURSOR 0x8001
|
|---|
| 204 | #define NE_RSCTYPE_DIALOG 0x8005
|
|---|
| 205 | #define NE_RSCTYPE_FONT 0x8008
|
|---|
| 206 | #define NE_RSCTYPE_FONTDIR 0x8007
|
|---|
| 207 | #define NE_RSCTYPE_GROUP_CURSOR 0x800c
|
|---|
| 208 | #define NE_RSCTYPE_GROUP_ICON 0x800e
|
|---|
| 209 | #define NE_RSCTYPE_ICON 0x8003
|
|---|
| 210 | #define NE_RSCTYPE_MENU 0x8004
|
|---|
| 211 | #define NE_RSCTYPE_RCDATA 0x800a
|
|---|
| 212 | #define NE_RSCTYPE_STRING 0x8006
|
|---|
| 213 |
|
|---|
| 214 | #endif /* __WINE_NEEXE_H */
|
|---|