- Merge the remaining portion of the wlan-bringup branch
[reactos.git] / rostests / kmtests / kmtest_drv / printf_stubs.c
1 /*
2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite stub functions for any-IRQL vsnprintf
5 * PROGRAMMER: Thomas Faber <thfabba@gmx.de>
6 */
7
8 #undef wctomb
9 #include <stdarg.h>
10 #include <stdio.h>
11 #include <wchar.h>
12
13 int __cdecl KmtWcToMb(char *mbchar, wchar_t wchar)
14 {
15 *mbchar = (char)wchar;
16 return 1;
17 }
18
19 int __cdecl streamout(FILE *stream, const char *format, va_list argptr);
20
21 int __cdecl KmtVSNPrintF(char *buffer, size_t count, const char *format, va_list argptr)
22 {
23 int result;
24 FILE stream;
25
26 stream._base = (char *)buffer;
27 stream._ptr = stream._base;
28 stream._charbuf = 0;
29 stream._cnt = count;
30 stream._bufsiz = 0;
31 stream._flag = _IOSTRG | _IOWRT;
32 stream._tmpfname = 0;
33
34 result = streamout(&stream, format, argptr);
35
36 /* Only zero terminate if there is enough space left */
37 if (stream._cnt) *(char *)stream._ptr = '\0';
38
39 return result;
40 }