News:

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

HexString To Dw with wildcards

Started by ragdog, November 12, 2008, 06:23:23 PM

Previous topic - Next topic

ragdog

Hi

I have a next probelm    
how i can bypass the (*) in a hexstring to dword





    push offset hDestBuffer
    push offset sztest             ;54*4553*54  to T*ES*T
       call HexDecode
   
        invoke MessageBox,hWnd,addr hDestBuffer,0,MB_OK


HexDecode proc uses esi edi ebx pHexStr:dword,pOutBuffer:dword
;---------------------------------------
   mov    esi, pHexStr
   mov    edi, pOutBuffer
   jmp    @1
@@: and    ebx, 0Fh
   add    eax, ebx
   mov    [edi], al
   inc    edi
@1: movzx  edx, byte ptr[esi]
cmp edx,"*"
jz @Next
   cmp    edx, 40h
   sbb    ebx, ebx
   sub    edx, 37h
   and    ebx, 7
   
   inc    esi
   add    ebx, edx
   js      @F
   mov    eax, ebx
   shl    eax, 4
   @Next:
   mov    [edi], al
   movzx  edx, byte ptr [esi]
   cmp    edx, 40h
   sbb    ebx, ebx
   sub    edx, 37h
   and    ebx, 7
   inc    esi
   add    ebx, edx
   jns    @B
@@: ret
;---------------------------------------
HexDecode endp



Greets

n00b!

Hi,
I do not know if this is exactly what you want since it's a totally noobish solution
(It could also be that I've misunderstood your request, if so I'm sorry):

@1:
   movzx edx, BYTE ptr [esi]
   cmp edx,"*"
   jnz @noasterisk
   inc esi
   ;Commented: String will be "TEST"
   ;Uncommented: String will be "T*ES*T"
   ;mov [edi], dl
   ;inc edi
   jmp @1
@noasterisk:
   cmp edx, 40h

ragdog

Thanks noob :U

total simply mistake  :bdg

Greets