flat assembler
Message board for the users of flat assembler.

Index > Windows > strange problem with console

Author
Thread Post new topic Reply to topic
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
when i open a handle to console screenbuffer (CONOUT$) with FILE_FLAG_OVERLAPPED - its ok, handle is created.

When i call WriteFile in synchronous mode, it return 1 and GLA = ERROR_SUCCESS, and data is written.

when i call WriteFile with asynchronous mode, it return 0, GLA = ERROR_INVALID_ACCESS, and data is also written!

when i call WriteFileEx, it return 0, GLA = ERROR_INVALID_HANDLE, data isnt written, callback isnt executed.

why it does happen?
why it works only in synchronous mode? why in asynchronous mode it returned ERROR_INVALID_ACCESS, and data was written?
why Ex function doesnt work? microsoft dont document this behavior, please help Sad
Post 25 Apr 2010, 07:48
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 619
cod3b453
CreateFile (http://msdn.microsoft.com/en-us/library/aa363858(v=VS.85).aspx) says it ignores flags for CONxxx so it looks like it's forced to synchronous. Question
Post 25 Apr 2010, 09:52
View user's profile Send private message Reply with quote
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
indeed it is ignbored, i must have missed that.

but look at WriteFileEx:
http://msdn.microsoft.com/en-us/library/aa365748%28VS.85%29.aspx


Quote:
hFile [in]

A handle to the file or I/O device (for example, a file, file stream, physical disk, volume, console buffer, tape drive, socket, communications resource, mailslot, or pipe).


clearly it allow console handle, so why it fail?
Post 25 Apr 2010, 10:08
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


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.