typedef struct _IMAGE_RELOCATION {
union {
DWORD VirtualAddress;
DWORD RelocCount;
};
DWORD SymbolTableIndex;
WORD Type;
} IMAGE_RELOCATION;
typedef struct _IMAGE_SYMBOL {
union {
BYTE ShortName[8];
struct {
DWORD Short; // if 0, use LongName
DWORD Long; // offset into string table
} Name;
PBYTE LongName[2];
} N;
DWORD Value;
SHORT SectionNumber;
WORD Type;
BYTE StorageClass;
BYTE NumberOfAuxSymbols;
} IMAGE_SYMBOL;
附录B:
Microsoft (R) COFF Binary File Dumper Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
Dump of file hello1.obj
File Type: COFF OBJECT
FILE HEADER VALUES
14C machine (i386)
2 number of sections
48E5C543 time date stamp Fri Oct 03 15:09:55 2008
A6 file pointer to symbol table
E number of symbols
0 size of optional header
0 characteristics
SECTION HEADER #1
.text name
0 physical address
0 virtual address
2E size of raw data
64 file pointer to raw data
92 file pointer to relocation table
0 file pointer to line numbers
2 number of relocations
0 number of line numbers
60500020 flags
Code
16 byte align
Execute Read
RELOCATIONS #1
Symbol Symbol
Offset Type Applied To Index Name
-------- ---------------- ----------------- -------- ------
00000008 DIR32 00000000 C L3
0000000E REL32 00000000 B _puts
SECTION HEADER #2
.data name
2E physical address
0 virtual address
0 size of raw data
0 file pointer to raw data
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0500040 flags
Initialized Data
16 byte align
Read Write
.486
.model flat
extrn __fltused:near
extrn __ftol:near
public _main
_TEXT segment
_main:
push ebx
push esi
push edi
push ebp
mov ebp,esp
lea edi,(L3)
push edi
call _puts
add esp,4
mov eax,0
L2:
mov esp,ebp
pop ebp
pop edi
pop esi
pop ebx
ret
_TEXT ends
extrn _puts:near
_TEXT segment
_TEXT ends
_TEXT segment
align 1
L3 label byte
db 72
db 101
db 108
db 108
db 111
db 32
db 87
db 111
db 114
db 108
db 100
db 33
db 0
_TEXT ends
end