The MASM Forum

64 bit assembler => 64 Bit Assembler => Topic started by: Gunther on October 01, 2012, 12:48:35 AM

Title: Is it printf or _printf?
Post by: Gunther on October 01, 2012, 12:48:35 AM
I need some help for the Windows 64 bit environment. Since I haven't running a 64 bit windows, I hope one of the members can answer. If one would call the LIBC from an assembly language application, is it:
Code: [Select]
call printfor
Code: [Select]
call _printf
Thank you.

Gunther

Title: Re: Is it printf or _printf?
Post by: qWord on October 01, 2012, 01:17:47 AM
it is printf.
Title: Re: Is it printf or _printf?
Post by: Vortex on October 01, 2012, 03:53:56 AM
Also, the same is true for msvcrt.dll. The function is exported as printf
Title: Re: Is it printf or _printf?
Post by: Gunther on October 01, 2012, 09:22:00 AM
Thank you for the information. In the 32 bit world it's _printf.

Gunther
Title: Re: Is it printf or _printf?
Post by: jj2007 on October 01, 2012, 03:27:47 PM
Thank you for the information. In the 32 bit world it's _printf.

Gunther

In the Masm32 world it seems to be printf: call crt_printf ;)
Title: Re: Is it printf or _printf?
Post by: MichaelW on October 01, 2012, 03:31:05 PM
In the 32 bit world it's _printf.

I know for some CRTs it is, the lcclibc.dll that I tested recently for example, but for MSVCRT.dll, on my Windows 2000 system and on my Windows XP system, it’s “printf”.
Code: [Select]
;==============================================================================
; Build as a console app.
;==============================================================================
include \masm32\include\masm32rt.inc
;==============================================================================
.data
    hMod dd 0
.code
;==============================================================================
start:
;==============================================================================
    invoke LoadLibrary, chr$("msvcrt.dll")
    mov hMod, eax
    printf("%Xh\n",hMod)
    invoke GetProcAddress, hMod, chr$("printf")
    mov ebx, eax
    printf("%Xh\n\n",ebx)

    push ebx
    push cfm$("%Xh\n\n")
    call ebx
    add esp, 8

    inkey
    exit
;==============================================================================
end start
Code: [Select]
78000000h
78023626h

78023626h