flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Is this a bug? "sizeof"?

Author
Thread Post new topic Reply to topic
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
Code:
format PE GUI
entry start

section '.code' code readable executable

  start:
        mov eax,sizeof.buffer
        push 0 0 0 0
        Call [MessageBox]
        push    0
        call    [ExitProcess]

section '.data' data readable writeable
  buffer   db 1024 DUP(?)
section '.idata' import data readable writeable

  dd 0,0,0,RVA kernel_name,RVA kernel_table
  dd 0,0,0,RVA user_name,RVA user_table
  dd 0,0,0,0,0

  kernel_table:
    ExitProcess dd RVA _ExitProcess
    dd 0
  user_table:
    MessageBox dd RVA _MessageBoxA
    dd 0

  kernel_name db 'KERNEL32.DLL',0
  user_name db 'USER32.DLL',0

  _ExitProcess dw 0
    db 'ExitProcess',0
  _MessageBoxA dw 0
    db 'MessageBoxA',0
            


mov eax,sizeof.buffer - undefined symbol
As I remember, in old version this work normal. Or now it must be in another way?
Post 09 Feb 2006, 12:53
View user's profile Send private message Reply with quote
Ivan2k2



Joined: 08 Sep 2004
Posts: 80
Location: Russia, Angarsk
Ivan2k2
if i not mistake, 'sizeof' works with structures
Post 09 Feb 2006, 13:25
View user's profile Send private message ICQ Number Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body
and what I must use instead "sizeof" ?
Is there another directive?
Post 09 Feb 2006, 13:48
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1608
Location: Ukraine
shoorick
BUFFSIZE = 1024 (or BUFFSIZE equ 1024)
...
mov ecx,BUFFSIZE
...
buffer db BUFFSIZE DUP(?)
Post 09 Feb 2006, 14:01
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7797
Location: Kraków, Poland
Tomasz Grysztar
Code:
struc db [data]
{ common . db data
  sizeof.#. = $ - . }    

Wink
Post 09 Feb 2006, 14:43
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. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.