summaryrefslogtreecommitdiff
path: root/LibTSforge/Modifiers
diff options
context:
space:
mode:
authorWitherOrNot2025-03-01 07:01:39 +0000
committerWitherOrNot2025-03-01 07:06:21 +0000
commit6d759899d85939c95f2b97c8e041d7b4865208f9 (patch)
tree08e174f929f4ddbbaa687207cf47784b29595f4b /LibTSforge/Modifiers
parent8aa1f9078d786a7b20d2b92bbeefdd77a93dd828 (diff)
downloadTSforge-6d759899d85939c95f2b97c8e041d7b4865208f9.zip
Add partial support (zcid, rtmr, non-functional kms4k) for vista
Co-authored-by: InvoxiPlayGames <[email protected]>
Diffstat (limited to 'LibTSforge/Modifiers')
-rw-r--r--LibTSforge/Modifiers/GenPKeyInstall.cs31
-rw-r--r--LibTSforge/Modifiers/GracePeriodReset.cs6
-rw-r--r--LibTSforge/Modifiers/KMSHostCharge.cs22
-rw-r--r--LibTSforge/Modifiers/KeyChangeLockDelete.cs6
-rw-r--r--LibTSforge/Modifiers/RearmReset.cs5
-rw-r--r--LibTSforge/Modifiers/TamperedFlagsDelete.cs5
-rw-r--r--LibTSforge/Modifiers/UniqueIdDelete.cs8
7 files changed, 46 insertions, 37 deletions
diff --git a/LibTSforge/Modifiers/GenPKeyInstall.cs b/LibTSforge/Modifiers/GenPKeyInstall.cs
index 28d0027..2e4c23d 100644
--- a/LibTSforge/Modifiers/GenPKeyInstall.cs
+++ b/LibTSforge/Modifiers/GenPKeyInstall.cs
@@ -31,6 +31,7 @@ namespace LibTSforge.Modifiers
public static void InstallGenPKey(PSVersion version, bool production, Guid actId)
{
+ if (version == PSVersion.Vista) throw new NotSupportedException("This feature is not supported on Windows Vista/Server 2008.");
if (actId == Guid.Empty) throw new ArgumentException("Activation ID must be specified for generated product key install.");
PKeyConfig pkc = new PKeyConfig();
@@ -72,57 +73,57 @@ namespace LibTSforge.Modifiers
if (pkey.Channel == "Volume:GVLK" && version == PSVersion.Win7) throw new NotSupportedException("Fake GVLK generation is not supported on Windows 7.");
- VariableBag pkb = new VariableBag();
- pkb.Blocks.AddRange(new CRCBlock[]
+ VariableBag pkb = new VariableBag(version);
+ pkb.Blocks.AddRange(new CRCBlockModern[]
{
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.STRING,
KeyAsStr = "SppPkeyBindingProductKey",
ValueAsStr = pkey.ToString()
},
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.STRING,
KeyAsStr = "SppPkeyBindingMPC",
ValueAsStr = pkey.GetMPC()
},
- new CRCBlock {
+ new CRCBlockModern {
DataType = CRCBlockType.BINARY,
KeyAsStr = "SppPkeyBindingPid2",
ValueAsStr = pkey.GetPid2()
},
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.BINARY,
KeyAsStr = "SppPkeyBindingPid3",
Value = pkey.GetPid3()
},
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.BINARY,
KeyAsStr = "SppPkeyBindingPid4",
Value = pkey.GetPid4()
},
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.STRING,
KeyAsStr = "SppPkeyChannelId",
ValueAsStr = pkey.Channel
},
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.STRING,
KeyAsStr = "SppPkeyBindingEditionId",
ValueAsStr = pkey.Edition
},
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.BINARY,
KeyAsStr = (version == PSVersion.Win7) ? "SppPkeyShortAuthenticator" : "SppPkeyPhoneActivationData",
Value = pkey.GetPhoneData(version)
},
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.BINARY,
KeyAsStr = "SppPkeyBindingMiscData",
@@ -140,11 +141,11 @@ namespace LibTSforge.Modifiers
SLApi.UninstallAllProductKeys(appId);
}
- Utils.KillSPP();
+ SPPUtils.KillSPP(version);
- using (IPhysicalStore ps = Utils.GetStore(version, production))
+ using (IPhysicalStore ps = SPPUtils.GetStore(version, production))
{
- using (ITokenStore tks = Utils.GetTokenStore(version))
+ using (ITokenStore tks = SPPUtils.GetTokenStore(version))
{
Logger.WriteLine("Writing to physical store and token store...");
@@ -195,7 +196,7 @@ namespace LibTSforge.Modifiers
Data = pkb.Serialize()
});
- string cachePath = Utils.GetTokensPath(version).Replace("tokens.dat", @"cache\cache.dat");
+ string cachePath = SPPUtils.GetTokensPath(version).Replace("tokens.dat", @"cache\cache.dat");
if (File.Exists(cachePath)) File.Delete(cachePath);
}
}
diff --git a/LibTSforge/Modifiers/GracePeriodReset.cs b/LibTSforge/Modifiers/GracePeriodReset.cs
index 4743ea6..ddca3f7 100644
--- a/LibTSforge/Modifiers/GracePeriodReset.cs
+++ b/LibTSforge/Modifiers/GracePeriodReset.cs
@@ -4,15 +4,16 @@ namespace LibTSforge.Modifiers
using System.Collections.Generic;
using System.Linq;
using LibTSforge.PhysicalStore;
+ using LibTSforge.SPP;
public static class GracePeriodReset
{
public static void Reset(PSVersion version, bool production)
{
- Utils.KillSPP();
+ SPPUtils.KillSPP(version);
Logger.WriteLine("Writing TrustedStore data...");
- using (IPhysicalStore store = Utils.GetStore(version, production))
+ using (IPhysicalStore store = SPPUtils.GetStore(version, production))
{
string value = "msft:sl/timer";
List<PSBlock> blocks = store.FindBlocks(value).ToList();
@@ -23,6 +24,7 @@ namespace LibTSforge.Modifiers
}
}
+ SPPUtils.RestartSPP(version);
Logger.WriteLine("Successfully reset all grace and evaluation period timers.");
}
}
diff --git a/LibTSforge/Modifiers/KMSHostCharge.cs b/LibTSforge/Modifiers/KMSHostCharge.cs
index 5bfabdf..a2f2423 100644
--- a/LibTSforge/Modifiers/KMSHostCharge.cs
+++ b/LibTSforge/Modifiers/KMSHostCharge.cs
@@ -7,7 +7,7 @@ namespace LibTSforge.Modifiers
public static class KMSHostCharge
{
- public static void Charge(PSVersion version, Guid actId, bool production)
+ public static void Charge(PSVersion version, bool production, Guid actId)
{
if (actId == Guid.Empty)
{
@@ -52,46 +52,46 @@ namespace LibTSforge.Modifiers
writer.Write((byte)currClients);
byte[] reqCounts = writer.GetBytes();
- Utils.KillSPP();
+ SPPUtils.KillSPP(version);
Logger.WriteLine("Writing TrustedStore data...");
- using (IPhysicalStore store = Utils.GetStore(version, production))
+ using (IPhysicalStore store = SPPUtils.GetStore(version, production))
{
- VariableBag kmsCountData = new VariableBag();
- kmsCountData.Blocks.AddRange(new CRCBlock[]
+ VariableBag kmsCountData = new VariableBag(version);
+ kmsCountData.Blocks.AddRange(new CRCBlockModern[]
{
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.BINARY,
KeyAsStr = "SppBindingLicenseData",
Value = hwidBlock
},
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.UINT,
Key = new byte[] { },
ValueAsInt = (uint)totalClients
},
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.UINT,
Key = new byte[] { },
ValueAsInt = 1051200000
},
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.UINT,
Key = new byte[] { },
ValueAsInt = (uint)currClients
},
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.BINARY,
Key = new byte[] { },
Value = cmidGuids
},
- new CRCBlock
+ new CRCBlockModern
{
DataType = CRCBlockType.BINARY,
Key = new byte[] { },
diff --git a/LibTSforge/Modifiers/KeyChangeLockDelete.cs b/LibTSforge/Modifiers/KeyChangeLockDelete.cs
index e3f32c4..5150a41 100644
--- a/LibTSforge/Modifiers/KeyChangeLockDelete.cs
+++ b/LibTSforge/Modifiers/KeyChangeLockDelete.cs
@@ -3,14 +3,16 @@ namespace LibTSforge.Modifiers
using System.Collections.Generic;
using System.Linq;
using LibTSforge.PhysicalStore;
+ using LibTSforge.SPP;
using LibTSforge;
+
public static class KeyChangeLockDelete
{
public static void Delete(PSVersion version, bool production)
{
- Utils.KillSPP();
+ SPPUtils.KillSPP(version);
Logger.WriteLine("Writing TrustedStore data...");
- using (IPhysicalStore store = Utils.GetStore(version, production))
+ using (IPhysicalStore store = SPPUtils.GetStore(version, production))
{
List<string> values = new List<string>
{
diff --git a/LibTSforge/Modifiers/RearmReset.cs b/LibTSforge/Modifiers/RearmReset.cs
index be2b174..a17c005 100644
--- a/LibTSforge/Modifiers/RearmReset.cs
+++ b/LibTSforge/Modifiers/RearmReset.cs
@@ -4,16 +4,17 @@ namespace LibTSforge.Modifiers
using System.Collections.Generic;
using System.Linq;
using LibTSforge.PhysicalStore;
+ using LibTSforge.SPP;
public static class RearmReset
{
public static void Reset(PSVersion version, bool production)
{
- Utils.KillSPP();
+ SPPUtils.KillSPP(version);
Logger.WriteLine("Writing TrustedStore data...");
- using (IPhysicalStore store = Utils.GetStore(version, production))
+ using (IPhysicalStore store = SPPUtils.GetStore(version, production))
{
List<PSBlock> blocks;
diff --git a/LibTSforge/Modifiers/TamperedFlagsDelete.cs b/LibTSforge/Modifiers/TamperedFlagsDelete.cs
index 8ffb370..55ba1ec 100644
--- a/LibTSforge/Modifiers/TamperedFlagsDelete.cs
+++ b/LibTSforge/Modifiers/TamperedFlagsDelete.cs
@@ -3,16 +3,17 @@ namespace LibTSforge.Modifiers
using System;
using System.Linq;
using LibTSforge.PhysicalStore;
+ using LibTSforge.SPP;
public static class TamperedFlagsDelete
{
public static void DeleteTamperFlags(PSVersion version, bool production)
{
- Utils.KillSPP();
+ SPPUtils.KillSPP(version);
Logger.WriteLine("Writing TrustedStore data...");
- using (IPhysicalStore store = Utils.GetStore(version, production))
+ using (IPhysicalStore store = SPPUtils.GetStore(version, production))
{
if (version != PSVersion.Win7)
{
diff --git a/LibTSforge/Modifiers/UniqueIdDelete.cs b/LibTSforge/Modifiers/UniqueIdDelete.cs
index b83d328..d1851c4 100644
--- a/LibTSforge/Modifiers/UniqueIdDelete.cs
+++ b/LibTSforge/Modifiers/UniqueIdDelete.cs
@@ -8,6 +8,8 @@ namespace LibTSforge.Modifiers
{
public static void DeleteUniqueId(PSVersion version, bool production, Guid actId)
{
+ if (version == PSVersion.Vista) throw new NotSupportedException("This feature is not supported on Windows Vista/Server 2008.");
+
Guid appId;
if (actId == Guid.Empty)
@@ -28,11 +30,11 @@ namespace LibTSforge.Modifiers
string instId = SLApi.GetInstallationID(actId);
Guid pkeyId = SLApi.GetInstalledPkeyID(actId);
- Utils.KillSPP();
+ SPPUtils.KillSPP(version);
Logger.WriteLine("Writing TrustedStore data...");
- using (IPhysicalStore store = Utils.GetStore(version, production))
+ using (IPhysicalStore store = SPPUtils.GetStore(version, production))
{
string key = string.Format("SPPSVC\\{0}\\{1}", appId, actId);
PSBlock keyBlock = store.GetBlock(key, pkeyId.ToString());
@@ -42,7 +44,7 @@ namespace LibTSforge.Modifiers
throw new Exception("No product key found.");
}
- VariableBag pkb = new VariableBag(keyBlock.Data);
+ VariableBag pkb = new VariableBag(keyBlock.Data, version);
pkb.DeleteBlock("SppPkeyUniqueIdToken");