Skip to content

Commit a19cdba

Browse files
committed
Upgrade to v2.6.4
修复在使用 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)
1 parent dd2bed1 commit a19cdba

9 files changed

+111
-29
lines changed

CMWTAT_DIGITAL/CMWTAT_DIGITAL.csproj

+11-3
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,14 @@
111111
<Generator>MSBuild:Compile</Generator>
112112
<SubType>Designer</SubType>
113113
</Page>
114+
<Page Include="Lang\fr.xaml">
115+
<Generator>MSBuild:Compile</Generator>
116+
<SubType>Designer</SubType>
117+
</Page>
118+
<Page Include="Lang\ru.xaml">
119+
<Generator>MSBuild:Compile</Generator>
120+
<SubType>Designer</SubType>
121+
</Page>
114122
<Page Include="Lang\zh.xaml">
115123
<SubType>Designer</SubType>
116124
<Generator>MSBuild:Compile</Generator>
@@ -189,11 +197,11 @@
189197
<ItemGroup>
190198
<Folder Include="bin\Debug\" />
191199
</ItemGroup>
192-
<ItemGroup>
193-
<Resource Include="Lang\fr.xml" />
194-
</ItemGroup>
195200
<ItemGroup>
196201
<Content Include="Res\ClipUp.exe" />
202+
<Content Include="Res\gatherosstate.exe" />
203+
<Content Include="Res\gatherosstateltsc.exe" />
204+
<Content Include="Res\slc.dll" />
197205
<EmbeddedResource Include="Res\LibGatherOsState.dll" />
198206
</ItemGroup>
199207
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
File renamed without changes.

CMWTAT_DIGITAL/MainWindow.xaml.cs

+59-24
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
using System.Globalization;
2626
using System.Reflection;
2727
using MaterialDesignThemes.Wpf;
28+
using System.IO.Pipes;
2829

2930
namespace CMWTAT_DIGITAL
3031
{
@@ -133,9 +134,10 @@ public void ExportTempFile()
133134

134135
ConsoleLog("开始写入缓存文件");
135136
File.WriteAllBytes(tempfile + "ClipUp" + ".exe", Properties.Resources.ClipUp);
136-
//File.WriteAllBytes(tempfile + "LibHWIDx86" + ".dll", Properties.Resources.LibHWIDx86);
137-
//File.WriteAllBytes(tempfile + "LibHWIDx64" + ".dll", Properties.Resources.LibHWIDx64);
138137
File.WriteAllBytes(tempfile + "slmgr" + ".vbs", Properties.Resources.slmgr);
138+
File.WriteAllBytes(tempfile + "gatherosstate" + ".exe", Properties.Resources.gatherosstate);
139+
File.WriteAllBytes(tempfile + "gatherosstateltsc" + ".exe", Properties.Resources.gatherosstateltsc);
140+
File.WriteAllBytes(tempfile + "slc" + ".dll", Properties.Resources.slc);
139141
ConsoleLog("写入缓存文件完毕");
140142
}
141143

@@ -1115,19 +1117,28 @@ private void RunAct()
11151117
}
11161118
}
11171119

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

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

1138+
// 写入注册表模拟激活和产品信息(用于旧版保底方案)
1139+
RunCMD(@"reg add ""HKLM\SYSTEM\Tokens\Kernel"" /v ""Kernel-ProductInfo"" /t REG_DWORD /d " + sku + " /f");
1140+
RunCMD(@"reg add ""HKLM\SYSTEM\Tokens\Kernel"" /v ""Security-SPP-GenuineLocalStatus"" /t REG_DWORD /d 1 /f");
1141+
11311142
actbtn.Dispatcher.Invoke(new Action(() =>
11321143
{
11331144
this.activatingtext.Text = (string)this.Resources["RunAct_Installing_Key"]; //提示正在安装密钥
@@ -1156,25 +1167,29 @@ private void RunAct()
11561167
{
11571168
//长期KMS
11581169
licenseType = LibGatherOsState.GatherOsState.LicenseType.GVLK;
1170+
RunCLI(tempfile + "gatherosstateltsc.exe", tempfile);
1171+
ConsoleLog("进入下一步(CUR:LTSC OLD)");
1172+
}
1173+
else
1174+
{
1175+
RunCLI(tempfile + "gatherosstate.exe", tempfile);
1176+
ConsoleLog("进入下一步(CUR:OLD)");
11591177
}
1160-
1178+
11611179
var result = LibGatherOsState.GatherOsState.GenActivateLicenseXML(licenseType);
11621180

11631181
if (result.state == LibGatherOsState.GatherOsState.ActivateLicenseXMLResultState.OK)
11641182
{
1165-
File.WriteAllText(tempfile + "GenuineTicket.xml", result.xml, Encoding.UTF8);
1166-
ConsoleLog("进入下一步");
1167-
1168-
int try_max_count = 30;
1169-
for (int i = 0; i < try_max_count + 1 && !File.Exists(tempfile + "GenuineTicket.xml"); i++)
1170-
{
1171-
Thread.Sleep(1000);
1172-
ConsoleLog($"检查许可证 重试 {i}/{try_max_count}");
1173-
}
1183+
File.WriteAllText(tempfile + "GenuineTicketvNext.xml", result.xml, Encoding.UTF8);
1184+
ConsoleLog("进入下一步(CUR:VNEXT)");
11741185
}
1175-
1176-
if (File.Exists(tempfile + "GenuineTicket.xml"))
1186+
1187+
var hasOldTicket = File.Exists(tempfile + "GenuineTicket.xml");
1188+
var hasvNextTicket = File.Exists(tempfile + "GenuineTicketvNext.xml");
1189+
1190+
if (hasOldTicket || hasvNextTicket)
11771191
{
1192+
11781193
actbtn.Dispatcher.Invoke(new Action(() =>
11791194
{
11801195
this.activatingtext.Text = (string)this.Resources["RunAct_Getting_digital_license"]; // "Getting digital license";
@@ -1199,8 +1214,13 @@ private void RunAct()
11991214
}));
12001215

12011216
int try_max_count = 30;
1202-
for (int i = 0; i < try_max_count + 1 && File.Exists(tempfile + "GenuineTicket.xml"); i++)
1217+
for (int i = 0; i < try_max_count + 1; i++)
12031218
{
1219+
if (hasOldTicket && !File.Exists(tempfile + "GenuineTicket.xml"))
1220+
{
1221+
break;
1222+
}
1223+
if (hasvNextTicket && !File.Exists(tempfile + "GenuineTicketvNext.xml"))
12041224
Thread.Sleep(1000);
12051225
ConsoleLog($"应用许可证 重试 {i}/{try_max_count}");
12061226
}
@@ -1241,6 +1261,21 @@ private void RunAct()
12411261
}
12421262
//string runend = RunCScript(slmgr_self, "-upk").Trim();
12431263
EndLine:;
1264+
// 此处确保注册表清理一定进行
1265+
try
1266+
{
1267+
actbtn.Dispatcher.Invoke(new Action(() =>
1268+
{
1269+
this.activatingtext.Text = (string)this.Resources["RunAct_Cleaning_changes"]; // "Cleaning changes";
1270+
ShowBallSameDig();
1271+
}));
1272+
1273+
RunCMD(@"reg delete ""HKLM\SYSTEM\Tokens"" /f");
1274+
}
1275+
catch
1276+
{
1277+
ConsoleLog("Delete Reg Error");
1278+
}
12441279
if (code != "200")
12451280
{
12461281
actbtn.Dispatcher.Invoke(new Action(() =>
@@ -1306,7 +1341,7 @@ private void RunCMD_old(string var)
13061341
p.StartInfo.RedirectStandardOutput = true;//由调用程序获取输出信息
13071342
p.StartInfo.CreateNoWindow = true;//不显示程序窗口
13081343
p.Start();//启动程序
1309-
//向CMD窗口发送输入信息:
1344+
//向CMD窗口发送输入信息:
13101345
p.StandardInput.WriteLine(var);
13111346
ConsoleLog(var);
13121347
//p.WaitForExit();
@@ -1321,7 +1356,7 @@ public static string RunCLI(string path, string wdPath, string var = "")
13211356
{
13221357
ConsoleLog(path + " " + var);
13231358
Wow64EnableWow64FsRedirection(false);//关闭文件重定向
1324-
//执行命令行函数
1359+
//执行命令行函数
13251360
try
13261361
{
13271362
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
@@ -1336,7 +1371,7 @@ public static string RunCLI(string path, string wdPath, string var = "")
13361371
//myProcess.Arguments = "/c " & Commands
13371372
//myProcess.StartInfo.StandardOutputEncoding = Encoding.UTF8;
13381373
myProcess.Start();
1339-
myProcess.WaitForExit(60 * 1000);
1374+
myProcess.WaitForExit(120 * 1000);
13401375
StreamReader myStreamReader = myProcess.StandardOutput;
13411376
string myString = myStreamReader.ReadToEnd();
13421377
myProcess.Close();

CMWTAT_DIGITAL/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
5252
// 方法是按如下所示使用“*”: :
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("2.6.3.0")]
55-
[assembly: AssemblyFileVersion("2.6.3.0")]
54+
[assembly: AssemblyVersion("2.6.4.0")]
55+
[assembly: AssemblyFileVersion("2.6.4.0")]

CMWTAT_DIGITAL/Properties/Resources.Designer.cs

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CMWTAT_DIGITAL/Properties/Resources.resx

+9
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@
124124
<data name="CMWTAT_ICON" type="System.Resources.ResXFileRef, System.Windows.Forms">
125125
<value>..\CMWTAT.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
126126
</data>
127+
<data name="gatherosstate" type="System.Resources.ResXFileRef, System.Windows.Forms">
128+
<value>..\Res\gatherosstate.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
129+
</data>
130+
<data name="gatherosstateltsc" type="System.Resources.ResXFileRef, System.Windows.Forms">
131+
<value>..\Res\gatherosstateltsc.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
132+
</data>
133+
<data name="slc" type="System.Resources.ResXFileRef, System.Windows.Forms">
134+
<value>..\Res\slc.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
135+
</data>
127136
<data name="slmgr" type="System.Resources.ResXFileRef, System.Windows.Forms">
128137
<value>..\Res\slmgr.vbs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
129138
</data>

CMWTAT_Digital_Release_2_6_3_0.zip

-4.65 MB
Binary file not shown.
Binary file not shown.

CMWTAT_Digital_Release_2_6_4_0.zip

6.2 MB
Binary file not shown.

0 commit comments

Comments
 (0)