diff --git a/main.c b/main.c
index 4993b82b08d4356c6fe5da7c22d2ae24783978ae..8c477831029d8be2b75e6c5e181946d157960041 100644
--- a/main.c
+++ b/main.c
@@ -41,8 +41,15 @@
 #include <windows.h>
 #include <winsvc.h>
 #include <shlobj.h>
+
+#ifndef PATH_MAX
 #define PATH_MAX MAX_PATH
+#endif
+
+#ifndef S_ISDIR
 #define S_ISDIR(x) ((x) & _S_IFDIR)
+#endif
+
 #define DIRSEP '\\'
 #define snprintf _snprintf
 #define vsnprintf _vsnprintf
diff --git a/mongoose.c b/mongoose.c
index 7399c5ca3b3adcd92902550f1d126089f54a1fa9..3cb1be74290ac173a41d5f73bf3d989ca452d1c0 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -139,7 +139,10 @@ typedef long off_t;
 #define flockfile(x) EnterCriticalSection(&global_log_file_lock)
 #define funlockfile(x) LeaveCriticalSection(&global_log_file_lock)
 #define sleep(x) Sleep((x) * 1000)
+
+#if !defined(va_copy)
 #define va_copy(x, y) x = y
+#endif // !va_copy MINGW #defines va_copy
 
 #if !defined(fileno)
 #define fileno(x) _fileno(x)