include: Add the msvcrt/crtdefs.h header and include it where needed.
diff --git a/include/Makefile.in b/include/Makefile.in
index 5b24e0d..abb89ab 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -290,6 +290,7 @@
 	mstcpip.h \
 	msvcrt/conio.h \
 	msvcrt/crtdbg.h \
+	msvcrt/crtdefs.h \
 	msvcrt/ctype.h \
 	msvcrt/direct.h \
 	msvcrt/dirent.h \
diff --git a/include/msvcrt/conio.h b/include/msvcrt/conio.h
index 0c958df..4384a37 100644
--- a/include/msvcrt/conio.h
+++ b/include/msvcrt/conio.h
@@ -7,9 +7,8 @@
  */
 #ifndef __WINE_CONIO_H
 #define __WINE_CONIO_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/msvcrt/crtdbg.h b/include/msvcrt/crtdbg.h
index a4393a9..bd98449 100644
--- a/include/msvcrt/crtdbg.h
+++ b/include/msvcrt/crtdbg.h
@@ -19,9 +19,8 @@
  */
 #ifndef __WINE_CRTDBG_H_
 #define __WINE_CRTDBG_H_
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 /* The debug API is not implemented in Winelib.
  * Redirect everything to the regular APIs.
diff --git a/include/msvcrt/crtdefs.h b/include/msvcrt/crtdefs.h
new file mode 100644
index 0000000..7234c1d
--- /dev/null
+++ b/include/msvcrt/crtdefs.h
@@ -0,0 +1,133 @@
+/*
+ * CRT definitions
+ *
+ * Copyright 2000 Francois Gouget.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_USE_MSVCRT
+#define __WINE_USE_MSVCRT
+#endif
+
+#if defined(__x86_64__) && !defined(_WIN64)
+#define _WIN64
+#endif
+
+#if !defined(_MSC_VER) && !defined(__int64)
+# if defined(_WIN64) && !defined(__MINGW64__)
+#   define __int64 long
+# else
+#   define __int64 long long
+# endif
+#endif
+
+#ifndef __stdcall
+# ifdef __i386__
+#  ifdef __GNUC__
+#   ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */
+#    define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
+#   else
+#    define __stdcall __attribute__((__stdcall__))
+#   endif
+#  elif defined(_MSC_VER)
+    /* Nothing needs to be done. __stdcall already exists */
+#  else
+#   error You need to define __stdcall for your compiler
+#  endif
+# elif defined(__x86_64__) && defined (__GNUC__)
+#  define __stdcall __attribute__((ms_abi))
+# else
+#  define __stdcall
+# endif
+#endif /* __stdcall */
+
+#ifndef __cdecl
+# if defined(__i386__) && defined(__GNUC__)
+#  ifdef __APPLE__ /* Mac OS X uses 16-byte aligned stack and not a 4-byte one */
+#   define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
+#  else
+#   define __cdecl __attribute__((__cdecl__))
+#  endif
+# elif defined(__x86_64__) && defined (__GNUC__)
+#  define __cdecl __attribute__((ms_abi))
+# elif !defined(_MSC_VER)
+#  define __cdecl
+# endif
+#endif /* __cdecl */
+
+#ifndef _INTPTR_T_DEFINED
+#ifdef  _WIN64
+typedef __int64 intptr_t;
+#else
+typedef int intptr_t;
+#endif
+#define _INTPTR_T_DEFINED
+#endif
+
+#ifndef _UINTPTR_T_DEFINED
+#ifdef  _WIN64
+typedef unsigned __int64 uintptr_t;
+#else
+typedef unsigned int uintptr_t;
+#endif
+#define _UINTPTR_T_DEFINED
+#endif
+
+#ifndef _PTRDIFF_T_DEFINED
+#ifdef _WIN64
+typedef __int64 ptrdiff_t;
+#else
+typedef int ptrdiff_t;
+#endif
+#define _PTRDIFF_T_DEFINED
+#endif
+
+#ifndef _SIZE_T_DEFINED
+#ifdef _WIN64
+typedef unsigned __int64 size_t;
+#else
+typedef unsigned int size_t;
+#endif
+#define _SIZE_T_DEFINED
+#endif
+
+#ifndef _TIME_T_DEFINED
+typedef long time_t;
+#define _TIME_T_DEFINED
+#endif
+
+#ifndef _TIME32_T_DEFINED
+typedef long __time32_t;
+#define _TIME32_T_DEFINED
+#endif
+
+#ifndef _TIME64_T_DEFINED
+typedef __int64 __time64_t;
+#define _TIME64_T_DEFINED
+#endif
+
+#ifndef _WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short wchar_t;
+#endif
+#define _WCHAR_T_DEFINED
+#endif
+
+#ifndef _WCTYPE_T_DEFINED
+typedef unsigned short  wint_t;
+typedef unsigned short  wctype_t;
+#define _WCTYPE_T_DEFINED
+#endif
diff --git a/include/msvcrt/ctype.h b/include/msvcrt/ctype.h
index 538dca7..bbcdba9 100644
--- a/include/msvcrt/ctype.h
+++ b/include/msvcrt/ctype.h
@@ -7,31 +7,17 @@
  */
 #ifndef __WINE_CTYPE_H
 #define __WINE_CTYPE_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
-
 #ifndef WEOF
 #define WEOF        (wint_t)(0xFFFF)
 #endif
 
-#ifndef _WCTYPE_T_DEFINED
-typedef unsigned short  wint_t;
-typedef unsigned short  wctype_t;
-#define _WCTYPE_T_DEFINED
-#endif
-
 /* ASCII char classification table - binary compatible */
 #define _UPPER        0x0001  /* C1_UPPER */
 #define _LOWER        0x0002  /* C1_LOWER */
diff --git a/include/msvcrt/direct.h b/include/msvcrt/direct.h
index d71aee0..4fc3943 100644
--- a/include/msvcrt/direct.h
+++ b/include/msvcrt/direct.h
@@ -7,9 +7,8 @@
  */
 #ifndef __WINE_DIRECT_H
 #define __WINE_DIRECT_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #include <pshpack8.h>
 
@@ -17,34 +16,6 @@
 extern "C" {
 #endif
 
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
-
-#if defined(__x86_64__) && !defined(_WIN64)
-#define _WIN64
-#endif
-
-#if !defined(_MSC_VER) && !defined(__int64)
-# if defined(_WIN64) && !defined(__MINGW64__)
-#   define __int64 long
-# else
-#   define __int64 long long
-# endif
-#endif
-
-#ifndef _SIZE_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned int size_t;
-#endif
-#define _SIZE_T_DEFINED
-#endif
-
 #ifndef _DISKFREE_T_DEFINED
 #define _DISKFREE_T_DEFINED
 struct _diskfree_t {
diff --git a/include/msvcrt/dos.h b/include/msvcrt/dos.h
index be6d444..c91468d 100644
--- a/include/msvcrt/dos.h
+++ b/include/msvcrt/dos.h
@@ -7,9 +7,8 @@
  */
 #ifndef __WINE_DOS_H
 #define __WINE_DOS_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #include <pshpack8.h>
 
diff --git a/include/msvcrt/eh.h b/include/msvcrt/eh.h
index 2f8281e..cadc8fe 100644
--- a/include/msvcrt/eh.h
+++ b/include/msvcrt/eh.h
@@ -19,9 +19,8 @@
  */
 #ifndef __WINE_EH_H
 #define __WINE_EH_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #if !defined(__cplusplus) && !defined(__WINE_MSVCRT_TEST)
 #error "eh.h is meant only for C++ applications"
diff --git a/include/msvcrt/errno.h b/include/msvcrt/errno.h
index ebb70b5..6214df9 100644
--- a/include/msvcrt/errno.h
+++ b/include/msvcrt/errno.h
@@ -18,9 +18,8 @@
 
 #ifndef __WINE_ERRNO_H
 #define __WINE_ERRNO_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #  define EPERM   1
 #  define ENOENT  2
diff --git a/include/msvcrt/fcntl.h b/include/msvcrt/fcntl.h
index 7a6c6ec..d0ee97b 100644
--- a/include/msvcrt/fcntl.h
+++ b/include/msvcrt/fcntl.h
@@ -7,9 +7,8 @@
  */
 #ifndef __WINE_FCNTL_H
 #define __WINE_FCNTL_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #define _O_RDONLY      0
 #define _O_WRONLY      1
diff --git a/include/msvcrt/float.h b/include/msvcrt/float.h
index 3122093..3bb8746 100644
--- a/include/msvcrt/float.h
+++ b/include/msvcrt/float.h
@@ -8,9 +8,8 @@
 
 #ifndef __WINE_FLOAT_H
 #define __WINE_FLOAT_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/msvcrt/io.h b/include/msvcrt/io.h
index ef4a312..f195d71 100644
--- a/include/msvcrt/io.h
+++ b/include/msvcrt/io.h
@@ -7,31 +7,11 @@
  */
 #ifndef __WINE_IO_H
 #define __WINE_IO_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #include <pshpack8.h>
 
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
-
-#if defined(__x86_64__) && !defined(_WIN64)
-#define _WIN64
-#endif
-
-#if !defined(_MSC_VER) && !defined(__int64)
-# if defined(_WIN64) && !defined(__MINGW64__)
-#   define __int64 long
-# else
-#   define __int64 long long
-# endif
-#endif
-
 /* The following are also defined in dos.h */
 #define _A_NORMAL 0x00000000
 #define _A_RDONLY 0x00000001
@@ -41,11 +21,6 @@
 #define _A_SUBDIR 0x00000010
 #define _A_ARCH   0x00000020
 
-#ifndef _TIME_T_DEFINED
-typedef long time_t;
-#define _TIME_T_DEFINED
-#endif
-
 #ifndef _FSIZE_T_DEFINED
 typedef unsigned long _fsize_t;
 #define _FSIZE_T_DEFINED
diff --git a/include/msvcrt/limits.h b/include/msvcrt/limits.h
index 209f260..938da76 100644
--- a/include/msvcrt/limits.h
+++ b/include/msvcrt/limits.h
@@ -1,6 +1,8 @@
 #ifndef __WINE_LIMITS_H
 #define __WINE_LIMITS_H
 
+#include <crtdefs.h>
+
 #define CHAR_BIT 8
 #define MB_LEN_MAX 2
 
diff --git a/include/msvcrt/locale.h b/include/msvcrt/locale.h
index 72c80fa..aaa3011 100644
--- a/include/msvcrt/locale.h
+++ b/include/msvcrt/locale.h
@@ -19,16 +19,8 @@
  */
 #ifndef __WINE_LOCALE_H
 #define __WINE_LOCALE_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
 
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
+#include <crtdefs.h>
 
 #define LC_ALL                 0
 #define LC_COLLATE             1
diff --git a/include/msvcrt/malloc.h b/include/msvcrt/malloc.h
index b71c4fd..cc60033 100644
--- a/include/msvcrt/malloc.h
+++ b/include/msvcrt/malloc.h
@@ -19,9 +19,8 @@
  */
 #ifndef __WINE_MALLOC_H
 #define __WINE_MALLOC_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 /* heap function constants */
 #define _HEAPEMPTY    -1
@@ -34,27 +33,6 @@
 #define _FREEENTRY     0
 #define _USEDENTRY     1
 
-#if defined(__x86_64__) && !defined(_WIN64)
-#define _WIN64
-#endif
-
-#if !defined(_MSC_VER) && !defined(__int64)
-# if defined(_WIN64) && !defined(__MINGW64__)
-#   define __int64 long
-# else
-#   define __int64 long long
-# endif
-#endif
-
-#ifndef _SIZE_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned int size_t;
-#endif
-#define _SIZE_T_DEFINED
-#endif
-
 #ifndef _HEAPINFO_DEFINED
 #define _HEAPINFO_DEFINED
 typedef struct _heapinfo
diff --git a/include/msvcrt/math.h b/include/msvcrt/math.h
index 4192378..5aaf7ab 100644
--- a/include/msvcrt/math.h
+++ b/include/msvcrt/math.h
@@ -8,9 +8,8 @@
 
 #ifndef __WINE_MATH_H
 #define __WINE_MATH_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #include <pshpack8.h>
 
diff --git a/include/msvcrt/mbctype.h b/include/msvcrt/mbctype.h
index e21d3f3..7a51399 100644
--- a/include/msvcrt/mbctype.h
+++ b/include/msvcrt/mbctype.h
@@ -19,9 +19,8 @@
  */
 #ifndef __WINE_MBCTYPE_H
 #define __WINE_MBCTYPE_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/msvcrt/mbstring.h b/include/msvcrt/mbstring.h
index a9c38cf..f4fa697 100644
--- a/include/msvcrt/mbstring.h
+++ b/include/msvcrt/mbstring.h
@@ -19,33 +19,11 @@
  */
 #ifndef __WINE_MBSTRING_H
 #define __WINE_MBSTRING_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #include <pshpack8.h>
 
-#if defined(__x86_64__) && !defined(_WIN64)
-#define _WIN64
-#endif
-
-#if !defined(_MSC_VER) && !defined(__int64)
-# if defined(_WIN64) && !defined(__MINGW64__)
-#   define __int64 long
-# else
-#   define __int64 long long
-# endif
-#endif
-
-#ifndef _SIZE_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned int size_t;
-#endif
-#define _SIZE_T_DEFINED
-#endif
-
 #ifndef _NLSCMP_DEFINED
 #define _NLSCMPERROR               ((unsigned int)0x7fffffff)
 #define _NLSCMP_DEFINED
diff --git a/include/msvcrt/memory.h b/include/msvcrt/memory.h
index e2f5a37..d501ece 100644
--- a/include/msvcrt/memory.h
+++ b/include/msvcrt/memory.h
@@ -7,30 +7,8 @@
  */
 #ifndef __WINE_MEMORY_H
 #define __WINE_MEMORY_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
 
-#if defined(__x86_64__) && !defined(_WIN64)
-#define _WIN64
-#endif
-
-#if !defined(_MSC_VER) && !defined(__int64)
-# if defined(_WIN64) && !defined(__MINGW64__)
-#   define __int64 long
-# else
-#   define __int64 long long
-# endif
-#endif
-
-#ifndef _SIZE_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned int size_t;
-#endif
-#define _SIZE_T_DEFINED
-#endif
+#include <crtdefs.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/msvcrt/process.h b/include/msvcrt/process.h
index c630671..e9ac135 100644
--- a/include/msvcrt/process.h
+++ b/include/msvcrt/process.h
@@ -7,16 +7,8 @@
  */
 #ifndef __WINE_PROCESS_H
 #define __WINE_PROCESS_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
 
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
+#include <crtdefs.h>
 
 /* Process creation flags */
 #define _P_WAIT    0
@@ -28,26 +20,6 @@
 #define _WAIT_CHILD      0
 #define _WAIT_GRANDCHILD 1
 
-#ifndef __stdcall
-# ifdef __i386__
-#  ifdef __GNUC__
-#   ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */
-#    define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
-#   else
-#    define __stdcall __attribute__((__stdcall__))
-#   endif
-#  elif defined(_MSC_VER)
-    /* Nothing needs to be done. __stdcall already exists */
-#  else
-#   error You need to define __stdcall for your compiler
-#  endif
-# elif defined(__x86_64__) && defined (__GNUC__)
-#  define __stdcall __attribute__((ms_abi))
-# else
-#  define __stdcall
-# endif
-#endif /* __stdcall */
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/include/msvcrt/search.h b/include/msvcrt/search.h
index ff5bf80..6783374 100644
--- a/include/msvcrt/search.h
+++ b/include/msvcrt/search.h
@@ -19,31 +19,8 @@
  */
 #ifndef __WINE_SEARCH_H
 #define __WINE_SEARCH_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
 
-#if defined(__x86_64__) && !defined(_WIN64)
-#define _WIN64
-#endif
-
-#if !defined(_MSC_VER) && !defined(__int64)
-# if defined(_WIN64) && !defined(__MINGW64__)
-#   define __int64 long
-# else
-#   define __int64 long long
-# endif
-#endif
-
-#ifndef _SIZE_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned int size_t;
-#endif
-#define _SIZE_T_DEFINED
-#endif
-
+#include <crtdefs.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/msvcrt/setjmp.h b/include/msvcrt/setjmp.h
index cf3b294..a880739 100644
--- a/include/msvcrt/setjmp.h
+++ b/include/msvcrt/setjmp.h
@@ -19,9 +19,8 @@
  */
 #ifndef __WINE_SETJMP_H
 #define __WINE_SETJMP_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #include <pshpack8.h>
 
diff --git a/include/msvcrt/signal.h b/include/msvcrt/signal.h
index 2155bb4..2ae6355 100644
--- a/include/msvcrt/signal.h
+++ b/include/msvcrt/signal.h
@@ -19,9 +19,8 @@
  */
 #ifndef _WINE_SIGNAL_H
 #define _WINE_SIGNAL_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #define SIGINT   2
 #define SIGILL   4
diff --git a/include/msvcrt/stddef.h b/include/msvcrt/stddef.h
index d0fe7de..c10fad1 100644
--- a/include/msvcrt/stddef.h
+++ b/include/msvcrt/stddef.h
@@ -19,64 +19,8 @@
  */
 #ifndef __WINE_STDDEF_H
 #define __WINE_STDDEF_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
 
-#if defined(__x86_64__) && !defined(_WIN64)
-#define _WIN64
-#endif
-
-#if !defined(_MSC_VER) && !defined(__int64)
-# if defined(_WIN64) && !defined(__MINGW64__)
-#   define __int64 long
-# else
-#   define __int64 long long
-# endif
-#endif
-
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
-
-#ifndef _INTPTR_T_DEFINED
-#ifdef  _WIN64
-typedef __int64 intptr_t;
-#else
-typedef int intptr_t;
-#endif
-#define _INTPTR_T_DEFINED
-#endif
-
-#ifndef _UINTPTR_T_DEFINED
-#ifdef  _WIN64
-typedef unsigned __int64 uintptr_t;
-#else
-typedef unsigned int uintptr_t;
-#endif
-#define _UINTPTR_T_DEFINED
-#endif
-
-#ifndef _PTRDIFF_T_DEFINED
-#ifdef _WIN64
-typedef __int64 ptrdiff_t;
-#else
-typedef int ptrdiff_t;
-#endif
-#define _PTRDIFF_T_DEFINED
-#endif
-
-#ifndef _SIZE_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned int size_t;
-#endif
-#define _SIZE_T_DEFINED
-#endif
+#include <crtdefs.h>
 
 #ifndef NULL
 #ifdef __cplusplus
diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h
index 55d9444..6a5ab65 100644
--- a/include/msvcrt/stdio.h
+++ b/include/msvcrt/stdio.h
@@ -7,27 +7,14 @@
  */
 #ifndef __WINE_STDIO_H
 #define __WINE_STDIO_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
 
-#include <pshpack8.h>
+#include <crtdefs.h>
 
 #ifndef RC_INVOKED
 #include <stdarg.h>
 #endif
 
-#if defined(__x86_64__) && !defined(_WIN64)
-#define _WIN64
-#endif
-
-#if !defined(_MSC_VER) && !defined(__int64)
-# if defined(_WIN64) && !defined(__MINGW64__)
-#   define __int64 long
-# else
-#   define __int64 long long
-# endif
-#endif
+#include <pshpack8.h>
 
 /* file._flag flags */
 #define _IOREAD          0x0001
@@ -89,28 +76,6 @@
 #define _FPOS_T_DEFINED
 #endif
 
-#ifndef _SIZE_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned int size_t;
-#endif
-#define _SIZE_T_DEFINED
-#endif
-
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
-
-#ifndef _WCTYPE_T_DEFINED
-typedef unsigned short  wint_t;
-typedef unsigned short  wctype_t;
-#define _WCTYPE_T_DEFINED
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h
index 0010c33..65c61a2 100644
--- a/include/msvcrt/stdlib.h
+++ b/include/msvcrt/stdlib.h
@@ -7,9 +7,8 @@
  */
 #ifndef __WINE_STDLIB_H
 #define __WINE_STDLIB_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #include <pshpack8.h>
 
@@ -21,14 +20,6 @@
 #endif
 #endif
 
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
-
-
 typedef struct
 {
     float f;
@@ -44,18 +35,6 @@
     unsigned char ld[10];
 } _LDOUBLE;
 
-#if defined(__x86_64__) && !defined(_WIN64)
-#define _WIN64
-#endif
-
-#if !defined(_MSC_VER) && !defined(__int64)
-# if defined(_WIN64) && !defined(__MINGW64__)
-#   define __int64 long
-# else
-#   define __int64 long long
-# endif
-#endif
-
 #define EXIT_SUCCESS        0
 #define EXIT_FAILURE        -1
 #define RAND_MAX            0x7FFF
@@ -79,15 +58,6 @@
     long rem;
 } ldiv_t;
 
-#ifndef _SIZE_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned int size_t;
-#endif
-#define _SIZE_T_DEFINED
-#endif
-
 #define __max(a,b) (((a) > (b)) ? (a) : (b))
 #define __min(a,b) (((a) < (b)) ? (a) : (b))
 #ifndef __cplusplus
diff --git a/include/msvcrt/string.h b/include/msvcrt/string.h
index d70cd23..0a9a7a2 100644
--- a/include/msvcrt/string.h
+++ b/include/msvcrt/string.h
@@ -7,37 +7,8 @@
  */
 #ifndef __WINE_STRING_H
 #define __WINE_STRING_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
 
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
-
-#if defined(__x86_64__) && !defined(_WIN64)
-#define _WIN64
-#endif
-
-#if !defined(_MSC_VER) && !defined(__int64)
-# if defined(_WIN64) && !defined(__MINGW64__)
-#   define __int64 long
-# else
-#   define __int64 long long
-# endif
-#endif
-
-#ifndef _SIZE_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned int size_t;
-#endif
-#define _SIZE_T_DEFINED
-#endif
+#include <crtdefs.h>
 
 #ifndef _NLSCMP_DEFINED
 #define _NLSCMPERROR               ((unsigned int)0x7fffffff)
diff --git a/include/msvcrt/sys/stat.h b/include/msvcrt/sys/stat.h
index 03b1a16..c29daf6 100644
--- a/include/msvcrt/sys/stat.h
+++ b/include/msvcrt/sys/stat.h
@@ -7,20 +7,11 @@
  */
 #ifndef __WINE_SYS_STAT_H
 #define __WINE_SYS_STAT_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
 
-#include <pshpack8.h>
-
+#include <crtdefs.h>
 #include <sys/types.h>
 
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
+#include <pshpack8.h>
 
 #ifndef _DEV_T_DEFINED
 typedef unsigned int _dev_t;
@@ -32,11 +23,6 @@
 #define _INO_T_DEFINED
 #endif
 
-#ifndef _TIME_T_DEFINED
-typedef long time_t;
-#define _TIME_T_DEFINED
-#endif
-
 #ifndef _OFF_T_DEFINED
 typedef int _off_t;
 #define _OFF_T_DEFINED
diff --git a/include/msvcrt/sys/timeb.h b/include/msvcrt/sys/timeb.h
index 253b581..3e2995a 100644
--- a/include/msvcrt/sys/timeb.h
+++ b/include/msvcrt/sys/timeb.h
@@ -19,17 +19,11 @@
  */
 #ifndef __WINE_SYS_TIMEB_H
 #define __WINE_SYS_TIMEB_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #include <pshpack8.h>
 
-#ifndef _TIME_T_DEFINED
-typedef long time_t;
-#define _TIME_T_DEFINED
-#endif
-
 #ifndef _TIMEB_DEFINED
 #define _TIMEB_DEFINED
 struct _timeb
diff --git a/include/msvcrt/sys/types.h b/include/msvcrt/sys/types.h
index dac8d64..a52e00d 100644
--- a/include/msvcrt/sys/types.h
+++ b/include/msvcrt/sys/types.h
@@ -19,21 +19,8 @@
  */
 #ifndef __WINE_SYS_TYPES_H
 #define __WINE_SYS_TYPES_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
 
-#if defined(__x86_64__) && !defined(_WIN64)
-#define _WIN64
-#endif
-
-#if !defined(_MSC_VER) && !defined(__int64)
-# if defined(_WIN64) && !defined(__MINGW64__)
-#   define __int64 long
-# else
-#   define __int64 long long
-# endif
-#endif
+#include <crtdefs.h>
 
 #ifndef _DEV_T_DEFINED
 typedef unsigned int   _dev_t;
@@ -55,16 +42,6 @@
 #define _OFF_T_DEFINED
 #endif
 
-#ifndef _TIME_T_DEFINED
-typedef long time_t;
-#define _TIME_T_DEFINED
-#endif
-
-#ifndef _TIME64_T_DEFINED
-#define _TIME64_T_DEFINED
-typedef __int64 __time64_t;
-#endif
-
 #ifndef _BSDTYPES_DEFINED
 typedef unsigned char u_char;
 typedef unsigned short u_short;
diff --git a/include/msvcrt/sys/utime.h b/include/msvcrt/sys/utime.h
index 65a855c..f1315b1 100644
--- a/include/msvcrt/sys/utime.h
+++ b/include/msvcrt/sys/utime.h
@@ -19,24 +19,11 @@
  */
 #ifndef __WINE_SYS_UTIME_H
 #define __WINE_SYS_UTIME_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #include <pshpack8.h>
 
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
-
-#ifndef _TIME_T_DEFINED
-typedef long time_t;
-#define _TIME_T_DEFINED
-#endif
-
 #ifndef _UTIMBUF_DEFINED
 #define _UTIMBUF_DEFINED
 struct _utimbuf
diff --git a/include/msvcrt/time.h b/include/msvcrt/time.h
index 9b9a516..1044622 100644
--- a/include/msvcrt/time.h
+++ b/include/msvcrt/time.h
@@ -19,45 +19,11 @@
  */
 #ifndef __WINE_TIME_H
 #define __WINE_TIME_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #include <pshpack8.h>
 
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
-
-#if defined(__x86_64__) && !defined(_WIN64)
-#define _WIN64
-#endif
-
-#if !defined(_MSC_VER) && !defined(__int64)
-# if defined(_WIN64) && !defined(__MINGW64__)
-#   define __int64 long
-# else
-#   define __int64 long long
-# endif
-#endif
-
-#ifndef _SIZE_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned int size_t;
-#endif
-#define _SIZE_T_DEFINED
-#endif
-
-#ifndef _TIME_T_DEFINED
-typedef long time_t;
-#define _TIME_T_DEFINED
-#endif
-
 #ifndef _CLOCK_T_DEFINED
 typedef long clock_t;
 #define _CLOCK_T_DEFINED
diff --git a/include/msvcrt/wchar.h b/include/msvcrt/wchar.h
index 4e4892f..dcefc0f 100644
--- a/include/msvcrt/wchar.h
+++ b/include/msvcrt/wchar.h
@@ -7,25 +7,16 @@
  */
 #ifndef __WINE_WCHAR_H
 #define __WINE_WCHAR_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
+#include <stdarg.h>
 
 #include <pshpack8.h>
 
-#include <stdarg.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
-
 #ifndef NULL
 #ifdef __cplusplus
 #define NULL  0
@@ -37,18 +28,6 @@
 #define WCHAR_MIN 0
 #define WCHAR_MAX ((wchar_t)-1)
 
-#if defined(__x86_64__) && !defined(_WIN64)
-#define _WIN64
-#endif
-
-#if !defined(_MSC_VER) && !defined(__int64)
-# if defined(_WIN64) && !defined(__MINGW64__)
-#   define __int64 long
-# else
-#   define __int64 long long
-# endif
-#endif
-
 #ifndef DECLSPEC_ALIGN
 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
 #  define DECLSPEC_ALIGN(x) __declspec(align(x))
@@ -61,21 +40,6 @@
 
 typedef int mbstate_t;
 
-#ifndef _SIZE_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 size_t;
-#else
-typedef unsigned int size_t;
-#endif
-#define _SIZE_T_DEFINED
-#endif
-
-#ifndef _WCTYPE_T_DEFINED
-typedef unsigned short  wint_t;
-typedef unsigned short  wctype_t;
-#define _WCTYPE_T_DEFINED
-#endif
-
 #ifndef WEOF
 #define WEOF        (wint_t)(0xFFFF)
 #endif
@@ -100,16 +64,6 @@
 #define _OFF_T_DEFINED
 #endif
 
-#ifndef _TIME_T_DEFINED
-typedef long time_t;
-#define _TIME_T_DEFINED
-#endif
-
-#ifndef _TIME64_T_DEFINED
-#define _TIME64_T_DEFINED
-typedef __int64 __time64_t;
-#endif
-
 #ifndef _TM_DEFINED
 #define _TM_DEFINED
 struct tm {
diff --git a/include/msvcrt/wctype.h b/include/msvcrt/wctype.h
index 0f70e4d..feebb77 100644
--- a/include/msvcrt/wctype.h
+++ b/include/msvcrt/wctype.h
@@ -19,19 +19,11 @@
  */
 #ifndef __WINE_WCTYPE_H
 #define __WINE_WCTYPE_H
-#ifndef __WINE_USE_MSVCRT
-#define __WINE_USE_MSVCRT
-#endif
+
+#include <crtdefs.h>
 
 #include <pshpack8.h>
 
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
-typedef unsigned short wchar_t;
-#endif
-#endif
-
 /* ASCII char classification table - binary compatible */
 #define _UPPER        0x0001  /* C1_UPPER */
 #define _LOWER        0x0002  /* C1_LOWER */
@@ -48,12 +40,6 @@
 #define WEOF        (wint_t)(0xFFFF)
 #endif
 
-#ifndef _WCTYPE_T_DEFINED
-typedef unsigned short  wint_t;
-typedef unsigned short  wctype_t;
-#define _WCTYPE_T_DEFINED
-#endif
-
 /* FIXME: there's something to do with __p__pctype and __p__pwctype */