headers: crt: split out corecrt_wdirect.h

Also removed _WDIRECT_DEFINED.

Signed-off-by: Zhongteng Gui <dragon-archer@outlook.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-headers/crt/corecrt_wdirect.h b/mingw-w64-headers/crt/corecrt_wdirect.h
new file mode 100644
index 0000000..5519f8a
--- /dev/null
+++ b/mingw-w64-headers/crt/corecrt_wdirect.h
@@ -0,0 +1,37 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#ifndef _INC_CORECRT_WDIRECT
+#define _INC_CORECRT_WDIRECT
+
+#include <corecrt.h>
+
+_CRT_BEGIN_C_HEADER
+
+#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
+#pragma push_macro("_wgetcwd")
+#undef _wgetcwd
+#pragma push_macro("_wgetdcwd")
+#undef _wgetdcwd
+#pragma push_macro("_wgetdcwd_nolock")
+#undef _wgetdcwd_nolock
+#endif
+  _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords);
+  _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords);
+#if __MSVCRT_VERSION__ >= 0x800
+  wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords);
+#endif
+#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
+#pragma pop_macro("_wgetcwd")
+#pragma pop_macro("_wgetdcwd")
+#pragma pop_macro("_wgetdcwd_nolock")
+#endif
+  _CRTIMP int __cdecl _wchdir(const wchar_t *_Path);
+  _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path);
+  _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path);
+
+_CRT_END_C_HEADER
+
+#endif /* _INC_CORECRT_WDIRECT */
diff --git a/mingw-w64-headers/crt/direct.h b/mingw-w64-headers/crt/direct.h
index f1a3983..660b05e 100644
--- a/mingw-w64-headers/crt/direct.h
+++ b/mingw-w64-headers/crt/direct.h
@@ -8,6 +8,7 @@
 
 #include <crtdefs.h>
 #include <io.h>
+#include <corecrt_wdirect.h>
 
 _CRT_BEGIN_C_HEADER
 
@@ -53,31 +54,6 @@
 #endif
 #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */
 
-#ifndef _WDIRECT_DEFINED
-#define _WDIRECT_DEFINED
-#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
-#pragma push_macro("_wgetcwd")
-#undef _wgetcwd
-#pragma push_macro("_wgetdcwd")
-#undef _wgetdcwd
-#pragma push_macro("_wgetdcwd_nolock")
-#undef _wgetdcwd_nolock
-#endif
-  _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords);
-  _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords);
-#if __MSVCRT_VERSION__ >= 0x800
-  wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords);
-#endif
-#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
-#pragma pop_macro("_wgetcwd")
-#pragma pop_macro("_wgetdcwd")
-#pragma pop_macro("_wgetdcwd_nolock")
-#endif
-  _CRTIMP int __cdecl _wchdir(const wchar_t *_Path);
-  _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path);
-  _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path);
-#endif
-
 #ifndef	NO_OLDNAMES
 
 #define diskfree_t _diskfree_t
diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h
index 705f153..13d9882 100644
--- a/mingw-w64-headers/crt/wchar.h
+++ b/mingw-w64-headers/crt/wchar.h
@@ -9,6 +9,7 @@
 #include <corecrt.h>
 #include <corecrt_wconio.h>
 #include <corecrt_wctype.h>
+#include <corecrt_wdirect.h>
 #include <corecrt_wio.h>
 #include <corecrt_wprocess.h>
 #include <corecrt_wstdio.h>
@@ -28,32 +29,6 @@
 #define WCHAR_MAX 0xffffU
 #endif
 
-#ifndef _WDIRECT_DEFINED
-#define _WDIRECT_DEFINED
-
-#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
-#pragma push_macro("_wgetcwd")
-#undef _wgetcwd
-#pragma push_macro("_wgetdcwd")
-#undef _wgetdcwd
-#pragma push_macro("_wgetdcwd_nolock")
-#undef _wgetdcwd_nolock
-#endif
-  _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords);
-  _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords);
-#if __MSVCRT_VERSION__ >= 0x800
-  wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords);
-#endif
-#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
-#pragma pop_macro("_wgetcwd")
-#pragma pop_macro("_wgetdcwd")
-#pragma pop_macro("_wgetdcwd_nolock")
-#endif
-  _CRTIMP int __cdecl _wchdir(const wchar_t *_Path);
-  _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path);
-  _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path);
-#endif
-
 #if !defined(_POSIX_) || defined(__GNUC__)
 #ifndef _INO_T_DEFINED
 #define _INO_T_DEFINED