fix vista kms4k, add reset support
This commit is contained in:
parent
6d759899d8
commit
f2ad15e5a2
@ -1,6 +1,7 @@
|
|||||||
namespace LibTSforge.Activators
|
namespace LibTSforge.Activators
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using LibTSforge.PhysicalStore;
|
using LibTSforge.PhysicalStore;
|
||||||
using LibTSforge.SPP;
|
using LibTSforge.SPP;
|
||||||
|
|
||||||
@ -62,12 +63,18 @@ namespace LibTSforge.Activators
|
|||||||
{
|
{
|
||||||
VistaTimer vistaTimer = new VistaTimer();
|
VistaTimer vistaTimer = new VistaTimer();
|
||||||
vistaTimer.Time = time2;
|
vistaTimer.Time = time2;
|
||||||
vistaTimer.Expiry = expiry;
|
vistaTimer.Expiry = Constants.TimerMax;
|
||||||
|
|
||||||
string vistaTimerName = string.Format("msft:sl/timer/VLExpiration/VOLUME/{0}/{1}", appId, actId);
|
string vistaTimerName = string.Format("msft:sl/timer/VLExpiration/VOLUME/{0}/{1}", appId, actId);
|
||||||
|
|
||||||
store.DeleteBlock(key, vistaTimerName);
|
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[]
|
store.AddBlocks(new PSBlock[]
|
||||||
{
|
{
|
||||||
@ -84,8 +91,8 @@ namespace LibTSforge.Activators
|
|||||||
Type = BlockType.NAMED,
|
Type = BlockType.NAMED,
|
||||||
Flags = 0,
|
Flags = 0,
|
||||||
KeyAsStr = key,
|
KeyAsStr = key,
|
||||||
ValueAsStr = "45E81E65-6944-422E-9C02-D83F7E5F5A58",
|
ValueAsStr = actId.ToString(),
|
||||||
Data = new Guid().ToByteArray()
|
Data = kmsData
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -191,7 +198,7 @@ namespace LibTSforge.Activators
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SPPUtils.RestartSPP(version);
|
SPPUtils.RestartSPP(version);
|
||||||
SLApi.FireStateChangedEvent(appId);
|
SLApi.FireStateChangedEvent(appId);
|
||||||
Logger.WriteLine("Activated using KMS4k successfully.");
|
Logger.WriteLine("Activated using KMS4k successfully.");
|
||||||
}
|
}
|
||||||
|
@ -87,8 +87,8 @@ namespace LibTSforge
|
|||||||
0x92, 0xA6, 0x56, 0x96
|
0x92, 0xA6, 0x56, 0x96
|
||||||
};
|
};
|
||||||
|
|
||||||
// 2^31 - 1 minutes
|
// 2^31 - 8 minutes
|
||||||
public static ulong TimerMax = (ulong)TimeSpan.FromMinutes(2147483647).Ticks;
|
public static ulong TimerMax = (ulong)TimeSpan.FromMinutes(2147483640).Ticks;
|
||||||
|
|
||||||
public static readonly string ZeroCID = new string('0', 48);
|
public static readonly string ZeroCID = new string('0', 48);
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,14 @@ namespace LibTSforge.Modifiers
|
|||||||
using LibTSforge.PhysicalStore;
|
using LibTSforge.PhysicalStore;
|
||||||
using LibTSforge.SPP;
|
using LibTSforge.SPP;
|
||||||
using LibTSforge;
|
using LibTSforge;
|
||||||
|
using System;
|
||||||
|
|
||||||
public static class KeyChangeLockDelete
|
public static class KeyChangeLockDelete
|
||||||
{
|
{
|
||||||
public static void Delete(PSVersion version, bool production)
|
public static void Delete(PSVersion version, bool production)
|
||||||
{
|
{
|
||||||
|
if (version == PSVersion.Vista) throw new NotSupportedException("This feature is not supported on Windows Vista/Server 2008.");
|
||||||
|
|
||||||
SPPUtils.KillSPP(version);
|
SPPUtils.KillSPP(version);
|
||||||
Logger.WriteLine("Writing TrustedStore data...");
|
Logger.WriteLine("Writing TrustedStore data...");
|
||||||
using (IPhysicalStore store = SPPUtils.GetStore(version, production))
|
using (IPhysicalStore store = SPPUtils.GetStore(version, production))
|
||||||
|
@ -2,6 +2,7 @@ namespace LibTSforge.Modifiers
|
|||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using LibTSforge.PhysicalStore;
|
using LibTSforge.PhysicalStore;
|
||||||
using LibTSforge.SPP;
|
using LibTSforge.SPP;
|
||||||
@ -18,7 +19,11 @@ namespace LibTSforge.Modifiers
|
|||||||
{
|
{
|
||||||
List<PSBlock> blocks;
|
List<PSBlock> blocks;
|
||||||
|
|
||||||
if (version == PSVersion.Win7)
|
if (version == PSVersion.Vista)
|
||||||
|
{
|
||||||
|
blocks = store.FindBlocks("740D70D8-6448-4b2f-9063-4A7A463600C5").ToList();
|
||||||
|
}
|
||||||
|
else if (version == PSVersion.Win7)
|
||||||
{
|
{
|
||||||
blocks = store.FindBlocks(0xA0000).ToList();
|
blocks = store.FindBlocks(0xA0000).ToList();
|
||||||
}
|
}
|
||||||
@ -29,7 +34,11 @@ namespace LibTSforge.Modifiers
|
|||||||
|
|
||||||
foreach (PSBlock block in blocks)
|
foreach (PSBlock block in blocks)
|
||||||
{
|
{
|
||||||
if (version == PSVersion.Win7)
|
if (version == PSVersion.Vista)
|
||||||
|
{
|
||||||
|
store.DeleteBlock(block.KeyAsStr, block.ValueAsStr);
|
||||||
|
}
|
||||||
|
else if (version == PSVersion.Win7)
|
||||||
{
|
{
|
||||||
store.SetBlock(block.KeyAsStr, block.ValueAsInt, new byte[8]);
|
store.SetBlock(block.KeyAsStr, block.ValueAsInt, new byte[8]);
|
||||||
}
|
}
|
||||||
|
@ -15,21 +15,24 @@ namespace LibTSforge.Modifiers
|
|||||||
|
|
||||||
using (IPhysicalStore store = SPPUtils.GetStore(version, production))
|
using (IPhysicalStore store = SPPUtils.GetStore(version, production))
|
||||||
{
|
{
|
||||||
if (version != PSVersion.Win7)
|
if (version == PSVersion.Vista)
|
||||||
{
|
{
|
||||||
string recreatedFlag = "__##USERSEP-RESERVED##__$$RECREATED-FLAG$$";
|
DeleteFlag(store, "6BE8425B-E3CF-4e86-A6AF-5863E3DCB606");
|
||||||
string recoveredFlag = "__##USERSEP-RESERVED##__$$RECOVERED-FLAG$$";
|
}
|
||||||
|
else if (version == PSVersion.Win7)
|
||||||
DeleteFlag(store, recreatedFlag);
|
{
|
||||||
DeleteFlag(store, recoveredFlag);
|
SetFlag(store, 0xA0001);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetFlag(store, 0xA0001);
|
DeleteFlag(store, "__##USERSEP-RESERVED##__$$RECREATED-FLAG$$");
|
||||||
|
DeleteFlag(store, "__##USERSEP-RESERVED##__$$RECOVERED-FLAG$$");
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.WriteLine("Successfully cleared the tamper state.");
|
Logger.WriteLine("Successfully cleared the tamper state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPPUtils.RestartSPP(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void DeleteFlag(IPhysicalStore store, string flag)
|
private static void DeleteFlag(IPhysicalStore store, string flag)
|
||||||
|
@ -252,6 +252,8 @@ namespace LibTSforge.SPP
|
|||||||
File.WriteAllBytes(filePath, PhysStoreCrypto.DecryptPhysicalStore(encrData, production, version));
|
File.WriteAllBytes(filePath, PhysStoreCrypto.DecryptPhysicalStore(encrData, production, version));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RestartSPP(version);
|
||||||
|
|
||||||
Logger.WriteLine("Store dumped successfully to '" + filePath + "'.");
|
Logger.WriteLine("Store dumped successfully to '" + filePath + "'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,6 +271,8 @@ namespace LibTSforge.SPP
|
|||||||
store.WriteRaw(File.ReadAllBytes(filePath));
|
store.WriteRaw(File.ReadAllBytes(filePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RestartSPP(version);
|
||||||
|
|
||||||
Logger.WriteLine("Loaded store file succesfully.");
|
Logger.WriteLine("Loaded store file succesfully.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user