Skip to content

Commit

Permalink
Upgrade to v2.6.4
Browse files Browse the repository at this point in the history
修复在使用 VirtIO 磁盘虚拟化技术的 Windows 虚拟机中激活报错问题 (issue #54)
Fix activation error in Windows virtual machines using VirtIO disk virtualization technology. (issue #54)
引入了部分旧版本逻辑,使激活速度更快、成功率更高
Introduced some of the old version logic for faster activation and higher success rate.
增加俄语支持(pull #57)
Add Russian language support. (pull #57)
[WIP] 增加法语支持(pull #23)
[WIP] Add French language support. (pull #23)
  • Loading branch information
TGSAN committed Feb 6, 2023
1 parent dd2bed1 commit a19cdba
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 29 deletions.
14 changes: 11 additions & 3 deletions CMWTAT_DIGITAL/CMWTAT_DIGITAL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Lang\fr.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Lang\ru.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Lang\zh.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -189,11 +197,11 @@
<ItemGroup>
<Folder Include="bin\Debug\" />
</ItemGroup>
<ItemGroup>
<Resource Include="Lang\fr.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="Res\ClipUp.exe" />
<Content Include="Res\gatherosstate.exe" />
<Content Include="Res\gatherosstateltsc.exe" />
<Content Include="Res\slc.dll" />
<EmbeddedResource Include="Res\LibGatherOsState.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
File renamed without changes.
83 changes: 59 additions & 24 deletions CMWTAT_DIGITAL/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using System.Globalization;
using System.Reflection;
using MaterialDesignThemes.Wpf;
using System.IO.Pipes;

namespace CMWTAT_DIGITAL
{
Expand Down Expand Up @@ -133,9 +134,10 @@ public void ExportTempFile()

ConsoleLog("开始写入缓存文件");
File.WriteAllBytes(tempfile + "ClipUp" + ".exe", Properties.Resources.ClipUp);
//File.WriteAllBytes(tempfile + "LibHWIDx86" + ".dll", Properties.Resources.LibHWIDx86);
//File.WriteAllBytes(tempfile + "LibHWIDx64" + ".dll", Properties.Resources.LibHWIDx64);
File.WriteAllBytes(tempfile + "slmgr" + ".vbs", Properties.Resources.slmgr);
File.WriteAllBytes(tempfile + "gatherosstate" + ".exe", Properties.Resources.gatherosstate);
File.WriteAllBytes(tempfile + "gatherosstateltsc" + ".exe", Properties.Resources.gatherosstateltsc);
File.WriteAllBytes(tempfile + "slc" + ".dll", Properties.Resources.slc);
ConsoleLog("写入缓存文件完毕");
}

Expand Down Expand Up @@ -1115,19 +1117,28 @@ private void RunAct()
}
}

//写入Win7特征
//ChangePKAction(changepk + " /ProductKey " + key);
//写入旧系统特征(用于旧版保底方案)
actbtn.Dispatcher.Invoke(new Action(() =>
{
this.activatingtext.Text = (string)this.Resources["RunAct_Writing_old_OS"]; // "Writing feature of old Windows version";
ShowBallSameDig();
}));

if (mode == "4")
{
//长期KMS
ConsoleLog(RunCScript(slmgr_self, "-skms 1.1.45.14:1919").Trim()); // いいよ、来いよ www
//ConsoleLog(RunCMD(@"cscript.exe /nologo %systemroot%\system32\slmgr.vbs -skms 1.1.45.14:1919").Trim()); // いいよ、来いよ www
//if (runend.EndsWith("successfully."))
//{
//}
RunCMD(@"reg add ""HKLM\SYSTEM\Tokens"" /v ""Channel"" /t REG_SZ /d ""Volume:GVLK"" /f"); // 用于旧版保底方案
}
else
{
RunCMD(@"reg add ""HKLM\SYSTEM\Tokens"" /v ""Channel"" /t REG_SZ /d ""Retail"" /f"); // 用于旧版保底方案
}

// 写入注册表模拟激活和产品信息(用于旧版保底方案)
RunCMD(@"reg add ""HKLM\SYSTEM\Tokens\Kernel"" /v ""Kernel-ProductInfo"" /t REG_DWORD /d " + sku + " /f");
RunCMD(@"reg add ""HKLM\SYSTEM\Tokens\Kernel"" /v ""Security-SPP-GenuineLocalStatus"" /t REG_DWORD /d 1 /f");

actbtn.Dispatcher.Invoke(new Action(() =>
{
this.activatingtext.Text = (string)this.Resources["RunAct_Installing_Key"]; //提示正在安装密钥
Expand Down Expand Up @@ -1156,25 +1167,29 @@ private void RunAct()
{
//长期KMS
licenseType = LibGatherOsState.GatherOsState.LicenseType.GVLK;
RunCLI(tempfile + "gatherosstateltsc.exe", tempfile);
ConsoleLog("进入下一步(CUR:LTSC OLD)");
}
else
{
RunCLI(tempfile + "gatherosstate.exe", tempfile);
ConsoleLog("进入下一步(CUR:OLD)");
}

var result = LibGatherOsState.GatherOsState.GenActivateLicenseXML(licenseType);

if (result.state == LibGatherOsState.GatherOsState.ActivateLicenseXMLResultState.OK)
{
File.WriteAllText(tempfile + "GenuineTicket.xml", result.xml, Encoding.UTF8);
ConsoleLog("进入下一步");

int try_max_count = 30;
for (int i = 0; i < try_max_count + 1 && !File.Exists(tempfile + "GenuineTicket.xml"); i++)
{
Thread.Sleep(1000);
ConsoleLog($"检查许可证 重试 {i}/{try_max_count}");
}
File.WriteAllText(tempfile + "GenuineTicketvNext.xml", result.xml, Encoding.UTF8);
ConsoleLog("进入下一步(CUR:VNEXT)");
}

if (File.Exists(tempfile + "GenuineTicket.xml"))

var hasOldTicket = File.Exists(tempfile + "GenuineTicket.xml");
var hasvNextTicket = File.Exists(tempfile + "GenuineTicketvNext.xml");

if (hasOldTicket || hasvNextTicket)
{

actbtn.Dispatcher.Invoke(new Action(() =>
{
this.activatingtext.Text = (string)this.Resources["RunAct_Getting_digital_license"]; // "Getting digital license";
Expand All @@ -1199,8 +1214,13 @@ private void RunAct()
}));

int try_max_count = 30;
for (int i = 0; i < try_max_count + 1 && File.Exists(tempfile + "GenuineTicket.xml"); i++)
for (int i = 0; i < try_max_count + 1; i++)
{
if (hasOldTicket && !File.Exists(tempfile + "GenuineTicket.xml"))
{
break;
}
if (hasvNextTicket && !File.Exists(tempfile + "GenuineTicketvNext.xml"))
Thread.Sleep(1000);
ConsoleLog($"应用许可证 重试 {i}/{try_max_count}");
}
Expand Down Expand Up @@ -1241,6 +1261,21 @@ private void RunAct()
}
//string runend = RunCScript(slmgr_self, "-upk").Trim();
EndLine:;
// 此处确保注册表清理一定进行
try
{
actbtn.Dispatcher.Invoke(new Action(() =>
{
this.activatingtext.Text = (string)this.Resources["RunAct_Cleaning_changes"]; // "Cleaning changes";
ShowBallSameDig();
}));

RunCMD(@"reg delete ""HKLM\SYSTEM\Tokens"" /f");
}
catch
{
ConsoleLog("Delete Reg Error");
}
if (code != "200")
{
actbtn.Dispatcher.Invoke(new Action(() =>
Expand Down Expand Up @@ -1306,7 +1341,7 @@ private void RunCMD_old(string var)
p.StartInfo.RedirectStandardOutput = true;//由调用程序获取输出信息
p.StartInfo.CreateNoWindow = true;//不显示程序窗口
p.Start();//启动程序
//向CMD窗口发送输入信息:
//向CMD窗口发送输入信息:
p.StandardInput.WriteLine(var);
ConsoleLog(var);
//p.WaitForExit();
Expand All @@ -1321,7 +1356,7 @@ public static string RunCLI(string path, string wdPath, string var = "")
{
ConsoleLog(path + " " + var);
Wow64EnableWow64FsRedirection(false);//关闭文件重定向
//执行命令行函数
//执行命令行函数
try
{
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
Expand All @@ -1336,7 +1371,7 @@ public static string RunCLI(string path, string wdPath, string var = "")
//myProcess.Arguments = "/c " & Commands
//myProcess.StartInfo.StandardOutputEncoding = Encoding.UTF8;
myProcess.Start();
myProcess.WaitForExit(60 * 1000);
myProcess.WaitForExit(120 * 1000);
StreamReader myStreamReader = myProcess.StandardOutput;
string myString = myStreamReader.ReadToEnd();
myProcess.Close();
Expand Down
4 changes: 2 additions & 2 deletions CMWTAT_DIGITAL/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.6.3.0")]
[assembly: AssemblyFileVersion("2.6.3.0")]
[assembly: AssemblyVersion("2.6.4.0")]
[assembly: AssemblyFileVersion("2.6.4.0")]
30 changes: 30 additions & 0 deletions CMWTAT_DIGITAL/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions CMWTAT_DIGITAL/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@
<data name="CMWTAT_ICON" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\CMWTAT.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="gatherosstate" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Res\gatherosstate.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="gatherosstateltsc" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Res\gatherosstateltsc.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="slc" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Res\slc.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="slmgr" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Res\slmgr.vbs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
Expand Down
Binary file removed CMWTAT_Digital_Release_2_6_3_0.zip
Binary file not shown.
Binary file not shown.
Binary file added CMWTAT_Digital_Release_2_6_4_0.zip
Binary file not shown.

0 comments on commit a19cdba

Please sign in to comment.