Sorry? my english very bad
I create programs with my stub
format PE GUI 4.0 on 'stub.exe'
entry start
include 'C:\Downloads\fasmw164\INCLUDE\win32ax.inc'
section '.code' code readable executable
start:
inc eax
inc eax
call [ExitProcess]
section '.idata' import data readable writeable
dd 0,0,0,RVA kernel_name,RVA kernel_table
dd 0,0,0,0,0
kernel_table:
ExitProcess dd RVA _ExitProcess
dd 0
kernel_name db 'KERNEL32.DLL',0
_ExitProcess dw 0
db 'ExitProcess',0
_MessageBoxA dw 0
db 'MessageBoxA',0
And stub
format MZ
segment new use16
mov ax,cs
mov ds,ax
mov dx,mes
mov ah,9
int 21h
mov ax,4c01h
int 21h
mes db 'Hello from stub!',0dh,0ah,'$'
mov bx,new
mov ax,new
mov bx,new
mov ax,new
mov ax,new
mov ax,new
mov bx,new
inc ax
I get result, stub incorrect aligning and rewrite last elements table of relocations
00000000 4D 5A 90 00 01 00 07 00 05 00 00 01 FF FF 04 00 MZ?.........yy..
^(count relocation 7)
00000010 00 10 00 00 00 00 00 00 40 00 00 00 00 00 00 00 ........@.......
^(offset of table of relocations 40h)
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000030 00 00 00 00 00 00 00 00 00 00 00 00 90 00 00 00 ............?...
00000040 24 00 00 00 27 00 00 00 2A 00 00 00 2D 00 00 00 $...'...*...-...
^(only 4 elements)
00000050 8C C8 8E D8 BA 10 00 B4 09 CD 21 B8 01 4C CD 21 ?EZO?..?.I!?.LI!
^now code of stub