flat assembler
Message board for the users of flat assembler.

Index > Windows > Console problem

Author
Thread Post new topic Reply to topic
Sasha



Joined: 17 Nov 2011
Posts: 93
Sasha
I have a problem with console output (may be input too, haven't tested).
After closing the output handle it couldn't be opened again, but the function GetStdHandle returns without an error! Here is a test program.


Description:
Download
Filename: console.zip
Filesize: 3.92 KB
Downloaded: 62 Time(s)

Post 13 Nov 2013, 11:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
If you close one of the standard console handles you can't use the handle again. When you close the handle you also close the pipe between your program and the console app. And trying to open a new pipe would be very tricky if the console app does not know to expect a new pipe from your program.

Basically, don't close the handles if you still need to send and/or receive more data from the console.
Post 13 Nov 2013, 11:21
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
Additional: You can call GetStdHandle multiple times without any issue. It just keeps returning the same handles each time.
Post 13 Nov 2013, 11:26
View user's profile Send private message Visit poster's website Reply with quote
Sasha



Joined: 17 Nov 2011
Posts: 93
Sasha
So, actually, the standard handle doesn't need to be closed at all.
Post 13 Nov 2013, 11:57
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
Sasha wrote:
So, actually, the standard handle doesn't need to be closed at all.
Correct. You can close them if you want to but then you lose the connection to the host process.
Post 13 Nov 2013, 12:02
View user's profile Send private message Visit poster's website 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.