As title, what exactly does LOCAL do? This question come to my mind when i tried to do this:
I can see that there is an A at my DlgItem but XP just says that my program has made some kind of error :/
Then i started to think about what LOCAL do...
so... anyone? :tongue:
LOCAL output[64]
....
push ecx
lea ecx,output
mov byte ptr[ecx],65
invoke SetDlgItemText,hwnd,1005,addr output
pop ecx
I can see that there is an A at my DlgItem but XP just says that my program has made some kind of error :/
Then i started to think about what LOCAL do...
so... anyone? :tongue:
LOCAL reserves a certain number of bytes on the stack and assigns it a label based on it's offset from EBP. For example :
myproc PROC
LOCAL var :DWORD
would reserve 4 bytes (DWORD) on the stack
myproc PROC
LOCAL var :DWORD
would reserve 4 bytes (DWORD) on the stack
Okey i understand :)
bj,
Also, the variables you use (on the stack) contain garbage when you enter a procedure.
Also, the variables you use (on the stack) contain garbage when you enter a procedure.
Hum, i still can't fix this problem.
I am sure that A is displayed on my item on my dialog, and then XP shows that my program have made a error and close my program.
No really error message are shown so i dont can figure out what where the problem is :(
I am sure that A is displayed on my item on my dialog, and then XP shows that my program have made a error and close my program.
No really error message are shown so i dont can figure out what where the problem is :(
Try replacing with
mov word ptr,65
mov word ptr,65
Still not working :(
Still not working :(
have you tried running your code through a debugger/commenting out lines/otherwise trying to determine which line your code is breaking on? also, due to your indentation, are you trying to access something off the stack from a different procedure? i'm not whether that will work or not, not having MASM installed at the moment (i really should start win32asming again).
Hum i works when i commenting out this line:
invoke SetDlgItemText,hwnd,1005,addr output
invoke SetDlgItemText,hwnd,1005,addr output
Hum this is strange, looks like SetDlgItemText messing up some other registers so when i put pusha before and popa after it works
What registers are you referring to? It is normal for api to mess up eax, edx and ecx.
I'm using all of them
So i should always save eax,edx,ecx before calling any API when i'm using these register in my code?
So i should always save eax,edx,ecx before calling any API when i'm using these register in my code?
If you require their values to be preserved. Generally if I do not want the values to be changed by any api calls I place them in ebx, edi or esi, since their values will not be modified by an api. When I am kind of short on registers, then I would use push/pushad/pop/popad to preserve the values in the register