Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String_Add proc stri:STRING, chars:LPSTR
- push ebx
- push ecx
- push edx
- mov ecx, stri
- invoke GetCharLength, chars
- ASSUME ecx:PTR STRINGS
- mov edx, [ecx].len
- add edx, eax
- mov ebx, [ecx].max
- push edx
- cmp ebx, edx
- jg String_Add_Update
- String_Add_continue:
- xor edx, edx
- mov eax, ebx
- mul ebx
- mov ebx, eax
- mov edx, [ecx].chars
- ASSUME ecx:NOTHING
- push ecx
- invoke GetProcessHeap
- invoke HeapReAlloc, eax, HEAP_ZERO_MEMORY, edx, ebx
- pop ecx
- invoke PrintNumber, eax
- ASSUME ecx:PTR STRINGS
- cmp eax, NULL
- je String_Add_fail
- invoke PrintChars, eax
- mov [ecx].chars, eax
- mov [ecx].max, ebx
- pop edx
- cmp ebx, edx
- push edx
- jle String_Add_continue
- String_Add_Update:
- pop edx
- mov [ecx].len, edx
- mov edx, [ecx].chars
- ASSUME ecx:NOTHING
- invoke PrintChars, edx
- xor ebx, ebx
- mov ecx, chars
- cmp [edx], bl
- je String_Add_Loop_Begin
- String_Add_MovePtr:
- inc edx
- cmp [edx], bl
- jne String_Add_MovePtr
- String_Add_Loop_Begin:
- cmp [ecx], bl
- je String_Add_Sucess
- String_Add_Loop:
- mov al, [ecx]
- mov [edx], al
- inc ecx
- inc edx
- cmp [ecx], bl
- jne String_Add_Loop
- String_Add_Sucess:
- mov eax, ecx
- sub eax, chars
- jmp String_Add_done
- String_Add_fail:
- xor eax, eax
- String_Add_done:
- pop edx
- pop ecx
- pop ebx
- ret
- String_Add endp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement