ReactOS 0.4.16-dev-1028-g8602629
putwch.cpp
Go to the documentation of this file.
1//
2// putwch.cpp
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// Defines _putwch(), which writes a wide character to the console.
7//
8#include <conio.h>
11
12// Writes a wide character to the console. Returns the character on success,
13// WEOF on failure.
14extern "C" wint_t __cdecl _putwch(wchar_t const c)
15{
16 return __acrt_lock_and_call(__acrt_conio_lock, [&]
17 {
18 return _putwch_nolock(c);
19 });
20}
21
22extern "C" wint_t __cdecl _putwch_nolock(wchar_t const c)
23{
25 return WEOF;
26
27 // Write character to console:
28 DWORD charsWritten;
29 if (__dcrt_write_console(&c, 1, &charsWritten) == FALSE)
30 return WEOF;
31
32 return c;
33}
34
35extern "C" wint_t __cdecl _putwch_nolock_internal(wchar_t const c, __crt_cached_ptd_host&)
36{
37 // Currently _putwch_nolock does not require any PTD access. Do not need to propagate __crt_cached_ptd_host&.
38 return _putwch_nolock(c);
39}
int wint_t
Definition: _apple.h:38
#define __cdecl
Definition: accygwin.h:79
@ __acrt_conio_lock
#define FALSE
Definition: types.h:117
unsigned long DWORD
Definition: ntddk_ex.h:95
const GLubyte * c
Definition: glext.h:8905
BOOL __cdecl __dcrt_lowio_ensure_console_output_initialized()
Definition: initcon.cpp:31
BOOL __cdecl __dcrt_write_console(_In_ void const *lpBuffer, _In_ DWORD nNumberOfCharsToWrite, _Out_ LPDWORD lpNumberOfCharsWritten)
Definition: initcon.cpp:67
#define c
Definition: ke_i.h:80
wint_t __cdecl _putwch_nolock_internal(wchar_t const c, __crt_cached_ptd_host &)
Definition: putwch.cpp:35
wint_t __cdecl _putwch_nolock(wchar_t const c)
Definition: putwch.cpp:22
#define WEOF
Definition: conio.h:185
#define _putwch()
Definition: conio.h:338