1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
.686p
.model flat, stdcall
option casemap: none
include windows.inc
include kernel32.inc
.code
start:
ReverseString PROC uses edi esi, pString:DWORD, StringSize:DWORD
LOCAL buff:DWORD
mov esi, pString
invoke VirtualAlloc, NULL, StringSize, MEM_COMMIT, PAGE_READWRITE
mov buff, eax
mov ecx, StringSize
mov edi, eax
dec ecx
add esi, ecx
dec esi
boucle:
movzx eax, byte ptr[esi]
dec esi
mov byte ptr[edi], al
inc edi
dec ecx
jnz boucle
cld
mov esi, buff
mov edi, pString
mov ecx, StringSize
rep movsb
invoke VirtualFree, buff, 0, MEM_RELEASE
mov eax, pString
ret
ReverseString endp
end start |
Partager