flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Bug with stub?

Author
Thread Post new topic Reply to topic
Ditrih



Joined: 03 Dec 2005
Posts: 3
Location: Russia
Ditrih
Sorry? my english very bad
I create programs with my stub
Code:
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
Code:
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
Code:
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
    
Post 08 Dec 2005, 20:14
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7715
Location: Kraków, Poland
Tomasz Grysztar
Thank you for the report. I uploaded the fixed 1.64 version to the website (still too lazy to change the version number Wink).
Post 08 Dec 2005, 21:21
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.