1

In my assembly program I called AllocConsole from the kernel32 library, however I do not know how to get input from the allocated console. Is there any function that the winapi contains that will get input from the allocated console in the current program?

CALL AllocConsole

All of the functions such as ReadConsole require an input buffer, and I do not know how to get the input buffer for my allocated console, let alone whether the function even does what I need.

To summarize, is there a function in the winapi that can get input from the allocated console in a program?

Thanks

2
  • Open CONIN$ using CreateFile(). Commented Jul 25, 2017 at 4:31
  • 3
    AllocConsole initializes standard input, standard output, and standard error handles for the new console. The standard input handle is a handle to the console's input buffer, and the standard output and standard error handles are handles to the console's screen buffer. To retrieve these handles, use the GetStdHandle function. Commented Jul 25, 2017 at 7:11

1 Answer 1

6

All of the functions such as ReadConsole require an input buffer, and I do not know how to get the input buffer

The functions you have to call are the same in C and in assembly language. So your problem is not assembly language specific.

You can get the standard input and standard output handles using the GetStdHandle function.

To get the input handle you must pass the constant STD_INPUT_HANDLE (-10 = 0xFFFFFFF6 in the case of a 32-bit program) as argument to the function.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.