This repository has been archived by the owner on Jun 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
elfinfo.exw
63 lines (55 loc) · 2.02 KB
/
elfinfo.exw
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
-- Òåñòîâàÿ ïðîãðàììà äëÿ ïðîâåðêè ïðàâèëüíîñòè ðàáîòû ôóíêöèé ìîäóëÿ elf.e
include std/pretty.e
include std/search.e
include std/console.e
include elf.e
include patcher.e
atom fn = open("d:\\Games\\df_linux\\libs\\Dwarf_Fortress","rb")
if fn<0 then
puts(1,"File not found.\n")
any_key()
abort(1)
end if
constant header = check_header(fn)
seek(fn,header)
puts(1, "e_ident:\n")
printf(1, " EI_MAG: #%x, \"%s\"\n",{getc(fn),get_bytes(fn,3)})
printf(1, " EI_CLASS: %d-bit objects\n", 32*getc(fn))
constant byte_order = {"least significant byte first", "most significant byte first"}
printf(1, " EI_DATA: %s\n",{byte_order[getc(fn)]})
printf(1, " EI_VERSION: %d\n", getc(fn))
puts(1, "Padding bytes:\n")
? get_bytes(fn,9)
puts(1, '\n')
constant e_types = {"ET_NONE","ET_REL","ET_EXEC","ET_DYN","ET_CORE"}
printf(1, "e_type: %s\n", {e_types[get_integer16(fn)+1]})
constant e_machines = {
"None",
"AT&T WE 32100",
"SPARC",
"Intel 80386",
"Motorola 68000",
"Motorola 88000",
"Intel 80860",
"MIPS RS3000"
}
printf(1, "e_machine: %s\n", {e_machines[get_integer16(fn)+1]})
constant e_versions = {"None","Current"}
printf(1, "e_version: %s\n", {e_versions[get_integer32(fn)+1]})
printf(1, "e_entry: #%x\n", get_integer32(fn))
printf(1, "e_phoff: #%x\n", get_integer32(fn))
printf(1, "e_shoff: #%x\n", get_integer32(fn))
printf(1, "e_flags: #%x\n", get_integer32(fn))
printf(1, "e_ehsize: #%x\n", get_integer16(fn))
printf(1, "e_phentsize: #%x\n", get_integer16(fn))
printf(1, "e_phnum: #%x\n", get_integer16(fn))
printf(1, "e_shentsize: #%x\n", get_integer16(fn))
printf(1, "e_shnum: #%x\n", get_integer16(fn))
printf(1, "e_shstrndx: #%x\n", get_integer16(fn))
puts(1,'\n')
sequence sections = get_section_table(fn)
puts(1," Name Type Flags Address Offset Size Link Info Align Ent. size\n")
for i = 1 to length(sections) do
printf(1,"%-18s %08x %08x %08x %08x %08x %08x %08x %08x %08x\n", sections[i])
end for
wait_key()