testing commit
This commit is contained in:
commit
a5727b4129
58 files changed
+7221
No files matched your search
@@ -0,0 +1,22 @@
|
||||
@echo off
|
||||
setlocal EnableExtensions
|
||||
setlocal EnableDelayedExpansion
|
||||
pushd "%~dp0"
|
||||
reg.exe query "hklm\software\microsoft\Windows NT\currentversion" /v buildlabex | find /i "amd64" >nul 2>&1
|
||||
if %errorlevel% equ 0 set xOS=x64
|
||||
if /i "%PROCESSOR_ARCHITECTURE%"=="x86" if not defined PROCESSOR_ARCHITEW6432 set xOS=x86
|
||||
|
||||
if "%xOS%"=="x86" (
|
||||
cd /D "%PROGRAMFILES%\MSBuild\12.0\Bin\
|
||||
) ELSE (
|
||||
cd /D "%PROGRAMFILES(x86)%\MSBuild\12.0\Bin\
|
||||
)
|
||||
|
||||
REM Build x86 Release
|
||||
MSBuild "%~dp0KMSEmulator.sln" /p:configuration="Release" /p:platform="Win32"
|
||||
|
||||
REM Build x64 Release
|
||||
MSBuild "%~dp0KMSEmulator.sln" /p:configuration="Release" /p:platform="x64"
|
||||
|
||||
REM Clean Solution of Junk Files
|
||||
call "%~dp0Clean.cmd"
|
||||
@@ -0,0 +1,27 @@
|
||||
@echo off
|
||||
cd /D %~dp0
|
||||
REM Delete Precompiled Headers
|
||||
FOR /D /R %%X IN (ipch*) DO RD /S /Q "%%X"
|
||||
|
||||
REM Delete obj Folders
|
||||
FOR /D /R %%X IN (obj*) DO RD /S /Q "%%X"
|
||||
|
||||
REM Delete Debug Folders
|
||||
FOR /D /R %%X IN (Debug*) DO RD /S /Q "%%X"
|
||||
|
||||
REM Delete Static Library Binary Folders
|
||||
RD /S /Q "%~dp0KMS Client Library\bin"
|
||||
RD /S /Q "%~dp0KMS Server Library\bin"
|
||||
RD /S /Q "%~dp0KMS Stub Library\bin"
|
||||
|
||||
REM Delete EXP Files
|
||||
DEL /f /s /q *.exp
|
||||
|
||||
REM Delete LIB Files
|
||||
DEL /f /s /q *.lib
|
||||
|
||||
REM Delete PDB Files
|
||||
DEL /f /s /q *.pdb
|
||||
|
||||
REM Delete SDF Files
|
||||
DEL /f /s /q *.sdf
|
||||
@@ -0,0 +1,172 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.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>{BF8574C9-3770-48D5-A8FA-DCAB6C3145D3}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>KMSClientLibrary</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</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|Win32'">
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\CoreKMS.h" />
|
||||
<ClInclude Include="..\include\Crypto.h" />
|
||||
<ClInclude Include="..\include\Hash.h" />
|
||||
<ClInclude Include="..\include\KMSClientLib.h" />
|
||||
<ClInclude Include="..\include\KMSClientLogic.h" />
|
||||
<ClInclude Include="..\include\KMSClientSettings.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\source\Crypto.cpp" />
|
||||
<ClCompile Include="..\source\Hash.cpp" />
|
||||
<ClCompile Include="..\source\KMSClientLogic.cpp" />
|
||||
<ClCompile Include="..\source\KMSClientSettings.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?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;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="..\include\CoreKMS.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\KMSClientLogic.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\KMSClientSettings.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\KMSClientLib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\Crypto.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\Hash.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\source\KMSClientLogic.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\KMSClientSettings.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\Crypto.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\Hash.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,173 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.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>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\KMSClientLib.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Resource.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KMS Client Library\KMS Client Library.vcxproj">
|
||||
<Project>{bf8574c9-3770-48d5-a8fa-dcab6c3145d3}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\KMS Stub Library\KMS Stub Library.vcxproj">
|
||||
<Project>{de697625-1bbe-40c1-877f-c5dd6d657199}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{4FFEE4C8-015E-4A1F-B6D4-82735E95B95B}</ProjectGuid>
|
||||
<RootNamespace>KMSClient</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</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)'=='Debug|Win32'">
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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;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="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\KMSClientLib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Resource.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
// Includes and Namespaces
|
||||
#include "KMSClientLib.h"
|
||||
|
||||
// KMS Client Console Main EntryPoint
|
||||
int wmain(int argc, wchar_t* argv[])
|
||||
{
|
||||
// Get Application Parameters
|
||||
LoadClientParameters(argc, argv, false);
|
||||
|
||||
// Start KMS Client
|
||||
StartKMSClient();
|
||||
|
||||
// Progrem Stopped
|
||||
return 0;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,30 @@
|
||||
// KMS Emulator DLL.cpp : Defines the exported functions for the DLL application.
|
||||
//
|
||||
|
||||
// Includes and Namespaces
|
||||
#include "stdafx.h"
|
||||
|
||||
// DLL Export Function Prototypes
|
||||
extern "C" __declspec(dllexport) void RunKMSClient(int argc, wchar_t *argv[], bool RunAsService);
|
||||
extern "C" __declspec(dllexport) void RunKMSServer(int argc, wchar_t *argv[], bool RunAsService);
|
||||
extern "C" __declspec(dllexport) void KillKMSServer();
|
||||
|
||||
// Load KMS Client Options and Start KMS Client
|
||||
extern "C" __declspec(dllexport) void RunKMSClient(int argc, wchar_t *argv[], bool RunAsService)
|
||||
{
|
||||
LoadClientParameters(argc, argv, RunAsService);
|
||||
StartKMSClient();
|
||||
}
|
||||
|
||||
// Load KMS Server Options and Start KMS Server
|
||||
extern "C" __declspec(dllexport) void RunKMSServer(int argc, wchar_t *argv[], bool RunAsService)
|
||||
{
|
||||
LoadServerParameters(argc, argv, RunAsService);
|
||||
StartKMSServer();
|
||||
}
|
||||
|
||||
// Stop KMS Server
|
||||
extern "C" __declspec(dllexport) void KillKMSServer()
|
||||
{
|
||||
StopKMSServer();
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.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>{0A20C4D6-B67A-4424-85BA-65FBAEB90259}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>KMSEmulatorDLL</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</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)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;KMSEMULATORDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;KMSEMULATORDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
</PrecompiledHeader>
|
||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
|
||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KMS Emulator DLL.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KMS Client Library\KMS Client Library.vcxproj">
|
||||
<Project>{bf8574c9-3770-48d5-a8fa-dcab6c3145d3}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\KMS Server Library\KMS Server Library.vcxproj">
|
||||
<Project>{903184f0-3e00-40d5-82a7-0f99ddf11e37}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\KMS Stub Library\KMS Stub Library.vcxproj">
|
||||
<Project>{de697625-1bbe-40c1-877f-c5dd6d657199}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Resource.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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;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="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KMS Emulator DLL.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Resource.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
// dllmain.cpp : Defines the entry point for the DLL application.
|
||||
#include "stdafx.h"
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
// No Unreferenced Parameter Warnings
|
||||
UNREFERENCED_PARAMETER(hModule);
|
||||
UNREFERENCED_PARAMETER(lpReserved);
|
||||
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// KMS Server DLL.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
@@ -0,0 +1,16 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files:
|
||||
#include <windows.h>
|
||||
|
||||
// Reference additional headers your program requires here
|
||||
#include "KMSClientLib.h"
|
||||
#include "KMSServerLib.h"
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
@@ -0,0 +1,176 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.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>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\CoreKMS.h" />
|
||||
<ClInclude Include="..\include\Crypto.h" />
|
||||
<ClInclude Include="..\include\Hash.h" />
|
||||
<ClInclude Include="..\include\KMSHWID.h" />
|
||||
<ClInclude Include="..\include\KMSPID.h" />
|
||||
<ClInclude Include="..\include\KMSServerLib.h" />
|
||||
<ClInclude Include="..\include\KMSServerLogic.h" />
|
||||
<ClInclude Include="..\include\KMSServerSettings.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\source\Crypto.cpp" />
|
||||
<ClCompile Include="..\source\Hash.cpp" />
|
||||
<ClCompile Include="..\source\KMSHWID.cpp" />
|
||||
<ClCompile Include="..\source\KMSPID.cpp" />
|
||||
<ClCompile Include="..\source\KMSServerLogic.cpp" />
|
||||
<ClCompile Include="..\source\KMSServerSettings.cpp" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{903184F0-3E00-40D5-82A7-0F99DDF11E37}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>KMSServerLibrary</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</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|Win32'">
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?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;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="..\include\KMSServerLib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\CoreKMS.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\KMSPID.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\KMSServerLogic.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\KMSServerSettings.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\Crypto.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\Hash.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\KMSHWID.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\source\KMSPID.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\KMSServerLogic.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\KMSServerSettings.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\Crypto.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\Hash.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\KMSHWID.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.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>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\KMSServerLib.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Resource.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KMS Server Library\KMS Server Library.vcxproj">
|
||||
<Project>{903184f0-3e00-40d5-82a7-0f99ddf11e37}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\KMS Stub Library\KMS Stub Library.vcxproj">
|
||||
<Project>{de697625-1bbe-40c1-877f-c5dd6d657199}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{9D4665B7-A3A4-4526-AACA-181AA64998C6}</ProjectGuid>
|
||||
<RootNamespace>KMSServerService</RootNamespace>
|
||||
<ProjectName>KMS Server Service</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</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)'=='Debug|Win32'">
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>1.0</Version>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>1.0</Version>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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;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="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\KMSServerLib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Resource.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Binary file not shown.
@@ -0,0 +1,81 @@
|
||||
// Includes and Namespaces
|
||||
#include "KMSServerLib.h"
|
||||
|
||||
// Function Prototypes
|
||||
void ServiceMain(int argc, char** argv);
|
||||
void ControlHandler(DWORD code);
|
||||
|
||||
// Windows Service Parameters
|
||||
extern SERVICE_STATUS ServerServiceStatus;
|
||||
extern SERVICE_STATUS_HANDLE ServerServiceHandle;
|
||||
WCHAR ServiceName[] = L"KMSServerService";
|
||||
|
||||
// KMS Server Service Main EntryPoint
|
||||
int wmain(int argc, wchar_t* argv[])
|
||||
{
|
||||
// Get Application Parameters
|
||||
LoadServerParameters(argc, argv, true);
|
||||
|
||||
// Windows Service Parameters
|
||||
SERVICE_TABLE_ENTRY ServiceTable[2] = {0};
|
||||
ServiceTable[0].lpServiceName = ServiceName;
|
||||
ServiceTable[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTION)ServiceMain;
|
||||
|
||||
// Start Service Control Dispatcher Thread for our Service
|
||||
StartServiceCtrlDispatcher(ServiceTable);
|
||||
|
||||
// Service Stopped
|
||||
return 0;
|
||||
}
|
||||
|
||||
// KMS Server Service EntryPoint
|
||||
void ServiceMain(int argc, char* argv[])
|
||||
{
|
||||
// No Unreferenced Parameter Warnings
|
||||
UNREFERENCED_PARAMETER(argc);
|
||||
UNREFERENCED_PARAMETER(argv);
|
||||
|
||||
// Register Control Handler
|
||||
ServerServiceHandle = RegisterServiceCtrlHandlerW(ServiceName, (LPHANDLER_FUNCTION)ControlHandler);
|
||||
|
||||
// RegisterServiceCtrlHandlerW returned NULL PTR
|
||||
if (ServerServiceHandle == NULL)
|
||||
{
|
||||
// Registering Control Handler failed
|
||||
return;
|
||||
}
|
||||
|
||||
ServerServiceStatus.dwServiceType = SERVICE_WIN32;
|
||||
ServerServiceStatus.dwCurrentState = SERVICE_RUNNING;
|
||||
ServerServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_SHUTDOWN | SERVICE_ACCEPT_STOP;
|
||||
ServerServiceStatus.dwWin32ExitCode = ERROR_SUCCESS;
|
||||
ServerServiceStatus.dwServiceSpecificExitCode = NULL;
|
||||
ServerServiceStatus.dwCheckPoint = NULL;
|
||||
ServerServiceStatus.dwWaitHint = NULL;
|
||||
|
||||
// Report Service Status to SCM.
|
||||
SetServiceStatus(ServerServiceHandle, &ServerServiceStatus);
|
||||
|
||||
// Start KMS Server
|
||||
StartKMSServer();
|
||||
}
|
||||
|
||||
// Control Handler
|
||||
void ControlHandler(DWORD code)
|
||||
{
|
||||
switch(code)
|
||||
{
|
||||
case SERVICE_CONTROL_SHUTDOWN:
|
||||
case SERVICE_CONTROL_STOP:
|
||||
ServerServiceStatus.dwWin32ExitCode = ERROR_SUCCESS;
|
||||
ServerServiceStatus.dwCurrentState = SERVICE_STOPPED;
|
||||
break;
|
||||
case SERVICE_USER_DEFINED_CONTROL:
|
||||
ServerServiceStatus.dwWin32ExitCode = ERROR_BAD_CONFIGURATION;
|
||||
ServerServiceStatus.dwCurrentState = SERVICE_STOPPED;
|
||||
break;
|
||||
}
|
||||
|
||||
// Report Service Status
|
||||
SetServiceStatus(ServerServiceHandle, &ServerServiceStatus);
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.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>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Resource.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KMS Server Library\KMS Server Library.vcxproj">
|
||||
<Project>{903184f0-3e00-40d5-82a7-0f99ddf11e37}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\KMS Stub Library\KMS Stub Library.vcxproj">
|
||||
<Project>{de697625-1bbe-40c1-877f-c5dd6d657199}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{B729294A-35C1-4720-A125-1C5996C8473F}</ProjectGuid>
|
||||
<RootNamespace>KMSServer</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</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)'=='Debug|Win32'">
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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="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="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Resource.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
// Includes and Namespaces
|
||||
#include "KMSServerLib.h"
|
||||
|
||||
// KMS Server Console Main EntryPoint
|
||||
int wmain(int argc, wchar_t* argv[])
|
||||
{
|
||||
// Get Application Parameters
|
||||
LoadServerParameters(argc, argv, false);
|
||||
|
||||
// Start KMS Server
|
||||
StartKMSServer();
|
||||
|
||||
// Progrem Stopped
|
||||
return 0;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.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>{DE697625-1BBE-40C1-877F-C5DD6D657199}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>KMSStubLibrary</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</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|Win32'">
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>bin\x86\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x86\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>bin\x64\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\x64\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\KMSServer.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\source\KMSServer_c.c" />
|
||||
<ClCompile Include="..\source\KMSServer_s.c" />
|
||||
<ClCompile Include="..\source\RPCMemory.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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;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="..\include\KMSServer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\source\KMSServer_c.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\KMSServer_s.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\source\RPCMemory.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,88 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KMS Server", "KMS Server\KMS Server.vcxproj", "{B729294A-35C1-4720-A125-1C5996C8473F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KMS Client", "KMS Client\KMS Client.vcxproj", "{4FFEE4C8-015E-4A1F-B6D4-82735E95B95B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KMS Server Service", "KMS Server Service\KMS Server Service.vcxproj", "{9D4665B7-A3A4-4526-AACA-181AA64998C6}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KMS Client Library", "KMS Client Library\KMS Client Library.vcxproj", "{BF8574C9-3770-48D5-A8FA-DCAB6C3145D3}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KMS Server Library", "KMS Server Library\KMS Server Library.vcxproj", "{903184F0-3E00-40D5-82A7-0F99DDF11E37}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KMS Emulator DLL", "KMS Emulator DLL\KMS Emulator DLL.vcxproj", "{0A20C4D6-B67A-4424-85BA-65FBAEB90259}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KMS Stub Library", "KMS Stub Library\KMS Stub Library.vcxproj", "{DE697625-1BBE-40C1-877F-C5DD6D657199}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B729294A-35C1-4720-A125-1C5996C8473F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B729294A-35C1-4720-A125-1C5996C8473F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B729294A-35C1-4720-A125-1C5996C8473F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B729294A-35C1-4720-A125-1C5996C8473F}.Debug|x64.Build.0 = Debug|x64
|
||||
{B729294A-35C1-4720-A125-1C5996C8473F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B729294A-35C1-4720-A125-1C5996C8473F}.Release|Win32.Build.0 = Release|Win32
|
||||
{B729294A-35C1-4720-A125-1C5996C8473F}.Release|x64.ActiveCfg = Release|x64
|
||||
{B729294A-35C1-4720-A125-1C5996C8473F}.Release|x64.Build.0 = Release|x64
|
||||
{4FFEE4C8-015E-4A1F-B6D4-82735E95B95B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4FFEE4C8-015E-4A1F-B6D4-82735E95B95B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4FFEE4C8-015E-4A1F-B6D4-82735E95B95B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4FFEE4C8-015E-4A1F-B6D4-82735E95B95B}.Debug|x64.Build.0 = Debug|x64
|
||||
{4FFEE4C8-015E-4A1F-B6D4-82735E95B95B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4FFEE4C8-015E-4A1F-B6D4-82735E95B95B}.Release|Win32.Build.0 = Release|Win32
|
||||
{4FFEE4C8-015E-4A1F-B6D4-82735E95B95B}.Release|x64.ActiveCfg = Release|x64
|
||||
{4FFEE4C8-015E-4A1F-B6D4-82735E95B95B}.Release|x64.Build.0 = Release|x64
|
||||
{9D4665B7-A3A4-4526-AACA-181AA64998C6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9D4665B7-A3A4-4526-AACA-181AA64998C6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9D4665B7-A3A4-4526-AACA-181AA64998C6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9D4665B7-A3A4-4526-AACA-181AA64998C6}.Debug|x64.Build.0 = Debug|x64
|
||||
{9D4665B7-A3A4-4526-AACA-181AA64998C6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9D4665B7-A3A4-4526-AACA-181AA64998C6}.Release|Win32.Build.0 = Release|Win32
|
||||
{9D4665B7-A3A4-4526-AACA-181AA64998C6}.Release|x64.ActiveCfg = Release|x64
|
||||
{9D4665B7-A3A4-4526-AACA-181AA64998C6}.Release|x64.Build.0 = Release|x64
|
||||
{BF8574C9-3770-48D5-A8FA-DCAB6C3145D3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BF8574C9-3770-48D5-A8FA-DCAB6C3145D3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BF8574C9-3770-48D5-A8FA-DCAB6C3145D3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BF8574C9-3770-48D5-A8FA-DCAB6C3145D3}.Debug|x64.Build.0 = Debug|x64
|
||||
{BF8574C9-3770-48D5-A8FA-DCAB6C3145D3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BF8574C9-3770-48D5-A8FA-DCAB6C3145D3}.Release|Win32.Build.0 = Release|Win32
|
||||
{BF8574C9-3770-48D5-A8FA-DCAB6C3145D3}.Release|x64.ActiveCfg = Release|x64
|
||||
{BF8574C9-3770-48D5-A8FA-DCAB6C3145D3}.Release|x64.Build.0 = Release|x64
|
||||
{903184F0-3E00-40D5-82A7-0F99DDF11E37}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{903184F0-3E00-40D5-82A7-0F99DDF11E37}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{903184F0-3E00-40D5-82A7-0F99DDF11E37}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{903184F0-3E00-40D5-82A7-0F99DDF11E37}.Debug|x64.Build.0 = Debug|x64
|
||||
{903184F0-3E00-40D5-82A7-0F99DDF11E37}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{903184F0-3E00-40D5-82A7-0F99DDF11E37}.Release|Win32.Build.0 = Release|Win32
|
||||
{903184F0-3E00-40D5-82A7-0F99DDF11E37}.Release|x64.ActiveCfg = Release|x64
|
||||
{903184F0-3E00-40D5-82A7-0F99DDF11E37}.Release|x64.Build.0 = Release|x64
|
||||
{0A20C4D6-B67A-4424-85BA-65FBAEB90259}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0A20C4D6-B67A-4424-85BA-65FBAEB90259}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0A20C4D6-B67A-4424-85BA-65FBAEB90259}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0A20C4D6-B67A-4424-85BA-65FBAEB90259}.Debug|x64.Build.0 = Debug|x64
|
||||
{0A20C4D6-B67A-4424-85BA-65FBAEB90259}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0A20C4D6-B67A-4424-85BA-65FBAEB90259}.Release|Win32.Build.0 = Release|Win32
|
||||
{0A20C4D6-B67A-4424-85BA-65FBAEB90259}.Release|x64.ActiveCfg = Release|x64
|
||||
{0A20C4D6-B67A-4424-85BA-65FBAEB90259}.Release|x64.Build.0 = Release|x64
|
||||
{DE697625-1BBE-40C1-877F-C5DD6D657199}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{DE697625-1BBE-40C1-877F-C5DD6D657199}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DE697625-1BBE-40C1-877F-C5DD6D657199}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{DE697625-1BBE-40C1-877F-C5DD6D657199}.Debug|x64.Build.0 = Debug|x64
|
||||
{DE697625-1BBE-40C1-877F-C5DD6D657199}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{DE697625-1BBE-40C1-877F-C5DD6D657199}.Release|Win32.Build.0 = Release|Win32
|
||||
{DE697625-1BBE-40C1-877F-C5DD6D657199}.Release|x64.ActiveCfg = Release|x64
|
||||
{DE697625-1BBE-40C1-877F-C5DD6D657199}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,675 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{one line to give the program's name and a brief idea of what it does.}
|
||||
Copyright (C) {year} {name of author}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
{project} Copyright (C) {year} {fullname}
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Header Guard
|
||||
#pragma once
|
||||
|
||||
// Includes and Namespaces
|
||||
#include <windows.h>
|
||||
//---------------------------------------------------------------------------
|
||||
// Defines
|
||||
#define MAX_RESPONSE_SIZE 512
|
||||
#define MAX_REQUEST_SIZE 256 // 260
|
||||
#define PID_BUFFER_SIZE 64
|
||||
#define PORT_BUFFER_SIZE 6
|
||||
#define GUID_BUFFER_SIZE 37
|
||||
#define HASH_SIZE 16
|
||||
#define HASH_SIZE_SHA256 32
|
||||
#define HASH_SIZE_HMAC_SHA256 16
|
||||
//---------------------------------------------------------------------------
|
||||
// Typdefs
|
||||
typedef unsigned long long QWORD;
|
||||
typedef unsigned long long *PQWORD;
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Struct Prototypes
|
||||
#pragma warning( disable: 4201 ) // Disable warning C4201: nonstandard extension used : nameless struct/union
|
||||
// Base Properties for KMS Client Request
|
||||
struct REQUEST
|
||||
{
|
||||
union
|
||||
{
|
||||
DWORD Version; // KMS Protocol Version
|
||||
struct
|
||||
{
|
||||
WORD MinorVer; // KMS Protocol Minor Version
|
||||
WORD MajorVer; // KMS Protocol Major Version
|
||||
};
|
||||
};
|
||||
|
||||
DWORD IsClientVM; // Whether or not the KMS Client is a Virtual Machine
|
||||
DWORD LicenseStatus; // Microsoft Licensing Status Code
|
||||
DWORD GraceTime; // The time in Minutes of the KMS Client's Licensing Grace Period
|
||||
GUID ApplicationId; // Microsoft Product Application ID
|
||||
GUID SkuId; // Microsoft Product SKU ID
|
||||
GUID KmsCountedId; // Microsoft Identifier for KMS Client Request Counting and Activation
|
||||
GUID ClientMachineId; // Unique Identifier to Distinguish KMS Clients
|
||||
DWORD RequiredClientCount; // Number of KMS Clients that must have requested KMS Server Activation
|
||||
FILETIME RequestTime; // Time of KMS Client Request
|
||||
GUID PreviousClientMachineId; // Previous Client Machine ID
|
||||
WCHAR MachineName[64]; // KMS Client Network DNS Name
|
||||
};
|
||||
|
||||
// Base Properties for KMS Server Response
|
||||
struct RESPONSE
|
||||
{
|
||||
union
|
||||
{
|
||||
DWORD Version; // KMS Protocol Version
|
||||
struct
|
||||
{
|
||||
WORD MinorVer; // KMS Protocol Minor Version
|
||||
WORD MajorVer; // KMS Protocol Major Version
|
||||
};
|
||||
};
|
||||
|
||||
DWORD KMSPIDLength; // Length of KMS PID
|
||||
WCHAR KMSPID[PID_BUFFER_SIZE]; // Microsoft Product Key ID for KMS Server Activated Product Key
|
||||
GUID ClientMachineId; // Unique Identifier of KMS Client
|
||||
FILETIME RequestTime; // Time of KMS Client Request
|
||||
DWORD KMSCurrentCount; // Number of KMS Clients that currently have requested KMS Server Activation
|
||||
DWORD VLActivationInterval; // The time in Minutes that Unactivated KMS Clients will wait before requesting Activation
|
||||
DWORD VLRenewalInterval; // The time in Minutes that Activated KMS Clients will wait before requesting Reactivation
|
||||
};
|
||||
|
||||
// KMS Client Request V4 Object
|
||||
struct REQUEST_V4
|
||||
{
|
||||
REQUEST RequestBase; // Unhashed KMS Client Request Data
|
||||
BYTE Hash[HASH_SIZE]; // MAC Hash of KMS Client Request Data
|
||||
};
|
||||
|
||||
// KMS Server Response V4 Object
|
||||
struct RESPONSE_V4
|
||||
{
|
||||
RESPONSE ResponseBase; // Unhashed KMS Server Response Data
|
||||
BYTE Hash[HASH_SIZE]; // MAC Hash of KMS Server Response Data
|
||||
};
|
||||
|
||||
// KMS Client Request V5 Object
|
||||
struct REQUEST_V5
|
||||
{
|
||||
union
|
||||
{
|
||||
DWORD Version; // KMS Protocol Version
|
||||
struct
|
||||
{
|
||||
WORD MinorVer; // KMS Protocol Minor Version
|
||||
WORD MajorVer; // KMS Protocol Major Version
|
||||
};
|
||||
};
|
||||
|
||||
BYTE Salt[16]; // KMS Client AES Initialization Vector (Salt)
|
||||
REQUEST RequestBase; // Unhashed KMS Client Request Data
|
||||
BYTE Pad[4]; // Padding - Fill Message, so that encryptSize is divisible by blocklength
|
||||
};
|
||||
|
||||
// KMS Server Response V5 Object
|
||||
struct RESPONSE_V5
|
||||
{
|
||||
union
|
||||
{
|
||||
DWORD Version; // KMS Protocol Version
|
||||
struct
|
||||
{
|
||||
WORD MinorVer; // KMS Protocol Minor Version
|
||||
WORD MajorVer; // KMS Protocol Major Version
|
||||
};
|
||||
};
|
||||
|
||||
BYTE RequestSalt[16]; // KMS Client AES Initialization Vector (Salt)
|
||||
RESPONSE ResponseBase; // Unhashed KMS Server Response Data
|
||||
BYTE Salt[16]; // KMS Server AES Initialization Vector (Salt) : Not Used. Possible MS Bug: The Request IV is used instead.
|
||||
BYTE Hash[HASH_SIZE_SHA256]; // Hash of KMS Server Response Data
|
||||
BYTE Pad[2]; // PKCS5 Padding
|
||||
};
|
||||
|
||||
// KMS Client Request V6 Object
|
||||
struct REQUEST_V6
|
||||
{
|
||||
union
|
||||
{
|
||||
DWORD Version; // KMS Protocol Version
|
||||
struct
|
||||
{
|
||||
WORD MinorVer; // KMS Protocol Minor Version
|
||||
WORD MajorVer; // KMS Protocol Major Version
|
||||
};
|
||||
};
|
||||
|
||||
BYTE Salt[16]; // KMS Client AES Initialization Vector (Salt)
|
||||
REQUEST RequestBase; // Unhashed KMS Client Request Data
|
||||
BYTE Pad[4]; // Padding - Fill Message, so that encryptSize is divisible by blocklength
|
||||
};
|
||||
|
||||
// KMS Server Response V6 Object
|
||||
struct RESPONSE_V6
|
||||
{
|
||||
union
|
||||
{
|
||||
DWORD Version; // KMS Protocol Version
|
||||
struct
|
||||
{
|
||||
WORD MinorVer; // KMS Protocol Minor Version
|
||||
WORD MajorVer; // KMS Protocol Major Version
|
||||
};
|
||||
};
|
||||
|
||||
BYTE RequestSalt[16]; // KMS Client AES Initialization Vector (Salt)
|
||||
RESPONSE ResponseBase; // Unhashed KMS Server Response Data
|
||||
BYTE Salt[16]; // KMS Server AES Initialization Vector (Salt) : Not Used. Possible MS Bug: The Request IV is used instead.
|
||||
BYTE Hash[HASH_SIZE_SHA256]; // Hash of KMS Server Response Data
|
||||
BYTE MachineHardwareHash[8]; // Most likely the machine hardware hash of the server
|
||||
BYTE Xor2[16]; // Xor2 ???
|
||||
BYTE HMAC_SHA256[HASH_SIZE_HMAC_SHA256]; // HMAC-SHA256 (RFC 2104)
|
||||
BYTE Pad[10]; // PKCS5 Padding
|
||||
};
|
||||
#pragma warning( default: 4201 ) // Enable warning C4201: nonstandard extension used : nameless struct/union
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,30 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Header Guard
|
||||
#pragma once
|
||||
|
||||
// Includes and Namespaces
|
||||
#include <windows.h>
|
||||
|
||||
// Constants
|
||||
#define AES_TYPE_128 0
|
||||
#define AES_TYPE_192 1
|
||||
#define AES_TYPE_256 2
|
||||
|
||||
#define AES_MODE_ECB 0
|
||||
#define AES_MODE_CBC 1
|
||||
#define AES_MODE_CFB 2
|
||||
#define AES_MODE_OFB 3
|
||||
#define AES_MODE_CTR 4
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Function Prototypes
|
||||
void AESDecryptMessage(PBYTE const IV, PBYTE const Message, PDWORD const MessageSize);
|
||||
void AESEncryptMessage(PBYTE const IV, PBYTE const Message, PDWORD const MessageSize, DWORD BufferLen);
|
||||
|
||||
BYTE MULx2(BYTE bIn);
|
||||
BYTE MULx3(BYTE bIn);
|
||||
DWORD AesInit(DWORD dwType, DWORD dwMode, BYTE bPadding, PBYTE pbKey, PBYTE pbIV);
|
||||
DWORD AesClear(void);
|
||||
void DecryptMessage(int MessageSize, PBYTE Message);
|
||||
void EncryptMessage(int MessageSize, PBYTE Message);
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,21 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Header Guard
|
||||
#pragma once
|
||||
|
||||
// Includes and Namespaces
|
||||
#include <windows.h>
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// HMAC-SHA256 key blob structure
|
||||
struct HMAC_KEYBLOB {
|
||||
BLOBHEADER hdr;
|
||||
DWORD dwKeySize;
|
||||
BYTE rgbKeyData[16];
|
||||
};
|
||||
|
||||
// Function Prototypes
|
||||
void GetHash(DWORD MessageSize, PBYTE const Message, PBYTE const hash);
|
||||
void GetHashSHA256(DWORD dataSize, PBYTE const data, PBYTE const Hash);
|
||||
void GetHmacKey(FILETIME* timestamp, PBYTE hmackey);
|
||||
void GetHmacSHA256(DWORD dwDataLen, PBYTE const pbData, PBYTE const pbHash);
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -0,0 +1,6 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Header Guard
|
||||
#pragma once
|
||||
|
||||
// Includes and Namespaces
|
||||
#include "KMSClientLogic.h"
|
||||
@@ -0,0 +1,29 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Header Guard
|
||||
#pragma once
|
||||
|
||||
// Includes and Namespaces
|
||||
#include <windows.h>
|
||||
#include <Strsafe.h>
|
||||
#include "CoreKMS.h"
|
||||
//---------------------------------------------------------------------------
|
||||
// Function Prototypes
|
||||
void LoadClientParameters(int argc, wchar_t *argv[], bool RunAsService);
|
||||
void StartKMSClient();
|
||||
PBYTE CreateRequest();
|
||||
void CreateRequestBase(REQUEST* const Request);
|
||||
PBYTE CreateRequestV4();
|
||||
PBYTE CreateRequestV5();
|
||||
PBYTE CreateRequestV6();
|
||||
void ReadResponseV4(RESPONSE_V4& Response_v4, int responseSize, PBYTE response);
|
||||
void ReadResponseV5(RESPONSE_V5& Response_v5, int responseSize, PBYTE response);
|
||||
void ReadResponseV6(RESPONSE_V6& Response_v5, int responseSize, PBYTE response);
|
||||
int SendRequest(PBYTE request, const int requestsSent, int* const requestsNeeded);
|
||||
void ClientValidateKMSPort(WCHAR* KMSPort);
|
||||
void ClientValidateKMSHost(WCHAR* KMSHost);
|
||||
void ClientValidateKMSClientMode(WCHAR* KMSClientMode);
|
||||
void ClientWriteLogInformation(WCHAR* const Message);
|
||||
void ClientWriteLogError(WCHAR* const Message);
|
||||
void ClientWriteLogErrorTerminate(WCHAR* const Message, int ExitCode);
|
||||
void ClientWriteEventLogEntry(DWORD dwIdentifier, WCHAR* const lpszMessage, WORD wType);
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,36 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Header Guard
|
||||
#pragma once
|
||||
|
||||
// Includes and Namespaces
|
||||
#include <windows.h>
|
||||
#include <Strsafe.h>
|
||||
#include "CoreKMS.h"
|
||||
//---------------------------------------------------------------------------
|
||||
// Class Prototypes
|
||||
|
||||
// Contain all KMS Client Parameters and Settings.
|
||||
class KMSClientSettings
|
||||
{
|
||||
public:
|
||||
// KMS Client Parameters
|
||||
static WCHAR KMSHost[256];
|
||||
static WCHAR KMSPort[PORT_BUFFER_SIZE];
|
||||
static WCHAR KMSClientMode[256];
|
||||
|
||||
// KMS Client Identification Data
|
||||
static DWORD RequiredClientCount;
|
||||
static WORD KMSProtocolMajorVersion;
|
||||
static WORD KMSProtocolMinorVersion;
|
||||
static DWORD KMSClientLicenseStatus;
|
||||
static WCHAR KMSClientAppID[GUID_BUFFER_SIZE];
|
||||
static WCHAR KMSClientSkuID[GUID_BUFFER_SIZE];
|
||||
static WCHAR KMSClientKMSCountedID[GUID_BUFFER_SIZE];
|
||||
|
||||
// KMS Client Program Control
|
||||
static bool RunAsService;
|
||||
|
||||
// Set Default Settings
|
||||
static void Initialize();
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,14 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Header Guard
|
||||
#pragma once
|
||||
|
||||
// Includes and Namespaces
|
||||
#include <windows.h>
|
||||
#include <regex>
|
||||
#include <Strsafe.h>
|
||||
#include <string>
|
||||
#include "CoreKMS.h"
|
||||
|
||||
// Function Prototypes
|
||||
void GetKMSHWID(PQWORD KMSHWID, REQUEST* const Request);
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,15 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Header Guard
|
||||
#pragma once
|
||||
|
||||
// Includes and Namespaces
|
||||
#include <windows.h>
|
||||
#include <regex>
|
||||
#include <Strsafe.h>
|
||||
#include <string>
|
||||
#include "CoreKMS.h"
|
||||
|
||||
// Function Prototypes
|
||||
void CreateKMSPID(WCHAR* const KMSPID, REQUEST* const Request);
|
||||
void GetKMSPID(WCHAR* const KMSPID, REQUEST* const Request);
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,85 @@
|
||||
|
||||
|
||||
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
|
||||
|
||||
|
||||
/* File created by MIDL compiler version 8.00.0595 */
|
||||
/* at Thu Oct 18 15:24:14 2012
|
||||
*/
|
||||
/* Compiler settings for KMSServer.idl:
|
||||
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0595
|
||||
protocol : dce , ms_ext, c_ext, robust
|
||||
error checks: allocation ref bounds_check enum stub_data
|
||||
VC __declspec() decoration level:
|
||||
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
|
||||
DECLSPEC_UUID(), MIDL_INTERFACE()
|
||||
*/
|
||||
/* @@MIDL_FILE_HEADING( ) */
|
||||
|
||||
#pragma warning( disable: 4049 ) /* more than 64k source lines */
|
||||
|
||||
|
||||
/* verify that the <rpcndr.h> version is high enough to compile this file*/
|
||||
#ifndef __REQUIRED_RPCNDR_H_VERSION__
|
||||
#define __REQUIRED_RPCNDR_H_VERSION__ 475
|
||||
#endif
|
||||
|
||||
#include "rpc.h"
|
||||
#include "rpcndr.h"
|
||||
|
||||
#ifndef __RPCNDR_H_VERSION__
|
||||
#error this stub requires an updated version of <rpcndr.h>
|
||||
#endif // __RPCNDR_H_VERSION__
|
||||
|
||||
|
||||
#ifndef __KMSServer_h_h__
|
||||
#define __KMSServer_h_h__
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/* Forward Declarations */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __KMSServer_INTERFACE_DEFINED__
|
||||
#define __KMSServer_INTERFACE_DEFINED__
|
||||
|
||||
/* interface KMSServer */
|
||||
/* [version][uuid] */
|
||||
|
||||
int ActivationRequest(
|
||||
/* [in] */ handle_t IDL_handle,
|
||||
/* [in] */ int requestSize,
|
||||
/* [size_is][in] */ unsigned char *request,
|
||||
/* [out] */ int *responseSize,
|
||||
/* [size_is][size_is][out] */ unsigned char **response);
|
||||
|
||||
int ActivationResponse(
|
||||
/* [in] */ handle_t IDL_handle,
|
||||
/* [in] */ int requestSize,
|
||||
/* [size_is][in] */ unsigned char *request,
|
||||
/* [out] */ int *responseSize,
|
||||
/* [size_is][size_is][out] */ unsigned char **response);
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE KMSServer_v1_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE KMSServer_v1_0_s_ifspec;
|
||||
#endif /* __KMSServer_INTERFACE_DEFINED__ */
|
||||
|
||||
/* Additional Prototypes for ALL interfaces */
|
||||
|
||||
/* end of Additional Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Header Guard
|
||||
#pragma once
|
||||
|
||||
// Includes and Namespaces
|
||||
#include "KMSServerLogic.h"
|
||||
@@ -0,0 +1,29 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Header Guard
|
||||
#pragma once
|
||||
|
||||
// Includes and Namespaces
|
||||
#include <windows.h>
|
||||
#include <Strsafe.h>
|
||||
#include "CoreKMS.h"
|
||||
//---------------------------------------------------------------------------
|
||||
// Function Prototypes
|
||||
void LoadServerParameters(int argc, wchar_t* argv[], bool RunAsService);
|
||||
void StartKMSServer();
|
||||
void StopKMSServer();
|
||||
DWORD CreateResponseBase(REQUEST* const Request, PBYTE const Response);
|
||||
PBYTE CreateResponseV4(REQUEST_V4* const Request, int* const responseSize);
|
||||
PBYTE CreateResponseV5(REQUEST_V5* const Request, int* const responseSize);
|
||||
PBYTE CreateResponseV6(REQUEST_V6* const Request, int* const responseSize);
|
||||
void ServerValidateKMSPort(WCHAR* KMSPort);
|
||||
void ServerValidateKMSPID(WCHAR* KMSPID);
|
||||
void ServerValidateKMSHWID(WCHAR* KMSHWID);
|
||||
void ServerValidateVLActivationInterval(int VLActivationInterval);
|
||||
void ServerValidateVLRenewalInterval(int VLRenewalInterval);
|
||||
void ServerWriteLogInformation(WCHAR* const Message);
|
||||
void ServerWriteLogError(WCHAR* const Message);
|
||||
void ServerWriteLogErrorTerminate(WCHAR* const Message, int ExitCode);
|
||||
void ServerWriteEventLogEntry(DWORD dwIdentifier, WCHAR* const lpszMessage, WORD wType);
|
||||
void GetHmacKey(FILETIME* timestamp, PBYTE hmackey);
|
||||
void GetHmacSHA256(DWORD dwDataLen, PBYTE const pbData, PBYTE const pbHash);
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,34 @@
|
||||
//---------------------------------------------------------------------------
|
||||
// Header Guard
|
||||
#pragma once
|
||||
|
||||
// Includes and Namespaces
|
||||
#include <windows.h>
|
||||
#include <Strsafe.h>
|
||||
#include "CoreKMS.h"
|
||||
//---------------------------------------------------------------------------
|
||||
// Class Prototypes
|
||||
|
||||
// Contains all KMS Server Parameters and Settings.
|
||||
class KMSServerSettings
|
||||
{
|
||||
public:
|
||||
// KMS Server Parameters
|
||||
static WCHAR KMSPID[PID_BUFFER_SIZE];
|
||||
static QWORD KMSHWID;
|
||||
static WCHAR KMSPort[PORT_BUFFER_SIZE];
|
||||
static DWORD CurrentClientCount;
|
||||
static DWORD VLActivationInterval;
|
||||
static DWORD VLRenewalInterval;
|
||||
|
||||
// KMS Server Program Control
|
||||
static bool GenerateRandomKMSPID;
|
||||
static bool RunAsService;
|
||||
|
||||
// Process Termination Control Variables
|
||||
static bool KillProcesses;
|
||||
|
||||
// Set Default Settings
|
||||
static void Initialize();
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,918 @@
|
||||
// Includes and Namespaces
|
||||
#include "Crypto.h"
|
||||
|
||||
// AES 128-bit key blob structure
|
||||
struct AES_128_KEYBLOB
|
||||
{
|
||||
BLOBHEADER hdr;
|
||||
DWORD dwKeySize;
|
||||
BYTE rgbKeyData[16];
|
||||
};
|
||||
|
||||
// Static AES Session Key
|
||||
static const AES_128_KEYBLOB keyBlob =
|
||||
{
|
||||
// Type, Version, Algorithm
|
||||
{PLAINTEXTKEYBLOB, CUR_BLOB_VERSION, NULL, CALG_AES_128},
|
||||
// Blocklength
|
||||
16,
|
||||
// Key
|
||||
{0xCD, 0x7E, 0x79, 0x6F, 0x2A, 0xB2, 0x5D, 0xCB, 0x55, 0xFF, 0xC8, 0xEF, 0x83, 0x64, 0xC4, 0x70}
|
||||
};
|
||||
|
||||
// Default Type
|
||||
static DWORD Type=AES_TYPE_128;
|
||||
|
||||
// Default Mode
|
||||
static DWORD Mode=AES_MODE_ECB;
|
||||
|
||||
// Default Padding
|
||||
static BYTE Padding=0x00;
|
||||
|
||||
// Static Key Pointer
|
||||
static PBYTE pKey=NULL;
|
||||
|
||||
// Static IV Pointer
|
||||
static PBYTE pIV=NULL;
|
||||
|
||||
// Init
|
||||
static bool IsInit=false;
|
||||
|
||||
// Nb: Number of blocks, Nr: Number of rounds, Nk: Number of keys
|
||||
static DWORD Nb,Nr,Nk;
|
||||
|
||||
// Static SubKeys Pointer
|
||||
static PDWORD pSubKeys=NULL;
|
||||
|
||||
// RCon
|
||||
static BYTE Rcon[11]= {0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36};
|
||||
|
||||
#pragma region Tables
|
||||
|
||||
// Substitution Table
|
||||
static BYTE SubTable[256]=
|
||||
{
|
||||
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
|
||||
0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
|
||||
0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
|
||||
0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75,
|
||||
0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84,
|
||||
0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF,
|
||||
0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8,
|
||||
0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2,
|
||||
0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73,
|
||||
0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB,
|
||||
0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79,
|
||||
0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08,
|
||||
0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A,
|
||||
0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E,
|
||||
0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
|
||||
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
|
||||
};
|
||||
|
||||
// Inverse Substitution Table
|
||||
static BYTE InvSubTable[256]=
|
||||
{
|
||||
0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB,
|
||||
0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB,
|
||||
0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E,
|
||||
0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25,
|
||||
0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92,
|
||||
0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84,
|
||||
0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06,
|
||||
0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B,
|
||||
0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73,
|
||||
0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E,
|
||||
0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B,
|
||||
0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4,
|
||||
0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F,
|
||||
0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF,
|
||||
0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61,
|
||||
0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
// WinApi: AES-128 CBC PKCS5-Padding Encryption
|
||||
void AESEncryptMessage(PBYTE const IV, PBYTE const Message, PDWORD const MessageSize, DWORD BufferLen)
|
||||
{
|
||||
HCRYPTPROV hProv = NULL;
|
||||
HCRYPTKEY hKey = NULL;
|
||||
|
||||
if(!CryptAcquireContextW(&hProv, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
|
||||
return;
|
||||
|
||||
CryptImportKey(hProv, (PBYTE)&keyBlob, sizeof(keyBlob), NULL, NULL, &hKey);
|
||||
CryptSetKeyParam(hKey, KP_IV, IV, NULL);
|
||||
CryptEncrypt(hKey, NULL, true, NULL, Message, MessageSize, BufferLen);
|
||||
|
||||
if(hKey)
|
||||
CryptDestroyKey(hKey);
|
||||
|
||||
if(hProv)
|
||||
CryptReleaseContext(hProv, NULL);
|
||||
}
|
||||
|
||||
// WinApi: AES-128 CBC PKCS5-Padding Decryption
|
||||
void AESDecryptMessage(PBYTE const IV, PBYTE const Message, PDWORD const MessageSize)
|
||||
{
|
||||
HCRYPTPROV hProv = NULL;
|
||||
HCRYPTKEY hKey = NULL;
|
||||
|
||||
if(!CryptAcquireContextW(&hProv, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
|
||||
return;
|
||||
|
||||
CryptImportKey(hProv, (PBYTE)&keyBlob, sizeof(keyBlob), NULL, NULL, &hKey);
|
||||
CryptSetKeyParam(hKey, KP_IV, IV, NULL);
|
||||
CryptDecrypt(hKey, NULL, true, NULL, Message, MessageSize);
|
||||
|
||||
if(hKey)
|
||||
CryptDestroyKey(hKey);
|
||||
|
||||
if(hProv)
|
||||
CryptReleaseContext(hProv, NULL);
|
||||
}
|
||||
|
||||
#pragma region Math
|
||||
|
||||
// MUL x 2
|
||||
BYTE MULx2(BYTE bIn)
|
||||
{
|
||||
BYTE bOut;
|
||||
bOut=(bIn<<1);
|
||||
|
||||
if ((bIn & 0x80) != 0x00)
|
||||
bOut^=0x1B;
|
||||
|
||||
return bOut;
|
||||
};
|
||||
|
||||
// MUL x 3
|
||||
BYTE MULx3(BYTE bIn)
|
||||
{
|
||||
BYTE bOut;
|
||||
bOut=MULx2(bIn)^bIn;
|
||||
|
||||
return bOut;
|
||||
};
|
||||
|
||||
// MUL x 4
|
||||
BYTE MULx4(BYTE bIn)
|
||||
{
|
||||
BYTE bOut;
|
||||
bOut=MULx2(bIn);
|
||||
bOut=MULx2(bOut);
|
||||
|
||||
return bOut;
|
||||
};
|
||||
|
||||
// MUL x 8
|
||||
BYTE MULx8(BYTE bIn)
|
||||
{
|
||||
BYTE bOut;
|
||||
bOut=MULx2(bIn);
|
||||
bOut=MULx2(bOut);
|
||||
bOut=MULx2(bOut);
|
||||
|
||||
return bOut;
|
||||
};
|
||||
|
||||
// MUL x 9
|
||||
BYTE MULx9(BYTE bIn)
|
||||
{
|
||||
BYTE bOut;
|
||||
bOut=MULx8(bIn)^bIn;
|
||||
|
||||
return bOut;
|
||||
};
|
||||
|
||||
// MUL x B
|
||||
BYTE MULxB(BYTE bIn)
|
||||
{
|
||||
BYTE bOut;
|
||||
bOut=MULx8(bIn)^MULx2(bIn)^bIn;
|
||||
|
||||
return bOut;
|
||||
};
|
||||
|
||||
// MUL x D
|
||||
BYTE MULxD(BYTE bIn)
|
||||
{
|
||||
BYTE bOut;
|
||||
bOut=MULx8(bIn)^MULx4(bIn)^bIn;
|
||||
|
||||
return bOut;
|
||||
};
|
||||
|
||||
// MUL x E
|
||||
BYTE MULxE(BYTE bIn)
|
||||
{
|
||||
BYTE bOut;
|
||||
bOut=MULx8(bIn)^MULx4(bIn)^MULx2(bIn);
|
||||
return bOut;
|
||||
};
|
||||
|
||||
// SBOX
|
||||
BYTE SBox(BYTE bIn)
|
||||
{
|
||||
return SubTable[bIn];
|
||||
};
|
||||
|
||||
// Inverse SBOX
|
||||
BYTE InvSBox(BYTE bIn)
|
||||
{
|
||||
return InvSubTable[bIn];
|
||||
};
|
||||
|
||||
// Substitute Word
|
||||
DWORD SubWord(DWORD dwIn)
|
||||
{
|
||||
DWORD dwOut;
|
||||
|
||||
(*((PBYTE)(&dwOut)))=SBox(*((PBYTE)(&dwIn)));
|
||||
(*(((PBYTE)(&dwOut))+1))=SBox(*(((PBYTE)(&dwIn))+1));
|
||||
(*(((PBYTE)(&dwOut))+2))=SBox(*(((PBYTE)(&dwIn))+2));
|
||||
(*(((PBYTE)(&dwOut))+3))=SBox(*(((PBYTE)(&dwIn))+3));
|
||||
|
||||
return dwOut;
|
||||
};
|
||||
|
||||
// Rotate Word
|
||||
DWORD RotWord(DWORD dwIn)
|
||||
{
|
||||
DWORD dwOut;
|
||||
|
||||
(*((PBYTE)(&dwOut)))=(*(((PBYTE)(&dwIn))+1));
|
||||
(*(((PBYTE)(&dwOut))+1))=(*(((PBYTE)(&dwIn))+2));
|
||||
(*(((PBYTE)(&dwOut))+2))=(*(((PBYTE)(&dwIn))+3));
|
||||
(*(((PBYTE)(&dwOut))+3))=(*((PBYTE)(&dwIn)));
|
||||
|
||||
return dwOut;
|
||||
};
|
||||
|
||||
// Substitute Bytes
|
||||
void SubBytes(PBYTE pBytes)
|
||||
{
|
||||
DWORD i;
|
||||
BYTE bIn[16];
|
||||
|
||||
for(i=0 ; i<16 ; i++)
|
||||
bIn[i]=pBytes[i];
|
||||
|
||||
for(i=0 ; i<16 ; i++)
|
||||
pBytes[i]=SBox(bIn[i]);
|
||||
};
|
||||
|
||||
// Shift Rows
|
||||
void ShiftRows(PBYTE pBytes)
|
||||
{
|
||||
DWORD i;
|
||||
BYTE bIn[16];
|
||||
|
||||
for(i=0 ; i<16 ; i++)
|
||||
bIn[i]=pBytes[i];
|
||||
|
||||
pBytes[0]=bIn[0];
|
||||
pBytes[1]=bIn[5];
|
||||
pBytes[2]=bIn[10];
|
||||
pBytes[3]=bIn[15];
|
||||
pBytes[4]=bIn[4];
|
||||
pBytes[5]=bIn[9];
|
||||
pBytes[6]=bIn[14];
|
||||
pBytes[7]=bIn[3];
|
||||
pBytes[8]=bIn[8];
|
||||
pBytes[9]=bIn[13];
|
||||
pBytes[10]=bIn[2];
|
||||
pBytes[11]=bIn[7];
|
||||
pBytes[12]=bIn[12];
|
||||
pBytes[13]=bIn[1];
|
||||
pBytes[14]=bIn[6];
|
||||
pBytes[15]=bIn[11];
|
||||
};
|
||||
|
||||
// Mix Columns
|
||||
void MixColumns(PBYTE pBytes)
|
||||
{
|
||||
DWORD i;
|
||||
BYTE bIn[16];
|
||||
|
||||
for(i=0 ; i<16 ; i++)
|
||||
bIn[i]=pBytes[i];
|
||||
|
||||
pBytes[0] = MULx2(bIn[0]) ^ MULx3(bIn[1]) ^ bIn[2] ^ bIn[3];
|
||||
pBytes[1] = bIn[0] ^ MULx2(bIn[1]) ^ MULx3(bIn[2]) ^ bIn[3];
|
||||
pBytes[2] = bIn[0] ^ bIn[1] ^ MULx2(bIn[2]) ^ MULx3(bIn[3]);
|
||||
pBytes[3] = MULx3(bIn[0]) ^ bIn[1] ^ bIn[2] ^ MULx2(bIn[3]);
|
||||
pBytes[4] = MULx2(bIn[4]) ^ MULx3(bIn[5]) ^ bIn[6] ^ bIn[7];
|
||||
pBytes[5] = bIn[4] ^ MULx2(bIn[5]) ^ MULx3(bIn[6]) ^ bIn[7];
|
||||
pBytes[6] = bIn[4] ^ bIn[5] ^ MULx2(bIn[6]) ^ MULx3(bIn[7]);
|
||||
pBytes[7] = MULx3(bIn[4]) ^ bIn[5] ^ bIn[6] ^ MULx2(bIn[7]);
|
||||
pBytes[8] = MULx2(bIn[8]) ^ MULx3(bIn[9]) ^ bIn[10] ^ bIn[11];
|
||||
pBytes[9] = bIn[8] ^ MULx2(bIn[9]) ^ MULx3(bIn[10]) ^ bIn[11];
|
||||
pBytes[10] = bIn[8] ^ bIn[9] ^ MULx2(bIn[10]) ^ MULx3(bIn[11]);
|
||||
pBytes[11] = MULx3(bIn[8]) ^ bIn[9] ^ bIn[10] ^ MULx2(bIn[11]);
|
||||
pBytes[12] = MULx2(bIn[12]) ^ MULx3(bIn[13]) ^ bIn[14] ^ bIn[15];
|
||||
pBytes[13] = bIn[12] ^ MULx2(bIn[13]) ^ MULx3(bIn[14]) ^ bIn[15];
|
||||
pBytes[14] = bIn[12] ^ bIn[13] ^ MULx2(bIn[14]) ^ MULx3(bIn[15]);
|
||||
pBytes[15] = MULx3(bIn[12]) ^ bIn[13] ^ bIn[14] ^ MULx2(bIn[15]);
|
||||
};
|
||||
|
||||
// Add Round Key
|
||||
void AddRoundKey(PBYTE pState, DWORD Round)
|
||||
{
|
||||
(*((PDWORD)pState)) ^= pSubKeys[4*Round];
|
||||
(*(((PDWORD)pState)+1)) ^= pSubKeys[4*Round+1];
|
||||
(*(((PDWORD)pState)+2)) ^= pSubKeys[4*Round+2];
|
||||
(*(((PDWORD)pState)+3)) ^= pSubKeys[4*Round+3];
|
||||
};
|
||||
|
||||
// Inverse Substitute Bytes
|
||||
void InvSubBytes(PBYTE pBytes)
|
||||
{
|
||||
DWORD i;
|
||||
BYTE bIn[16];
|
||||
|
||||
for(i=0 ; i<16 ; i++)
|
||||
bIn[i]=pBytes[i];
|
||||
|
||||
for(i=0 ; i<16 ; i++)
|
||||
pBytes[i]=InvSBox(bIn[i]);
|
||||
};
|
||||
|
||||
// Inverse Shift Rows
|
||||
void InvShiftRows(PBYTE pBytes)
|
||||
{
|
||||
DWORD i;
|
||||
BYTE bIn[16];
|
||||
|
||||
for(i=0 ; i<16 ; i++)
|
||||
bIn[i]=pBytes[i];
|
||||
|
||||
pBytes[0]=bIn[0];
|
||||
pBytes[1]=bIn[13];
|
||||
pBytes[2]=bIn[10];
|
||||
pBytes[3]=bIn[7];
|
||||
pBytes[4]=bIn[4];
|
||||
pBytes[5]=bIn[1];
|
||||
pBytes[6]=bIn[14];
|
||||
pBytes[7]=bIn[11];
|
||||
pBytes[8]=bIn[8];
|
||||
pBytes[9]=bIn[5];
|
||||
pBytes[10]=bIn[2];
|
||||
pBytes[11]=bIn[15];
|
||||
pBytes[12]=bIn[12];
|
||||
pBytes[13]=bIn[9];
|
||||
pBytes[14]=bIn[6];
|
||||
pBytes[15]=bIn[3];
|
||||
};
|
||||
|
||||
// Inverse Mix Columns
|
||||
void InvMixColumns(PBYTE pBytes)
|
||||
{
|
||||
DWORD i;
|
||||
BYTE bIn[16];
|
||||
|
||||
for(i=0 ; i<16 ; i++)
|
||||
bIn[i]=pBytes[i];
|
||||
|
||||
pBytes[0] = MULxE(bIn[0]) ^ MULxB(bIn[1]) ^ MULxD(bIn[2]) ^ MULx9(bIn[3]);
|
||||
pBytes[1] = MULx9(bIn[0]) ^ MULxE(bIn[1]) ^ MULxB(bIn[2]) ^ MULxD(bIn[3]);
|
||||
pBytes[2] = MULxD(bIn[0]) ^ MULx9(bIn[1]) ^ MULxE(bIn[2]) ^ MULxB(bIn[3]);
|
||||
pBytes[3] = MULxB(bIn[0]) ^ MULxD(bIn[1]) ^ MULx9(bIn[2]) ^ MULxE(bIn[3]);
|
||||
pBytes[4] = MULxE(bIn[4]) ^ MULxB(bIn[5]) ^ MULxD(bIn[6]) ^ MULx9(bIn[7]);
|
||||
pBytes[5] = MULx9(bIn[4]) ^ MULxE(bIn[5]) ^ MULxB(bIn[6]) ^ MULxD(bIn[7]);
|
||||
pBytes[6] = MULxD(bIn[4]) ^ MULx9(bIn[5]) ^ MULxE(bIn[6]) ^ MULxB(bIn[7]);
|
||||
pBytes[7] = MULxB(bIn[4]) ^ MULxD(bIn[5]) ^ MULx9(bIn[6]) ^ MULxE(bIn[7]);
|
||||
pBytes[8] = MULxE(bIn[8]) ^ MULxB(bIn[9]) ^ MULxD(bIn[10]) ^ MULx9(bIn[11]);
|
||||
pBytes[9] = MULx9(bIn[8]) ^ MULxE(bIn[9]) ^ MULxB(bIn[10]) ^ MULxD(bIn[11]);
|
||||
pBytes[10] = MULxD(bIn[8]) ^ MULx9(bIn[9]) ^ MULxE(bIn[10]) ^ MULxB(bIn[11]);
|
||||
pBytes[11] = MULxB(bIn[8]) ^ MULxD(bIn[9]) ^ MULx9(bIn[10]) ^ MULxE(bIn[11]);
|
||||
pBytes[12] = MULxE(bIn[12]) ^ MULxB(bIn[13]) ^ MULxD(bIn[14]) ^ MULx9(bIn[15]);
|
||||
pBytes[13] = MULx9(bIn[12]) ^ MULxE(bIn[13]) ^ MULxB(bIn[14]) ^ MULxD(bIn[15]);
|
||||
pBytes[14] = MULxD(bIn[12]) ^ MULx9(bIn[13]) ^ MULxE(bIn[14]) ^ MULxB(bIn[15]);
|
||||
pBytes[15] = MULxB(bIn[12]) ^ MULxD(bIn[13]) ^ MULx9(bIn[14]) ^ MULxE(bIn[15]);
|
||||
};
|
||||
|
||||
// Key Expansion
|
||||
void KeyExpansion(void)
|
||||
{
|
||||
DWORD i,Temp;
|
||||
|
||||
for(i=0 ; i<Nk ; i++){
|
||||
(*(((PBYTE)pSubKeys)+4*i))=pKey[4*i];
|
||||
(*(((PBYTE)pSubKeys)+4*i+1))=pKey[4*i+1];
|
||||
(*(((PBYTE)pSubKeys)+4*i+2))=pKey[4*i+2];
|
||||
(*(((PBYTE)pSubKeys)+4*i+3))=pKey[4*i+3];
|
||||
};
|
||||
|
||||
for(i=Nk ; i<(Nb*(Nr+1)) ; i++){
|
||||
Temp=pSubKeys[i-1];
|
||||
|
||||
if (((i/Nk)*Nk) == i){
|
||||
Temp=((SubWord(RotWord(Temp)))^Rcon[i/Nk]);
|
||||
}else{
|
||||
if ((Nk>6)&&((i-Nk*(i/Nk)) == 4))
|
||||
Temp=SubWord(Temp);
|
||||
};
|
||||
|
||||
pSubKeys[i]=((pSubKeys[i-Nk])^Temp);
|
||||
};
|
||||
};
|
||||
|
||||
// Do Cipher
|
||||
void DoCipher(PBYTE pIn, PBYTE pOut)
|
||||
{
|
||||
BYTE State[16];
|
||||
DWORD Round;
|
||||
DWORD i;
|
||||
|
||||
for(i=0 ; i<16 ; i++)
|
||||
State[i]=pIn[i];
|
||||
|
||||
AddRoundKey(State,0);
|
||||
|
||||
for(Round=1 ; Round<Nr ; Round++){
|
||||
SubBytes(State);
|
||||
ShiftRows(State);
|
||||
MixColumns(State);
|
||||
|
||||
// KMS V6
|
||||
if(Round == 4){
|
||||
State[0] ^= 0x73;
|
||||
}else if(Round == 6){
|
||||
State[0] ^= 0x09;
|
||||
}else if(Round == 8){
|
||||
State[0] ^= 0xE4;
|
||||
}
|
||||
|
||||
AddRoundKey(State,Round);
|
||||
};
|
||||
|
||||
SubBytes(State);
|
||||
ShiftRows(State);
|
||||
AddRoundKey(State,Nr);
|
||||
|
||||
for(i=0 ; i<16 ; i++)
|
||||
pOut[i]=State[i];
|
||||
};
|
||||
|
||||
// Do Inverse Cipher
|
||||
void DoInvCipher(PBYTE pIn, PBYTE pOut)
|
||||
{
|
||||
BYTE State[16];
|
||||
DWORD Round;
|
||||
DWORD i;
|
||||
|
||||
for(i=0 ; i<16 ; i++)
|
||||
State[i]=pIn[i];
|
||||
|
||||
AddRoundKey(State,Nr);
|
||||
|
||||
for(Round=(Nr-1) ; Round>0 ; Round--){
|
||||
InvShiftRows(State);
|
||||
InvSubBytes(State);
|
||||
AddRoundKey(State,Round);
|
||||
|
||||
// KMS V6
|
||||
if(Round == 4){
|
||||
State[0] ^= 0x73;
|
||||
}else if(Round == 6){
|
||||
State[0] ^= 0x09;
|
||||
}else if(Round == 8){
|
||||
State[0] ^= 0xE4;
|
||||
}
|
||||
|
||||
InvMixColumns(State);
|
||||
};
|
||||
|
||||
InvShiftRows(State);
|
||||
InvSubBytes(State);
|
||||
AddRoundKey(State,0);
|
||||
|
||||
for(i=0 ; i<16 ; i++)
|
||||
pOut[i]=State[i];
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Initialization and Cleanup
|
||||
|
||||
// AES Init
|
||||
DWORD AesInit(DWORD dwType, DWORD dwMode, BYTE bPadding, PBYTE pbKey, PBYTE pbIV)
|
||||
{
|
||||
DWORD i,N;
|
||||
|
||||
if ((dwType != AES_TYPE_128) && (dwType != AES_TYPE_192) && (dwType != AES_TYPE_256))
|
||||
return 1;
|
||||
if ((dwMode != AES_MODE_ECB) && (dwMode != AES_MODE_CBC) && (dwMode != AES_MODE_CFB) && (dwMode != AES_MODE_OFB) && (dwMode != AES_MODE_CTR))
|
||||
return 2;
|
||||
if (pbKey == NULL)
|
||||
return 3;
|
||||
if (pbIV == NULL)
|
||||
return 4;
|
||||
|
||||
if (pKey != NULL){
|
||||
for(i=0 ; i<32 ; i++)
|
||||
pKey[i]=0x00;
|
||||
delete(pKey);
|
||||
};
|
||||
|
||||
if (pIV != NULL){
|
||||
for(i=0 ; i<16 ; i++)
|
||||
pIV[i]=0x00;
|
||||
delete(pIV);
|
||||
};
|
||||
|
||||
Type=dwType;
|
||||
Mode=dwMode;
|
||||
Padding=bPadding;
|
||||
pKey = new BYTE[32];
|
||||
Nb=4;
|
||||
|
||||
switch(Type){
|
||||
case AES_TYPE_128:
|
||||
N=16;
|
||||
Nr=10;
|
||||
Nk=4;
|
||||
break;
|
||||
case AES_TYPE_192:
|
||||
N=24;
|
||||
Nr=12;
|
||||
Nk=6;
|
||||
break;
|
||||
default:
|
||||
N=32;
|
||||
Nr=14;
|
||||
Nk=8;
|
||||
};
|
||||
|
||||
for(i=0 ; i<N ; i++)
|
||||
pKey[i]=pbKey[i];
|
||||
|
||||
pIV = new BYTE[16];
|
||||
|
||||
for(i=0 ; i<16 ; i++)
|
||||
pIV[i]=pbIV[i];
|
||||
|
||||
pSubKeys = new DWORD[Nb*(Nr+1)];
|
||||
KeyExpansion();
|
||||
IsInit=true;
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
// AES Clear
|
||||
DWORD AesClear(void)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (!IsInit)
|
||||
return 5;
|
||||
|
||||
if (pSubKeys != NULL){
|
||||
for(i=0 ; i<(Nb*(Nr+1)) ; i++)
|
||||
pSubKeys[i]=0x00000000;
|
||||
delete(pSubKeys);
|
||||
};
|
||||
|
||||
pSubKeys=NULL;
|
||||
|
||||
if (pKey != NULL){
|
||||
for(i=0 ; i<32 ; i++)
|
||||
pKey[i]=0x00;
|
||||
delete(pKey);
|
||||
};
|
||||
|
||||
pKey=NULL;
|
||||
|
||||
if (pIV != NULL){
|
||||
for(i=0 ; i<16 ; i++)
|
||||
pIV[i]=0x00;
|
||||
delete(pIV);
|
||||
};
|
||||
|
||||
pIV=NULL;
|
||||
Type=AES_TYPE_128;
|
||||
Mode=AES_MODE_ECB;
|
||||
Padding=0x00;
|
||||
IsInit=false;
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Encryption
|
||||
|
||||
// Aes Encrypt Block
|
||||
DWORD AesEncryptBlock(PBYTE PlainText, DWORD PlainTextSize, PBYTE Cipher)
|
||||
{
|
||||
BYTE bIn[16];
|
||||
DWORD i,j;
|
||||
|
||||
if (PlainTextSize > 16)
|
||||
return 1;
|
||||
|
||||
for(i=0 ; i<PlainTextSize ; i++)
|
||||
bIn[i]=PlainText[i];
|
||||
|
||||
for(j=i ; j<16 ; j++)
|
||||
bIn[j]=Padding;
|
||||
|
||||
DoCipher(bIn,Cipher);
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
// AES Encrypt
|
||||
DWORD AesEncrypt(PBYTE PlainText, DWORD PlainTextSize, PBYTE Cipher, PDWORD CipherSize)
|
||||
{
|
||||
DWORD N,n;
|
||||
DWORD i,j;
|
||||
DWORD Error;
|
||||
DWORD DataLen;
|
||||
BYTE Temp[16];
|
||||
DataLen=0;
|
||||
N=PlainTextSize/16;
|
||||
n=PlainTextSize-16*N;
|
||||
(*CipherSize)=0;
|
||||
|
||||
if (PlainTextSize == 0)
|
||||
return 1;
|
||||
|
||||
switch(Mode){
|
||||
case AES_MODE_ECB:
|
||||
for(i=0 ; i<N ; i++){
|
||||
Error=AesEncryptBlock(PlainText+16*i,16,Cipher+16*i);
|
||||
|
||||
if (Error != 0)
|
||||
return Error;
|
||||
|
||||
DataLen+=16;
|
||||
};
|
||||
|
||||
if (n != 0){
|
||||
Error=AesEncryptBlock(PlainText+16*N,n,Cipher+16*N);
|
||||
|
||||
if (Error != 0)
|
||||
return Error;
|
||||
|
||||
DataLen+=16;
|
||||
};
|
||||
|
||||
(*CipherSize)=DataLen;
|
||||
|
||||
break;
|
||||
case AES_MODE_CBC:
|
||||
for(i=0 ; i<N ; i++){
|
||||
|
||||
for(j=0 ; j<16 ; j++){
|
||||
if (i == 0)
|
||||
Temp[j]=(pIV[j]^PlainText[j]);
|
||||
else
|
||||
Temp[j]=(Cipher[16*(i-1)+j]^PlainText[16*i+j]);
|
||||
};
|
||||
|
||||
Error=AesEncryptBlock(Temp,16,Cipher+16*i);
|
||||
|
||||
if (Error != 0)
|
||||
return Error;
|
||||
|
||||
DataLen+=16;
|
||||
};
|
||||
|
||||
if (n != 0){
|
||||
|
||||
for(j=0 ; j<n ; j++){
|
||||
if (N == 0)
|
||||
Temp[j]=(pIV[j]^PlainText[j]);
|
||||
else
|
||||
Temp[j]=(Cipher[16*(N-1)+j]^PlainText[16*N+j]);
|
||||
};
|
||||
|
||||
for(j=n ; j<16 ; j++){
|
||||
if (N == 0)
|
||||
Temp[j]=(pIV[j]^Padding);
|
||||
else
|
||||
Temp[j]=(Cipher[16*(N-1)+j]^Padding);
|
||||
};
|
||||
|
||||
Error=AesEncryptBlock(Temp,16,Cipher+16*N);
|
||||
|
||||
if (Error != 0)
|
||||
return Error;
|
||||
|
||||
DataLen+=16;
|
||||
};
|
||||
|
||||
(*CipherSize)=DataLen;
|
||||
|
||||
break;
|
||||
case AES_MODE_CFB:
|
||||
for(i=0 ; i<N ; i++){
|
||||
if (i == 0)
|
||||
Error=AesEncryptBlock(pIV,16,Temp);
|
||||
else
|
||||
Error=AesEncryptBlock(Cipher+16*(i-1),16,Temp);
|
||||
|
||||
if (Error != 0)
|
||||
return Error;
|
||||
|
||||
for(j=0 ; j<16 ; j++)
|
||||
Cipher[16*i+j]=Temp[j]^PlainText[16*i+j];
|
||||
|
||||
DataLen+=16;
|
||||
};
|
||||
|
||||
if (n != 0){
|
||||
if (i == 0)
|
||||
Error=AesEncryptBlock(pIV,16,Temp);
|
||||
else
|
||||
Error=AesEncryptBlock(Cipher+16*(i-1),16,Temp);
|
||||
|
||||
if (Error != 0)
|
||||
return Error;
|
||||
|
||||
for(j=0 ; j<n ; j++)
|
||||
Cipher[16*i+j]=Temp[j]^PlainText[16*i+j];
|
||||
|
||||
for(j=n ; j<16 ; j++)
|
||||
Cipher[16*i+j]=Temp[j]^Padding;
|
||||
|
||||
DataLen+=16;
|
||||
};
|
||||
|
||||
(*CipherSize)=DataLen;
|
||||
|
||||
break;
|
||||
case AES_MODE_OFB:
|
||||
for(i=0 ; i<N ; i++){
|
||||
if (i == 0)
|
||||
Error=AesEncryptBlock(pIV,16,Temp);
|
||||
else
|
||||
Error=AesEncryptBlock(Temp,16,Temp);
|
||||
|
||||
if (Error != 0)
|
||||
return Error;
|
||||
|
||||
for(j=0 ; j<16 ; j++)
|
||||
Cipher[16*i+j]=Temp[j]^PlainText[16*i+j];
|
||||
|
||||
DataLen+=16;
|
||||
};
|
||||
|
||||
if (n != 0){
|
||||
if (i == 0)
|
||||
Error=AesEncryptBlock(pIV,16,Temp);
|
||||
else
|
||||
Error=AesEncryptBlock(Temp,16,Temp);
|
||||
|
||||
if (Error != 0)
|
||||
return Error;
|
||||
|
||||
for(j=0 ; j<n ; j++)
|
||||
Cipher[16*i+j]=Temp[j]^PlainText[16*i+j];
|
||||
|
||||
for(j=n ; j<16 ; j++)
|
||||
Cipher[16*i+j]=Temp[j]^Padding;
|
||||
|
||||
DataLen+=16;
|
||||
};
|
||||
|
||||
(*CipherSize)=DataLen;
|
||||
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
};
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
// Encrypt Message
|
||||
void EncryptMessage(int MessageSize, PBYTE Message)
|
||||
{
|
||||
PBYTE p;
|
||||
DWORD q;
|
||||
|
||||
p = new BYTE[MessageSize];
|
||||
memcpy(p, Message, MessageSize);
|
||||
|
||||
AesEncrypt(p, MessageSize, Message, &q);
|
||||
|
||||
delete[] p;
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Decryption
|
||||
|
||||
// Aes Decrypt Block
|
||||
DWORD AesDecryptBlock(PBYTE Cipher, PBYTE PlainText)
|
||||
{
|
||||
DoInvCipher(Cipher,PlainText);
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
// AES Decrypt
|
||||
DWORD AesDecrypt(PBYTE Cipher, DWORD CipherSize, PBYTE PlainText, PDWORD PlainTextSize)
|
||||
{
|
||||
DWORD N,n;
|
||||
DWORD i,j;
|
||||
DWORD Error;
|
||||
BYTE Temp[16];
|
||||
N=CipherSize/16;
|
||||
n=CipherSize-16*N;
|
||||
(*PlainTextSize)=0;
|
||||
|
||||
if (CipherSize == 0)
|
||||
return 1;
|
||||
if (n != 0)
|
||||
return 1;
|
||||
|
||||
switch(Mode){
|
||||
case AES_MODE_ECB:
|
||||
for(i=0 ; i<N ; i++){
|
||||
Error=AesDecryptBlock(Cipher+16*i,PlainText+16*i);
|
||||
|
||||
if (Error != 0)
|
||||
return Error;
|
||||
};
|
||||
|
||||
(*PlainTextSize)=CipherSize;
|
||||
|
||||
break;
|
||||
case AES_MODE_CBC:
|
||||
for(i=0 ; i<N ; i++){
|
||||
Error=AesDecryptBlock(Cipher+16*i,Temp);
|
||||
|
||||
if (Error != 0)
|
||||
return Error;
|
||||
|
||||
for(j=0 ; j<16 ; j++){
|
||||
if (i == 0)
|
||||
PlainText[16*i+j]=(pIV[j]^Temp[j]);
|
||||
else
|
||||
PlainText[16*i+j]=(Cipher[16*(i-1)+j]^Temp[j]);
|
||||
};
|
||||
};
|
||||
|
||||
(*PlainTextSize)=CipherSize;
|
||||
|
||||
break;
|
||||
case AES_MODE_CFB:
|
||||
for(i=0 ; i<N ; i++){
|
||||
if (i == 0)
|
||||
Error=AesEncryptBlock(pIV,16,Temp);
|
||||
else
|
||||
Error=AesEncryptBlock(Cipher+16*(i-1),16,Temp);
|
||||
|
||||
if (Error != 0)
|
||||
return Error;
|
||||
|
||||
for(j=0 ; j<16 ; j++)
|
||||
PlainText[16*i+j]=Temp[j]^Cipher[16*i+j];
|
||||
};
|
||||
|
||||
(*PlainTextSize)=CipherSize;
|
||||
|
||||
break;
|
||||
case AES_MODE_OFB:
|
||||
for(i=0 ; i<N ; i++){
|
||||
if (i == 0)
|
||||
Error=AesEncryptBlock(pIV,16,Temp);
|
||||
else
|
||||
Error=AesEncryptBlock(Temp,16,Temp);
|
||||
|
||||
if (Error != 0) return Error;
|
||||
|
||||
for(j=0 ; j<16 ; j++)
|
||||
PlainText[16*i+j]=Temp[j]^Cipher[16*i+j];
|
||||
};
|
||||
|
||||
(*PlainTextSize)=CipherSize;
|
||||
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
};
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
// Decrypt Message
|
||||
void DecryptMessage(int MessageSize, PBYTE Message)
|
||||
{
|
||||
PBYTE p;
|
||||
DWORD q;
|
||||
|
||||
p = new BYTE[MessageSize];
|
||||
memcpy(p, Message, MessageSize);
|
||||
|
||||
AesDecrypt(p, MessageSize, Message, &q);
|
||||
|
||||
delete[] p;
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
+220
@@ -0,0 +1,220 @@
|
||||
// Includes and Namespaces
|
||||
#include "CoreKMS.h"
|
||||
#include "Crypto.h"
|
||||
#include "Hash.h"
|
||||
|
||||
#pragma region Tables
|
||||
|
||||
// Precomputed Key Schedule
|
||||
static const BYTE AesKeyV4[] = {
|
||||
0x05, 0x3D, 0x83, 0x07, 0xF9, 0xE5, 0xF0, 0x88, 0xEB, 0x5E, 0xA6, 0x68, 0x6C, 0xF0, 0x37, 0xC7,
|
||||
0xE4, 0xEF, 0xD2, 0xD6, 0xDB, 0x88, 0x75, 0x6E, 0x22, 0x6D, 0x85, 0xE6, 0xC9, 0x33, 0x23, 0x8E,
|
||||
0xA5, 0xC3, 0x14, 0x49, 0x41, 0x2C, 0xC6, 0x9F, 0xA8, 0x3C, 0xAE, 0xED, 0x8A, 0x51, 0x2B, 0x0B,
|
||||
0x43, 0x62, 0x08, 0x85, 0xE6, 0xA1, 0x1C, 0xCC, 0xA7, 0x8D, 0xDA, 0x53, 0xF1, 0x6B, 0x43, 0xB1,
|
||||
0x7B, 0x3A, 0x68, 0xBA, 0x38, 0x58, 0x60, 0x3F, 0xDE, 0xF9, 0x7C, 0xF3, 0x79, 0x74, 0xA6, 0xA0,
|
||||
0x6B, 0x4F, 0xA3, 0x07, 0x10, 0x75, 0xCB, 0xBD, 0x28, 0x2D, 0xAB, 0x82, 0xF6, 0xD4, 0xD7, 0x71,
|
||||
0x8F, 0xA0, 0x71, 0xD1, 0x9B, 0xEC, 0x9D, 0x74, 0x8B, 0x99, 0x56, 0xC9, 0xA3, 0xB4, 0xFD, 0x4B,
|
||||
0x55, 0x60, 0x2A, 0x3A, 0xDA, 0xC0, 0x5B, 0xEB, 0x01, 0xD5, 0x74, 0x23, 0x8A, 0x4C, 0x22, 0xEA,
|
||||
0x29, 0xF8, 0xDF, 0xA1, 0x7C, 0x98, 0xF5, 0x9B, 0xA6, 0x58, 0xAE, 0x70, 0x2B, 0x31, 0x25, 0x07,
|
||||
0xA1, 0x7D, 0x07, 0xED, 0x88, 0x85, 0xD8, 0x4C, 0xF4, 0x1D, 0x2D, 0xD7, 0x52, 0x45, 0x83, 0xA7,
|
||||
0xC5, 0xDD, 0x79, 0x07, 0x64, 0xA0, 0x7E, 0xEA, 0xEC, 0x25, 0xA6, 0xA6, 0x18, 0x38, 0x8B, 0x71,
|
||||
0x4A, 0x7D, 0x08, 0xD6, 0x21, 0xED, 0x8F, 0xD1, 0x45, 0x4D, 0xF1, 0x3B, 0xA9, 0x68, 0x57, 0x9D
|
||||
};
|
||||
|
||||
// Rijndael SBox
|
||||
static const BYTE SubTable[256] =
|
||||
{
|
||||
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
|
||||
0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
|
||||
0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
|
||||
0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75,
|
||||
0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84,
|
||||
0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF,
|
||||
0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8,
|
||||
0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2,
|
||||
0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73,
|
||||
0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB,
|
||||
0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79,
|
||||
0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08,
|
||||
0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A,
|
||||
0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E,
|
||||
0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
|
||||
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Structs
|
||||
|
||||
HMAC_KEYBLOB Hmac_keyblob = {
|
||||
// Type, Version, Algorithm
|
||||
{PLAINTEXTKEYBLOB, CUR_BLOB_VERSION, NULL, CALG_RC2},
|
||||
// Key length
|
||||
16,
|
||||
// Key
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Helpers
|
||||
|
||||
// Rijndael AddRoundKey
|
||||
void HashAddRoundKey(PBYTE const hash, DWORD round)
|
||||
{
|
||||
for (DWORD i = 0; i < 16; i++)
|
||||
hash[i] ^= AesKeyV4[(round << 4) + i];
|
||||
}
|
||||
|
||||
// Xor Buffer
|
||||
void HashXorBuffer(PBYTE const source, PBYTE const destination, DWORD size)
|
||||
{
|
||||
for (DWORD i = 0; i < size; i++)
|
||||
destination[i] ^= source[i];
|
||||
}
|
||||
|
||||
// Rijndael SBox
|
||||
void HashSubBytes(PBYTE const pBytes)
|
||||
{
|
||||
for(DWORD i = 0; i < 16; i++)
|
||||
pBytes[i] = SubTable[pBytes[i]];
|
||||
}
|
||||
|
||||
// Rijndael ShiftRows
|
||||
void HashShiftRows(PBYTE const pBytes)
|
||||
{
|
||||
BYTE bIn[16];
|
||||
memcpy(bIn, pBytes, 16);
|
||||
|
||||
for (DWORD i = 0; i < 16; i++)
|
||||
pBytes[i] = bIn[(i + ((i & 3) << 2)) & 0xf];
|
||||
}
|
||||
|
||||
// Rijndael MixColumns
|
||||
void HashMixColumns(PBYTE const pBytes)
|
||||
{
|
||||
BYTE column[5];
|
||||
|
||||
for (DWORD i = 0; i < 16; i += 4)
|
||||
{
|
||||
*(PDWORD) column = *(PDWORD) &pBytes[i];
|
||||
column[4] = column[0] ^ column[1] ^ column[2] ^ column[3];
|
||||
|
||||
pBytes[i] = MULx2(column[0] ^ column[1]) ^ column[4];
|
||||
pBytes[i | 1] = MULx2(column[1] ^ column[2]) ^ column[4];
|
||||
pBytes[i | 2] = MULx2(column[2] ^ column[3]) ^ column[4];
|
||||
pBytes[i | 3] = MULx2(column[3] ^ column[0]) ^ column[4];
|
||||
|
||||
*(PDWORD) &pBytes[i] ^= *(PDWORD) column;
|
||||
}
|
||||
}
|
||||
|
||||
// Rijndael Block
|
||||
void Hash(PBYTE const hash)
|
||||
{
|
||||
HashAddRoundKey(hash, 0);
|
||||
|
||||
for (DWORD i = 1; i < 11; i++){
|
||||
HashSubBytes(hash);
|
||||
HashShiftRows(hash);
|
||||
HashMixColumns(hash);
|
||||
HashAddRoundKey(hash, i);
|
||||
}
|
||||
|
||||
HashSubBytes(hash);
|
||||
HashShiftRows(hash);
|
||||
HashAddRoundKey(hash, 11);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
// Get Hash
|
||||
void GetHash(DWORD MessageSize, PBYTE const Message, PBYTE const hash)
|
||||
{
|
||||
DWORD i, j, k;
|
||||
|
||||
// MessageSize / Blocksize
|
||||
j = MessageSize >> 4;
|
||||
|
||||
// Remainding Bytes
|
||||
k = MessageSize & 0xf;
|
||||
|
||||
// Hash
|
||||
for (i = 0; i < j; i++){
|
||||
HashXorBuffer(&Message[i << 4], hash, 16);
|
||||
Hash(hash);
|
||||
}
|
||||
|
||||
// Bit Padding
|
||||
hash[k] ^= 0x80;
|
||||
|
||||
HashXorBuffer(&Message[i << 4], hash, k);
|
||||
Hash(hash);
|
||||
}
|
||||
|
||||
// Generate SHA-256 Hash with Win32 Crypt API Provider
|
||||
void GetHashSHA256(DWORD dataSize, PBYTE const data, PBYTE const Hash)
|
||||
{
|
||||
HCRYPTPROV hProv = NULL;
|
||||
HCRYPTHASH hHash = NULL;
|
||||
DWORD HashSize = HASH_SIZE_SHA256;
|
||||
|
||||
if(!CryptAcquireContextW(&hProv, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
|
||||
return;
|
||||
|
||||
CryptCreateHash(hProv, CALG_SHA_256, NULL, NULL, &hHash);
|
||||
CryptHashData(hHash, data, dataSize, NULL);
|
||||
CryptGetHashParam(hHash, HP_HASHVAL, Hash, &HashSize, NULL);
|
||||
|
||||
if(hHash)
|
||||
CryptDestroyHash(hHash);
|
||||
|
||||
if(hProv)
|
||||
CryptReleaseContext(hProv, NULL);
|
||||
}
|
||||
|
||||
// Generate time based HMAC key
|
||||
void GetHmacKey(FILETIME* timestamp, PBYTE hmackey)
|
||||
{
|
||||
BYTE Sha256Hash[32];
|
||||
QWORD t, c1, c2, c3, seed;
|
||||
|
||||
t = *(PQWORD)timestamp;
|
||||
c1 = 0x00000022816889BD;
|
||||
c2 = 0x000000208CBAB5ED;
|
||||
c3 = 0x3156CD5AC628477A;
|
||||
seed = ((t / c1) * c2) + c3;
|
||||
|
||||
GetHashSHA256(8, (PBYTE)&seed, Sha256Hash);
|
||||
memcpy(hmackey, Sha256Hash+16, 16);
|
||||
}
|
||||
|
||||
// Generate HMAC-SHA-256
|
||||
void GetHmacSHA256(DWORD dwDataLen, PBYTE const pbData, PBYTE const pbHash)
|
||||
{
|
||||
HCRYPTPROV hProv = NULL;
|
||||
HCRYPTKEY hKey = NULL;
|
||||
HCRYPTHASH hHmacHash = NULL;
|
||||
HMAC_INFO HmacInfo = {0};
|
||||
DWORD dwHmacSize = 32;
|
||||
|
||||
HmacInfo.HashAlgid = CALG_SHA_256;
|
||||
|
||||
if(!CryptAcquireContextW(&hProv, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
|
||||
return;
|
||||
|
||||
CryptImportKey(hProv, (PBYTE)&Hmac_keyblob, sizeof(HMAC_KEYBLOB), NULL, NULL, &hKey);
|
||||
CryptCreateHash(hProv, CALG_HMAC, hKey, NULL, &hHmacHash);
|
||||
CryptSetHashParam(hHmacHash, HP_HMAC_INFO, (PBYTE)&HmacInfo, NULL);
|
||||
CryptHashData(hHmacHash, pbData, dwDataLen, NULL);
|
||||
CryptGetHashParam(hHmacHash, HP_HASHVAL, pbHash, &dwHmacSize, NULL);
|
||||
|
||||
if(hKey)
|
||||
CryptDestroyKey(hKey);
|
||||
|
||||
if(hHmacHash)
|
||||
CryptDestroyHash(hHmacHash);
|
||||
|
||||
if(hProv)
|
||||
CryptReleaseContext(hProv, NULL);
|
||||
}
|
||||
@@ -0,0 +1,834 @@
|
||||
// Includes and Namespaces
|
||||
#include <regex>
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include "Crypto.h"
|
||||
#include "Hash.h"
|
||||
#include "KMSServer.h"
|
||||
#include "KMSClientLogic.h"
|
||||
#include "KMSClientSettings.h"
|
||||
using namespace std;
|
||||
|
||||
// Link Libraries
|
||||
#pragma comment(lib, "rpcrt4.lib")
|
||||
|
||||
// Hold KMS Client Settings
|
||||
KMSClientSettings ClientSettings;
|
||||
|
||||
// Windows Service Parameters for Service Application
|
||||
SERVICE_STATUS ClientServiceStatus;
|
||||
SERVICE_STATUS_HANDLE ClientServiceHandle;
|
||||
|
||||
#pragma region Application Initialization Functions
|
||||
// Load Application Parameters from Command-Line
|
||||
void LoadClientParameters(int argc, wchar_t *argv[], bool RunAsService)
|
||||
{
|
||||
// Initialize KMS Client Settings Object
|
||||
ClientSettings.Initialize();
|
||||
ClientSettings.RunAsService = RunAsService;
|
||||
|
||||
#pragma region Command-Line
|
||||
// Handle Command-Line Arguments (KMS Port or Help)
|
||||
if (argc >= 2)
|
||||
{
|
||||
if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"/?", -1) == CSTR_EQUAL)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf("[KMS Port] [KMS Host] [Client Mode]\n\n");
|
||||
|
||||
printf("KMS Port:\n");
|
||||
printf("\tDefaultPort:\t\tUse the built-in KMS Port.\n");
|
||||
printf("\tInteger:\t\tNumber from 1 to 65535.\n\n");
|
||||
|
||||
printf("KMS Host:\n");
|
||||
printf("\tDefaultHost:\t\tUse the built-in KMS Host Address.\n");
|
||||
printf("\tString:\t\t\tA DNS Name or IP Address.\n\n");
|
||||
|
||||
printf("Client Mode:\n");
|
||||
printf("\tWindows:\t\tWindows Vista Enterprise KMS (V4) Client.\n");
|
||||
printf("\tWindowsVista:\t\tWindows Vista Enterprise KMS (V4) Client.\n");
|
||||
printf("\tWindows7:\t\tWindows 7 Enterprise KMS (V4) Client.\n");
|
||||
printf("\tWindows8:\t\tWindows 8 Enterprise KMS (V5) Client.\n");
|
||||
printf("\tWindows81:\t\tWindows 8 Enterprise KMS (V6) Client.\n");
|
||||
printf("\tOffice2010:\t\tOffice 2010 Pro Plus KMS (V4) Client.\n");
|
||||
printf("\tOffice2013:\t\tOffice 2013 Pro Plus KMS (V4) Client.\n");
|
||||
printf("\tOffice2013V4:\t\tOffice 2013 Pro Plus KMS (V4) Client.\n");
|
||||
printf("\tOffice2013V5:\t\tOffice 2013 Pro Plus KMS (V5) Client.\n\n");
|
||||
printf("\tOffice2013V6:\t\tOffice 2013 Pro Plus KMS (V6) Client.\n\n");
|
||||
|
||||
printf("Example:\n");
|
||||
printf("\tC:\\>\"KMS Client.exe\" 1688 127.0.0.2 Windows");
|
||||
ClientWriteLogErrorTerminate(L"\n", -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClientValidateKMSPort(argv[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Command-Line Arguments (KMS Host)
|
||||
if (argc >= 3)
|
||||
{
|
||||
ClientValidateKMSHost(argv[2]);
|
||||
}
|
||||
|
||||
// Handle Command-Line Arguments (Client Mode)
|
||||
if (argc >= 4)
|
||||
{
|
||||
ClientValidateKMSClientMode(argv[3]);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
}
|
||||
|
||||
// Start RPC Connection and try to contact a KMS Server.
|
||||
void StartKMSClient()
|
||||
{
|
||||
// RPC Parameters
|
||||
RPC_STATUS status;
|
||||
RPC_WSTR pszUuid = NULL;
|
||||
RPC_WSTR pszProtocolSequence = (RPC_WSTR)L"ncacn_ip_tcp";
|
||||
RPC_WSTR pszNetworkAddress = (RPC_WSTR)ClientSettings.KMSHost;
|
||||
RPC_WSTR pszEndpoint = (RPC_WSTR)ClientSettings.KMSPort;
|
||||
RPC_WSTR pszOptions = NULL;
|
||||
RPC_WSTR pszStringBinding = NULL;
|
||||
|
||||
// Create String Binding
|
||||
status = RpcStringBindingCompose
|
||||
(
|
||||
pszUuid,
|
||||
pszProtocolSequence,
|
||||
pszNetworkAddress,
|
||||
pszEndpoint,
|
||||
pszOptions,
|
||||
&pszStringBinding
|
||||
);
|
||||
|
||||
if (status)
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"RpcStringBindingCompose failed with code %i.\n", status);
|
||||
ClientWriteLogErrorTerminate(Message, status);
|
||||
}
|
||||
|
||||
// Get RPC Binding Handle from String Binding
|
||||
status = RpcBindingFromStringBinding(pszStringBinding, &KMSServer_v1_0_c_ifspec);
|
||||
|
||||
if (status)
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"RpcBindingFromStringBinding failed with code %i.\n", status);
|
||||
ClientWriteLogErrorTerminate(Message, status);
|
||||
}
|
||||
|
||||
ClientWriteLogInformation(L"\nKMS Client Emulator started successfully.\n");
|
||||
|
||||
// Send Requests
|
||||
int RequestsNeeded = ClientSettings.RequiredClientCount;
|
||||
for (int requests = 0; requests < RequestsNeeded; requests++)
|
||||
{
|
||||
// Define the size of the request
|
||||
int sizeRequest = 0;
|
||||
if (ClientSettings.KMSProtocolMajorVersion == 4)
|
||||
{
|
||||
sizeRequest = sizeof(REQUEST_V4);
|
||||
}
|
||||
else if (ClientSettings.KMSProtocolMajorVersion == 5)
|
||||
{
|
||||
sizeRequest = sizeof(REQUEST_V5);
|
||||
}
|
||||
else
|
||||
{
|
||||
sizeRequest = sizeof(REQUEST_V6);
|
||||
}
|
||||
|
||||
// Create KMS Client Request
|
||||
PBYTE request = (PBYTE)midl_user_allocate(sizeRequest);
|
||||
memcpy(request, (PBYTE)CreateRequest(), sizeRequest);
|
||||
|
||||
// Send KMS Client Request to KMS Server
|
||||
status = SendRequest(request, requests, &RequestsNeeded);
|
||||
if (status)
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Activation request (KMS V%i.%i) %i of %i failed.\n", ClientSettings.KMSProtocolMajorVersion, ClientSettings.KMSProtocolMinorVersion, requests + 1, RequestsNeeded);
|
||||
ClientWriteLogErrorTerminate(Message, status);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Activation request (KMS V%i.%i) %i of %i sent.\n", ClientSettings.KMSProtocolMajorVersion, ClientSettings.KMSProtocolMinorVersion, requests + 1, RequestsNeeded);
|
||||
ClientWriteLogInformation(Message);
|
||||
}
|
||||
}
|
||||
|
||||
// Free String Binding
|
||||
status = RpcStringFree(&pszStringBinding);
|
||||
|
||||
if (status)
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"RpcStringFree failed with code %i.\n", status);
|
||||
ClientWriteLogErrorTerminate(Message, status);
|
||||
}
|
||||
|
||||
// Free RPC Binding
|
||||
status = RpcBindingFree(&KMSServer_v1_0_c_ifspec);
|
||||
|
||||
if (status)
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"RpcBindingFree failed with code %i.\n", status);
|
||||
ClientWriteLogErrorTerminate(Message, status);
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region KMS Client Request Generation Functions
|
||||
// Create KMS Client Request Data Based on KMS Client Protocol Version.
|
||||
PBYTE CreateRequest()
|
||||
{
|
||||
// KMS Protocol Major Version
|
||||
if (ClientSettings.KMSProtocolMajorVersion == 4)
|
||||
{
|
||||
return CreateRequestV4();
|
||||
}
|
||||
else if (ClientSettings.KMSProtocolMajorVersion == 5)
|
||||
{
|
||||
return CreateRequestV5();
|
||||
}
|
||||
else
|
||||
{
|
||||
return CreateRequestV6();
|
||||
}
|
||||
}
|
||||
|
||||
// Create Base KMS Client Request Object.
|
||||
void CreateRequestBase(REQUEST* const Request)
|
||||
{
|
||||
// KMS Protocol Version
|
||||
Request->MajorVer = ClientSettings.KMSProtocolMajorVersion;
|
||||
Request->MinorVer = ClientSettings.KMSProtocolMinorVersion;
|
||||
|
||||
// KMS Client is NOT a VM
|
||||
Request->IsClientVM = 0;
|
||||
|
||||
// License Status
|
||||
Request->LicenseStatus = ClientSettings.KMSClientLicenseStatus;
|
||||
|
||||
// Grace Time
|
||||
Request->GraceTime = 43200;
|
||||
|
||||
// Application ID
|
||||
UuidFromStringW((RPC_WSTR)ClientSettings.KMSClientAppID, &Request->ApplicationId);
|
||||
|
||||
// SKU ID
|
||||
UuidFromStringW((RPC_WSTR)ClientSettings.KMSClientSkuID, &Request->SkuId);
|
||||
|
||||
// KMS Counted ID
|
||||
UuidFromStringW((RPC_WSTR)ClientSettings.KMSClientKMSCountedID, &Request->KmsCountedId);
|
||||
|
||||
// CMID
|
||||
CoCreateGuid(&Request->ClientMachineId);
|
||||
|
||||
// Minimum Clients
|
||||
Request->RequiredClientCount = ClientSettings.RequiredClientCount;
|
||||
|
||||
// Timestamp
|
||||
GetSystemTimeAsFileTime(&Request->RequestTime);
|
||||
|
||||
// Machine Name
|
||||
static const char alphanum[] = "0123456789" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
// Seed Random Number Generator
|
||||
srand(GetTickCount());
|
||||
|
||||
// Generate Random Machine Name (Up to 63 Characters)
|
||||
int MachineNameLength = rand() % 63 + 1;
|
||||
for (int i = 0; i < MachineNameLength; i++)
|
||||
{
|
||||
Request->MachineName[i] = alphanum[rand() % (sizeof(alphanum) - 1)];
|
||||
}
|
||||
Request->MachineName[MachineNameLength] = 0;
|
||||
}
|
||||
|
||||
// Create Hashed KMS Client Request Data for KMS Protocol Version 4.
|
||||
PBYTE CreateRequestV4()
|
||||
{
|
||||
// Allocate KMS Client Request Buffer
|
||||
PBYTE request = (PBYTE)midl_user_allocate(sizeof(REQUEST_V4));
|
||||
|
||||
// Clean buffer memory
|
||||
memset(request, 0x00, sizeof(REQUEST_V4));
|
||||
|
||||
// Create KMS Client Request Base
|
||||
CreateRequestBase((REQUEST*)request);
|
||||
|
||||
// Create Hash
|
||||
GetHash(sizeof(REQUEST), request, request + sizeof(REQUEST));
|
||||
|
||||
// Return Request
|
||||
return request;
|
||||
}
|
||||
|
||||
// Create Encrypted KMS Client Request Data for KMS Protocol Version 5.
|
||||
PBYTE CreateRequestV5()
|
||||
{
|
||||
// Allocate KMS Client Request Buffer
|
||||
PBYTE request = (PBYTE)midl_user_allocate(sizeof(REQUEST_V5));
|
||||
|
||||
// Clean buffer memory
|
||||
memset(request, 0x00, sizeof(REQUEST_V5));
|
||||
|
||||
// Temporary Pointer for access to REQUEST_V5 structure
|
||||
REQUEST_V5 *requestptr = (REQUEST_V5 *)request;
|
||||
|
||||
// KMS Protocol Version
|
||||
requestptr->MajorVer = ClientSettings.KMSProtocolMajorVersion;
|
||||
requestptr->MinorVer = ClientSettings.KMSProtocolMinorVersion;
|
||||
|
||||
// Seed Random Number Generator
|
||||
srand(GetTickCount());
|
||||
|
||||
// Generate a Random Salt Key
|
||||
for(int i = 0; i < 16; i++)
|
||||
{
|
||||
requestptr->Salt[i] = rand() % 256;
|
||||
}
|
||||
|
||||
// Set KMS Client Request Base
|
||||
CreateRequestBase(&requestptr->RequestBase);
|
||||
|
||||
// Encrypted Size
|
||||
DWORD EncryptedSize = sizeof(requestptr->RequestBase);
|
||||
|
||||
// AES-128 Encrypt
|
||||
AESEncryptMessage(requestptr->Salt, (PBYTE)(&requestptr->RequestBase), &EncryptedSize, sizeof(requestptr->RequestBase) + sizeof(requestptr->Pad));
|
||||
|
||||
// Return Request
|
||||
return request;
|
||||
}
|
||||
|
||||
// Create Encrypted KMS Client Request Data for KMS Protocol Version 6.
|
||||
PBYTE CreateRequestV6()
|
||||
{
|
||||
// V6: AES key
|
||||
BYTE AES_V6_KEY[16] = {0xA9, 0x4A, 0x41, 0x95, 0xE2, 0x01, 0x43, 0x2D, 0x9B, 0xCB, 0x46, 0x04, 0x05, 0xD8, 0x4A, 0x21};
|
||||
|
||||
// Allocate KMS Client Request Buffer
|
||||
PBYTE request = (PBYTE)midl_user_allocate(sizeof(REQUEST_V6));
|
||||
|
||||
// Clean buffer memory
|
||||
memset(request, 0x00, sizeof(REQUEST_V6));
|
||||
|
||||
// Temporary Pointer for access to REQUEST_V6 structure
|
||||
REQUEST_V6 *requestptr = (REQUEST_V6 *)request;
|
||||
|
||||
// KMS Protocol Version
|
||||
requestptr->MajorVer = ClientSettings.KMSProtocolMajorVersion;
|
||||
requestptr->MinorVer = ClientSettings.KMSProtocolMinorVersion;
|
||||
|
||||
// Seed Random Number Generator
|
||||
srand(GetTickCount());
|
||||
|
||||
// Generate a Random Salt Key
|
||||
for(int i = 0; i < 16; i++)
|
||||
{
|
||||
requestptr->Salt[i] = rand() % 256;
|
||||
}
|
||||
|
||||
// Set KMS Client Request Base
|
||||
CreateRequestBase(&requestptr->RequestBase);
|
||||
|
||||
// Set Padding to 0x04
|
||||
memset(&requestptr->Pad, 0x04, sizeof(&requestptr->Pad));
|
||||
|
||||
// Encrypted Size
|
||||
DWORD EncryptedSize = sizeof(requestptr->RequestBase) + sizeof(requestptr->Pad);
|
||||
|
||||
AesInit(AES_TYPE_128, AES_MODE_CBC, 0x04, AES_V6_KEY, requestptr->Salt);
|
||||
EncryptMessage(EncryptedSize, (PBYTE)(&requestptr->RequestBase));
|
||||
AesClear();
|
||||
|
||||
// Return Request
|
||||
return request;
|
||||
}
|
||||
|
||||
// Read KMS Server Response V4 from Byte Array
|
||||
void ReadResponseV4(RESPONSE_V4& Response_v4, int responseSize, PBYTE response)
|
||||
{
|
||||
int copySize =
|
||||
sizeof(Response_v4.ResponseBase.Version) +
|
||||
sizeof(Response_v4.ResponseBase.KMSPIDLength) +
|
||||
(((RESPONSE_V4*)response)->ResponseBase.KMSPIDLength <= PID_BUFFER_SIZE << 1 ?
|
||||
((RESPONSE_V4*)response)->ResponseBase.KMSPIDLength :
|
||||
PID_BUFFER_SIZE << 1);
|
||||
|
||||
memcpy(&Response_v4, response, copySize);
|
||||
memcpy(&Response_v4.ResponseBase.ClientMachineId, response + copySize, responseSize - copySize);
|
||||
|
||||
// Ensure KMSPID is NULL Terminated
|
||||
Response_v4.ResponseBase.KMSPID[PID_BUFFER_SIZE - 1] = 0;
|
||||
}
|
||||
|
||||
// Read KMS Server Response V5 from Byte Array
|
||||
void ReadResponseV5(RESPONSE_V5& Response_v5, int responseSize, PBYTE response)
|
||||
{
|
||||
// Get Size of the First Part of the Response
|
||||
int copySize1 =
|
||||
sizeof(Response_v5.Version) +
|
||||
sizeof(Response_v5.RequestSalt);
|
||||
|
||||
// Decrypt KMS Server Response (Encrypted part starts after RequestSalt)
|
||||
responseSize -= copySize1;
|
||||
AESDecryptMessage(((RESPONSE_V5*)(response))->RequestSalt, response + copySize1, (DWORD*)&responseSize);
|
||||
|
||||
// Add Size of KMS Protocol Version, KMS PID Length and KMS PID (Variable Sized)
|
||||
copySize1 +=
|
||||
sizeof(Response_v5.ResponseBase.Version) +
|
||||
sizeof(Response_v5.ResponseBase.KMSPIDLength) +
|
||||
(((RESPONSE_V5*)response)->ResponseBase.KMSPIDLength <= PID_BUFFER_SIZE << 1 ?
|
||||
((RESPONSE_V5*)response)->ResponseBase.KMSPIDLength :
|
||||
PID_BUFFER_SIZE << 1);
|
||||
|
||||
// Copy Part 1 of Response up to KMS PID (Variable Sized)
|
||||
memcpy(&Response_v5, response, copySize1);
|
||||
|
||||
// Ensure KMSPID is NULL Terminated
|
||||
Response_v5.ResponseBase.KMSPID[PID_BUFFER_SIZE - 1] = 0;
|
||||
|
||||
// Get Size of the Second Part of the Response
|
||||
int copySize2 =
|
||||
sizeof(Response_v5.ResponseBase.ClientMachineId) +
|
||||
sizeof(Response_v5.ResponseBase.RequestTime) +
|
||||
sizeof(Response_v5.ResponseBase.KMSCurrentCount) +
|
||||
sizeof(Response_v5.ResponseBase.VLActivationInterval) +
|
||||
sizeof(Response_v5.ResponseBase.VLRenewalInterval) +
|
||||
sizeof(Response_v5.Salt) +
|
||||
sizeof(Response_v5.Hash);
|
||||
|
||||
// Copy Part 2 of Response
|
||||
memcpy(&Response_v5.ResponseBase.ClientMachineId, response + copySize1, copySize2);
|
||||
}
|
||||
|
||||
// Read KMS Server Response V6 from Byte Array
|
||||
void ReadResponseV6(RESPONSE_V6& Response_v6, int responseSize, PBYTE response)
|
||||
{
|
||||
// V6: AES key
|
||||
BYTE AES_V6_KEY[16] = {0xA9, 0x4A, 0x41, 0x95, 0xE2, 0x01, 0x43, 0x2D, 0x9B, 0xCB, 0x46, 0x04, 0x05, 0xD8, 0x4A, 0x21};
|
||||
|
||||
// Get Size of the First Part of the Response
|
||||
int copySize =
|
||||
sizeof(Response_v6.Version) +
|
||||
sizeof(Response_v6.RequestSalt);
|
||||
|
||||
// Read the first part.
|
||||
memcpy(&Response_v6, response, copySize);
|
||||
response += copySize;
|
||||
responseSize -= copySize;
|
||||
|
||||
// Decrypt the response.
|
||||
AesInit(AES_TYPE_128, AES_MODE_CBC, 0x04, AES_V6_KEY, Response_v6.RequestSalt);
|
||||
DecryptMessage(responseSize, response);
|
||||
AesClear();
|
||||
|
||||
// Read version.
|
||||
copySize = sizeof(Response_v6.ResponseBase.Version);
|
||||
memcpy(&Response_v6.ResponseBase.Version, response, copySize);
|
||||
response += copySize;
|
||||
responseSize -= copySize;
|
||||
|
||||
// Read KMS PID length.
|
||||
copySize = sizeof(Response_v6.ResponseBase.KMSPIDLength);
|
||||
memcpy(&Response_v6.ResponseBase.KMSPIDLength, response, copySize);
|
||||
response += copySize;
|
||||
responseSize -= copySize;
|
||||
|
||||
// Read KMS PID.
|
||||
copySize = Response_v6.ResponseBase.KMSPIDLength <= PID_BUFFER_SIZE << 1 ? Response_v6.ResponseBase.KMSPIDLength : PID_BUFFER_SIZE << 1;
|
||||
memcpy(&Response_v6.ResponseBase.KMSPID, response, copySize);
|
||||
response += copySize;
|
||||
responseSize -= copySize;
|
||||
|
||||
// Ensure KMSPID is NULL Terminated
|
||||
Response_v6.ResponseBase.KMSPID[PID_BUFFER_SIZE - 1] = 0;
|
||||
|
||||
// Read the rest into the structure.
|
||||
memcpy(&Response_v6.ResponseBase.ClientMachineId, response, responseSize);
|
||||
}
|
||||
|
||||
// Function to Send Request to KMS Server
|
||||
// Used to allow use of RpcTryExcept
|
||||
int SendRequest(PBYTE request, const int requestsSent, int* const requestsNeeded)
|
||||
{
|
||||
RpcTryExcept
|
||||
{
|
||||
// Allocate Memory for Response
|
||||
int responseSize = MAX_RESPONSE_SIZE;
|
||||
PBYTE resp = (PBYTE)midl_user_allocate(MAX_RESPONSE_SIZE);
|
||||
|
||||
if (ClientSettings.KMSProtocolMajorVersion == 4)
|
||||
{
|
||||
// Call KMS Server via RPC for V4
|
||||
ActivationRequest(KMSServer_v1_0_c_ifspec, sizeof(REQUEST_V4), request, &responseSize, &resp);
|
||||
}
|
||||
else if (ClientSettings.KMSProtocolMajorVersion == 5)
|
||||
{
|
||||
// Call KMS Server via RPC for V5
|
||||
ActivationRequest(KMSServer_v1_0_c_ifspec, sizeof(REQUEST_V5), request, &responseSize, &resp);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Call KMS Server via RPC for V6
|
||||
ActivationRequest(KMSServer_v1_0_c_ifspec, sizeof(REQUEST_V6), request, &responseSize, &resp);
|
||||
}
|
||||
|
||||
// Verify Response Was Received
|
||||
if (resp == NULL)
|
||||
{
|
||||
ClientWriteLogErrorTerminate(L"Failed to get Activation response.\n", -1);
|
||||
}
|
||||
|
||||
// Determine how many more requests are needed.
|
||||
if (requestsSent < 1)
|
||||
{
|
||||
// Place to Store Base Response Data
|
||||
RESPONSE response;
|
||||
|
||||
// KMSPID from Response
|
||||
WCHAR* KMSPID = L"";
|
||||
|
||||
// KMSHWID from Response
|
||||
WCHAR KMSHWID[256];
|
||||
|
||||
// ActivatedMachines from Response
|
||||
DWORD ActivatedMachines;
|
||||
|
||||
if (ClientSettings.KMSProtocolMajorVersion == 4)
|
||||
{
|
||||
// Get KMS Server Response Object
|
||||
RESPONSE_V4 response_v4;
|
||||
ReadResponseV4(response_v4, responseSize, resp);
|
||||
|
||||
// Get Base KMS Server Response Object
|
||||
response = response_v4.ResponseBase;
|
||||
|
||||
// Read KMSPID from Response
|
||||
KMSPID = response.KMSPID;
|
||||
|
||||
// Read ActivatedMachines from Response
|
||||
ActivatedMachines = response.KMSCurrentCount;
|
||||
}
|
||||
else if (ClientSettings.KMSProtocolMajorVersion == 5)
|
||||
{
|
||||
// Get KMS Server Response Object
|
||||
RESPONSE_V5 response_v5;
|
||||
ReadResponseV5(response_v5, responseSize, resp);
|
||||
|
||||
// Get Base KMS Server Response Object
|
||||
response = response_v5.ResponseBase;
|
||||
|
||||
// Read KMSPID from Response
|
||||
KMSPID = response.KMSPID;
|
||||
|
||||
// Read ActivatedMachines from Response
|
||||
ActivatedMachines = response.KMSCurrentCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get KMS Server Response Object
|
||||
RESPONSE_V6 response_v6;
|
||||
ReadResponseV6(response_v6, responseSize, resp);
|
||||
|
||||
// Get Base KMS Server Response Object
|
||||
response = response_v6.ResponseBase;
|
||||
|
||||
// Read KMSPID from Response
|
||||
KMSPID = response.KMSPID;
|
||||
|
||||
// Read KMSHWID from Response
|
||||
swprintf_s(KMSHWID, 256, L"%02X%02X%02X%02X%02X%02X%02X%02X", response_v6.MachineHardwareHash[7], response_v6.MachineHardwareHash[6], response_v6.MachineHardwareHash[5], response_v6.MachineHardwareHash[4], response_v6.MachineHardwareHash[3], response_v6.MachineHardwareHash[2], response_v6.MachineHardwareHash[1], response_v6.MachineHardwareHash[0]);
|
||||
|
||||
// Read ActivatedMachines from Response
|
||||
ActivatedMachines = response.KMSCurrentCount;
|
||||
}
|
||||
|
||||
ClientWriteLogInformation(L"Successfully received response from KMS Server.\n");
|
||||
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"KMS Server PID: %s.\n", KMSPID);
|
||||
ClientWriteLogInformation(Message);
|
||||
if (ClientSettings.KMSProtocolMajorVersion > 5)
|
||||
{
|
||||
swprintf_s(Message, 256, L"KMS Server HWID: %s.\n", KMSHWID);
|
||||
ClientWriteLogInformation(Message);
|
||||
}
|
||||
|
||||
// Send no more requests if the client count was sufficient.
|
||||
if (ActivatedMachines >= ClientSettings.RequiredClientCount)
|
||||
{
|
||||
*requestsNeeded = 1;
|
||||
}
|
||||
// Send as many requests as needed.
|
||||
else
|
||||
{
|
||||
*requestsNeeded = (ClientSettings.RequiredClientCount - ActivatedMachines) + 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
RpcExcept(1)
|
||||
{
|
||||
// Get RPC Exception Code
|
||||
unsigned long ulCode = RpcExceptionCode();
|
||||
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Runtime reported exception 0x%lx = %ld\n", ulCode, ulCode);
|
||||
ClientWriteLogErrorTerminate(Message, ulCode);
|
||||
|
||||
// Return
|
||||
return false;
|
||||
}
|
||||
RpcEndExcept
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Parameter Validation Functions
|
||||
// Validate KMS Port Parameter
|
||||
void ClientValidateKMSPort(WCHAR* KMSPort)
|
||||
{
|
||||
// Check if the KMS Port is not the Default
|
||||
if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSPort, -1, L"DefaultPort", -1) != CSTR_EQUAL)
|
||||
{
|
||||
// Check if KMS Port is Valid Number
|
||||
if (regex_match(KMSPort, wregex(L"^([0-9]+)$")))
|
||||
{
|
||||
// Check if KMS Port is Valid Range
|
||||
if(_wtoi(KMSPort) < 1 || _wtoi(KMSPort) > 65535)
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Invalid KMS Port Range! %s is not a valid argument.\n", KMSPort);
|
||||
ClientWriteLogErrorTerminate(Message, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Apply Setting
|
||||
StringCchCopyW(ClientSettings.KMSPort, PORT_BUFFER_SIZE, KMSPort);
|
||||
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"KMS Port: %s \n", KMSPort);
|
||||
ClientWriteLogInformation(Message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Invalid KMS Port! %s is not a valid argument.\n", KMSPort);
|
||||
ClientWriteLogErrorTerminate(Message, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate KMS Host Parameter
|
||||
void ClientValidateKMSHost(WCHAR* KMSHost)
|
||||
{
|
||||
// Check if the KMS PID is not the Default
|
||||
if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSHost, -1, L"DefaultHost", -1) != CSTR_EQUAL)
|
||||
{
|
||||
// Apply Setting
|
||||
StringCchCopyW(ClientSettings.KMSHost, 256, KMSHost);
|
||||
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"KMS Host: %s \n", KMSHost);
|
||||
ClientWriteLogInformation(Message);
|
||||
}
|
||||
}
|
||||
|
||||
// Validate KMS Client Mode
|
||||
void ClientValidateKMSClientMode(WCHAR* KMSClientMode)
|
||||
{
|
||||
// Check if KMS Client Mode is Valid
|
||||
if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSClientMode, -1, L"Windows", -1) == CSTR_EQUAL || CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSClientMode, -1, L"WindowsVista", -1) == CSTR_EQUAL)
|
||||
{
|
||||
ClientSettings.RequiredClientCount = 25;
|
||||
ClientSettings.KMSProtocolMajorVersion = 4;
|
||||
StringCchCopyW(ClientSettings.KMSClientAppID, GUID_BUFFER_SIZE, L"55c92734-d682-4d71-983e-d6ec3f16059f");
|
||||
StringCchCopyW(ClientSettings.KMSClientSkuID, GUID_BUFFER_SIZE, L"cfd8ff08-c0d7-452b-9f60-ef5c70c32094");
|
||||
StringCchCopyW(ClientSettings.KMSClientKMSCountedID, GUID_BUFFER_SIZE, L"212a64dc-43b1-4d3d-a30c-2fc69d2095c6");
|
||||
}
|
||||
else if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSClientMode, -1, L"Windows7", -1) == CSTR_EQUAL)
|
||||
{
|
||||
ClientSettings.RequiredClientCount = 25;
|
||||
ClientSettings.KMSProtocolMajorVersion = 4;
|
||||
StringCchCopyW(ClientSettings.KMSClientAppID, GUID_BUFFER_SIZE, L"55c92734-d682-4d71-983e-d6ec3f16059f");
|
||||
StringCchCopyW(ClientSettings.KMSClientSkuID, GUID_BUFFER_SIZE, L"ae2ee509-1b34-41c0-acb7-6d4650168915");
|
||||
StringCchCopyW(ClientSettings.KMSClientKMSCountedID, GUID_BUFFER_SIZE, L"7fde5219-fbfa-484a-82c9-34d1ad53e856");
|
||||
}
|
||||
else if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSClientMode, -1, L"Windows8", -1) == CSTR_EQUAL)
|
||||
{
|
||||
ClientSettings.RequiredClientCount = 25;
|
||||
ClientSettings.KMSProtocolMajorVersion = 5;
|
||||
StringCchCopyW(ClientSettings.KMSClientAppID, GUID_BUFFER_SIZE, L"55c92734-d682-4d71-983e-d6ec3f16059f");
|
||||
StringCchCopyW(ClientSettings.KMSClientSkuID, GUID_BUFFER_SIZE, L"458e1bec-837a-45f6-b9d5-925ed5d299de");
|
||||
StringCchCopyW(ClientSettings.KMSClientKMSCountedID, GUID_BUFFER_SIZE, L"3c40b358-5948-45af-923b-53d21fcc7e79");
|
||||
}
|
||||
else if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSClientMode, -1, L"Windows81", -1) == CSTR_EQUAL)
|
||||
{
|
||||
ClientSettings.RequiredClientCount = 25;
|
||||
ClientSettings.KMSProtocolMajorVersion = 6;
|
||||
StringCchCopyW(ClientSettings.KMSClientAppID, GUID_BUFFER_SIZE, L"55c92734-d682-4d71-983e-d6ec3f16059f");
|
||||
StringCchCopyW(ClientSettings.KMSClientSkuID, GUID_BUFFER_SIZE, L"81671aaf-79d1-4eb1-b004-8cbbe173afea");
|
||||
StringCchCopyW(ClientSettings.KMSClientKMSCountedID, GUID_BUFFER_SIZE, L"cb8fc780-2c05-495a-9710-85afffc904d7");
|
||||
}
|
||||
else if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSClientMode, -1, L"Office2010", -1) == CSTR_EQUAL)
|
||||
{
|
||||
ClientSettings.RequiredClientCount = 5;
|
||||
ClientSettings.KMSProtocolMajorVersion = 4;
|
||||
StringCchCopyW(ClientSettings.KMSClientAppID, GUID_BUFFER_SIZE, L"59a52881-a989-479d-af46-f275c6370663");
|
||||
StringCchCopyW(ClientSettings.KMSClientSkuID, GUID_BUFFER_SIZE, L"6f327760-8c5c-417c-9b61-836a98287e0c");
|
||||
StringCchCopyW(ClientSettings.KMSClientKMSCountedID, GUID_BUFFER_SIZE, L"e85af946-2e25-47b7-83e1-bebcebeac611");
|
||||
}
|
||||
else if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSClientMode, -1, L"Office2013", -1) == CSTR_EQUAL ||
|
||||
CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSClientMode, -1, L"Office2013V4", -1) == CSTR_EQUAL)
|
||||
{
|
||||
ClientSettings.RequiredClientCount = 5;
|
||||
ClientSettings.KMSProtocolMajorVersion = 4;
|
||||
StringCchCopyW(ClientSettings.KMSClientAppID, GUID_BUFFER_SIZE, L"0ff1ce15-a989-479d-af46-f275c6370663");
|
||||
StringCchCopyW(ClientSettings.KMSClientSkuID, GUID_BUFFER_SIZE, L"b322da9c-a2e2-4058-9e4e-f59a6970bd69");
|
||||
StringCchCopyW(ClientSettings.KMSClientKMSCountedID, GUID_BUFFER_SIZE, L"e6a6f1bf-9d40-40c3-aa9f-c77ba21578c0");
|
||||
}
|
||||
else if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSClientMode, -1, L"Office2013V5", -1) == CSTR_EQUAL)
|
||||
{
|
||||
ClientSettings.RequiredClientCount = 5;
|
||||
ClientSettings.KMSProtocolMajorVersion = 5;
|
||||
StringCchCopyW(ClientSettings.KMSClientAppID, GUID_BUFFER_SIZE, L"0ff1ce15-a989-479d-af46-f275c6370663");
|
||||
StringCchCopyW(ClientSettings.KMSClientSkuID, GUID_BUFFER_SIZE, L"b322da9c-a2e2-4058-9e4e-f59a6970bd69");
|
||||
StringCchCopyW(ClientSettings.KMSClientKMSCountedID, GUID_BUFFER_SIZE, L"e6a6f1bf-9d40-40c3-aa9f-c77ba21578c0");
|
||||
}
|
||||
else if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSClientMode, -1, L"Office2013V6", -1) == CSTR_EQUAL)
|
||||
{
|
||||
ClientSettings.RequiredClientCount = 5;
|
||||
ClientSettings.KMSProtocolMajorVersion = 6;
|
||||
StringCchCopyW(ClientSettings.KMSClientAppID, GUID_BUFFER_SIZE, L"0ff1ce15-a989-479d-af46-f275c6370663");
|
||||
StringCchCopyW(ClientSettings.KMSClientSkuID, GUID_BUFFER_SIZE, L"b322da9c-a2e2-4058-9e4e-f59a6970bd69");
|
||||
StringCchCopyW(ClientSettings.KMSClientKMSCountedID, GUID_BUFFER_SIZE, L"e6a6f1bf-9d40-40c3-aa9f-c77ba21578c0");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Invalid KMS Client Type! %s is not a valid argument.\n", KMSClientMode);
|
||||
ClientWriteLogErrorTerminate(Message, -1);
|
||||
}
|
||||
|
||||
// Apply Setting
|
||||
StringCchCopyW(ClientSettings.KMSClientMode, 256, KMSClientMode);
|
||||
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"KMS Client Mode: %s \n", KMSClientMode);
|
||||
ClientWriteLogInformation(Message);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Logging Functions
|
||||
// Log an informational message to the Console or Windows Application Event Log.
|
||||
void ClientWriteLogInformation(WCHAR* const Message)
|
||||
{
|
||||
// Log Message Buffer
|
||||
WCHAR logMessage[256];
|
||||
|
||||
// Write Log Message to Buffer
|
||||
StringCbPrintfW(logMessage, 256, Message);
|
||||
|
||||
// Choose Log Source
|
||||
if (ClientSettings.RunAsService)
|
||||
{
|
||||
// Output to Windows Event Log: Qualifiers: 16384, EventId: 12290
|
||||
ClientWriteEventLogEntry(0x40003002, logMessage, EVENTLOG_INFORMATION_TYPE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Output to Console
|
||||
wprintf(L"%s", logMessage);
|
||||
}
|
||||
}
|
||||
|
||||
// Log an error message to the Console or Windows Application Event Log.
|
||||
void ClientWriteLogError(WCHAR* const Message)
|
||||
{
|
||||
// Log Message Buffer
|
||||
WCHAR logMessage[256];
|
||||
|
||||
// Write Log Message to Buffer
|
||||
StringCbPrintfW(logMessage, 256, Message);
|
||||
|
||||
// Choose Log Source
|
||||
if (ClientSettings.RunAsService)
|
||||
{
|
||||
// Output to Windows Event Log: Qualifiers: 16384, EventId: 902
|
||||
ClientWriteEventLogEntry(0x40000386, logMessage, EVENTLOG_ERROR_TYPE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Output to Console
|
||||
wprintf(L"%s", logMessage);
|
||||
}
|
||||
}
|
||||
|
||||
// Log an error message to the Console or Windows Application Event Log and terminate program.
|
||||
void ClientWriteLogErrorTerminate(WCHAR* const Message, int ExitCode)
|
||||
{
|
||||
// Call ClientWriteLogError
|
||||
ClientWriteLogError(Message);
|
||||
|
||||
if (!ClientSettings.RunAsService)
|
||||
{
|
||||
// Exit Program
|
||||
exit(ExitCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Exit Service
|
||||
ClientServiceStatus.dwCurrentState = SERVICE_STOPPED;
|
||||
ClientServiceStatus.dwWin32ExitCode = ExitCode;
|
||||
SetServiceStatus(ClientServiceHandle, &ClientServiceStatus);
|
||||
}
|
||||
}
|
||||
|
||||
// Log a message to the Windows Application Event Log.
|
||||
void ClientWriteEventLogEntry(DWORD dwIdentifier, WCHAR* const lpszMessage, WORD wType)
|
||||
{
|
||||
HANDLE hEventSource = OpenEventLogW(NULL, L"KmsRequests"); // Provider: KmsRequests or Microsoft-Windows-Security-SPP
|
||||
|
||||
if(hEventSource != NULL)
|
||||
{
|
||||
ReportEventW(
|
||||
hEventSource, // Event log handle
|
||||
wType, // Event type
|
||||
NULL, // Event category
|
||||
dwIdentifier, // Event identifier
|
||||
NULL, // No security identifier
|
||||
1, // Size of lpszStrings array
|
||||
NULL, // No binary data
|
||||
(LPCWSTR*)&lpszMessage, // Array of strings
|
||||
NULL // No binary data
|
||||
);
|
||||
|
||||
CloseEventLog(hEventSource);
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
@@ -0,0 +1,35 @@
|
||||
// Includes and Namespaces
|
||||
#include "KMSClientSettings.h"
|
||||
|
||||
// KMS Client Parameters
|
||||
WCHAR KMSClientSettings::KMSHost[256];
|
||||
WCHAR KMSClientSettings::KMSPort[PORT_BUFFER_SIZE];
|
||||
WCHAR KMSClientSettings::KMSClientMode[256];
|
||||
|
||||
// KMS Client Identification Data
|
||||
DWORD KMSClientSettings::RequiredClientCount;
|
||||
WORD KMSClientSettings::KMSProtocolMajorVersion;
|
||||
WORD KMSClientSettings::KMSProtocolMinorVersion;
|
||||
DWORD KMSClientSettings::KMSClientLicenseStatus;
|
||||
WCHAR KMSClientSettings::KMSClientAppID[GUID_BUFFER_SIZE];
|
||||
WCHAR KMSClientSettings::KMSClientSkuID[GUID_BUFFER_SIZE];
|
||||
WCHAR KMSClientSettings::KMSClientKMSCountedID[GUID_BUFFER_SIZE];
|
||||
|
||||
// KMS Client Program Control
|
||||
bool KMSClientSettings::RunAsService;
|
||||
|
||||
// Set Default Settings
|
||||
void KMSClientSettings::Initialize()
|
||||
{
|
||||
StringCchCopyW(KMSHost, 256, L"127.0.0.2");
|
||||
StringCchCopyW(KMSPort, PORT_BUFFER_SIZE, L"1688");
|
||||
StringCchCopyW(KMSClientMode, 256, L"Windows");
|
||||
RequiredClientCount = 25;
|
||||
KMSProtocolMajorVersion = 4;
|
||||
KMSProtocolMinorVersion = 0;
|
||||
KMSClientLicenseStatus = 2;
|
||||
StringCchCopyW(KMSClientAppID, GUID_BUFFER_SIZE, L"55c92734-d682-4d71-983e-d6ec3f16059f");
|
||||
StringCchCopyW(KMSClientSkuID, GUID_BUFFER_SIZE, L"cfd8ff08-c0d7-452b-9f60-ef5c70c32094");
|
||||
StringCchCopyW(KMSClientKMSCountedID, GUID_BUFFER_SIZE, L"212a64dc-43b1-4d3d-a30c-2fc69d2095c6");
|
||||
RunAsService = false;
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
// Includes and Namespaces
|
||||
#include "KMSHWID.h"
|
||||
using namespace std;
|
||||
|
||||
// Get Application Specific KMSHWID from the Registry (KMS Server Service Only)
|
||||
void GetKMSHWID(PQWORD KMSHWID, REQUEST* const Request)
|
||||
{
|
||||
// Open Registry Key
|
||||
HKEY hKey;
|
||||
DWORD bufferSize = 256;
|
||||
WCHAR buffer[256] = {0};
|
||||
|
||||
// Get ClientAppID as String
|
||||
WCHAR ClientAppID[GUID_BUFFER_SIZE];
|
||||
StringCchPrintfW(ClientAppID, GUID_BUFFER_SIZE, L"%08X-%04hX-%04hX-%02X%02X-%02X%02X%02X%02X%02X%02X", Request->ApplicationId.Data1, Request->ApplicationId.Data2, Request->ApplicationId.Data3, Request->ApplicationId.Data4[0], Request->ApplicationId.Data4[1], Request->ApplicationId.Data4[2], Request->ApplicationId.Data4[3], Request->ApplicationId.Data4[4], Request->ApplicationId.Data4[5], Request->ApplicationId.Data4[6], Request->ApplicationId.Data4[7]);
|
||||
|
||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Services\\KMSServerService\\Parameters\\KMSHWID"), NULL, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
// Get Registry Value
|
||||
if (RegQueryValueExW(hKey, ClientAppID, NULL, NULL, (LPBYTE)buffer, &bufferSize) == ERROR_SUCCESS)
|
||||
{
|
||||
if (regex_match(buffer, wregex(L"^[a-fA-F0-9]{16}$")))
|
||||
{
|
||||
// Close Registry Key
|
||||
RegCloseKey(hKey);
|
||||
|
||||
// Apply Setting
|
||||
*KMSHWID = wcstoull(buffer, NULL, 16);
|
||||
}
|
||||
}
|
||||
|
||||
// Close Registry Key
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Return NULL KMSHWID
|
||||
*KMSHWID = 0x0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
// Includes and Namespaces
|
||||
#include "KMSPID.h"
|
||||
|
||||
#pragma region Structs
|
||||
|
||||
// HostType and OSBuild
|
||||
static const struct KMSHostOS { WORD Type; WORD Build; } HostOS[] =
|
||||
{
|
||||
{ 55041, 7601 }, // Windows Server 2008 R2 SP1
|
||||
{ 5426, 9200 }, // Windows Server 2012
|
||||
{ 6401, 9600 }, // Windows Server 2012 R2
|
||||
};
|
||||
|
||||
// GroupID and PIDRange
|
||||
static const struct PKEYCONFIG { WORD GroupID; DWORD RangeMin; DWORD RangeMax; } pkeyconfig[] = {
|
||||
{ 206, 152000000, 152999999 }, // Windows Server 2012 KMS Host pkeyconfig, actual max is 191999999
|
||||
{ 206, 271000000, 271999999 }, // Windows Server 2012 R2 KMS Host pkeyconfig, actual max is 310999999
|
||||
{ 96, 199000000, 201999999 }, // Office2010 KMS Host pkeyconfig, actual max is 217999999
|
||||
{ 206, 234000000, 234999999 }, // Office2013 KMS Host pkeyconfig, actual max is 255999999
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Defines
|
||||
|
||||
// Defines
|
||||
static const GUID APP_ID_WINDOWS = {0x55C92734, 0xD682, 0x4D71, {0x98, 0x3E, 0xD6, 0xEC, 0x3F, 0x16, 0x05, 0x9F}};
|
||||
static const GUID APP_ID_OFFICE14 = {0x59A52881, 0xA989, 0x479D, {0xAF, 0x46, 0xF2, 0x75, 0xC6, 0x37, 0x06, 0x63}};
|
||||
static const GUID APP_ID_OFFICE15 = {0x0FF1CE15, 0xA989, 0x479D, {0xAF, 0x46, 0xF2, 0x75, 0xC6, 0x37, 0x06, 0x63}};
|
||||
|
||||
#define HOST_SERVER2008R2 0
|
||||
#define HOST_SERVER2012 1
|
||||
#define HOST_SERVER2012R2 2
|
||||
|
||||
#define PKEYCONFIG_SERVER2012_CSVLK 0
|
||||
#define PKEYCONFIG_SERVER2012R2_CSVLK 1
|
||||
#define PKEYCONFIG_OFFICE2010_CSVLK 2
|
||||
#define PKEYCONFIG_OFFICE2013_CSVLK 3
|
||||
|
||||
// Minimum possible activation date for each Microsoft products (in UTC seconds)
|
||||
#define MinDateServer2008R2 ((time_t)1297875600LL) // Available on February 16, 2011 through TechNet or MSDN
|
||||
#define MinDateServer2012 ((time_t)1346778000LL) // Available on September 4, 2012 through TechNet or MSDN
|
||||
#define MinDateOffice2013 ((time_t)1351098000LL) // Available on October 24, 2012 through TechNet or MSDN
|
||||
#define MinDateServer2012R2 ((time_t)1382029200LL) // Available on October 17, 2013 through TechNet or MSDN
|
||||
|
||||
// Macros
|
||||
#define countof( array ) ( sizeof( array )/sizeof( array[0] ) )
|
||||
|
||||
#pragma endregion
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Get GroupID and PIDRange for the specified AppID and KMS Protocol Version
|
||||
static const PKEYCONFIG *GetKMSHostPkeyConfig(REQUEST* const Request)
|
||||
{
|
||||
if (Request->ApplicationId == APP_ID_WINDOWS)
|
||||
return (Request->MajorVer == 6 ? &pkeyconfig[PKEYCONFIG_SERVER2012R2_CSVLK] : &pkeyconfig[PKEYCONFIG_SERVER2012_CSVLK]);
|
||||
|
||||
if (Request->ApplicationId == APP_ID_OFFICE15)
|
||||
return &pkeyconfig[PKEYCONFIG_OFFICE2013_CSVLK];
|
||||
|
||||
if (Request->ApplicationId == APP_ID_OFFICE14)
|
||||
return &pkeyconfig[PKEYCONFIG_OFFICE2010_CSVLK];
|
||||
|
||||
return &pkeyconfig[PKEYCONFIG_SERVER2012_CSVLK];
|
||||
}
|
||||
|
||||
// Calculate Minimum Possible Date of KMS Host
|
||||
static const time_t GetMinKMSHostBuildDate(int HostIndex, REQUEST* const Request)
|
||||
{
|
||||
// Request is KMS V6 or Server 2012 R2 Build # is used
|
||||
if (Request->MajorVer == 6 || HostIndex == HOST_SERVER2012R2)
|
||||
return MinDateServer2012R2;
|
||||
|
||||
// Request is Office 2013 (Both V4 and V5)
|
||||
if (Request->ApplicationId == APP_ID_OFFICE15)
|
||||
return MinDateOffice2013;
|
||||
|
||||
// Request is KMS V5 or Server 2012 Build # is used
|
||||
if (Request->MajorVer == 5 || HostIndex == HOST_SERVER2012)
|
||||
return MinDateServer2012;
|
||||
|
||||
// Otherwise, Request is KMS V4 (Office 2010/Vista/7) and Server 2008 R2 Build # is used
|
||||
return MinDateServer2008R2;
|
||||
}
|
||||
|
||||
// Random Number Generator
|
||||
BOOL GetRandomBytes(BYTE *RandomBuffer, DWORD RandomBufferLength)
|
||||
{
|
||||
BOOL success = FALSE;
|
||||
HCRYPTPROV hProv = NULL;
|
||||
|
||||
success = CryptAcquireContextW(&hProv, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT) &&
|
||||
CryptGenRandom(hProv, RandomBufferLength, RandomBuffer);
|
||||
|
||||
if (hProv)
|
||||
CryptReleaseContext(hProv, 0);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void CreateKMSPID(WCHAR* const KMSPID, REQUEST* const Request)
|
||||
{
|
||||
// Random Number Buffer
|
||||
DWORD RandomNumber[4];
|
||||
GetRandomBytes((BYTE *)RandomNumber, sizeof(RandomNumber));
|
||||
|
||||
// Choose KMS HostOS
|
||||
int HostIndex = RandomNumber[0] % countof(HostOS);
|
||||
const KMSHostOS *host = &HostOS[HostIndex];
|
||||
|
||||
// Set Product Specific Base pkeyconfig (use Windows if unknown product)
|
||||
const PKEYCONFIG *config = GetKMSHostPkeyConfig(Request);
|
||||
|
||||
// Generate Random ID
|
||||
int RandomID = config->RangeMin + RandomNumber[1] % (config->RangeMax - config->RangeMin);
|
||||
|
||||
// Generate Part 5: License Channel (00=Retail, 01=Retail, 02=OEM, 03=Volume(GVLK,MAK)) - always 03
|
||||
DWORD LicenseChannel = 3;
|
||||
|
||||
// Generate Part 6: Language - use system default language
|
||||
DWORD LanguageCode = GetSystemDefaultLCID();
|
||||
|
||||
// Get Product Specific Minimum Activation Date
|
||||
time_t MinDate = GetMinKMSHostBuildDate(HostIndex, Request);
|
||||
|
||||
// Get Maximum Possible Value of Activation Date
|
||||
time_t MaxDate = time(NULL) - 86400; // limit latest activation date to yesterday
|
||||
|
||||
// Generate Random Date between MinDate and MaxDate
|
||||
time_t RandomDate = ((ULONG64 *)RandomNumber)[1] & 0x7FFFFFFFFFFFFFFFULL;
|
||||
time_t GeneratedDate = MinDate + RandomDate % (MaxDate - MinDate);
|
||||
struct tm Date;
|
||||
localtime_s(&Date, &GeneratedDate);
|
||||
|
||||
StringCchPrintfW(KMSPID, PID_BUFFER_SIZE, L"%05u-%05u-%03u-%06u-%02u-%u-%04u.0000-%03d%04d",
|
||||
host->Type, config->GroupID, RandomID / 1000000, RandomID % 1000000, LicenseChannel,
|
||||
LanguageCode, host->Build, Date.tm_yday+1, Date.tm_year+1900);
|
||||
}
|
||||
|
||||
// Get Application Specific KMS PID from the Registry (KMS Server Service Only)
|
||||
void GetKMSPID(WCHAR* const KMSPID, REQUEST* const Request)
|
||||
{
|
||||
// Open Registry Key
|
||||
HKEY hKey;
|
||||
DWORD bufferSize = 256;
|
||||
WCHAR buffer[256] = {0};
|
||||
|
||||
// Get ClientAppID as String
|
||||
WCHAR ClientAppID[GUID_BUFFER_SIZE];
|
||||
StringCchPrintfW(ClientAppID, GUID_BUFFER_SIZE, L"%08X-%04hX-%04hX-%02X%02X-%02X%02X%02X%02X%02X%02X", Request->ApplicationId.Data1, Request->ApplicationId.Data2, Request->ApplicationId.Data3, Request->ApplicationId.Data4[0], Request->ApplicationId.Data4[1], Request->ApplicationId.Data4[2], Request->ApplicationId.Data4[3], Request->ApplicationId.Data4[4], Request->ApplicationId.Data4[5], Request->ApplicationId.Data4[6], Request->ApplicationId.Data4[7]);
|
||||
|
||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Services\\KMSServerService\\Parameters\\KMSPID"), NULL, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
// Get Registry Value
|
||||
if (RegQueryValueExW(hKey, ClientAppID, NULL, NULL, (LPBYTE)buffer, &bufferSize) == ERROR_SUCCESS)
|
||||
{
|
||||
if (regex_match(buffer, wregex(L"^([0-9]{5})-([0-9]{5})-([0-9]{3})-([0-9]{6})-([0-9]{2})-([0-9]{4,5})-([0-9]{4}).([0-9]{4})-([0-9]{7})$")))
|
||||
{
|
||||
// Close Registry Key
|
||||
RegCloseKey(hKey);
|
||||
|
||||
// Apply Setting
|
||||
StringCchCopyW(KMSPID, PID_BUFFER_SIZE, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
// Close Registry Key
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Return Empty KMSPID
|
||||
StringCchCopyW(KMSPID, PID_BUFFER_SIZE, L"");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
[
|
||||
uuid(51C82175-844E-4750-B0D8-EC255555BC06),
|
||||
version(1.0),
|
||||
]
|
||||
interface KMSServer
|
||||
{
|
||||
int RequestActivation
|
||||
(
|
||||
[in] int requestSize,
|
||||
[in, size_is(requestSize)] unsigned char* request,
|
||||
[out] int* responseSize,
|
||||
[out, size_is( , *responseSize)] unsigned char** response
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,949 @@
|
||||
// Includes and Namespaces
|
||||
#include <regex>
|
||||
#include <iostream>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include "Crypto.h"
|
||||
#include "Hash.h"
|
||||
#include "KMSPID.h"
|
||||
#include "KMSHWID.h"
|
||||
#include "KMSServer.h"
|
||||
#include "KMSServerLogic.h"
|
||||
#include "KMSServerSettings.h"
|
||||
using namespace std;
|
||||
|
||||
// Link Libraries
|
||||
#pragma comment(lib, "rpcrt4.lib")
|
||||
#pragma comment(lib, "iphlpapi.lib")
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
|
||||
// Hold KMS Server Settings
|
||||
KMSServerSettings ServerSettings;
|
||||
|
||||
// Windows Service Parameters for Service Application
|
||||
SERVICE_STATUS ServerServiceStatus;
|
||||
SERVICE_STATUS_HANDLE ServerServiceHandle;
|
||||
|
||||
// Defined in Hash.cpp
|
||||
extern HMAC_KEYBLOB Hmac_keyblob;
|
||||
|
||||
#pragma region Application Initialization Functions
|
||||
// Load Application Parameters from Command-Line or Registry.
|
||||
void LoadServerParameters(int argc, wchar_t* argv[], bool RunAsService)
|
||||
{
|
||||
// Initialize KMS Server Settings Object
|
||||
ServerSettings.Initialize();
|
||||
ServerSettings.RunAsService = RunAsService;
|
||||
|
||||
if (!RunAsService)
|
||||
{
|
||||
#pragma region Command-Line
|
||||
// Handle Command-Line Arguments (KMS Port or Help)
|
||||
if (argc >= 2)
|
||||
{
|
||||
if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"/?", -1) == CSTR_EQUAL)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf("[KMS Port] [KMS PID] [KMS HWID] [Activation Interval] [Renewal Interval] [Kill Processes]\n\n");
|
||||
|
||||
printf("KMS Port:\n");
|
||||
printf("\tDefaultPort:\t\tUse the built-in KMS Port.\n");
|
||||
printf("\tInteger:\t\tNumber from 1 to 65535.\n\n");
|
||||
|
||||
printf("KMS PID:\n");
|
||||
printf("\tRandomKMSPID:\t\tGenerate a random KMS PID.\n");
|
||||
printf("\tString:\t\t\tA Microsoft Extended Product Key ID.\n\n");
|
||||
|
||||
printf("KMS HWID:\n");
|
||||
printf("\tDefaultKMSHWID:\t\tUse the built-in KMS HWID.\n");
|
||||
printf("\tString:\t\t\t16 Hex character KMS HWID (No 0x).\n\n");
|
||||
|
||||
printf("Activation Interval:\n");
|
||||
printf("\tDefaultAI:\t\tUse the built-in Activation Interval.\n");
|
||||
printf("\tInteger:\t\tNumber (in minutes) from 15 to 43200.\n\n");
|
||||
|
||||
printf("Renewal Interval:\n");
|
||||
printf("\tDefaultRI:\t\tUse the built-in Renewal Interval.\n");
|
||||
printf("\tInteger:\t\tNumber (in minutes) from 15 to 43200.\n\n");
|
||||
|
||||
printf("Kill Processes:\n");
|
||||
printf("\tKillProcessOnPort:\tForce open the KMS Port if this is present.\n\n");
|
||||
|
||||
printf("Example:\n");
|
||||
printf("\tC:\\>\"KMS Server.exe\" 1688 RandomKMSPID DefaultKMSHWID 43200 43200 KillProcessOnPort");
|
||||
ServerWriteLogErrorTerminate(L"\n", -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerValidateKMSPort(argv[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Command-Line Arguments (KMS PID)
|
||||
if (argc >= 3)
|
||||
{
|
||||
ServerValidateKMSPID(argv[2]);
|
||||
}
|
||||
|
||||
// Handle Command-Line Arguments (KMS HWID)
|
||||
if (argc >= 4)
|
||||
{
|
||||
ServerValidateKMSHWID(argv[3]);
|
||||
}
|
||||
|
||||
// Handle Command-Line Arguments (Activation Interval)
|
||||
if (argc >= 5)
|
||||
{
|
||||
if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, argv[4], -1, L"DefaultAI", -1) != CSTR_EQUAL)
|
||||
{
|
||||
// Check if Activation Interval is Valid Number
|
||||
if (regex_match(argv[4], wregex(L"^([0-9]+)$")))
|
||||
{
|
||||
ServerValidateVLActivationInterval(_wtoi(argv[4]));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Invalid KMS Activation Interval! %s is not a valid argument.\n", argv[4]);
|
||||
ServerWriteLogErrorTerminate(Message, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Command-Line Arguments (Renewal Interval)
|
||||
if (argc >= 6)
|
||||
{
|
||||
if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, argv[5], -1, L"DefaultRI", -1) != CSTR_EQUAL)
|
||||
{
|
||||
// Check if Renewal Interval is Valid Number
|
||||
if (regex_match(argv[5], wregex(L"^([0-9]+)$")))
|
||||
{
|
||||
ServerValidateVLRenewalInterval(_wtoi(argv[5]));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Invalid KMS Renewal Interval! %s is not a valid argument.\n", argv[5]);
|
||||
ServerWriteLogErrorTerminate(Message, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Command-Line Arguments (Free TCP/IP)
|
||||
if (argc >= 7)
|
||||
{
|
||||
if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, argv[6], -1, L"KillProcessOnPort", -1) == CSTR_EQUAL)
|
||||
{
|
||||
// Apply Setting
|
||||
ServerSettings.KillProcesses = true;
|
||||
ServerWriteLogInformation(L"KMS Port Process Termination: Enabled \n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Apply Setting
|
||||
ServerSettings.KillProcesses = false;
|
||||
ServerWriteLogInformation(L"KMS Port Process Termination: Disabled \n");
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
}
|
||||
else
|
||||
{
|
||||
#pragma region Registry
|
||||
// Create Buffers for Values
|
||||
WCHAR KMSPID[256] = {0};
|
||||
WCHAR KMSHWID[256] = {0};
|
||||
WCHAR KMSPort[256] = {0};
|
||||
DWORD VLActivationInterval = 0;
|
||||
DWORD VLRenewalInterval = 0;
|
||||
DWORD KillProcesses = 0;
|
||||
|
||||
// Open Registry Key
|
||||
HKEY hKey;
|
||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\KMSServerService\\Parameters", NULL, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
// Buffer Size
|
||||
DWORD bufferSize = 0;
|
||||
|
||||
// Handle Registry Parameters (KMS PID)
|
||||
bufferSize = 256;
|
||||
RegQueryValueExW(hKey, L"KMSPID", NULL, NULL, (LPBYTE)KMSPID, &bufferSize);
|
||||
|
||||
// Handle Registry Parameters (KMS HWID)
|
||||
bufferSize = 256;
|
||||
RegQueryValueExW(hKey, L"KMSHWID", NULL, NULL, (LPBYTE)KMSHWID, &bufferSize);
|
||||
|
||||
// Handle Registry Parameters (KMS Port)
|
||||
bufferSize = 256;
|
||||
RegQueryValueExW(hKey, L"KMSPort", NULL, NULL, (LPBYTE)KMSPort, &bufferSize);
|
||||
|
||||
// Handle Registry Parameters (Activation Interval)
|
||||
bufferSize = sizeof(DWORD);
|
||||
RegQueryValueExW(hKey, L"VLActivationInterval", NULL, NULL, (LPBYTE)&VLActivationInterval, &bufferSize);
|
||||
|
||||
// Handle Registry Parameters (Renewal Interval)
|
||||
bufferSize = sizeof(DWORD);
|
||||
RegQueryValueExW(hKey, L"VLRenewalInterval", NULL, NULL, (LPBYTE)&VLRenewalInterval, &bufferSize);
|
||||
|
||||
// Handle Registry Parameters (Free TCP/IP)
|
||||
bufferSize = sizeof(DWORD);
|
||||
RegQueryValueExW(hKey, L"KillProcessOnPort", NULL, NULL, (LPBYTE)&KillProcesses, &bufferSize);
|
||||
|
||||
// Close Registry Key
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
// Validate Values
|
||||
ServerValidateKMSPort(KMSPort);
|
||||
ServerValidateKMSPID(KMSPID);
|
||||
ServerValidateKMSHWID(KMSHWID);
|
||||
ServerValidateVLActivationInterval(VLActivationInterval);
|
||||
ServerValidateVLRenewalInterval(VLRenewalInterval);
|
||||
|
||||
// Handle External Process Termination
|
||||
if (KillProcesses > 0)
|
||||
{
|
||||
// Apply Setting
|
||||
ServerSettings.KillProcesses = true;
|
||||
ServerWriteLogInformation(L"KMS Port Process Termination: Enabled \n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Apply Setting
|
||||
ServerSettings.KillProcesses = false;
|
||||
ServerWriteLogInformation(L"KMS Port Process Termination: Disabled \n");
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
}
|
||||
}
|
||||
|
||||
// Start RPC Connection and listen indefinitely for KMS Clients.
|
||||
void StartKMSServer()
|
||||
{
|
||||
// Uses the protocol combined with the endpoint for receiving remote procedure calls.
|
||||
RPC_STATUS status = RpcServerUseProtseqEp
|
||||
(
|
||||
// Use TCP/IP protocol.
|
||||
(RPC_WSTR)L"ncacn_ip_tcp",
|
||||
// Backlog queue length for TCP/IP.
|
||||
RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
|
||||
// TCP/IP port to use.
|
||||
(RPC_WSTR)ServerSettings.KMSPort,
|
||||
// No security.
|
||||
NULL
|
||||
);
|
||||
|
||||
if (status)
|
||||
{
|
||||
// TCP/IP Port in Use
|
||||
if (status == RPC_S_DUPLICATE_ENDPOINT && ServerSettings.KillProcesses)
|
||||
{
|
||||
// TCP Table and TCP Table Size
|
||||
MIB_TCPTABLE_OWNER_PID *pTCPInfo;
|
||||
DWORD dwSize = 0;
|
||||
|
||||
// Get TCP Table Size
|
||||
GetExtendedTcpTable(NULL, &dwSize, true, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0);
|
||||
|
||||
// Allocate Memory for TCP Table
|
||||
pTCPInfo = (MIB_TCPTABLE_OWNER_PID*)malloc(dwSize);
|
||||
|
||||
// Get TCP Table Data
|
||||
GetExtendedTcpTable(pTCPInfo, &dwSize, true, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0);
|
||||
|
||||
// Read TCP Table Data
|
||||
for (DWORD i = 0; i < pTCPInfo->dwNumEntries; i++)
|
||||
{
|
||||
// Get Process ID, Opened Port of the Process and KMS Port
|
||||
DWORD processID = pTCPInfo->table[i].dwOwningPid;
|
||||
DWORD kmsport = _wtoi(ServerSettings.KMSPort);
|
||||
DWORD port = ntohs((u_short)pTCPInfo->table[i].dwLocalPort);
|
||||
|
||||
// Check if this Process has the KMS Port
|
||||
if (port == kmsport)
|
||||
{
|
||||
|
||||
// Enable Debug Privileges
|
||||
HANDLE tokenHandle;
|
||||
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tokenHandle);
|
||||
TOKEN_PRIVILEGES privilegeToken;
|
||||
LookupPrivilegeValue(0, SE_DEBUG_NAME, &privilegeToken.Privileges[0].Luid);
|
||||
privilegeToken.PrivilegeCount = 1;
|
||||
privilegeToken.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
||||
AdjustTokenPrivileges(tokenHandle, 0, &privilegeToken, sizeof(TOKEN_PRIVILEGES), 0, 0);
|
||||
CloseHandle(tokenHandle);
|
||||
|
||||
// Kill Process using the KMS Port
|
||||
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, processID);
|
||||
if (hProcess != NULL)
|
||||
{
|
||||
TerminateProcess(hProcess, 0);
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Failed to get handle to kill Process ID: %i.\n", processID);
|
||||
ServerWriteLogErrorTerminate(Message, -1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Connect on Port Again
|
||||
Sleep(5000);
|
||||
status = RpcServerUseProtseqEp
|
||||
(
|
||||
// Use TCP/IP protocol.
|
||||
(RPC_WSTR)L"ncacn_ip_tcp",
|
||||
// Backlog queue length for TCP/IP.
|
||||
RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
|
||||
// TCP/IP port to use.
|
||||
(RPC_WSTR)ServerSettings.KMSPort,
|
||||
// No security.
|
||||
NULL
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"RpcServerUseProtseqEp failed with code %i.\n", status);
|
||||
ServerWriteLogErrorTerminate(Message, status);
|
||||
}
|
||||
}
|
||||
|
||||
// Registers the KMSServer interface.
|
||||
status = RpcServerRegisterIfEx
|
||||
(
|
||||
// Interface to register.
|
||||
KMSServer_v1_0_s_ifspec,
|
||||
// Use the MIDL generated entry-point vector.
|
||||
NULL,
|
||||
// Use the MIDL generated entry-point vector.
|
||||
NULL,
|
||||
// Interface Registration Flags
|
||||
RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH | RPC_IF_AUTOLISTEN,
|
||||
// Maximum Calls
|
||||
RPC_C_LISTEN_MAX_CALLS_DEFAULT,
|
||||
// No Security Callback Function
|
||||
NULL
|
||||
);
|
||||
|
||||
if (status)
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"RpcServerRegisterIfEx failed with code %i.\n", status);
|
||||
ServerWriteLogErrorTerminate(Message, status);
|
||||
}
|
||||
|
||||
ServerWriteLogInformation(L"\nKMS Server Emulator started successfully.\n");
|
||||
|
||||
// Start to listen for remote procedure calls for all registered interfaces.
|
||||
// This call will not return until RpcMgmtStopServerListening is called or the program is exited.
|
||||
status = RpcServerListen
|
||||
(
|
||||
// Recommended minimum number of threads.
|
||||
1,
|
||||
// Recommended maximum number of threads.
|
||||
RPC_C_LISTEN_MAX_CALLS_DEFAULT,
|
||||
// Start listening now.
|
||||
0
|
||||
);
|
||||
|
||||
if (status)
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"RpcServerListen failed with code %i.\n", status);
|
||||
ServerWriteLogErrorTerminate(Message, status);
|
||||
}
|
||||
}
|
||||
|
||||
// Stop RPC Connection
|
||||
void StopKMSServer()
|
||||
{
|
||||
RpcMgmtStopServerListening(NULL);
|
||||
RpcServerUnregisterIf(NULL, NULL, FALSE);
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region RPC Interface Functions
|
||||
// RPC Function to Build and Send a KMS Server Response.
|
||||
int ActivationResponse(handle_t IDL_handle, int requestSize, unsigned char *request, int *responseSize, unsigned char **response)
|
||||
{
|
||||
// No Unreferenced Parameter Warnings
|
||||
UNREFERENCED_PARAMETER(IDL_handle);
|
||||
|
||||
// Verify Request Size
|
||||
if (requestSize < 92)
|
||||
{
|
||||
return RPC_S_INVALID_ENDPOINT_FORMAT;
|
||||
}
|
||||
|
||||
// KMS Protocol Version
|
||||
if (request[2] == 4 && request[0] == 0)
|
||||
{
|
||||
// Send Response to KMS Client
|
||||
*response = CreateResponseV4((REQUEST_V4 *)request, responseSize);
|
||||
|
||||
// Log Sent Response
|
||||
ServerWriteLogInformation(L"Activation response (KMS V4.0) sent.\n");
|
||||
|
||||
// Return to RPC Interface
|
||||
return RPC_S_OK;
|
||||
}
|
||||
else if (request[2] == 5 && request[0] == 0)
|
||||
{
|
||||
// Send Response to KMS Client
|
||||
*response = CreateResponseV5((REQUEST_V5 *)request, responseSize);
|
||||
|
||||
// Log Sent Response
|
||||
ServerWriteLogInformation(L"Activation response (KMS V5.0) sent.\n");
|
||||
|
||||
// Return to RPC Interface
|
||||
return RPC_S_OK;
|
||||
}
|
||||
else if (request[2] == 6 && request[0] == 0)
|
||||
{
|
||||
// Send Response to KMS Client
|
||||
*response = CreateResponseV6((REQUEST_V6 *)request, responseSize);
|
||||
|
||||
// Log Sent Response
|
||||
ServerWriteLogInformation(L"Activation response (KMS V6.0) sent.\n");
|
||||
|
||||
// Return to RPC Interface
|
||||
return RPC_S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unsupported Protocol
|
||||
return RPC_S_INVALID_VERS_OPTION;
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region KMS Server Response Generation Functions
|
||||
// Create Base KMS Server Response Object and handle KMS PID and HWID.
|
||||
DWORD CreateResponseBase(REQUEST* const Request, PBYTE const Response)
|
||||
{
|
||||
// Generate KMS PID or use Command Argument
|
||||
WCHAR kmsPIDInstance[PID_BUFFER_SIZE] = { 0 };
|
||||
|
||||
// Try to Get Application Specific KMS PID and HWID if running as KMS Server Service
|
||||
if (ServerSettings.RunAsService)
|
||||
{
|
||||
GetKMSPID(kmsPIDInstance, Request);
|
||||
}
|
||||
|
||||
// No Specific KMS PID or not running as KMS Server Service
|
||||
if (!regex_match(kmsPIDInstance, wregex(L"^([0-9]{5})-([0-9]{5})-([0-9]{3})-([0-9]{6})-([0-9]{2})-([0-9]{4,5})-([0-9]{4}).([0-9]{4})-([0-9]{7})$")))
|
||||
{
|
||||
if (ServerSettings.GenerateRandomKMSPID)
|
||||
{
|
||||
// Build Random KMS PID
|
||||
CreateKMSPID(kmsPIDInstance, Request);
|
||||
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"\nKMS PID Generated: %s \n", kmsPIDInstance);
|
||||
ServerWriteLogInformation(Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use Global KMS PID from Settings
|
||||
StringCchCopyW(kmsPIDInstance, PID_BUFFER_SIZE, ServerSettings.KMSPID);
|
||||
}
|
||||
}
|
||||
|
||||
// Get KMS PID Length
|
||||
DWORD kmsPIDLen = (DWORD)((wcslen(kmsPIDInstance) + 1) * sizeof(WCHAR));
|
||||
|
||||
// Current pointer
|
||||
PBYTE current = Response;
|
||||
|
||||
// Set KMS Protocol Minor Version & Major Version
|
||||
*(PDWORD)current = *(PDWORD)Request;
|
||||
current += sizeof(DWORD);
|
||||
|
||||
// Set KMS PID Length
|
||||
*(PDWORD)current = kmsPIDLen;
|
||||
current += sizeof(DWORD);
|
||||
|
||||
// Copy KMS PID
|
||||
memcpy(current, kmsPIDInstance, kmsPIDLen);
|
||||
current += kmsPIDLen;
|
||||
|
||||
// Copy Client Machine ID
|
||||
memcpy(current, &Request->ClientMachineId, sizeof(GUID));
|
||||
current += sizeof(GUID);
|
||||
|
||||
// Copy KMS Client Request Timestamp
|
||||
memcpy(current, &Request->RequestTime, sizeof(FILETIME));
|
||||
current += sizeof(FILETIME);
|
||||
|
||||
// Set KMS Client Count Parameter
|
||||
*(PDWORD)current = ServerSettings.CurrentClientCount;
|
||||
current += sizeof(DWORD);
|
||||
|
||||
// Set KMS Activation Interval Parameter
|
||||
*(PDWORD)current = ServerSettings.VLActivationInterval;
|
||||
current += sizeof(DWORD);
|
||||
|
||||
// Set KMS Renewal Interval Parameter
|
||||
*(PDWORD)current = ServerSettings.VLRenewalInterval;
|
||||
current += sizeof(DWORD);
|
||||
|
||||
// Return ResponseBase Size
|
||||
return (DWORD)(current - Response);
|
||||
}
|
||||
|
||||
// Create Hashed KMS Server Response Data for KMS Protocol Version 4.
|
||||
PBYTE CreateResponseV4(REQUEST_V4* const Request, int* const responseSize)
|
||||
{
|
||||
// Allocate KMS Server Response Buffer
|
||||
BYTE buffer[MAX_RESPONSE_SIZE] = {0};
|
||||
|
||||
// Create KMS Server Response Base
|
||||
int size = CreateResponseBase(&Request->RequestBase, buffer);
|
||||
|
||||
// Create Hash
|
||||
GetHash(size, buffer, buffer + size);
|
||||
|
||||
// Create Proper Response with Hash
|
||||
*responseSize = size + 16;
|
||||
PBYTE response = (PBYTE)midl_user_allocate(*responseSize);
|
||||
memcpy(response, buffer, *responseSize);
|
||||
|
||||
// Return Response
|
||||
return response;
|
||||
}
|
||||
|
||||
// Create Encrypted KMS Server Response Data for KMS Protocol Version 5.
|
||||
PBYTE CreateResponseV5(REQUEST_V5* const Request, int* const responseSize)
|
||||
{
|
||||
// Allocate Response Buffer
|
||||
BYTE buffer[MAX_RESPONSE_SIZE] = {0};
|
||||
|
||||
// Current pointer
|
||||
PBYTE current = buffer;
|
||||
|
||||
// Set KMS Protocol Minor Version & Major Version
|
||||
*(PDWORD)current = *(PDWORD)Request;
|
||||
current += sizeof(DWORD);
|
||||
|
||||
// Store Response Salt pointer
|
||||
PBYTE ResponseSalt = current;
|
||||
|
||||
// Copy Response Salt
|
||||
memcpy(current, Request->Salt, 16);
|
||||
current += 16;
|
||||
|
||||
// AES-128 Decrypt
|
||||
DWORD DecryptSize = sizeof(Request->Salt) + sizeof(Request->RequestBase) + sizeof(Request->Pad);
|
||||
AESDecryptMessage(Request->Salt, Request->Salt, &DecryptSize);
|
||||
|
||||
// Store Encrypt start pointer
|
||||
PBYTE EncryptStart = current;
|
||||
|
||||
// Create Response Base Object
|
||||
current += CreateResponseBase(&Request->RequestBase, current);
|
||||
|
||||
// Random Salt
|
||||
BYTE RandomSalt[16];
|
||||
|
||||
// Seed Random Number Generator
|
||||
srand(GetTickCount());
|
||||
|
||||
// Generate a Random Salt Key
|
||||
for(int i = 0; i < 16; i++)
|
||||
{
|
||||
RandomSalt[i] = rand() % 256;
|
||||
current[i] = Request->Salt[i] ^ ResponseSalt[i] ^ RandomSalt[i];
|
||||
}
|
||||
current += 16;
|
||||
|
||||
// Create Hash
|
||||
GetHashSHA256(16, RandomSalt, current);
|
||||
current += 32;
|
||||
|
||||
// Encrypted and Unencrypted size (KMS Protocol Major Version (2) + KMS Protocol Minor Version (2) + Salt (16))
|
||||
DWORD UnencryptedSize = 20;
|
||||
DWORD EncryptedSize = (DWORD)(current - EncryptStart);
|
||||
|
||||
// AES-128 Encrypt
|
||||
AESEncryptMessage(ResponseSalt, EncryptStart, &EncryptedSize, MAX_RESPONSE_SIZE - UnencryptedSize);
|
||||
|
||||
// Make proper response with correct size
|
||||
*responseSize = EncryptedSize + UnencryptedSize;
|
||||
PBYTE response = (PBYTE)midl_user_allocate(*responseSize);
|
||||
memcpy(response, buffer, *responseSize);
|
||||
|
||||
// Return Response
|
||||
return response;
|
||||
}
|
||||
|
||||
// Create Encrypted KMS Server Response Data for KMS Protocol Version 6.
|
||||
PBYTE CreateResponseV6(REQUEST_V6* const Request, int* const responseSize)
|
||||
{
|
||||
// V6: AES key
|
||||
BYTE AES_V6_KEY[16] = {0xA9, 0x4A, 0x41, 0x95, 0xE2, 0x01, 0x43, 0x2D, 0x9B, 0xCB, 0x46, 0x04, 0x05, 0xD8, 0x4A, 0x21};
|
||||
|
||||
// Allocate Response Buffer
|
||||
BYTE buffer[MAX_RESPONSE_SIZE] = {0};
|
||||
|
||||
// Current pointer
|
||||
PBYTE current = buffer;
|
||||
|
||||
// Set KMS Protocol Minor Version & Major Version
|
||||
*(PDWORD)current = *(PDWORD)Request;
|
||||
current += sizeof(DWORD);
|
||||
|
||||
// Store Response Salt pointer
|
||||
PBYTE ResponseSalt = current;
|
||||
|
||||
// Copy Response Salt
|
||||
memcpy(current, Request->Salt, 16);
|
||||
current += 16;
|
||||
|
||||
// AES-128 Decrypt
|
||||
DWORD DecryptSize = sizeof(Request->Salt) + sizeof(Request->RequestBase) + sizeof(Request->Pad);
|
||||
|
||||
// Modded AES-CBC Decrypt
|
||||
AesInit(AES_TYPE_128, AES_MODE_CBC, 0x04, AES_V6_KEY, Request->Salt);
|
||||
DecryptMessage(DecryptSize, Request->Salt);
|
||||
AesClear();
|
||||
|
||||
// Store Encrypt start pointer
|
||||
PBYTE EncryptStart = current;
|
||||
|
||||
// Create Response Base Object
|
||||
current += CreateResponseBase(&Request->RequestBase, current);
|
||||
|
||||
// Random Salt
|
||||
BYTE RandomSalt[16];
|
||||
|
||||
// Seed Random Number Generator
|
||||
srand(GetTickCount());
|
||||
|
||||
// Generate a Random Salt Key
|
||||
for(int i = 0; i < 16; i++)
|
||||
{
|
||||
RandomSalt[i] = rand() % 256;
|
||||
current[i] = Request->Salt[i] ^ ResponseSalt[i] ^ RandomSalt[i];
|
||||
}
|
||||
current += 16;
|
||||
|
||||
// Create Hash
|
||||
GetHashSHA256(16, RandomSalt, current);
|
||||
current += 32;
|
||||
|
||||
#pragma region KMS HWID
|
||||
// Try to Get Application Specific KMS HWID if running as KMS Server Service
|
||||
QWORD kmsHWIDInstance = 0x0;
|
||||
if (ServerSettings.RunAsService)
|
||||
{
|
||||
GetKMSHWID(&kmsHWIDInstance, &Request->RequestBase);
|
||||
}
|
||||
|
||||
// No Specific KMS HWID or not running as KMS Server Service
|
||||
if (kmsHWIDInstance == 0x0)
|
||||
{
|
||||
// Use Global KMS PID from Settings
|
||||
kmsHWIDInstance = ServerSettings.KMSHWID;
|
||||
}
|
||||
|
||||
// Machine Hardware Hash
|
||||
*(PQWORD) current = kmsHWIDInstance;
|
||||
current += 8;
|
||||
#pragma endregion
|
||||
|
||||
// HMAC message buffer
|
||||
BYTE Hmac_msg[256];
|
||||
|
||||
// Xor2 and Hmac_msg
|
||||
for(int i = 0; i < 16; i++)
|
||||
{
|
||||
Hmac_msg[i] = current[i] = Request->Salt[i] ^ ResponseSalt[i];
|
||||
}
|
||||
current += 16;
|
||||
|
||||
// HMAC size
|
||||
DWORD Hmac_size = current - EncryptStart;
|
||||
memcpy(Hmac_msg + 16, EncryptStart, Hmac_size);
|
||||
Hmac_size += 16;
|
||||
|
||||
// HMAC-SHA256
|
||||
BYTE Hmac_hash[32];
|
||||
GetHmacKey(&Request->RequestBase.RequestTime, Hmac_keyblob.rgbKeyData);
|
||||
GetHmacSHA256(Hmac_size, Hmac_msg, Hmac_hash);
|
||||
memcpy(current, Hmac_hash + 16, 16);
|
||||
current += 16;
|
||||
|
||||
// Encrypted and Unencrypted size (KMS Protocol Major Version (2) + KMS Protocol Minor Version (2) + Salt (16))
|
||||
DWORD EncryptSize = (DWORD)(current - EncryptStart);
|
||||
|
||||
// PKCS5 Padding
|
||||
BYTE bPadding =(~EncryptSize + 1) & 0x0f;
|
||||
if(bPadding == 0){
|
||||
bPadding = 16;
|
||||
}
|
||||
|
||||
memset(current, bPadding, bPadding);
|
||||
EncryptSize += bPadding;
|
||||
|
||||
// Modded AES-CBC Encrypt
|
||||
AesInit(AES_TYPE_128, AES_MODE_CBC, bPadding, AES_V6_KEY, ResponseSalt);
|
||||
EncryptMessage(EncryptSize, EncryptStart);
|
||||
AesClear();
|
||||
|
||||
// Make proper response with correct size
|
||||
*responseSize = EncryptSize + 20;
|
||||
PBYTE response = (PBYTE)midl_user_allocate(*responseSize);
|
||||
memcpy(response, buffer, *responseSize);
|
||||
|
||||
// Return Response
|
||||
return response;
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Parameter Validation Functions
|
||||
// Validate KMS Port Parameter
|
||||
void ServerValidateKMSPort(WCHAR* KMSPort)
|
||||
{
|
||||
// Check if the KMS Port is not the Default
|
||||
if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSPort, -1, L"DefaultPort", -1) != CSTR_EQUAL)
|
||||
{
|
||||
// Check if KMS Port is Valid Number
|
||||
if (regex_match(KMSPort, wregex(L"^([0-9]+)$")))
|
||||
{
|
||||
// Check if KMS Port is Valid Range
|
||||
if(_wtoi(KMSPort) < 1 || _wtoi(KMSPort) > 65535)
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Invalid KMS Port Range! %s is not a valid argument.\n", KMSPort);
|
||||
ServerWriteLogErrorTerminate(Message, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Apply Setting
|
||||
StringCchCopyW(ServerSettings.KMSPort, PORT_BUFFER_SIZE, KMSPort);
|
||||
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"KMS Port: %s \n", KMSPort);
|
||||
ServerWriteLogInformation(Message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Invalid KMS Port! %s is not a valid argument.\n", KMSPort);
|
||||
ServerWriteLogErrorTerminate(Message, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate KMS PID Parameter
|
||||
void ServerValidateKMSPID(WCHAR* KMSPID)
|
||||
{
|
||||
// Check if KMS PID should be Random
|
||||
if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSPID, -1, L"RandomKMSPID", -1) == CSTR_EQUAL)
|
||||
{
|
||||
ServerSettings.GenerateRandomKMSPID = true;
|
||||
}
|
||||
// Check if KMS PID is Valid
|
||||
else if (regex_match(KMSPID, wregex(L"^([0-9]{5})-([0-9]{5})-([0-9]{3})-([0-9]{6})-([0-9]{2})-([0-9]{4,5})-([0-9]{4}).([0-9]{4})-([0-9]{7})$")))
|
||||
{
|
||||
// Apply Setting
|
||||
StringCchCopyW(ServerSettings.KMSPID, PID_BUFFER_SIZE, KMSPID);
|
||||
|
||||
// Disable Random KMSPID Generation
|
||||
ServerSettings.GenerateRandomKMSPID = false;
|
||||
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"KMS PID: %s \n", KMSPID);
|
||||
ServerWriteLogInformation(Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Invalid KMS PID! %s is not a valid argument.\n", KMSPID);
|
||||
ServerWriteLogErrorTerminate(Message, -1);
|
||||
}
|
||||
}
|
||||
|
||||
// Validate KMS HWID Parameter
|
||||
void ServerValidateKMSHWID(WCHAR* KMSHWID)
|
||||
{
|
||||
// Check if the KMS Port is not the Default
|
||||
if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, KMSHWID, -1, L"DefaultKMSHWID", -1) != CSTR_EQUAL)
|
||||
{
|
||||
// Check if KMS HWID is Valid Hex String
|
||||
if (regex_match(KMSHWID, wregex(L"^[a-fA-F0-9]{16}$")))
|
||||
{
|
||||
// Apply Setting
|
||||
ServerSettings.KMSHWID = wcstoull(KMSHWID, NULL, 16);
|
||||
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"KMS HWID: %s \n", KMSHWID);
|
||||
ServerWriteLogInformation(Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Invalid KMS Hardware ID! %s is not a valid argument.\n", KMSHWID);
|
||||
ServerWriteLogErrorTerminate(Message, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate KMS Activation Interval Parameter
|
||||
void ServerValidateVLActivationInterval(int VLActivationInterval)
|
||||
{
|
||||
// Check if KMS Activation Interval is Valid Range
|
||||
if (VLActivationInterval < 15 || VLActivationInterval > 43200)
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Invalid KMS Activation Interval Range! %i is not a valid argument.\n", VLActivationInterval);
|
||||
ServerWriteLogErrorTerminate(Message, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Apply Setting
|
||||
ServerSettings.VLActivationInterval = VLActivationInterval;
|
||||
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"KMS Activation Interval: %i minutes \n", VLActivationInterval);
|
||||
ServerWriteLogInformation(Message);
|
||||
}
|
||||
}
|
||||
|
||||
// Validate KMS Activation Interval Parameter
|
||||
void ServerValidateVLRenewalInterval(int VLRenewalInterval)
|
||||
{
|
||||
// Check if KMS Renewal Interval is Valid Range
|
||||
if (VLRenewalInterval < 15 || VLRenewalInterval > 43200)
|
||||
{
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"Invalid KMS Renewal Interval Range! %i is not a valid argument.\n", VLRenewalInterval);
|
||||
ServerWriteLogErrorTerminate(Message, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Apply Setting
|
||||
ServerSettings.VLRenewalInterval = VLRenewalInterval;
|
||||
|
||||
// Format Log Message
|
||||
WCHAR Message[256];
|
||||
swprintf_s(Message, 256, L"KMS Renewal Interval: %i minutes \n", VLRenewalInterval);
|
||||
ServerWriteLogInformation(Message);
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Logging Functions
|
||||
// Log an informational message to the Console or Windows Application Event Log.
|
||||
void ServerWriteLogInformation(WCHAR* const Message)
|
||||
{
|
||||
// Log Message Buffer
|
||||
WCHAR logMessage[256];
|
||||
|
||||
// Write Log Message to Buffer
|
||||
StringCbPrintfW(logMessage, 256, Message);
|
||||
|
||||
// Choose Log Source
|
||||
if (ServerSettings.RunAsService)
|
||||
{
|
||||
// Output to Windows Event Log: Qualifiers: 16384, EventId: 12290
|
||||
ServerWriteEventLogEntry(0x40003002, logMessage, EVENTLOG_INFORMATION_TYPE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Output to Console
|
||||
wprintf(L"%s", logMessage);
|
||||
}
|
||||
}
|
||||
|
||||
// Log an error message to the Console or Windows Application Event Log.
|
||||
void ServerWriteLogError(WCHAR* const Message)
|
||||
{
|
||||
// Log Message Buffer
|
||||
WCHAR logMessage[256];
|
||||
|
||||
// Write Log Message to Buffer
|
||||
StringCbPrintfW(logMessage, 256, Message);
|
||||
|
||||
// Choose Log Source
|
||||
if (ServerSettings.RunAsService)
|
||||
{
|
||||
// Output to Windows Event Log: Qualifiers: 16384, EventId: 902
|
||||
ServerWriteEventLogEntry(0x40000386, logMessage, EVENTLOG_ERROR_TYPE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Output to Console
|
||||
wprintf(L"%s", logMessage);
|
||||
}
|
||||
}
|
||||
|
||||
// Log an error message to the Console or Windows Application Event Log and terminate program.
|
||||
void ServerWriteLogErrorTerminate(WCHAR* const Message, int ExitCode)
|
||||
{
|
||||
// Call ServerWriteLogError
|
||||
ServerWriteLogError(Message);
|
||||
|
||||
if (!ServerSettings.RunAsService)
|
||||
{
|
||||
// Exit Program
|
||||
exit(ExitCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Exit Service
|
||||
ServerServiceStatus.dwCurrentState = SERVICE_STOPPED;
|
||||
ServerServiceStatus.dwWin32ExitCode = ExitCode;
|
||||
SetServiceStatus(ServerServiceHandle, &ServerServiceStatus);
|
||||
}
|
||||
}
|
||||
|
||||
// Log a message to the Windows Application Event Log.
|
||||
void ServerWriteEventLogEntry(DWORD dwIdentifier, WCHAR* const lpszMessage, WORD wType)
|
||||
{
|
||||
HANDLE hEventSource = OpenEventLogW(NULL, L"KmsRequests"); // Provider: KmsRequests or Microsoft-Windows-Security-SPP
|
||||
|
||||
if(hEventSource != NULL)
|
||||
{
|
||||
ReportEventW(
|
||||
hEventSource, // Event log handle
|
||||
wType, // Event type
|
||||
NULL, // Event category
|
||||
dwIdentifier, // Event identifier
|
||||
NULL, // No security identifier
|
||||
1, // Size of lpszStrings array
|
||||
NULL, // No binary data
|
||||
(LPCWSTR*)&lpszMessage, // Array of strings
|
||||
NULL // No binary data
|
||||
);
|
||||
|
||||
CloseEventLog(hEventSource);
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
@@ -0,0 +1,29 @@
|
||||
// Includes and Namespaces
|
||||
#include "KMSServerSettings.h"
|
||||
|
||||
// KMS Server Parameters
|
||||
WCHAR KMSServerSettings::KMSPID[PID_BUFFER_SIZE];
|
||||
QWORD KMSServerSettings::KMSHWID;
|
||||
WCHAR KMSServerSettings::KMSPort[PORT_BUFFER_SIZE];
|
||||
DWORD KMSServerSettings::CurrentClientCount;
|
||||
DWORD KMSServerSettings::VLActivationInterval;
|
||||
DWORD KMSServerSettings::VLRenewalInterval;
|
||||
|
||||
// KMS Server Program Control
|
||||
bool KMSServerSettings::GenerateRandomKMSPID;
|
||||
bool KMSServerSettings::RunAsService;
|
||||
|
||||
// Process Termination Control Variables
|
||||
bool KMSServerSettings:: KillProcesses;
|
||||
|
||||
// Set Default Settings
|
||||
void KMSServerSettings::Initialize()
|
||||
{
|
||||
StringCchCopyW(KMSPID, PID_BUFFER_SIZE, L"55041-00168-305-246209-03-1033-7600.0000-0522010");
|
||||
KMSHWID = 0x364F463A8863D35F;
|
||||
StringCchCopyW(KMSPort, PORT_BUFFER_SIZE, L"1688");
|
||||
CurrentClientCount = 26;
|
||||
VLActivationInterval = 120;
|
||||
VLRenewalInterval = 10080;
|
||||
GenerateRandomKMSPID = true;
|
||||
};
|
||||
@@ -0,0 +1,498 @@
|
||||
// Win32 KMS Client RPC Stubs
|
||||
#if !defined(_M_IA64) && !defined(_M_AMD64) && !defined(_ARM_)
|
||||
|
||||
|
||||
#pragma warning( disable: 4049 ) /* more than 64k source lines */
|
||||
#if _MSC_VER >= 1200
|
||||
#pragma warning(push)
|
||||
#endif
|
||||
|
||||
#pragma warning( disable: 4211 ) /* redefine extern to static */
|
||||
#pragma warning( disable: 4232 ) /* dllimport identity*/
|
||||
#pragma warning( disable: 4024 ) /* array to pointer mapping*/
|
||||
#pragma warning( disable: 4100 ) /* unreferenced arguments in x86 call */
|
||||
|
||||
#pragma optimize("", off )
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "KMSServer.h"
|
||||
|
||||
#define TYPE_FORMAT_STRING_SIZE 43
|
||||
#define PROC_FORMAT_STRING_SIZE 59
|
||||
#define EXPR_FORMAT_STRING_SIZE 1
|
||||
#define TRANSMIT_AS_TABLE_SIZE 0
|
||||
#define WIRE_MARSHAL_TABLE_SIZE 0
|
||||
|
||||
typedef struct _KMSServer_MIDL_TYPE_FORMAT_STRING
|
||||
{
|
||||
short Pad;
|
||||
unsigned char Format[ TYPE_FORMAT_STRING_SIZE ];
|
||||
} KMSServer_MIDL_TYPE_FORMAT_STRING;
|
||||
|
||||
typedef struct _KMSServer_MIDL_PROC_FORMAT_STRING
|
||||
{
|
||||
short Pad;
|
||||
unsigned char Format[ PROC_FORMAT_STRING_SIZE ];
|
||||
} KMSServer_MIDL_PROC_FORMAT_STRING;
|
||||
|
||||
typedef struct _KMSServer_MIDL_EXPR_FORMAT_STRING
|
||||
{
|
||||
long Pad;
|
||||
unsigned char Format[ EXPR_FORMAT_STRING_SIZE ];
|
||||
} KMSServer_MIDL_EXPR_FORMAT_STRING;
|
||||
|
||||
|
||||
static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax =
|
||||
{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}};
|
||||
|
||||
|
||||
extern const KMSServer_MIDL_TYPE_FORMAT_STRING KMSServer__MIDL_TypeFormatString;
|
||||
extern const KMSServer_MIDL_PROC_FORMAT_STRING KMSServer__MIDL_ProcFormatString;
|
||||
extern const KMSServer_MIDL_EXPR_FORMAT_STRING KMSServer__MIDL_ExprFormatString;
|
||||
|
||||
#define GENERIC_BINDING_TABLE_SIZE 0
|
||||
|
||||
|
||||
/* Standard interface: KMSServer, ver. 1.0,
|
||||
GUID={0x51C82175,0x844E,0x4750,{0xB0,0xD8,0xEC,0x25,0x55,0x55,0xBC,0x06}} */
|
||||
|
||||
|
||||
|
||||
static const RPC_CLIENT_INTERFACE KMSServer___RpcClientInterface =
|
||||
{
|
||||
sizeof(RPC_CLIENT_INTERFACE),
|
||||
{{0x51C82175,0x844E,0x4750,{0xB0,0xD8,0xEC,0x25,0x55,0x55,0xBC,0x06}},{1,0}},
|
||||
{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}},
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0x00000000
|
||||
};
|
||||
RPC_IF_HANDLE KMSServer_v1_0_c_ifspec = (RPC_IF_HANDLE)& KMSServer___RpcClientInterface;
|
||||
|
||||
extern const MIDL_STUB_DESC KMSServer_StubDesc;
|
||||
|
||||
static RPC_BINDING_HANDLE KMSServer__MIDL_AutoBindHandle;
|
||||
|
||||
|
||||
int ActivationRequest(
|
||||
/* [in] */ handle_t IDL_handle,
|
||||
/* [in] */ int requestSize,
|
||||
/* [size_is][in] */ unsigned char *request,
|
||||
/* [out] */ int *responseSize,
|
||||
/* [size_is][size_is][out] */ unsigned char **response)
|
||||
{
|
||||
|
||||
CLIENT_CALL_RETURN _RetVal;
|
||||
|
||||
_RetVal = NdrClientCall2(
|
||||
( PMIDL_STUB_DESC )&KMSServer_StubDesc,
|
||||
(PFORMAT_STRING) &KMSServer__MIDL_ProcFormatString.Format[0],
|
||||
( unsigned char * )&IDL_handle);
|
||||
return ( int )_RetVal.Simple;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if !defined(__RPC_WIN32__)
|
||||
#error Invalid build platform for this stub.
|
||||
#endif
|
||||
|
||||
#if !(TARGET_IS_NT50_OR_LATER)
|
||||
#error You need Windows 2000 or later to run this stub because it uses these features:
|
||||
#error /robust command line switch.
|
||||
#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems.
|
||||
#error This app will fail with the RPC_X_WRONG_STUB_VERSION error.
|
||||
#endif
|
||||
|
||||
|
||||
static const KMSServer_MIDL_PROC_FORMAT_STRING KMSServer__MIDL_ProcFormatString =
|
||||
{
|
||||
0,
|
||||
{
|
||||
|
||||
/* Procedure ActivationRequest */
|
||||
|
||||
0x0, /* 0 */
|
||||
0x48, /* Old Flags: */
|
||||
/* 2 */ NdrFcLong( 0x0 ), /* 0 */
|
||||
/* 6 */ NdrFcShort( 0x0 ), /* 0 */
|
||||
/* 8 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */
|
||||
/* 10 */ 0x32, /* FC_BIND_PRIMITIVE */
|
||||
0x0, /* 0 */
|
||||
/* 12 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */
|
||||
/* 14 */ NdrFcShort( 0x8 ), /* 8 */
|
||||
/* 16 */ NdrFcShort( 0x24 ), /* 36 */
|
||||
/* 18 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */
|
||||
0x5, /* 5 */
|
||||
/* 20 */ 0x8, /* 8 */
|
||||
0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */
|
||||
/* 22 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 24 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 26 */ NdrFcShort( 0x0 ), /* 0 */
|
||||
|
||||
/* Parameter IDL_handle */
|
||||
|
||||
/* 28 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */
|
||||
/* 30 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
|
||||
/* 32 */ 0x8, /* FC_LONG */
|
||||
0x0, /* 0 */
|
||||
|
||||
/* Parameter requestSize */
|
||||
|
||||
/* 34 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */
|
||||
/* 36 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
|
||||
/* 38 */ NdrFcShort( 0x6 ), /* Type Offset=6 */
|
||||
|
||||
/* Parameter request */
|
||||
|
||||
/* 40 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
|
||||
/* 42 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
|
||||
/* 44 */ 0x8, /* FC_LONG */
|
||||
0x0, /* 0 */
|
||||
|
||||
/* Parameter responseSize */
|
||||
|
||||
/* 46 */ NdrFcShort( 0x2013 ), /* Flags: must size, must free, out, srv alloc size=8 */
|
||||
/* 48 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */
|
||||
/* 50 */ NdrFcShort( 0x16 ), /* Type Offset=22 */
|
||||
|
||||
/* Parameter response */
|
||||
|
||||
/* 52 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
|
||||
/* 54 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */
|
||||
/* 56 */ 0x8, /* FC_LONG */
|
||||
0x0, /* 0 */
|
||||
|
||||
0x0
|
||||
}
|
||||
};
|
||||
|
||||
static const KMSServer_MIDL_TYPE_FORMAT_STRING KMSServer__MIDL_TypeFormatString =
|
||||
{
|
||||
0,
|
||||
{
|
||||
NdrFcShort( 0x0 ), /* 0 */
|
||||
/* 2 */
|
||||
0x11, 0x0, /* FC_RP */
|
||||
/* 4 */ NdrFcShort( 0x2 ), /* Offset= 2 (6) */
|
||||
/* 6 */
|
||||
0x1b, /* FC_CARRAY */
|
||||
0x0, /* 0 */
|
||||
/* 8 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 10 */ 0x28, /* Corr desc: parameter, FC_LONG */
|
||||
0x0, /* */
|
||||
/* 12 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
|
||||
/* 14 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
|
||||
/* 16 */ 0x2, /* FC_CHAR */
|
||||
0x5b, /* FC_END */
|
||||
/* 18 */
|
||||
0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */
|
||||
/* 20 */ 0x8, /* FC_LONG */
|
||||
0x5c, /* FC_PAD */
|
||||
/* 22 */
|
||||
0x11, 0x14, /* FC_RP [alloced_on_stack] [pointer_deref] */
|
||||
/* 24 */ NdrFcShort( 0x2 ), /* Offset= 2 (26) */
|
||||
/* 26 */
|
||||
0x12, 0x0, /* FC_UP */
|
||||
/* 28 */ NdrFcShort( 0x2 ), /* Offset= 2 (30) */
|
||||
/* 30 */
|
||||
0x1b, /* FC_CARRAY */
|
||||
0x0, /* 0 */
|
||||
/* 32 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 34 */ 0x28, /* Corr desc: parameter, FC_LONG */
|
||||
0x54, /* FC_DEREFERENCE */
|
||||
/* 36 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
|
||||
/* 38 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
|
||||
/* 40 */ 0x2, /* FC_CHAR */
|
||||
0x5b, /* FC_END */
|
||||
|
||||
0x0
|
||||
}
|
||||
};
|
||||
|
||||
static const unsigned short KMSServer_FormatStringOffsetTable[] =
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
static const MIDL_STUB_DESC KMSServer_StubDesc =
|
||||
{
|
||||
(void *)& KMSServer___RpcClientInterface,
|
||||
MIDL_user_allocate,
|
||||
MIDL_user_free,
|
||||
&KMSServer__MIDL_AutoBindHandle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
KMSServer__MIDL_TypeFormatString.Format,
|
||||
1, /* -error bounds_check flag */
|
||||
0x50002, /* Ndr library version */
|
||||
0,
|
||||
0x8000253, /* MIDL Version 8.0.595 */
|
||||
0,
|
||||
0,
|
||||
0, /* notify & notify_flag routine table */
|
||||
0x1, /* MIDL flag */
|
||||
0, /* cs routines */
|
||||
0, /* proxy/server info */
|
||||
0
|
||||
};
|
||||
#pragma optimize("", on )
|
||||
#if _MSC_VER >= 1200
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// x64 KMS Client RPC Stubs
|
||||
#if defined(_M_AMD64)
|
||||
|
||||
|
||||
#pragma warning( disable: 4049 ) /* more than 64k source lines */
|
||||
#if _MSC_VER >= 1200
|
||||
#pragma warning(push)
|
||||
#endif
|
||||
|
||||
#pragma warning( disable: 4211 ) /* redefine extern to static */
|
||||
#pragma warning( disable: 4232 ) /* dllimport identity*/
|
||||
#pragma warning( disable: 4024 ) /* array to pointer mapping*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "KMSServer.h"
|
||||
|
||||
#define TYPE_FORMAT_STRING_SIZE 43
|
||||
#define PROC_FORMAT_STRING_SIZE 61
|
||||
#define EXPR_FORMAT_STRING_SIZE 1
|
||||
#define TRANSMIT_AS_TABLE_SIZE 0
|
||||
#define WIRE_MARSHAL_TABLE_SIZE 0
|
||||
|
||||
typedef struct _KMSServer_MIDL_TYPE_FORMAT_STRING
|
||||
{
|
||||
short Pad;
|
||||
unsigned char Format[ TYPE_FORMAT_STRING_SIZE ];
|
||||
} KMSServer_MIDL_TYPE_FORMAT_STRING;
|
||||
|
||||
typedef struct _KMSServer_MIDL_PROC_FORMAT_STRING
|
||||
{
|
||||
short Pad;
|
||||
unsigned char Format[ PROC_FORMAT_STRING_SIZE ];
|
||||
} KMSServer_MIDL_PROC_FORMAT_STRING;
|
||||
|
||||
typedef struct _KMSServer_MIDL_EXPR_FORMAT_STRING
|
||||
{
|
||||
long Pad;
|
||||
unsigned char Format[ EXPR_FORMAT_STRING_SIZE ];
|
||||
} KMSServer_MIDL_EXPR_FORMAT_STRING;
|
||||
|
||||
|
||||
static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax =
|
||||
{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}};
|
||||
|
||||
|
||||
extern const KMSServer_MIDL_TYPE_FORMAT_STRING KMSServer__MIDL_TypeFormatString;
|
||||
extern const KMSServer_MIDL_PROC_FORMAT_STRING KMSServer__MIDL_ProcFormatString;
|
||||
extern const KMSServer_MIDL_EXPR_FORMAT_STRING KMSServer__MIDL_ExprFormatString;
|
||||
|
||||
#define GENERIC_BINDING_TABLE_SIZE 0
|
||||
|
||||
|
||||
/* Standard interface: KMSServer, ver. 1.0,
|
||||
GUID={0x51C82175,0x844E,0x4750,{0xB0,0xD8,0xEC,0x25,0x55,0x55,0xBC,0x06}} */
|
||||
|
||||
|
||||
|
||||
static const RPC_CLIENT_INTERFACE KMSServer___RpcClientInterface =
|
||||
{
|
||||
sizeof(RPC_CLIENT_INTERFACE),
|
||||
{{0x51C82175,0x844E,0x4750,{0xB0,0xD8,0xEC,0x25,0x55,0x55,0xBC,0x06}},{1,0}},
|
||||
{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}},
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0x00000000
|
||||
};
|
||||
RPC_IF_HANDLE KMSServer_v1_0_c_ifspec = (RPC_IF_HANDLE)& KMSServer___RpcClientInterface;
|
||||
|
||||
extern const MIDL_STUB_DESC KMSServer_StubDesc;
|
||||
|
||||
static RPC_BINDING_HANDLE KMSServer__MIDL_AutoBindHandle;
|
||||
|
||||
|
||||
int ActivationRequest(
|
||||
/* [in] */ handle_t IDL_handle,
|
||||
/* [in] */ int requestSize,
|
||||
/* [size_is][in] */ unsigned char *request,
|
||||
/* [out] */ int *responseSize,
|
||||
/* [size_is][size_is][out] */ unsigned char **response)
|
||||
{
|
||||
|
||||
CLIENT_CALL_RETURN _RetVal;
|
||||
|
||||
_RetVal = NdrClientCall2(
|
||||
( PMIDL_STUB_DESC )&KMSServer_StubDesc,
|
||||
(PFORMAT_STRING) &KMSServer__MIDL_ProcFormatString.Format[0],
|
||||
IDL_handle,
|
||||
requestSize,
|
||||
request,
|
||||
responseSize,
|
||||
response);
|
||||
return ( int )_RetVal.Simple;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if !defined(__RPC_WIN64__)
|
||||
#error Invalid build platform for this stub.
|
||||
#endif
|
||||
|
||||
static const KMSServer_MIDL_PROC_FORMAT_STRING KMSServer__MIDL_ProcFormatString =
|
||||
{
|
||||
0,
|
||||
{
|
||||
|
||||
/* Procedure ActivationRequest */
|
||||
|
||||
0x0, /* 0 */
|
||||
0x48, /* Old Flags: */
|
||||
/* 2 */ NdrFcLong( 0x0 ), /* 0 */
|
||||
/* 6 */ NdrFcShort( 0x0 ), /* 0 */
|
||||
/* 8 */ NdrFcShort( 0x30 ), /* X64 Stack size/offset = 48 */
|
||||
/* 10 */ 0x32, /* FC_BIND_PRIMITIVE */
|
||||
0x0, /* 0 */
|
||||
/* 12 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */
|
||||
/* 14 */ NdrFcShort( 0x8 ), /* 8 */
|
||||
/* 16 */ NdrFcShort( 0x24 ), /* 36 */
|
||||
/* 18 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */
|
||||
0x5, /* 5 */
|
||||
/* 20 */ 0xa, /* 10 */
|
||||
0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */
|
||||
/* 22 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 24 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 26 */ NdrFcShort( 0x0 ), /* 0 */
|
||||
/* 28 */ NdrFcShort( 0x0 ), /* 0 */
|
||||
|
||||
/* Parameter IDL_handle */
|
||||
|
||||
/* 30 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */
|
||||
/* 32 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
|
||||
/* 34 */ 0x8, /* FC_LONG */
|
||||
0x0, /* 0 */
|
||||
|
||||
/* Parameter requestSize */
|
||||
|
||||
/* 36 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */
|
||||
/* 38 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
|
||||
/* 40 */ NdrFcShort( 0x6 ), /* Type Offset=6 */
|
||||
|
||||
/* Parameter request */
|
||||
|
||||
/* 42 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
|
||||
/* 44 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
|
||||
/* 46 */ 0x8, /* FC_LONG */
|
||||
0x0, /* 0 */
|
||||
|
||||
/* Parameter responseSize */
|
||||
|
||||
/* 48 */ NdrFcShort( 0x2013 ), /* Flags: must size, must free, out, srv alloc size=8 */
|
||||
/* 50 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */
|
||||
/* 52 */ NdrFcShort( 0x16 ), /* Type Offset=22 */
|
||||
|
||||
/* Parameter response */
|
||||
|
||||
/* 54 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
|
||||
/* 56 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */
|
||||
/* 58 */ 0x8, /* FC_LONG */
|
||||
0x0, /* 0 */
|
||||
|
||||
0x0
|
||||
}
|
||||
};
|
||||
|
||||
static const KMSServer_MIDL_TYPE_FORMAT_STRING KMSServer__MIDL_TypeFormatString =
|
||||
{
|
||||
0,
|
||||
{
|
||||
NdrFcShort( 0x0 ), /* 0 */
|
||||
/* 2 */
|
||||
0x11, 0x0, /* FC_RP */
|
||||
/* 4 */ NdrFcShort( 0x2 ), /* Offset= 2 (6) */
|
||||
/* 6 */
|
||||
0x1b, /* FC_CARRAY */
|
||||
0x0, /* 0 */
|
||||
/* 8 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 10 */ 0x28, /* Corr desc: parameter, FC_LONG */
|
||||
0x0, /* */
|
||||
/* 12 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
|
||||
/* 14 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
|
||||
/* 16 */ 0x2, /* FC_CHAR */
|
||||
0x5b, /* FC_END */
|
||||
/* 18 */
|
||||
0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */
|
||||
/* 20 */ 0x8, /* FC_LONG */
|
||||
0x5c, /* FC_PAD */
|
||||
/* 22 */
|
||||
0x11, 0x14, /* FC_RP [alloced_on_stack] [pointer_deref] */
|
||||
/* 24 */ NdrFcShort( 0x2 ), /* Offset= 2 (26) */
|
||||
/* 26 */
|
||||
0x12, 0x0, /* FC_UP */
|
||||
/* 28 */ NdrFcShort( 0x2 ), /* Offset= 2 (30) */
|
||||
/* 30 */
|
||||
0x1b, /* FC_CARRAY */
|
||||
0x0, /* 0 */
|
||||
/* 32 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 34 */ 0x28, /* Corr desc: parameter, FC_LONG */
|
||||
0x54, /* FC_DEREFERENCE */
|
||||
/* 36 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
|
||||
/* 38 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
|
||||
/* 40 */ 0x2, /* FC_CHAR */
|
||||
0x5b, /* FC_END */
|
||||
|
||||
0x0
|
||||
}
|
||||
};
|
||||
|
||||
static const unsigned short KMSServer_FormatStringOffsetTable[] =
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
static const MIDL_STUB_DESC KMSServer_StubDesc =
|
||||
{
|
||||
(void *)& KMSServer___RpcClientInterface,
|
||||
MIDL_user_allocate,
|
||||
MIDL_user_free,
|
||||
&KMSServer__MIDL_AutoBindHandle,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
KMSServer__MIDL_TypeFormatString.Format,
|
||||
1, /* -error bounds_check flag */
|
||||
0x50002, /* Ndr library version */
|
||||
0,
|
||||
0x8000253, /* MIDL Version 8.0.595 */
|
||||
0,
|
||||
0,
|
||||
0, /* notify & notify_flag routine table */
|
||||
0x1, /* MIDL flag */
|
||||
0, /* cs routines */
|
||||
0, /* proxy/server info */
|
||||
0
|
||||
};
|
||||
#if _MSC_VER >= 1200
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,502 @@
|
||||
// Win32 KMS Server RPC Stubs
|
||||
#if !defined(_M_IA64) && !defined(_M_AMD64) && !defined(_ARM_)
|
||||
|
||||
|
||||
#pragma warning( disable: 4049 ) /* more than 64k source lines */
|
||||
#if _MSC_VER >= 1200
|
||||
#pragma warning(push)
|
||||
#endif
|
||||
|
||||
#pragma warning( disable: 4211 ) /* redefine extern to static */
|
||||
#pragma warning( disable: 4232 ) /* dllimport identity*/
|
||||
#pragma warning( disable: 4024 ) /* array to pointer mapping*/
|
||||
#pragma warning( disable: 4100 ) /* unreferenced arguments in x86 call */
|
||||
|
||||
#pragma optimize("", off )
|
||||
|
||||
#include <string.h>
|
||||
#include "KMSServer.h"
|
||||
|
||||
#define TYPE_FORMAT_STRING_SIZE 43
|
||||
#define PROC_FORMAT_STRING_SIZE 59
|
||||
#define EXPR_FORMAT_STRING_SIZE 1
|
||||
#define TRANSMIT_AS_TABLE_SIZE 0
|
||||
#define WIRE_MARSHAL_TABLE_SIZE 0
|
||||
|
||||
typedef struct _KMSServer_MIDL_TYPE_FORMAT_STRING
|
||||
{
|
||||
short Pad;
|
||||
unsigned char Format[ TYPE_FORMAT_STRING_SIZE ];
|
||||
} KMSServer_MIDL_TYPE_FORMAT_STRING;
|
||||
|
||||
typedef struct _KMSServer_MIDL_PROC_FORMAT_STRING
|
||||
{
|
||||
short Pad;
|
||||
unsigned char Format[ PROC_FORMAT_STRING_SIZE ];
|
||||
} KMSServer_MIDL_PROC_FORMAT_STRING;
|
||||
|
||||
typedef struct _KMSServer_MIDL_EXPR_FORMAT_STRING
|
||||
{
|
||||
long Pad;
|
||||
unsigned char Format[ EXPR_FORMAT_STRING_SIZE ];
|
||||
} KMSServer_MIDL_EXPR_FORMAT_STRING;
|
||||
|
||||
|
||||
static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax =
|
||||
{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}};
|
||||
|
||||
extern const KMSServer_MIDL_TYPE_FORMAT_STRING KMSServer__MIDL_TypeFormatString;
|
||||
extern const KMSServer_MIDL_PROC_FORMAT_STRING KMSServer__MIDL_ProcFormatString;
|
||||
extern const KMSServer_MIDL_EXPR_FORMAT_STRING KMSServer__MIDL_ExprFormatString;
|
||||
|
||||
/* Standard interface: KMSServer, ver. 1.0,
|
||||
GUID={0x51C82175,0x844E,0x4750,{0xB0,0xD8,0xEC,0x25,0x55,0x55,0xBC,0x06}} */
|
||||
|
||||
|
||||
extern const MIDL_SERVER_INFO KMSServer_ServerInfo;
|
||||
|
||||
extern const RPC_DISPATCH_TABLE KMSServer_v1_0_DispatchTable;
|
||||
|
||||
static const RPC_SERVER_INTERFACE KMSServer___RpcServerInterface =
|
||||
{
|
||||
sizeof(RPC_SERVER_INTERFACE),
|
||||
{{0x51C82175,0x844E,0x4750,{0xB0,0xD8,0xEC,0x25,0x55,0x55,0xBC,0x06}},{1,0}},
|
||||
{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}},
|
||||
(RPC_DISPATCH_TABLE*)&KMSServer_v1_0_DispatchTable,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&KMSServer_ServerInfo,
|
||||
0x04000000
|
||||
};
|
||||
RPC_IF_HANDLE KMSServer_v1_0_s_ifspec = (RPC_IF_HANDLE)& KMSServer___RpcServerInterface;
|
||||
|
||||
extern const MIDL_STUB_DESC KMSServer_StubDesc;
|
||||
|
||||
|
||||
#if !defined(__RPC_WIN32__)
|
||||
#error Invalid build platform for this stub.
|
||||
#endif
|
||||
|
||||
#if !(TARGET_IS_NT50_OR_LATER)
|
||||
#error You need Windows 2000 or later to run this stub because it uses these features:
|
||||
#error /robust command line switch.
|
||||
#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems.
|
||||
#error This app will fail with the RPC_X_WRONG_STUB_VERSION error.
|
||||
#endif
|
||||
|
||||
|
||||
static const KMSServer_MIDL_PROC_FORMAT_STRING KMSServer__MIDL_ProcFormatString =
|
||||
{
|
||||
0,
|
||||
{
|
||||
|
||||
/* Procedure ActivationResponse */
|
||||
|
||||
0x0, /* 0 */
|
||||
0x48, /* Old Flags: */
|
||||
/* 2 */ NdrFcLong( 0x0 ), /* 0 */
|
||||
/* 6 */ NdrFcShort( 0x0 ), /* 0 */
|
||||
/* 8 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */
|
||||
/* 10 */ 0x32, /* FC_BIND_PRIMITIVE */
|
||||
0x0, /* 0 */
|
||||
/* 12 */ NdrFcShort( 0x0 ), /* x86 Stack size/offset = 0 */
|
||||
/* 14 */ NdrFcShort( 0x8 ), /* 8 */
|
||||
/* 16 */ NdrFcShort( 0x24 ), /* 36 */
|
||||
/* 18 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */
|
||||
0x5, /* 5 */
|
||||
/* 20 */ 0x8, /* 8 */
|
||||
0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */
|
||||
/* 22 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 24 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 26 */ NdrFcShort( 0x0 ), /* 0 */
|
||||
|
||||
/* Parameter IDL_handle */
|
||||
|
||||
/* 28 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */
|
||||
/* 30 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
|
||||
/* 32 */ 0x8, /* FC_LONG */
|
||||
0x0, /* 0 */
|
||||
|
||||
/* Parameter requestSize */
|
||||
|
||||
/* 34 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */
|
||||
/* 36 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
|
||||
/* 38 */ NdrFcShort( 0x6 ), /* Type Offset=6 */
|
||||
|
||||
/* Parameter request */
|
||||
|
||||
/* 40 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
|
||||
/* 42 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
|
||||
/* 44 */ 0x8, /* FC_LONG */
|
||||
0x0, /* 0 */
|
||||
|
||||
/* Parameter responseSize */
|
||||
|
||||
/* 46 */ NdrFcShort( 0x2013 ), /* Flags: must size, must free, out, srv alloc size=8 */
|
||||
/* 48 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */
|
||||
/* 50 */ NdrFcShort( 0x16 ), /* Type Offset=22 */
|
||||
|
||||
/* Parameter response */
|
||||
|
||||
/* 52 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
|
||||
/* 54 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */
|
||||
/* 56 */ 0x8, /* FC_LONG */
|
||||
0x0, /* 0 */
|
||||
|
||||
0x0
|
||||
}
|
||||
};
|
||||
|
||||
static const KMSServer_MIDL_TYPE_FORMAT_STRING KMSServer__MIDL_TypeFormatString =
|
||||
{
|
||||
0,
|
||||
{
|
||||
NdrFcShort( 0x0 ), /* 0 */
|
||||
/* 2 */
|
||||
0x11, 0x0, /* FC_RP */
|
||||
/* 4 */ NdrFcShort( 0x2 ), /* Offset= 2 (6) */
|
||||
/* 6 */
|
||||
0x1b, /* FC_CARRAY */
|
||||
0x0, /* 0 */
|
||||
/* 8 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 10 */ 0x28, /* Corr desc: parameter, FC_LONG */
|
||||
0x0, /* */
|
||||
/* 12 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
|
||||
/* 14 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
|
||||
/* 16 */ 0x2, /* FC_CHAR */
|
||||
0x5b, /* FC_END */
|
||||
/* 18 */
|
||||
0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */
|
||||
/* 20 */ 0x8, /* FC_LONG */
|
||||
0x5c, /* FC_PAD */
|
||||
/* 22 */
|
||||
0x11, 0x14, /* FC_RP [alloced_on_stack] [pointer_deref] */
|
||||
/* 24 */ NdrFcShort( 0x2 ), /* Offset= 2 (26) */
|
||||
/* 26 */
|
||||
0x12, 0x0, /* FC_UP */
|
||||
/* 28 */ NdrFcShort( 0x2 ), /* Offset= 2 (30) */
|
||||
/* 30 */
|
||||
0x1b, /* FC_CARRAY */
|
||||
0x0, /* 0 */
|
||||
/* 32 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 34 */ 0x28, /* Corr desc: parameter, FC_LONG */
|
||||
0x54, /* FC_DEREFERENCE */
|
||||
/* 36 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
|
||||
/* 38 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
|
||||
/* 40 */ 0x2, /* FC_CHAR */
|
||||
0x5b, /* FC_END */
|
||||
|
||||
0x0
|
||||
}
|
||||
};
|
||||
|
||||
static const unsigned short KMSServer_FormatStringOffsetTable[] =
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
static const MIDL_STUB_DESC KMSServer_StubDesc =
|
||||
{
|
||||
(void *)& KMSServer___RpcServerInterface,
|
||||
MIDL_user_allocate,
|
||||
MIDL_user_free,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
KMSServer__MIDL_TypeFormatString.Format,
|
||||
1, /* -error bounds_check flag */
|
||||
0x50002, /* Ndr library version */
|
||||
0,
|
||||
0x8000253, /* MIDL Version 8.0.595 */
|
||||
0,
|
||||
0,
|
||||
0, /* notify & notify_flag routine table */
|
||||
0x1, /* MIDL flag */
|
||||
0, /* cs routines */
|
||||
0, /* proxy/server info */
|
||||
0
|
||||
};
|
||||
|
||||
static const RPC_DISPATCH_FUNCTION KMSServer_table[] =
|
||||
{
|
||||
NdrServerCall2,
|
||||
0
|
||||
};
|
||||
static const RPC_DISPATCH_TABLE KMSServer_v1_0_DispatchTable =
|
||||
{
|
||||
1,
|
||||
(RPC_DISPATCH_FUNCTION*)KMSServer_table
|
||||
};
|
||||
|
||||
static const SERVER_ROUTINE KMSServer_ServerRoutineTable[] =
|
||||
{
|
||||
(SERVER_ROUTINE)ActivationResponse
|
||||
};
|
||||
|
||||
static const MIDL_SERVER_INFO KMSServer_ServerInfo =
|
||||
{
|
||||
&KMSServer_StubDesc,
|
||||
KMSServer_ServerRoutineTable,
|
||||
KMSServer__MIDL_ProcFormatString.Format,
|
||||
KMSServer_FormatStringOffsetTable,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0};
|
||||
#pragma optimize("", on )
|
||||
#if _MSC_VER >= 1200
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// x64 KMS Server RPC Stubs
|
||||
#if defined(_M_AMD64)
|
||||
|
||||
|
||||
#pragma warning( disable: 4049 ) /* more than 64k source lines */
|
||||
#if _MSC_VER >= 1200
|
||||
#pragma warning(push)
|
||||
#endif
|
||||
|
||||
#pragma warning( disable: 4211 ) /* redefine extern to static */
|
||||
#pragma warning( disable: 4232 ) /* dllimport identity*/
|
||||
#pragma warning( disable: 4024 ) /* array to pointer mapping*/
|
||||
|
||||
#include <string.h>
|
||||
#include "KMSServer.h"
|
||||
|
||||
#define TYPE_FORMAT_STRING_SIZE 43
|
||||
#define PROC_FORMAT_STRING_SIZE 61
|
||||
#define EXPR_FORMAT_STRING_SIZE 1
|
||||
#define TRANSMIT_AS_TABLE_SIZE 0
|
||||
#define WIRE_MARSHAL_TABLE_SIZE 0
|
||||
|
||||
typedef struct _KMSServer_MIDL_TYPE_FORMAT_STRING
|
||||
{
|
||||
short Pad;
|
||||
unsigned char Format[ TYPE_FORMAT_STRING_SIZE ];
|
||||
} KMSServer_MIDL_TYPE_FORMAT_STRING;
|
||||
|
||||
typedef struct _KMSServer_MIDL_PROC_FORMAT_STRING
|
||||
{
|
||||
short Pad;
|
||||
unsigned char Format[ PROC_FORMAT_STRING_SIZE ];
|
||||
} KMSServer_MIDL_PROC_FORMAT_STRING;
|
||||
|
||||
typedef struct _KMSServer_MIDL_EXPR_FORMAT_STRING
|
||||
{
|
||||
long Pad;
|
||||
unsigned char Format[ EXPR_FORMAT_STRING_SIZE ];
|
||||
} KMSServer_MIDL_EXPR_FORMAT_STRING;
|
||||
|
||||
|
||||
static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax =
|
||||
{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}};
|
||||
|
||||
extern const KMSServer_MIDL_TYPE_FORMAT_STRING KMSServer__MIDL_TypeFormatString;
|
||||
extern const KMSServer_MIDL_PROC_FORMAT_STRING KMSServer__MIDL_ProcFormatString;
|
||||
extern const KMSServer_MIDL_EXPR_FORMAT_STRING KMSServer__MIDL_ExprFormatString;
|
||||
|
||||
/* Standard interface: KMSServer, ver. 1.0,
|
||||
GUID={0x51C82175,0x844E,0x4750,{0xB0,0xD8,0xEC,0x25,0x55,0x55,0xBC,0x06}} */
|
||||
|
||||
|
||||
extern const MIDL_SERVER_INFO KMSServer_ServerInfo;
|
||||
|
||||
extern const RPC_DISPATCH_TABLE KMSServer_v1_0_DispatchTable;
|
||||
|
||||
static const RPC_SERVER_INTERFACE KMSServer___RpcServerInterface =
|
||||
{
|
||||
sizeof(RPC_SERVER_INTERFACE),
|
||||
{{0x51C82175,0x844E,0x4750,{0xB0,0xD8,0xEC,0x25,0x55,0x55,0xBC,0x06}},{1,0}},
|
||||
{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}},
|
||||
(RPC_DISPATCH_TABLE*)&KMSServer_v1_0_DispatchTable,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&KMSServer_ServerInfo,
|
||||
0x04000000
|
||||
};
|
||||
RPC_IF_HANDLE KMSServer_v1_0_s_ifspec = (RPC_IF_HANDLE)& KMSServer___RpcServerInterface;
|
||||
|
||||
extern const MIDL_STUB_DESC KMSServer_StubDesc;
|
||||
|
||||
|
||||
#if !defined(__RPC_WIN64__)
|
||||
#error Invalid build platform for this stub.
|
||||
#endif
|
||||
|
||||
static const KMSServer_MIDL_PROC_FORMAT_STRING KMSServer__MIDL_ProcFormatString =
|
||||
{
|
||||
0,
|
||||
{
|
||||
|
||||
/* Procedure ActivationResponse */
|
||||
|
||||
0x0, /* 0 */
|
||||
0x48, /* Old Flags: */
|
||||
/* 2 */ NdrFcLong( 0x0 ), /* 0 */
|
||||
/* 6 */ NdrFcShort( 0x0 ), /* 0 */
|
||||
/* 8 */ NdrFcShort( 0x30 ), /* X64 Stack size/offset = 48 */
|
||||
/* 10 */ 0x32, /* FC_BIND_PRIMITIVE */
|
||||
0x0, /* 0 */
|
||||
/* 12 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */
|
||||
/* 14 */ NdrFcShort( 0x8 ), /* 8 */
|
||||
/* 16 */ NdrFcShort( 0x24 ), /* 36 */
|
||||
/* 18 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */
|
||||
0x5, /* 5 */
|
||||
/* 20 */ 0xa, /* 10 */
|
||||
0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */
|
||||
/* 22 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 24 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 26 */ NdrFcShort( 0x0 ), /* 0 */
|
||||
/* 28 */ NdrFcShort( 0x0 ), /* 0 */
|
||||
|
||||
/* Parameter IDL_handle */
|
||||
|
||||
/* 30 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */
|
||||
/* 32 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
|
||||
/* 34 */ 0x8, /* FC_LONG */
|
||||
0x0, /* 0 */
|
||||
|
||||
/* Parameter requestSize */
|
||||
|
||||
/* 36 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */
|
||||
/* 38 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */
|
||||
/* 40 */ NdrFcShort( 0x6 ), /* Type Offset=6 */
|
||||
|
||||
/* Parameter request */
|
||||
|
||||
/* 42 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
|
||||
/* 44 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
|
||||
/* 46 */ 0x8, /* FC_LONG */
|
||||
0x0, /* 0 */
|
||||
|
||||
/* Parameter responseSize */
|
||||
|
||||
/* 48 */ NdrFcShort( 0x2013 ), /* Flags: must size, must free, out, srv alloc size=8 */
|
||||
/* 50 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */
|
||||
/* 52 */ NdrFcShort( 0x16 ), /* Type Offset=22 */
|
||||
|
||||
/* Parameter response */
|
||||
|
||||
/* 54 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
|
||||
/* 56 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */
|
||||
/* 58 */ 0x8, /* FC_LONG */
|
||||
0x0, /* 0 */
|
||||
|
||||
0x0
|
||||
}
|
||||
};
|
||||
|
||||
static const KMSServer_MIDL_TYPE_FORMAT_STRING KMSServer__MIDL_TypeFormatString =
|
||||
{
|
||||
0,
|
||||
{
|
||||
NdrFcShort( 0x0 ), /* 0 */
|
||||
/* 2 */
|
||||
0x11, 0x0, /* FC_RP */
|
||||
/* 4 */ NdrFcShort( 0x2 ), /* Offset= 2 (6) */
|
||||
/* 6 */
|
||||
0x1b, /* FC_CARRAY */
|
||||
0x0, /* 0 */
|
||||
/* 8 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 10 */ 0x28, /* Corr desc: parameter, FC_LONG */
|
||||
0x0, /* */
|
||||
/* 12 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */
|
||||
/* 14 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
|
||||
/* 16 */ 0x2, /* FC_CHAR */
|
||||
0x5b, /* FC_END */
|
||||
/* 18 */
|
||||
0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */
|
||||
/* 20 */ 0x8, /* FC_LONG */
|
||||
0x5c, /* FC_PAD */
|
||||
/* 22 */
|
||||
0x11, 0x14, /* FC_RP [alloced_on_stack] [pointer_deref] */
|
||||
/* 24 */ NdrFcShort( 0x2 ), /* Offset= 2 (26) */
|
||||
/* 26 */
|
||||
0x12, 0x0, /* FC_UP */
|
||||
/* 28 */ NdrFcShort( 0x2 ), /* Offset= 2 (30) */
|
||||
/* 30 */
|
||||
0x1b, /* FC_CARRAY */
|
||||
0x0, /* 0 */
|
||||
/* 32 */ NdrFcShort( 0x1 ), /* 1 */
|
||||
/* 34 */ 0x28, /* Corr desc: parameter, FC_LONG */
|
||||
0x54, /* FC_DEREFERENCE */
|
||||
/* 36 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */
|
||||
/* 38 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
|
||||
/* 40 */ 0x2, /* FC_CHAR */
|
||||
0x5b, /* FC_END */
|
||||
|
||||
0x0
|
||||
}
|
||||
};
|
||||
|
||||
static const unsigned short KMSServer_FormatStringOffsetTable[] =
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
static const MIDL_STUB_DESC KMSServer_StubDesc =
|
||||
{
|
||||
(void *)& KMSServer___RpcServerInterface,
|
||||
MIDL_user_allocate,
|
||||
MIDL_user_free,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
KMSServer__MIDL_TypeFormatString.Format,
|
||||
1, /* -error bounds_check flag */
|
||||
0x50002, /* Ndr library version */
|
||||
0,
|
||||
0x8000253, /* MIDL Version 8.0.595 */
|
||||
0,
|
||||
0,
|
||||
0, /* notify & notify_flag routine table */
|
||||
0x1, /* MIDL flag */
|
||||
0, /* cs routines */
|
||||
0, /* proxy/server info */
|
||||
0
|
||||
};
|
||||
|
||||
static const RPC_DISPATCH_FUNCTION KMSServer_table[] =
|
||||
{
|
||||
NdrServerCall2,
|
||||
0
|
||||
};
|
||||
static const RPC_DISPATCH_TABLE KMSServer_v1_0_DispatchTable =
|
||||
{
|
||||
1,
|
||||
(RPC_DISPATCH_FUNCTION*)KMSServer_table
|
||||
};
|
||||
|
||||
static const SERVER_ROUTINE KMSServer_ServerRoutineTable[] =
|
||||
{
|
||||
(SERVER_ROUTINE)ActivationResponse
|
||||
};
|
||||
|
||||
static const MIDL_SERVER_INFO KMSServer_ServerInfo =
|
||||
{
|
||||
&KMSServer_StubDesc,
|
||||
KMSServer_ServerRoutineTable,
|
||||
KMSServer__MIDL_ProcFormatString.Format,
|
||||
KMSServer_FormatStringOffsetTable,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0};
|
||||
#if _MSC_VER >= 1200
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "KMSServer.h"
|
||||
|
||||
// Memory allocation function for RPC.
|
||||
// The runtime uses these two functions for allocating/deallocating
|
||||
// enough memory to pass the string to the server.
|
||||
void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len)
|
||||
{
|
||||
return malloc(len);
|
||||
}
|
||||
|
||||
// Memory deallocation function for RPC.
|
||||
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
Reference in new issue
Block a user