Do any one know what masm do when you use the word lenghtof.

I mean do it call an Window API to do it or do it has it's own Low Level strlen like Hutch in M32.LIB.

mov esi, Buffer1
mov edi, Buffer2
cmp lengthof Buffer1
Posted on 2002-02-27 18:46:02 by cmax
E.G.:

arr DD 20 DUP(0) is an array of 20 DWORD's, when you say SIZEOF arr, you'll get a value 20*4 or 80 in this case, actually SIZEOF is LENGTHOF * TYPE meaning LENGTHOF is just the number of arrays. TYPE can be a byte(1), word(2), dword(4)...


in essence, LENGTHOF is the number of elements in an array. :)


value DD 1, 2, 3, 4, 5, 6 has 6 elements.
Posted on 2002-02-27 18:51:51 by stryker
I got everything listed with actual size but it got confuing.

So before i just start changing everything to the word lenghtof i need to now that the API had nothing to do with it.
This is good to know.

Thanks umberg6007
Posted on 2002-02-27 19:20:26 by cmax
What's the value of LENGTHOF value if the value is
value DD 1, 2, 3, 4, 5, 6
       DD 7, 8, 9, 10, 11, 12

valueNum equ $ - value can get the value 2 ?
Posted on 2003-01-13 13:50:38 by yoursguideline
Thank to sluggy and f0dder for encourrgeing me to not take the easy way out as i was planing to do to cover it all up somehow...or re-during the whole thing...
That's okay, just remember that Real Men (tm) never take the easy way way out of a problem :grin:

Actually, in my experience 95% of all bugs are usually something small, but that doesn't mean they are easy to find. One of the great things about using ASM is that it teaches you to be careful the first time you code something, simply because it can be quite painful trying to find bugs.
Posted on 2003-01-13 15:59:36 by sluggy
OK, i get the answer
LENGTHOF value = 6
SIZEOF value = 24
valueNum = 48
Posted on 2003-01-14 01:33:22 by yoursguideline
You are absolutely right sluggy .

It also teaches you to keep your mouth shut sometimes because we find trouble than blame EVERYBODY in the world (MS$) before we find the bug in our OWN CODING.... That's the best lesson of all i am beginning to learn.
Posted on 2003-01-14 01:55:42 by cmax
You must know that LENGTHOF and SIZEOF only works for arrays with a size that is known at assembly time.


Do any one know what masm do when you use the word lenghtof.

I mean do it call an Window API to do it or do it has it's own Low Level strlen like Hutch in M32.LIB.

mov esi, Buffer1
mov edi, Buffer2
cmp lengthof Buffer1
Posted on 2003-01-14 03:47:48 by gliptic