@isopodlabs/binary_libs 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +21 -0
- package/README.md +4 -1
- package/dist/CompoundDocument.d.ts +10 -10
- package/dist/CompoundDocument.js +45 -43
- package/dist/arch.js +2 -2
- package/dist/clr.d.ts +75 -54
- package/dist/clr.js +126 -114
- package/dist/cvinfo.d.ts +26 -0
- package/dist/cvinfo.js +930 -0
- package/dist/elf.d.ts +26 -20
- package/dist/elf.js +61 -61
- package/dist/mach.d.ts +176 -146
- package/dist/mach.js +101 -101
- package/dist/pe.d.ts +162 -132
- package/dist/pe.js +178 -172
- package/package.json +46 -43
- package/dist/CompoundDocument.js.map +0 -1
- package/dist/arch.js.map +0 -1
- package/dist/clr.js.map +0 -1
- package/dist/elf.js.map +0 -1
- package/dist/mach.js.map +0 -1
- package/dist/pe.js.map +0 -1
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Adrian Stephens
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# Binary Libs
|
|
2
|
+
[](https://www.npmjs.com/package/@isopodlabs/binary_libs)
|
|
3
|
+
[](https://github.com/adrianstephens/binary_libs)
|
|
4
|
+
[](LICENSE.txt)
|
|
2
5
|
|
|
3
6
|
This package provides readers for various library formats, using the @isopodlabs/binary binary file loading library
|
|
4
7
|
|
|
5
8
|
## ☕ Support My Work
|
|
6
|
-
If you use this package, consider [buying me a tea](https://coff.ee/adrianstephens) to support future updates!
|
|
9
|
+
If you use this package, consider [buying me a cup of tea](https://coff.ee/adrianstephens) to support future updates!
|
|
7
10
|
|
|
8
11
|
## Supported File Types
|
|
9
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as bin from '@isopodlabs/binary';
|
|
2
2
|
declare class FAT {
|
|
3
3
|
shift: number;
|
|
4
4
|
sectors: Uint8Array;
|
|
@@ -18,7 +18,7 @@ declare class FAT {
|
|
|
18
18
|
write_chain(chain: number[], source: Uint8Array): void;
|
|
19
19
|
dirty_chain_part(chain: number[], offset: number): Uint8Array;
|
|
20
20
|
}
|
|
21
|
-
declare const Header_base: (new (s:
|
|
21
|
+
declare const Header_base: (new (s: bin._stream) => {
|
|
22
22
|
magic: bigint;
|
|
23
23
|
id: Uint8Array;
|
|
24
24
|
revision: number;
|
|
@@ -38,17 +38,17 @@ declare const Header_base: (new (s: binary._stream) => {
|
|
|
38
38
|
num_difat: number;
|
|
39
39
|
difat: Uint8Array;
|
|
40
40
|
} & {
|
|
41
|
-
write(w:
|
|
41
|
+
write(w: bin._stream): void;
|
|
42
42
|
}) & {
|
|
43
|
-
get: <X extends abstract new (...args: any) => any>(this: X, s:
|
|
44
|
-
put: (s:
|
|
43
|
+
get: <X extends abstract new (...args: any) => any>(this: X, s: bin._stream) => InstanceType<X>;
|
|
44
|
+
put: (s: bin._stream, v: any) => void;
|
|
45
45
|
};
|
|
46
46
|
export declare class Header extends Header_base {
|
|
47
47
|
sector_size(): number;
|
|
48
48
|
use_mini(size: number): boolean;
|
|
49
49
|
valid(): boolean;
|
|
50
50
|
}
|
|
51
|
-
declare const DirEntry_base: (new (s:
|
|
51
|
+
declare const DirEntry_base: (new (s: bin._stream) => {
|
|
52
52
|
name: string;
|
|
53
53
|
name_size: number;
|
|
54
54
|
type: number;
|
|
@@ -64,14 +64,14 @@ declare const DirEntry_base: (new (s: binary._stream) => {
|
|
|
64
64
|
size: number;
|
|
65
65
|
unused: number;
|
|
66
66
|
} & {
|
|
67
|
-
write(w:
|
|
67
|
+
write(w: bin._stream): void;
|
|
68
68
|
}) & {
|
|
69
|
-
get: <X extends abstract new (...args: any) => any>(this: X, s:
|
|
70
|
-
put: (s:
|
|
69
|
+
get: <X extends abstract new (...args: any) => any>(this: X, s: bin._stream) => InstanceType<X>;
|
|
70
|
+
put: (s: bin._stream, v: any) => void;
|
|
71
71
|
};
|
|
72
72
|
declare class DirEntry extends DirEntry_base {
|
|
73
73
|
index: number;
|
|
74
|
-
constructor(index: number, r:
|
|
74
|
+
constructor(index: number, r: bin.stream);
|
|
75
75
|
load(fat: FAT): Uint8Array;
|
|
76
76
|
}
|
|
77
77
|
declare class Master {
|
package/dist/CompoundDocument.js
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Reader = exports.Header = void 0;
|
|
27
|
-
const
|
|
27
|
+
const bin = __importStar(require("@isopodlabs/binary"));
|
|
28
28
|
const fs_1 = require("fs");
|
|
29
29
|
class FAT {
|
|
30
30
|
shift;
|
|
@@ -111,25 +111,25 @@ class FAT {
|
|
|
111
111
|
return this.sectors.subarray((sector << this.shift) + (offset & ((1 << this.shift) - 1)));
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
class Header extends
|
|
115
|
-
magic:
|
|
116
|
-
id:
|
|
117
|
-
revision:
|
|
118
|
-
version:
|
|
119
|
-
byteorder:
|
|
120
|
-
sector_shift:
|
|
121
|
-
mini_shift:
|
|
122
|
-
unused1:
|
|
123
|
-
num_directory:
|
|
124
|
-
num_fat:
|
|
125
|
-
first_directory:
|
|
126
|
-
transaction:
|
|
127
|
-
mini_cutoff:
|
|
128
|
-
first_mini:
|
|
129
|
-
num_mini:
|
|
130
|
-
first_difat:
|
|
131
|
-
num_difat:
|
|
132
|
-
difat:
|
|
114
|
+
class Header extends bin.Class({
|
|
115
|
+
magic: bin.UINT64_BE,
|
|
116
|
+
id: bin.Buffer(16),
|
|
117
|
+
revision: bin.UINT16_LE,
|
|
118
|
+
version: bin.UINT16_LE,
|
|
119
|
+
byteorder: bin.UINT16_LE,
|
|
120
|
+
sector_shift: bin.UINT16_LE,
|
|
121
|
+
mini_shift: bin.UINT16_LE,
|
|
122
|
+
unused1: bin.SkipType(6),
|
|
123
|
+
num_directory: bin.UINT32_LE,
|
|
124
|
+
num_fat: bin.UINT32_LE,
|
|
125
|
+
first_directory: bin.UINT32_LE,
|
|
126
|
+
transaction: bin.SkipType(4), //must be 0
|
|
127
|
+
mini_cutoff: bin.UINT32_LE,
|
|
128
|
+
first_mini: bin.UINT32_LE,
|
|
129
|
+
num_mini: bin.UINT32_LE,
|
|
130
|
+
first_difat: bin.UINT32_LE,
|
|
131
|
+
num_difat: bin.UINT32_LE,
|
|
132
|
+
difat: bin.Buffer(436),
|
|
133
133
|
}) {
|
|
134
134
|
sector_size() { return 1 << this.sector_shift; }
|
|
135
135
|
use_mini(size) { return size < this.mini_cutoff; }
|
|
@@ -144,24 +144,26 @@ const TYPE = {
|
|
|
144
144
|
Property: 4,
|
|
145
145
|
RootStorage: 5,
|
|
146
146
|
};
|
|
147
|
+
/*
|
|
147
148
|
const COLOUR = {
|
|
148
149
|
RED: 0, BLACK: 1
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
150
|
+
} as const;
|
|
151
|
+
*/
|
|
152
|
+
class DirEntry extends bin.Class({
|
|
153
|
+
name: bin.StringType(32, 'utf16le'),
|
|
154
|
+
name_size: bin.UINT16_LE,
|
|
155
|
+
type: bin.UINT8,
|
|
156
|
+
colour: bin.UINT8,
|
|
157
|
+
left: bin.INT32_LE,
|
|
158
|
+
right: bin.INT32_LE,
|
|
159
|
+
root: bin.INT32_LE,
|
|
160
|
+
guid: bin.Buffer(16),
|
|
161
|
+
flags: bin.UINT32_LE,
|
|
162
|
+
creation: bin.UINT64_LE,
|
|
163
|
+
modification: bin.UINT64_LE,
|
|
164
|
+
sec_id: bin.INT32_LE,
|
|
165
|
+
size: bin.UINT32_LE,
|
|
166
|
+
unused: bin.UINT32_LE
|
|
165
167
|
}) {
|
|
166
168
|
index;
|
|
167
169
|
constructor(index, r) {
|
|
@@ -187,14 +189,14 @@ class Master {
|
|
|
187
189
|
let num = header.num_difat;
|
|
188
190
|
let m_size = 109 + (num << (shift - 2));
|
|
189
191
|
this.difat = new Int32Array(m_size);
|
|
190
|
-
|
|
192
|
+
bin.utils.to8(this.difat).set(header.difat, 0);
|
|
191
193
|
let sect = header.first_difat;
|
|
192
194
|
let p = 109 * 4;
|
|
193
195
|
while (num--) {
|
|
194
196
|
const data = sectors.subarray(sect << shift, (sect + 1) << shift);
|
|
195
197
|
const end = data.length - 4;
|
|
196
198
|
sect = new DataView(data.buffer).getUint32(end);
|
|
197
|
-
|
|
199
|
+
bin.utils.to8(this.difat).set(data.subarray(0, end), p);
|
|
198
200
|
p += end;
|
|
199
201
|
}
|
|
200
202
|
while (this.difat[m_size - 1] == -1 /* SecID.FREE */)
|
|
@@ -202,12 +204,12 @@ class Master {
|
|
|
202
204
|
this.fat = new FAT(m_size << (shift - 2), shift, sectors);
|
|
203
205
|
Array.from(this.difat.subarray(0, m_size)).forEach((id, index) => {
|
|
204
206
|
const data = sectors.subarray(id << shift, (id + 1) << shift);
|
|
205
|
-
|
|
207
|
+
bin.utils.to8(this.fat.fat).set(data, index << shift);
|
|
206
208
|
});
|
|
207
|
-
const root = new DirEntry(0, new
|
|
209
|
+
const root = new DirEntry(0, new bin.stream(sectors.subarray(header.first_directory << shift)));
|
|
208
210
|
this.mini_chain = this.fat.get_chain(root.sec_id);
|
|
209
211
|
this.mini_fat = new FAT(header.num_mini << (shift - 2), header.mini_shift, root.load(this.fat));
|
|
210
|
-
this.fat.read(header.first_mini,
|
|
212
|
+
this.fat.read(header.first_mini, bin.utils.to8(this.mini_fat.fat));
|
|
211
213
|
}
|
|
212
214
|
get_fat(mini) {
|
|
213
215
|
return mini ? this.mini_fat : this.fat;
|
|
@@ -251,7 +253,7 @@ class Reader extends Master {
|
|
|
251
253
|
super(sectors, header);
|
|
252
254
|
this.entry_chain = this.fat.get_chain(header.first_directory);
|
|
253
255
|
const dir_buff = this.fat.read_chain_alloc(this.entry_chain);
|
|
254
|
-
const r2 = new
|
|
256
|
+
const r2 = new bin.stream(dir_buff);
|
|
255
257
|
for (let i = 0; i < dir_buff.length / 128; i++)
|
|
256
258
|
this.entries[i] = new DirEntry(i, r2.seek(i * 128));
|
|
257
259
|
}
|
|
@@ -292,7 +294,7 @@ class Reader extends Master {
|
|
|
292
294
|
e.size = data.length;
|
|
293
295
|
e.sec_id = chain[0];
|
|
294
296
|
const dest = this.fat.dirty_chain_part(this.entry_chain, e.index * 128);
|
|
295
|
-
e.write(new
|
|
297
|
+
e.write(new bin.stream(dest));
|
|
296
298
|
}
|
|
297
299
|
fat2.write_chain(chain, data);
|
|
298
300
|
}
|
package/dist/arch.js
CHANGED
|
@@ -58,7 +58,7 @@ class ArchFile {
|
|
|
58
58
|
while (s.remaining() > 0) {
|
|
59
59
|
const member = binary.read(s, _HEADER);
|
|
60
60
|
const data = s.read_buffer(member.size);
|
|
61
|
-
s
|
|
61
|
+
binary.AlignType(2).get(s); //.align(2);
|
|
62
62
|
if (member.name == '/') {
|
|
63
63
|
long_names = binary.utils.decodeText(data, 'utf8');
|
|
64
64
|
continue;
|
|
@@ -80,7 +80,7 @@ class ArchFile {
|
|
|
80
80
|
break;
|
|
81
81
|
}
|
|
82
82
|
case 2: { // microsoft symbols
|
|
83
|
-
const
|
|
83
|
+
const _offsets = binary.ArrayType(binary.INT32_LE, binary.INT32_LE).get(s2);
|
|
84
84
|
const indices = binary.ArrayType(binary.INT32_LE, binary.INT16_LE).get(s2);
|
|
85
85
|
member.name = 'Symbols2';
|
|
86
86
|
member.contents = indices.map(i => [
|
package/dist/clr.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as bin from '@isopodlabs/binary';
|
|
2
2
|
import * as pe from './pe';
|
|
3
3
|
declare enum TABLE {
|
|
4
4
|
Module = 0,
|
|
@@ -40,7 +40,7 @@ declare enum TABLE {
|
|
|
40
40
|
MethodSpec = 43,
|
|
41
41
|
GenericParamConstraint = 44
|
|
42
42
|
}
|
|
43
|
-
declare class clr_stream extends
|
|
43
|
+
declare class clr_stream extends bin.stream {
|
|
44
44
|
heaps: Uint8Array[];
|
|
45
45
|
heap_sizes: number;
|
|
46
46
|
table_counts: number[];
|
|
@@ -55,7 +55,7 @@ declare class clr_stream extends binary.stream {
|
|
|
55
55
|
}
|
|
56
56
|
declare const TableReaders: {
|
|
57
57
|
0: {
|
|
58
|
-
generation:
|
|
58
|
+
generation: bin.TypeT<number>;
|
|
59
59
|
name: {
|
|
60
60
|
get(s: clr_stream): string;
|
|
61
61
|
put(_s: clr_stream, _v: number): void;
|
|
@@ -87,7 +87,7 @@ declare const TableReaders: {
|
|
|
87
87
|
};
|
|
88
88
|
};
|
|
89
89
|
2: {
|
|
90
|
-
flags:
|
|
90
|
+
flags: bin.TypeT<number>;
|
|
91
91
|
name: {
|
|
92
92
|
get(s: clr_stream): string;
|
|
93
93
|
put(_s: clr_stream, _v: number): void;
|
|
@@ -107,7 +107,7 @@ declare const TableReaders: {
|
|
|
107
107
|
};
|
|
108
108
|
};
|
|
109
109
|
4: {
|
|
110
|
-
flags:
|
|
110
|
+
flags: bin.TypeT<number>;
|
|
111
111
|
name: {
|
|
112
112
|
get(s: clr_stream): string;
|
|
113
113
|
put(_s: clr_stream, _v: number): void;
|
|
@@ -118,9 +118,9 @@ declare const TableReaders: {
|
|
|
118
118
|
};
|
|
119
119
|
};
|
|
120
120
|
6: {
|
|
121
|
-
code:
|
|
122
|
-
implflags:
|
|
123
|
-
flags:
|
|
121
|
+
code: bin.TypeT<number>;
|
|
122
|
+
implflags: bin.TypeT<number>;
|
|
123
|
+
flags: bin.TypeT<number>;
|
|
124
124
|
name: {
|
|
125
125
|
get(s: clr_stream): string;
|
|
126
126
|
put(_s: clr_stream, _v: number): void;
|
|
@@ -134,8 +134,8 @@ declare const TableReaders: {
|
|
|
134
134
|
};
|
|
135
135
|
};
|
|
136
136
|
8: {
|
|
137
|
-
flags:
|
|
138
|
-
sequence:
|
|
137
|
+
flags: bin.TypeT<number>;
|
|
138
|
+
sequence: bin.TypeT<number>;
|
|
139
139
|
name: {
|
|
140
140
|
get(s: clr_stream): string;
|
|
141
141
|
put(_s: clr_stream, _v: number): void;
|
|
@@ -163,7 +163,7 @@ declare const TableReaders: {
|
|
|
163
163
|
};
|
|
164
164
|
};
|
|
165
165
|
11: {
|
|
166
|
-
type:
|
|
166
|
+
type: bin.TypeT<number>;
|
|
167
167
|
parent: {
|
|
168
168
|
get(s: clr_stream): number;
|
|
169
169
|
};
|
|
@@ -194,7 +194,7 @@ declare const TableReaders: {
|
|
|
194
194
|
};
|
|
195
195
|
};
|
|
196
196
|
14: {
|
|
197
|
-
action:
|
|
197
|
+
action: bin.TypeT<number>;
|
|
198
198
|
parent: {
|
|
199
199
|
get(s: clr_stream): number;
|
|
200
200
|
};
|
|
@@ -204,14 +204,14 @@ declare const TableReaders: {
|
|
|
204
204
|
};
|
|
205
205
|
};
|
|
206
206
|
15: {
|
|
207
|
-
packing_size:
|
|
208
|
-
class_size:
|
|
207
|
+
packing_size: bin.TypeT<number>;
|
|
208
|
+
class_size: bin.TypeT<number>;
|
|
209
209
|
parent: {
|
|
210
210
|
get(s: clr_stream): number;
|
|
211
211
|
};
|
|
212
212
|
};
|
|
213
213
|
16: {
|
|
214
|
-
offset:
|
|
214
|
+
offset: bin.TypeT<number>;
|
|
215
215
|
field: {
|
|
216
216
|
get(s: clr_stream): number;
|
|
217
217
|
};
|
|
@@ -231,7 +231,7 @@ declare const TableReaders: {
|
|
|
231
231
|
};
|
|
232
232
|
};
|
|
233
233
|
20: {
|
|
234
|
-
flags:
|
|
234
|
+
flags: bin.TypeT<number>;
|
|
235
235
|
name: {
|
|
236
236
|
get(s: clr_stream): string;
|
|
237
237
|
put(_s: clr_stream, _v: number): void;
|
|
@@ -249,7 +249,7 @@ declare const TableReaders: {
|
|
|
249
249
|
};
|
|
250
250
|
};
|
|
251
251
|
23: {
|
|
252
|
-
flags:
|
|
252
|
+
flags: bin.TypeT<number>;
|
|
253
253
|
name: {
|
|
254
254
|
get(s: clr_stream): string;
|
|
255
255
|
put(_s: clr_stream, _v: number): void;
|
|
@@ -260,7 +260,7 @@ declare const TableReaders: {
|
|
|
260
260
|
};
|
|
261
261
|
};
|
|
262
262
|
24: {
|
|
263
|
-
flags:
|
|
263
|
+
flags: bin.TypeT<number>;
|
|
264
264
|
method: {
|
|
265
265
|
get(s: clr_stream): number;
|
|
266
266
|
};
|
|
@@ -292,7 +292,7 @@ declare const TableReaders: {
|
|
|
292
292
|
};
|
|
293
293
|
};
|
|
294
294
|
28: {
|
|
295
|
-
flags:
|
|
295
|
+
flags: bin.TypeT<number>;
|
|
296
296
|
member_forwarded: {
|
|
297
297
|
get(s: clr_stream): number;
|
|
298
298
|
};
|
|
@@ -305,18 +305,18 @@ declare const TableReaders: {
|
|
|
305
305
|
};
|
|
306
306
|
};
|
|
307
307
|
29: {
|
|
308
|
-
rva:
|
|
308
|
+
rva: bin.TypeT<number>;
|
|
309
309
|
field: {
|
|
310
310
|
get(s: clr_stream): number;
|
|
311
311
|
};
|
|
312
312
|
};
|
|
313
313
|
32: {
|
|
314
|
-
hashalg:
|
|
315
|
-
major:
|
|
316
|
-
minor:
|
|
317
|
-
build:
|
|
318
|
-
rev:
|
|
319
|
-
flags:
|
|
314
|
+
hashalg: bin.TypeT<number>;
|
|
315
|
+
major: bin.TypeT<number>;
|
|
316
|
+
minor: bin.TypeT<number>;
|
|
317
|
+
build: bin.TypeT<number>;
|
|
318
|
+
rev: bin.TypeT<number>;
|
|
319
|
+
flags: bin.TypeT<number>;
|
|
320
320
|
publickey: {
|
|
321
321
|
get(s: clr_stream): Uint8Array;
|
|
322
322
|
put(_s: clr_stream, _v: number): void;
|
|
@@ -331,19 +331,19 @@ declare const TableReaders: {
|
|
|
331
331
|
};
|
|
332
332
|
};
|
|
333
333
|
33: {
|
|
334
|
-
processor:
|
|
334
|
+
processor: bin.TypeT<number>;
|
|
335
335
|
};
|
|
336
336
|
34: {
|
|
337
|
-
platform:
|
|
338
|
-
minor:
|
|
339
|
-
major:
|
|
337
|
+
platform: bin.TypeT<number>;
|
|
338
|
+
minor: bin.TypeT<number>;
|
|
339
|
+
major: bin.TypeT<number>;
|
|
340
340
|
};
|
|
341
341
|
35: {
|
|
342
|
-
major:
|
|
343
|
-
minor:
|
|
344
|
-
build:
|
|
345
|
-
rev:
|
|
346
|
-
flags:
|
|
342
|
+
major: bin.TypeT<number>;
|
|
343
|
+
minor: bin.TypeT<number>;
|
|
344
|
+
build: bin.TypeT<number>;
|
|
345
|
+
rev: bin.TypeT<number>;
|
|
346
|
+
flags: bin.TypeT<number>;
|
|
347
347
|
publickey: {
|
|
348
348
|
get(s: clr_stream): Uint8Array;
|
|
349
349
|
put(_s: clr_stream, _v: number): void;
|
|
@@ -362,21 +362,21 @@ declare const TableReaders: {
|
|
|
362
362
|
};
|
|
363
363
|
};
|
|
364
364
|
36: {
|
|
365
|
-
processor:
|
|
365
|
+
processor: bin.TypeT<number>;
|
|
366
366
|
assembly: {
|
|
367
367
|
get(s: clr_stream): number;
|
|
368
368
|
};
|
|
369
369
|
};
|
|
370
370
|
37: {
|
|
371
|
-
platform:
|
|
372
|
-
major:
|
|
373
|
-
minor:
|
|
371
|
+
platform: bin.TypeT<number>;
|
|
372
|
+
major: bin.TypeT<number>;
|
|
373
|
+
minor: bin.TypeT<number>;
|
|
374
374
|
assembly: {
|
|
375
375
|
get(s: clr_stream): number;
|
|
376
376
|
};
|
|
377
377
|
};
|
|
378
378
|
38: {
|
|
379
|
-
flags:
|
|
379
|
+
flags: bin.TypeT<number>;
|
|
380
380
|
name: {
|
|
381
381
|
get(s: clr_stream): string;
|
|
382
382
|
put(_s: clr_stream, _v: number): void;
|
|
@@ -387,8 +387,8 @@ declare const TableReaders: {
|
|
|
387
387
|
};
|
|
388
388
|
};
|
|
389
389
|
39: {
|
|
390
|
-
flags:
|
|
391
|
-
typedef_id:
|
|
390
|
+
flags: bin.TypeT<number>;
|
|
391
|
+
typedef_id: bin.TypeT<number>;
|
|
392
392
|
name: {
|
|
393
393
|
get(s: clr_stream): string;
|
|
394
394
|
put(_s: clr_stream, _v: number): void;
|
|
@@ -402,8 +402,8 @@ declare const TableReaders: {
|
|
|
402
402
|
};
|
|
403
403
|
};
|
|
404
404
|
40: {
|
|
405
|
-
data:
|
|
406
|
-
flags:
|
|
405
|
+
data: bin.TypeT<number>;
|
|
406
|
+
flags: bin.TypeT<number>;
|
|
407
407
|
name: {
|
|
408
408
|
get(s: clr_stream): string;
|
|
409
409
|
put(_s: clr_stream, _v: number): void;
|
|
@@ -421,8 +421,8 @@ declare const TableReaders: {
|
|
|
421
421
|
};
|
|
422
422
|
};
|
|
423
423
|
42: {
|
|
424
|
-
number:
|
|
425
|
-
flags:
|
|
424
|
+
number: bin.TypeT<number>;
|
|
425
|
+
flags: bin.TypeT<number>;
|
|
426
426
|
owner: {
|
|
427
427
|
get(s: clr_stream): number;
|
|
428
428
|
};
|
|
@@ -460,14 +460,32 @@ export declare class CLR {
|
|
|
460
460
|
cb: number;
|
|
461
461
|
MajorRuntimeVersion: number;
|
|
462
462
|
MinorRuntimeVersion: number;
|
|
463
|
-
MetaData:
|
|
463
|
+
MetaData: {
|
|
464
|
+
VirtualAddress: number;
|
|
465
|
+
Size: number;
|
|
466
|
+
};
|
|
464
467
|
Flags: Record<string, bigint | boolean> | Record<string, number | boolean>;
|
|
465
468
|
EntryPoint: number;
|
|
466
|
-
Resources:
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
469
|
+
Resources: {
|
|
470
|
+
VirtualAddress: number;
|
|
471
|
+
Size: number;
|
|
472
|
+
};
|
|
473
|
+
StrongNameSignature: {
|
|
474
|
+
VirtualAddress: number;
|
|
475
|
+
Size: number;
|
|
476
|
+
};
|
|
477
|
+
CodeManagerTable: {
|
|
478
|
+
VirtualAddress: number;
|
|
479
|
+
Size: number;
|
|
480
|
+
};
|
|
481
|
+
VTableFixups: {
|
|
482
|
+
VirtualAddress: number;
|
|
483
|
+
Size: number;
|
|
484
|
+
};
|
|
485
|
+
ExportAddressTableJumps: {
|
|
486
|
+
VirtualAddress: number;
|
|
487
|
+
Size: number;
|
|
488
|
+
};
|
|
471
489
|
};
|
|
472
490
|
table_info: {
|
|
473
491
|
Reserved: number;
|
|
@@ -482,12 +500,15 @@ export declare class CLR {
|
|
|
482
500
|
tables: Record<TABLE, Table>;
|
|
483
501
|
Resources?: Uint8Array;
|
|
484
502
|
constructor(pe: pe.PE, clr_data: Uint8Array);
|
|
485
|
-
getEntry<T extends TABLE>(t: T, i: number):
|
|
503
|
+
getEntry<T extends TABLE>(t: T, i: number): bin.ReadType<typeof TableReaders[T]>;
|
|
486
504
|
getEntry(t: TABLE, i: number): any;
|
|
487
|
-
getTable<T extends TABLE>(t: T):
|
|
505
|
+
getTable<T extends TABLE>(t: T): bin.ReadType<typeof TableReaders[T]>[];
|
|
488
506
|
getTable(t: TABLE): any;
|
|
489
507
|
getResources(block: string): Record<string, any> | undefined;
|
|
490
508
|
getResource(block: string, name: string): any;
|
|
491
509
|
allResources(): any;
|
|
492
510
|
}
|
|
511
|
+
export declare function ReadCLR(pe: pe.PE, data: bin.MappedMemory): {
|
|
512
|
+
[k: string]: any;
|
|
513
|
+
};
|
|
493
514
|
export {};
|