PE文件格式(3)
2007-01-14 20:15:00 来源:WEB开发网核心提示: #defineSTD_OUTPUT_HANDLE-11UL#definehello"hello,world"__declspec(dllimport)unsignedlong__stdcallGetStdHandle(unsignedlonghdl);__declspe
#defineSTD_OUTPUT_HANDLE-11UL
#definehello"hello,world
"
__declspec(dllimport)unsignedlong__stdcall
GetStdHandle(unsignedlonghdl);
__declspec(dllimport)unsignedlong__stdcall
WriteConsoleA(unsignedlonghConsoleOutput,
constvoid*buffer,
unsignedlongchrs,
unsignedlong*written,
unsignedlongunused
);
staticunsignedlongwritten;
voidstartup(void)
{
WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE),hello,sizeof(hello)-1,&written,0);
return;
}
汇编语言
startup:
;参数WriteConsole(),逆向
6A00 push 0x00000000
68???????? push offset_written
6A0D push 0x0000000d
68???????? push offsethello
;参数GetStdHandle()
6AF5 push 0xfffffff5
2EFF15???????? call dwordptrcs:__imp__GetStdHandle@4
;resultislastparameterforWriteConsole()
50 push eax
2EFF15???????? call dwordptrcs:__imp__WriteConsoleA@20
C3 ret
hello:
68656C6C6F2C20776F726C640A "hello,world
"
_written:
00000000
下面是链接器:
更多精彩
赞助商链接