flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Windows > [solved] Odd issue with 64-bit MSVCRT printf invocation

Author
Thread Post new topic Reply to topic
Trinitek



Joined: 06 Nov 2011
Posts: 255
[solved] Odd issue with 64-bit MSVCRT printf invocation
I've got a heisenbug on my hands. The following works on my Win7 machine and my debugger without problems, but fails on Win10.

Code:
format PE64 console
entry start

    include "win64a.inc"

section '.text' code readable executable
    
    start:
        invoke printfmsg_helloWorld
        invoke ExitProcess0
        
    msg_test db "Test"0x0D0x0A0
    
section '.data' data readable

    msg_helloWorld db "Hello world!"0x0D0x0A0
    
section '.idata' import data readable writeable

    library kernel32,'KERNEL32.DLL',\
            msvcrt'MSVCRT.DLL'
    
    include 'api/kernel32.inc'
    
    import  msvcrt,\
            printf'printf'

Any ideas? inb4 Windows 10? More like WinBLOWS 10 am I rite???
Post 27 Mar 2017, 06:27
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14848
Location: Lost in translation
What do you mean by "fails on Win10"? Crashes? Prints something else? Prints nothing? Infinite loop? Can't start? Can't debug?
Post 27 Mar 2017, 06:38
View user's profile Send private message Visit poster's website Reply with quote
Trinitek



Joined: 06 Nov 2011
Posts: 255

revolution wrote:
What do you mean by "fails on Win10"? Crashes? Prints something else? Prints nothing? Infinite loop? Can't start? Can't debug?

It crashes and burns. "ConsoleTest.exe has stopped working."
Post 27 Mar 2017, 06:44
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14848
Location: Lost in translation
Probably because the stack is misaligned.

Try inserting this after the start label:

Code:
and rsp,-16

Post 27 Mar 2017, 06:50
View user's profile Send private message Visit poster's website Reply with quote
Trinitek



Joined: 06 Nov 2011
Posts: 255
Stupid stack alignments. Thanks a bunch.
Post 27 Mar 2017, 06:55
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.