News:

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

help with bypass chars in file

Started by remus2k, December 06, 2006, 07:53:01 PM

Previous topic - Next topic

ragdog

I created it so far
as I delete the last character ( - ) into my string

           invoke CreateFile,offset szFile,GENERIC_READ or GENERIC_WRITE,\
                                             FILE_SHARE_READ or FILE_SHARE_WRITE,0,\
                                               OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0                   
              mov hFile,eax
     invoke ReadFile, hFile,addr hRead,sizeof hRead,addr NumberOfBytes,0       
        mov edi, offset hData
        mov esi, offset hRead         
        mov ebx,0
     @@:   
        mov al, byte ptr [esi]  ; read byte
        mov byte ptr [edi], al  ; write byte
        cmp al,"-"              ; did we copy a null?
         je @print              ; done
        inc esi                 ; else increment pointers using INC
        inc edi
        jmp @B
@print:
        mov edi,offset hData
     invoke MessageBox,hWnd,offset hData,0,MB_OK
        inc esi               
        inc ebx               
        cmp ebx,3
        jne @B

ragdog

Tedd

            jmp @B
    @print:
            mov BYTE PTR [edi],0    ; <------- ADD ME!!!
            mov edi,offset hData


:U
No snowflake in an avalanche feels responsible.

PBrennick

RagDog,
As Tedd has said (without saying it), you did not zero terminate the buffer. You need to do this before you can use the buffer in , for example, a MessageBox.

BTW: That is an interesting choice of an avatar...

Paul
The GeneSys Project is available from:
The Repository or My crappy website

ragdog

thank tedd this works :U
and paul for the info


regards
ragdog