flat assembler
Message board for the users of flat assembler.

Index > Windows > view byte by byte through OutputDebugString

Author
Thread Post new topic Reply to topic
sleepsleep



Joined: 05 Oct 2006
Posts: 13176
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 20 May 2007, 23:58
hi there,
while doing this smart card dll, i face one problem
let me describe my problem.

eg.
Code:
somevariable db 0x00, 0xA4, 0x04, 0x00, 0x0A, 0x0A0, 0x00, 0x00, 0x00, 0x74, 0x4A, 0x50, 0x4E, 0x00, 0x10
    

now, assume i need to view it through OutputDebugString (return exactly like 0x00 0xA4 0x00 0x0A .... ~

first idea i got is like
f1 db '%lX ',0
f2 db '%s',0
mov eax,somevariable
xor edx,edx
mov edx, byte [eax]
invoke wsprintf,buff,f1,edx
mov esi,buff2
invoke lstrlen,buff
add esi,eax
invoke wsprintf,esi,f2,buff

u guys got any idea?
Post 20 May 2007, 23:58
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 13176
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 21 May 2007, 01:21
just coded this (seems workable on my side)
could read the smartcard response now (match with string) through debugger (more easier now)
if first byte is zero, it returns immediately, u can check it with eax, if u supply sz, it will loop until that byte, if u supply zero, it loop until it finds 0 byte.

Code:
buff2                            rb 0xFF
debug                                rb 0xFF
debugr                               dd ?
debugw                          dd ?
debugs                          dd ?

proc debug_mem addr, sz
; -- -------------------
             push    debug
               pop     [debugw]
            push    [addr]
              pop     [debugr]
            cmp     [sz],0
              je      .till_null
          push    [sz]
                pop     [debugs]
    
    .s1:
            xor     edx,edx
             mov     eax,[debugr]
                mov     dl,byte [eax]
       cinvoke wsprintf,buff2,f2,edx
       cinvoke wsprintf,[debugw],f3,buff2
  invoke  lstrlen,buff2
               add     [debugw],eax
                inc     [debugr]
            dec     [debugs]
            cmp     [debugs],0
          je      .exit
               jmp     .s1
 
    .till_null:
             mov     eax,[addr]
          cmp     byte [eax],0
                je      .first_null
         mov     [debugs],1
          inc     eax
         
            .s2:
                    cmp     byte [eax],0
                        je      .s1
                 inc     eax
                 inc     [debugs]
                    jmp     .s2
         
            .first_null:
                    mov     eax,0
                       ret
 
    .exit:
          mov     eax,debug
           ret
endp
    
Post 21 May 2007, 01:21
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.