We've seen this example before.
Note: These are used in conjunction with movsb.
.data
buffer db "Hello There!",0
bufferlen equ $-buffer
.code
mov esi,offset buffer ; 12 characters + 0
mov ecx,bufferlen ; so 'equ 13'now right?
But my question is how can this be done if we are using undeclared data?
.data
buffer db "Hello There!",0
bufferlen equ $-buffer
.data?
buffer2 db 256 dup (?) ;So large, just
bufferlen2 equ $-buffer ;incase more or less
;data.
.code
invoke lstrcpy, addr buffer2, addr buffer
mov esi,offset buffer2 ;now this contains 256
mov ecx,bufferlen2 ;minus "Hello There"
So now buffer2 contains our original string
"Hello There!". Here is the problem. I need to find a way so that my program can count the data in buffer2 and then make it so bufferlen2 is equal to it. Because right now bufferlen2 has 12 (not sure if term null is included, if so 13) characters, plus 243 undeclaired spaces right? And this causes a major problem for my program. I am writing data to another file, and more data is written than is needed. Thus overwriting data further in the file.
All help is appreciated :)
Thanks,
Nokturnal
Note: These are used in conjunction with movsb.
.data
buffer db "Hello There!",0
bufferlen equ $-buffer
.code
mov esi,offset buffer ; 12 characters + 0
mov ecx,bufferlen ; so 'equ 13'now right?
But my question is how can this be done if we are using undeclared data?
.data
buffer db "Hello There!",0
bufferlen equ $-buffer
.data?
buffer2 db 256 dup (?) ;So large, just
bufferlen2 equ $-buffer ;incase more or less
;data.
.code
invoke lstrcpy, addr buffer2, addr buffer
mov esi,offset buffer2 ;now this contains 256
mov ecx,bufferlen2 ;minus "Hello There"
So now buffer2 contains our original string
"Hello There!". Here is the problem. I need to find a way so that my program can count the data in buffer2 and then make it so bufferlen2 is equal to it. Because right now bufferlen2 has 12 (not sure if term null is included, if so 13) characters, plus 243 undeclaired spaces right? And this causes a major problem for my program. I am writing data to another file, and more data is written than is needed. Thus overwriting data further in the file.
All help is appreciated :)
Thanks,
Nokturnal
the first string can be calulated at compile time (for want of a better phrase) because it's length is known.
you can't do it then if you don't know what the string length is. You'll have to use
invoke strlen,addr <string>
then eax contains the length.
umbongo
you can't do it then if you don't know what the string length is. You'll have to use
invoke strlen,addr <string>
then eax contains the length.
umbongo
Works great Umbongo!:)
Never needed to use it before, so I didn't know what it was or how to use it.:cool:
Thanks Man!:alright:
Nok.:grin:
:stupid:
Never needed to use it before, so I didn't know what it was or how to use it.:cool:
Thanks Man!:alright:
Nok.:grin:
:stupid:
Hi nok
sorry for not mailing you.
since i use 1 hd for internet and 1 for coding im a bit lazy to go online.most time i learn coding and only go online to post a stupid question :)
i have not forget you and i work on a tutorial for you on how to change icon in exe files ,its not so easy for me to because english is not my home language so i use some grafics to show what im doing.
i mail it to you soon :)
cu
sorry for not mailing you.
since i use 1 hd for internet and 1 for coding im a bit lazy to go online.most time i learn coding and only go online to post a stupid question :)
i have not forget you and i work on a tutorial for you on how to change icon in exe files ,its not so easy for me to because english is not my home language so i use some grafics to show what im doing.
i mail it to you soon :)
cu