Author Topic: Minor change in StrMidA  (Read 827 times)

HSE

  • Member
  • ****
  • Posts: 553
  • <AMD>< 7-32>
Minor change in StrMidA
« 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:
Code: [Select]
    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:)
« Last Edit: October 02, 2016, 07:03:27 AM by HSE »

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 126
  • ObjAsm32
    • ObjAsm32
Re: Minor change in StrMidA
« Reply #1 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

jj2007

  • Member
  • *****
  • Posts: 7757
  • Assembler is fun ;-)
    • MasmBasic
Re: Minor change in StrMidA
« Reply #2 on: December 28, 2016, 12:14:29 PM »
Code: [Select]
m2z BYTE ptr [edx]                                  ;Set ZTC
Can you explain what this line does? Just curious.

HSE

  • Member
  • ****
  • Posts: 553
  • <AMD>< 7-32>
Re: Minor change in StrMidA
« Reply #3 on: December 28, 2016, 12:24:19 PM »
Code: [Select]
mov byte ptr [edx], 0
If function fail return a null string.

HSE

  • Member
  • ****
  • Posts: 553
  • <AMD>< 7-32>
Re: Minor change in StrMidA
« Reply #4 on: December 29, 2016, 05:35:47 AM »
Hi Biterider

StrMidA working prefectly. Thanks  :t