diff --git a/texk/web2c/lib/texmfmp.c b/texk/web2c/lib/texmfmp.c
index e7379c60c0..804209882c 100644
--- a/texk/web2c/lib/texmfmp.c
+++ b/texk/web2c/lib/texmfmp.c
@@ -174,6 +174,8 @@ FILE *Poptr;
 #undef xfopen
 #define fopen fsyscp_fopen
 #define xfopen fsyscp_xfopen
+#undef stat
+#define stat _stat
 #include <wchar.h>
 int
 fsyscp_stat(const char *path, struct stat *buffer)
diff --git a/texk/dvipdfm-x/dpxfile.c b/texk/dvipdfm-x/dpxfile.c
index 2ffa246049..895b085f18 100644
--- a/texk/dvipdfm-x/dpxfile.c
+++ b/texk/dvipdfm-x/dpxfile.c
@@ -160,6 +160,8 @@ static char  _tmpbuf[PATH_MAX+1];
 #endif /* MIKTEX */
 
 #if defined(_WIN32)
+#undef stat
+#define stat _stat
 extern int utf8name_failed;
 int fsyscp_stat(const char *path, struct stat *buffer)
 {
