flat assembler
Message board for the users of flat assembler.

Index > Main > sizeof

Author
Thread Post new topic Reply to topic
shaolin007



Joined: 03 Sep 2004
Posts: 65
shaolin007
is there one in FASM like the C language?
Post 01 Jun 2005, 18:14
View user's profile Send private message Reply with quote
Barf



Joined: 17 Sep 2004
Posts: 34
Location: Poland
Barf
try to check in winapi documentation. If you haven`t it mail me: barf@o2.pl, i will send it you. I won`t post it here because it has 10MB.
Post 01 Jun 2005, 18:48
View user's profile Send private message Reply with quote
shaolin007



Joined: 03 Sep 2004
Posts: 65
shaolin007
Sorry, I meant is there a way to calculate the size of a structure like

Code:
sizeof(my_struct)
    


in FASM like in the C language?
Post 01 Jun 2005, 19:05
View user's profile Send private message Reply with quote
Torrey



Joined: 12 Oct 2003
Posts: 78
Torrey
Sometimes I do this:

Code:
struc my_struct
{
   .variable1 dd ?
   .variable2 dd ?
   .variable3 dd ?
   .variable4 dd ?
   .variable5 dd ?
   .size        = $-.variable1
}    
Post 01 Jun 2005, 19:14
View user's profile Send private message Visit poster's website Reply with quote
shaolin007



Joined: 03 Sep 2004
Posts: 65
shaolin007
Torrey wrote:
Sometimes I do this:

Code:
struc my_struct
{
   .variable1 dd ?
   .variable2 dd ?
   .variable3 dd ?
   .variable4 dd ?
   .variable5 dd ?
   .size        = $-.variable1
}    


So would this calculate the complete size of my_struct variable1-5?
Post 01 Jun 2005, 19:27
View user's profile Send private message Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
yes Smile
You can also declare structures this way:
Code:
struct my_struct
   .variable1 dd ?
   .variable2 dd ?
   .variable3 dd ?
   .variable4 dd ?
   .variable5 dd ?
ends    

This will automatically define sizeof.my_struct that will contain structure's size. You have to include standard macro library (win32a.inc) of course.
Post 01 Jun 2005, 19:43
View user's profile Send private message Visit poster's website Reply with quote
shaolin007



Joined: 03 Sep 2004
Posts: 65
shaolin007
decard wrote:
yes Smile
You can also declare structures this way:
Code:
struct my_struct
   .variable1 dd ?
   .variable2 dd ?
   .variable3 dd ?
   .variable4 dd ?
   .variable5 dd ?
ends    

This will automatically define sizeof.my_struct that will contain structure's size. You have to include standard macro library (win32a.inc) of course.



Ok so I can lets say
Code:
mov [wndclass.cbsize], sizeof.wndclass
    


then?
Post 01 Jun 2005, 20:26
View user's profile Send private message Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
yes Smile
Post 01 Jun 2005, 21:12
View user's profile Send private message Visit poster's website Reply with quote
shaolin007



Joined: 03 Sep 2004
Posts: 65
shaolin007
Hmmm it didn't work and I have the win32a.inc included. Any suggestions?
Post 01 Jun 2005, 23:28
View user's profile Send private message Reply with quote
beppe85



Joined: 23 Oct 2004
Posts: 181
beppe85
What fasm returns to you(error description)?
Post 02 Jun 2005, 03:10
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
The structure names are defined in upper case:

Code:
wndclass WNDCLASS
mov [wndclass.cbsize], sizeof.WNDCLASS
    
Post 02 Jun 2005, 03:48
View user's profile Send private message Visit poster's website Reply with quote
veach1



Joined: 16 Jul 2004
Posts: 165
veach1
And what about "sizeof" not for structures but for variables?
Post 02 Jun 2005, 06:23
View user's profile Send private message Reply with quote
shaolin007



Joined: 03 Sep 2004
Posts: 65
shaolin007
revolution wrote:
The structure names are defined in upper case:

Code:
wndclass WNDCLASS
mov [wndclass.cbsize], sizeof.WNDCLASS
    


Thankyou very much that worked.
Post 02 Jun 2005, 12:13
View user's profile Send private message 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.