Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uhex$ in masm assembly

I have this block of code here on Intel structure and I wonder why uhex$(ebx)+6 ? What is the +6 in there is for ? Can some one explain it to me ?

.code 
start: 
    ...

WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD 
    ...
WinMain endp

WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM 
    ...
            .ELSEIF  ax==IDM_GETTEXT 
                ; store user input into buffer
                invoke GetWindowText,hwndEdit,ADDR buffer,512 

                ; convert into hex
                xor eax,eax
                invoke lstrlen, addr buffer
                mov mSize,eax
                mov edx,mSize
                mov esi, OFFSET buffer

                .WHILE i != edx
                    push edx
                    xor ebx,ebx
                    mov bl, [esi]
                    add esi,1
                    mov Value,uhex$(ebx) + 6
                    invoke lstrcat, addr mStr, Value
                    inc i
                    pop edx
               .ENDW

                ...
WndProc endp 
end start

I've tried searching on Google and ChatGPT but all I found was uhex convert 32 bit integer to hex string, I just need an explaination of uhex$ and why +6 ?

like image 528
Huy Tran Avatar asked Oct 12 '25 11:10

Huy Tran


1 Answers

From masm32 folder D:\masm32\macros\macros.asm


      uhex$ MACRO DDvalue   ;; unsigned DWORD to hex string
        LOCAL rvstring
        .data
          rvstring db 12 dup (0)
        align 4
        .code
        invoke dw2hex,DDvalue,ADDR rvstring
        EXITM <OFFSET rvstring>
      ENDM
like image 130
Nassau Avatar answered Oct 16 '25 06:10

Nassau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!