Fixed some issues found by winapi_check.

diff --git a/misc/registry.c b/misc/registry.c
index afe70ba..a79d1b4 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -30,6 +30,7 @@
 #include <sys/errno.h>
 #endif
 #include <sys/types.h>
+#include <fcntl.h>
 #include <sys/fcntl.h>
 #include <sys/stat.h>
 #include <assert.h>
@@ -731,7 +732,10 @@
     }
 }
 /* NT REGISTRY LOADER */
-#include <sys/mman.h>
+
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif
 
 #ifndef MAP_FAILED
 #define MAP_FAILED ((LPVOID)-1)