lisette-stdlib 0.1.16

Little language inspired by Rust that compiles to Go
Documentation
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
// Generated by Lisette bindgen
// Source: debug/pe (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.14

import "go:debug/dwarf"
import "go:io"

pub fn NewFile(r: io.ReaderAt) -> Result<Ref<File>, error>

pub fn Open(name: string) -> Result<Ref<File>, error>

/// COFFSymbol represents single COFF symbol table record.
pub struct COFFSymbol {
  pub Name: Slice<uint8>,
  pub Value: uint32,
  pub SectionNumber: int16,
  pub Type: uint16,
  pub StorageClass: uint8,
  pub NumberOfAuxSymbols: uint8,
}

/// COFFSymbolAuxFormat5 describes the expected form of an aux symbol
/// attached to a section definition symbol. The PE format defines a
/// number of different aux symbol formats: format 1 for function
/// definitions, format 2 for .be and .ef symbols, and so on. Format 5
/// holds extra info associated with a section definition, including
/// number of relocations + line numbers, as well as COMDAT info. See
/// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#auxiliary-format-5-section-definitions
/// for more on what's going on here.
pub struct COFFSymbolAuxFormat5 {
  pub Size: uint32,
  pub NumRelocs: uint16,
  pub NumLineNumbers: uint16,
  pub Checksum: uint32,
  pub SecNum: uint16,
  pub Selection: uint8,
}

pub struct DataDirectory {
  pub VirtualAddress: uint32,
  pub Size: uint32,
}

/// A File represents an open PE file.
pub struct File {
  pub FileHeader: FileHeader,
  pub OptionalHeader: Unknown,
  pub Sections: Slice<Option<Ref<Section>>>,
  pub Symbols: Slice<Option<Ref<Symbol>>>,
  pub COFFSymbols: Slice<COFFSymbol>,
  pub StringTable: StringTable,
}

pub struct FileHeader {
  pub Machine: uint16,
  pub NumberOfSections: uint16,
  pub TimeDateStamp: uint32,
  pub PointerToSymbolTable: uint32,
  pub NumberOfSymbols: uint32,
  pub SizeOfOptionalHeader: uint16,
  pub Characteristics: uint16,
}

/// FormatError is unused.
/// The type is retained for compatibility.
pub type FormatError

pub struct ImportDirectory {
  pub OriginalFirstThunk: uint32,
  pub TimeDateStamp: uint32,
  pub ForwarderChain: uint32,
  pub Name: uint32,
  pub FirstThunk: uint32,
}

pub struct OptionalHeader32 {
  pub Magic: uint16,
  pub MajorLinkerVersion: uint8,
  pub MinorLinkerVersion: uint8,
  pub SizeOfCode: uint32,
  pub SizeOfInitializedData: uint32,
  pub SizeOfUninitializedData: uint32,
  pub AddressOfEntryPoint: uint32,
  pub BaseOfCode: uint32,
  pub BaseOfData: uint32,
  pub ImageBase: uint32,
  pub SectionAlignment: uint32,
  pub FileAlignment: uint32,
  pub MajorOperatingSystemVersion: uint16,
  pub MinorOperatingSystemVersion: uint16,
  pub MajorImageVersion: uint16,
  pub MinorImageVersion: uint16,
  pub MajorSubsystemVersion: uint16,
  pub MinorSubsystemVersion: uint16,
  pub Win32VersionValue: uint32,
  pub SizeOfImage: uint32,
  pub SizeOfHeaders: uint32,
  pub CheckSum: uint32,
  pub Subsystem: uint16,
  pub DllCharacteristics: uint16,
  pub SizeOfStackReserve: uint32,
  pub SizeOfStackCommit: uint32,
  pub SizeOfHeapReserve: uint32,
  pub SizeOfHeapCommit: uint32,
  pub LoaderFlags: uint32,
  pub NumberOfRvaAndSizes: uint32,
  pub DataDirectory: Slice<DataDirectory>,
}

pub struct OptionalHeader64 {
  pub Magic: uint16,
  pub MajorLinkerVersion: uint8,
  pub MinorLinkerVersion: uint8,
  pub SizeOfCode: uint32,
  pub SizeOfInitializedData: uint32,
  pub SizeOfUninitializedData: uint32,
  pub AddressOfEntryPoint: uint32,
  pub BaseOfCode: uint32,
  pub ImageBase: uint64,
  pub SectionAlignment: uint32,
  pub FileAlignment: uint32,
  pub MajorOperatingSystemVersion: uint16,
  pub MinorOperatingSystemVersion: uint16,
  pub MajorImageVersion: uint16,
  pub MinorImageVersion: uint16,
  pub MajorSubsystemVersion: uint16,
  pub MinorSubsystemVersion: uint16,
  pub Win32VersionValue: uint32,
  pub SizeOfImage: uint32,
  pub SizeOfHeaders: uint32,
  pub CheckSum: uint32,
  pub Subsystem: uint16,
  pub DllCharacteristics: uint16,
  pub SizeOfStackReserve: uint64,
  pub SizeOfStackCommit: uint64,
  pub SizeOfHeapReserve: uint64,
  pub SizeOfHeapCommit: uint64,
  pub LoaderFlags: uint32,
  pub NumberOfRvaAndSizes: uint32,
  pub DataDirectory: Slice<DataDirectory>,
}

/// Reloc represents a PE COFF relocation.
/// Each section contains its own relocation list.
pub struct Reloc {
  pub VirtualAddress: uint32,
  pub SymbolTableIndex: uint32,
  pub Type: uint16,
}

/// Section provides access to PE COFF section.
pub struct Section {
  pub SectionHeader: SectionHeader,
  pub Relocs: Slice<Reloc>,
  pub ReaderAt: Option<io.ReaderAt>,
}

/// SectionHeader is similar to [SectionHeader32] with Name
/// field replaced by Go string.
pub struct SectionHeader {
  pub Name: string,
  pub VirtualSize: uint32,
  pub VirtualAddress: uint32,
  pub Size: uint32,
  pub Offset: uint32,
  pub PointerToRelocations: uint32,
  pub PointerToLineNumbers: uint32,
  pub NumberOfRelocations: uint16,
  pub NumberOfLineNumbers: uint16,
  pub Characteristics: uint32,
}

/// SectionHeader32 represents real PE COFF section header.
pub struct SectionHeader32 {
  pub Name: Slice<uint8>,
  pub VirtualSize: uint32,
  pub VirtualAddress: uint32,
  pub SizeOfRawData: uint32,
  pub PointerToRawData: uint32,
  pub PointerToRelocations: uint32,
  pub PointerToLineNumbers: uint32,
  pub NumberOfRelocations: uint16,
  pub NumberOfLineNumbers: uint16,
  pub Characteristics: uint32,
}

/// StringTable is a COFF string table.
pub struct StringTable(Slice<uint8>)

/// Symbol is similar to [COFFSymbol] with Name field replaced
/// by Go string. Symbol also does not have NumberOfAuxSymbols.
pub struct Symbol {
  pub Name: string,
  pub Value: uint32,
  pub SectionNumber: int16,
  pub Type: uint16,
  pub StorageClass: uint8,
}

const COFFSymbolSize = 18

/// These constants make up the possible values for the 'Selection'
/// field in an AuxFormat5.
const IMAGE_COMDAT_SELECT_ANY = 2

/// These constants make up the possible values for the 'Selection'
/// field in an AuxFormat5.
const IMAGE_COMDAT_SELECT_ASSOCIATIVE = 5

/// These constants make up the possible values for the 'Selection'
/// field in an AuxFormat5.
const IMAGE_COMDAT_SELECT_EXACT_MATCH = 4

/// These constants make up the possible values for the 'Selection'
/// field in an AuxFormat5.
const IMAGE_COMDAT_SELECT_LARGEST = 6

/// These constants make up the possible values for the 'Selection'
/// field in an AuxFormat5.
const IMAGE_COMDAT_SELECT_NODUPLICATES = 1

/// These constants make up the possible values for the 'Selection'
/// field in an AuxFormat5.
const IMAGE_COMDAT_SELECT_SAME_SIZE = 3

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_ARCHITECTURE = 7

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_BASERELOC = 5

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT = 11

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_DEBUG = 6

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT = 13

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_EXCEPTION = 3

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_EXPORT = 0

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_GLOBALPTR = 8

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_IAT = 12

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_IMPORT = 1

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG = 10

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_RESOURCE = 2

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_SECURITY = 4

/// IMAGE_DIRECTORY_ENTRY constants
const IMAGE_DIRECTORY_ENTRY_TLS = 9

/// OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
/// values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_APPCONTAINER = 0x1000

/// OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
/// values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE = 0x0040

/// OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
/// values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY = 0x0080

/// OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
/// values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_GUARD_CF = 0x4000

/// OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
/// values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA = 0x0020

/// OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
/// values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_NO_BIND = 0x0800

/// OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
/// values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = 0x0200

/// OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
/// values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_NO_SEH = 0x0400

/// OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
/// values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_NX_COMPAT = 0x0100

/// OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
/// values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000

/// OptionalHeader64.DllCharacteristics and OptionalHeader32.DllCharacteristics
/// values. These can be combined together.
const IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = 0x2000

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_32BIT_MACHINE = 0x0100

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_AGGRESIVE_WS_TRIM = 0x0010

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_BYTES_REVERSED_HI = 0x8000

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_BYTES_REVERSED_LO = 0x0080

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_DEBUG_STRIPPED = 0x0200

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_DLL = 0x2000

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0x0008

const IMAGE_FILE_MACHINE_AM33 = 0x1d3

const IMAGE_FILE_MACHINE_AMD64 = 0x8664

const IMAGE_FILE_MACHINE_ARM = 0x1c0

const IMAGE_FILE_MACHINE_ARM64 = 0xaa64

const IMAGE_FILE_MACHINE_ARMNT = 0x1c4

const IMAGE_FILE_MACHINE_EBC = 0xebc

const IMAGE_FILE_MACHINE_I386 = 0x14c

const IMAGE_FILE_MACHINE_IA64 = 0x200

const IMAGE_FILE_MACHINE_LOONGARCH32 = 0x6232

const IMAGE_FILE_MACHINE_LOONGARCH64 = 0x6264

const IMAGE_FILE_MACHINE_M32R = 0x9041

const IMAGE_FILE_MACHINE_MIPS16 = 0x266

const IMAGE_FILE_MACHINE_MIPSFPU = 0x366

const IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466

const IMAGE_FILE_MACHINE_POWERPC = 0x1f0

const IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1

const IMAGE_FILE_MACHINE_R4000 = 0x166

const IMAGE_FILE_MACHINE_RISCV128 = 0x5128

const IMAGE_FILE_MACHINE_RISCV32 = 0x5032

const IMAGE_FILE_MACHINE_RISCV64 = 0x5064

const IMAGE_FILE_MACHINE_SH3 = 0x1a2

const IMAGE_FILE_MACHINE_SH3DSP = 0x1a3

const IMAGE_FILE_MACHINE_SH4 = 0x1a6

const IMAGE_FILE_MACHINE_SH5 = 0x1a8

const IMAGE_FILE_MACHINE_THUMB = 0x1c2

const IMAGE_FILE_MACHINE_UNKNOWN = 0x0

const IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_NET_RUN_FROM_SWAP = 0x0800

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_RELOCS_STRIPPED = 0x0001

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0x0400

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_SYSTEM = 0x1000

/// Values of IMAGE_FILE_HEADER.Characteristics. These can be combined together.
const IMAGE_FILE_UP_SYSTEM_ONLY = 0x4000

/// Section characteristics flags.
const IMAGE_SCN_CNT_CODE = 0x00000020

/// Section characteristics flags.
const IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040

/// Section characteristics flags.
const IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080

/// Section characteristics flags.
const IMAGE_SCN_LNK_COMDAT = 0x00001000

/// Section characteristics flags.
const IMAGE_SCN_MEM_DISCARDABLE = 0x02000000

/// Section characteristics flags.
const IMAGE_SCN_MEM_EXECUTE = 0x20000000

/// Section characteristics flags.
const IMAGE_SCN_MEM_READ = 0x40000000

/// Section characteristics flags.
const IMAGE_SCN_MEM_WRITE = 0x80000000

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_EFI_APPLICATION = 10

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_EFI_ROM = 13

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_NATIVE = 1

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_NATIVE_WINDOWS = 8

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_OS2_CUI = 5

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_POSIX_CUI = 7

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_UNKNOWN = 0

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_WINDOWS_CUI = 3

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_WINDOWS_GUI = 2

/// OptionalHeader64.Subsystem and OptionalHeader32.Subsystem values.
const IMAGE_SUBSYSTEM_XBOX = 14

impl COFFSymbol {
  /// FullName finds real name of symbol sym. Normally name is stored
  /// in sym.Name, but if it is longer then 8 characters, it is stored
  /// in COFF string table st instead.
  fn FullName(self: Ref<COFFSymbol>, st: StringTable) -> Result<string, error>
}

impl File {
  /// COFFSymbolReadSectionDefAux returns a blob of auxiliary information
  /// (including COMDAT info) for a section definition symbol. Here 'idx'
  /// is the index of a section symbol in the main [COFFSymbol] array for
  /// the File. Return value is a pointer to the appropriate aux symbol
  /// struct. For more info, see:
  /// 
  /// auxiliary symbols: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#auxiliary-symbol-records
  /// COMDAT sections: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#comdat-sections-object-only
  /// auxiliary info for section definitions: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#auxiliary-format-5-section-definitions
  fn COFFSymbolReadSectionDefAux(self: Ref<File>, idx: int) -> Result<Ref<COFFSymbolAuxFormat5>, error>

  /// Close closes the [File].
  /// If the [File] was created using [NewFile] directly instead of [Open],
  /// Close has no effect.
  #[allow(unused_result)]
  fn Close(self: Ref<File>) -> Result<(), error>

  fn DWARF(self: Ref<File>) -> Result<Ref<dwarf.Data>, error>

  /// ImportedLibraries returns the names of all libraries
  /// referred to by the binary f that are expected to be
  /// linked with the binary at dynamic link time.
  fn ImportedLibraries(self: Ref<File>) -> Result<Slice<string>, error>

  /// ImportedSymbols returns the names of all symbols
  /// referred to by the binary f that are expected to be
  /// satisfied by other libraries at dynamic load time.
  /// It does not return weak symbols.
  fn ImportedSymbols(self: Ref<File>) -> Result<Slice<string>, error>

  /// Section returns the first section with the given name, or nil if no such
  /// section exists.
  fn Section(self: Ref<File>, name: string) -> Option<Ref<Section>>
}

impl FormatError {
  fn Error(self: Ref<FormatError>) -> string
}

impl Section {
  /// Data reads and returns the contents of the PE section s.
  /// 
  /// If s.Offset is 0, the section has no contents,
  /// and Data will always return a non-nil error.
  fn Data(self: Ref<Section>) -> Result<Slice<uint8>, error>

  /// Open returns a new ReadSeeker reading the PE section s.
  /// 
  /// If s.Offset is 0, the section has no contents, and all calls
  /// to the returned reader will return a non-nil error.
  fn Open(self: Ref<Section>) -> io.ReadSeeker

  fn ReadAt(self, mut p: Slice<uint8>, off: int64) -> Partial<int, error>
}

impl StringTable {
  /// String extracts string from COFF string table st at offset start.
  fn String(self, start: uint32) -> Result<string, error>
}