Avoid including other headers from the msvcrt headers, duplicate some
definitions instead like Windows does.
Always define wchar_t (suggested by Dimitrie O. Paun), and use wchar_t
everywhere instead of WCHAR to avoid depending on Windows headers.

diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 41a5e6b..6ac4fd7 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -46,6 +46,7 @@
 #include "msvcrt/sys/utime.h"
 #include "msvcrt/time.h"
 #include "msvcrt/share.h"
+#include "msvcrt/wctype.h"
 
 #include "wine/debug.h"
 
diff --git a/dlls/msvcrt/misc.c b/dlls/msvcrt/misc.c
index ea917f6..d292b6f 100644
--- a/dlls/msvcrt/misc.c
+++ b/dlls/msvcrt/misc.c
@@ -60,7 +60,7 @@
  */
 void* _lfind(const void* match, const void* start,
              unsigned int* array_size, unsigned int elem_size,
-             MSVCRT_compar_fn_t cf)
+             int (*cf)(const void*,const void*) )
 {
   unsigned int size = *array_size;
   if (size)
@@ -78,7 +78,7 @@
  */
 void* _lsearch(const void* match, void* start,
                unsigned int* array_size, unsigned int elem_size,
-               MSVCRT_compar_fn_t cf)
+               int (*cf)(const void*,const void*) )
 {
   unsigned int size = *array_size;
   if (size)
diff --git a/dlls/msvcrt/scanf.c b/dlls/msvcrt/scanf.c
index 003eb7a..a4e3b82 100644
--- a/dlls/msvcrt/scanf.c
+++ b/dlls/msvcrt/scanf.c
@@ -28,6 +28,8 @@
 #include "msvcrt.h"
 #include "msvcrt/conio.h"
 #include "msvcrt/io.h"
+#include "msvcrt/stdio.h"
+#include "msvcrt/wctype.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
diff --git a/include/msvcrt/ctype.h b/include/msvcrt/ctype.h
index 1b869fc..1e6505e 100644
--- a/include/msvcrt/ctype.h
+++ b/include/msvcrt/ctype.h
@@ -9,13 +9,53 @@
 #define __WINE_CTYPE_H
 #define __WINE_USE_MSVCRT
 
-#include "msvcrt/wctype.h"
-
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
+#endif
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
+#endif
+#endif
+
+#ifndef USE_MSVCRT_PREFIX
+# ifndef WEOF
+#  define WEOF        (wint_t)(0xFFFF)
+# endif
+#else
+# ifndef MSVCRT_WEOF
+#  define MSVCRT_WEOF (MSVCRT_wint_t)(0xFFFF)
+# endif
+#endif /* USE_MSVCRT_PREFIX */
+
+#ifndef MSVCRT_WCTYPE_T_DEFINED
+typedef MSVCRT(wchar_t) MSVCRT(wint_t);
+typedef MSVCRT(wchar_t) MSVCRT(wctype_t);
+#define MSVCRT_WCTYPE_T_DEFINED
+#endif
+
+/* ASCII char classification table - binary compatible */
+#define _UPPER        0x0001  /* C1_UPPER */
+#define _LOWER        0x0002  /* C1_LOWER */
+#define _DIGIT        0x0004  /* C1_DIGIT */
+#define _SPACE        0x0008  /* C1_SPACE */
+#define _PUNCT        0x0010  /* C1_PUNCT */
+#define _CONTROL      0x0020  /* C1_CNTRL */
+#define _BLANK        0x0040  /* C1_BLANK */
+#define _HEX          0x0080  /* C1_XDIGIT */
+#define _LEADBYTE     0x8000
+#define _ALPHA       (0x0100|_UPPER|_LOWER)  /* (C1_ALPHA|_UPPER|_LOWER) */
+
 int MSVCRT(__isascii)(int);
 int MSVCRT(__iscsym)(int);
 int MSVCRT(__iscsymf)(int);
@@ -37,6 +77,27 @@
 int MSVCRT(tolower)(int);
 int MSVCRT(toupper)(int);
 
+#ifndef MSVCRT_WCTYPE_DEFINED
+#define MSVCRT_WCTYPE_DEFINED
+int MSVCRT(is_wctype)(MSVCRT(wint_t),MSVCRT(wctype_t));
+int MSVCRT(isleadbyte)(int);
+int MSVCRT(iswalnum)(MSVCRT(wint_t));
+int MSVCRT(iswalpha)(MSVCRT(wint_t));
+int MSVCRT(iswascii)(MSVCRT(wint_t));
+int MSVCRT(iswcntrl)(MSVCRT(wint_t));
+int MSVCRT(iswctype)(MSVCRT(wint_t),MSVCRT(wctype_t));
+int MSVCRT(iswdigit)(MSVCRT(wint_t));
+int MSVCRT(iswgraph)(MSVCRT(wint_t));
+int MSVCRT(iswlower)(MSVCRT(wint_t));
+int MSVCRT(iswprint)(MSVCRT(wint_t));
+int MSVCRT(iswpunct)(MSVCRT(wint_t));
+int MSVCRT(iswspace)(MSVCRT(wint_t));
+int MSVCRT(iswupper)(MSVCRT(wint_t));
+int MSVCRT(iswxdigit)(MSVCRT(wint_t));
+MSVCRT(wchar_t) MSVCRT(towlower)(MSVCRT(wchar_t));
+MSVCRT(wchar_t) MSVCRT(towupper)(MSVCRT(wchar_t));
+#endif /* MSVCRT_WCTYPE_DEFINED */
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/msvcrt/direct.h b/include/msvcrt/direct.h
index 41f9ace..3e75fa5 100644
--- a/include/msvcrt/direct.h
+++ b/include/msvcrt/direct.h
@@ -9,14 +9,40 @@
 #define __WINE_DIRECT_H
 #define __WINE_USE_MSVCRT
 
-#include "winnt.h"
-#include "msvcrt/dos.h"            /* For _getdiskfree & co */
-
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
+#endif
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
+#endif
+#endif
+
+#ifndef MSVCRT_SIZE_T_DEFINED
+typedef unsigned int MSVCRT(size_t);
+#define MSVCRT_SIZE_T_DEFINED
+#endif
+
+#ifndef MSVCRT_DISKFREE_T_DEFINED
+#define MSVCRT_DISKFREE_T_DEFINED
+struct _diskfree_t {
+  unsigned int total_clusters;
+  unsigned int avail_clusters;
+  unsigned int sectors_per_cluster;
+  unsigned int bytes_per_sector;
+};
+#endif /* MSVCRT_DISKFREE_T_DEFINED */
+
 int         _chdir(const char*);
 int         _chdrive(int);
 char*       _getcwd(char*,int);
@@ -26,11 +52,14 @@
 int         _mkdir(const char*);
 int         _rmdir(const char*);
 
-int         _wchdir(const WCHAR*);
-WCHAR*      _wgetcwd(WCHAR*,int);
-WCHAR*      _wgetdcwd(int,WCHAR*,int);
-int         _wmkdir(const WCHAR*);
-int         _wrmdir(const WCHAR*);
+#ifndef MSVCRT_WDIRECT_DEFINED
+#define MSVCRT_WDIRECT_DEFINED
+int              _wchdir(const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)* _wgetcwd(MSVCRT(wchar_t)*,int);
+MSVCRT(wchar_t)* _wgetdcwd(int,MSVCRT(wchar_t)*,int);
+int              _wmkdir(const MSVCRT(wchar_t)*);
+int              _wrmdir(const MSVCRT(wchar_t)*);
+#endif /* MSVCRT_WDIRECT_DEFINED */
 
 #ifdef __cplusplus
 }
diff --git a/include/msvcrt/dos.h b/include/msvcrt/dos.h
index c7883cb..6f948fb 100644
--- a/include/msvcrt/dos.h
+++ b/include/msvcrt/dos.h
@@ -19,12 +19,15 @@
 #define _A_SUBDIR 0x00000010
 #define _A_ARCH   0x00000020
 
+#ifndef MSVCRT_DISKFREE_T_DEFINED
+#define MSVCRT_DISKFREE_T_DEFINED
 struct _diskfree_t {
   unsigned int total_clusters;
   unsigned int avail_clusters;
   unsigned int sectors_per_cluster;
   unsigned int bytes_per_sector;
 };
+#endif /* MSVCRT_DISKFREE_T_DEFINED */
 
 
 #ifdef __cplusplus
diff --git a/include/msvcrt/eh.h b/include/msvcrt/eh.h
index 39103a5..94a8cbc 100644
--- a/include/msvcrt/eh.h
+++ b/include/msvcrt/eh.h
@@ -25,10 +25,12 @@
 #error "eh.h is meant only for C++ applications"
 #endif
 
-#ifdef USE_MSVCRT_PREFIX
-#define MSVCRT(x)    MSVCRT_##x
-#else
-#define MSVCRT(x)    x
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
 #endif
 
 struct _EXCEPTION_POINTERS;
diff --git a/include/msvcrt/errno.h b/include/msvcrt/errno.h
index 1908834..d37b7ce 100644
--- a/include/msvcrt/errno.h
+++ b/include/msvcrt/errno.h
@@ -20,6 +20,14 @@
 #define __WINE_ERRNO_H
 #define __WINE_USE_MSVCRT
 
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
+#endif
+
 #ifdef USE_MSVCRT_PREFIX
 
 #  define MSVCRT_EPERM   1
@@ -104,4 +112,12 @@
 
 #endif /* USE_MSVCRT_PREFIX */
 
+extern int* MSVCRT(_errno)(void);
+
+#ifndef USE_MSVCRT_PREFIX
+# define errno        (*_errno())
+#else
+# define MSVCRT_errno (*MSVCRT__errno())
+#endif
+
 #endif  /* __WINE_ERRNO_H */
diff --git a/include/msvcrt/io.h b/include/msvcrt/io.h
index a01a052..f76e22b 100644
--- a/include/msvcrt/io.h
+++ b/include/msvcrt/io.h
@@ -9,8 +9,26 @@
 #define __WINE_IO_H
 #define __WINE_USE_MSVCRT
 
-#include "msvcrt/stdio.h"          /* For FILENAME_MAX */
-#include "msvcrt/sys/types.h"      /* For time_t */
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
+#endif
+
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
+#endif
+#endif
+
+#ifndef _MSC_VER
+# ifndef __int64
+#  define __int64 long long
+# endif
+#endif
 
 /* The following are also defined in dos.h */
 #define _A_NORMAL 0x00000000
@@ -21,8 +39,18 @@
 #define _A_SUBDIR 0x00000010
 #define _A_ARCH   0x00000020
 
-typedef unsigned long _fsize_t;
+#ifndef MSVCRT_TIME_T_DEFINED
+typedef long MSVCRT(time_t);
+#define MSVCRT_TIME_T_DEFINED
+#endif
 
+#ifndef MSVCRT_FSIZE_T_DEFINED
+typedef unsigned long _fsize_t;
+#define MSVCRT_FSIZE_T_DEFINED
+#endif
+
+#ifndef MSVCRT_FINDDATA_T_DEFINED
+#define MSVCRT_FINDDATA_T_DEFINED
 struct _finddata_t
 {
   unsigned attrib;
@@ -30,7 +58,7 @@
   MSVCRT(time_t) time_access;
   MSVCRT(time_t) time_write;
   _fsize_t       size;
-  char           name[MSVCRT(FILENAME_MAX)];
+  char           name[260];
 };
 
 struct _finddatai64_t
@@ -40,16 +68,19 @@
   MSVCRT(time_t) time_access;
   MSVCRT(time_t) time_write;
   __int64        size;
-  char           name[MSVCRT(FILENAME_MAX)];
+  char           name[260];
 };
+#endif /* MSVCRT_FINDDATA_T_DEFINED */
 
+#ifndef MSVCRT_WFINDDATA_T_DEFINED
+#define MSVCRT_WFINDDATA_T_DEFINED
 struct _wfinddata_t {
   unsigned attrib;
   MSVCRT(time_t) time_create;
   MSVCRT(time_t) time_access;
   MSVCRT(time_t) time_write;
   _fsize_t       size;
-  WCHAR          name[MSVCRT(FILENAME_MAX)];
+  MSVCRT(wchar_t) name[260];
 };
 
 struct _wfinddatai64_t {
@@ -58,9 +89,9 @@
   MSVCRT(time_t) time_access;
   MSVCRT(time_t) time_write;
   __int64        size;
-  WCHAR          name[MSVCRT(FILENAME_MAX)];
+  MSVCRT(wchar_t) name[260];
 };
-
+#endif /* MSVCRT_WFINDDATA_T_DEFINED */
 
 #ifdef __cplusplus
 extern "C" {
@@ -103,19 +134,21 @@
 int         MSVCRT(remove)(const char*);
 int         MSVCRT(rename)(const char*,const char*);
 
-int         _waccess(const WCHAR*,int);
-int         _wchmod(const WCHAR*,int);
-int         _wcreat(const WCHAR*,int);
-long        _wfindfirst(const WCHAR*,struct _wfinddata_t*);
-long        _wfindfirsti64(const WCHAR*, struct _wfinddatai64_t*);
+#ifndef MSVCRT_WIO_DEFINED
+#define MSVCRT_WIO_DEFINED
+int         _waccess(const MSVCRT(wchar_t)*,int);
+int         _wchmod(const MSVCRT(wchar_t)*,int);
+int         _wcreat(const MSVCRT(wchar_t)*,int);
+long        _wfindfirst(const MSVCRT(wchar_t)*,struct _wfinddata_t*);
+long        _wfindfirsti64(const MSVCRT(wchar_t)*, struct _wfinddatai64_t*);
 int         _wfindnext(long,struct _wfinddata_t*);
 int         _wfindnexti64(long, struct _wfinddatai64_t*);
-WCHAR*      _wmktemp(WCHAR*);
-int         _wopen(const WCHAR*,int,...);
-int         _wrename(const WCHAR*,const WCHAR*);
-int         _wsopen(const WCHAR*,int,int,...);
-int         _wunlink(const WCHAR*);
-
+MSVCRT(wchar_t)*_wmktemp(MSVCRT(wchar_t)*);
+int         _wopen(const MSVCRT(wchar_t)*,int,...);
+int         _wrename(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+int         _wsopen(const MSVCRT(wchar_t)*,int,int,...);
+int         _wunlink(const MSVCRT(wchar_t)*);
+#endif /* MSVCRT_WIO_DEFINED */
 
 #ifdef __cplusplus
 }
diff --git a/include/msvcrt/locale.h b/include/msvcrt/locale.h
index f57a073..fa72243 100644
--- a/include/msvcrt/locale.h
+++ b/include/msvcrt/locale.h
@@ -21,12 +21,19 @@
 #define __WINE_LOCALE_H
 #define __WINE_USE_MSVCRT
 
-#include "winnt.h"
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
+#endif
 
-#ifdef USE_MSVCRT_PREFIX
-#define MSVCRT(x)    MSVCRT_##x
-#else
-#define MSVCRT(x)    x
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
+#endif
 #endif
 
 #ifdef USE_MSVCRT_PREFIX
@@ -49,6 +56,8 @@
 #define LC_MAX                 LC_TIME
 #endif /* USE_MSVCRT_PREFIX */
 
+#ifndef MSVCRT_LCONV_DEFINED
+#define MSVCRT_LCONV_DEFINED
 struct MSVCRT(lconv)
 {
     char* decimal_point;
@@ -70,6 +79,7 @@
     char p_sign_posn;
     char n_sign_posn;
 };
+#endif /* MSVCRT_LCONV_DEFINED */
 
 
 #ifdef __cplusplus
@@ -79,7 +89,10 @@
 char*       MSVCRT(setlocale)(int,const char*);
 struct MSVCRT(lconv)* MSVCRT(localeconv)(void);
 
-WCHAR*      _wsetlocale(int,const WCHAR*);
+#ifndef MSVCRT_WLOCALE_DEFINED
+#define MSVCRT_WLOCALE_DEFINED
+MSVCRT(wchar_t)* _wsetlocale(int,const MSVCRT(wchar_t)*);
+#endif /* MSVCRT_WLOCALE_DEFINED */
 
 #ifdef __cplusplus
 }
diff --git a/include/msvcrt/malloc.h b/include/msvcrt/malloc.h
index 54fd99b..8eba071 100644
--- a/include/msvcrt/malloc.h
+++ b/include/msvcrt/malloc.h
@@ -21,13 +21,14 @@
 #define __WINE_MALLOC_H
 #define __WINE_USE_MSVCRT
 
-#ifdef USE_MSVCRT_PREFIX
-#define MSVCRT(x)    MSVCRT_##x
-#else
-#define MSVCRT(x)    x
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
 #endif
 
-
 /* heap function constants */
 #define _HEAPEMPTY    -1
 #define _HEAPOK       -2
@@ -45,13 +46,15 @@
 #define MSVCRT_SIZE_T_DEFINED
 #endif
 
+#ifndef MSVCRT_HEAPINFO_DEFINED
+#define MSVCRT_HEAPINFO_DEFINED
 typedef struct _heapinfo
 {
   int*           _pentry;
   MSVCRT(size_t) _size;
   int            _useflag;
 } _HEAPINFO;
-
+#endif /* MSVCRT_HEAPINFO_DEFINED */
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/msvcrt/mbctype.h b/include/msvcrt/mbctype.h
index 336f4c4..0409dd8 100644
--- a/include/msvcrt/mbctype.h
+++ b/include/msvcrt/mbctype.h
@@ -37,13 +37,17 @@
 int         _ismbbkana(unsigned int);
 int         _ismbbkprint(unsigned int);
 int         _ismbbkpunct(unsigned int);
-int         _ismbblead(unsigned int);
 int         _ismbbprint(unsigned int);
 int         _ismbbpunct(unsigned int);
+int         _setmbcp(int);
+
+#ifndef MSVCRT_MBLEADTRAIL_DEFINED
+#define MSVCRT_MBLEADTRAIL_DEFINED
+int         _ismbblead(unsigned int);
 int         _ismbbtrail(unsigned int);
 int         _ismbslead(const unsigned char*,const unsigned char*);
 int         _ismbstrail(const unsigned char*,const unsigned char*);
-int         _setmbcp(int);
+#endif /* MSVCRT_MBLEADTRAIL_DEFINED */
 
 #ifdef __cplusplus
 }
diff --git a/include/msvcrt/mbstring.h b/include/msvcrt/mbstring.h
index bef7396..cdbebf7 100644
--- a/include/msvcrt/mbstring.h
+++ b/include/msvcrt/mbstring.h
@@ -21,12 +21,12 @@
 #define __WINE_MBSTRING_H
 #define __WINE_USE_MSVCRT
 
-#include "msvcrt/mbctype.h"
-
-#ifdef USE_MSVCRT_PREFIX
-#define MSVCRT(x)    MSVCRT_##x
-#else
-#define MSVCRT(x)    x
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
 #endif
 
 #ifndef MSVCRT_SIZE_T_DEFINED
@@ -34,8 +34,10 @@
 #define MSVCRT_SIZE_T_DEFINED
 #endif
 
+#ifndef MSVCRT_NLSCMP_DEFINED
 #define _NLSCMPERROR               ((unsigned int)0x7fffffff)
-
+#define MSVCRT_NLSCMP_DEFINED
+#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -114,6 +116,14 @@
 unsigned char* _mbstok(unsigned char*,const unsigned char*);
 unsigned char* _mbsupr(unsigned char*);
 
+#ifndef MSVCRT_MBLEADTRAIL_DEFINED
+#define MSVCRT_MBLEADTRAIL_DEFINED
+int         _ismbblead(unsigned int);
+int         _ismbbtrail(unsigned int);
+int         _ismbslead(const unsigned char*,const unsigned char*);
+int         _ismbstrail(const unsigned char*,const unsigned char*);
+#endif /* MSVCRT_MBLEADTRAIL_DEFINED */
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/msvcrt/process.h b/include/msvcrt/process.h
index 50d85ce..376ecc9 100644
--- a/include/msvcrt/process.h
+++ b/include/msvcrt/process.h
@@ -9,14 +9,20 @@
 #define __WINE_PROCESS_H
 #define __WINE_USE_MSVCRT
 
-#include "winnt.h"
-
-#ifdef USE_MSVCRT_PREFIX
-#define MSVCRT(x)    MSVCRT_##x
-#else
-#define MSVCRT(x)    x
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
 #endif
 
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
+#endif
+#endif
 
 /* Process creation flags */
 #define _P_WAIT    0
@@ -66,23 +72,26 @@
 void        MSVCRT(exit)(int);
 int         MSVCRT(system)(const char*);
 
-int         _wexecl(const WCHAR*,const WCHAR*,...);
-int         _wexecle(const WCHAR*,const WCHAR*,...);
-int         _wexeclp(const WCHAR*,const WCHAR*,...);
-int         _wexeclpe(const WCHAR*,const WCHAR*,...);
-int         _wexecv(const WCHAR*,const WCHAR* const *);
-int         _wexecve(const WCHAR*,const WCHAR* const *,const WCHAR* const *);
-int         _wexecvp(const WCHAR*,const WCHAR* const *);
-int         _wexecvpe(const WCHAR*,const WCHAR* const *,const WCHAR* const *);
-int         _wspawnl(int,const WCHAR*,const WCHAR*,...);
-int         _wspawnle(int,const WCHAR*,const WCHAR*,...);
-int         _wspawnlp(int,const WCHAR*,const WCHAR*,...);
-int         _wspawnlpe(int,const WCHAR*,const WCHAR*,...);
-int         _wspawnv(int,const WCHAR*,const WCHAR* const *);
-int         _wspawnve(int,const WCHAR*,const WCHAR* const *,const WCHAR* const *);
-int         _wspawnvp(int,const WCHAR*,const WCHAR* const *);
-int         _wspawnvpe(int,const WCHAR*,const WCHAR* const *,const WCHAR* const *);
-int         _wsystem(const WCHAR*);
+#ifndef MSVCRT_WPROCESS_DEFINED
+#define MSVCRT_WPROCESS_DEFINED
+int         _wexecl(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wexecle(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wexeclp(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wexeclpe(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wexecv(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *);
+int         _wexecve(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *,const MSVCRT(wchar_t)* const *);
+int         _wexecvp(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *);
+int         _wexecvpe(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *,const MSVCRT(wchar_t)* const *);
+int         _wspawnl(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wspawnle(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wspawnlp(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wspawnlpe(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wspawnv(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *);
+int         _wspawnve(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *,const MSVCRT(wchar_t)* const *);
+int         _wspawnvp(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *);
+int         _wspawnvpe(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *,const MSVCRT(wchar_t)* const *);
+int         _wsystem(const MSVCRT(wchar_t)*);
+#endif /* MSVCRT_WPROCESS_DEFINED */
 
 #ifdef __cplusplus
 }
diff --git a/include/msvcrt/search.h b/include/msvcrt/search.h
index ff54a37..9b70205 100644
--- a/include/msvcrt/search.h
+++ b/include/msvcrt/search.h
@@ -21,13 +21,14 @@
 #define __WINE_SEARCH_H
 #define __WINE_USE_MSVCRT
 
-#ifdef USE_MSVCRT_PREFIX
-#define MSVCRT(x)    MSVCRT_##x
-#else
-#define MSVCRT(x)    x
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
 #endif
 
-
 #ifndef MSVCRT_SIZE_T_DEFINED
 typedef unsigned int MSVCRT(size_t);
 #define MSVCRT_SIZE_T_DEFINED
@@ -38,13 +39,14 @@
 extern "C" {
 #endif
 
-typedef int (*MSVCRT_compar_fn_t)(const void*,const void*);
-
-void*       _lfind(const void*,const void*,unsigned int*,unsigned int,MSVCRT_compar_fn_t);
-void*       _lsearch(const void*,void*,unsigned int*,unsigned int,MSVCRT_compar_fn_t);
-
-void*       MSVCRT(bsearch)(const void*,const void*,MSVCRT(size_t),MSVCRT(size_t),MSVCRT_compar_fn_t);
-void        MSVCRT(qsort)(void*,MSVCRT(size_t),MSVCRT(size_t),MSVCRT_compar_fn_t);
+void*       _lfind(const void*,const void*,unsigned int*,unsigned int,
+                   int (*)(const void*,const void*));
+void*       _lsearch(const void*,void*,unsigned int*,unsigned int,
+                     int (*)(const void*,const void*));
+void*       MSVCRT(bsearch)(const void*,const void*,MSVCRT(size_t),MSVCRT(size_t),
+                            int (*)(const void*,const void*));
+void        MSVCRT(qsort)(void*,MSVCRT(size_t),MSVCRT(size_t),
+                          int (*)(const void*,const void*));
 
 #ifdef __cplusplus
 }
diff --git a/include/msvcrt/setjmp.h b/include/msvcrt/setjmp.h
index 28391f2..1d1199c 100644
--- a/include/msvcrt/setjmp.h
+++ b/include/msvcrt/setjmp.h
@@ -21,10 +21,12 @@
 #define __WINE_SETJMP_H
 #define __WINE_USE_MSVCRT
 
-#ifdef USE_MSVCRT_PREFIX
-#define MSVCRT(x)    MSVCRT_##x
-#else
-#define MSVCRT(x)    x
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
 #endif
 
 
diff --git a/include/msvcrt/stddef.h b/include/msvcrt/stddef.h
index c080da6..17ff207 100644
--- a/include/msvcrt/stddef.h
+++ b/include/msvcrt/stddef.h
@@ -21,21 +21,38 @@
 #define __WINE_STDDEF_H
 #define __WINE_USE_MSVCRT
 
-#include "winnt.h"
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
+#endif
 
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
+#endif
+#endif
 
+#ifndef MSVCRT_PTRDIFF_T_DEFINED
 typedef int ptrdiff_t;
+#define MSVCRT_PTRDIFF_T_DEFINED
+#endif
 
 #ifndef MSVCRT_SIZE_T_DEFINED
 typedef unsigned int MSVCRT(size_t);
 #define MSVCRT_SIZE_T_DEFINED
 #endif
 
-/* Best to leave this one alone: wchar_t */
-#ifdef WINE_DEFINE_WCHAR_T
-typedef unsigned short wchar_t;
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL  0
+#else
+#define NULL  ((void *)0)
 #endif
-
+#endif
 
 #define offsetof(s,m)       (size_t)&(((s*)NULL)->m)
 
diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h
index 94e8485..cd6e503 100644
--- a/include/msvcrt/stdio.h
+++ b/include/msvcrt/stdio.h
@@ -12,8 +12,14 @@
 #ifndef RC_INVOKED
 #include <stdarg.h>
 #endif
-#include "msvcrt/wctype.h"         /* For wint_t */
 
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
+#endif
 
 /* file._flag flags */
 #ifndef USE_MSVCRT_PREFIX
@@ -36,6 +42,13 @@
 #define MSVCRT__IOAPPEND 0x0200
 #endif /* USE_MSVCRT_PREFIX */
 
+#ifndef NULL
+#ifdef  __cplusplus
+#define NULL  0
+#else
+#define NULL  ((void *)0)
+#endif
+#endif
 
 #ifndef USE_MSVCRT_PREFIX
 
@@ -76,6 +89,8 @@
 
 #endif /* USE_MSVCRT_PREFIX */
 
+#ifndef MSVCRT_FILE_DEFINED
+#define MSVCRT_FILE_DEFINED
 typedef struct MSVCRT(_iobuf)
 {
   char* _ptr;
@@ -87,21 +102,40 @@
   int   _bufsiz;
   char* _tmpfname;
 } MSVCRT(FILE);
+#endif  /* MSVCRT_FILE_DEFINED */
 
+#ifndef MSVCRT_FPOS_T_DEFINED
 typedef long MSVCRT(fpos_t);
+#define MSVCRT_FPOS_T_DEFINED
+#endif
 
 #ifndef MSVCRT_SIZE_T_DEFINED
 typedef unsigned int MSVCRT(size_t);
 #define MSVCRT_SIZE_T_DEFINED
 #endif
 
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
+#endif
+#endif
+
+#ifndef MSVCRT_WCTYPE_T_DEFINED
+typedef MSVCRT(wchar_t) MSVCRT(wint_t);
+typedef MSVCRT(wchar_t) MSVCRT(wctype_t);
+#define MSVCRT_WCTYPE_T_DEFINED
+#endif
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#ifndef MSVCRT_STDIO_DEFINED
 MSVCRT(FILE)*        MSVCRT(__p__iob)(void);
 #define _iob               (__p__iob())
+#endif /* MSVCRT_STDIO_DEFINED */
+
 #ifndef USE_MSVCRT_PREFIX
 #define stdin              (_iob+STDIN_FILENO)
 #define stdout             (_iob+STDOUT_FILENO)
@@ -112,7 +146,8 @@
 #define MSVCRT_stderr      (_iob+STDERR_FILENO)
 #endif /* USE_MSVCRT_PREFIX, __WINE__ */
 
-
+#ifndef MSVCRT_STDIO_DEFINED
+#define MSVCRT_STDIO_DEFINED
 int         _fcloseall(void);
 MSVCRT(FILE)* _fdopen(int,const char*);
 int         _fgetchar(void);
@@ -176,43 +211,48 @@
 int         MSVCRT(vprintf)(const char*,va_list);
 int         MSVCRT(vsprintf)(char*,const char*,va_list);
 
-MSVCRT(wint_t) _fgetwchar(void);
-MSVCRT(wint_t) _fputwchar(MSVCRT(wint_t));
-WCHAR*      _getws(WCHAR*);
-int         _putws(const WCHAR*);
-int         _snwprintf(WCHAR*,MSVCRT(size_t),const WCHAR*,...);
-int         _vsnwprintf(WCHAR*,MSVCRT(size_t),const WCHAR*,va_list);
-MSVCRT(FILE)* _wfdopen(int,const WCHAR*);
-MSVCRT(FILE)* _wfopen(const WCHAR*,const WCHAR*);
-MSVCRT(FILE)* _wfreopen(const WCHAR*,const WCHAR*,MSVCRT(FILE)*);
-MSVCRT(FILE)* _wfsopen(const WCHAR*,const WCHAR*,int);
-void        _wperror(const WCHAR*);
-MSVCRT(FILE)* _wpopen(const WCHAR*,const WCHAR*);
-int         _wremove(const WCHAR*);
-WCHAR*      _wtempnam(const WCHAR*,const WCHAR*);
-WCHAR*      _wtmpnam(WCHAR*);
+#ifndef MSVCRT_WSTDIO_DEFINED
+#define MSVCRT_WSTDIO_DEFINED
+MSVCRT(wint_t)  _fgetwchar(void);
+MSVCRT(wint_t)  _fputwchar(MSVCRT(wint_t));
+MSVCRT(wchar_t)*_getws(MSVCRT(wchar_t)*);
+int             _putws(const MSVCRT(wchar_t)*);
+int             _snwprintf(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,...);
+int             _vsnwprintf(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,va_list);
+MSVCRT(FILE)*   _wfdopen(int,const MSVCRT(wchar_t)*);
+MSVCRT(FILE)*   _wfopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(FILE)*   _wfreopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
+MSVCRT(FILE)*   _wfsopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,int);
+void            _wperror(const MSVCRT(wchar_t)*);
+MSVCRT(FILE)*   _wpopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+int             _wremove(const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*_wtempnam(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*_wtmpnam(MSVCRT(wchar_t)*);
 
-MSVCRT(wint_t) MSVCRT(fgetwc)(MSVCRT(FILE)*);
-WCHAR*      MSVCRT(fgetws)(WCHAR*,int,MSVCRT(FILE)*);
-MSVCRT(wint_t) MSVCRT(fputwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
-int         MSVCRT(fputws)(const WCHAR*,MSVCRT(FILE)*);
-int         MSVCRT(fwprintf)(MSVCRT(FILE)*,const WCHAR*,...);
-int         MSVCRT(fputws)(const WCHAR*,MSVCRT(FILE)*);
-int         MSVCRT(fwscanf)(MSVCRT(FILE)*,const WCHAR*,...);
-MSVCRT(wint_t) MSVCRT(getwc)(MSVCRT(FILE)*);
-MSVCRT(wint_t) MSVCRT(getwchar)(void);
-WCHAR*      MSVCRT(getws)(WCHAR*);
-MSVCRT(wint_t) MSVCRT(putwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
-MSVCRT(wint_t) MSVCRT(putwchar)(MSVCRT(wint_t));
-int         MSVCRT(putws)(const WCHAR*);
-int         MSVCRT(swprintf)(WCHAR*,const WCHAR*,...);
-int         MSVCRT(swscanf)(const WCHAR*,const WCHAR*,...);
-MSVCRT(wint_t) MSVCRT(ungetwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
-int         MSVCRT(vfwprintf)(MSVCRT(FILE)*,const WCHAR*,va_list);
-int         MSVCRT(vswprintf)(WCHAR*,const WCHAR*,va_list);
-int         MSVCRT(vwprintf)(const WCHAR*,va_list);
-int         MSVCRT(wprintf)(const WCHAR*,...);
-int         MSVCRT(wscanf)(const WCHAR*,...);
+MSVCRT(wint_t)  MSVCRT(fgetwc)(MSVCRT(FILE)*);
+MSVCRT(wchar_t)*MSVCRT(fgetws)(MSVCRT(wchar_t)*,int,MSVCRT(FILE)*);
+MSVCRT(wint_t)  MSVCRT(fputwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
+int             MSVCRT(fputws)(const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
+int             MSVCRT(fwprintf)(MSVCRT(FILE)*,const MSVCRT(wchar_t)*,...);
+int             MSVCRT(fputws)(const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
+int             MSVCRT(fwscanf)(MSVCRT(FILE)*,const MSVCRT(wchar_t)*,...);
+MSVCRT(wint_t)  MSVCRT(getwc)(MSVCRT(FILE)*);
+MSVCRT(wint_t)  MSVCRT(getwchar)(void);
+MSVCRT(wchar_t)*MSVCRT(getws)(MSVCRT(wchar_t)*);
+MSVCRT(wint_t)  MSVCRT(putwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
+MSVCRT(wint_t)  MSVCRT(putwchar)(MSVCRT(wint_t));
+int             MSVCRT(putws)(const MSVCRT(wchar_t)*);
+int             MSVCRT(swprintf)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int             MSVCRT(swscanf)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+MSVCRT(wint_t)  MSVCRT(ungetwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
+int             MSVCRT(vfwprintf)(MSVCRT(FILE)*,const MSVCRT(wchar_t)*,va_list);
+int             MSVCRT(vswprintf)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,va_list);
+int             MSVCRT(vwprintf)(const MSVCRT(wchar_t)*,va_list);
+int             MSVCRT(wprintf)(const MSVCRT(wchar_t)*,...);
+int             MSVCRT(wscanf)(const MSVCRT(wchar_t)*,...);
+#endif /* MSVCRT_WSTDIO_DEFINED */
+
+#endif /* MSVCRT_STDIO_DEFINED */
 
 #ifdef __cplusplus
 }
diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h
index 8658071..8bdf608 100644
--- a/include/msvcrt/stdlib.h
+++ b/include/msvcrt/stdlib.h
@@ -9,10 +9,26 @@
 #define __WINE_STDLIB_H
 #define __WINE_USE_MSVCRT
 
-#include "basetsd.h"
-#include "msvcrt/malloc.h"                /* For size_t, malloc & co */
-#include "msvcrt/search.h"                /* For bsearch and qsort */
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
+#endif
 
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
+#endif
+#endif
+
+#ifndef _MSC_VER
+# ifndef __int64
+#  define __int64 long long
+# endif
+#endif
 
 #ifndef USE_MSVCRT_PREFIX
 #define EXIT_SUCCESS        0
@@ -41,6 +57,10 @@
     long rem;
 } MSVCRT(ldiv_t);
 
+#ifndef MSVCRT_SIZE_T_DEFINED
+typedef unsigned int MSVCRT(size_t);
+#define MSVCRT_SIZE_T_DEFINED
+#endif
 
 #define __max(a,b) (((a) > (b)) ? (a) : (b))
 #define __min(a,b) (((a) < (b)) ? (a) : (b))
@@ -71,9 +91,9 @@
 
 extern int*                  __p___argc(void);
 extern char***               __p___argv(void);
-extern WCHAR***              __p___wargv(void);
+extern MSVCRT(wchar_t)***    __p___wargv(void);
 extern char***               __p__environ(void);
-extern WCHAR***              __p__wenviron(void);
+extern MSVCRT(wchar_t)***    __p__wenviron(void);
 extern int*                  __p___mb_cur_max(void);
 extern unsigned long*        __doserrno(void);
 extern unsigned int*         __p__fmode(void);
@@ -104,10 +124,10 @@
 
 extern int*           MSVCRT(_errno)(void);
 #ifndef USE_MSVCRT_PREFIX
-#define errno              (*_errno())
-#elif !defined(__WINE__)
-#define MSVCRT_errno       (*MSVCRT__errno())
-#endif /* USE_MSVCRT_PREFIX, __WINE__ */
+# define errno        (*_errno())
+#else
+# define MSVCRT_errno (*MSVCRT__errno())
+#endif
 
 
 typedef int (*_onexit_t)(void);
@@ -148,6 +168,7 @@
 double      MSVCRT(atof)(const char*);
 int         MSVCRT(atoi)(const char*);
 long        MSVCRT(atol)(const char*);
+void*       MSVCRT(calloc)(MSVCRT(size_t),MSVCRT(size_t));
 #ifdef __i386__
 long long    MSVCRT(div)(int,int);
 unsigned long long MSVCRT(ldiv)(long,long);
@@ -156,41 +177,47 @@
 MSVCRT(ldiv_t) MSVCRT(ldiv)(long,long);
 #endif
 void        MSVCRT(exit)(int);
+void        MSVCRT(free)(void*);
 char*       MSVCRT(getenv)(const char*);
 long        MSVCRT(labs)(long);
+void*       MSVCRT(malloc)(MSVCRT(size_t));
 int         MSVCRT(mblen)(const char*,MSVCRT(size_t));
 void        MSVCRT(perror)(const char*);
 int         MSVCRT(rand)(void);
+void*       MSVCRT(realloc)(void*,MSVCRT(size_t));
 void        MSVCRT(srand)(unsigned int);
 double      MSVCRT(strtod)(const char*,char**);
 long        MSVCRT(strtol)(const char*,char**,int);
 unsigned long MSVCRT(strtoul)(const char*,char**,int);
 int         MSVCRT(system)(const char*);
 
-WCHAR*      _itow(int,WCHAR*,int);
-WCHAR*      _i64tow(__int64,WCHAR*,int);
-WCHAR*      _ltow(long,WCHAR*,int);
-WCHAR*      _ui64tow(unsigned __int64,WCHAR*,int);
-WCHAR*      _ultow(unsigned long,WCHAR*,int);
-WCHAR*      _wfullpath(WCHAR*,const WCHAR*,size_t);
-WCHAR*      _wgetenv(const WCHAR*);
-void        _wmakepath(WCHAR*,const WCHAR*,const WCHAR*,const WCHAR*,const WCHAR*);
-void        _wperror(const WCHAR*);
-int         _wputenv(const WCHAR*);
-void        _wsearchenv(const WCHAR*,const WCHAR*,WCHAR*);
-void        _wsplitpath(const WCHAR*,WCHAR*,WCHAR*,WCHAR*,WCHAR*);
-int         _wsystem(const WCHAR*);
-int         _wtoi(const WCHAR*);
-__int64     _wtoi64(const WCHAR*);
-long        _wtol(const WCHAR*);
+#ifndef MSVCRT_WSTDLIB_DEFINED
+#define MSVCRT_WSTDLIB_DEFINED
+MSVCRT(wchar_t)*_itow(int,MSVCRT(wchar_t)*,int);
+MSVCRT(wchar_t)*_i64tow(__int64,MSVCRT(wchar_t)*,int);
+MSVCRT(wchar_t)*_ltow(long,MSVCRT(wchar_t)*,int);
+MSVCRT(wchar_t)*_ui64tow(unsigned __int64,MSVCRT(wchar_t)*,int);
+MSVCRT(wchar_t)*_ultow(unsigned long,MSVCRT(wchar_t)*,int);
+MSVCRT(wchar_t)*_wfullpath(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,size_t);
+MSVCRT(wchar_t)*_wgetenv(const MSVCRT(wchar_t)*);
+void            _wmakepath(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+void            _wperror(const MSVCRT(wchar_t)*);
+int             _wputenv(const MSVCRT(wchar_t)*);
+void            _wsearchenv(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(wchar_t)*);
+void            _wsplitpath(const MSVCRT(wchar_t)*,MSVCRT(wchar_t)*,MSVCRT(wchar_t)*,MSVCRT(wchar_t)*,MSVCRT(wchar_t)*);
+int             _wsystem(const MSVCRT(wchar_t)*);
+int             _wtoi(const MSVCRT(wchar_t)*);
+__int64         _wtoi64(const MSVCRT(wchar_t)*);
+long            _wtol(const MSVCRT(wchar_t)*);
 
-MSVCRT(size_t) MSVCRT(mbstowcs)(WCHAR*,const char*,MSVCRT(size_t));
-int         MSVCRT(mbtowc)(WCHAR*,const char*,MSVCRT(size_t));
-double      MSVCRT(wcstod)(const WCHAR*,WCHAR**);
-long        MSVCRT(wcstol)(const WCHAR*,WCHAR**,int);
-MSVCRT(size_t) MSVCRT(wcstombs)(char*,const WCHAR*,MSVCRT(size_t));
-unsigned long MSVCRT(wcstoul)(const WCHAR*,WCHAR**,int);
-int         MSVCRT(wctomb)(char*,WCHAR);
+MSVCRT(size_t) MSVCRT(mbstowcs)(MSVCRT(wchar_t)*,const char*,MSVCRT(size_t));
+int            MSVCRT(mbtowc)(MSVCRT(wchar_t)*,const char*,MSVCRT(size_t));
+double         MSVCRT(wcstod)(const MSVCRT(wchar_t)*,MSVCRT(wchar_t)**);
+long           MSVCRT(wcstol)(const MSVCRT(wchar_t)*,MSVCRT(wchar_t)**,int);
+MSVCRT(size_t) MSVCRT(wcstombs)(char*,const MSVCRT(wchar_t)*,MSVCRT(size_t));
+unsigned long  MSVCRT(wcstoul)(const MSVCRT(wchar_t)*,MSVCRT(wchar_t)**,int);
+int            MSVCRT(wctomb)(char*,MSVCRT(wchar_t));
+#endif /* MSVCRT_WSTDLIB_DEFINED */
 
 #ifdef __cplusplus
 }
diff --git a/include/msvcrt/string.h b/include/msvcrt/string.h
index d6d2df2..ee3ddbb 100644
--- a/include/msvcrt/string.h
+++ b/include/msvcrt/string.h
@@ -9,20 +9,38 @@
 #define __WINE_STRING_H
 #define __WINE_USE_MSVCRT
 
-#include "winnt.h"
-
-#ifdef USE_MSVCRT_PREFIX
-#define MSVCRT(x)    MSVCRT_##x
-#else
-#define MSVCRT(x)    x
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
 #endif
 
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
+#endif
+#endif
 
 #ifndef MSVCRT_SIZE_T_DEFINED
 typedef unsigned int MSVCRT(size_t);
 #define MSVCRT_SIZE_T_DEFINED
 #endif
 
+#ifndef MSVCRT_NLSCMP_DEFINED
+#define _NLSCMPERROR               ((unsigned int)0x7fffffff)
+#define MSVCRT_NLSCMP_DEFINED
+#endif
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL  0
+#else
+#define NULL  ((void *)0)
+#endif
+#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -65,32 +83,35 @@
 char*       MSVCRT(strtok)(char*,const char*);
 MSVCRT(size_t) MSVCRT(strxfrm)(char*,const char*,MSVCRT(size_t));
 
-WCHAR*      _wcsdup(const WCHAR*);
-int         _wcsicmp(const WCHAR*,const WCHAR*);
-int         _wcsicoll(const WCHAR*,const WCHAR*);
-WCHAR*      _wcslwr(WCHAR*);
-int         _wcsnicmp(const WCHAR*,const WCHAR*,MSVCRT(size_t));
-WCHAR*      _wcsnset(WCHAR*,WCHAR,MSVCRT(size_t));
-WCHAR*      _wcsrev(WCHAR*);
-WCHAR*      _wcsset(WCHAR*,WCHAR);
-WCHAR*      _wcsupr(WCHAR*);
+#ifndef MSVCRT_WSTRING_DEFINED
+#define MSVCRT_WSTRING_DEFINED
+MSVCRT(wchar_t)*_wcsdup(const MSVCRT(wchar_t)*);
+int             _wcsicmp(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+int             _wcsicoll(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*_wcslwr(MSVCRT(wchar_t)*);
+int             _wcsnicmp(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(size_t));
+MSVCRT(wchar_t)*_wcsnset(MSVCRT(wchar_t)*,MSVCRT(wchar_t),MSVCRT(size_t));
+MSVCRT(wchar_t)*_wcsrev(MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*_wcsset(MSVCRT(wchar_t)*,MSVCRT(wchar_t));
+MSVCRT(wchar_t)*_wcsupr(MSVCRT(wchar_t)*);
 
-WCHAR*      MSVCRT(wcscat)(WCHAR*,const WCHAR*);
-WCHAR*      MSVCRT(wcschr)(const WCHAR*,WCHAR);
-int         MSVCRT(wcscmp)(const WCHAR*,const WCHAR*);
-int         MSVCRT(wcscoll)(const WCHAR*,const WCHAR*);
-WCHAR*      MSVCRT(wcscpy)(WCHAR*,const WCHAR*);
-MSVCRT(size_t) MSVCRT(wcscspn)(const WCHAR*,const WCHAR*);
-MSVCRT(size_t) MSVCRT(wcslen)(const WCHAR*);
-WCHAR*      MSVCRT(wcsncat)(WCHAR*,const WCHAR*,MSVCRT(size_t));
-int         MSVCRT(wcsncmp)(const WCHAR*,const WCHAR*,MSVCRT(size_t));
-WCHAR*      MSVCRT(wcsncpy)(WCHAR*,const WCHAR*,MSVCRT(size_t));
-WCHAR*      MSVCRT(wcspbrk)(const WCHAR*,const WCHAR*);
-WCHAR*      MSVCRT(wcsrchr)(const WCHAR*,WCHAR wcFor);
-MSVCRT(size_t) MSVCRT(wcsspn)(const WCHAR*,const WCHAR*);
-WCHAR*      MSVCRT(wcsstr)(const WCHAR*,const WCHAR*);
-WCHAR*      MSVCRT(wcstok)(WCHAR*,const WCHAR*);
-MSVCRT(size_t) MSVCRT(wcsxfrm)(WCHAR*,const WCHAR*,MSVCRT(size_t));
+MSVCRT(wchar_t)*MSVCRT(wcscat)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*MSVCRT(wcschr)(const MSVCRT(wchar_t)*,MSVCRT(wchar_t));
+int             MSVCRT(wcscmp)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+int             MSVCRT(wcscoll)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*MSVCRT(wcscpy)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(size_t)  MSVCRT(wcscspn)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(size_t)  MSVCRT(wcslen)(const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*MSVCRT(wcsncat)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(size_t));
+int             MSVCRT(wcsncmp)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(size_t));
+MSVCRT(wchar_t)*MSVCRT(wcsncpy)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(size_t));
+MSVCRT(wchar_t)*MSVCRT(wcspbrk)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*MSVCRT(wcsrchr)(const MSVCRT(wchar_t)*,MSVCRT(wchar_t) wcFor);
+MSVCRT(size_t)  MSVCRT(wcsspn)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*MSVCRT(wcsstr)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*MSVCRT(wcstok)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(size_t)  MSVCRT(wcsxfrm)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(size_t));
+#endif /* MSVCRT_WSTRING_DEFINED */
 
 #ifdef __cplusplus
 }
diff --git a/include/msvcrt/sys/stat.h b/include/msvcrt/sys/stat.h
index 4164618..4af2ade 100644
--- a/include/msvcrt/sys/stat.h
+++ b/include/msvcrt/sys/stat.h
@@ -9,8 +9,48 @@
 #define __WINE_SYS_STAT_H
 #define __WINE_USE_MSVCRT
 
-#include "msvcrt/sys/types.h"
+#include "sys/types.h"
 
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
+#endif
+
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
+#endif
+#endif
+
+#ifndef _MSC_VER
+# ifndef __int64
+#  define __int64 long long
+# endif
+#endif
+
+#ifndef MSVCRT_DEV_T_DEFINED
+typedef unsigned int   _dev_t;
+#define MSVCRT_DEV_T_DEFINED
+#endif
+
+#ifndef MSVCRT_INO_T_DEFINED
+typedef unsigned short _ino_t;
+#define MSVCRT_INO_T_DEFINED
+#endif
+
+#ifndef MSVCRT_TIME_T_DEFINED
+typedef long MSVCRT(time_t);
+#define MSVCRT_TIME_T_DEFINED
+#endif
+
+#ifndef MSVCRT_OFF_T_DEFINED
+typedef int MSVCRT(_off_t);
+#define MSVCRT_OFF_T_DEFINED
+#endif
 
 #define _S_IEXEC  0x0040
 #define _S_IWRITE 0x0080
@@ -26,6 +66,9 @@
 #undef st_ctime
 #undef st_mtime
 
+#ifndef MSVCRT_STAT_DEFINED
+#define MSVCRT_STAT_DEFINED
+
 struct _stat {
   _dev_t         st_dev;
   _ino_t         st_ino;
@@ -53,7 +96,7 @@
   MSVCRT(time_t) st_mtime;
   MSVCRT(time_t) st_ctime;
 };
-
+#endif /* MSVCRT_STAT_DEFINED */
 
 #ifdef __cplusplus
 extern "C" {
@@ -64,8 +107,11 @@
 int _fstati64(int,struct _stati64*);
 int _stati64(const char*,struct _stati64*);
 
-int _wstat(const WCHAR*,struct _stat*);
-int _wstati64(const WCHAR*,struct _stati64*);
+#ifndef MSVCRT_WSTAT_DEFINED
+#define MSVCRT_WSTAT_DEFINED
+int _wstat(const MSVCRT(wchar_t)*,struct _stat*);
+int _wstati64(const MSVCRT(wchar_t)*,struct _stati64*);
+#endif /* MSVCRT_WSTAT_DEFINED */
 
 #ifdef __cplusplus
 }
diff --git a/include/msvcrt/sys/timeb.h b/include/msvcrt/sys/timeb.h
index eac101d..17477fb 100644
--- a/include/msvcrt/sys/timeb.h
+++ b/include/msvcrt/sys/timeb.h
@@ -21,9 +21,21 @@
 #define __WINE_SYS_TIMEB_H
 #define __WINE_USE_MSVCRT
 
-#include "msvcrt/sys/types.h"      /* For time_t */
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
+#endif
 
+#ifndef MSVCRT_TIME_T_DEFINED
+typedef long MSVCRT(time_t);
+#define MSVCRT_TIME_T_DEFINED
+#endif
 
+#ifndef MSVCRT_TIMEB_DEFINED
+#define MSVCRT_TIMEB_DEFINED
 struct _timeb
 {
     MSVCRT(time_t) time;
@@ -31,6 +43,7 @@
     short          timezone;
     short          dstflag;
 };
+#endif /* MSVCRT_TIMEB_DEFINED */
 
 
 #ifdef __cplusplus
diff --git a/include/msvcrt/sys/types.h b/include/msvcrt/sys/types.h
index 1142eae..ca98db2 100644
--- a/include/msvcrt/sys/types.h
+++ b/include/msvcrt/sys/types.h
@@ -21,18 +21,33 @@
 #define __WINE_SYS_TYPES_H
 #define __WINE_USE_MSVCRT
 
-
-#ifdef USE_MSVCRT_PREFIX
-#define MSVCRT(x)    MSVCRT_##x
-#else
-#define MSVCRT(x)    x
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
 #endif
 
-
+#ifndef MSVCRT_DEV_T_DEFINED
 typedef unsigned int   _dev_t;
+#define MSVCRT_DEV_T_DEFINED
+#endif
+
+#ifndef MSVCRT_INO_T_DEFINED
 typedef unsigned short _ino_t;
-typedef int            MSVCRT(_off_t);
-typedef long           MSVCRT(time_t);
+#define MSVCRT_INO_T_DEFINED
+#endif
+
+#ifndef MSVCRT_OFF_T_DEFINED
+typedef int MSVCRT(_off_t);
+#define MSVCRT_OFF_T_DEFINED
+#endif
+
+#ifndef MSVCRT_TIME_T_DEFINED
+typedef long MSVCRT(time_t);
+#define MSVCRT_TIME_T_DEFINED
+#endif
 
 
 #ifndef USE_MSVCRT_PREFIX
diff --git a/include/msvcrt/sys/utime.h b/include/msvcrt/sys/utime.h
index 225922b..0a0c48c 100644
--- a/include/msvcrt/sys/utime.h
+++ b/include/msvcrt/sys/utime.h
@@ -21,16 +21,34 @@
 #define __WINE_SYS_UTIME_H
 #define __WINE_USE_MSVCRT
 
-#include "winnt.h"
-#include "msvcrt/sys/types.h"      /* For time_t */
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
+#endif
 
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
+#endif
+#endif
 
+#ifndef MSVCRT_TIME_T_DEFINED
+typedef long MSVCRT(time_t);
+#define MSVCRT_TIME_T_DEFINED
+#endif
+
+#ifndef MSVCRT_UTIMBUF_DEFINED
+#define MSVCRT_UTIMBUF_DEFINED
 struct _utimbuf
 {
     MSVCRT(time_t) actime;
     MSVCRT(time_t) modtime;
 };
-
+#endif /* MSVCRT_UTIMBUF_DEFINED */
 
 #ifdef __cplusplus
 extern "C" {
@@ -39,7 +57,7 @@
 int         _futime(int,struct _utimbuf*);
 int         _utime(const char*,struct _utimbuf*);
 
-int         _wutime(const WCHAR*,struct _utimbuf*);
+int         _wutime(const MSVCRT(wchar_t)*,struct _utimbuf*);
 
 #ifdef __cplusplus
 }
diff --git a/include/msvcrt/time.h b/include/msvcrt/time.h
index 4f4113d..dc9a743 100644
--- a/include/msvcrt/time.h
+++ b/include/msvcrt/time.h
@@ -21,17 +21,46 @@
 #define __WINE_TIME_H
 #define __WINE_USE_MSVCRT
 
-#include "winnt.h"
-#include "msvcrt/sys/types.h"      /* For time_t */
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
+#endif
 
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
+#endif
+#endif
 
 #ifndef MSVCRT_SIZE_T_DEFINED
 typedef unsigned int MSVCRT(size_t);
 #define MSVCRT_SIZE_T_DEFINED
 #endif
 
-typedef long MSVCRT(clock_t);
+#ifndef MSVCRT_TIME_T_DEFINED
+typedef long MSVCRT(time_t);
+#define MSVCRT_TIME_T_DEFINED
+#endif
 
+#ifndef MSVCRT_CLOCK_T_DEFINED
+typedef long MSVCRT(clock_t);
+#define MSVCRT_CLOCK_T_DEFINED
+#endif
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL  0
+#else
+#define NULL  ((void *)0)
+#endif
+#endif
+
+#ifndef MSVCRT_TM_DEFINED
+#define MSVCRT_TM_DEFINED
 struct MSVCRT(tm) {
     int tm_sec;
     int tm_min;
@@ -43,7 +72,7 @@
     int tm_yday;
     int tm_isdst;
 };
-
+#endif /* MSVCRT_TM_DEFINED */
 
 #ifdef __cplusplus
 extern "C" {
@@ -68,11 +97,14 @@
 size_t      MSVCRT(strftime)(char*,size_t,const char*,const struct MSVCRT(tm)*);
 MSVCRT(time_t) MSVCRT(time)(MSVCRT(time_t)*);
 
-WCHAR*      _wasctime(const struct MSVCRT(tm)*);
-MSVCRT(size_t) wcsftime(WCHAR*,MSVCRT(size_t),const WCHAR*,const struct MSVCRT(tm)*);
-WCHAR*      _wctime(const MSVCRT(time_t)*);
-WCHAR*      _wstrdate(WCHAR*);
-WCHAR*      _wstrtime(WCHAR*);
+#ifndef MSVCRT_WTIME_DEFINED
+#define MSVCRT_WTIME_DEFINED
+MSVCRT(wchar_t)*_wasctime(const struct MSVCRT(tm)*);
+MSVCRT(size_t)  wcsftime(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,const struct MSVCRT(tm)*);
+MSVCRT(wchar_t)*_wctime(const MSVCRT(time_t)*);
+MSVCRT(wchar_t)*_wstrdate(MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*_wstrtime(MSVCRT(wchar_t)*);
+#endif /* MSVCRT_WTIME_DEFINED */
 
 #ifdef __cplusplus
 }
diff --git a/include/msvcrt/wchar.h b/include/msvcrt/wchar.h
index 1dfb4d0..6fe4ddd 100644
--- a/include/msvcrt/wchar.h
+++ b/include/msvcrt/wchar.h
@@ -9,20 +9,37 @@
 #define __WINE_WCHAR_H
 #define __WINE_USE_MSVCRT
 
-#include "msvcrt/io.h"
-#include "msvcrt/locale.h"
-#include "msvcrt/process.h"
-#include "msvcrt/stdio.h"
-#include "msvcrt/stdlib.h"
-#include "msvcrt/string.h"
-#include "msvcrt/sys/stat.h"
-#include "msvcrt/sys/types.h"
-#include "msvcrt/time.h"
-#include "msvcrt/wctype.h"
+#include <stdarg.h>
 
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
+#endif
+#endif
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL  0
+#else
+#define NULL  ((void *)0)
+#endif
+#endif
 
 #define WCHAR_MIN 0
-#define WCHAR_MAX ((WCHAR)-1)
+#define WCHAR_MAX ((MSVCRT(wchar_t))-1)
 
 typedef int MSVCRT(mbstate_t);
 
@@ -31,18 +48,343 @@
 #define MSVCRT_SIZE_T_DEFINED
 #endif
 
-
-#ifdef __cplusplus
-extern "C" {
+#ifndef MSVCRT_WCTYPE_T_DEFINED
+typedef MSVCRT(wchar_t) MSVCRT(wint_t);
+typedef MSVCRT(wchar_t) MSVCRT(wctype_t);
+#define MSVCRT_WCTYPE_T_DEFINED
 #endif
 
-WCHAR       btowc(int);
-MSVCRT(size_t) mbrlen(const char *,MSVCRT(size_t),MSVCRT(mbstate_t)*);
-MSVCRT(size_t) mbrtowc(WCHAR*,const char*,MSVCRT(size_t),MSVCRT(mbstate_t)*);
-MSVCRT(size_t) mbsrtowcs(WCHAR*,const char**,MSVCRT(size_t),MSVCRT(mbstate_t)*);
-MSVCRT(size_t) wcrtomb(char*,WCHAR,MSVCRT(mbstate_t)*);
-MSVCRT(size_t) wcsrtombs(char*,const WCHAR**,MSVCRT(size_t),MSVCRT(mbstate_t)*);
-int         wctob(MSVCRT(wint_t));
+#ifndef _MSC_VER
+# ifndef __int64
+#  define __int64 long long
+# endif
+#endif
+
+#ifndef USE_MSVCRT_PREFIX
+# ifndef WEOF
+#  define WEOF        (wint_t)(0xFFFF)
+# endif
+#else
+# ifndef MSVCRT_WEOF
+#  define MSVCRT_WEOF (MSVCRT_wint_t)(0xFFFF)
+# endif
+#endif /* USE_MSVCRT_PREFIX */
+
+#ifndef MSVCRT_FSIZE_T_DEFINED
+typedef unsigned long _fsize_t;
+#define MSVCRT_FSIZE_T_DEFINED
+#endif
+
+#ifndef MSVCRT_DEV_T_DEFINED
+typedef unsigned int   _dev_t;
+#define MSVCRT_DEV_T_DEFINED
+#endif
+
+#ifndef MSVCRT_INO_T_DEFINED
+typedef unsigned short _ino_t;
+#define MSVCRT_INO_T_DEFINED
+#endif
+
+#ifndef MSVCRT_OFF_T_DEFINED
+typedef int MSVCRT(_off_t);
+#define MSVCRT_OFF_T_DEFINED
+#endif
+
+#ifndef MSVCRT_TIME_T_DEFINED
+typedef long MSVCRT(time_t);
+#define MSVCRT_TIME_T_DEFINED
+#endif
+
+#ifndef MSVCRT_TM_DEFINED
+#define MSVCRT_TM_DEFINED
+struct MSVCRT(tm) {
+    int tm_sec;
+    int tm_min;
+    int tm_hour;
+    int tm_mday;
+    int tm_mon;
+    int tm_year;
+    int tm_wday;
+    int tm_yday;
+    int tm_isdst;
+};
+#endif /* MSVCRT_TM_DEFINED */
+
+#ifndef MSVCRT_FILE_DEFINED
+#define MSVCRT_FILE_DEFINED
+typedef struct MSVCRT(_iobuf)
+{
+  char* _ptr;
+  int   _cnt;
+  char* _base;
+  int   _flag;
+  int   _file;
+  int   _charbuf;
+  int   _bufsiz;
+  char* _tmpfname;
+} MSVCRT(FILE);
+#endif  /* MSVCRT_FILE_DEFINED */
+
+#ifndef MSVCRT_WFINDDATA_T_DEFINED
+#define MSVCRT_WFINDDATA_T_DEFINED
+
+struct _wfinddata_t {
+  unsigned attrib;
+  MSVCRT(time_t) time_create;
+  MSVCRT(time_t) time_access;
+  MSVCRT(time_t) time_write;
+  _fsize_t       size;
+  MSVCRT(wchar_t) name[260];
+};
+
+struct _wfinddatai64_t {
+  unsigned attrib;
+  MSVCRT(time_t) time_create;
+  MSVCRT(time_t) time_access;
+  MSVCRT(time_t) time_write;
+  __int64        size;
+  MSVCRT(wchar_t) name[260];
+};
+
+#endif /* MSVCRT_WFINDDATA_T_DEFINED */
+
+#ifndef MSVCRT_STAT_DEFINED
+#define MSVCRT_STAT_DEFINED
+
+struct _stat {
+  _dev_t         st_dev;
+  _ino_t         st_ino;
+  unsigned short st_mode;
+  short          st_nlink;
+  short          st_uid;
+  short          st_gid;
+  _dev_t         st_rdev;
+  MSVCRT(_off_t) st_size;
+  MSVCRT(time_t) st_atime;
+  MSVCRT(time_t) st_mtime;
+  MSVCRT(time_t) st_ctime;
+};
+
+struct _stati64 {
+  _dev_t         st_dev;
+  _ino_t         st_ino;
+  unsigned short st_mode;
+  short          st_nlink;
+  short          st_uid;
+  short          st_gid;
+  _dev_t         st_rdev;
+  __int64        st_size;
+  MSVCRT(time_t) st_atime;
+  MSVCRT(time_t) st_mtime;
+  MSVCRT(time_t) st_ctime;
+};
+#endif /* MSVCRT_STAT_DEFINED */
+
+/* ASCII char classification table - binary compatible */
+#define _UPPER        0x0001  /* C1_UPPER */
+#define _LOWER        0x0002  /* C1_LOWER */
+#define _DIGIT        0x0004  /* C1_DIGIT */
+#define _SPACE        0x0008  /* C1_SPACE */
+#define _PUNCT        0x0010  /* C1_PUNCT */
+#define _CONTROL      0x0020  /* C1_CNTRL */
+#define _BLANK        0x0040  /* C1_BLANK */
+#define _HEX          0x0080  /* C1_XDIGIT */
+#define _LEADBYTE     0x8000
+#define _ALPHA       (0x0100|_UPPER|_LOWER)  /* (C1_ALPHA|_UPPER|_LOWER) */
+
+#ifndef MSVCRT_WCTYPE_DEFINED
+#define MSVCRT_WCTYPE_DEFINED
+int MSVCRT(is_wctype)(MSVCRT(wint_t),MSVCRT(wctype_t));
+int MSVCRT(isleadbyte)(int);
+int MSVCRT(iswalnum)(MSVCRT(wint_t));
+int MSVCRT(iswalpha)(MSVCRT(wint_t));
+int MSVCRT(iswascii)(MSVCRT(wint_t));
+int MSVCRT(iswcntrl)(MSVCRT(wint_t));
+int MSVCRT(iswctype)(MSVCRT(wint_t),MSVCRT(wctype_t));
+int MSVCRT(iswdigit)(MSVCRT(wint_t));
+int MSVCRT(iswgraph)(MSVCRT(wint_t));
+int MSVCRT(iswlower)(MSVCRT(wint_t));
+int MSVCRT(iswprint)(MSVCRT(wint_t));
+int MSVCRT(iswpunct)(MSVCRT(wint_t));
+int MSVCRT(iswspace)(MSVCRT(wint_t));
+int MSVCRT(iswupper)(MSVCRT(wint_t));
+int MSVCRT(iswxdigit)(MSVCRT(wint_t));
+MSVCRT(wchar_t) MSVCRT(towlower)(MSVCRT(wchar_t));
+MSVCRT(wchar_t) MSVCRT(towupper)(MSVCRT(wchar_t));
+#endif /* MSVCRT_WCTYPE_DEFINED */
+
+#ifndef MSVCRT_WDIRECT_DEFINED
+#define MSVCRT_WDIRECT_DEFINED
+int              _wchdir(const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)* _wgetcwd(MSVCRT(wchar_t)*,int);
+MSVCRT(wchar_t)* _wgetdcwd(int,MSVCRT(wchar_t)*,int);
+int              _wmkdir(const MSVCRT(wchar_t)*);
+int              _wrmdir(const MSVCRT(wchar_t)*);
+#endif /* MSVCRT_WDIRECT_DEFINED */
+
+#ifndef MSVCRT_WIO_DEFINED
+#define MSVCRT_WIO_DEFINED
+int         _waccess(const MSVCRT(wchar_t)*,int);
+int         _wchmod(const MSVCRT(wchar_t)*,int);
+int         _wcreat(const MSVCRT(wchar_t)*,int);
+long        _wfindfirst(const MSVCRT(wchar_t)*,struct _wfinddata_t*);
+long        _wfindfirsti64(const MSVCRT(wchar_t)*, struct _wfinddatai64_t*);
+int         _wfindnext(long,struct _wfinddata_t*);
+int         _wfindnexti64(long, struct _wfinddatai64_t*);
+MSVCRT(wchar_t)*_wmktemp(MSVCRT(wchar_t)*);
+int         _wopen(const MSVCRT(wchar_t)*,int,...);
+int         _wrename(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+int         _wsopen(const MSVCRT(wchar_t)*,int,int,...);
+int         _wunlink(const MSVCRT(wchar_t)*);
+#endif /* MSVCRT_WIO_DEFINED */
+
+#ifndef MSVCRT_WLOCALE_DEFINED
+#define MSVCRT_WLOCALE_DEFINED
+MSVCRT(wchar_t)* _wsetlocale(int,const MSVCRT(wchar_t)*);
+#endif /* MSVCRT_WLOCALE_DEFINED */
+
+#ifndef MSVCRT_WPROCESS_DEFINED
+#define MSVCRT_WPROCESS_DEFINED
+int         _wexecl(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wexecle(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wexeclp(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wexeclpe(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wexecv(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *);
+int         _wexecve(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *,const MSVCRT(wchar_t)* const *);
+int         _wexecvp(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *);
+int         _wexecvpe(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *,const MSVCRT(wchar_t)* const *);
+int         _wspawnl(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wspawnle(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wspawnlp(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wspawnlpe(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int         _wspawnv(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *);
+int         _wspawnve(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *,const MSVCRT(wchar_t)* const *);
+int         _wspawnvp(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *);
+int         _wspawnvpe(int,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)* const *,const MSVCRT(wchar_t)* const *);
+int         _wsystem(const MSVCRT(wchar_t)*);
+#endif /* MSVCRT_WPROCESS_DEFINED */
+
+#ifndef MSVCRT_WSTAT_DEFINED
+#define MSVCRT_WSTAT_DEFINED
+int _wstat(const MSVCRT(wchar_t)*,struct _stat*);
+int _wstati64(const MSVCRT(wchar_t)*,struct _stati64*);
+#endif /* MSVCRT_WSTAT_DEFINED */
+
+#ifndef MSVCRT_WSTDIO_DEFINED
+#define MSVCRT_WSTDIO_DEFINED
+MSVCRT(wint_t)  _fgetwchar(void);
+MSVCRT(wint_t)  _fputwchar(MSVCRT(wint_t));
+MSVCRT(wchar_t)*_getws(MSVCRT(wchar_t)*);
+int             _putws(const MSVCRT(wchar_t)*);
+int             _snwprintf(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,...);
+int             _vsnwprintf(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,va_list);
+MSVCRT(FILE)*   _wfdopen(int,const MSVCRT(wchar_t)*);
+MSVCRT(FILE)*   _wfopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(FILE)*   _wfreopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
+MSVCRT(FILE)*   _wfsopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,int);
+void            _wperror(const MSVCRT(wchar_t)*);
+MSVCRT(FILE)*   _wpopen(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+int             _wremove(const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*_wtempnam(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*_wtmpnam(MSVCRT(wchar_t)*);
+
+MSVCRT(wint_t)  MSVCRT(fgetwc)(MSVCRT(FILE)*);
+MSVCRT(wchar_t)*MSVCRT(fgetws)(MSVCRT(wchar_t)*,int,MSVCRT(FILE)*);
+MSVCRT(wint_t)  MSVCRT(fputwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
+int             MSVCRT(fputws)(const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
+int             MSVCRT(fwprintf)(MSVCRT(FILE)*,const MSVCRT(wchar_t)*,...);
+int             MSVCRT(fputws)(const MSVCRT(wchar_t)*,MSVCRT(FILE)*);
+int             MSVCRT(fwscanf)(MSVCRT(FILE)*,const MSVCRT(wchar_t)*,...);
+MSVCRT(wint_t)  MSVCRT(getwc)(MSVCRT(FILE)*);
+MSVCRT(wint_t)  MSVCRT(getwchar)(void);
+MSVCRT(wchar_t)*MSVCRT(getws)(MSVCRT(wchar_t)*);
+MSVCRT(wint_t)  MSVCRT(putwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
+MSVCRT(wint_t)  MSVCRT(putwchar)(MSVCRT(wint_t));
+int             MSVCRT(putws)(const MSVCRT(wchar_t)*);
+int             MSVCRT(swprintf)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+int             MSVCRT(swscanf)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,...);
+MSVCRT(wint_t)  MSVCRT(ungetwc)(MSVCRT(wint_t),MSVCRT(FILE)*);
+int             MSVCRT(vfwprintf)(MSVCRT(FILE)*,const MSVCRT(wchar_t)*,va_list);
+int             MSVCRT(vswprintf)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,va_list);
+int             MSVCRT(vwprintf)(const MSVCRT(wchar_t)*,va_list);
+int             MSVCRT(wprintf)(const MSVCRT(wchar_t)*,...);
+int             MSVCRT(wscanf)(const MSVCRT(wchar_t)*,...);
+#endif /* MSVCRT_WSTDIO_DEFINED */
+
+#ifndef MSVCRT_WSTDLIB_DEFINED
+#define MSVCRT_WSTDLIB_DEFINED
+MSVCRT(wchar_t)*_itow(int,MSVCRT(wchar_t)*,int);
+MSVCRT(wchar_t)*_i64tow(__int64,MSVCRT(wchar_t)*,int);
+MSVCRT(wchar_t)*_ltow(long,MSVCRT(wchar_t)*,int);
+MSVCRT(wchar_t)*_ui64tow(unsigned __int64,MSVCRT(wchar_t)*,int);
+MSVCRT(wchar_t)*_ultow(unsigned long,MSVCRT(wchar_t)*,int);
+MSVCRT(wchar_t)*_wfullpath(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,size_t);
+MSVCRT(wchar_t)*_wgetenv(const MSVCRT(wchar_t)*);
+void            _wmakepath(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+void            _wperror(const MSVCRT(wchar_t)*);
+int             _wputenv(const MSVCRT(wchar_t)*);
+void            _wsearchenv(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(wchar_t)*);
+void            _wsplitpath(const MSVCRT(wchar_t)*,MSVCRT(wchar_t)*,MSVCRT(wchar_t)*,MSVCRT(wchar_t)*,MSVCRT(wchar_t)*);
+int             _wsystem(const MSVCRT(wchar_t)*);
+int             _wtoi(const MSVCRT(wchar_t)*);
+__int64         _wtoi64(const MSVCRT(wchar_t)*);
+long            _wtol(const MSVCRT(wchar_t)*);
+
+MSVCRT(size_t) MSVCRT(mbstowcs)(MSVCRT(wchar_t)*,const char*,MSVCRT(size_t));
+int            MSVCRT(mbtowc)(MSVCRT(wchar_t)*,const char*,MSVCRT(size_t));
+double         MSVCRT(wcstod)(const MSVCRT(wchar_t)*,MSVCRT(wchar_t)**);
+long           MSVCRT(wcstol)(const MSVCRT(wchar_t)*,MSVCRT(wchar_t)**,int);
+MSVCRT(size_t) MSVCRT(wcstombs)(char*,const MSVCRT(wchar_t)*,MSVCRT(size_t));
+unsigned long  MSVCRT(wcstoul)(const MSVCRT(wchar_t)*,MSVCRT(wchar_t)**,int);
+int            MSVCRT(wctomb)(char*,MSVCRT(wchar_t));
+#endif /* MSVCRT_WSTDLIB_DEFINED */
+
+#ifndef MSVCRT_WSTRING_DEFINED
+#define MSVCRT_WSTRING_DEFINED
+MSVCRT(wchar_t)*_wcsdup(const MSVCRT(wchar_t)*);
+int             _wcsicmp(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+int             _wcsicoll(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*_wcslwr(MSVCRT(wchar_t)*);
+int             _wcsnicmp(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(size_t));
+MSVCRT(wchar_t)*_wcsnset(MSVCRT(wchar_t)*,MSVCRT(wchar_t),MSVCRT(size_t));
+MSVCRT(wchar_t)*_wcsrev(MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*_wcsset(MSVCRT(wchar_t)*,MSVCRT(wchar_t));
+MSVCRT(wchar_t)*_wcsupr(MSVCRT(wchar_t)*);
+
+MSVCRT(wchar_t)*MSVCRT(wcscat)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*MSVCRT(wcschr)(const MSVCRT(wchar_t)*,MSVCRT(wchar_t));
+int             MSVCRT(wcscmp)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+int             MSVCRT(wcscoll)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*MSVCRT(wcscpy)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(size_t)  MSVCRT(wcscspn)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(size_t)  MSVCRT(wcslen)(const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*MSVCRT(wcsncat)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(size_t));
+int             MSVCRT(wcsncmp)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(size_t));
+MSVCRT(wchar_t)*MSVCRT(wcsncpy)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(size_t));
+MSVCRT(wchar_t)*MSVCRT(wcspbrk)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*MSVCRT(wcsrchr)(const MSVCRT(wchar_t)*,MSVCRT(wchar_t) wcFor);
+MSVCRT(size_t)  MSVCRT(wcsspn)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*MSVCRT(wcsstr)(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*MSVCRT(wcstok)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
+MSVCRT(size_t)  MSVCRT(wcsxfrm)(MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*,MSVCRT(size_t));
+#endif /* MSVCRT_WSTRING_DEFINED */
+
+#ifndef MSVCRT_WTIME_DEFINED
+#define MSVCRT_WTIME_DEFINED
+MSVCRT(wchar_t)*_wasctime(const struct MSVCRT(tm)*);
+MSVCRT(size_t)  wcsftime(MSVCRT(wchar_t)*,MSVCRT(size_t),const MSVCRT(wchar_t)*,const struct MSVCRT(tm)*);
+MSVCRT(wchar_t)*_wctime(const MSVCRT(time_t)*);
+MSVCRT(wchar_t)*_wstrdate(MSVCRT(wchar_t)*);
+MSVCRT(wchar_t)*_wstrtime(MSVCRT(wchar_t)*);
+#endif /* MSVCRT_WTIME_DEFINED */
+
+MSVCRT(wchar_t) btowc(int);
+MSVCRT(size_t)  mbrlen(const char *,MSVCRT(size_t),MSVCRT(mbstate_t)*);
+MSVCRT(size_t)  mbrtowc(MSVCRT(wchar_t)*,const char*,MSVCRT(size_t),MSVCRT(mbstate_t)*);
+MSVCRT(size_t)  mbsrtowcs(MSVCRT(wchar_t)*,const char**,MSVCRT(size_t),MSVCRT(mbstate_t)*);
+MSVCRT(size_t)  wcrtomb(char*,MSVCRT(wchar_t),MSVCRT(mbstate_t)*);
+MSVCRT(size_t)  wcsrtombs(char*,const MSVCRT(wchar_t)**,MSVCRT(size_t),MSVCRT(mbstate_t)*);
+int             wctob(MSVCRT(wint_t));
 
 #ifdef __cplusplus
 }
diff --git a/include/msvcrt/wctype.h b/include/msvcrt/wctype.h
index fce0b11..0b7e34e 100644
--- a/include/msvcrt/wctype.h
+++ b/include/msvcrt/wctype.h
@@ -21,51 +21,48 @@
 #define __WINE_WCTYPE_H
 #define __WINE_USE_MSVCRT
 
-
-/* FIXME: winnt.h includes 'ctype.h' which includes 'wctype.h'. So we get
- * there but WCHAR is not defined.
- */
-/* Some systems might have wchar_t, but we really need 16 bit characters */
-#ifndef WINE_WCHAR_DEFINED
-#ifdef WINE_UNICODE_NATIVE
-typedef wchar_t         WCHAR,      *PWCHAR;
-#else
-typedef unsigned short  WCHAR,      *PWCHAR;
-#endif
-#define WINE_WCHAR_DEFINED
+#ifndef MSVCRT
+# ifdef USE_MSVCRT_PREFIX
+#  define MSVCRT(x)    MSVCRT_##x
+# else
+#  define MSVCRT(x)    x
+# endif
 #endif
 
-#ifdef USE_MSVCRT_PREFIX
-#define MSVCRT(x)    MSVCRT_##x
-#else
-#define MSVCRT(x)    x
+#ifndef MSVCRT_WCHAR_T_DEFINED
+#define MSVCRT_WCHAR_T_DEFINED
+#ifndef __cplusplus
+typedef unsigned short MSVCRT(wchar_t);
 #endif
-
+#endif
 
 /* ASCII char classification table - binary compatible */
-#define _UPPER        C1_UPPER
-#define _LOWER        C1_LOWER
-#define _DIGIT        C1_DIGIT
-#define _SPACE        C1_SPACE
-#define _PUNCT        C1_PUNCT
-#define _CONTROL      C1_CNTRL
-#define _BLANK        C1_BLANK
-#define _HEX          C1_XDIGIT
+#define _UPPER        0x0001  /* C1_UPPER */
+#define _LOWER        0x0002  /* C1_LOWER */
+#define _DIGIT        0x0004  /* C1_DIGIT */
+#define _SPACE        0x0008  /* C1_SPACE */
+#define _PUNCT        0x0010  /* C1_PUNCT */
+#define _CONTROL      0x0020  /* C1_CNTRL */
+#define _BLANK        0x0040  /* C1_BLANK */
+#define _HEX          0x0080  /* C1_XDIGIT */
 #define _LEADBYTE     0x8000
-#define _ALPHA       (C1_ALPHA|_UPPER|_LOWER)
+#define _ALPHA       (0x0100|_UPPER|_LOWER)  /* (C1_ALPHA|_UPPER|_LOWER) */
 
 #ifndef USE_MSVCRT_PREFIX
 # ifndef WEOF
-#  define WEOF        (WCHAR)(0xFFFF)
+#  define WEOF        (wint_t)(0xFFFF)
 # endif
 #else
 # ifndef MSVCRT_WEOF
-#  define MSVCRT_WEOF (WCHAR)(0xFFFF)
+#  define MSVCRT_WEOF (MSVCRT_wint_t)(0xFFFF)
 # endif
 #endif /* USE_MSVCRT_PREFIX */
 
-typedef WCHAR MSVCRT(wctype_t);
-typedef WCHAR MSVCRT(wint_t);
+#ifndef MSVCRT_WCTYPE_T_DEFINED
+typedef MSVCRT(wchar_t) MSVCRT(wint_t);
+typedef MSVCRT(wchar_t) MSVCRT(wctype_t);
+#define MSVCRT_WCTYPE_T_DEFINED
+#endif
 
 /* FIXME: there's something to do with __p__pctype and __p__pwctype */
 
@@ -74,6 +71,8 @@
 extern "C" {
 #endif
 
+#ifndef MSVCRT_WCTYPE_DEFINED
+#define MSVCRT_WCTYPE_DEFINED
 int MSVCRT(is_wctype)(MSVCRT(wint_t),MSVCRT(wctype_t));
 int MSVCRT(isleadbyte)(int);
 int MSVCRT(iswalnum)(MSVCRT(wint_t));
@@ -89,8 +88,9 @@
 int MSVCRT(iswspace)(MSVCRT(wint_t));
 int MSVCRT(iswupper)(MSVCRT(wint_t));
 int MSVCRT(iswxdigit)(MSVCRT(wint_t));
-WCHAR MSVCRT(towlower)(WCHAR);
-WCHAR MSVCRT(towupper)(WCHAR);
+MSVCRT(wchar_t) MSVCRT(towlower)(MSVCRT(wchar_t));
+MSVCRT(wchar_t) MSVCRT(towupper)(MSVCRT(wchar_t));
+#endif /* MSVCRT_WCTYPE_DEFINED */
 
 #ifdef __cplusplus
 }
diff --git a/include/winnt.h b/include/winnt.h
index 5cd3b6b..0bd9906 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -293,14 +293,11 @@
 typedef long            LONG,       *PLONG;
 
 /* Some systems might have wchar_t, but we really need 16 bit characters */
-#ifndef WINE_WCHAR_DEFINED
 #ifdef WINE_UNICODE_NATIVE
 typedef wchar_t         WCHAR,      *PWCHAR;
 #else
 typedef unsigned short  WCHAR,      *PWCHAR;
 #endif
-#define WINE_WCHAR_DEFINED
-#endif
 
 /* 'Extended/Wide' numerical types */
 #ifndef _ULONGLONG_