PROWAREtech
x86 Assembly: wcslen Procedure
Find wide-char string length.
Use MASM for Visual C++ Express Edition 2005 to compile this procedure.
This procedure, wcslen_asm
, returns the length of a wchar_t
string.
TITLE 'extern "C" unsigned wcslen_asm(const wchar_t *string);'
.386P
.model FLAT
PUBLIC _wcslen_asm
_TEXT SEGMENT
_wcslen_asm PROC NEAR
push edi
mov edi, DWORD PTR [esp+8] ; string
mov ecx, 0FFFFFFFFh
xor eax, eax
cld
repne scasw
xor ecx, 0FFFFFFFFh
dec ecx
mov eax, ecx
pop edi
ret 0
_wcslen_asm ENDP
_TEXT ENDS
END
Comment