Skip to content

Commit

Permalink
Tool 0.3.3 & Library 2023.2.28
Browse files Browse the repository at this point in the history
Better priority support, prettier error handling, bootstat management, updated dependencies, all known feature names as of 3/22/2023
  • Loading branch information
thebookisclosed committed Mar 23, 2023
1 parent cae5214 commit 97195a4
Show file tree
Hide file tree
Showing 22 changed files with 749 additions and 105 deletions.
558 changes: 551 additions & 7 deletions Extra/FeatureDictionary.pfs

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions ViVe.sln
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29306.81
# Visual Studio Version 17
VisualStudioVersion = 17.4.33403.182
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ViVe", "ViVe\ViVe.csproj", "{80DCDA4D-8022-4740-8CCF-459DD3FE6F72}"
EndProject
Expand All @@ -10,17 +10,27 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM64 = Debug|ARM64
Release|Any CPU = Release|Any CPU
Release|ARM64 = Release|ARM64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{80DCDA4D-8022-4740-8CCF-459DD3FE6F72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80DCDA4D-8022-4740-8CCF-459DD3FE6F72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80DCDA4D-8022-4740-8CCF-459DD3FE6F72}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{80DCDA4D-8022-4740-8CCF-459DD3FE6F72}.Debug|ARM64.Build.0 = Debug|Any CPU
{80DCDA4D-8022-4740-8CCF-459DD3FE6F72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80DCDA4D-8022-4740-8CCF-459DD3FE6F72}.Release|Any CPU.Build.0 = Release|Any CPU
{80DCDA4D-8022-4740-8CCF-459DD3FE6F72}.Release|ARM64.ActiveCfg = Release|Any CPU
{80DCDA4D-8022-4740-8CCF-459DD3FE6F72}.Release|ARM64.Build.0 = Release|Any CPU
{4DAAB723-3613-4133-AE54-646133538E44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4DAAB723-3613-4133-AE54-646133538E44}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4DAAB723-3613-4133-AE54-646133538E44}.Debug|ARM64.ActiveCfg = Debug|ARM64
{4DAAB723-3613-4133-AE54-646133538E44}.Debug|ARM64.Build.0 = Debug|ARM64
{4DAAB723-3613-4133-AE54-646133538E44}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4DAAB723-3613-4133-AE54-646133538E44}.Release|Any CPU.Build.0 = Release|Any CPU
{4DAAB723-3613-4133-AE54-646133538E44}.Release|ARM64.ActiveCfg = Release|ARM64
{4DAAB723-3613-4133-AE54-646133538E44}.Release|ARM64.Build.0 = Release|ARM64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
27 changes: 14 additions & 13 deletions ViVe/FeatureManager.cs
@@ -1,6 +1,6 @@
/*
ViVe - Windows feature configuration library
Copyright (C) 2019-2022 @thebookisclosed
Copyright (C) 2019-2023 @thebookisclosed
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -80,22 +80,18 @@ public static int SetFeatureConfigurations(RTL_FEATURE_CONFIGURATION_UPDATE[] up

public static int SetFeatureConfigurations(RTL_FEATURE_CONFIGURATION_UPDATE[] updates, RTL_FEATURE_CONFIGURATION_TYPE configurationType, ref ulong previousChangeStamp)
{
foreach (var update in updates)
if (update.Priority == RTL_FEATURE_CONFIGURATION_PRIORITY.ImageDefault ||
update.Priority == RTL_FEATURE_CONFIGURATION_PRIORITY.ImageOverride ||
update.Priority == RTL_FEATURE_CONFIGURATION_PRIORITY.Security)
throw new ArgumentException("ImageDefault (0), Security (9), and ImageOverride (15) priorities are protected and can't be written to.");
else if (update.Priority == RTL_FEATURE_CONFIGURATION_PRIORITY.UserPolicy && !update.UserPolicyPriorityCompatible)
throw new ArgumentException("UserPolicy priority overrides do not support persisting properties other than EnabledState.");

if (configurationType == RTL_FEATURE_CONFIGURATION_TYPE.Runtime)
{
foreach (var update in updates)
if (update.Priority == RTL_FEATURE_CONFIGURATION_PRIORITY.ImageDefault || update.Priority == RTL_FEATURE_CONFIGURATION_PRIORITY.ImageOverride)
throw new ArgumentException("Windows does not support Runtime configuration of features with ImageDefault or ImageOverride priority.");
else if (update.Priority == RTL_FEATURE_CONFIGURATION_PRIORITY.UserPolicy && !update.UserPolicyPriorityCompatible)
throw new ArgumentException("UserPolicy priority features do not support persisting properties other than EnabledState.");
return Ntdll.RtlSetFeatureConfigurations(ref previousChangeStamp, RTL_FEATURE_CONFIGURATION_TYPE.Runtime, updates, updates.Length);
}
else
{
foreach (var update in updates)
if (update.Priority == RTL_FEATURE_CONFIGURATION_PRIORITY.UserPolicy && !update.UserPolicyPriorityCompatible)
throw new ArgumentException("UserPolicy priority features do not support persisting properties other than EnabledState.");
return SetFeatureConfigurationsInRegistry(updates, previousChangeStamp);
}
}

public static IntPtr RegisterFeatureConfigurationChangeNotification(FeatureConfigurationChangeCallback callback)
Expand Down Expand Up @@ -187,6 +183,11 @@ public static bool FixLKGStore()
} catch { return false; }
}

public static int InitializeBootStatusDataFile()
{
return Ntdll.RtlCreateBootStatusDataFile(null);
}

private static int SetFeatureConfigurationsInRegistry(RTL_FEATURE_CONFIGURATION_UPDATE[] updates, ulong previousStamp)
{
// Stamp behavior and return values are taken from equivalent kernel operations for runtime feature configuration
Expand Down
2 changes: 1 addition & 1 deletion ViVe/FeaturePropertyOverflowException.cs
@@ -1,6 +1,6 @@
/*
ViVe - Windows feature configuration library
Copyright (C) 2019-2022 @thebookisclosed
Copyright (C) 2019-2023 @thebookisclosed
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
7 changes: 5 additions & 2 deletions ViVe/NativeEnums.cs
@@ -1,6 +1,6 @@
/*
ViVe - Windows feature configuration library
Copyright (C) 2019-2022 @thebookisclosed
Copyright (C) 2019-2023 @thebookisclosed
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -36,9 +36,12 @@ public enum RTL_FEATURE_ENABLED_STATE : uint
public enum RTL_FEATURE_CONFIGURATION_PRIORITY : uint
{
ImageDefault = 0,
Enrollment = 2,
EKB = 1,
Safeguard = 2,
Service = 4,
Dynamic = 6,
User = 8,
Security = 9,
UserPolicy = 10,
Test = 12,
ImageOverride = 15
Expand Down
5 changes: 4 additions & 1 deletion ViVe/NativeMethods.Ntdll.cs
@@ -1,6 +1,6 @@
/*
ViVe - Windows feature configuration library
Copyright (C) 2019-2022 @thebookisclosed
Copyright (C) 2019-2023 @thebookisclosed
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -116,5 +116,8 @@ IntPtr returnLength
int dataLength,
IntPtr returnLength
);

[DllImport("ntdll.dll", CharSet = CharSet.Unicode)]
public static extern int RtlCreateBootStatusDataFile(string bootStatusPath);
}
}
2 changes: 1 addition & 1 deletion ViVe/NativeStructs.cs
@@ -1,6 +1,6 @@
/*
ViVe - Windows feature configuration library
Copyright (C) 2019-2022 @thebookisclosed
Copyright (C) 2019-2023 @thebookisclosed
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion ViVe/ObfuscationHelpers.cs
@@ -1,6 +1,6 @@
/*
ViVe - Windows feature configuration library
Copyright (C) 2019-2022 @thebookisclosed
Copyright (C) 2019-2023 @thebookisclosed
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
6 changes: 3 additions & 3 deletions ViVe/Properties/AssemblyInfo.cs
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Albacore.ViVe")]
[assembly: AssemblyCopyright("Copyright © @thebookisclosed 2022")]
[assembly: AssemblyCopyright("Copyright © @thebookisclosed 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2022.6.27.0")]
[assembly: AssemblyFileVersion("2022.6.27.0")]
[assembly: AssemblyVersion("2023.2.28.0")]
[assembly: AssemblyFileVersion("2023.2.28.0")]
3 changes: 2 additions & 1 deletion ViVe/ViVe.csproj
Expand Up @@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Albacore.ViVe</RootNamespace>
<AssemblyName>Albacore.ViVe</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
6 changes: 3 additions & 3 deletions ViVeTool/App.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1"/>
</startup>
</configuration>
</configuration>
20 changes: 10 additions & 10 deletions ViVeTool/ArgumentBlock.cs
@@ -1,6 +1,6 @@
/*
ViVe - Windows feature configuration library
Copyright (C) 2019-2022 @thebookisclosed
Copyright (C) 2019-2023 @thebookisclosed
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -26,7 +26,7 @@ static class ArgumentBlock
{
internal static FeatureConfigurationTypeEx? Store;
internal static List<uint> IdList;
internal static FeatureConigurationProperties FeatureConigurationProperties;
internal static FeatureConfigurationProperties FeatureConfigurationProperties;
internal static SubscriptionProperties SubscriptionProperties;
#if SET_LKG_COMMAND
internal static BSD_FEATURE_CONFIGURATION_STATE? LKGStatus;
Expand All @@ -52,7 +52,7 @@ internal static void Initialize(string[] args, ArgumentBlockFlags flags)
flags.HasFlag(ArgumentBlockFlags.VariantPayloadKind) ||
flags.HasFlag(ArgumentBlockFlags.VariantPayload) ||
flags.HasFlag(ArgumentBlockFlags.Priority)))
FeatureConigurationProperties = new FeatureConigurationProperties();
FeatureConfigurationProperties = new FeatureConfigurationProperties();

if (flags != 0 &&
(flags.HasFlag(ArgumentBlockFlags.ReportingKind) ||
Expand Down Expand Up @@ -113,13 +113,13 @@ internal static void Initialize(string[] args, ArgumentBlockFlags flags)
}
else if (flags.HasFlag(ArgumentBlockFlags.EnabledStateOptions) && key == "/experiment")
{
FeatureConigurationProperties.EnabledStateOptions = RTL_FEATURE_ENABLED_STATE_OPTIONS.WexpConfig;
FeatureConfigurationProperties.EnabledStateOptions = RTL_FEATURE_ENABLED_STATE_OPTIONS.WexpConfig;
flags &= ~ArgumentBlockFlags.EnabledStateOptions;
}
else if (flags.HasFlag(ArgumentBlockFlags.Variant) && key == "/variant")
{
if (TryParseDecHexUint(value, out uint parsedVariant))
FeatureConigurationProperties.Variant = parsedVariant;
FeatureConfigurationProperties.Variant = parsedVariant;
flags &= ~ArgumentBlockFlags.Variant;
}
else if (flags.HasFlag(ArgumentBlockFlags.VariantPayloadKind) && key == "/variantpayloadkind")
Expand All @@ -130,25 +130,25 @@ internal static void Initialize(string[] args, ArgumentBlockFlags flags)
HelpMode = true;
return;
}
FeatureConigurationProperties.VariantPayloadKind = parsedKind;
FeatureConfigurationProperties.VariantPayloadKind = parsedKind;
flags &= ~ArgumentBlockFlags.VariantPayloadKind;
}
else if (flags.HasFlag(ArgumentBlockFlags.VariantPayload) && key == "/variantpayload")
{
if (TryParseDecHexUint(value, out uint parsedPayload))
FeatureConigurationProperties.VariantPayload = parsedPayload;
FeatureConfigurationProperties.VariantPayload = parsedPayload;
flags &= ~ArgumentBlockFlags.VariantPayload;
}
else if (flags.HasFlag(ArgumentBlockFlags.Priority) && key == "/priority")
{
if (!Enum.TryParse(value, true, out RTL_FEATURE_CONFIGURATION_PRIORITY parsedPriority) ||
((int)parsedPriority < 1 || (int)parsedPriority > 14))
(uint)parsedPriority > 15)
{
ConsoleEx.WriteErrorLine(Properties.Resources.InvalidEnumSpec, value, "Priority");
HelpMode = true;
return;
}
FeatureConigurationProperties.Priority = parsedPriority;
FeatureConfigurationProperties.Priority = parsedPriority;
flags &= ~ArgumentBlockFlags.Priority;
}
else if (flags.HasFlag(ArgumentBlockFlags.ReportingKind) && key == "/reportingkind")
Expand Down Expand Up @@ -225,7 +225,7 @@ private static bool TryParseDecHexUshort(string input, out ushort output)
}
}

internal class FeatureConigurationProperties
internal class FeatureConfigurationProperties
{
internal RTL_FEATURE_ENABLED_STATE_OPTIONS EnabledStateOptions;
internal uint Variant;
Expand Down
2 changes: 1 addition & 1 deletion ViVeTool/ConsoleEx.cs
@@ -1,6 +1,6 @@
/*
ViVe - Windows feature configuration library
Copyright (C) 2019-2022 @thebookisclosed
Copyright (C) 2019-2023 @thebookisclosed
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion ViVeTool/FeatureNaming.cs
@@ -1,6 +1,6 @@
/*
ViVe - Windows feature configuration library
Copyright (C) 2019-2022 @thebookisclosed
Copyright (C) 2019-2023 @thebookisclosed
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion ViVeTool/NativeMethods.cs
@@ -1,6 +1,6 @@
/*
ViVe - Windows feature configuration library
Copyright (C) 2019-2022 @thebookisclosed
Copyright (C) 2019-2023 @thebookisclosed
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down

0 comments on commit 97195a4

Please sign in to comment.