News:

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

At witts end with parsing

Started by Gunner, November 28, 2009, 09:16:23 PM

Previous topic - Next topic

Gunner

Ok, figured I would write a tool to make my life easier.  Idea is to copy some text from a table in a html doc and paste it to a text box, then parse the text and grab what I need instead of copy and paste each line in column 1...  So I was just playing with some other parse code I have and cannot get this to work, am I out of the loop that long that I am missing the obvious?  When I PrintStringByAddr edi I get nothing
LOCAL Len:DWORD

    push    NULL
    push    NULL
    push    WM_GETTEXTLENGTH
    push    hText
    call    SendMessage
    add     eax, 1
    mov     Len, eax
   
    invoke HeapAlloc, hHeap, HEAP_ZERO_MEMORY, Len
    mov     esi, eax
       
    push    esi
    push    Len
    push    WM_GETTEXT
    push    hText
    call    SendMessage
   
    mov     eax, 2
    mul     Len
    mov     Len, eax

     
    invoke HeapAlloc, hHeap, HEAP_ZERO_MEMORY, Len
    mov     edi, eax
       
    @@:
        mov al, byte ptr[esi]               
        test al, al
        jz @F       
        mov byte ptr[edi], al
        inc edi
        ;dec edi ;<-- kinda works, string is backwards
        inc esi       
        jmp @B
    @@:
   
    PrintStringByAddr edi ;<-----------Nothing!
         
    push edi
    push 0
    push hHeap
    call HeapFree
         
    push esi
    push 0
    push hHeap
    call HeapFree
            ret


What am I missing?
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

dedndave

simplify the loop a little bit - notice how it writes the null terminator for you
and save/restore edi

        push    edi

@@:     mov     al,[esi]
        mov     [edi],al
        inc     esi
        inc     edi
        test    al,al
        jnz     @B

        pop     edi

Gunner

Thank you soooo much!  :dance: :U
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

jj2007

OT: Gunner, you are on rank 6 for googling PrintStringByAddr. Congrats :cheekygreen:

Gunner

Quote from: jj2007 on November 29, 2009, 12:54:25 AM
OT: Gunner, you are on rank 6 for googling PrintStringByAddr. Congrats :cheekygreen:

That is too funny  :bg
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com