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?
Posted on 2003-03-01 11:51:42 by alonso
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.
Posted on 2003-03-01 17:53:00 by Odyssey
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
Posted on 2003-03-01 22:31:38 by Joshua
"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"?
Posted on 2003-03-02 04:00:17 by Tomasz Grysztar