Hi, to every body.
Can some one please tell me how can I call Proc in FASM, I create the following code to search for text in a string:
proc FindString,DataAddress,DataSize,VarToCompare
enter
push ebx esi edi
mov ecx,
mov edi,
mov al,byte
cld
repne scasb
cmp ecx,0
; jne FSContinue
invoke MessageBox,HWND_DESKTOP,No_found,NULL,NULL
pop edi esi ebx
return
When I call this proc like this:
stdcall FindString,,10,_asm_extension
It says that the program has perform an illigal operation and it will shut down
If I use:
invoke FindString,,10,[_asm_extension]
I get an Invalid Size of Operand on compile time and If I use call I get an Extra characters on line
So what command should I use?
Can some one please tell me how can I call Proc in FASM, I create the following code to search for text in a string:
proc FindString,DataAddress,DataSize,VarToCompare
enter
push ebx esi edi
mov ecx,
mov edi,
mov al,byte
cld
repne scasb
cmp ecx,0
; jne FSContinue
invoke MessageBox,HWND_DESKTOP,No_found,NULL,NULL
pop edi esi ebx
return
When I call this proc like this:
stdcall FindString,,10,_asm_extension
It says that the program has perform an illigal operation and it will shut down
If I use:
invoke FindString,,10,[_asm_extension]
I get an Invalid Size of Operand on compile time and If I use call I get an Extra characters on line
So what command should I use?
You could try inserting an std instruction after the repne scasb line or removing the cld instruction because the Direction Flag should be clear by default I think.
your stack is inbalanced, if you use enter, you also need to use leave
ex:
proc FindString,DataAddress,DataSize,VarToCompare
enter
push ebx esi edi
mov ecx,
mov edi,
mov al,byte
cld
repne scasb
cmp ecx,0
; jne FSContinue
invoke MessageBox,HWND_DESKTOP,No_found,NULL,NULL
pop edi esi ebx
leave ; <-------- Don't forget this
return
ex:
proc FindString,DataAddress,DataSize,VarToCompare
enter
push ebx esi edi
mov ecx,
mov edi,
mov al,byte
cld
repne scasb
cmp ecx,0
; jne FSContinue
invoke MessageBox,HWND_DESKTOP,No_found,NULL,NULL
pop edi esi ebx
leave ; <-------- Don't forget this
return
"return" macro already includes the "leave" instruction.
alonso: "stdcall" should be used in this case. But you have posted not enough info about your code. What's in ecx? If it contains the address to your text, shouldn't it be "stdcall FindString,ecx,10,_asm_extension"?
alonso: "stdcall" should be used in this case. But you have posted not enough info about your code. What's in ecx? If it contains the address to your text, shouldn't it be "stdcall FindString,ecx,10,_asm_extension"?