[PATCH 2/3] msvcrt: Use the right _iob functions in the public msvcrt header for ucrtbase

Martin Storsjo martin at martin.st
Fri Nov 6 04:28:15 CST 2015


The generic stdio.h definitions refer to __p__iob() and
__iob_func() which aren't exposed in ucrtbase.

Signed-off-by: Martin Storsjo <martin at martin.st>

---

This currently requires the calling code to define UCRTBASE to get
the right definition, this probably isn't the right way - other
suggestions welcome.
---
 include/msvcrt/stdio.h | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h
index 0606d07..3edf897 100644
--- a/include/msvcrt/stdio.h
+++ b/include/msvcrt/stdio.h
@@ -81,18 +81,23 @@ extern "C" {
 #endif
 
 #ifndef _STDIO_DEFINED
-# ifdef __i386__
-FILE* __cdecl __p__iob(void);
-#  define _iob (__p__iob())
+# ifdef UCRTBASE
+FILE* __cdecl __acrt_iob_func(unsigned);
+#  define _iob(x) (__acrt_iob_func(x))
 # else
+#  ifdef __i386__
+FILE* __cdecl __p__iob(void);
+#   define _iob(x) (__p__iob() + (x))
+#  else
 FILE* __cdecl __iob_func(void);
-#  define _iob (__iob_func())
+#   define _iob(x) (__iob_func() + (x))
+#  endif
 # endif
 #endif /* _STDIO_DEFINED */
 
-#define stdin              (_iob+STDIN_FILENO)
-#define stdout             (_iob+STDOUT_FILENO)
-#define stderr             (_iob+STDERR_FILENO)
+#define stdin              (_iob(STDIN_FILENO))
+#define stdout             (_iob(STDOUT_FILENO))
+#define stderr             (_iob(STDERR_FILENO))
 
 /* return value for _get_output_format */
 #define _TWO_DIGIT_EXPONENT 0x1
-- 
1.8.1.2




More information about the wine-patches mailing list