-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBin2AccentPolicy.cs
59 lines (52 loc) · 1.41 KB
/
Bin2AccentPolicy.cs
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
56
57
58
59
using System;
using System.IO;
using System.Runtime.InteropServices;
class Bin2AccentPolicy
{
enum ACCENT_STATE : int
{
ACCENT_DISABLED = 0,
ACCENT_ENABLE_GRADIENT = 1,
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
ACCENT_ENABLE_BLURBEHIND = 3,
ACCENT_ENABLE_ACRYLICBLURBEHIND = 4,
ACCENT_ENABLE_HOSTBACKDROP = 5,
ACCENT_INVALID_STATE = 6
}
[StructLayout(LayoutKind.Sequential)]
struct ACCENT_POLICY
{
public ACCENT_STATE AccentState;
public uint AccentFlags;
public uint GradientColor;
public int AnimationId;
}
unsafe static int Main(string[] args)
{
try
{
byte *array = stackalloc byte[sizeof(ACCENT_POLICY)];
using (var stream = File.OpenRead(args.Length > 0 ? args[0] : "dump.bin"))
{
if (stream.Length != sizeof(ACCENT_POLICY))
{
throw new InvalidDataException();
}
stream.CopyTo(new UnmanagedMemoryStream(array, 0, sizeof(ACCENT_POLICY), FileAccess.Write));
}
ACCENT_POLICY *policy = (ACCENT_POLICY *)array;
Console.WriteLine("Accent State: {0}", policy->AccentState);
Console.WriteLine("Accent Flags: {0}", policy->AccentFlags);
Console.WriteLine("Gradient Color: 0x{0:X}", policy->GradientColor.ToString("X"));
Console.WriteLine("Animation Id: {0}", policy->AnimationId);
return 0;
}
catch (Exception exc)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(exc.Message);
Console.ResetColor();
return 1;
}
}
}