Skip to content

Commit fbb64b4

Browse files
committed
Upgrade to v2.7.0
Use cloud services to deliver digital certificates.
1 parent d3d41c5 commit fbb64b4

9 files changed

+48
-128
lines changed

CMWTAT_DIGITAL/CMWTAT_DIGITAL.csproj

-4
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,6 @@
199199
</ItemGroup>
200200
<ItemGroup>
201201
<Content Include="Res\ClipUp.exe" />
202-
<Content Include="Res\gatherosstate.exe" />
203-
<Content Include="Res\gatherosstateltsc.exe" />
204-
<Content Include="Res\slc.dll" />
205-
<EmbeddedResource Include="Res\LibGatherOsState.dll" />
206202
</ItemGroup>
207203
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
208204
<Import Project="..\packages\MaterialDesignThemes.4.5.0\build\MaterialDesignThemes.targets" Condition="Exists('..\packages\MaterialDesignThemes.4.5.0\build\MaterialDesignThemes.targets')" />

CMWTAT_DIGITAL/MainWindow.xaml.cs

+46-79
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ public void ExportTempFile()
135135
ConsoleLog("开始写入缓存文件");
136136
File.WriteAllBytes(tempfile + "ClipUp" + ".exe", Properties.Resources.ClipUp);
137137
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);
141138
ConsoleLog("写入缓存文件完毕");
142139
}
143140

@@ -367,7 +364,7 @@ public MainWindow()
367364
DataContext = new ViewModel();
368365

369366
this.DialogHostGrid.Visibility = Visibility.Visible;
370-
367+
371368
DialogWait.IsOpen = true;
372369
try
373370
{
@@ -446,6 +443,7 @@ private void CheckUpdate()
446443
}
447444
}
448445

446+
public static string StaticServerDomain = "https://uwa-static.cloudmoe.com"; // 静态服务器
449447
public static string MainServerDomain = "https://cmwtat.cloudmoe.com"; // 主要服务器
450448
public static string BackupServerDomain = "https://kms.kumo.moe"; // 备用服务器
451449

@@ -464,14 +462,14 @@ private void LoadOSList()
464462
string json;
465463
try
466464
{
467-
json = GetHttpWebRequest(MainServerDomain + "/api/digital?list=1&ver=3"); // 主要服务器
465+
json = GetHttpWebRequest(MainServerDomain + "/api/digital?list=1&ver=4"); // 主要服务器
468466
}
469467
catch (Exception e)
470468
{
471469
ConsoleLog("MainServer:" + MainServerDomain + " is not working.");
472470
ConsoleLog("Error Message:" + e.Message);
473471
ConsoleLog("Ready to use BackupServer:" + BackupServerDomain);
474-
json = GetHttpWebRequest(BackupServerDomain + "/api/digital?list=1&ver=3"); // 备用服务器
472+
json = GetHttpWebRequest(BackupServerDomain + "/api/digital?list=1&ver=4"); // 备用服务器
475473
}
476474
JObject jsonobj = JObject.Parse(json);
477475
List<Frequency> list = new List<Frequency>();
@@ -661,12 +659,12 @@ private void installbtn_Click(object sender, RoutedEventArgs e)
661659
Thread installthread = new Thread(RunInstall);
662660
installthread.Start();
663661
}
664-
662+
665663
private void upgradefullbtn_Click(object sender, RoutedEventArgs e)
666664
{
667665
this.DialogUpgradeFullVersion.IsOpen = true;
668666
}
669-
667+
670668
private void UpgradeFullVersionWindows_Click(object sender, RoutedEventArgs e)
671669
{
672670
this.DialogUpgradeFullVersion.IsOpen = false;
@@ -781,14 +779,14 @@ private void RunInstall()
781779
string json;
782780
try
783781
{
784-
json = GetHttpWebRequest(MainServerDomain + "/api/digital?list=0&ver=3"); // 主要服务器
782+
json = GetHttpWebRequest(MainServerDomain + "/api/digital?list=0&ver=4"); // 主要服务器
785783
}
786784
catch (Exception e)
787785
{
788786
ConsoleLog("MainServer:" + MainServerDomain + " is not working.");
789787
ConsoleLog("Error Message:" + e.Message);
790788
ConsoleLog("Ready to use BackupServer:" + BackupServerDomain);
791-
json = GetHttpWebRequest(BackupServerDomain + "/api/digital?list=0&ver=3"); // 备用服务器
789+
json = GetHttpWebRequest(BackupServerDomain + "/api/digital?list=0&ver=4"); // 备用服务器
792790
}
793791
JObject jsonobj = JObject.Parse(json);
794792
List<Frequency> list = new List<Frequency>();
@@ -946,7 +944,7 @@ private void RunAct()
946944
string targetFile = slmgr_self;
947945
bool isrewrite = true; // true=覆盖已存在的同名文件,false则反之
948946
ConsoleLog("Copy Start: " + sourceFile + " To " + targetFile);
949-
System.IO.File.Copy(sourceFile, targetFile, isrewrite);
947+
File.Copy(sourceFile, targetFile, isrewrite);
950948
ConsoleLog("Copy Completed.");
951949
}
952950
catch (Exception CopyExc)
@@ -955,7 +953,6 @@ private void RunAct()
955953
}
956954

957955
//旧的位置
958-
//string slmgr_self = System.AppDomain.CurrentDomain.BaseDirectory + "slmgr.vbs";
959956

960957
string changepk = Environment.SystemDirectory + "\\changepk.exe";
961958

@@ -980,14 +977,14 @@ private void RunAct()
980977
string json;
981978
try
982979
{
983-
json = GetHttpWebRequest(MainServerDomain + "/api/digital?list=0&ver=3"); // 主要服务器
980+
json = GetHttpWebRequest(MainServerDomain + "/api/digital?list=0&ver=4"); // 主要服务器
984981
}
985982
catch (Exception e)
986983
{
987984
ConsoleLog("MainServer:" + MainServerDomain + " is not working.");
988985
ConsoleLog("Error Message:" + e.Message);
989986
ConsoleLog("Ready to use BackupServer:" + BackupServerDomain);
990-
json = GetHttpWebRequest(BackupServerDomain + "/api/digital?list=0&ver=3"); // 备用服务器
987+
json = GetHttpWebRequest(BackupServerDomain + "/api/digital?list=0&ver=4"); // 备用服务器
991988
}
992989
JObject jsonobj = JObject.Parse(json);
993990
List<Frequency> list = new List<Frequency>();
@@ -1117,28 +1114,6 @@ private void RunAct()
11171114
}
11181115
}
11191116

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-
}));
1126-
1127-
if (mode == "4")
1128-
{
1129-
//长期KMS
1130-
ConsoleLog(RunCScript(slmgr_self, "-skms 1.1.45.14:1919").Trim()); // いいよ、来いよ www
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"); // 用于旧版保底方案
1136-
}
1137-
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-
11421117
actbtn.Dispatcher.Invoke(new Action(() =>
11431118
{
11441119
this.activatingtext.Text = (string)this.Resources["RunAct_Installing_Key"]; //提示正在安装密钥
@@ -1159,37 +1134,45 @@ private void RunAct()
11591134
ShowBallSameDig();
11601135
}));
11611136

1162-
//LibGatherOsState.GatherOsState.SetLibHWIDPath(tempfile + "LibHWIDx86.dll", tempfile + "LibHWIDx64.dll");
1137+
string ticket = null;
11631138

1164-
var licenseType = LibGatherOsState.GatherOsState.LicenseType.Retail;
1165-
1166-
if (mode == "4")
1139+
try
11671140
{
1168-
//长期KMS
1169-
licenseType = LibGatherOsState.GatherOsState.LicenseType.GVLK;
1170-
RunCLI(tempfile + "gatherosstateltsc.exe", tempfile);
1171-
ConsoleLog("进入下一步(CUR:LTSC OLD)");
1141+
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\ProductOptions", true);
1142+
var packageFamilyName = registryKey.GetValue("OSProductPfn").ToString();
1143+
try
1144+
{
1145+
if (mode == "4")
1146+
{
1147+
//长期KMS
1148+
ticket = GetHttpWebRequest(StaticServerDomain + "/Tickets/KMS.xml");
1149+
}
1150+
else
1151+
{
1152+
ticket = GetHttpWebRequest(StaticServerDomain + "/Tickets/" + packageFamilyName + ".xml");
1153+
}
1154+
//System.Windows.MessageBox.Show(ticket);
1155+
}
1156+
catch (Exception e)
1157+
{
1158+
ConsoleLog("StaticServer:" + StaticServerDomain + " is not working.");
1159+
ConsoleLog("Error Message:" + e.Message);
1160+
}
11721161
}
1173-
else
1162+
catch (Exception e)
11741163
{
1175-
RunCLI(tempfile + "gatherosstate.exe", tempfile);
1176-
ConsoleLog("进入下一步(CUR:OLD)");
1164+
ConsoleLog("Get PackageFamilyName failed.");
1165+
ConsoleLog("Error Message:" + e.Message);
11771166
}
11781167

1179-
var result = LibGatherOsState.GatherOsState.GenActivateLicenseXML(licenseType);
1168+
File.WriteAllText(tempfile + "GenuineTicketvNext.xml", ticket, Encoding.UTF8);
1169+
ConsoleLog("进入下一步(CUR:VNEXT)");
11801170

1181-
if (result.state == LibGatherOsState.GatherOsState.ActivateLicenseXMLResultState.OK)
1182-
{
1183-
File.WriteAllText(tempfile + "GenuineTicketvNext.xml", result.xml, Encoding.UTF8);
1184-
ConsoleLog("进入下一步(CUR:VNEXT)");
1185-
}
1186-
1187-
var hasOldTicket = File.Exists(tempfile + "GenuineTicket.xml");
11881171
var hasvNextTicket = File.Exists(tempfile + "GenuineTicketvNext.xml");
11891172

1190-
if (hasOldTicket || hasvNextTicket)
1173+
if (hasvNextTicket)
11911174
{
1192-
1175+
11931176
actbtn.Dispatcher.Invoke(new Action(() =>
11941177
{
11951178
this.activatingtext.Text = (string)this.Resources["RunAct_Getting_digital_license"]; // "Getting digital license";
@@ -1198,11 +1181,11 @@ private void RunAct()
11981181

11991182
RunCMD(@"sc start wuauserv");
12001183
RunCMD(@"sc start clipsvc");
1201-
1184+
12021185
RunCMD(@"clipup -v -o -altto " + tempfile);
12031186
RunCMD(@"clipup -v -o -altto " + tempfile.TrimEnd('\\')); // 旧版本系统的 ClipUp 路径不能带最后的反斜杠
1204-
if (OSVersionInfo.BuildVersion >= 20348)
1205-
{
1187+
if (OSVersionInfo.BuildVersion >= 20348)
1188+
{
12061189
RunCLI(tempfile + "ClipUp.exe", ".", "-v -o -altto " + tempfile); // 固定版本解决 22H2 后 ARM64 许可证接收问题
12071190
RunCLI(tempfile + "ClipUp.exe", ".", "-v -o -altto " + tempfile.TrimEnd('\\'));
12081191
}
@@ -1216,17 +1199,16 @@ private void RunAct()
12161199
int try_max_count = 30;
12171200
for (int i = 0; i < try_max_count + 1; i++)
12181201
{
1219-
if (hasOldTicket && !File.Exists(tempfile + "GenuineTicket.xml"))
1202+
if (!File.Exists(tempfile + "GenuineTicketvNext.xml"))
12201203
{
12211204
break;
12221205
}
1223-
if (hasvNextTicket && !File.Exists(tempfile + "GenuineTicketvNext.xml"))
12241206
Thread.Sleep(1000);
12251207
ConsoleLog($"应用许可证 重试 {i}/{try_max_count}");
12261208
}
12271209

12281210
runend = RunCScript(slmgr_self, "-ato").Trim();
1229-
1211+
12301212
ConsoleLog(runend);
12311213
if (runend.EndsWith("successfully.") || runend.Contains("0xC004F074") || runend.Contains("0xC004C003")) //0xC004F074 是 KMS38 长期激活会出的提示,Error 0xC004C003: The activation server determined that the specified product key is blocked. 是因为未连接激活服务器,下次连接时会自动激活。
12321214
{
@@ -1261,21 +1243,6 @@ private void RunAct()
12611243
}
12621244
//string runend = RunCScript(slmgr_self, "-upk").Trim();
12631245
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-
}
12791246
if (code != "200")
12801247
{
12811248
actbtn.Dispatcher.Invoke(new Action(() =>
@@ -1510,7 +1477,7 @@ private void UpdateInputMatch()
15101477
try
15111478
{
15121479
if (actbtn != null)
1513-
{
1480+
{
15141481
string pattern = @"^[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}$";
15151482
if (is_auto == false)
15161483
{

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.4.0")]
55-
[assembly: AssemblyFileVersion("2.6.4.0")]
54+
[assembly: AssemblyVersion("2.7.0.0")]
55+
[assembly: AssemblyFileVersion("2.7.0.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,15 +124,6 @@
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>
136127
<data name="slmgr" type="System.Resources.ResXFileRef, System.Windows.Forms">
137128
<value>..\Res\slmgr.vbs;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
138129
</data>

CMWTAT_Digital_Release_2_6_4_0.zip

-6.2 MB
Binary file not shown.
Binary file not shown.

CMWTAT_Digital_Release_2_7_0_0.zip

4.44 MB
Binary file not shown.

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
> Due to the closure of the Microsoft Digital License Issuance service, CMWTAT has temporarily disabled digital license activation. However, this does not affect the "Offline KMS" activation feature. There is no need to update CMWTAT; it should automatically switch to "Offline KMS" activation mode.
2-
3-
> 由于微软数字许可证下发服务关闭,CMWTAT 暂时关闭了数字许可证激活功能,但是这并不影响“离线 KMS”激活功能,无需更新 CMWTAT,它应该会自动切换到“离线 KMS”激活模式。
4-
51
# Official Site 官方网站
62

73
[https://cmwtat.cloudmoe.com]

0 commit comments

Comments
 (0)