File: nlm386.h

package info (click to toggle)
biew 5.2.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,808 kB
  • ctags: 5,528
  • sloc: ansic: 38,763; makefile: 389; pascal: 245
file content (193 lines) | stat: -rw-r--r-- 6,395 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/** 
 * @namespace   biew_plugins_auto
 * @file        plugins/bin/nlm386.h
 * @brief       This file contains NLM file format definitions.
 * @version     -
 * @remark      this source file is part of Binary vIEW project (BIEW).
 *              The Binary vIEW (BIEW) is copyright (C) 1995 Nick Kurshev.
 *              All rights reserved. This software is redistributable under the
 *              licence given in the file "Licence.en" ("Licence.ru" in russian
 *              translation) distributed in the BIEW archive.
 * @note        Requires POSIX compatible development system
 *
 * @author      Nick Kurshev
 * @since       1995
 * @note        Development, fixes and improvements
**/
#ifndef __NLM_INC
#define __NLM_INC

#ifndef __SYS_DEP_H
#include "_sys_dep.h"
#endif

#ifdef __HAVE_PRAGMA_PACK__
#pragma pack(1)
#endif

typedef uint32_t file_ptr;
typedef uint32_t bfd_size_type;
typedef uint32_t bfd_vma;
typedef uint32_t PTR;
#define NLM_SIGNATURE "NetWare Loadable Module\x1a"
#define NLM_SIGNATURE_SIZE 24
#define NLM_MODULE_NAME_SIZE 14
#define NLM_MAX_DESCRIPTION_LENGTH 41
#define NLM_OLD_THREAD_NAME_LENGTH 5
#define NLM_MAX_SCREEN_NAME_LENGTH 4
#define NLM_MAX_THREAD_NAME_LENGTH 7
#define NLM_MAX_COPYRIGHT_MESSAGE_LENGTH 1


typedef struct nlm_internal_fixed_header
{
  int8_t        nlm_signature[NLM_SIGNATURE_SIZE];
  int32_t       nlm_version;
  int8_t        nlm_moduleName[NLM_MODULE_NAME_SIZE];
  file_ptr      nlm_codeImageOffset;
  bfd_size_type nlm_codeImageSize;
  file_ptr      nlm_dataImageOffset;
  bfd_size_type nlm_dataImageSize;
  bfd_size_type nlm_uninitializedDataSize;
  file_ptr      nlm_customDataOffset;
  bfd_size_type nlm_customDataSize;
  file_ptr      nlm_moduleDependencyOffset;
  int32_t       nlm_numberOfModuleDependencies;
  file_ptr      nlm_relocationFixupOffset;
  int32_t       nlm_numberOfRelocationFixups;
  file_ptr      nlm_externalReferencesOffset;
  int32_t       nlm_numberOfExternalReferences;
  file_ptr      nlm_publicsOffset;
  int32_t       nlm_numberOfPublics;
  file_ptr      nlm_debugInfoOffset;
  int32_t       nlm_numberOfDebugRecords;
  file_ptr      nlm_codeStartOffset;
  file_ptr      nlm_exitProcedureOffset;
  file_ptr      nlm_checkUnloadProcedureOffset;
  int32_t       nlm_moduleType;
  int32_t       nlm_flags;
} Nlm_Internal_Fixed_Header;

typedef struct nlm_internal_variable_header
{
  uint8_t        descriptionLength;
  int8_t         descriptionText[NLM_MAX_DESCRIPTION_LENGTH + 1];
  int32_t        stackSize;
  int32_t        reserved; /**< should contain zero */
  int8_t         oldThreadName[NLM_OLD_THREAD_NAME_LENGTH]; /**< " LONG" */
  uint8_t        screenNameLength;
  int8_t         screenName[NLM_MAX_SCREEN_NAME_LENGTH + 1];
  uint8_t        threadNameLength;
  int8_t         threadName[NLM_MAX_THREAD_NAME_LENGTH + 1];
} Nlm_Internal_Variable_Header;

/** The header is recognized by "VeRsIoN#" in the stamp field. */
typedef struct nlm_internal_version_header
{
  int8_t          stamp[8];
  int32_t         majorVersion;
  int32_t         minorVersion;
  int32_t         revision;
  int32_t         year;
  int32_t         month;
  int32_t         day;
} Nlm_Internal_Version_Header;

/** The header is recognized by "CoPyRiGhT=" in the stamp field. */
typedef struct nlm_internal_copyright_header
{
  int8_t         stamp[10];
  uint8_t        copyrightMessageLength;
  int8_t         copyrightMessage[NLM_MAX_COPYRIGHT_MESSAGE_LENGTH];
} Nlm_Internal_Copyright_Header;

/** The header is recognized by "MeSsAgEs" in the stamp field. */
typedef struct nlm_internal_extended_header
{
  int8_t        stamp[8];
  int32_t       languageID;
  file_ptr      messageFileOffset;
  bfd_size_type messageFileLength;
  int32_t       messageCount;
  file_ptr      helpFileOffset;
  bfd_size_type helpFileLength;
  file_ptr      RPCDataOffset;
  bfd_size_type RPCDataLength;
  file_ptr      sharedCodeOffset;
  bfd_size_type sharedCodeLength;
  file_ptr      sharedDataOffset;
  bfd_size_type sharedDataLength;
  file_ptr      sharedRelocationFixupOffset;
  int32_t       sharedRelocationFixupCount;
  file_ptr      sharedExternalReferenceOffset;
  int32_t       sharedExternalReferenceCount;
  file_ptr      sharedPublicsOffset;
  int32_t       sharedPublicsCount;
  file_ptr      sharedDebugRecordOffset;
  int32_t       sharedDebugRecordCount;
  bfd_vma       SharedInitializationOffset;
  bfd_vma       SharedExitProcedureOffset;
  int32_t       productID;
  int32_t       reserved[6];
} Nlm_Internal_Extended_Header;

/** The format of a custom header as stored internally is different
   from the external format.  This is how we store a custom header
   which we do not recognize.  */
/** The header is recognized by "CuStHeAd" in the stamp field. */
typedef struct nlm_internal_custom_header
{
  int8_t        stamp[8];
  bfd_size_type hdrLength;
  file_ptr      dataOffset;
  bfd_size_type dataLength;
  int8_t        dataStamp[8];
  PTR           hdr;
} Nlm_Internal_Custom_Header;

/** The internal Cygnus header is written out externally as a custom
    header.  We don't try to replicate that structure here.  */

/** The header is recognized by "CyGnUsEx" in the stamp field. */
typedef struct nlm_internal_cygnus_ext_header
{
  int8_t        stamp[8];
  file_ptr      offset;  /**< File location of debugging information.  */
  bfd_size_type length;   /**< Length of debugging information.  */
} Nlm_Internal_Cygnus_Ext_Header;

/**
   Public names table:
   ===================
   +0 ( 1 byte )         - name length
   +1 ( length bytes )   - name
   +length+1 ( 4 bytes ) - physical offset from begin of code section
*/

/**
   External name table:
   ====================
   +0 ( 1 byte )         - name length
   +1 ( length bytes )   - name
   +length+1 ( 4 bytes ) - number of fixups
   +length+5 ( 4 bytes array) - physical offsets from begin of code section
*/


typedef uint32_t	Nlm32_Addr;	/**< Unsigned program address */
typedef uint32_t	Nlm32_Off;	/**< Unsigned file offset */
typedef int32_t		Nlm32_Sword;	/**< Signed large integer */
typedef uint32_t	Nlm32_Word;	/**< Unsigned large integer */
typedef uint16_t	Nlm32_Half;	/**< Unsigned medium integer */
typedef uint8_t		Nlm32_Char;	/**< Unsigned tiny integer */

typedef int32_t		Nlm64_Sword;
typedef uint32_t	Nlm64_Word;
typedef uint16_t	Nlm64_Half;

#ifdef __HAVE_PRAGMA_PACK__
#pragma pack()
#endif


#endif