diff --git a/ms/winrtdef.h b/ms/winrtdef.h
index b1a7598..6ba2e1d 100644
--- a/ms/winrtdef.h
+++ b/ms/winrtdef.h
@@ -6,9 +6,11 @@
 #if defined(OPENSSL_WINAPP)
 //Include stdio.h to replace fprintf
 # include<stdio.h>
+#if !defined(NTDDI_VERSION) || (NTDDI_VERSION < NTDDI_WIN10_RS4)
 # ifdef getenv
 #  undef getenv
 # endif
+#endif
 # ifdef setenv
 #  undef setenv
 # endif
@@ -32,7 +34,9 @@
 #   undef GetModuleHandle
 # define GetModuleHandle winrt_GetModuleHandle
 # endif
+#if !defined(NTDDI_WIN10_RS4) || (NTDDI_VERSION < NTDDI_WIN10_RS4)
 # define getenv winrt_getenv
+#endif
 # define setenv winrt_getenv
 
 int winrt_GetTickCount(void);
