diff --git a/msvc/config.h b/msvc/config.h
index aebf200..2f8d973 100644
--- a/msvc/config.h
+++ b/msvc/config.h
@@ -16,9 +16,11 @@
* config.h: MSVC-specific configuration file
*/
-#define VERSION "0.7 (msvc)"
+#define PACKAGE_VERSION "0.7 (msvc)"
#define SONAME "libzzuf.dll"
+#define ATTRIBUTE_PRINTF(x,y)
+
#define HAVE_WINDOWS_H 1
#define HAVE_WINSOCK2_H 1
#define HAVE_IO_H 1
diff --git a/msvc/libzzuf.vcxproj b/msvc/libzzuf.vcxproj
new file mode 100644
index 0000000..4b112cc
--- /dev/null
+++ b/msvc/libzzuf.vcxproj
@@ -0,0 +1,133 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ {E658DCE5-E1E5-41C8-910B-1CC2D73C435C}
+ ExtStoredProcProj
+
+
+
+ DynamicLibrary
+ MultiByte
+
+
+ DynamicLibrary
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.21006.1
+ Debug\
+ Debug\
+ true
+ Release\
+ Release\
+ false
+ AllRules.ruleset
+
+
+ AllRules.ruleset
+
+
+
+
+
+ Disabled
+ ..\msvc;%(AdditionalIncludeDirectories)
+ WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)
+ true
+ EnableFastChecks
+ MultiThreadedDebugDLL
+ $(IntDir).libs/
+ Level3
+ EditAndContinue
+
+
+ imagehlp.lib;%(AdditionalDependencies)
+ true
+ Windows
+ MachineX86
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ false
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ 0x0409
+
+
+
+
+ ..\msvc;%(AdditionalIncludeDirectories)
+ WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)
+ MultiThreadedDLL
+ $(IntDir).libs/
+ Level3
+ ProgramDatabase
+
+
+ imagehlp.lib;%(AdditionalDependencies)
+ true
+ Windows
+ true
+ true
+ MachineX86
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ false
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ 0x0409
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/msvc/zzuf.vcxproj b/msvc/zzuf.vcxproj
new file mode 100644
index 0000000..c58717d
--- /dev/null
+++ b/msvc/zzuf.vcxproj
@@ -0,0 +1,121 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ {2E5723ED-A886-45A9-AAAC-3D02F2EFC358}
+ Win32Proj
+
+
+
+ Application
+ MultiByte
+
+
+ Application
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.21006.1
+ Debug\
+ Debug\
+ true
+ Release\
+ Release\
+ false
+ AllRules.ruleset
+
+
+ AllRules.ruleset
+
+
+
+
+
+ Disabled
+ ..\msvc;%(AdditionalIncludeDirectories)
+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ EnableFastChecks
+ MultiThreadedDebug
+
+
+ Level3
+ EditAndContinue
+
+
+ ws2_32.lib;%(AdditionalDependencies)
+ $(OutDir)zzuf.exe
+ true
+ $(OutDir)zzuf.pdb
+ Console
+ MachineX86
+
+
+
+
+ ..\msvc;%(AdditionalIncludeDirectories)
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ MultiThreaded
+
+
+ Level3
+ ProgramDatabase
+
+
+ ws2_32.lib;%(AdditionalDependencies)
+ $(OutDir)zzuf.exe
+ true
+ Console
+ true
+ true
+ MachineX86
+
+
+
+
+
+
+
+
+
+
+
+
+ $(IntDir)%(FileName)1.obj
+ $(IntDir)%(FileName)1.obj
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/msvc/zzuf10.sln b/msvc/zzuf10.sln
new file mode 100644
index 0000000..01c85a0
--- /dev/null
+++ b/msvc/zzuf10.sln
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zzuf", "zzuf.vcxproj", "{2E5723ED-A886-45A9-AAAC-3D02F2EFC358}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzzuf", "libzzuf.vcxproj", "{E658DCE5-E1E5-41C8-910B-1CC2D73C435C}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2E5723ED-A886-45A9-AAAC-3D02F2EFC358}.Debug|Win32.ActiveCfg = Debug|Win32
+ {2E5723ED-A886-45A9-AAAC-3D02F2EFC358}.Debug|Win32.Build.0 = Debug|Win32
+ {2E5723ED-A886-45A9-AAAC-3D02F2EFC358}.Release|Win32.ActiveCfg = Release|Win32
+ {2E5723ED-A886-45A9-AAAC-3D02F2EFC358}.Release|Win32.Build.0 = Release|Win32
+ {E658DCE5-E1E5-41C8-910B-1CC2D73C435C}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E658DCE5-E1E5-41C8-910B-1CC2D73C435C}.Debug|Win32.Build.0 = Debug|Win32
+ {E658DCE5-E1E5-41C8-910B-1CC2D73C435C}.Release|Win32.ActiveCfg = Release|Win32
+ {E658DCE5-E1E5-41C8-910B-1CC2D73C435C}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/src/network.c b/src/network.c
index 5c25758..1d2dc02 100644
--- a/src/network.c
+++ b/src/network.c
@@ -26,15 +26,18 @@
#include
#include
#include
-#include
-#include
-#include
+#if defined HAVE_SYS_SOCKET_H
+# include
+# include
+# include
+#endif
#include "libzzuf.h"
#include "debug.h"
#include "ranges.h"
#include "network.h"
+#if defined HAVE_SYS_SOCKET_H
static unsigned int get_socket_ip(int);
static int host_in_list(unsigned int, unsigned int const *);
static unsigned int *create_host_list(char const *, unsigned int *);
@@ -48,6 +51,7 @@ static unsigned int static_deny[512];
/* Network port cherry picking */
static int *ports = NULL;
static int static_ports[512];
+#endif
void _zz_network_init(void)
{
@@ -56,39 +60,52 @@ void _zz_network_init(void)
void _zz_network_fini(void)
{
+#if defined HAVE_SYS_SOCKET_H
if(ports != static_ports)
free(ports);
if(allow != static_allow)
free(allow);
if(deny != static_deny)
free(deny);
+#endif
}
void _zz_allow(char const *allowlist)
{
+#if defined HAVE_SYS_SOCKET_H
allow = create_host_list(allowlist, static_allow);
+#endif
}
void _zz_deny(char const *denylist)
{
+#if defined HAVE_SYS_SOCKET_H
deny = create_host_list(denylist, static_deny);
+#endif
}
void _zz_ports(char const *portlist)
{
+#if defined HAVE_SYS_SOCKET_H
ports = _zz_allocrange(portlist, static_ports);
+#endif
}
int _zz_portwatched(int port)
{
+#if defined HAVE_SYS_SOCKET_H
if(!ports)
return 1;
return _zz_isinrange(port, ports);
+#else
+ return 0;
+#endif
}
int _zz_hostwatched(int sock)
{
+#if defined HAVE_SYS_SOCKET_H
int watch = 1;
unsigned int ip;
@@ -103,10 +120,14 @@ int _zz_hostwatched(int sock)
watch = host_in_list(ip, allow);
return watch;
+#else
+ return 0;
+#endif
}
/* XXX: the following functions are local */
+#if defined HAVE_SYS_SOCKET_H
static unsigned int *create_host_list(char const *list,
unsigned int *static_list)
{
@@ -192,4 +213,4 @@ static unsigned int get_socket_ip(int sock)
return sin.sin_addr.s_addr;
}
-
+#endif /* HAVE_SYS_SOCKET_H */