diff --git a/windows/mpconfigport.h b/windows/mpconfigport.h
index 01e066500ad48d5332194c879748ebf13d60c324..fe13a6876303863e0a336dfd523a210e648bd57e 100644
--- a/windows/mpconfigport.h
+++ b/windows/mpconfigport.h
@@ -196,6 +196,13 @@ extern const struct _mp_obj_module_t mp_module_time;
 #define PATH_MAX                    MICROPY_ALLOC_PATH_MAX
 #define S_ISREG(m)                  (((m) & S_IFMT) == S_IFREG)
 #define S_ISDIR(m)                  (((m) & S_IFMT) == S_IFDIR)
+#ifdef _WIN64
+#define SSIZE_MAX                   _I64_MAX
+typedef __int64                     ssize_t;
+#else
+#define SSIZE_MAX                   _I32_MAX
+typedef int                         ssize_t;
+#endif
 
 
 // Put static/global variables in sections with a known name
diff --git a/windows/windows_mphal.h b/windows/windows_mphal.h
index c36889dcbbb49aab11e1c70d59413c4eaa723fd5..dce24845501baac465453367ac26f2c58bf4cd01 100644
--- a/windows/windows_mphal.h
+++ b/windows/windows_mphal.h
@@ -25,7 +25,7 @@
  */
 
 #include "sleep.h"
-#include "unix/unix_mphal.h"
+#include "unix/mphalport.h"
 
 #define MICROPY_HAL_HAS_VT100 (0)