The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Jeaton on April 07, 2005, 06:03:01 PM

Title: Uptime Proc
Post by: Jeaton on April 07, 2005, 06:03:01 PM
I'm pretty new to asm, practicing by a writing a mIRC dll, anyway, I came across a problem I can't figure out.  When I call the dll, it only returns the first interger value(eax, the one that returns the day count) pushed into wsprintf, and nothing more.  Maybe one of you can see what I'm doing wrong..

    .data
      blah db "%li"

.....

uptme PROC mWnd:DWORD,aWND:DWORD,pData:DWORD,pParams:DWORD,show:DWORD,nopause:DWORD

    call GetTickCount
   
    mov ebx, 1000
    xor edx, edx
    div ebx

    mov ebx, 60
    xor edx, edx
    div ebx
    push edx

    xor edx, edx
    div ebx
    push edx

    mov ebx, 24
    xor edx, edx
    div ebx
    push edx

    push eax

    push offset blah
    push pData
   
    call wsprintf
    add esp, 12

    mov eax, 3
    ret

uptme endp
Title: Re: Uptime Proc
Post by: hitchhikr on April 07, 2005, 08:23:27 PM

blah db "%li:%li:%li",0
pData db 64 dup (0)


    call GetTickCount
   
    mov ebx, 1000
    xor edx, edx
    div ebx

    mov ebx, 60
    xor edx, edx
    div ebx
    push edx

    xor edx, edx
    div ebx
    push edx

    mov ebx, 24
    xor edx, edx
    div ebx
    push eax

    push offset blah
    push offset pData
    call wsprintf
    add esp,(5 * 4)


The number of %li = the number of extra arguments (2 push edx + 1 push eax) beside the output buffer (pData) and the format string (blah).
Title: Re: Uptime Proc
Post by: Jeaton on April 07, 2005, 09:03:55 PM
I forgot to push another edx for the hour count, so I added it to my previous post. 

Anyway, that fixed the problem, thanks a lot.