blob: 4b611b69476cacda00ab15b7e3562ed68b3eea92 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
namespace LibTSforge.Modifiers
{
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using LibTSforge.PhysicalStore;
using LibTSforge.SPP;
public static class RearmReset
{
public static void Reset(PSVersion version, bool production)
{
SPPUtils.KillSPP(version);
Logger.WriteLine("Writing TrustedStore data...");
using (IPhysicalStore store = SPPUtils.GetStore(version, production))
{
List<PSBlock> blocks;
if (version == PSVersion.Vista)
{
blocks = store.FindBlocks("740D70D8-6448-4b2f-9063-4A7A463600C5").ToList();
}
else if (version == PSVersion.Win7)
{
blocks = store.FindBlocks(0xA0000).ToList();
}
else
{
blocks = store.FindBlocks("__##USERSEP-RESERVED##__$$REARM-COUNT$$").ToList();
}
foreach (PSBlock block in blocks)
{
if (version == PSVersion.Vista)
{
store.DeleteBlock(block.KeyAsStr, block.ValueAsStr);
}
else if (version == PSVersion.Win7)
{
store.SetBlock(block.KeyAsStr, block.ValueAsInt, new byte[8]);
}
else
{
store.SetBlock(block.KeyAsStr, block.ValueAsStr, new byte[8]);
}
}
Logger.WriteLine("Successfully reset all rearm counters.");
}
}
}
}
|