;One of these nights, I thought, I had digested the "Basics" of programming.
;Obviously I have not.
;Why this proc doesn't correctly return ? Please tell me !
;Hier is the example
include \masm32\include\masm32rt.inc
The_Test_Proc PROTO :DWORD
;-----
show_value MACRO arg1,arg2
LOCAL ws_msg,showint
.data
ws_msg TCHAR 60 dup(?),0
showint TCHAR 'Wert: %lu',0
.code
pushad
INVOKE wsprintf,addr ws_msg,addr showint,arg1
INVOKE MessageBox,0,addr ws_msg,reparg(arg2),0
popad
ENDM
;-----
.data
testvar db"12345",0
testvar2 db"123456789",0
testvar3 db"123456789123456789",0
.code
start:
mov eax,len(addr testvar)
show_value eax,"Len testvar1" ;correct !
INVOKE The_Test_Proc,addr testvar
mov eax,len(addr testvar2)
show_value eax,"Len testvar2" ;correct !
INVOKE The_Test_Proc,addr testvar2
mov eax,len(addr testvar3)
show_value eax,"Len testvar3" ;correct !
INVOKE The_Test_Proc,addr testvar3
INVOKE ExitProcess,0
;=====The Test Proc
The_Test_Proc proc arg
mov eax,len(addr arg)
show_value eax,"Len input" ;not correct !
ret
The_Test_Proc endp
;=====
end start
In the following code.
;=====The Test Proc
The_Test_Proc proc arg
mov eax,len(addr arg)
show_value eax,"Len input" ;not correct !
ret
The_Test_Proc endp
You are getting the address of an address. Its usually referred to as multiple levels of indirection.
>>> ,addr testvar3 is passed to "The_Test_Proc" as arg then you get the address of the data that is passed.
In "The_Test_Proc" you should use "len(arg)".
yes hutch,
thank you.
How stupid of me ...