ReactOS 0.4.16-dev-2104-gb84fa49
conio.h File Reference
#include <corecrt.h>
#include <stdarg.h>
#include <sec_api/conio_s.h>
Include dependency graph for conio.h:

Go to the source code of this file.

Macros

#define __need___va_list
 
#define _WCONIO_DEFINED
 
#define WEOF   (wint_t)(0xFFFF)
 
#define _putwch()   _putwch_nolock()
 
#define _getwch()   _getwch_nolock()
 
#define _getwche()   _getwche_nolock()
 
#define _ungetwch()   _ungetwch_nolock()
 

Functions

_CRTIMP char *__cdecl _cgets (_Pre_notnull_ _Post_z_ char *_Buffer)
 
_Check_return_opt_ _CRTIMP int __cdecl _cprintf (_In_z_ _Printf_format_string_ const char *_Format,...)
 
_Check_return_opt_ _CRTIMP int __cdecl _cputs (_In_z_ const char *_Str)
 
_Check_return_opt_ _CRTIMP int __cdecl _cscanf (_In_z_ _Scanf_format_string_ const char *_Format,...)
 
_Check_return_opt_ _CRTIMP int __cdecl _cscanf_l (_In_z_ _Scanf_format_string_ const char *_Format, _In_opt_ _locale_t _Locale,...)
 
_Check_return_ _CRTIMP int __cdecl _getch (void)
 
_Check_return_ _CRTIMP int __cdecl _getche (void)
 
_Check_return_opt_ _CRTIMP int __cdecl _vcprintf (_In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
 
_Check_return_opt_ _CRTIMP int __cdecl _cprintf_p (_In_z_ _Printf_format_string_ const char *_Format,...)
 
_Check_return_opt_ _CRTIMP int __cdecl _vcprintf_p (_In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
 
_Check_return_opt_ _CRTIMP int __cdecl _cprintf_l (_In_z_ _Printf_format_string_ const char *_Format, _In_opt_ _locale_t _Locale,...)
 
_Check_return_opt_ _CRTIMP int __cdecl _vcprintf_l (_In_z_ _Printf_format_string_ const char *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList)
 
_Check_return_opt_ _CRTIMP int __cdecl _cprintf_p_l (_In_z_ _Printf_format_string_ const char *_Format, _In_opt_ _locale_t _Locale,...)
 
_Check_return_opt_ _CRTIMP int __cdecl _vcprintf_p_l (_In_z_ _Printf_format_string_ const char *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList)
 
_CRTIMP int __cdecl _kbhit (void)
 
_CRTIMP int __cdecl _putch (_In_ int _Ch)
 
_CRTIMP int __cdecl _ungetch (_In_ int _Ch)
 
_Check_return_ _CRTIMP int __cdecl _getch_nolock (void)
 
_Check_return_ _CRTIMP int __cdecl _getche_nolock (void)
 
_CRTIMP int __cdecl _putch_nolock (_In_ int _Ch)
 
_CRTIMP int __cdecl _ungetch_nolock (_In_ int _Ch)
 
_CRTIMP wchar_t_cgetws (_Pre_notnull_ _Post_z_ wchar_t *_Buffer)
 
_Check_return_ _CRTIMP wint_t __cdecl _putwch (wchar_t _WCh)
 
_Check_return_ _CRTIMP wint_t __cdecl _ungetwch (wint_t _WCh)
 
_Check_return_opt_ _CRTIMP int __cdecl _cputws (_In_z_ const wchar_t *_String)
 
_Check_return_opt_ _CRTIMP int __cdecl _cwprintf (_In_z_ _Printf_format_string_ const wchar_t *_Format,...)
 
_Check_return_opt_ _CRTIMP int __cdecl _cwscanf (_In_z_ _Scanf_format_string_ const wchar_t *_Format,...)
 
_Check_return_opt_ _CRTIMP int __cdecl _cwscanf_l (_In_z_ _Scanf_format_string_ const wchar_t *_Format, _In_opt_ _locale_t _Locale,...)
 
_Check_return_opt_ _CRTIMP int __cdecl _vcwprintf (_In_z_ _Printf_format_string_ const wchar_t *_Format, va_list _ArgList)
 
_Check_return_opt_ _CRTIMP int __cdecl _cwprintf_p (_In_z_ _Printf_format_string_ const wchar_t *_Format,...)
 
_Check_return_opt_ _CRTIMP int __cdecl _vcwprintf_p (_In_z_ _Printf_format_string_ const wchar_t *_Format, va_list _ArgList)
 
_CRTIMP int __cdecl _cwprintf_l (_In_z_ _Printf_format_string_ const wchar_t *_Format, _In_opt_ _locale_t _Locale,...)
 
_CRTIMP int __cdecl _vcwprintf_l (_In_z_ _Printf_format_string_ const wchar_t *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList)
 
_CRTIMP int __cdecl _cwprintf_p_l (_In_z_ _Printf_format_string_ const wchar_t *_Format, _In_opt_ _locale_t _Locale,...)
 
_CRTIMP int __cdecl _vcwprintf_p_l (_In_z_ _Printf_format_string_ const wchar_t *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList)
 
_Check_return_opt_ _CRTIMP wint_t __cdecl _putwch_nolock (wchar_t _WCh)
 
_Check_return_ _CRTIMP wint_t __cdecl _getwch_nolock (void)
 
_Check_return_ _CRTIMP wint_t __cdecl _getwche_nolock (void)
 
_Check_return_opt_ _CRTIMP wint_t __cdecl _ungetwch_nolock (wint_t _WCh)
 
_Check_return_opt_ _CRTIMP char *__cdecl cgets (_Out_writes_z_(_Inexpressible_(*_Buffer+2)) char *_Buffer)
 
_Check_return_opt_ _CRTIMP int __cdecl cprintf (_In_z_ _Printf_format_string_ const char *_Format,...)
 
_Check_return_opt_ _CRTIMP int __cdecl cputs (_In_z_ const char *_Str)
 
_Check_return_opt_ _CRTIMP int __cdecl cscanf (_In_z_ _Scanf_format_string_ const char *_Format,...)
 
_Check_return_ _CRTIMP int __cdecl getch (void)
 
_Check_return_ _CRTIMP int __cdecl getche (void)
 
_Check_return_ _CRTIMP int __cdecl kbhit (void)
 
_Check_return_opt_ _CRTIMP int __cdecl putch (int _Ch)
 
_Check_return_opt_ _CRTIMP int __cdecl ungetch (int _Ch)
 

Macro Definition Documentation

◆ __need___va_list

#define __need___va_list

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER within this package.

Definition at line 11 of file conio.h.

◆ _getwch

Definition at line 339 of file conio.h.

◆ _getwche

Definition at line 340 of file conio.h.

◆ _putwch

#define _putwch ( )    _putwch_nolock()

Definition at line 338 of file conio.h.

◆ _ungetwch

#define _ungetwch ( )    _ungetwch_nolock()

Definition at line 341 of file conio.h.

◆ _WCONIO_DEFINED

#define _WCONIO_DEFINED

Definition at line 182 of file conio.h.

◆ WEOF

#define WEOF   (wint_t)(0xFFFF)

Definition at line 185 of file conio.h.

Function Documentation

◆ _cgets()

_CRTIMP char *__cdecl _cgets ( _Pre_notnull_ _Post_z_ char _Buffer)

◆ _cgetws()

_CRTIMP wchar_t * _cgetws ( _Pre_notnull_ _Post_z_ wchar_t _Buffer)

◆ _cprintf()

Definition at line 176 of file conio.h.

182 {
183 int _Result;
188 return _Result;
189 }
#define NULL
Definition: types.h:112
char * va_list
Definition: vadefs.h:50
_In_z_ _Printf_format_string_ char const *const _Format
Definition: printf.c:19
_Result
Definition: conio.h:347
__crt_va_end(_ArgList)
_Check_return_opt_ _In_opt_ _locale_t const va_list _ArgList
Definition: conio.h:285
_Check_return_opt_ _CRT_STDIO_INLINE int __CRTDECL _vcprintf_l(_In_z_ _Printf_format_string_params_(2) char const *const _Format, _In_opt_ _locale_t const _Locale, va_list _ArgList)
Definition: conio.h:71
__crt_va_start(_ArgList, _Locale)

◆ _cprintf_l()

◆ _cprintf_p()

Definition at line 246 of file conio.h.

252 {
253 int _Result;
258 return _Result;
259 }
_Check_return_opt_ _CRT_STDIO_INLINE int __CRTDECL _vcprintf_p_l(_In_z_ _Printf_format_string_params_(2) char const *const _Format, _In_opt_ _locale_t const _Locale, va_list _ArgList)
Definition: conio.h:129

◆ _cprintf_p_l()

_Check_return_opt_ _CRTIMP int __cdecl _cprintf_p_l ( _In_z_ _Printf_format_string_ const char _Format,
_In_opt_ _locale_t  _Locale,
  ... 
)

◆ _cputs()

◆ _cputws()

◆ _cscanf()

◆ _cscanf_l()

◆ _cwprintf()

◆ _cwprintf_l()

_CRTIMP int __cdecl _cwprintf_l ( _In_z_ _Printf_format_string_ const wchar_t _Format,
_In_opt_ _locale_t  _Locale,
  ... 
)

◆ _cwprintf_p()

◆ _cwprintf_p_l()

_CRTIMP int __cdecl _cwprintf_p_l ( _In_z_ _Printf_format_string_ const wchar_t _Format,
_In_opt_ _locale_t  _Locale,
  ... 
)

◆ _cwscanf()

◆ _cwscanf_l()

◆ _getch()

Definition at line 218 of file console.c.

219{
220 int ret;
221
223 ret = _getch_nolock();
225 return ret;
226}
#define LOCK_CONSOLE
Definition: console.c:33
int CDECL _getch_nolock(void)
Definition: console.c:164
#define UNLOCK_CONSOLE
Definition: console.c:34
return ret
Definition: mutex.c:146

◆ _getch_nolock()

_Check_return_ _CRTIMP int __cdecl _getch_nolock ( void  )

Definition at line 164 of file console.c.

165{
166 int retval = EOF;
167
169 {
172 }
173 else
174 {
175 INPUT_RECORD ir;
176 DWORD count;
177 DWORD mode = 0;
178
180 if(mode)
182
183 do {
185 {
186 /* Only interested in ASCII chars */
187 if (ir.EventType == KEY_EVENT &&
189 {
190 unsigned char ch1, ch2;
191
193 {
195 break;
196 }
197
198 if (handle_enhanced_keys(&ir, &ch1, &ch2))
199 {
200 retval = ch1;
202 break;
203 }
204 }
205 }
206 else
207 break;
208 } while(1);
209 if (mode)
211 }
212 return retval;
213}
BOOL WINAPI GetConsoleMode(HANDLE hConsoleHandle, LPDWORD lpMode)
Definition: console.c:1571
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode)
Definition: console.c:1608
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleInputA(IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead)
Definition: readwrite.c:1276
static BOOL handle_enhanced_keys(INPUT_RECORD *ir, unsigned char *ch1, unsigned char *ch2)
Definition: console.c:131
static HANDLE msvcrt_input_console(void)
Definition: console.c:42
static int __MSVCRT_console_buffer
Definition: console.c:38
#define EOF
Definition: stdio.h:33
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum mode
Definition: glext.h:6217
union _INPUT_RECORD::@3503 Event
WORD EventType
Definition: wincon.h:294
KEY_EVENT_RECORD KeyEvent
Definition: wincon.h:296
union _KEY_EVENT_RECORD::@3502 uChar
int retval
Definition: wcstombs.cpp:91
#define KEY_EVENT
Definition: wincon.h:156

◆ _getche()

Definition at line 354 of file console.c.

355{
356 int ret;
357
361 return ret;
362}
int CDECL _getche_nolock(void)
Definition: console.c:342

◆ _getche_nolock()

_Check_return_ _CRTIMP int __cdecl _getche_nolock ( void  )

Definition at line 342 of file console.c.

343{
344 int retval;
346 if (retval != EOF)
348 return retval;
349}
int CDECL _putch_nolock(int c)
Definition: console.c:298

◆ _getwch_nolock()

_Check_return_ _CRTIMP wint_t __cdecl _getwch_nolock ( void  )

Definition at line 231 of file console.c.

232{
233 wchar_t retval = WEOF;
234
236 {
239 }
240 else
241 {
242 INPUT_RECORD ir;
243 DWORD count;
244 DWORD mode = 0;
245
247 if(mode)
249
250 do {
252 {
253 /* Only interested in ASCII chars */
254 if (ir.EventType == KEY_EVENT &&
256 {
257 unsigned char ch1, ch2;
258
260 {
262 break;
263 }
264
265 if (handle_enhanced_keys(&ir, &ch1, &ch2))
266 {
267 retval = ch1;
269 break;
270 }
271 }
272 }
273 else
274 break;
275 } while(1);
276 if (mode)
278 }
279 return retval;
280}
BOOL WINAPI ReadConsoleInputW(HANDLE handle, INPUT_RECORD *buffer, DWORD length, DWORD *count)
Definition: console.c:1815
static wchar_t __MSVCRT_console_buffer_w
Definition: console.c:39
#define WEOF
WCHAR UnicodeChar
Definition: wincon.h:266

◆ _getwche_nolock()

_Check_return_ _CRTIMP wint_t __cdecl _getwche_nolock ( void  )

Definition at line 367 of file console.c.

368{
369 wchar_t wch;
370 wch = _getch_nolock();
371 if (wch == WEOF)
372 return wch;
373 return _putwch_nolock(wch);
374}
wchar_t CDECL _putwch_nolock(wchar_t c)
Definition: console.c:320

◆ _kbhit()

_CRTIMP int __cdecl _kbhit ( void  )

Definition at line 474 of file console.c.

475{
476 int retval = 0;
477
480 retval = 1;
481 else
482 {
483 /* FIXME: There has to be a faster way than this in Win32.. */
484 INPUT_RECORD *ir = NULL;
485 DWORD count = 0, i;
486
488
489 if (count && (ir = malloc(count * sizeof(INPUT_RECORD))) &&
491 for(i = 0; i < count; i++)
492 {
493 if (ir[i].EventType == KEY_EVENT &&
494 ir[i].Event.KeyEvent.bKeyDown &&
495 ir[i].Event.KeyEvent.uChar.AsciiChar)
496 {
497 retval = 1;
498 break;
499 }
500 }
501 free(ir);
502 }
504 return retval;
505}
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
BOOL WINAPI GetNumberOfConsoleInputEvents(HANDLE hConsoleInput, LPDWORD lpNumberOfEvents)
Definition: console.c:1637
BOOL WINAPI DECLSPEC_HOTPATCH PeekConsoleInputA(IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead)
Definition: readwrite.c:1236
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ EVENT_TYPE EventType
Definition: exfuncs.h:167

◆ _putch()

_CRTIMP int __cdecl _putch ( _In_ int  _Ch)

◆ _putch_nolock()

_CRTIMP int __cdecl _putch_nolock ( _In_ int  _Ch)

◆ _putwch()

Definition at line 331 of file console.c.

332{
334 c = _putwch_nolock(c);
336 return c;
337}
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80

◆ _putwch_nolock()

_Check_return_opt_ _CRTIMP wint_t __cdecl _putwch_nolock ( wchar_t  _WCh)

Definition at line 320 of file console.c.

321{
322 DWORD count;
324 return c;
325 return WEOF;
326}
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleW(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
Definition: readwrite.c:1447
static HANDLE msvcrt_output_console(void)
Definition: console.c:55

◆ _ungetch()

_CRTIMP int __cdecl _ungetch ( _In_ int  _Ch)

◆ _ungetch_nolock()

_CRTIMP int __cdecl _ungetch_nolock ( _In_ int  _Ch)

◆ _ungetwch()

Definition at line 463 of file console.c.

464{
468 return c;
469}
wchar_t CDECL _ungetwch_nolock(wchar_t c)
Definition: console.c:452

◆ _ungetwch_nolock()

_Check_return_opt_ _CRTIMP wint_t __cdecl _ungetwch_nolock ( wint_t  _WCh)

Definition at line 452 of file console.c.

453{
454 wchar_t retval = WEOF;
457 return retval;
458}

◆ _vcprintf()

Definition at line 87 of file conio.h.

94 {
96 }

◆ _vcprintf_l()

_Check_return_opt_ _CRTIMP int __cdecl _vcprintf_l ( _In_z_ _Printf_format_string_ const char _Format,
_In_opt_ _locale_t  _Locale,
va_list  _ArgList 
)

Referenced by _cprintf(), _cprintf_l(), and _vcprintf().

◆ _vcprintf_p()

◆ _vcprintf_p_l()

_Check_return_opt_ _CRTIMP int __cdecl _vcprintf_p_l ( _In_z_ _Printf_format_string_ const char _Format,
_In_opt_ _locale_t  _Locale,
va_list  _ArgList 
)

◆ _vcwprintf()

◆ _vcwprintf_l()

_CRTIMP int __cdecl _vcwprintf_l ( _In_z_ _Printf_format_string_ const wchar_t _Format,
_In_opt_ _locale_t  _Locale,
va_list  _ArgList 
)

◆ _vcwprintf_p()

◆ _vcwprintf_p_l()

_CRTIMP int __cdecl _vcwprintf_p_l ( _In_z_ _Printf_format_string_ const wchar_t _Format,
_In_opt_ _locale_t  _Locale,
va_list  _ArgList 
)

◆ cgets()

_Check_return_opt_ _CRTIMP char *__cdecl cgets ( _Out_writes_z_(_Inexpressible_(*_Buffer+2)) char _Buffer)

◆ cprintf()

◆ cputs()

◆ cscanf()

◆ getch()

Definition at line 180 of file mwerks_console_OS_X.c.

181{
182 return 0;
183}

◆ getche()

◆ kbhit()

Definition at line 175 of file mwerks_console_OS_X.c.

176{
177 return 0;
178}

◆ putch()

◆ ungetch()