[CRT] Sync _cputs() with Wine Staging 1.9.16. CORE-11866 CORE-8546
[reactos.git] / reactos / sdk / lib / crt / conio / cputs.c
1 /* Imported from msvcrt/console.c */
2
3 #include <precomp.h>
4
5 /*********************************************************************
6 * _cputs (MSVCRT.@)
7 */
8 int CDECL _cputs(const char* str)
9 {
10 DWORD count;
11 int len, retval = -1;
12 #ifdef __REACTOS__ /* r54651 */
13 HANDLE MSVCRT_console_out = GetStdHandle(STD_OUTPUT_HANDLE);
14 #endif
15
16 if (!MSVCRT_CHECK_PMT(str != NULL)) return -1;
17 len = strlen(str);
18
19 #ifndef __REACTOS__ /* r54651 */
20 LOCK_CONSOLE;
21 #endif
22 if (WriteConsoleA(MSVCRT_console_out, str, len, &count, NULL)
23 && count == len)
24 retval = 0;
25 #ifndef __REACTOS__ /* r54651 */
26 UNLOCK_CONSOLE;
27 #endif
28 return retval;
29 }