Эх сурвалжийг харах

vlmcsd-svn1031-2016-10-06-Hotbird64

Wind4 9 жил өмнө
parent
commit
d413afbadf
54 өөрчлөгдсөн 2348 нэмэгдсэн , 691 устгасан
  1. 236 0
      VisualStudio/libkms/libkms.vcxproj
  2. 93 0
      VisualStudio/libkms/libkms.vcxproj.filters
  3. BIN
      VisualStudio/msvcrt.lib
  4. BIN
      VisualStudio/msvcrt64.lib
  5. 227 0
      VisualStudio/vlmcs/vlmcs.vcxproj
  6. 102 0
      VisualStudio/vlmcs/vlmcs.vcxproj.filters
  7. 58 0
      VisualStudio/vlmcsd-2015-with-2013-c++-build-tools.sln
  8. 229 0
      VisualStudio/vlmcsd.vcxproj
  9. 102 0
      VisualStudio/vlmcsd.vcxproj.filters
  10. 231 0
      VisualStudio/vlmcsdmulti/vlmcsdmulti.vcxproj
  11. 114 0
      VisualStudio/vlmcsdmulti/vlmcsdmulti.vcxproj.filters
  12. 1 1
      crypto.c
  13. 1 3
      crypto.h
  14. 1 1
      crypto_internal.c
  15. 2 2
      crypto_windows.c
  16. 4 1
      crypto_windows.h
  17. 1 1
      dns_srv.c
  18. 1 1
      dns_srv.h
  19. BIN
      floppy144.vfd
  20. 18 6
      helpers.c
  21. 15 7
      kms.c
  22. 4 0
      kms.h
  23. 2 2
      libkms.c
  24. 8 8
      make_linux
  25. 4 4
      make_osx
  26. 17 7
      make_windows
  27. 2 0
      msrpc-client.h
  28. 11 12
      network.c
  29. 7 0
      network.h
  30. 1 1
      ntservice.c
  31. 11 3
      output.c
  32. 1 0
      output.h
  33. 18 17
      rpc.c
  34. 11 1
      rpc.h
  35. 2 0
      shared_globals.h
  36. 36 8
      types.h
  37. 1 1
      vlmcs.1.html
  38. BIN
      vlmcs.1.pdf
  39. 37 17
      vlmcs.c
  40. 1 1
      vlmcsd-floppy.7.html
  41. BIN
      vlmcsd-floppy.7.pdf
  42. 1 1
      vlmcsd.7.html
  43. BIN
      vlmcsd.7.pdf
  44. 1 1
      vlmcsd.8.html
  45. BIN
      vlmcsd.8.pdf
  46. 581 570
      vlmcsd.c
  47. 0 2
      vlmcsd.h
  48. 1 1
      vlmcsd.ini.5.html
  49. BIN
      vlmcsd.ini.5.pdf
  50. 1 1
      vlmcsdmulti.1.html
  51. BIN
      vlmcsdmulti.1.pdf
  52. 45 10
      vlmcsdmulti.c
  53. 76 0
      wingetopt.c
  54. 32 0
      wingetopt.h

+ 236 - 0
VisualStudio/libkms/libkms.vcxproj

@@ -0,0 +1,236 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{2A0FC04D-C3C0-43E2-8812-53AE901C5395}</ProjectGuid>
+    <RootNamespace>vlmcsdmulti</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140_xp</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v120_xp</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140_xp</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v120_xp</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>$(SolutionDir)..\</OutDir>
+    <TargetName>libkms32</TargetName>
+    <GenerateManifest>false</GenerateManifest>
+    <TargetExt>.dll</TargetExt>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <OutDir>$(SolutionDir)..\</OutDir>
+    <TargetName>libkms64</TargetName>
+    <GenerateManifest>false</GenerateManifest>
+    <TargetExt>.dll</TargetExt>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <GenerateManifest>false</GenerateManifest>
+    <TargetName>$(ProjectName)64</TargetName>
+    <TargetExt>.dll</TargetExt>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <GenerateManifest>false</GenerateManifest>
+    <TargetExt>.dll</TargetExt>
+    <TargetName>$(ProjectName)32</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <CompileAs>Default</CompileAs>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <PreprocessorDefinitions>_USING_V110_SDK71_;_MBCS;%(PreprocessorDefinitions);_CRYPTO_WINDOWS;_PEDANTIC;SIMPLE_SOCKETS;NO_TIMEOUT;NO_SIGHUP;NO_CL_PIDS;NO_EXTENDED_PRODUCT_LIST;NO_BASIC_PRODUCT_LIST;NO_LOG;NO_RANDOM_EPID;NO_INI_FILE;NO_HELP;NO_CUSTOM_INTERVALS;NO_PID_FILE;NO_USER_SWITCH;NO_VERBOSE_LOG;NO_LIMIT;NO_VERSION_INFORMATION;NO_PRIVATE_IP_DETECT;IS_LIBRARY=1</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>shlwapi.lib;Iphlpapi.lib;Dnsapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <SubSystem>NotSet</SubSystem>
+      <MinimumRequiredVersion />
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_USING_V110_SDK71_;%(PreprocessorDefinitions);_CRYPTO_WINDOWS;_PEDANTIC;SIMPLE_SOCKETS;NO_TIMEOUT;NO_SIGHUP;NO_CL_PIDS;NO_EXTENDED_PRODUCT_LIST;NO_BASIC_PRODUCT_LIST;NO_LOG;NO_RANDOM_EPID;NO_INI_FILE;NO_HELP;NO_CUSTOM_INTERVALS;NO_PID_FILE;NO_USER_SWITCH;NO_VERBOSE_LOG;NO_LIMIT;NO_VERSION_INFORMATION;NO_PRIVATE_IP_DETECT;IS_LIBRARY=1</PreprocessorDefinitions>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>shlwapi.lib;Iphlpapi.lib;Dnsapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <SubSystem>NotSet</SubSystem>
+      <MinimumRequiredVersion />
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MinSpace</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>
+      </SDLCheck>
+      <CallingConvention>Cdecl</CallingConvention>
+      <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+      <OmitFramePointers>true</OmitFramePointers>
+      <StringPooling>true</StringPooling>
+      <ExceptionHandling>false</ExceptionHandling>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <FloatingPointModel>Fast</FloatingPointModel>
+      <FloatingPointExceptions>false</FloatingPointExceptions>
+      <CreateHotpatchableImage>false</CreateHotpatchableImage>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <OpenMPSupport>false</OpenMPSupport>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <PreprocessorDefinitions>_X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions);_CRYPTO_WINDOWS;SIMPLE_SOCKETS;NO_TIMEOUT;NO_SIGHUP;NO_CL_PIDS;NO_EXTENDED_PRODUCT_LIST;NO_BASIC_PRODUCT_LIST;NO_LOG;NO_RANDOM_EPID;NO_INI_FILE;NO_HELP;NO_CUSTOM_INTERVALS;NO_PID_FILE;NO_USER_SWITCH;NO_VERBOSE_LOG;NO_LIMIT;NO_VERSION_INFORMATION;NO_PRIVATE_IP_DETECT;IS_LIBRARY=1</PreprocessorDefinitions>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>$(SolutionDir)\msvcrt.lib;Shlwapi.lib;Iphlpapi.lib;Dnsapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <GenerateDebugInformation>false</GenerateDebugInformation>
+      <SubSystem>NotSet</SubSystem>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+      <LargeAddressAware>true</LargeAddressAware>
+      <TerminalServerAware>
+      </TerminalServerAware>
+      <SwapRunFromCD>true</SwapRunFromCD>
+      <SwapRunFromNET>true</SwapRunFromNET>
+      <MinimumRequiredVersion />
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MinSpace</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>
+      </SDLCheck>
+      <PreprocessorDefinitions>_USING_V110_SDK71_;%(PreprocessorDefinitions);_CRYPTO_WINDOWS;SIMPLE_SOCKETS;NO_TIMEOUT;NO_SIGHUP;NO_CL_PIDS;NO_EXTENDED_PRODUCT_LIST;NO_BASIC_PRODUCT_LIST;NO_LOG;NO_RANDOM_EPID;NO_INI_FILE;NO_HELP;NO_CUSTOM_INTERVALS;NO_PID_FILE;NO_USER_SWITCH;NO_VERBOSE_LOG;NO_LIMIT;NO_VERSION_INFORMATION;NO_PRIVATE_IP_DETECT;IS_LIBRARY=1</PreprocessorDefinitions>
+      <DebugInformationFormat>None</DebugInformationFormat>
+      <TreatWarningAsError>false</TreatWarningAsError>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+      <StringPooling>true</StringPooling>
+      <ExceptionHandling>false</ExceptionHandling>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <FloatingPointModel>Fast</FloatingPointModel>
+      <FloatingPointExceptions>false</FloatingPointExceptions>
+      <CreateHotpatchableImage>false</CreateHotpatchableImage>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <OpenMPSupport>false</OpenMPSupport>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>$(SolutionDir)\msvcrt64.lib;Shlwapi.lib;Iphlpapi.lib;Dnsapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+      <GenerateDebugInformation>false</GenerateDebugInformation>
+      <SubSystem>NotSet</SubSystem>
+      <LargeAddressAware>true</LargeAddressAware>
+      <TerminalServerAware>
+      </TerminalServerAware>
+      <SwapRunFromCD>true</SwapRunFromCD>
+      <SwapRunFromNET>true</SwapRunFromNET>
+      <MinimumRequiredVersion />
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\crypto.c" />
+    <ClCompile Include="..\..\crypto_windows.c" />
+    <ClCompile Include="..\..\endian.c" />
+    <ClCompile Include="..\..\helpers.c" />
+    <ClCompile Include="..\..\kms.c" />
+    <ClCompile Include="..\..\libkms.c" />
+    <ClCompile Include="..\..\network.c" />
+    <ClCompile Include="..\..\output.c" />
+    <ClCompile Include="..\..\rpc.c" />
+    <ClCompile Include="..\..\shared_globals.c" />
+    <ClCompile Include="..\..\vlmcs.c" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\config.h" />
+    <ClInclude Include="..\..\crypto.h" />
+    <ClInclude Include="..\..\crypto_windows.h" />
+    <ClInclude Include="..\..\endian.h" />
+    <ClInclude Include="..\..\helpers.h" />
+    <ClInclude Include="..\..\kms.h" />
+    <ClInclude Include="..\..\libkms.h" />
+    <ClInclude Include="..\..\network.h" />
+    <ClInclude Include="..\..\output.h" />
+    <ClInclude Include="..\..\rpc.h" />
+    <ClInclude Include="..\..\shared_globals.h" />
+    <ClInclude Include="..\..\types.h" />
+    <ClInclude Include="..\..\vlmcs.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 93 - 0
VisualStudio/libkms/libkms.vcxproj.filters

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\crypto.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\crypto_windows.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\endian.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\helpers.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\kms.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\network.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\output.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\rpc.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\shared_globals.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\vlmcs.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\libkms.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\config.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\crypto.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\crypto_windows.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\endian.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\helpers.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\kms.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\network.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\output.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\rpc.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\shared_globals.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\types.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\vlmcs.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\libkms.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

BIN
VisualStudio/msvcrt.lib


BIN
VisualStudio/msvcrt64.lib


+ 227 - 0
VisualStudio/vlmcs/vlmcs.vcxproj

@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{2B3F305D-6351-4F4A-A7F2-1F9B1988CDEE}</ProjectGuid>
+    <RootNamespace>vlmcs</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140_xp</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v120_xp</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140_xp</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v120_xp</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>$(SolutionDir)..\</OutDir>
+    <TargetName>vlmcs-Windows-x86</TargetName>
+    <GenerateManifest>false</GenerateManifest>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <OutDir>$(SolutionDir)..\</OutDir>
+    <TargetName>vlmcs-Windows-x64</TargetName>
+    <GenerateManifest>false</GenerateManifest>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <GenerateManifest>false</GenerateManifest>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <GenerateManifest>false</GenerateManifest>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <CompileAs>Default</CompileAs>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <PreprocessorDefinitions>_USING_V110_SDK71_;_MBCS;%(PreprocessorDefinitions);_CRYPTO_WINDOWS;_PEDANTIC</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>shlwapi.lib;Iphlpapi.lib;Dnsapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <SubSystem>Console</SubSystem>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_USING_V110_SDK71_;%(PreprocessorDefinitions);_CRYPTO_WINDOWS;_PEDANTIC</PreprocessorDefinitions>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>shlwapi.lib;Iphlpapi.lib;Dnsapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <SubSystem>Console</SubSystem>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MinSpace</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>
+      </SDLCheck>
+      <CallingConvention>Cdecl</CallingConvention>
+      <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+      <OmitFramePointers>true</OmitFramePointers>
+      <StringPooling>true</StringPooling>
+      <ExceptionHandling>false</ExceptionHandling>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <FloatingPointModel>Fast</FloatingPointModel>
+      <FloatingPointExceptions>false</FloatingPointExceptions>
+      <CreateHotpatchableImage>false</CreateHotpatchableImage>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <OpenMPSupport>false</OpenMPSupport>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <PreprocessorDefinitions>_X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions);_CRYPTO_WINDOWS</PreprocessorDefinitions>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>$(SolutionDir)\msvcrt.lib;Shlwapi.lib;Iphlpapi.lib;Dnsapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <GenerateDebugInformation>false</GenerateDebugInformation>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+      <LargeAddressAware>true</LargeAddressAware>
+      <TerminalServerAware>true</TerminalServerAware>
+      <SwapRunFromCD>true</SwapRunFromCD>
+      <SwapRunFromNET>true</SwapRunFromNET>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MinSpace</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>
+      </SDLCheck>
+      <PreprocessorDefinitions>_USING_V110_SDK71_;%(PreprocessorDefinitions);_CRYPTO_WINDOWS</PreprocessorDefinitions>
+      <DebugInformationFormat>None</DebugInformationFormat>
+      <TreatWarningAsError>false</TreatWarningAsError>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+      <StringPooling>true</StringPooling>
+      <ExceptionHandling>false</ExceptionHandling>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <FloatingPointModel>Fast</FloatingPointModel>
+      <FloatingPointExceptions>false</FloatingPointExceptions>
+      <CreateHotpatchableImage>false</CreateHotpatchableImage>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <OpenMPSupport>false</OpenMPSupport>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>$(SolutionDir)\msvcrt64.lib;Shlwapi.lib;Iphlpapi.lib;Dnsapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+      <GenerateDebugInformation>false</GenerateDebugInformation>
+      <SubSystem>Console</SubSystem>
+      <LargeAddressAware>true</LargeAddressAware>
+      <TerminalServerAware>true</TerminalServerAware>
+      <SwapRunFromCD>true</SwapRunFromCD>
+      <SwapRunFromNET>true</SwapRunFromNET>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\crypto.c" />
+    <ClCompile Include="..\..\crypto_windows.c" />
+    <ClCompile Include="..\..\dns_srv.c" />
+    <ClCompile Include="..\..\endian.c" />
+    <ClCompile Include="..\..\helpers.c" />
+    <ClCompile Include="..\..\kms.c" />
+    <ClCompile Include="..\..\network.c" />
+    <ClCompile Include="..\..\output.c" />
+    <ClCompile Include="..\..\rpc.c" />
+    <ClCompile Include="..\..\shared_globals.c" />
+    <ClCompile Include="..\..\vlmcs.c" />
+    <ClCompile Include="..\..\wingetopt.c" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\config.h" />
+    <ClInclude Include="..\..\crypto.h" />
+    <ClInclude Include="..\..\crypto_internal.h" />
+    <ClInclude Include="..\..\crypto_windows.h" />
+    <ClInclude Include="..\..\dns_srv.h" />
+    <ClInclude Include="..\..\endian.h" />
+    <ClInclude Include="..\..\helpers.h" />
+    <ClInclude Include="..\..\kms.h" />
+    <ClInclude Include="..\..\network.h" />
+    <ClInclude Include="..\..\output.h" />
+    <ClInclude Include="..\..\rpc.h" />
+    <ClInclude Include="..\..\shared_globals.h" />
+    <ClInclude Include="..\..\types.h" />
+    <ClInclude Include="..\..\vlmcs.h" />
+    <ClInclude Include="..\..\wingetopt.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 102 - 0
VisualStudio/vlmcs/vlmcs.vcxproj.filters

@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\crypto.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\crypto_windows.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\dns_srv.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\endian.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\helpers.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\kms.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\network.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\output.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\rpc.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\shared_globals.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\vlmcs.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\wingetopt.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\config.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\crypto.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\crypto_internal.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\crypto_windows.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\dns_srv.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\endian.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\helpers.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\kms.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\network.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\output.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\rpc.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\shared_globals.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\types.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\vlmcs.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\wingetopt.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 58 - 0
VisualStudio/vlmcsd-2015-with-2013-c++-build-tools.sln

@@ -0,0 +1,58 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vlmcsd", "vlmcsd.vcxproj", "{918B4F5B-6356-451E-998C-5FCB29988170}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vlmcs", "vlmcs\vlmcs.vcxproj", "{2B3F305D-6351-4F4A-A7F2-1F9B1988CDEE}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vlmcsdmulti", "vlmcsdmulti\vlmcsdmulti.vcxproj", "{7F07671D-1432-43E9-9D72-08435F216B5E}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libkms", "libkms\libkms.vcxproj", "{2A0FC04D-C3C0-43E2-8812-53AE901C5395}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{918B4F5B-6356-451E-998C-5FCB29988170}.Debug|x64.ActiveCfg = Debug|x64
+		{918B4F5B-6356-451E-998C-5FCB29988170}.Debug|x64.Build.0 = Debug|x64
+		{918B4F5B-6356-451E-998C-5FCB29988170}.Debug|x86.ActiveCfg = Debug|Win32
+		{918B4F5B-6356-451E-998C-5FCB29988170}.Debug|x86.Build.0 = Debug|Win32
+		{918B4F5B-6356-451E-998C-5FCB29988170}.Release|x64.ActiveCfg = Release|x64
+		{918B4F5B-6356-451E-998C-5FCB29988170}.Release|x64.Build.0 = Release|x64
+		{918B4F5B-6356-451E-998C-5FCB29988170}.Release|x86.ActiveCfg = Release|Win32
+		{918B4F5B-6356-451E-998C-5FCB29988170}.Release|x86.Build.0 = Release|Win32
+		{2B3F305D-6351-4F4A-A7F2-1F9B1988CDEE}.Debug|x64.ActiveCfg = Debug|x64
+		{2B3F305D-6351-4F4A-A7F2-1F9B1988CDEE}.Debug|x64.Build.0 = Debug|x64
+		{2B3F305D-6351-4F4A-A7F2-1F9B1988CDEE}.Debug|x86.ActiveCfg = Debug|Win32
+		{2B3F305D-6351-4F4A-A7F2-1F9B1988CDEE}.Debug|x86.Build.0 = Debug|Win32
+		{2B3F305D-6351-4F4A-A7F2-1F9B1988CDEE}.Release|x64.ActiveCfg = Release|x64
+		{2B3F305D-6351-4F4A-A7F2-1F9B1988CDEE}.Release|x64.Build.0 = Release|x64
+		{2B3F305D-6351-4F4A-A7F2-1F9B1988CDEE}.Release|x86.ActiveCfg = Release|Win32
+		{2B3F305D-6351-4F4A-A7F2-1F9B1988CDEE}.Release|x86.Build.0 = Release|Win32
+		{7F07671D-1432-43E9-9D72-08435F216B5E}.Debug|x64.ActiveCfg = Debug|x64
+		{7F07671D-1432-43E9-9D72-08435F216B5E}.Debug|x64.Build.0 = Debug|x64
+		{7F07671D-1432-43E9-9D72-08435F216B5E}.Debug|x86.ActiveCfg = Debug|Win32
+		{7F07671D-1432-43E9-9D72-08435F216B5E}.Debug|x86.Build.0 = Debug|Win32
+		{7F07671D-1432-43E9-9D72-08435F216B5E}.Release|x64.ActiveCfg = Release|x64
+		{7F07671D-1432-43E9-9D72-08435F216B5E}.Release|x64.Build.0 = Release|x64
+		{7F07671D-1432-43E9-9D72-08435F216B5E}.Release|x86.ActiveCfg = Release|Win32
+		{7F07671D-1432-43E9-9D72-08435F216B5E}.Release|x86.Build.0 = Release|Win32
+		{2A0FC04D-C3C0-43E2-8812-53AE901C5395}.Debug|x64.ActiveCfg = Debug|x64
+		{2A0FC04D-C3C0-43E2-8812-53AE901C5395}.Debug|x64.Build.0 = Debug|x64
+		{2A0FC04D-C3C0-43E2-8812-53AE901C5395}.Debug|x86.ActiveCfg = Debug|Win32
+		{2A0FC04D-C3C0-43E2-8812-53AE901C5395}.Debug|x86.Build.0 = Debug|Win32
+		{2A0FC04D-C3C0-43E2-8812-53AE901C5395}.Release|x64.ActiveCfg = Release|x64
+		{2A0FC04D-C3C0-43E2-8812-53AE901C5395}.Release|x64.Build.0 = Release|x64
+		{2A0FC04D-C3C0-43E2-8812-53AE901C5395}.Release|x86.ActiveCfg = Release|Win32
+		{2A0FC04D-C3C0-43E2-8812-53AE901C5395}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 229 - 0
VisualStudio/vlmcsd.vcxproj

@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{918B4F5B-6356-451E-998C-5FCB29988170}</ProjectGuid>
+    <RootNamespace>vlmcsd</RootNamespace>
+    <WindowsTargetPlatformVersion>
+    </WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140_xp</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140_xp</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v120_xp</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v120_xp</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <GenerateManifest>false</GenerateManifest>
+    <OutDir>$(SolutionDir)..\</OutDir>
+    <TargetName>vlmcsd-Windows-x64</TargetName>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+    <GenerateManifest>false</GenerateManifest>
+    <TargetName>vlmcsd-Windows-x86</TargetName>
+    <OutDir>$(SolutionDir)..\</OutDir>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <PreprocessorDefinitions>_USING_V110_SDK71_;%(PreprocessorDefinitions);_CRYPTO_WINDOWS;_PEDANTIC</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <AdditionalDependencies>Iphlpapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_USING_V110_SDK71_;%(PreprocessorDefinitions);_CRYPTO_WINDOWS;_PEDANTIC</PreprocessorDefinitions>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <AdditionalDependencies>Iphlpapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MinSpace</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>
+      </SDLCheck>
+      <StringPooling>true</StringPooling>
+      <ExceptionHandling>false</ExceptionHandling>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <ControlFlowGuard>false</ControlFlowGuard>
+      <CreateHotpatchableImage>false</CreateHotpatchableImage>
+      <CallingConvention>Cdecl</CallingConvention>
+      <CompileAs>Default</CompileAs>
+      <DebugInformationFormat>None</DebugInformationFormat>
+      <CompileAsManaged>false</CompileAsManaged>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+      <OmitFramePointers>true</OmitFramePointers>
+      <FloatingPointModel>Fast</FloatingPointModel>
+      <FloatingPointExceptions>false</FloatingPointExceptions>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <OpenMPSupport>false</OpenMPSupport>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <TreatWarningAsError>false</TreatWarningAsError>
+      <PreprocessorDefinitions>_X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions);_CRYPTO_WINDOWS</PreprocessorDefinitions>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+      <CompileAsWinRT>false</CompileAsWinRT>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <SubSystem>Console</SubSystem>
+      <AdditionalDependencies>$(SolutionDir)\msvcrt.lib;Iphlpapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <GenerateDebugInformation>false</GenerateDebugInformation>
+      <ProgramDatabaseFile />
+      <LargeAddressAware>true</LargeAddressAware>
+      <TerminalServerAware>true</TerminalServerAware>
+      <SwapRunFromCD>true</SwapRunFromCD>
+      <SwapRunFromNET>true</SwapRunFromNET>
+      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MinSpace</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>
+      </SDLCheck>
+      <DebugInformationFormat>None</DebugInformationFormat>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+      <OmitFramePointers>true</OmitFramePointers>
+      <StringPooling>true</StringPooling>
+      <ExceptionHandling>false</ExceptionHandling>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <ControlFlowGuard>false</ControlFlowGuard>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <OpenMPSupport>false</OpenMPSupport>
+      <PreprocessorDefinitions>_USING_V110_SDK71_;%(PreprocessorDefinitions);_CRYPTO_WINDOWS</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <CompileAsManaged>false</CompileAsManaged>
+      <TreatWarningAsError>false</TreatWarningAsError>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <SubSystem>Console</SubSystem>
+      <AdditionalDependencies>$(SolutionDir)\msvcrt64.lib;Iphlpapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <GenerateDebugInformation>false</GenerateDebugInformation>
+      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+      <ProgramDatabaseFile />
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClInclude Include="..\config.h" />
+    <ClInclude Include="..\crypto.h" />
+    <ClInclude Include="..\crypto_internal.h" />
+    <ClInclude Include="..\crypto_windows.h" />
+    <ClInclude Include="..\endian.h" />
+    <ClInclude Include="..\helpers.h" />
+    <ClInclude Include="..\kms.h" />
+    <ClInclude Include="..\network.h" />
+    <ClInclude Include="..\ntservice.h" />
+    <ClInclude Include="..\output.h" />
+    <ClInclude Include="..\rpc.h" />
+    <ClInclude Include="..\shared_globals.h" />
+    <ClInclude Include="..\types.h" />
+    <ClInclude Include="..\vlmcsd.h" />
+    <ClInclude Include="..\wingetopt.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\crypto.c" />
+    <ClCompile Include="..\crypto_windows.c" />
+    <ClCompile Include="..\endian.c" />
+    <ClCompile Include="..\helpers.c" />
+    <ClCompile Include="..\kms.c" />
+    <ClCompile Include="..\network.c" />
+    <ClCompile Include="..\ntservice.c" />
+    <ClCompile Include="..\output.c" />
+    <ClCompile Include="..\rpc.c" />
+    <ClCompile Include="..\shared_globals.c" />
+    <ClCompile Include="..\vlmcsd.c" />
+    <ClCompile Include="..\wingetopt.c" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 102 - 0
VisualStudio/vlmcsd.vcxproj.filters

@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\config.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\crypto.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\crypto_internal.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\crypto_windows.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\endian.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\helpers.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\kms.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\network.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\ntservice.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\output.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\rpc.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\shared_globals.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\types.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\vlmcsd.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\wingetopt.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\crypto.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\crypto_windows.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\endian.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\helpers.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\kms.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\network.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\ntservice.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\output.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\rpc.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\shared_globals.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\vlmcsd.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\wingetopt.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>

+ 231 - 0
VisualStudio/vlmcsdmulti/vlmcsdmulti.vcxproj

@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{7F07671D-1432-43E9-9D72-08435F216B5E}</ProjectGuid>
+    <RootNamespace>vlmcsdmulti</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140_xp</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v120_xp</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140_xp</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v120_xp</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>$(SolutionDir)..\</OutDir>
+    <TargetName>vlmcsdmulti-Windows-x86</TargetName>
+    <GenerateManifest>false</GenerateManifest>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <OutDir>$(SolutionDir)..\</OutDir>
+    <TargetName>vlmcsdmulti-Windows-x64</TargetName>
+    <GenerateManifest>false</GenerateManifest>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <GenerateManifest>false</GenerateManifest>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <GenerateManifest>false</GenerateManifest>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <CompileAs>Default</CompileAs>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <PreprocessorDefinitions>_USING_V110_SDK71_;_MBCS;%(PreprocessorDefinitions);_CRYPTO_WINDOWS;_PEDANTIC;MULTI_CALL_BINARY=1</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>shlwapi.lib;Iphlpapi.lib;Dnsapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <SubSystem>Console</SubSystem>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_USING_V110_SDK71_;%(PreprocessorDefinitions);_CRYPTO_WINDOWS;_PEDANTIC;MULTI_CALL_BINARY=1</PreprocessorDefinitions>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <MinimalRebuild>false</MinimalRebuild>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>shlwapi.lib;Iphlpapi.lib;Dnsapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <SubSystem>Console</SubSystem>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MinSpace</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>
+      </SDLCheck>
+      <CallingConvention>Cdecl</CallingConvention>
+      <DebugInformationFormat>None</DebugInformationFormat>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+      <OmitFramePointers>true</OmitFramePointers>
+      <StringPooling>true</StringPooling>
+      <ExceptionHandling>false</ExceptionHandling>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <FloatingPointModel>Fast</FloatingPointModel>
+      <FloatingPointExceptions>false</FloatingPointExceptions>
+      <CreateHotpatchableImage>false</CreateHotpatchableImage>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <OpenMPSupport>false</OpenMPSupport>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <PreprocessorDefinitions>_X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions);_CRYPTO_WINDOWS;MULTI_CALL_BINARY=1</PreprocessorDefinitions>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>$(SolutionDir)\msvcrt.lib;Shlwapi.lib;Iphlpapi.lib;Dnsapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <GenerateDebugInformation>false</GenerateDebugInformation>
+      <SubSystem>Console</SubSystem>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+      <LargeAddressAware>true</LargeAddressAware>
+      <TerminalServerAware>true</TerminalServerAware>
+      <SwapRunFromCD>true</SwapRunFromCD>
+      <SwapRunFromNET>true</SwapRunFromNET>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MinSpace</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>
+      </SDLCheck>
+      <PreprocessorDefinitions>_USING_V110_SDK71_;%(PreprocessorDefinitions);_CRYPTO_WINDOWS;MULTI_CALL_BINARY=1</PreprocessorDefinitions>
+      <DebugInformationFormat>None</DebugInformationFormat>
+      <TreatWarningAsError>false</TreatWarningAsError>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+      <StringPooling>true</StringPooling>
+      <ExceptionHandling>false</ExceptionHandling>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+      <FloatingPointModel>Fast</FloatingPointModel>
+      <FloatingPointExceptions>false</FloatingPointExceptions>
+      <CreateHotpatchableImage>false</CreateHotpatchableImage>
+      <RuntimeTypeInfo>false</RuntimeTypeInfo>
+      <OpenMPSupport>false</OpenMPSupport>
+      <AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>$(SolutionDir)\msvcrt64.lib;Shlwapi.lib;Iphlpapi.lib;Dnsapi.lib;ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+      <GenerateDebugInformation>false</GenerateDebugInformation>
+      <SubSystem>Console</SubSystem>
+      <LargeAddressAware>true</LargeAddressAware>
+      <TerminalServerAware>true</TerminalServerAware>
+      <SwapRunFromCD>true</SwapRunFromCD>
+      <SwapRunFromNET>true</SwapRunFromNET>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\crypto.c" />
+    <ClCompile Include="..\..\crypto_windows.c" />
+    <ClCompile Include="..\..\dns_srv.c" />
+    <ClCompile Include="..\..\endian.c" />
+    <ClCompile Include="..\..\helpers.c" />
+    <ClCompile Include="..\..\kms.c" />
+    <ClCompile Include="..\..\network.c" />
+    <ClCompile Include="..\..\ntservice.c" />
+    <ClCompile Include="..\..\output.c" />
+    <ClCompile Include="..\..\rpc.c" />
+    <ClCompile Include="..\..\shared_globals.c" />
+    <ClCompile Include="..\..\vlmcs.c" />
+    <ClCompile Include="..\..\vlmcsd.c" />
+    <ClCompile Include="..\..\vlmcsdmulti.c" />
+    <ClCompile Include="..\..\wingetopt.c" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\config.h" />
+    <ClInclude Include="..\..\crypto.h" />
+    <ClInclude Include="..\..\crypto_windows.h" />
+    <ClInclude Include="..\..\dns_srv.h" />
+    <ClInclude Include="..\..\endian.h" />
+    <ClInclude Include="..\..\helpers.h" />
+    <ClInclude Include="..\..\kms.h" />
+    <ClInclude Include="..\..\network.h" />
+    <ClInclude Include="..\..\ntservice.h" />
+    <ClInclude Include="..\..\output.h" />
+    <ClInclude Include="..\..\rpc.h" />
+    <ClInclude Include="..\..\shared_globals.h" />
+    <ClInclude Include="..\..\types.h" />
+    <ClInclude Include="..\..\vlmcs.h" />
+    <ClInclude Include="..\..\vlmcsd.h" />
+    <ClInclude Include="..\..\wingetopt.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 114 - 0
VisualStudio/vlmcsdmulti/vlmcsdmulti.vcxproj.filters

@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\crypto.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\crypto_windows.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\dns_srv.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\endian.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\helpers.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\kms.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\network.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\output.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\rpc.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\shared_globals.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\vlmcs.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\wingetopt.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\ntservice.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\vlmcsd.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\vlmcsdmulti.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\config.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\crypto.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\crypto_windows.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\dns_srv.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\endian.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\helpers.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\kms.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\network.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\output.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\rpc.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\shared_globals.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\types.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\vlmcs.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\wingetopt.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\ntservice.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\vlmcsd.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 1 - 1
crypto.c

@@ -117,7 +117,7 @@ void AesInitKey(AesCtx *Ctx, const BYTE *Key, int_fast8_t IsV6, int RijndaelKeyB
 
 	memcpy(Ctx->Key, Key, RijndaelKeyBytes);
 
-	for ( i = RijndaelKeyDwords; i < ( Ctx->rounds + 1 ) << 2; i++ )
+	for ( i = (uint_fast8_t)RijndaelKeyDwords; i < ( Ctx->rounds + 1 ) << 2; i++ )
 	{
 		temp = Ctx->Key[ i - 1 ];
 

+ 1 - 3
crypto.h

@@ -14,12 +14,10 @@
 #include "endian.h"
 #include <stdint.h>
 
-//#define AES_ROUNDS      (10)
 #define AES_KEY_BYTES   (16) // 128 Bits
 #define AES_BLOCK_BYTES (16)
 #define AES_BLOCK_WORDS (AES_BLOCK_BYTES / sizeof(DWORD))
 #define AES_KEY_DWORDS  (AES_KEY_BYTES / sizeof(DWORD))
-//#define V4_ROUNDS		(11)
 #define V4_KEY_BYTES	(20) // 160 Bits
 
 #define ROR32(v, n)  ( (v) << (32 - n) | (v) >> n )
@@ -39,7 +37,7 @@ typedef struct {
 void AesInitKey(AesCtx *Ctx, const BYTE *Key, int_fast8_t IsV6, int AesKeyBytes);
 void AesEncryptBlock(const AesCtx *const Ctx, BYTE *block);
 void AesDecryptBlock(const AesCtx *const Ctx, BYTE *block);
-void AesEncryptCbc(const AesCtx *const Ctx, BYTE *iv, BYTE *data, size_t *len);
+void AesEncryptCbc(const AesCtx *const Ctx, BYTE *restrict iv, BYTE *restrict data, size_t *restrict len);
 void AesDecryptCbc(const AesCtx *const Ctx, BYTE *iv, BYTE *data, size_t len);
 void MixColumnsR(BYTE *restrict state);
 

+ 1 - 1
crypto_internal.c

@@ -95,7 +95,7 @@ static void Sha256Update(Sha256Ctx *Ctx, BYTE *data, size_t len)
 	unsigned int  b_len = Ctx->Len & 63,
 								r_len = (b_len ^ 63) + 1;
 
-	Ctx->Len += len;
+	Ctx->Len += (unsigned int)len;
 
 	if ( len < r_len )
 	{

+ 2 - 2
crypto_windows.c

@@ -39,7 +39,7 @@ static int_fast8_t AcquireCryptContext()
 {
 	if (!hRsaAesProvider)
 	{
-		return CryptAcquireContextW
+		return (int_fast8_t)CryptAcquireContextW
 		(
 			&hRsaAesProvider,		// Provider handle
 			NULL,					// No key container name
@@ -163,7 +163,7 @@ int_fast8_t Sha256Hmac(const BYTE* key, BYTE* restrict data, DWORD len, BYTE* re
 	if (hKey) CryptDestroyKey(hKey);
 	if (hHmacHash) CryptDestroyHash(hHmacHash);
 
-	return success;
+	return (int_fast8_t)success;
 }
 
 #endif // _WIN32 || __CYGWIN__

+ 4 - 1
crypto_windows.h

@@ -11,6 +11,9 @@
 #else // _WIN32 || __CYGWIN__
 
 #include "types.h"
+#if _MSC_VER
+#include "Wincrypt.h"
+#endif
 
 typedef struct _Sha2356HmacCtx
 {
@@ -18,7 +21,7 @@ typedef struct _Sha2356HmacCtx
 	HCRYPTKEY hKey;
 } Sha256HmacCtx;
 
-int_fast8_t Sha256(BYTE *data, DWORD len, BYTE *hash);
+int_fast8_t Sha256(BYTE* restrict data, DWORD DataSize, BYTE* restrict hash);
 int_fast8_t Sha256Hmac(const BYTE* key, BYTE* restrict data, DWORD len, BYTE* restrict hmac);
 
 /*int_fast8_t Sha256HmacInit(Sha256HmacCtx *Ctx, BYTE *key, uint8_t keySize);

+ 1 - 1
dns_srv.c

@@ -309,7 +309,7 @@ int getKmsServerList(kms_server_dns_ptr** serverlist, const char *const restrict
 
 		memset(kms_server, 0, sizeof(kms_server_dns_t));
 
-		snprintf(kms_server->serverName, sizeof(kms_server->serverName), "%s:%hu", dns_iterator->Data.SRV.pNameTarget, dns_iterator->Data.SRV.wPort);
+		vlmcsd_snprintf(kms_server->serverName, sizeof(kms_server->serverName), "%s:%hu", dns_iterator->Data.SRV.pNameTarget, dns_iterator->Data.SRV.wPort);
 		kms_server->priority = dns_iterator->Data.SRV.wPriority;
 		kms_server->weight = dns_iterator->Data.SRV.wWeight;
 

+ 1 - 1
dns_srv.h

@@ -96,7 +96,7 @@ typedef enum __ns_class {
 
 #endif
 
-int getKmsServerList(kms_server_dns_ptr** serverlist, const char *restrict query);
+int getKmsServerList(kms_server_dns_ptr** serverlist, const char *const restrict query);
 void sortSrvRecords(kms_server_dns_ptr* serverlist, const int answers);
 
 #endif // NO_DNS

BIN
floppy144.vfd


+ 18 - 6
helpers.c

@@ -2,6 +2,10 @@
  * Helper functions used by other modules
  */
 
+#ifndef _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #ifndef CONFIG
 #define CONFIG "config.h"
 #endif // CONFIG
@@ -10,7 +14,11 @@
 #ifndef _WIN32
 #include <errno.h>
 #endif // _WIN32
+#ifndef _MSC_VER
 #include <getopt.h>
+#else
+#include "wingetopt.h"
+#endif
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
@@ -20,6 +28,7 @@
 #include "shared_globals.h"
 
 
+
 /*
  *  UCS2 <-> UTF-8 functions
  *  All functions use little endian UCS2 since we only need it to communicate with Windows via RPC
@@ -72,7 +81,7 @@ int ucs2_to_utf8_char (const WCHAR ucs2_le, char *utf8)
     const WCHAR ucs2 = LE16(ucs2_le);
 
     if (ucs2 < 0x80) {
-        utf8[0] = ucs2;
+        utf8[0] = (char)ucs2;
         utf8[1] = '\0';
         return 1;
     }
@@ -153,7 +162,7 @@ BOOL stringToInt(const char *const szValue, const unsigned int min, const unsign
 	char *nextchar;
 
 	errno = 0;
-	long long result = strtoll(szValue, &nextchar, 10);
+	long long result = vlmcsd_strtoll(szValue, &nextchar, 10);
 
 	if (errno || result < (long long)min || result > (long long)max || *nextchar)
 	{
@@ -177,7 +186,7 @@ int_fast8_t string2Uuid(const char *const restrict input, GUID *const restrict g
 	{
 		if (i == 8 || i == 13 || i == 18 || i == 23) continue;
 
-		const char c = toupper((int)input[i]);
+		const char c = (char)toupper((int)input[i]);
 
 		if (c < '0' || c > 'F' || (c > '9' && c < 'A')) return FALSE;
 	}
@@ -211,7 +220,7 @@ void LEGUID(GUID *const restrict out, const GUID* const restrict in)
 	#endif
 }
 
-
+#if !IS_LIBRARY
 //Checks a command line argument if it is numeric and between min and max. Returns the numeric value or exits on error
 __pure unsigned int getOptionArgumentInt(const char o, const unsigned int min, const unsigned int max)
 {
@@ -226,7 +235,6 @@ __pure unsigned int getOptionArgumentInt(const char o, const unsigned int min, c
 	return result;
 }
 
-
 // Resets getopt() to start parsing from the beginning
 void optReset(void)
 {
@@ -241,7 +249,7 @@ void optReset(void)
 	optind = 1;
 	#endif
 }
-
+#endif // !IS_LIBRARY
 
 #if defined(_WIN32) || defined(USE_MSRPC)
 
@@ -295,9 +303,13 @@ void parseAddress(char *const addr, char** szHost, char** szPort)
 // Initialize random generator (needs to be done in each thread)
 void randomNumberInit()
 {
+#	if _MSC_VER
+	srand(GetTickCount());
+#	else
 	struct timeval tv;
 	gettimeofday(&tv, NULL);
 	srand((unsigned int)(tv.tv_sec ^ tv.tv_usec));
+#	endif
 }
 
 

+ 15 - 7
kms.c

@@ -3,6 +3,10 @@
 #endif // CONFIG
 #include CONFIG
 
+#ifndef _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
@@ -200,8 +204,8 @@ const KmsIdList ExtendedProductList [] = {
 		{ { 0xb3ca044e, 0xa358, 0x4d68, { 0x98, 0x83, 0xaa, 0xa2, 0x94, 0x1a, 0xca, 0x99, } } /*b3ca044e-a358-4d68-9883-aaa2941aca99*/, LOGTEXT("Windows Server 2012 R2 Standard"),                EPID_WINDOWS,    APP_ID_WINDOWS,    KMS_ID_WIN2012R2 },
 
 		// Windows Server 2016
-		{ { 0x7b4433f4, 0xb1e7, 0x4788, { 0x89, 0x5a, 0xc4, 0x53, 0x78, 0xd3, 0x82, 0x53, } } /*7b4433f4-b1e7-4788-895a-c45378d38253*/, LOGTEXT("Windows Server 2016 Azure Core"),                 EPID_WINDOWS,    APP_ID_WINDOWS,    KMS_ID_WIN2016 },
-		{ { 0x3dbf341b, 0x5f6c, 0x4fa7, { 0xb9, 0x36, 0x69, 0x9d, 0xce, 0x9e, 0x26, 0x3f, } } /*3dbf341b-5f6c-4fa7-b936-699dce9e263f*/, LOGTEXT("Windows Server 2016 Cloud Storage"),              EPID_WINDOWS,    APP_ID_WINDOWS,    KMS_ID_WIN2016 },
+		{ { 0x3dbf341b, 0x5f6c, 0x4fa7, { 0xb9, 0x36, 0x69, 0x9d, 0xce, 0x9e, 0x26, 0x3f, } } /*3dbf341b-5f6c-4fa7-b936-699dce9e263f*/, LOGTEXT("Windows Server 2016 Azure Core"),                 EPID_WINDOWS,    APP_ID_WINDOWS,    KMS_ID_WIN2016 },
+		{ { 0x7b4433f4, 0xb1e7, 0x4788, { 0x89, 0x5a, 0xc4, 0x53, 0x78, 0xd3, 0x82, 0x53, } } /*7b4433f4-b1e7-4788-895a-c45378d38253*/, LOGTEXT("Windows Server 2016 Cloud Storage"),              EPID_WINDOWS,    APP_ID_WINDOWS,    KMS_ID_WIN2016 },
 		{ { 0x21c56779, 0xb449, 0x4d20, { 0xad, 0xfc, 0xee, 0xce, 0x0e, 0x1a, 0xd7, 0x4b, } } /*21c56779-b449-4d20-adfc-eece0e1ad74b*/, LOGTEXT("Windows Server 2016 Datacenter"),                 EPID_WINDOWS,    APP_ID_WINDOWS,    KMS_ID_WIN2016 },
 		{ { 0x2b5a1b0f, 0xa5ab, 0x4c54, { 0xac, 0x2f, 0xa6, 0xd9, 0x48, 0x24, 0xa2, 0x83, } } /*2b5a1b0f-a5ab-4c54-ac2f-a6d94824a283*/, LOGTEXT("Windows Server 2016 Essentials"),                 EPID_WINDOWS,    APP_ID_WINDOWS,    KMS_ID_WIN2016 },
 		{ { 0x8c1c5410, 0x9f39, 0x4805, { 0x8c, 0x9d, 0x63, 0xa0, 0x77, 0x06, 0x35, 0x8f, } } /*8c1c5410-9f39-4805-8c9d-63a07706358f*/, LOGTEXT("Windows Server 2016 Standard"),                   EPID_WINDOWS,    APP_ID_WINDOWS,    KMS_ID_WIN2016 },
@@ -495,6 +499,10 @@ static void generateRandomPid(int index, char *const szPid, int serverType, int1
 	time_t maxTime, kmsTime;
 	time(&maxTime);
 
+#	ifndef BUILD_TIME
+#	define BUILD_TIME 1474752907
+#   endif
+
 	if (maxTime < (time_t)BUILD_TIME) // Just in case the system time is < 10/17/2013 1:00 pm
 		maxTime = (time_t)BUILD_TIME;
 
@@ -748,7 +756,7 @@ static BOOL __stdcall CreateResponseBaseCallback(const REQUEST *const baseReques
 	memcpy(&baseResponse->CMID, &baseRequest->CMID, sizeof(GUID));
 	memcpy(&baseResponse->ClientTime, &baseRequest->ClientTime, sizeof(FILETIME));
 
-	baseResponse->Count  				= index == 1 || index == 2 ? LE32(10) : LE32(50);
+	baseResponse->Count  				= index > 0 && index < 4 ? LE32(10) : LE32(50);
 	baseResponse->VLActivationInterval	= LE32(VLActivationInterval);
 	baseResponse->VLRenewalInterval   	= LE32(VLRenewalInterval);
 
@@ -833,10 +841,10 @@ static int_fast8_t CreateV6Hmac(BYTE *const encrypt_start, const size_t encryptS
 	// The last 16 bytes of the hashed time slot are the actual HMAC key
 	if (!Sha256Hmac
 	(
-		hash + halfHashSize,								// Use last 16 bytes of SHA256 as HMAC key
-		encrypt_start,										// hash only the encrypted part of the v6 response
-		encryptSize - sizeof(((RESPONSE_V6*)0)->HMAC),		// encryptSize minus the HMAC itself
-		hash												// use same buffer for resulting hash where the key came from
+		hash + halfHashSize,									// Use last 16 bytes of SHA256 as HMAC key
+		encrypt_start,											// hash only the encrypted part of the v6 response
+		(DWORD)(encryptSize - sizeof(((RESPONSE_V6*)0)->HMAC)),	// encryptSize minus the HMAC itself
+		hash													// use same buffer for resulting hash where the key came from
 	))
 	{
 		return FALSE;

+ 4 - 0
kms.h

@@ -6,7 +6,11 @@
 #endif // CONFIG
 #include CONFIG
 
+#if _MSC_VER
+#include <time.h>
+#else
 #include <sys/time.h>
+#endif // _MSC_VER
 #include <stdlib.h>
 #include "types.h"
 //

+ 2 - 2
libkms.c

@@ -62,7 +62,7 @@ EXTERNC __declspec(EXTERNAL) SOCKET __cdecl ConnectToServer(const char* host, co
 
 	size_t adrlen = strlen(host) + 16;
 	char* RemoteAddr = (char*)alloca(adrlen);
-	snprintf(RemoteAddr, adrlen, "[%s]:%s", host, port);
+	vlmcsd_snprintf(RemoteAddr, adrlen, "[%s]:%s", host, port);
 	sock = connectToAddress(RemoteAddr, addressFamily, FALSE);
 
 	if (sock == INVALID_RPCCTX)
@@ -161,7 +161,7 @@ EXTERNC __declspec(EXTERNAL) DWORD __cdecl StartKmsServer(const int port, Reques
 #	endif // _WIN32
 
 	defaultport = vlmcsd_malloc(16);
-	snprintf((char*)defaultport, (size_t)16, "%i", port);
+	vlmcsd_snprintf((char*)defaultport, (size_t)16, "%i", port);
 
 	CreateResponseBase = requestCallback;
 	error = listenOnAllAddresses();

+ 8 - 8
make_linux

@@ -70,10 +70,10 @@ export STAGING_DIR=.
 
 
 # Windows 32-bit using MingW32-w64 toolchain on Ubuntu Linux
-export CLIENT_NAME=binaries/Windows/intel/vlmcs-Windows-x86.exe
-export PROGRAM_NAME=binaries/Windows/intel/vlmcsd-Windows-x86.exe
-export MULTI_NAME=binaries/Windows/intel/vlmcsdmulti-Windows-x86.exe
-export DLL_NAME=binaries/Windows/intel/libkms32.dll
+export CLIENT_NAME=binaries/Windows/intel/vlmcs-Windows-x86-gcc.exe
+export PROGRAM_NAME=binaries/Windows/intel/vlmcsd-Windows-x86-gcc.exe
+export MULTI_NAME=binaries/Windows/intel/vlmcsdmulti-Windows-x86-gcc.exe
+export DLL_NAME=binaries/Windows/intel/libkms32-gcc.dll
 export THREADS=1
 export CFLAGS="$SMALLCC"
 export CC=i686-w64-mingw32-gcc
@@ -131,10 +131,10 @@ fi
 
 
 # Windows 64-bit using MingW32-w64 toolchain on Ubuntu Linux
-export CLIENT_NAME=binaries/Windows/intel/vlmcs-Windows-x64.exe
-export PROGRAM_NAME=binaries/Windows/intel/vlmcsd-Windows-x64.exe
-export MULTI_NAME=binaries/Windows/intel/vlmcsdmulti-Windows-x64.exe
-export DLL_NAME=binaries/Windows/intel/libkms64.dll
+export CLIENT_NAME=binaries/Windows/intel/vlmcs-Windows-x64-gcc.exe
+export PROGRAM_NAME=binaries/Windows/intel/vlmcsd-Windows-x64-gcc.exe
+export MULTI_NAME=binaries/Windows/intel/vlmcsdmulti-Windows-x64-gcc.exe
+export DLL_NAME=binaries/Windows/intel/libkms64-gcc.dll
 export THREADS=1
 export CFLAGS="$SMALLCC"
 export CC=x86_64-w64-mingw32-gcc

+ 4 - 4
make_osx

@@ -46,10 +46,10 @@ PATH=~/toolchains/iOS5.1-MacOS-Lion/usr/bin:$PATH make $MAKEFLAGS allmulti MULTI
 PATH=~/toolchains/gcc4.2/usr/bin:$PATH make -Bj allmulti SAFE_MODE=1 MULTI_NAME=vlmcsdmulti-MacOSX-ppc PROGRAM_NAME=vlmcsd-MacOSX-ppc CLIENT_NAME=vlmcs-MacOSX-ppc CC=gcc CFLAGS="$CFGCC42 -isysroot ~/toolchains/MacOSX10.5.sdk -arch ppc -mmacosx-version-min=10.0" && \
 
 
-make $MAKEFLAGS allmulti MULTI_NAME=vlmcsdmulti-MacOSX-x86-gcc CLIENT_NAME=vlmcs-MacOSX-x86-gcc PROGRAM_NAME=vlmcsd-MacOSX-x86-gcc CC=gcc-5 CFLAGS="$CFGCC" PLATFORMFLAGS="-m32 -march=core2 -mmacosx-version-min=10.11" && \
-make $MAKEFLAGS vlmcsd-MacOSX-x86-threads-gcc THREADS=1 PROGRAM_NAME=vlmcsd-MacOSX-x86-threads-gcc CC=gcc-5 CFLAGS="$CFGCC" PLATFORMFLAGS="-m32 -march=core2 -mmacosx-version-min=10.11" && \
-make $MAKEFLAGS allmulti MULTI_NAME=vlmcsdmulti-MacOSX-x64-gcc CLIENT_NAME=vlmcs-MacOSX-x64-gcc PROGRAM_NAME=vlmcsd-MacOSX-x64-gcc CC=gcc-5 CFLAGS="$CFGCC" PLATFORMFLAGS="-m64 -march=core2 -mmacosx-version-min=10.11" && \
-make $MAKEFLAGS vlmcsd-MacOSX-x64-threads-gcc THREADS=1 PROGRAM_NAME=vlmcsd-MacOSX-x64-threads-gcc CC=gcc-5 CFLAGS="$CFGCC" PLATFORMFLAGS="-m64 -march=core2 -mmacosx-version-min=10.11" && \
+make $MAKEFLAGS allmulti MULTI_NAME=vlmcsdmulti-MacOSX-x86-gcc CLIENT_NAME=vlmcs-MacOSX-x86-gcc PROGRAM_NAME=vlmcsd-MacOSX-x86-gcc CC=gcc-6 CFLAGS="$CFGCC" PLATFORMFLAGS="-m32 -march=core2 -mmacosx-version-min=10.11" && \
+make $MAKEFLAGS vlmcsd-MacOSX-x86-threads-gcc THREADS=1 PROGRAM_NAME=vlmcsd-MacOSX-x86-threads-gcc CC=gcc-6 CFLAGS="$CFGCC" PLATFORMFLAGS="-m32 -march=core2 -mmacosx-version-min=10.11" && \
+make $MAKEFLAGS allmulti MULTI_NAME=vlmcsdmulti-MacOSX-x64-gcc CLIENT_NAME=vlmcs-MacOSX-x64-gcc PROGRAM_NAME=vlmcsd-MacOSX-x64-gcc CC=gcc-6 CFLAGS="$CFGCC" PLATFORMFLAGS="-m64 -march=core2 -mmacosx-version-min=10.11" && \
+make $MAKEFLAGS vlmcsd-MacOSX-x64-threads-gcc THREADS=1 PROGRAM_NAME=vlmcsd-MacOSX-x64-threads-gcc CC=gcc-6 CFLAGS="$CFGCC" PLATFORMFLAGS="-m64 -march=core2 -mmacosx-version-min=10.11" && \
 
 # Sign the iOS binaries
 #ldid -S *iOS*

+ 17 - 7
make_windows

@@ -1,8 +1,17 @@
 #!/bin/bash
 
 export VLMCSD_VERSION="svn`svnversion`"
+
+msbuild='/cygdrive/c/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe'
+version="$VLMCSD_VERSION, built $(date -u '+%Y-%m-%d %H:%M:%S') UTC"
+
 rm -f cygkms*.dll libkms*.dll vlmcs-* vlmcsd-win* vlmcsd-cyg* vlmcsdmulti-* *_all.* vlmcsd.exe vlmcs.exe vlmcsdmulti.exe 2> /dev/null
 
+export ExternalCompilerOptions="/D VERSION=\"\\\"$version\\\"\" /D BUILD_TIME=$(date '+%s')"
+
+"$msbuild" VisualStudio/vlmcsd-2015-with-2013-c++-build-tools.sln /t:Rebuild /p:Configuration=Release /p:Platform=x86 /m /v:m
+"$msbuild" VisualStudio/vlmcsd-2015-with-2013-c++-build-tools.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64 /m /v:m
+
 export CAT=2
 export VERBOSE=3
 NUMCPU=`cat /proc/cpuinfo | grep "processor" | wc -l`
@@ -35,10 +44,10 @@ make $MAKEFLAGS THREADS=1 MSRPC=1 DNS_PARSER=internal CLIENT_NAME=vlmcs-cygwin-m
 
 export CAT=2
 #unset CAT
-make $MAKEFLAGS libkms32.dll CRYPTO=windows FEATURES=minimum THREADS=1 DLL_NAME=libkms32.dll CC=i686-w64-MingW32-gcc.exe CFLAGS="$CF -flto=jobserver -fvisibility=hidden" PLATFORMFLAGS="$PF32" LDFLAGS="-static-libgcc $LFWIN32"
-make $MAKEFLAGS libkms64.dll CRYPTO=windows FEATURES=minimum THREADS=1 DLL_NAME=libkms64.dll CC=x86_64-w64-MingW32-gcc.exe CFLAGS="$CF -flto=jobserver -fvisibility=hidden" PLATFORMFLAGS="$PF64" LDFLAGS="-static-libgcc $LFWIN64"
-make $MAKEFLAGS allmulti THREADS=1 CRYPTO=windows CLIENT_NAME=vlmcs-Windows-x86 PROGRAM_NAME=vlmcsd-Windows-x86 MULTI_NAME=vlmcsdmulti-Windows-x86 CC=i686-w64-MingW32-gcc.exe CFLAGS="$CF -fno-lto" PLATFORMFLAGS="$PF32" LDFLAGS="$LFWIN32"
-make $MAKEFLAGS allmulti THREADS=1 CRYPTO=windows CLIENT_NAME=vlmcs-Windows-x64 PROGRAM_NAME=vlmcsd-Windows-x64 MULTI_NAME=vlmcsdmulti-Windows-x64 CC=x86_64-w64-MingW32-gcc.exe CFLAGS="$CF -fno-lto" PLATFORMFLAGS="$PF64" LDFLAGS="$LFWIN64"
+make $MAKEFLAGS libkms32-gcc.dll CRYPTO=windows FEATURES=minimum THREADS=1 DLL_NAME=libkms32-gcc.dll CC=i686-w64-MingW32-gcc.exe CFLAGS="$CF -flto=jobserver -fvisibility=hidden" PLATFORMFLAGS="$PF32" LDFLAGS="-static-libgcc $LFWIN32"
+make $MAKEFLAGS libkms64-gcc.dll CRYPTO=windows FEATURES=minimum THREADS=1 DLL_NAME=libkms64-gcc.dll CC=x86_64-w64-MingW32-gcc.exe CFLAGS="$CF -flto=jobserver -fvisibility=hidden" PLATFORMFLAGS="$PF64" LDFLAGS="-static-libgcc $LFWIN64"
+make $MAKEFLAGS allmulti THREADS=1 CRYPTO=windows CLIENT_NAME=vlmcs-Windows-x86-gcc PROGRAM_NAME=vlmcsd-Windows-x86-gcc MULTI_NAME=vlmcsdmulti-Windows-x86-gcc CC=i686-w64-MingW32-gcc.exe CFLAGS="$CF -fno-lto" PLATFORMFLAGS="$PF32" LDFLAGS="$LFWIN32"
+make $MAKEFLAGS allmulti THREADS=1 CRYPTO=windows CLIENT_NAME=vlmcs-Windows-x64-gcc PROGRAM_NAME=vlmcsd-Windows-x64-gcc MULTI_NAME=vlmcsdmulti-Windows-x64-gcc CC=x86_64-w64-MingW32-gcc.exe CFLAGS="$CF -fno-lto" PLATFORMFLAGS="$PF64" LDFLAGS="$LFWIN64"
 unset CAT
 make -Bj allmulti MSRPC=1 CRYPTO=windows CLIENT_NAME=vlmcs-Windows-msrpc-x86 PROGRAM_NAME=vlmcsd-Windows-msrpc-x86 MULTI_NAME=vlmcsdmulti-Windows-msrpc-x86 CC=i686-w64-MingW32-gcc.exe CFLAGS="$CFMSRPC -fno-lto"  PLATFORMFLAGS="$PF32" LDFLAGS="$LFWIN32"
 make $MAKEFLAGS allmulti THREADS=1 MSRPC=1 CRYPTO=windows CLIENT_NAME=vlmcs-Windows-msrpc-x64 PROGRAM_NAME=vlmcsd-Windows-msrpc-x64 MULTI_NAME=vlmcsdmulti-Windows-msrpc-x64 CC=x86_64-w64-MingW32-gcc.exe CFLAGS="$CFMSRPC -fno-lto" PLATFORMFLAGS="$PF64" LDFLAGS="$LFWIN64"
@@ -63,10 +72,11 @@ cp -p cygkms64.dll /usr/local/bin/cygkms.dll &
 
 cp -p libkms32.dll /cygdrive/c/nttools/x86 &
 cp -p libkms64.dll /cygdrive/c/nttools/x64 &
-cp -p vlmcsdmulti-Windows-x86.exe /cygdrive/c/nttools/x86/vlmcsdmulti.exe 
+cp -p vlmcsd-Windows-x86.exe /cygdrive/c/nttools/x86/vlmcsd.exe 
+cp -p vlmcs-Windows-x86.exe /cygdrive/c/nttools/x86/vlmcs.exe 
 
-cmd /C mklink c:\\nttools\\x86\\vlmcsd.exe vlmcsdmulti.exe 2> /dev/null &
-cmd /C mklink c:\\nttools\\x86\\vlmcs.exe vlmcsdmulti.exe 2> /dev/null &
+#cmd /C mklink c:\\nttools\\x86\\vlmcsd.exe vlmcsdmulti.exe 2> /dev/null &
+#cmd /C mklink c:\\nttools\\x86\\vlmcs.exe vlmcsdmulti.exe 2> /dev/null &
 
 echo "Installing man pages"
 

+ 2 - 0
msrpc-client.h

@@ -2,6 +2,7 @@
  * msrpc-client.h
  */
 
+#ifdef USE_MSRPC
 #ifndef MSRPC_CLIENT_H_
 #define MSRPC_CLIENT_H_
 
@@ -19,5 +20,6 @@ RpcStatus rpcSendRequest(const RpcCtx handle, BYTE* KmsRequest, size_t requestSi
 RpcStatus closeRpc(RpcCtx s);
 
 #define INVALID_RPCCTX ((RpcCtx)~0)
+#endif // USE_MSRPC
 
 #endif /* MSRPC_CLIENT_H_ */

+ 11 - 12
network.c

@@ -40,12 +40,11 @@
 
 #include "network.h"
 #include "endian.h"
-#include "output.h"
+//#include "output.h"
 #include "helpers.h"
 #include "shared_globals.h"
 #include "rpc.h"
 
-
 #ifndef _WIN32
 typedef ssize_t (*sendrecv_t)(int, void*, size_t, int);
 #else
@@ -92,7 +91,7 @@ static int_fast8_t ip2str(char *restrict result, const size_t resultLength, cons
 		return FALSE;
 	}
 
-	if ((unsigned int)snprintf(result, resultLength, socketAddress->sa_family == AF_INET6 ? fIPv6 : fIPv4, ipAddress, portNumber) > resultLength) return FALSE;
+	if ((unsigned int)vlmcsd_snprintf(result, resultLength, socketAddress->sa_family == AF_INET6 ? fIPv6 : fIPv4, ipAddress, portNumber) > resultLength) return FALSE;
 	return TRUE;
 }
 
@@ -245,7 +244,7 @@ SOCKET connectToAddress(const char *const addr, const int AddressFamily, int_fas
 		// struct sockaddr_in* addr4 = (struct sockaddr_in*)sa->ai_addr;
 		// struct sockaddr_in6* addr6 = (struct sockaddr_in6*)sa->ai_addr;
 
-		if (ip2str(szAddr, sizeof(szAddr), sa->ai_addr, sa->ai_addrlen))
+		if (ip2str(szAddr, sizeof(szAddr), sa->ai_addr, (socklen_t)sa->ai_addrlen))
 		{
 			if (showHostName)
 				printf("Connecting to %s (%s) ... ", addr, szAddr);
@@ -274,7 +273,7 @@ SOCKET connectToAddress(const char *const addr, const int AddressFamily, int_fas
 		setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, (sockopt_t)&to, sizeof(to));
 #		endif // !defined(NO_TIMEOUT) && !__minix__
 
-		if (!connect(s, sa->ai_addr, sa->ai_addrlen))
+		if (!connect(s, sa->ai_addr, (int)sa->ai_addrlen))
 		{
 			printf("successful\n");
 			break;
@@ -310,7 +309,7 @@ static int_fast8_t allowSocketReuse(SOCKET s)
 	if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (sockopt_t)&socketOption, sizeof(socketOption)))
 	{
 #		ifdef _PEDANTIC
-		printerrorf("Warning: %s does not support socket option SO_REUSEADDR: %s\n", ipstr, vlmcsd_strerror(socket_errno));
+		printerrorf("Warning: Socket option SO_REUSEADDR unsupported: %s\n", vlmcsd_strerror(socket_errno));
 #		endif // _PEDANTIC
 	}
 
@@ -403,7 +402,7 @@ void getPrivateIPAddresses(int* numAddresses, char*** ipAddresses)
 
 	for (currentAdapter = firstAdapter, *numAddresses = 0; currentAdapter != NULL; currentAdapter = currentAdapter->Next)
 	{
-		PIP_ADAPTER_UNICAST_ADDRESS_XP currentAddress;
+		PIP_ADAPTER_UNICAST_ADDRESS currentAddress;
 		int length;
 
 		if (currentAdapter->OperStatus != IfOperStatusUp) continue;
@@ -418,7 +417,7 @@ void getPrivateIPAddresses(int* numAddresses, char*** ipAddresses)
 
 	for (currentAdapter = firstAdapter, *numAddresses = 0; currentAdapter != NULL; currentAdapter = currentAdapter->Next)
 	{
-		PIP_ADAPTER_UNICAST_ADDRESS_XP currentAddress;
+		PIP_ADAPTER_UNICAST_ADDRESS currentAddress;
 		int length;
 
 		if (currentAdapter->OperStatus != IfOperStatusUp) continue;
@@ -521,7 +520,7 @@ static int listenOnAddress(const struct addrinfo *const ai, SOCKET *s)
 	int error;
 	char ipstr[64];
 
-	ip2str(ipstr, sizeof(ipstr), ai->ai_addr, ai->ai_addrlen);
+	ip2str(ipstr, sizeof(ipstr), ai->ai_addr, (socklen_t)ai->ai_addrlen);
 
 	//*s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
 	*s = socket(ai->ai_family, SOCK_STREAM, IPPROTO_TCP);
@@ -615,7 +614,7 @@ static int listenOnAddress(const struct addrinfo *const ai, SOCKET *s)
 
 #	endif // HAVE_FREEBIND
 
-	if (bind(*s, ai->ai_addr, ai->ai_addrlen) || listen(*s, SOMAXCONN))
+	if (bind(*s, ai->ai_addr, (int)ai->ai_addrlen) || listen(*s, SOMAXCONN))
 	{
 		error = socket_errno;
 		printerrorf("Warning: %s: %s\n", ipstr, vlmcsd_strerror(error));
@@ -696,7 +695,7 @@ static SOCKET network_accept_any()
         if (SocketList[i] > maxSocket) maxSocket = SocketList[i];
     }
 
-    status = select(maxSocket + 1, &ListeningSocketsList, NULL, NULL, NULL);
+    status = select((int)maxSocket + 1, &ListeningSocketsList, NULL, NULL, NULL);
 
     if (status < 0) return INVALID_SOCKET;
 
@@ -871,7 +870,7 @@ static void *serveClientThreadProc (PCLDATA clData)
 #ifndef NO_SOCKETS
 
 #if defined(USE_THREADS) && (defined(_WIN32) || defined(__CYGWIN__)) // Windows Threads
-static int serveClientAsyncWinThreads(const PCLDATA thr_CLData)
+static int serveClientAsyncWinThreads(PCLDATA thr_CLData)
 {
 	wait_sem();
 

+ 7 - 0
network.h

@@ -13,6 +13,13 @@
 #include "types.h"
 #include "output.h"
 
+#if _MSC_VER
+//typedef signed char int_fast8_t;
+//typedef unsigned char BYTE;
+//typedef UINT_PTR size_t;
+//typedef unsigned long DWORD;
+#define STDIN_FILENO 0
+#endif
 
 int_fast8_t sendrecv(SOCKET sock, BYTE *data, int len, int_fast8_t do_send);
 

+ 1 - 1
ntservice.c

@@ -14,7 +14,7 @@
 SERVICE_STATUS          gSvcStatus;
 SERVICE_STATUS_HANDLE   gSvcStatusHandle;
 
-static VOID WINAPI ServiceCtrlHandler(const DWORD dwCtrl)
+VOID WINAPI ServiceCtrlHandler(DWORD dwCtrl)
 {
    // Handle the requested control code.
 

+ 11 - 3
output.c

@@ -2,6 +2,10 @@
 #define _DEFAULT_SOURCE
 #endif // _DEFAULT_SOURCE
 
+#ifndef _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #ifndef CONFIG
 #define CONFIG "config.h"
 #endif // CONFIG
@@ -66,8 +70,12 @@ static void vlogger(const char *message, va_list args)
 
 	// We write everything to a string before we really log inside the critical section
 	// so formatting the output can be concurrent
-	int len = strlen(mbstr);
-	vsnprintf(mbstr + len, sizeof(mbstr) - len, message, args);
+	int len = (int)strlen(mbstr);
+//#	if !_MSC_VER
+	vlmcsd_vsnprintf(mbstr + len, sizeof(mbstr) - len, message, args);
+//#	else
+//	wvsprintf(mbstr + len, message, args);
+//#	endif
 
 	lock_mutex(&logmutex);
 	fprintf(log, "%s", mbstr);
@@ -104,7 +112,7 @@ int printerrorf(const char *const fmt, ...)
 #	ifdef IS_LIBRARY
 
 	size_t len = strlen(ErrorMessage);
-	vsnprintf(ErrorMessage + len, MESSAGE_BUFFER_SIZE - len - 1, fmt, arglist);
+	vlmcsd_vsnprintf(ErrorMessage + len, MESSAGE_BUFFER_SIZE - len - 1, fmt, arglist);
 
 #	else // !IS_LIBRARY
 

+ 1 - 0
output.h

@@ -7,6 +7,7 @@
 #include CONFIG
 
 #include <errno.h>
+#include "types.h"
 #include "kms.h"
 
 typedef int (*PRINTFUNC)(const char *const fmt, ...);

+ 18 - 17
rpc.c

@@ -95,9 +95,9 @@ static void CheckRpcRequest(const RPC_REQUEST64 *const Request, const unsigned i
 	}
 
 	if (Ctx != *Ndr64Ctx)
-		kmsMajorVersion = LE16(((WORD*)Request->Ndr.Data)[1]);
+		kmsMajorVersion = (uint_fast8_t)LE16(((WORD*)Request->Ndr.Data)[1]);
 	else
-		kmsMajorVersion = LE16(((WORD*)Request->Ndr64.Data)[1]);
+		kmsMajorVersion = (uint_fast8_t)LE16(((WORD*)Request->Ndr64.Data)[1]);
 
 	if (kmsMajorVersion > 6)
 	{
@@ -394,11 +394,12 @@ static int rpcBind(const RPC_BIND_REQUEST *const Request, RPC_BIND_RESPONSE* Res
 		getsockname(sock, (struct sockaddr*)&addr, &socklen) ||
 		getnameinfo((struct sockaddr*)&addr, socklen, NULL, 0, (char*)Response->SecondaryAddress, sizeof(Response->SecondaryAddress), NI_NUMERICSERV))
 	{
-		portNumberSize = Response->SecondaryAddressLength = 0;
+		portNumberSize = 0;
+		Response->SecondaryAddressLength = 0;
 	}
 	else
 	{
-		portNumberSize = strlen((char*)Response->SecondaryAddress) + 1;
+		portNumberSize = (uint_fast8_t)strlen((char*)Response->SecondaryAddress) + 1;
 		Response->SecondaryAddressLength = LE16(portNumberSize);
 	}
 
@@ -542,7 +543,7 @@ void rpcServer(const SOCKET sock, const DWORD RpcAssocGroup, const char* const i
 		if (!_recv(sock, requestBuffer, request_len)) return;
 
 		// Request is invalid
-		BYTE isValid = _Actions[_a].CheckRequestSize(requestBuffer, request_len, &NdrCtx, &Ndr64Ctx);
+		BYTE isValid = (BYTE)_Actions[_a].CheckRequestSize(requestBuffer, request_len, &NdrCtx, &Ndr64Ctx);
 		if (rpcRequestHeader.PacketType != RPC_PT_REQUEST && !isValid) return;
 
 		// Unable to create a valid response from request
@@ -552,7 +553,7 @@ void rpcServer(const SOCKET sock, const DWORD RpcAssocGroup, const char* const i
 
 		memcpy(rpcResponseHeader, &rpcRequestHeader, sizeof(RPC_HEADER));
 
-		rpcResponseHeader->FragLength = LE16(response_len);
+		rpcResponseHeader->FragLength = LE16((WORD)response_len);
 		rpcResponseHeader->PacketType = _Actions[_a].ResponsePacketType;
 
 		if (rpcResponseHeader->PacketType == RPC_PT_ALTERCONTEXT_ACK)
@@ -710,7 +711,7 @@ RpcStatus rpcSendRequest(const RpcCtx sock, const BYTE *const KmsRequest, const
 	RequestHeader = (RPC_HEADER*)_Request;
 	RpcRequest = (RPC_REQUEST64*)(_Request + sizeof(RPC_HEADER));
 
-	createRpcRequestHeader(RequestHeader, RPC_PT_REQUEST, size);
+	createRpcRequestHeader(RequestHeader, RPC_PT_REQUEST, (WORD)size);
 
 	// Increment CallId for next Request
 	CallId++;
@@ -720,7 +721,7 @@ RpcStatus rpcSendRequest(const RpcCtx sock, const BYTE *const KmsRequest, const
 	if (useNdr64)
 	{
 		RpcRequest->ContextId = LE16(1); // We negotiate NDR64 always as context 1
-		RpcRequest->AllocHint = LE32(requestSize + sizeof(RpcRequest->Ndr64));
+		RpcRequest->AllocHint = LE32((DWORD)(requestSize + sizeof(RpcRequest->Ndr64)));
 		RpcRequest->Ndr64.DataLength = LE64((uint64_t)requestSize);
 		RpcRequest->Ndr64.DataSizeIs = LE64((uint64_t)requestSize);
 		memcpy(RpcRequest->Ndr64.Data, KmsRequest, requestSize);
@@ -728,9 +729,9 @@ RpcStatus rpcSendRequest(const RpcCtx sock, const BYTE *const KmsRequest, const
 	else
 	{
 		RpcRequest->ContextId = 0; // We negotiate NDR32 always as context 0
-		RpcRequest->AllocHint = LE32(requestSize + sizeof(RpcRequest->Ndr));
-		RpcRequest->Ndr.DataLength = LE32(requestSize);
-		RpcRequest->Ndr.DataSizeIs = LE32(requestSize);
+		RpcRequest->AllocHint = LE32((DWORD)(requestSize + sizeof(RpcRequest->Ndr)));
+		RpcRequest->Ndr.DataLength = LE32((DWORD)requestSize);
+		RpcRequest->Ndr.DataSizeIs = LE32((DWORD)requestSize);
 		memcpy(RpcRequest->Ndr.Data, KmsRequest, requestSize);
 	}
 
@@ -738,7 +739,7 @@ RpcStatus rpcSendRequest(const RpcCtx sock, const BYTE *const KmsRequest, const
 	{
 		int bytesread;
 
-		if (!_send(sock, _Request, size))
+		if (!_send(sock, _Request, (int)size))
 		{
 			printerrorf("\nFatal: Could not send RPC request\n");
 			status = RPC_S_COMM_FAILURE;
@@ -759,7 +760,7 @@ RpcStatus rpcSendRequest(const RpcCtx sock, const BYTE *const KmsRequest, const
 		if (size > LE16(ResponseHeader.FragLength) - sizeof(ResponseHeader))
 			size = LE16(ResponseHeader.FragLength) - sizeof(ResponseHeader);
 
-		if (!_recv(sock, &_Response, size))
+		if (!_recv(sock, &_Response, (int)size))
 		{
 			printerrorf("\nFatal: RPC response is incomplete\n");
 			status = RPC_S_COMM_FAILURE;
@@ -823,7 +824,7 @@ RpcStatus rpcSendRequest(const RpcCtx sock, const BYTE *const KmsRequest, const
 		memset(*KmsResponse, 0, *responseSize + MAX_EXCESS_BYTES);
 
 		// Read up to 16 bytes more than bytes expected to detect faulty KMS emulators
-		if ((bytesread = recv(sock, (char*)*KmsResponse, *responseSize + MAX_EXCESS_BYTES, 0)) < (int)*responseSize)
+		if ((bytesread = recv(sock, (char*)*KmsResponse, (int)(*responseSize) + MAX_EXCESS_BYTES, 0)) < (int)*responseSize)
 		{
 			printerrorf("\nFatal: No or incomplete KMS response received. Required %u bytes but only got %i\n",
 					(uint32_t)*responseSize,
@@ -897,12 +898,12 @@ RpcStatus rpcBindOrAlterClientContext(const RpcCtx sock, BYTE packetType, const
 	WORD ctxIndex = 0;
 	WORD i;
 	WORD CtxBTFN = (WORD)~0, CtxNDR64 = (WORD)~0;
-	BYTE _Request[rpcBindSize];
+	BYTE* _Request = (BYTE*)alloca(rpcBindSize);
 
 	RequestHeader = (RPC_HEADER*)_Request;
 	bindRequest = (RPC_BIND_REQUEST* )(_Request + sizeof(RPC_HEADER));
 
-	createRpcRequestHeader(RequestHeader, packetType, rpcBindSize);
+	createRpcRequestHeader(RequestHeader, packetType, (WORD)rpcBindSize);
 	RequestHeader->PacketFlags |=  UseMultiplexedRpc ? RPC_PF_MULTIPLEX : 0;
 
 	bindRequest->AssocGroup		= 0;
@@ -935,7 +936,7 @@ RpcStatus rpcBindOrAlterClientContext(const RpcCtx sock, BYTE packetType, const
 		CtxBTFN = ctxIndex;
 	}
 
-	if (!_send(sock, _Request, rpcBindSize))
+	if (!_send(sock, _Request, (int)rpcBindSize))
 	{
 		printerrorf("\nFatal: Sending RPC bind request failed\n");
 		return RPC_S_COMM_FAILURE;

+ 11 - 1
rpc.h

@@ -8,6 +8,15 @@
 
 #include "types.h"
 
+//#if _MSC_VER
+//typedef signed char int_fast8_t;
+//typedef unsigned char BYTE;
+//typedef UINT_PTR size_t;
+//typedef unsigned long DWORD;
+//#define STDIN_FILENO 0
+//#endif
+
+
 #if !defined(_WIN32) && !defined(__CYGWIN__)
 #define RPC_S_OK 0
 #define RPC_S_INVALID_ARG 87
@@ -257,6 +266,7 @@ typedef struct {
 } /*__packed*/ RPC_RESPONSE64;
 
 
+//#define RpcCtx SOCKET
 typedef SOCKET RpcCtx;
 typedef int RpcStatus;
 
@@ -304,7 +314,7 @@ typedef union _RPC_FLAGS
 
 extern RPC_FLAGS RpcFlags;
 
-void rpcServer(const RpcCtx socket, const DWORD RpcAssocGroup, const char* const ipstr);
+void rpcServer(const SOCKET sock, const DWORD RpcAssocGroup, const char* const ipstr);
 RpcStatus rpcBindClient(const RpcCtx sock, const int_fast8_t verbose);
 RpcStatus rpcSendRequest(const RpcCtx socket, const BYTE *const KmsRequest, const size_t requestSize, BYTE **KmsResponse, size_t *const responseSize);
 

+ 2 - 0
shared_globals.h

@@ -33,7 +33,9 @@
 #endif
 
 #include <signal.h>
+#if !_MSC_VER
 #include <unistd.h>
+#endif
 #include <time.h>
 #include <stdio.h>
 #include <stdlib.h>

+ 36 - 8
types.h

@@ -1,6 +1,10 @@
 #ifndef __types_h
 #define __types_h
 
+#ifndef _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #ifndef CONFIG
 #define CONFIG "config.h"
 #endif // CONFIG
@@ -57,11 +61,6 @@
 #endif // __GNUC__
 #endif // alloca
 
-#ifndef alloca
-#if _MSC_VER
-#define alloca _malloca
-#endif // _MSC_VER
-#endif // alloca
 
 #ifndef alloca
 #ifdef __has_builtin // clang feature test
@@ -72,8 +71,15 @@
 #endif // alloca
 
 #ifndef alloca
+#if !_MSC_VER
 #include <alloca.h>
+#else
+#include <malloc.h>
+//#define alloca _malloca
 #endif
+//#define alloca _malloca
+//#endif // _MSC_VER
+#endif // alloca
 
 #ifndef __packed
 #if _MSC_VER
@@ -84,12 +90,20 @@
 #endif
 
 #ifndef __pure
+#if _MSC_VER
+#define __pure
+#else
 #define __pure	  __attribute__((pure))
 #endif
+#endif
 
 #ifndef __noreturn
+#if _MSC_VER
+#define __noreturn __declspec(noreturn)
+#else
 #define __noreturn	__attribute__((noreturn))
 #endif
+#endif
 
 #define restrict	__restrict
 
@@ -157,7 +171,7 @@ typedef uint8_t ProdListIndex_t;
 
 // Stupid MingW just uses rand() from msvcrt.dll which uses RAND_MAX of 0x7fff
 #if RAND_MAX < 0x7fffffff
-#define rand32(x) ((uint32_t)((rand(x) << 17) | (rand(x) << 2) | (rand(x) & 3)))
+#define rand32() ((uint32_t)((rand() << 17) | (rand() << 2) | (rand() & 3)))
 #elif RAND_MAX < 0xffffffff
 #define rand32(x) ((uint32_t)((rand(x) << 1) | (rand(x) & 1)))
 #else
@@ -285,11 +299,11 @@ typedef void* sockopt_t;
 #undef IsEqualGUID
 #define IsEqualGUID(a, b)  ( !memcmp(a, b, sizeof(GUID)) )
 
-#ifndef __stdcall
+#if !defined(__stdcall) && !_MSC_VER
 #define __stdcall
 #endif
 
-#ifndef __cdecl
+#if !defined(__cdecl) && !_MSC_VER
 #define __cdecl
 #endif
 
@@ -301,4 +315,18 @@ typedef struct {
 } CLDATA, *const PCLDATA;
 
 
+#ifdef _MSC_VER
+#define strcasecmp _stricmp
+#define strncasecmp _strnicmp
+#define vlmcsd_snprintf _snprintf
+#define vlmcsd_vsnprintf _vsnprintf
+#define vlmcsd_unlink DeleteFile
+#define vlmcsd_strtoll strtol // TODO: Get some 64-bit strtoll
+#else // !_MSC_VER
+#define vlmcsd_snprintf snprintf
+#define vlmcsd_vsnprintf vsnprintf
+#define vlmcsd_strtoll strtoll
+#define vlmcsd_unlink unlink
+#endif  // !_MSC_VER
+
 #endif // __types_h

+ 1 - 1
vlmcs.1.html

@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.3 -->
-<!-- CreationDate: Fri Sep 16 00:23:34 2016 -->
+<!-- CreationDate: Thu Oct  6 01:17:00 2016 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>

BIN
vlmcs.1.pdf


+ 37 - 17
vlmcs.c

@@ -8,15 +8,24 @@
 #endif
 
 #include "vlmcs.h"
+#if _MSC_VER
+#include <Shlwapi.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 #include <stdint.h>
+#if _MSC_VER
+#include "wingetopt.h"
+#else
 #include <getopt.h>
+#endif
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifndef _MSC_VER
 #include <unistd.h>
+#endif
 #ifndef _WIN32
 #include <sys/ioctl.h>
 #include <termios.h>
@@ -301,7 +310,7 @@ __noreturn static void showProducts(PRINTFUNC p)
 
 	for (currentProduct = ExtendedProductList; currentProduct->name; currentProduct++)
 	{
-		uint_fast8_t len = strlen(currentProduct->name);
+		uint_fast8_t len = (uint_fast8_t)strlen(currentProduct->name);
 
 		if (len > longestString)
 			longestString = len;
@@ -538,7 +547,7 @@ static void parseCommandLinePass2(const char *const programName, const int argc,
 
 			case 'i':
 
-				switch(getOptionArgumentInt(o, 4, 6))
+				switch(getOptionArgumentInt((char)o, 4, 6))
 				{
 					case 4:
 						AddressFamily = AF_INET;
@@ -564,13 +573,13 @@ static void parseCommandLinePass2(const char *const programName, const int argc,
 			case 'n': // Fixed number of Requests (regardless, whether they are required)
 
 				incompatibleOptions |= VLMCS_OPTION_NO_GRAB_INI;
-				FixedRequests = getOptionArgumentInt(o, 1, INT_MAX);
+				FixedRequests = getOptionArgumentInt((char)o, 1, INT_MAX);
 				break;
 
 			case 'r': // Fake minimum required client count
 
 				incompatibleOptions |= VLMCS_OPTION_NO_GRAB_INI;
-				ActiveLicensePack.N_Policy = getOptionArgumentInt(o, 0, INT_MAX);
+				ActiveLicensePack.N_Policy = getOptionArgumentInt((char)o, 0, INT_MAX);
 				break;
 
 			case 'c': // use a specific client GUID
@@ -596,7 +605,7 @@ static void parseCommandLinePass2(const char *const programName, const int argc,
 
 			case 'g': // Set custom "grace" time in minutes (default 30 days)
 
-				BindingExpiration = getOptionArgumentInt(o, 0, INT_MAX);
+				BindingExpiration = getOptionArgumentInt((char)o, 0, INT_MAX);
 				break;
 
 			case 's': // Set specfic SKU ID
@@ -657,7 +666,7 @@ static void parseCommandLinePass2(const char *const programName, const int argc,
 
 			case 't':
 
-				LicenseStatus = getOptionArgumentInt(o, 0, 0x7fffffff);
+				LicenseStatus = getOptionArgumentInt((char)o, 0, 0x7fffffff);
 				if ((unsigned int)LicenseStatus > 6) errorout("Warning: Correct license status is 0 <= license status <= 6.\n");
 				break;
 
@@ -913,13 +922,13 @@ int SendActivationRequest(const RpcCtx sock, RESPONSE *baseResponse, REQUEST *ba
 		if (LE16(((RESPONSE*)(response))->MajorVer) == 4)
 		{
 			RESPONSE_V4 response_v4;
-			*result = DecryptResponseV4(&response_v4, responseSize, response, request);
+			*result = DecryptResponseV4(&response_v4, (const int)responseSize, response, request);
 			memcpy(baseResponse, &response_v4.ResponseBase, sizeof(RESPONSE));
 		}
 		else
 		{
 			RESPONSE_V6 response_v6;
-			*result = DecryptResponseV6(&response_v6, responseSize, response, request, hwid);
+			*result = DecryptResponseV6(&response_v6, (int)responseSize, response, request, hwid);
 			memcpy(baseResponse, &response_v6.ResponseBase, sizeof(RESPONSE));
 		}
 
@@ -1000,7 +1009,7 @@ static void newIniBackupFile(const char* const restrict fname)
 	if (fclose(f))
 	{
 		errorout("Fatal: Cannot write to %s: %s\n", fname, strerror(errno));
-		unlink(fname);
+		vlmcsd_unlink(fname);
 		exit(!0);
 	}
 }
@@ -1009,7 +1018,9 @@ static void newIniBackupFile(const char* const restrict fname)
 static void updateIniFile(iniFileEpidLines* const restrict lines)
 {
 	int_fast8_t lineWritten[_countof(*lines)];
+#	if !_MSC_VER
 	struct stat statbuf;
+#	endif
 	uint_fast8_t i;
 	int_fast8_t iniFileExistedBefore = TRUE;
 	unsigned int lineNumber;
@@ -1021,6 +1032,13 @@ static void updateIniFile(iniFileEpidLines* const restrict lines)
 	strcpy(fn_bak, fn_ini_client);
 	strcat(fn_bak, "~");
 
+#	if _MSC_VER
+	if (!PathFileExists(fn_ini_client))
+	{
+		iniFileExistedBefore = FALSE;
+		newIniBackupFile(fn_bak);
+	}
+#	else
 	if (stat(fn_ini_client, &statbuf))
 	{
 		if (errno != ENOENT)
@@ -1034,9 +1052,10 @@ static void updateIniFile(iniFileEpidLines* const restrict lines)
 			newIniBackupFile(fn_bak);
 		}
 	}
+#	endif
 	else
 	{
-		unlink(fn_bak); // Required for Windows. Most Unix systems don't need it.
+		vlmcsd_unlink(fn_bak); // Required for Windows. Most Unix systems don't need it.
 		if (rename(fn_ini_client, fn_bak))
 		{
 			errorout("Fatal: Cannot create %s: %s\n", fn_bak, strerror(errno));
@@ -1110,11 +1129,12 @@ static void updateIniFile(iniFileEpidLines* const restrict lines)
 		exit(!0);
 	}
 
-	if (!iniFileExistedBefore) unlink(fn_bak);
+	if (!iniFileExistedBefore) vlmcsd_unlink(fn_bak);
 
 	free(fn_bak);
 }
 
+
 static void grabServerData()
 {
 	RpcCtx s = INVALID_RPCCTX;
@@ -1163,16 +1183,16 @@ static void grabServerData()
     		memset(ePID + 3 * PID_BUFFER_SIZE - 3, 0, 3);
     	}
 
-    	snprintf(lines[i], sizeof(lines[0]), "%s = %s", ePidGroup[i], ePID);
+    	vlmcsd_snprintf(lines[i], sizeof(lines[0]), "%s = %s", ePidGroup[i], ePID);
 
     	if (response.MajorVer > 5)
     	{
     		len = strlen(lines[i]);
-    		snprintf (lines[i] + len, sizeof(lines[0]) - len, " / %02X %02X %02X %02X %02X %02X %02X %02X", hwid[0], hwid[1], hwid[2], hwid[3], hwid[4], hwid[5], hwid[6], hwid[7]);
+    		vlmcsd_snprintf (lines[i] + len, sizeof(lines[0]) - len, " / %02X %02X %02X %02X %02X %02X %02X %02X", hwid[0], hwid[1], hwid[2], hwid[3], hwid[4], hwid[5], hwid[6], hwid[7]);
     	}
 
 		len = strlen(lines[i]);
-    	snprintf(lines[i] + len, sizeof(lines[0]) - len, "\n");
+    	vlmcsd_snprintf(lines[i] + len, sizeof(lines[0]) - len, "\n");
 
     }
 
@@ -1188,7 +1208,7 @@ static void grabServerData()
 }
 
 
-int client_main(const int argc, CARGV argv)
+int client_main(int argc, CARGV argv)
 {
 	#if defined(_WIN32) && !defined(USE_MSRPC)
 
@@ -1354,10 +1374,10 @@ static void CreateRequestBase(REQUEST *Request)
 	{
 		int len, len2;
 		unsigned int index = rand() % _countof(ClientDnsNames.first);
-		len = utf8_to_ucs2(Request->WorkstationName, ClientDnsNames.first[index], WORKSTATION_NAME_BUFFER, WORKSTATION_NAME_BUFFER * 3);
+		len = (int)utf8_to_ucs2(Request->WorkstationName, ClientDnsNames.first[index], WORKSTATION_NAME_BUFFER, WORKSTATION_NAME_BUFFER * 3);
 
 		index = rand() % _countof(ClientDnsNames.second);
-		len2 = utf8_to_ucs2(Request->WorkstationName + len, ClientDnsNames.second[index], WORKSTATION_NAME_BUFFER, WORKSTATION_NAME_BUFFER * 3);
+		len2 = (int)utf8_to_ucs2(Request->WorkstationName + len, ClientDnsNames.second[index], WORKSTATION_NAME_BUFFER, WORKSTATION_NAME_BUFFER * 3);
 
 		index = rand() % _countof(ClientDnsNames.tld);
 		utf8_to_ucs2(Request->WorkstationName + len + len2, ClientDnsNames.tld[index], WORKSTATION_NAME_BUFFER, WORKSTATION_NAME_BUFFER * 3);

+ 1 - 1
vlmcsd-floppy.7.html

@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.3 -->
-<!-- CreationDate: Fri Sep 16 00:23:35 2016 -->
+<!-- CreationDate: Thu Oct  6 01:17:00 2016 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>

BIN
vlmcsd-floppy.7.pdf


+ 1 - 1
vlmcsd.7.html

@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.3 -->
-<!-- CreationDate: Fri Sep 16 00:23:34 2016 -->
+<!-- CreationDate: Thu Oct  6 01:17:00 2016 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>

BIN
vlmcsd.7.pdf


+ 1 - 1
vlmcsd.8.html

@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.3 -->
-<!-- CreationDate: Fri Sep 16 00:23:34 2016 -->
+<!-- CreationDate: Thu Oct  6 01:17:00 2016 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>

BIN
vlmcsd.8.pdf


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 581 - 570
vlmcsd.c


+ 0 - 2
vlmcsd.h

@@ -16,9 +16,7 @@ extern char *fn_log;
 //int main(int argc, CARGV);
 extern void cleanup();
 
-#ifdef _NTSERVICE
 int newmain();
-#endif
 
 #if MULTI_CALL_BINARY < 1
 #define server_main main

+ 1 - 1
vlmcsd.ini.5.html

@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.3 -->
-<!-- CreationDate: Fri Sep 16 00:23:35 2016 -->
+<!-- CreationDate: Thu Oct  6 01:17:00 2016 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>

BIN
vlmcsd.ini.5.pdf


+ 1 - 1
vlmcsdmulti.1.html

@@ -1,5 +1,5 @@
 <!-- Creator     : groff version 1.22.3 -->
-<!-- CreationDate: Fri Sep 16 00:23:35 2016 -->
+<!-- CreationDate: Thu Oct  6 01:17:00 2016 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 <html>

BIN
vlmcsdmulti.1.pdf


+ 45 - 10
vlmcsdmulti.c

@@ -1,5 +1,7 @@
 /* Multi-Call Binary for vlmcs and vlmcsd */
 
+#define _CRT_SECURE_NO_WARNINGS
+
 #ifndef CONFIG
 #define CONFIG "config.h"
 #endif // CONFIG
@@ -9,9 +11,15 @@
 #error "Please define MULTI_CALL_BINARY=1 when compiling this file."
 #endif
 
-#include <libgen.h>
 #include <stdio.h>
 
+#if !_MSC_VER
+#include <libgen.h>
+#else // _MSC_VER
+#include <stdlib.h>
+#include "helpers.h"
+#endif // _MSC_VER
+
 #include "vlmcs.h"
 #include "vlmcsd.h"
 #include "types.h"
@@ -24,6 +32,33 @@
 #define compare strcmp // for case-sensitive filesystems
 #endif // native Unix
 
+#if _MSC_VER
+static char* basename(const char* fullname)
+{
+	size_t len = strlen(fullname);
+	char* filename = (char*)vlmcsd_malloc(len + 1);
+	char* extension = (char*)vlmcsd_malloc(len + 1);
+	static char result[64];
+
+	_splitpath(fullname, NULL, NULL, filename, extension);
+
+	if (strlen(filename) + strlen(extension) > 63)
+	{
+		*result = 0;
+		goto finally;
+	}
+
+	strcpy(result, filename);
+	strcat(result, extension);
+
+	finally:
+	free(filename);
+	free(extension);
+
+	return result;
+}
+#endif // _MSC_VER
+
 int main(int argc, CARGV argv)
 {
 	multi_argv = argv;
@@ -35,29 +70,29 @@ int main(int argc, CARGV argv)
 	if (!compare(basename((char*)*argv), "vlmcs"))
 		return client_main(argc, argv);
 
-	#ifdef _WIN32
+#ifdef _WIN32
 	if (!compare(basename((char*)*argv), "vlmcsd.exe"))
 		return server_main(argc, argv);
 
 	if (!compare(basename((char*)*argv), "vlmcs.exe"))
 		return client_main(argc, argv);
-	#endif // _WIN32
+#endif // _WIN32
 
 	if (argc > 1)
 	{
-		if (!strcmp((char*)argv[1],"vlmcsd"))
+		if (!strcmp((char*)argv[1], "vlmcsd"))
 			return server_main(argc - 1, argv + 1);
 
-		if (!strcmp((char*)argv[1],"vlmcs"))
+		if (!strcmp((char*)argv[1], "vlmcs"))
 			return client_main(argc - 1, argv + 1);
 	}
 
 	errorout(
-			"vlmcsdmulti %s\n\n"
-			"Usage:\n"
-			"\t%s vlmcsd [<vlmcsd command line>]\n"
-			"\t%s vlmcs [<vlmcs command line>]\n\n",
-			Version, *argv, *argv
+		"vlmcsdmulti %s\n\n"
+		"Usage:\n"
+		"\t%s vlmcsd [<vlmcsd command line>]\n"
+		"\t%s vlmcs [<vlmcs command line>]\n\n",
+		Version, *argv, *argv
 	);
 
 	return !0;

+ 76 - 0
wingetopt.c

@@ -0,0 +1,76 @@
+/*
+POSIX getopt for Windows
+
+AT&T Public License
+
+Code given out at the 1985 UNIFORUM conference in Dallas.
+*/
+
+#ifdef _MSC_VER
+
+#include "wingetopt.h"
+#include <stdio.h>
+#include <string.h>
+
+#define EOF	(-1)
+#define ERR(s, c)	if(opterr){\
+	char errbuf[2];\
+	errbuf[0] = c; errbuf[1] = '\n';\
+	fputs(argv[0], stderr);\
+	fputs(s, stderr);\
+	fputc(c, stderr);}
+//(void) write(2, argv[0], (unsigned)strlen(argv[0]));\
+	//(void) write(2, s, (unsigned)strlen(s));\
+	//(void) write(2, errbuf, 2);}
+
+int	opterr = 1;
+int	optind = 1;
+int	optopt;
+char	*optarg;
+
+int getopt(int argc, char * const argv[], const char *opts)
+{
+	static int sp = 1;
+	register int c;
+	register char *cp;
+
+	if (sp == 1)
+		if (optind >= argc ||
+			argv[optind][0] != '-' || argv[optind][1] == '\0')
+			return(EOF);
+		else if (strcmp(argv[optind], "--") == 0) {
+			optind++;
+			return(EOF);
+		}
+		optopt = c = argv[optind][sp];
+		if (c == ':' || (cp = strchr(opts, c)) == NULL) {
+			ERR(": illegal option -- ", (char)c);
+			if (argv[optind][++sp] == '\0') {
+				optind++;
+				sp = 1;
+			}
+			return('?');
+		}
+		if (*++cp == ':') {
+			if (argv[optind][sp + 1] != '\0')
+				optarg = (char*)&argv[optind++][sp + 1];
+			else if (++optind >= argc) {
+				ERR(": option requires an argument -- ", (char)c);
+				sp = 1;
+				return('?');
+			}
+			else
+				optarg = (char*)argv[optind++];
+			sp = 1;
+		}
+		else {
+			if (argv[optind][++sp] == '\0') {
+				sp = 1;
+				optind++;
+			}
+			optarg = NULL;
+		}
+		return(c);
+}
+
+#endif  /* __GNUC__ */

+ 32 - 0
wingetopt.h

@@ -0,0 +1,32 @@
+/*
+POSIX getopt for Windows
+
+AT&T Public License
+
+Code given out at the 1985 UNIFORUM conference in Dallas.
+*/
+
+#ifndef _MSC_VER
+#include <getopt.h>
+#endif
+#ifdef _MSC_VER
+
+#ifndef _WINGETOPT_H_
+#define _WINGETOPT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+	extern int opterr;
+	extern int optind;
+	extern int optopt;
+	extern char *optarg;
+	extern int getopt(int argc, char * const argv[], const char *optstring);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* _GETOPT_H_ */
+#endif  /* __GNUC__ */

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно