summaryrefslogtreecommitdiff
path: root/LibTSforge/Activators/KMS4K.cs
diff options
context:
space:
mode:
authorWitherOrNot2025-03-03 00:02:36 +0000
committerWitherOrNot2025-03-03 00:02:36 +0000
commitf2ad15e5a25c9cc2cdf0d198927be0562f466156 (patch)
treefa2dda646e5cecf3e5dab1ebe3aa071a0545d0c1 /LibTSforge/Activators/KMS4K.cs
parent6d759899d85939c95f2b97c8e041d7b4865208f9 (diff)
downloadTSforge-f2ad15e5a25c9cc2cdf0d198927be0562f466156.zip
fix vista kms4k, add reset support
Diffstat (limited to 'LibTSforge/Activators/KMS4K.cs')
-rw-r--r--LibTSforge/Activators/KMS4K.cs17
1 files changed, 12 insertions, 5 deletions
diff --git a/LibTSforge/Activators/KMS4K.cs b/LibTSforge/Activators/KMS4K.cs
index 315e082..01b7395 100644
--- a/LibTSforge/Activators/KMS4K.cs
+++ b/LibTSforge/Activators/KMS4K.cs
@@ -1,6 +1,7 @@
namespace LibTSforge.Activators
{
using System;
+ using System.IO;
using LibTSforge.PhysicalStore;
using LibTSforge.SPP;
@@ -62,12 +63,18 @@ namespace LibTSforge.Activators
{
VistaTimer vistaTimer = new VistaTimer();
vistaTimer.Time = time2;
- vistaTimer.Expiry = expiry;
+ vistaTimer.Expiry = Constants.TimerMax;
string vistaTimerName = string.Format("msft:sl/timer/VLExpiration/VOLUME/{0}/{1}", appId, actId);
store.DeleteBlock(key, vistaTimerName);
- store.DeleteBlock(key, "45E81E65-6944-422E-9C02-D83F7E5F5A58");
+ store.DeleteBlock(key, actId.ToString());
+
+ BinaryWriter writer = new BinaryWriter(new MemoryStream());
+ writer.Write(Constants.KMSv4Response.Length);
+ writer.Write(Constants.KMSv4Response);
+ writer.Write(Constants.UniversalHWIDBlock);
+ byte[] kmsData = writer.GetBytes();
store.AddBlocks(new PSBlock[]
{
@@ -84,8 +91,8 @@ namespace LibTSforge.Activators
Type = BlockType.NAMED,
Flags = 0,
KeyAsStr = key,
- ValueAsStr = "45E81E65-6944-422E-9C02-D83F7E5F5A58",
- Data = new Guid().ToByteArray()
+ ValueAsStr = actId.ToString(),
+ Data = kmsData
}
});
}
@@ -191,7 +198,7 @@ namespace LibTSforge.Activators
}
}
- SPPUtils.RestartSPP(version);
+ SPPUtils.RestartSPP(version);
SLApi.FireStateChangedEvent(appId);
Logger.WriteLine("Activated using KMS4k successfully.");
}