News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

szCatStr

Started by brethren, February 21, 2011, 04:38:12 PM

Previous topic - Next topic

brethren

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    .486
    .model flat, stdcall
    option casemap :none

    szLen PROTO :DWORD

    .code

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE

align 16

szCatStr proc lpszSource:DWORD, lpszAdd:DWORD

    push edi

    invoke szLen,[esp+8]            ; get source length
    mov edi, [esp+8]
    mov ecx, [esp+12]
    add edi, eax                    ; set write starting position
    xor edx, edx                    ; zero index

  @@:
    movzx eax, BYTE PTR [ecx+edx]   ; write append string to end of source
    mov [edi+edx], al
    add edx, 1
    test eax, eax                   ; exit when terminator is written
    jne @B

    pop edi

    mov eax, [esp+8]                ; return start address of source

    ret 8

szCatStr endp

OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end


thats the source code for the szCatStr procedure. as you can see by the final comment it should be returning the address of the source string in eax

it actually returns the address of the string concatenated to lpszSource, ie lpszAdd

btw this obviously impacts the add$ macro as well

Quote 
    ;placing the pop after the mov eax should fix it
    mov eax, [esp+8]                ; return start address of source
    pop edi

    ret 8

szCatStr endp

dedndave

    pop edi

    mov eax, [esp+8]                ; return start address of source


you could either swap the order of these 2 instructions or make it esp+4

i believe this has been dealt with previously
http://www.masm32.com/board/index.php?topic=11438.0

brethren

thanks for the link, dave. i must of missed it first time round

btw is there a list of bug fixes or updated files?

dedndave

i wish there was - lol
there are several little updates like this one, additions to windows.inc, QE and ProStart updates, etc
i have been waiting for Hutch to release the next version of the masm32 package, which should include everything to date
otherwise, we are left to sift through the masm32 project subforum if we have to reinstall