1 // copyright (c) 2020-2021 hors<horsicq@gmail.com>
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 
10 // The above copyright notice and this permission notice shall be included in all
11 // copies or substantial portions of the Software.
12 
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 // SOFTWARE.
20 //
21 #ifndef XLE_DEF_H
22 #define XLE_DEF_H
23 
24 #include <QtGlobal>
25 
26 namespace XLE_DEF
27 {
28 const quint32 S_IMAGE_VXD_SIGNATURE             =0x454C;      // LE
29 const quint32 S_IMAGE_LX_SIGNATURE              =0x584C;      // LX
30 
31 struct IMAGE_VXD_HEADER
32 {      // Windows VXD header
33     quint16 e32_magic;                  // Magic number
34     quint8 e32_border;                  // The byte ordering for the VXD
35     quint8 e32_worder;                  // The word ordering for the VXD
36     quint32 e32_level;                  // The EXE format level for now = 0
37     quint16 e32_cpu;                    // The CPU type
38     quint16 e32_os;                     // The OS type
39     quint32 e32_ver;                    // Module version
40     quint32 e32_mflags;                 // Module flags
41     quint32 e32_mpages;                 // Module # pages
42     quint32 e32_startobj;               // Object # for instruction pointer
43     quint32 e32_eip;                    // Extended instruction pointer
44     quint32 e32_stackobj;               // Object # for stack pointer
45     quint32 e32_esp;                    // Extended stack pointer
46     quint32 e32_pagesize;               // VXD page size
47     quint32 e32_lastpagesize;           // Last page size in VXD
48     quint32 e32_fixupsize;              // Fixup section size
49     quint32 e32_fixupsum;               // Fixup section checksum
50     quint32 e32_ldrsize;                // Loader section size
51     quint32 e32_ldrsum;                 // Loader section checksum
52     quint32 e32_objtab;                 // Object table offset
53     quint32 e32_objcnt;                 // Number of objects in module
54     quint32 e32_objmap;                 // Object page map offset
55     quint32 e32_itermap;                // Object iterated data map offset
56     quint32 e32_rsrctab;                // Offset of Resource Table
57     quint32 e32_rsrccnt;                // Number of resource entries
58     quint32 e32_restab;                 // Offset of resident name table
59     quint32 e32_enttab;                 // Offset of Entry Table
60     quint32 e32_dirtab;                 // Offset of Module Directive Table
61     quint32 e32_dircnt;                 // Number of module directives
62     quint32 e32_fpagetab;               // Offset of Fixup Page Table
63     quint32 e32_frectab;                // Offset of Fixup Record Table
64     quint32 e32_impmod;                 // Offset of Import Module Name Table
65     quint32 e32_impmodcnt;              // Number of entries in Import Module Name Table
66     quint32 e32_impproc;                // Offset of Import Procedure Name Table
67     quint32 e32_pagesum;                // Offset of Per-Page Checksum Table
68     quint32 e32_datapage;               // Offset of Enumerated Data Pages
69     quint32 e32_preload;                // Number of preload pages
70     quint32 e32_nrestab;                // Offset of Non-resident Names Table
71     quint32 e32_cbnrestab;              // Size of Non-resident Name Table
72     quint32 e32_nressum;                // Non-resident Name Table Checksum
73     quint32 e32_autodata;               // Object # for automatic data object
74     quint32 e32_debuginfo;              // Offset of the debugging information
75     quint32 e32_debuglen;               // The length of the debugging info. in bytes
76     quint32 e32_instpreload;            // Number of instance pages in preload section of VXD file
77     quint32 e32_instdemand;             // Number of instance pages in demand load section of VXD file
78     quint32 e32_heapsize;               // Size of heap - for 16-bit apps
79 //    BYTE   e32_res3[12];              // Reserved words
80 //    DWORD  e32_winresoff;
81 //    DWORD  e32_winreslen;
82 //    WORD   e32_devid;                 // Device ID for VxD
83 //    WORD   e32_ddkver;                // DDK version for VxD
84 };
85 
86 struct o32_obj
87 {
88     quint32 o32_size;
89     quint32 o32_base;
90     quint32 o32_flags;
91     quint32 o32_pagemap;                // index in map
92     quint32 o32_mapsize;                // number of entry
93     quint32 o32_reserved;
94 };
95 
96 struct o32_map
97 {
98     quint32 o32_pagedataoffset;
99     quint16 o32_pagesize;
100     quint16 o32_pageflags;
101 };
102 }
103 #endif // XLE_DEF_H
104