Explanation from previous post still valid. This patch also fixes the problem introduced by the winnt.h change: http://cvs.winehq.com/patch.py?id=6556 Now the msvcrt files need to include windef.h instead of winnt.h. As I said, if you want to modify the msvcrt headers to not include each other, but rather to duplicate definitions in each file, I think it should go in as a separate patch. This one fixes massive Winelib breakage. ChangeLog Do not explicitly include msvcrt files from msvcrt headers. Include windef.h instead of winnt.h to get all appropriate types. Index: include/msvcrt/ctype.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/ctype.h,v retrieving revision 1.2 diff -u -r1.2 ctype.h --- include/msvcrt/ctype.h 22 Oct 2001 18:59:23 -0000 1.2 +++ include/msvcrt/ctype.h 13 Dec 2002 06:45:40 -0000 @@ -9,8 +9,9 @@ #define __WINE_CTYPE_H #define __WINE_USE_MSVCRT -#include "msvcrt/wctype.h" - +#ifndef USE_MSVCRT_PREFIX +# include "wctype.h" +#endif #ifdef __cplusplus extern "C" { Index: include/msvcrt/direct.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/direct.h,v retrieving revision 1.2 diff -u -r1.2 direct.h --- include/msvcrt/direct.h 22 Oct 2001 18:59:23 -0000 1.2 +++ include/msvcrt/direct.h 14 Dec 2002 17:37:31 -0000 @@ -9,9 +9,10 @@ #define __WINE_DIRECT_H #define __WINE_USE_MSVCRT -#include "winnt.h" -#include "msvcrt/dos.h" /* For _getdiskfree & co */ - +#include "windef.h" +#ifndef USE_MSVCRT_PREFIX +# include "dos.h" /* For _getdiskfree & co */ +#endif #ifdef __cplusplus extern "C" { Index: include/msvcrt/io.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/io.h,v retrieving revision 1.2 diff -u -r1.2 io.h --- include/msvcrt/io.h 22 Oct 2001 18:59:23 -0000 1.2 +++ include/msvcrt/io.h 13 Dec 2002 06:46:13 -0000 @@ -9,8 +9,10 @@ #define __WINE_IO_H #define __WINE_USE_MSVCRT -#include "msvcrt/stdio.h" /* For FILENAME_MAX */ -#include "msvcrt/sys/types.h" /* For time_t */ +#ifndef USE_MSVCRT_PREFIX +# include "stdio.h" /* For FILENAME_MAX */ +# include "sys/types.h" /* For time_t */ +#endif /* The following are also defined in dos.h */ #define _A_NORMAL 0x00000000 Index: include/msvcrt/locale.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/locale.h,v retrieving revision 1.3 diff -u -r1.3 locale.h --- include/msvcrt/locale.h 10 Mar 2002 00:02:38 -0000 1.3 +++ include/msvcrt/locale.h 14 Dec 2002 17:37:49 -0000 @@ -21,7 +21,7 @@ #define __WINE_LOCALE_H #define __WINE_USE_MSVCRT -#include "winnt.h" +#include "windef.h" #ifdef USE_MSVCRT_PREFIX #define MSVCRT(x) MSVCRT_##x Index: include/msvcrt/mbstring.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/mbstring.h,v retrieving revision 1.2 diff -u -r1.2 mbstring.h --- include/msvcrt/mbstring.h 10 Mar 2002 00:02:38 -0000 1.2 +++ include/msvcrt/mbstring.h 13 Dec 2002 06:46:26 -0000 @@ -21,7 +21,9 @@ #define __WINE_MBSTRING_H #define __WINE_USE_MSVCRT -#include "msvcrt/mbctype.h" +#ifndef USE_MSVCRT_PREFIX +# include "mbctype.h" +#endif #ifdef USE_MSVCRT_PREFIX #define MSVCRT(x) MSVCRT_##x Index: include/msvcrt/process.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/process.h,v retrieving revision 1.5 diff -u -r1.5 process.h --- include/msvcrt/process.h 2 Feb 2002 18:42:18 -0000 1.5 +++ include/msvcrt/process.h 14 Dec 2002 17:38:00 -0000 @@ -9,7 +9,7 @@ #define __WINE_PROCESS_H #define __WINE_USE_MSVCRT -#include "winnt.h" +#include "windef.h" #ifdef USE_MSVCRT_PREFIX #define MSVCRT(x) MSVCRT_##x Index: include/msvcrt/stddef.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/stddef.h,v retrieving revision 1.5 diff -u -r1.5 stddef.h --- include/msvcrt/stddef.h 30 Nov 2002 19:14:23 -0000 1.5 +++ include/msvcrt/stddef.h 13 Dec 2002 19:34:17 -0000 @@ -21,7 +21,7 @@ #define __WINE_STDDEF_H #define __WINE_USE_MSVCRT -#include "winnt.h" +#include "windef.h" typedef int ptrdiff_t; Index: include/msvcrt/stdio.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/stdio.h,v retrieving revision 1.7 diff -u -r1.7 stdio.h --- include/msvcrt/stdio.h 17 Aug 2002 01:22:00 -0000 1.7 +++ include/msvcrt/stdio.h 13 Dec 2002 06:47:11 -0000 @@ -9,11 +9,12 @@ #define __WINE_STDIO_H #define __WINE_USE_MSVCRT -#ifndef RC_INVOKED -#include <stdarg.h> +#ifndef USE_MSVCRT_PREFIX +# ifndef RC_INVOKED +# include <stdarg.h> +# endif +# include "wctype.h" /* For wint_t */ #endif -#include "msvcrt/wctype.h" /* For wint_t */ - /* file._flag flags */ #ifndef USE_MSVCRT_PREFIX Index: include/msvcrt/stdlib.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/stdlib.h,v retrieving revision 1.7 diff -u -r1.7 stdlib.h --- include/msvcrt/stdlib.h 10 Dec 2002 22:56:44 -0000 1.7 +++ include/msvcrt/stdlib.h 14 Dec 2002 17:41:20 -0000 @@ -9,10 +9,12 @@ #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 */ +#include "windef.h" +#ifndef USE_MSVCRT_PREFIX +# include "malloc.h" /* For size_t, malloc & co */ +# include "search.h" /* For bsearch and qsort */ +#endif #ifndef USE_MSVCRT_PREFIX #define EXIT_SUCCESS 0 Index: include/msvcrt/string.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/string.h,v retrieving revision 1.4 diff -u -r1.4 string.h --- include/msvcrt/string.h 5 Dec 2001 22:11:36 -0000 1.4 +++ include/msvcrt/string.h 14 Dec 2002 17:36:07 -0000 @@ -9,7 +9,7 @@ #define __WINE_STRING_H #define __WINE_USE_MSVCRT -#include "winnt.h" +#include "windef.h" #ifdef USE_MSVCRT_PREFIX #define MSVCRT(x) MSVCRT_##x Index: include/msvcrt/time.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/time.h,v retrieving revision 1.3 diff -u -r1.3 time.h --- include/msvcrt/time.h 10 Mar 2002 00:02:38 -0000 1.3 +++ include/msvcrt/time.h 14 Dec 2002 17:38:18 -0000 @@ -21,8 +21,10 @@ #define __WINE_TIME_H #define __WINE_USE_MSVCRT -#include "winnt.h" -#include "msvcrt/sys/types.h" /* For time_t */ +#include "windef.h" +#ifndef USE_MSVCRT_PREFIX +# include "sys/types.h" /* For time_t */ +#endif #ifndef MSVCRT_SIZE_T_DEFINED Index: include/msvcrt/wchar.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/wchar.h,v retrieving revision 1.3 diff -u -r1.3 wchar.h --- include/msvcrt/wchar.h 22 Oct 2001 18:59:23 -0000 1.3 +++ include/msvcrt/wchar.h 13 Dec 2002 06:48:13 -0000 @@ -9,17 +9,18 @@ #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" - +#ifndef USE_MSVCRT_PREFIX +# include "io.h" +# include "locale.h" +# include "process.h" +# include "stdio.h" +# include "stdlib.h" +# include "string.h" +# include "sys/stat.h" +# include "sys/types.h" +# include "time.h" +# include "wctype.h" +#endif #define WCHAR_MIN 0 #define WCHAR_MAX ((WCHAR)-1) Index: include/msvcrt/sys/stat.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/sys/stat.h,v retrieving revision 1.5 diff -u -r1.5 stat.h --- include/msvcrt/sys/stat.h 31 Jul 2002 20:04:20 -0000 1.5 +++ include/msvcrt/sys/stat.h 13 Dec 2002 06:48:29 -0000 @@ -9,7 +9,9 @@ #define __WINE_SYS_STAT_H #define __WINE_USE_MSVCRT -#include "msvcrt/sys/types.h" +#ifndef USE_MSVCRT_PREFIX +# include "sys/types.h" +#endif #define _S_IEXEC 0x0040 Index: include/msvcrt/sys/timeb.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/sys/timeb.h,v retrieving revision 1.3 diff -u -r1.3 timeb.h --- include/msvcrt/sys/timeb.h 10 Mar 2002 00:02:38 -0000 1.3 +++ include/msvcrt/sys/timeb.h 13 Dec 2002 06:48:43 -0000 @@ -21,7 +21,9 @@ #define __WINE_SYS_TIMEB_H #define __WINE_USE_MSVCRT -#include "msvcrt/sys/types.h" /* For time_t */ +#ifndef USE_MSVCRT_PREFIX +# include "sys/types.h" /* For time_t */ +#endif struct _timeb Index: include/msvcrt/sys/utime.h =================================================================== RCS file: /var/cvs/wine/include/msvcrt/sys/utime.h,v retrieving revision 1.3 diff -u -r1.3 utime.h --- include/msvcrt/sys/utime.h 10 Mar 2002 00:02:38 -0000 1.3 +++ include/msvcrt/sys/utime.h 14 Dec 2002 17:37:16 -0000 @@ -21,9 +21,10 @@ #define __WINE_SYS_UTIME_H #define __WINE_USE_MSVCRT -#include "winnt.h" -#include "msvcrt/sys/types.h" /* For time_t */ - +#include "windef.h" +#ifndef USE_MSVCRT_PREFIX +# include "sys/types.h" /* For time_t */ +#endif struct _utimbuf { -- Dimi.