program pe;
{$APPTYPE CONSOLE}
uses
SysUtils,windows;
type
PImageImportDescriptor = ^TImageImportDescriptor;
TImageImportDescriptor = packed record
originalFirstThunk: DWord;
TimeDateStamp : DWord;
ForwarderChain : DWord;
DLLName : DWord;
FirstThunk : DWord;
end;
PImageThunkData=^TImageThunkData;
TImageThunkData = record
case integer of
1:( ForwarderString : DWord; );
2:( Function_ : DWord; );
3:( ordinal : DWord; );
4:( AddressOfData : DWord; );
end;
var
DosHeader: pIMAGEDOSHEADER;
ntheader:pimagentheaders;
optheader: pimageoptionalheader;
importdesc:pimageimportdescriptor;
vra:longint;
hmod:longint;
sectionnum:integer;
begin
hmod:=GetModuleHandle(NiL);
writeln(format('exe-imagebase:%8X',[hmod]));
dosheader:=pimagedosheader(hmod);
writeln(format('dos-header:%8p',[dosheader]));
ntheader:=pimagentheaders(hmod+dosheader^._lfanew) ;
writeln(format('nt-header:%8p',[ntheader]));
optheader:=pimageoptionalheader(dword(ntheader)+24);
writeln(format('opt-header:%8p',[optheader]));
vra:=OptHeader^.DataDirectory[1].VirtualAddress ;
writeln(format('import-vra-adress:%8x',[vra]));
importdesc:=pimageimportdescriptor(byte(hmod)+vra);
writeln(format('import-first-desc-adress:%8p',[importdesc]));
sectionnum:=ntheader^.FileHeader.NumberOfSections ;
writeln(format('sections:%8d',[sectionnum]));
end.
帖子浏览
|
用户名:学生 用户ID:110 用户级别:9名动江湖 注册时间:2008-09-17 论坛分数:18860 |
继续标记
|
本主题讨论树
- 标记一下 (64字) 【学生】 2010-10-08 06:53 阅读:11
回复本帖
请先 登录,再回复本帖。