The MASM Forum

Projects => ObjAsm => Topic started by: HSE on September 28, 2016, 06:35:08 AM

Title: Minor change in StrMidA
Post by: HSE on September 28, 2016, 06:35:08 AM
Hi Biterider!

I have some problems extracting only 1 byte string. With a minor change apparently is working well:    invoke StrLengthA, [esp + 8]
; Agregated         
    inc eax     ; 27/09/16
    mov ecx, eax
; Replaced
    ;inc ecx     ; 27/09/16


Regards

LATER: not solved at all. But MASM32 szMid make the job until I understand the function (forever?  :biggrin:)
Title: Re: Minor change in StrMidA
Post by: Biterider on December 28, 2016, 08:50:45 AM
Hi HSE
Sorry for the delay, but I was a bit busy. I found a problem when the starting character was the last in the source string. Due to a wrang comparison, the function was aborted returning zero.
Attached the corrected version of the ANSI and the wide string functions. BTW, when the function returns, eax contains the number of chars copied.

Biterider
Title: Re: Minor change in StrMidA
Post by: jj2007 on December 28, 2016, 12:14:29 PM
m2z BYTE ptr [edx]                                  ;Set ZTC

Can you explain what this line does? Just curious.
Title: Re: Minor change in StrMidA
Post by: HSE on December 28, 2016, 12:24:19 PM
mov byte ptr [edx], 0

If function fail return a null string.
Title: Re: Minor change in StrMidA
Post by: HSE on December 29, 2016, 05:35:47 AM
Hi Biterider

StrMidA working prefectly. Thanks  :t