https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1a318898010a8c94624b6…
commit 1a318898010a8c94624b60966acf546284c636d9
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Fri Mar 23 22:30:18 2018 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Fri Mar 23 22:30:18 2018 +0100
[CRT] Implement the missing CRT _sc(w)printf() functions. CORE-14497
---
dll/win32/msvcrt/msvcrt.spec | 4 ++--
sdk/lib/crt/crt.cmake | 2 ++
sdk/lib/crt/printf/_scprintf.c | 25 +++++++++++++++++++++++++
sdk/lib/crt/printf/_scwprintf.c | 25 +++++++++++++++++++++++++
4 files changed, 54 insertions(+), 2 deletions(-)
diff --git a/dll/win32/msvcrt/msvcrt.spec b/dll/win32/msvcrt/msvcrt.spec
index 368c97e4cc..202bf7e115 100644
--- a/dll/win32/msvcrt/msvcrt.spec
+++ b/dll/win32/msvcrt/msvcrt.spec
@@ -601,8 +601,8 @@
@ cdecl -arch=i386 _safe_fprem()
@ cdecl -arch=i386 _safe_fprem1()
@ cdecl _scalb(double long)
-# stub _scprintf
-# stub _scwprintf
+@ varargs _scprintf(str)
+@ varargs _scwprintf(wstr)
@ cdecl _searchenv(str str ptr)
@ stdcall -i386 _seh_longjmp_unwind(ptr)
# stub _set_SSE2_enable
diff --git a/sdk/lib/crt/crt.cmake b/sdk/lib/crt/crt.cmake
index 66c5b52e1d..a6a7e5dc13 100644
--- a/sdk/lib/crt/crt.cmake
+++ b/sdk/lib/crt/crt.cmake
@@ -135,6 +135,8 @@ list(APPEND CRT_SOURCE
misc/tls.c
printf/_cprintf.c
printf/_cwprintf.c
+ printf/_scprintf.c
+ printf/_scwprintf.c
printf/_snprintf.c
printf/_snprintf_s.c
printf/_snwprintf.c
diff --git a/sdk/lib/crt/printf/_scprintf.c b/sdk/lib/crt/printf/_scprintf.c
new file mode 100644
index 0000000000..9eb30ca4e3
--- /dev/null
+++ b/sdk/lib/crt/printf/_scprintf.c
@@ -0,0 +1,25 @@
+/*
+ * COPYRIGHT: GNU GPL, see COPYING in the top level directory
+ * PROJECT: ReactOS crt library
+ * FILE: lib/sdk/crt/printf/_scprintf.c
+ * PURPOSE: Implementation of _scprintf
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+
+int
+__cdecl
+_scprintf(
+ const char *format,
+ ...)
+{
+ int len;
+ va_list args;
+
+ va_start(args, format);
+ len = _vscprintf(format, args);
+ va_end(args);
+
+ return len;
+}
diff --git a/sdk/lib/crt/printf/_scwprintf.c b/sdk/lib/crt/printf/_scwprintf.c
new file mode 100644
index 0000000000..78c4c9ee1a
--- /dev/null
+++ b/sdk/lib/crt/printf/_scwprintf.c
@@ -0,0 +1,25 @@
+/*
+ * COPYRIGHT: GNU GPL, see COPYING in the top level directory
+ * PROJECT: ReactOS crt library
+ * FILE: lib/sdk/crt/printf/_scwprintf.c
+ * PURPOSE: Implementation of _scwprintf
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+
+int
+__cdecl
+_scwprintf(
+ const wchar_t *format,
+ ...)
+{
+ int len;
+ va_list args;
+
+ va_start(args, format);
+ len = _vscwprintf(format, args);
+ va_end(args);
+
+ return len;
+}