Hi does, Masm32 have a strcmp function like C's, I don't seem to see any, I wonder if anyone might want to share one with me, I'd really appreciate it. It just seem's like such a needed item
there must be a real good one already out there. That I don't know about

Thanks
Andy
Posted on 2001-12-29 20:40:56 by andy981
Was it this I was looking for

invoke lstrcmp,ebx,

I just guessed, I'll see if it works


:stupid:
Posted on 2001-12-29 20:47:38 by andy981
Just a few functions you might find useful. These aren't mine. I would credit the author if I remembered where I got these from...



Cut PROTO :DWORD,:DWORD,:DWORD,:BYTE ;Cut off end of string
StrLen PROTO :DWORD ;Find length of string
StrCmp PROTO :DWORD,:DWORD ;Compare two strings
StrCpy PROTO :DWORD,:DWORD ;Copy a string
StrCat PROTO :DWORD,:DWORD ;String1+=String2

Cut PROC SRC:DWORD,DST:DWORD,OS:DWORD,EC:BYTE
mov eax,OS
add SRC,eax
mov al,EC
mov ecx,-1
mov edi,SRC
repnz scasb
not ecx
dec ecx
.IF ecx>1010 ;Buffer overflow: Truncate (414)
mov ecx,1020
.ENDIF
mov esi,SRC
mov edi,DST
rep movsb
mov BYTE PTR[edi],0
ret
Cut ENDP

StrLen PROC SRC:DWORD
mov ecx,-1
mov edi,SRC
mov al,0
repnz scasb
mov eax,ecx
not eax
dec eax
ret
StrLen ENDP

StrCpy proc SRC:LPSTR,DST:LPSTR
INVOKE StrLen,SRC
add eax,2
mov ecx,eax
mov esi,SRC
mov edi,DST
rep movsb
ret
StrCpy endp

StrCat proc S1:DWORD,S2:DWORD
INVOKE StrLen,S2
add eax,2
push eax
INVOKE StrLen,S1
mov edi,S1
add edi,eax
mov esi,S2
pop ecx
rep movsb
ret
StrCat endp

StrCmp PROC SRC:DWORD,DST:DWORD
INVOKE StrLen,SRC
inc eax
mov ecx,eax
mov esi,SRC
mov edi,DST
repz cmpsb
mov eax,1
jnz Next ;zf set or not from repz
dec eax
Next:
ret
StrCmp endp


Torch
Posted on 2001-12-29 22:46:41 by Torch
Those String Functions are pretty
cool,
Have you used them?
How do you access them?,
I would just call them I guess

push par2
push par1
call strfunction

Do you use a better way?

Thanks for the Cool String Functions
Andy!



:)
Posted on 2001-12-29 23:13:54 by andy981
You can use Invoke

Invoke Strcmp, String1, Sting2

I like that way better than the push stuff :)
Posted on 2001-12-30 00:32:24 by Torch