### Apply Feature Configuration Updates Source: https://context7.com/thebookisclosed/vive/llms.txt Use this to enable or disable features, or change their variants. Supports Runtime and Boot stores. Throws ArgumentException for invalid configurations. ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeEnums; using Albacore.ViVe.NativeStructs; // Enable a feature at User priority in the Runtime store var updates = new[] { new RTL_FEATURE_CONFIGURATION_UPDATE { FeatureId = 26008830, Priority = RTL_FEATURE_CONFIGURATION_PRIORITY.User, EnabledState = RTL_FEATURE_ENABLED_STATE.Enabled, Operation = RTL_FEATURE_CONFIGURATION_OPERATION.FeatureState | RTL_FEATURE_CONFIGURATION_OPERATION.VariantState } }; try { int result = FeatureManager.SetFeatureConfigurations(updates, RTL_FEATURE_CONFIGURATION_TYPE.Runtime); if (result != 0) Console.Error.WriteLine($"Set failed with NTSTATUS 0x{result:X8}"); else Console.WriteLine("Feature configuration applied successfully."); } catch (ArgumentException ex) { Console.Error.WriteLine($"Invalid update: {ex.Message}"); } // Write to Boot store (persisted across reboot) — also writes registry keys int bootResult = FeatureManager.SetFeatureConfigurations(updates, RTL_FEATURE_CONFIGURATION_TYPE.Boot); Console.WriteLine($"Boot store result: 0x{bootResult:X8}"); ``` -------------------------------- ### Manage Boot Feature Configuration State Source: https://context7.com/thebookisclosed/vive/llms.txt Read and write the LKG boot state using GetBootFeatureConfigurationState and SetBootFeatureConfigurationState. This affects how feature configurations are applied, rolled back, or committed after a reboot. Initialize the BSD file if it's missing. ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeEnums; // Read current boot state int queryResult = FeatureManager.GetBootFeatureConfigurationState(out BSD_FEATURE_CONFIGURATION_STATE state); if (queryResult != 0) Console.Error.WriteLine($"Query failed: 0x{queryResult:X8}"); else Console.WriteLine($"Boot feature state: {state}"); // e.g. Committed // Mark boot store changes as pending a reboot int setResult = FeatureManager.SetBootFeatureConfigurationState(BSD_FEATURE_CONFIGURATION_STATE.BootPending); Console.WriteLine($"Set boot state result: 0x{setResult:X8}"); // Initialize BSD file if missing (STATUS_OBJECT_NAME_NOT_FOUND = 0xC0000034) if ((uint)queryResult == 0xC0000034) { int initResult = FeatureManager.InitializeBootStatusDataFile(); Console.WriteLine($"BSD init result: 0x{initResult:X8}"); } ``` -------------------------------- ### Query All Feature Configurations with ViVe Source: https://context7.com/thebookisclosed/vive/llms.txt Retrieves all active feature configurations from either the Runtime or Boot store. Optionally tracks changes in the Boot store using a change stamp. Returns null if the underlying NTDLL call fails. ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeEnums; using Albacore.ViVe.NativeStructs; // Query all Runtime feature configurations RTL_FEATURE_CONFIGURATION[] configs = FeatureManager.QueryAllFeatureConfigurations(RTL_FEATURE_CONFIGURATION_TYPE.Runtime); if (configs == null) { Console.Error.WriteLine("Failed to query feature configurations."); return; } foreach (var cfg in configs) { Console.WriteLine($"ID={cfg.FeatureId} Priority={cfg.Priority} ({(uint)cfg.Priority}) " + $"State={cfg.EnabledState} Variant={cfg.Variant} " + $"IsWexp={cfg.IsWexpConfiguration}"); } // Query Boot store with change-stamp tracking ulong stamp = 0; RTL_FEATURE_CONFIGURATION[] bootConfigs = FeatureManager.QueryAllFeatureConfigurations(RTL_FEATURE_CONFIGURATION_TYPE.Boot, ref stamp); Console.WriteLine($"Boot store change stamp: {stamp}, entries: {bootConfigs?.Length ?? 0}"); ``` -------------------------------- ### ViVeTool CLI: Application and Dictionary Updates Source: https://context7.com/thebookisclosed/vive/llms.txt Update ViVeTool application and the feature name dictionary using the respective commands. Use /? for per-command help. ```cmd :: Check for ViVeTool app update ViVeTool.exe /appupdate ``` ```cmd :: Update the feature name dictionary ViVeTool.exe /dictupdate ``` ```cmd :: Get per-command help ViVeTool.exe /enable /? ``` ```cmd ViVeTool.exe /query /? ``` -------------------------------- ### Subscribe to Live Feature Configuration Changes Source: https://context7.com/thebookisclosed/vive/llms.txt Register a callback to be notified when feature configurations change. Remember to unregister the subscription when it's no longer needed to prevent memory leaks. ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeMethods; using System; using System.Threading; FeatureConfigurationChangeCallback onChange = (context) => { ulong newStamp = FeatureManager.QueryFeatureConfigurationChangeStamp(); Console.WriteLine($"Feature store changed! New stamp: {newStamp}"); }; IntPtr subscription = FeatureManager.RegisterFeatureConfigurationChangeNotification(onChange); Console.WriteLine("Watching for feature configuration changes. Press Enter to stop."); Console.ReadLine(); int unregResult = FeatureManager.UnregisterFeatureConfigurationChangeNotification(subscription); Console.WriteLine($"Unregistered (result=0x{unregResult:X8})"); ``` -------------------------------- ### ViVeTool CLI: Import/Export and Status Source: https://context7.com/thebookisclosed/vive/llms.txt Export and import feature configurations using ViVeTool.exe. Commands like /lkgstatus, /fixlkg, and /fixpriority help manage system state and resolve issues. ```cmd :: Export both stores to a file ViVeTool.exe /export /store:Both /filename:backup.vvt ``` ```cmd :: Import from file (merging with existing overrides) ViVeTool.exe /import /store:Both /filename:backup.vvt ``` ```cmd :: Import and replace all existing overrides ViVeTool.exe /import /store:Both /filename:backup.vvt /replace ``` ```cmd :: Show current LKG boot state ViVeTool.exe /lkgstatus ``` ```cmd :: Fix corrupted LKG store ViVeTool.exe /fixlkg ``` ```cmd :: Fix features stuck at Service priority (migrates them to User) ViVeTool.exe /fixpriority ``` -------------------------------- ### ViVeTool CLI: Query and Reset Features Source: https://context7.com/thebookisclosed/vive/llms.txt Query specific features or all overrides, and reset feature configurations using ViVeTool.exe. Use /fullreset with caution as it prompts for confirmation. ```cmd :: Query a specific feature ViVeTool.exe /query /id:26008830 ``` ```cmd :: Query all Runtime overrides ViVeTool.exe /query ``` ```cmd :: Query all Boot overrides filtered by priority ViVeTool.exe /query /store:Boot /priority:User ``` ```cmd :: Reset (delete) a specific feature override ViVeTool.exe /reset /id:26008830 ``` ```cmd :: Reset all user-writable overrides (prompts for confirmation) ViVeTool.exe /fullreset ``` -------------------------------- ### FeatureManager.QueryAllFeatureConfigurations Source: https://context7.com/thebookisclosed/vive/llms.txt Retrieves all active feature configurations from either the Runtime or Boot store. It can optionally track changes using a change stamp. ```APIDOC ## FeatureManager.QueryAllFeatureConfigurations — Query all active feature configurations ### Description Returns all `RTL_FEATURE_CONFIGURATION` entries currently present in the Runtime or Boot store. Optionally accepts a `changeStamp` ref to detect concurrent store changes. Returns `null` if the underlying NTDLL call fails. ### Method ```csharp FeatureManager.QueryAllFeatureConfigurations(RTL_FEATURE_CONFIGURATION_TYPE storeType, ref ulong changeStamp = 0) ``` ### Parameters #### Path Parameters - **storeType** (RTL_FEATURE_CONFIGURATION_TYPE) - Required - Specifies whether to query the Runtime or Boot store. - **changeStamp** (ref ulong) - Optional - A reference to a ulong used to track changes in the store. If the store is modified after the stamp is set, the method will return the updated stamp. ### Request Example ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeEnums; using Albacore.ViVe.NativeStructs; // Query all Runtime feature configurations RTL_FEATURE_CONFIGURATION[] configs = FeatureManager.QueryAllFeatureConfigurations(RTL_FEATURE_CONFIGURATION_TYPE.Runtime); if (configs == null) { Console.Error.WriteLine("Failed to query feature configurations."); return; } foreach (var cfg in configs) { Console.WriteLine($"ID={cfg.FeatureId} Priority={(uint)cfg.Priority} State={cfg.EnabledState} Variant={cfg.Variant} IsWexp={cfg.IsWexpConfiguration}"); } // Query Boot store with change-stamp tracking ulong stamp = 0; RTL_FEATURE_CONFIGURATION[] bootConfigs = FeatureManager.QueryAllFeatureConfigurations(RTL_FEATURE_CONFIGURATION_TYPE.Boot, ref stamp); Console.WriteLine($"Boot store change stamp: {stamp}, entries: {bootConfigs?.Length ?? 0}"); ``` ### Response #### Success Response - **RTL_FEATURE_CONFIGURATION[]** - An array of `RTL_FEATURE_CONFIGURATION` structs representing the feature configurations, or `null` if the call fails. #### Response Example ```json [ { "FeatureId": 12345, "Priority": "User", "EnabledState": "Enabled", "Variant": 0, "IsWexpConfiguration": false } ] ``` ``` -------------------------------- ### ViVeTool CLI - Command-line feature toggling Source: https://context7.com/thebookisclosed/vive/llms.txt The reference CLI built on top of ViVe, requiring administrator privileges and Windows 10 build 18963 or newer. Features can be specified by numeric ID or by name. ```APIDOC ## ViVeTool CLI — Command-line feature toggling ViVeTool is the reference CLI built on top of ViVe. It requires administrator privileges and Windows 10 build 18963 or newer. Features can be specified by numeric ID (`/id`) or by name (`/name`) when a feature dictionary (`FeatureDictionary.pfs`) is present alongside the executable. ```cmd :: Enable a feature in the Runtime store (immediate, no reboot required) ViVeTool.exe /enable /id:26008830 :: Disable multiple features at once ViVeTool.exe /disable /id:26008830,35878005,40588570 :: Enable in Boot store (persists across reboots) ViVeTool.exe /enable /id:26008830 /store:Boot :: Enable in both Runtime and Boot stores simultaneously ViVeTool.exe /enable /id:26008830 /store:Both :: Enable with a specific priority (default is User=8) ViVeTool.exe /enable /id:26008830 /priority:Test :: Enable as a Wexp (A/B experiment) configuration ViVeTool.exe /enable /id:26008830 /experiment :: Enable with variant payload ViVeTool.exe /enable /id:26008830 /variant:3 /variantpayloadkind:Resident /variantpayload:42 :: Query a specific feature ViVeTool.exe /query /id:26008830 :: Query all Runtime overrides ViVeTool.exe /query :: Query all Boot overrides filtered by priority ViVeTool.exe /query /store:Boot /priority:User :: Reset (delete) a specific feature override ViVeTool.exe /reset /id:26008830 :: Reset all user-writable overrides (prompts for confirmation) ViVeTool.exe /fullreset :: Export both stores to a file ViVeTool.exe /export /store:Both /filename:backup.vvt :: Import from file (merging with existing overrides) ViVeTool.exe /import /store:Both /filename:backup.vvt :: Import and replace all existing overrides ViVeTool.exe /import /store:Both /filename:backup.vvt /replace :: Show current LKG boot state ViVeTool.exe /lkgstatus :: Fix corrupted LKG store ViVeTool.exe /fixlkg :: Fix features stuck at Service priority (migrates them to User) ViVeTool.exe /fixpriority :: Check for ViVeTool app update ViVeTool.exe /appupdate :: Update the feature name dictionary ViVeTool.exe /dictupdate :: Get per-command help ViVeTool.exe /enable /? ViVeTool.exe /query /? ``` ``` -------------------------------- ### FeatureManager.GetBootFeatureConfigurationState / SetBootFeatureConfigurationState Source: https://context7.com/thebookisclosed/vive/llms.txt Read and write the LKG boot state from the Boot Status Data (BSD) file. This controls feature configuration application, rollback, or commit after a reboot. ```APIDOC ## FeatureManager.GetBootFeatureConfigurationState / SetBootFeatureConfigurationState ### Description Reads or writes the `BSD_FEATURE_CONFIGURATION_STATE` item from the Boot Status Data (BSD) file, which Windows uses to decide whether to apply, roll back, or commit feature configurations after a reboot. States include `BootPending`, `LKGPending`, `RollbackPending`, and `Committed`. ### Method - `GetBootFeatureConfigurationState(out BSD_FEATURE_CONFIGURATION_STATE state)` - `SetBootFeatureConfigurationState(BSD_FEATURE_CONFIGURATION_STATE state)` ### Parameters #### GetBootFeatureConfigurationState - **state** (out BSD_FEATURE_CONFIGURATION_STATE) - Output - The current boot feature configuration state. #### SetBootFeatureConfigurationState - **state** (BSD_FEATURE_CONFIGURATION_STATE) - Required - The desired boot feature configuration state to set. ### Response #### Success Response (Get) - **int** - Returns 0 on success. The state is returned via the `state` output parameter. #### Success Response (Set) - **int** - Returns 0 on success. #### Error Response - **int** - Returns an NTSTATUS error code on failure (e.g., 0xC0000034 for `STATUS_OBJECT_NAME_NOT_FOUND`). ### Request Example ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeEnums; // Read current boot state int queryResult = FeatureManager.GetBootFeatureConfigurationState(out BSD_FEATURE_CONFIGURATION_STATE state); if (queryResult != 0) Console.Error.WriteLine($"Query failed: 0x{queryResult:X8}"); else Console.WriteLine($"Boot feature state: {state}"); // e.g. Committed // Mark boot store changes as pending a reboot int setResult = FeatureManager.SetBootFeatureConfigurationState(BSD_FEATURE_CONFIGURATION_STATE.BootPending); Console.WriteLine($"Set boot state result: 0x{setResult:X8}"); // Initialize BSD file if missing (STATUS_OBJECT_NAME_NOT_FOUND = 0xC0000034) if ((uint)queryResult == 0xC0000034) { int initResult = FeatureManager.InitializeBootStatusDataFile(); Console.WriteLine($"BSD init result: 0x{initResult:X8}"); } ``` ``` -------------------------------- ### Manage Feature Usage Subscriptions with FeatureManager Source: https://context7.com/thebookisclosed/vive/llms.txt Use these methods to subscribe to, query, and unsubscribe from feature usage telemetry. Ensure correct FeatureId, ReportingKind, and ReportingTarget are provided. Runtime and registry subscriptions can be managed separately. ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeStructs; // Add a usage subscription var subs = new[] { new RTL_FEATURE_USAGE_SUBSCRIPTION_DETAILS { FeatureId = 26008830, ReportingKind = 1, ReportingOptions = 0, ReportingTarget = 0x1234567890ABCDEF } }; int addResult = FeatureManager.AddFeatureUsageSubscriptions(subs); Console.WriteLine($"Runtime subscribe result: 0x{addResult:X8}"); int regResult = FeatureManager.AddFeatureUsageSubscriptionsToRegistry(subs); Console.WriteLine($"Registry subscribe result: 0x{regResult:X8}"); // Query all active subscriptions var active = FeatureManager.QueryFeatureUsageSubscriptions(); if (active != null) foreach (var s in active) Console.WriteLine($"Sub: FeatureId={s.FeatureId}, Kind={s.ReportingKind}, Target=0x{s.ReportingTarget:X16}"); // Remove FeatureManager.RemoveFeatureUsageSubscriptions(subs); FeatureManager.RemoveFeatureUsageSubscriptionsFromRegistry(subs); ``` -------------------------------- ### FeatureManager.SetFeatureConfigurations Source: https://context7.com/thebookisclosed/vive/llms.txt Applies one or more feature configuration updates to the Runtime or Boot store. It can throw an ArgumentException for invalid configurations and returns an HRESULT-style integer indicating success or failure. ```APIDOC ## FeatureManager.SetFeatureConfigurations — Apply one or more feature configuration updates Writes an array of `RTL_FEATURE_CONFIGURATION_UPDATE` structs to the Runtime or Boot store. Throws `ArgumentException` if an immutable priority (e.g., `ImageDefault`, `EKB`, `Security`) is targeted, or if `UserPolicy` priority is combined with unsupported properties. Returns an HRESULT-style integer (0 = success). ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeEnums; using Albacore.ViVe.NativeStructs; // Enable a feature at User priority in the Runtime store var updates = new[] { new RTL_FEATURE_CONFIGURATION_UPDATE { FeatureId = 26008830, Priority = RTL_FEATURE_CONFIGURATION_PRIORITY.User, EnabledState = RTL_FEATURE_ENABLED_STATE.Enabled, Operation = RTL_FEATURE_CONFIGURATION_OPERATION.FeatureState | RTL_FEATURE_CONFIGURATION_OPERATION.VariantState } }; try { int result = FeatureManager.SetFeatureConfigurations(updates, RTL_FEATURE_CONFIGURATION_TYPE.Runtime); if (result != 0) Console.Error.WriteLine($"Set failed with NTSTATUS 0x{result:X8}"); else Console.WriteLine("Feature configuration applied successfully."); } catch (ArgumentException ex) { Console.Error.WriteLine($"Invalid update: {ex.Message}"); } // Write to Boot store (persisted across reboot) — also writes registry keys int bootResult = FeatureManager.SetFeatureConfigurations(updates, RTL_FEATURE_CONFIGURATION_TYPE.Boot); Console.WriteLine($"Boot store result: 0x{bootResult:X8}"); ``` ``` -------------------------------- ### NativeMethods.Ntdll - Direct NTDLL P/Invoke exports Source: https://context7.com/thebookisclosed/vive/llms.txt Exposes raw DllImport("ntdll.dll") static methods for direct control over parameters, unsafe pointers, and functionality not surfaced by FeatureManager. ```APIDOC ## NativeMethods.Ntdll — Direct NTDLL P/Invoke exports All Feature Management kernel functions exposed as raw `[DllImport("ntdll.dll")]` static methods. Use these when you need exact control over parameters, unsafe pointers, or functionality not surfaced by `FeatureManager`. ```csharp using Albacore.ViVe.NativeMethods; using Albacore.ViVe.NativeEnums; using Albacore.ViVe.NativeStructs; using System; using System.Runtime.InteropServices; // Direct query of a single feature ulong changeStamp = 0; int hr = Ntdll.RtlQueryFeatureConfiguration( 26008830, RTL_FEATURE_CONFIGURATION_TYPE.Runtime, ref changeStamp, out RTL_FEATURE_CONFIGURATION config); if (hr == 0) Console.WriteLine($"Direct query OK: State={config.EnabledState}"); // Direct bulk query using unsafe pointer unsafe { int count = 0; Ntdll.RtlQueryAllFeatureConfigurations(RTL_FEATURE_CONFIGURATION_TYPE.Runtime, null, null, out count); var buf = new RTL_FEATURE_CONFIGURATION[count]; fixed (RTL_FEATURE_CONFIGURATION* ptr = buf) Ntdll.RtlQueryAllFeatureConfigurations(RTL_FEATURE_CONFIGURATION_TYPE.Runtime, null, ptr, out count); Console.WriteLine($"Total Runtime features: {count}"); } // Read global change stamp ulong stamp = Ntdll.RtlQueryFeatureConfigurationChangeStamp(); Console.WriteLine($"Change stamp: {stamp}"); ``` ``` -------------------------------- ### Query Single Feature Configuration with ViVe Source: https://context7.com/thebookisclosed/vive/llms.txt Retrieves the configuration for a specific feature ID from the Runtime store. Returns a nullable struct, which will be null if the feature is not configured. An overload is available for change stamp tracking. ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeEnums; uint featureId = 26008830; // example: Windows 11 Start menu feature var config = FeatureManager.QueryFeatureConfiguration(featureId, RTL_FEATURE_CONFIGURATION_TYPE.Runtime); if (config == null) { Console.WriteLine($"Feature {featureId} has no Runtime override."); return; } var c = config.Value; Console.WriteLine($"Feature {c.FeatureId}: State={c.EnabledState}, Priority={c.Priority}, " + $"Variant={c.Variant}, PayloadKind={c.VariantPayloadKind}, Payload={c.VariantPayload}"); // Example output: // Feature 26008830: State=Enabled, Priority=User, Variant=0, PayloadKind=None, Payload=0 ``` -------------------------------- ### ViVeTool CLI: Enable/Disable Features Source: https://context7.com/thebookisclosed/vive/llms.txt Use ViVeTool.exe to manage feature configurations. Requires administrator privileges and Windows 10 build 18963+. Features can be specified by numeric ID or name if a FeatureDictionary.pfs is present. ```cmd :: Enable a feature in the Runtime store (immediate, no reboot required) ViVeTool.exe /enable /id:26008830 ``` ```cmd :: Disable multiple features at once ViVeTool.exe /disable /id:26008830,35878005,40588570 ``` ```cmd :: Enable in Boot store (persists across reboots) ViVeTool.exe /enable /id:26008830 /store:Boot ``` ```cmd :: Enable in both Runtime and Boot stores simultaneously ViVeTool.exe /enable /id:26008830 /store:Both ``` ```cmd :: Enable with a specific priority (default is User=8) ViVeTool.exe /enable /id:26008830 /priority:Test ``` ```cmd :: Enable as a Wexp (A/B experiment) configuration ViVeTool.exe /enable /id:26008830 /experiment ``` ```cmd :: Enable with variant payload ViVeTool.exe /enable /id:26008830 /variant:3 /variantpayloadkind:Resident /variantpayload:42 ``` -------------------------------- ### FeatureManager.FixLKGStore Source: https://context7.com/thebookisclosed/vive/llms.txt Repair a corrupted Last Known Good (LKG) store header, often caused by a use-after-free bug in `fcon.dll`. ```APIDOC ## FeatureManager.FixLKGStore ### Description Corrects a corrupted LKG store header caused by a known use-after-free bug in `fcon.dll`. Returns `true` if a fix was applied, `false` if the store was already healthy or inaccessible. ### Method - `FixLKGStore()` ### Response #### Success Response - **bool** - Returns `true` if the LKG store was repaired, `false` otherwise. ### Request Example ```csharp using Albacore.ViVe; bool wasFixed = FeatureManager.FixLKGStore(); Console.WriteLine(wasFixed ? "LKG store was repaired." : "LKG store is healthy or not accessible."); ``` ``` -------------------------------- ### FeatureManager.QueryFeatureConfigurationChangeStamp Source: https://context7.com/thebookisclosed/vive/llms.txt Reads the global feature configuration change counter. This returns a monotonically increasing ulong that increments with each modification, useful for cache invalidation or optimistic concurrency checks. ```APIDOC ## FeatureManager.QueryFeatureConfigurationChangeStamp — Read the global change counter Returns a monotonically increasing `ulong` that increments each time any feature configuration is modified. Useful for cache invalidation or detecting concurrent writes before applying updates. ```csharp using Albacore.ViVe; ulong stamp = FeatureManager.QueryFeatureConfigurationChangeStamp(); Console.WriteLine($"Current change stamp: {stamp}"); // Optimistic-concurrency: only apply update if store hasn't changed ulong previousStamp = stamp; var updates = new[] { /* ... RTL_FEATURE_CONFIGURATION_UPDATE ... */ }; // Will return 0xC0000001 (STATUS_UNSUCCESSFUL) if stamp changed between reads int result = FeatureManager.SetFeatureConfigurations( updates, Albacore.ViVe.NativeEnums.RTL_FEATURE_CONFIGURATION_TYPE.Runtime, ref previousStamp); ``` ``` -------------------------------- ### Direct NTDLL P/Invoke Exports for Feature Management Source: https://context7.com/thebookisclosed/vive/llms.txt Use these raw DllImport methods when exact control over parameters, unsafe pointers, or functionality not surfaced by FeatureManager is needed. Ensure correct NTSTATUS codes are handled. ```csharp using Albacore.ViVe.NativeMethods; using Albacore.ViVe.NativeEnums; using Albacore.ViVe.NativeStructs; using System; using System.Runtime.InteropServices; // Direct query of a single feature ulong changeStamp = 0; int hr = Ntdll.RtlQueryFeatureConfiguration( 26008830, RTL_FEATURE_CONFIGURATION_TYPE.Runtime, ref changeStamp, out RTL_FEATURE_CONFIGURATION config); if (hr == 0) Console.WriteLine($"Direct query OK: State={config.EnabledState}"); // Direct bulk query using unsafe pointer unsafe { int count = 0; Ntdll.RtlQueryAllFeatureConfigurations(RTL_FEATURE_CONFIGURATION_TYPE.Runtime, null, null, out count); var buf = new RTL_FEATURE_CONFIGURATION[count]; fixed (RTL_FEATURE_CONFIGURATION* ptr = buf) Ntdll.RtlQueryAllFeatureConfigurations(RTL_FEATURE_CONFIGURATION_TYPE.Runtime, null, ptr, out count); Console.WriteLine($"Total Runtime features: {count}"); } // Read global change stamp ulong stamp = Ntdll.RtlQueryFeatureConfigurationChangeStamp(); Console.WriteLine($"Change stamp: {stamp}"); ``` -------------------------------- ### FeatureManager.RegisterFeatureConfigurationChangeNotification Source: https://context7.com/thebookisclosed/vive/llms.txt Subscribes to live configuration changes by registering a callback that is triggered when the feature configuration change stamp advances. Returns an opaque IntPtr subscription handle that must be used with UnregisterFeatureConfigurationChangeNotification. ```APIDOC ## FeatureManager.RegisterFeatureConfigurationChangeNotification — Subscribe to live configuration changes Registers a callback that fires whenever the feature configuration change stamp advances (i.e., any feature is modified). Returns an opaque `IntPtr` subscription handle. Call `UnregisterFeatureConfigurationChangeNotification` to stop receiving events. ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeMethods; using System; using System.Threading; FeatureConfigurationChangeCallback onChange = (context) => { ulong newStamp = FeatureManager.QueryFeatureConfigurationChangeStamp(); Console.WriteLine($"Feature store changed! New stamp: {newStamp}"); }; IntPtr subscription = FeatureManager.RegisterFeatureConfigurationChangeNotification(onChange); Console.WriteLine("Watching for feature configuration changes. Press Enter to stop."); Console.ReadLine(); int unregResult = FeatureManager.UnregisterFeatureConfigurationChangeNotification(subscription); Console.WriteLine($"Unregistered (result=0x{unregResult:X8})"); ``` ``` -------------------------------- ### FeatureManager.QueryFeatureConfiguration Source: https://context7.com/thebookisclosed/vive/llms.txt Retrieves the configuration for a specific feature ID from the specified store. Supports change stamp tracking for optimistic concurrency. ```APIDOC ## FeatureManager.QueryFeatureConfiguration — Query a single feature by ID ### Description Retrieves the `RTL_FEATURE_CONFIGURATION` for one specific feature ID. Returns `null` (nullable struct) when the feature is not configured in the chosen store. A `changeStamp` overload is available for optimistic-concurrency workflows. ### Method ```csharp FeatureManager.QueryFeatureConfiguration(uint featureId, RTL_FEATURE_CONFIGURATION_TYPE storeType, ref ulong changeStamp = 0) ``` ### Parameters #### Path Parameters - **featureId** (uint) - Required - The unique identifier of the feature to query. - **storeType** (RTL_FEATURE_CONFIGURATION_TYPE) - Required - Specifies whether to query the Runtime or Boot store. - **changeStamp** (ref ulong) - Optional - A reference to a ulong used to track changes in the store. If the store is modified after the stamp is set, the method will return the updated stamp. ### Request Example ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeEnums; uint featureId = 26008830; // example: Windows 11 Start menu feature var config = FeatureManager.QueryFeatureConfiguration(featureId, RTL_FEATURE_CONFIGURATION_TYPE.Runtime); if (config == null) { Console.WriteLine($"Feature {featureId} has no Runtime override."); return; } var c = config.Value; Console.WriteLine($"Feature {c.FeatureId}: State={c.EnabledState}, Priority={c.Priority}, Variant={c.Variant}, PayloadKind={c.VariantPayloadKind}, Payload={c.VariantPayload}"); ``` ### Response #### Success Response - **RTL_FEATURE_CONFIGURATION?** - A nullable `RTL_FEATURE_CONFIGURATION` struct representing the feature's configuration, or `null` if the feature is not configured in the specified store. #### Response Example ```json { "FeatureId": 26008830, "Priority": "User", "EnabledState": "Enabled", "Variant": 0, "VariantPayloadKind": "None", "VariantPayload": 0 } ``` ``` -------------------------------- ### Obfuscate and Deobfuscate Feature IDs with ObfuscationHelpers Source: https://context7.com/thebookisclosed/vive/llms.txt These helpers are used internally by FeatureManager to transform raw feature IDs into obfuscated names for registry keys and vice versa. Use ObfuscateFeatureId for forward transformation and DeobfuscateFeatureId for reverse. ```csharp using Albacore.ViVe; uint featureId = 26008830; uint obfuscated = ObfuscationHelpers.ObfuscateFeatureId(featureId); uint deobfuscated = ObfuscationHelpers.DeobfuscateFeatureId(obfuscated); Console.WriteLine($"Original: {featureId}"); Console.WriteLine($"Obfuscated: {obfuscated}"); Console.WriteLine($"Round-tripped: {deobfuscated}"); // equals featureId ``` -------------------------------- ### FeatureManager.QueryFeatureUsageSubscriptions / AddFeatureUsageSubscriptions / RemoveFeatureUsageSubscriptions Source: https://context7.com/thebookisclosed/vive/llms.txt Manage feature usage telemetry subscriptions. Query active subscriptions, add new ones, and remove existing ones. These methods interact with runtime subscriptions and optionally persist changes to the registry. ```APIDOC ## FeatureManager.QueryFeatureUsageSubscriptions / AddFeatureUsageSubscriptions / RemoveFeatureUsageSubscriptions ### Description Manage feature usage telemetry subscriptions. `QueryFeatureUsageSubscriptions` returns all active `RTL_FEATURE_USAGE_SUBSCRIPTION_DETAILS` entries; `AddFeatureUsageSubscriptions` registers new ones at Runtime; `RemoveFeatureUsageSubscriptions` unregisters them. Registry-persisting counterparts (`AddFeatureUsageSubscriptionsToRegistry` / `RemoveFeatureUsageSubscriptionsFromRegistry`) write to `HKLM\SYSTEM\CurrentControlSet\Control\FeatureManagement\UsageSubscriptions`. ### Method - `AddFeatureUsageSubscriptions(IEnumerable subscriptions)` - `AddFeatureUsageSubscriptionsToRegistry(IEnumerable subscriptions)` - `QueryFeatureUsageSubscriptions()` - `RemoveFeatureUsageSubscriptions(IEnumerable subscriptions)` - `RemoveFeatureUsageSubscriptionsFromRegistry(IEnumerable subscriptions)` ### Parameters #### AddFeatureUsageSubscriptions / AddFeatureUsageSubscriptionsToRegistry - **subscriptions** (IEnumerable) - Required - The list of feature usage subscription details to add. #### RemoveFeatureUsageSubscriptions / RemoveFeatureUsageSubscriptionsFromRegistry - **subscriptions** (IEnumerable) - Required - The list of feature usage subscription details to remove. ### Response #### Success Response (Add/Remove) - **int** - Returns 0 on success or an NTSTATUS error code on failure. #### Success Response (Query) - **IEnumerable** - A collection of active feature usage subscription details, or null if none are active. ### Request Example ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeStructs; // Add a usage subscription var subs = new[] { new RTL_FEATURE_USAGE_SUBSCRIPTION_DETAILS { FeatureId = 26008830, ReportingKind = 1, ReportingOptions = 0, ReportingTarget = 0x1234567890ABCDEF } }; int addResult = FeatureManager.AddFeatureUsageSubscriptions(subs); Console.WriteLine($"Runtime subscribe result: 0x{addResult:X8}"); int regResult = FeatureManager.AddFeatureUsageSubscriptionsToRegistry(subs); Console.WriteLine($"Registry subscribe result: 0x{regResult:X8}"); // Query all active subscriptions var active = FeatureManager.QueryFeatureUsageSubscriptions(); if (active != null) foreach (var s in active) Console.WriteLine($"Sub: FeatureId={s.FeatureId}, Kind={s.ReportingKind}, Target=0x{s.ReportingTarget:X16}"); // Remove FeatureManager.RemoveFeatureUsageSubscriptions(subs); FeatureManager.RemoveFeatureUsageSubscriptionsFromRegistry(subs); ``` ``` -------------------------------- ### Repair Corrupted LKG Store with FeatureManager.FixLKGStore Source: https://context7.com/thebookisclosed/vive/llms.txt Use FixLKGStore to correct a corrupted LKG store header. The method returns true if a fix was applied, and false if the store was already healthy or inaccessible. This addresses a known bug in fcon.dll. ```csharp using Albacore.ViVe; bool wasFixed = FeatureManager.FixLKGStore(); Console.WriteLine(wasFixed ? "LKG store was repaired." : "LKG store is healthy or not accessible."); ``` -------------------------------- ### Query Feature Configuration Change Stamp Source: https://context7.com/thebookisclosed/vive/llms.txt Retrieve the global change counter to detect modifications. Useful for cache invalidation or optimistic concurrency control. ```csharp using Albacore.ViVe; ulong stamp = FeatureManager.QueryFeatureConfigurationChangeStamp(); Console.WriteLine($"Current change stamp: {stamp}"); // Optimistic-concurrency: only apply update if store hasn't changed ulong previousStamp = stamp; var updates = new[] { /* ... RTL_FEATURE_CONFIGURATION_UPDATE ... */ }; // Will return 0xC0000001 (STATUS_UNSUCCESSFUL) if stamp changed between reads int result = FeatureManager.SetFeatureConfigurations( updates, Albacore.ViVe.NativeEnums.RTL_FEATURE_CONFIGURATION_TYPE.Runtime, ref previousStamp); ``` -------------------------------- ### Emit Feature Usage Telemetry with FeatureManager.NotifyFeatureUsage Source: https://context7.com/thebookisclosed/vive/llms.txt Send a single feature usage report to the kernel. The method returns 0 on success or an NTSTATUS error code. Ensure the RTL_FEATURE_USAGE_REPORT struct is correctly populated. ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeStructs; var report = new RTL_FEATURE_USAGE_REPORT { FeatureId = 26008830, ReportingKind = 1, ReportingOptions = 0 }; int result = FeatureManager.NotifyFeatureUsage(ref report); Console.WriteLine(result == 0 ? "Usage reported." : $"Failed: 0x{result:X8}"); ``` -------------------------------- ### FeatureManager.NotifyFeatureUsage Source: https://context7.com/thebookisclosed/vive/llms.txt Emit a feature usage telemetry report to the kernel via `RtlNotifyFeatureUsage`. ```APIDOC ## FeatureManager.NotifyFeatureUsage ### Description Sends a single `RTL_FEATURE_USAGE_REPORT` event to the kernel via `RtlNotifyFeatureUsage`. Returns 0 on success or an NTSTATUS error code. ### Method - `NotifyFeatureUsage(ref RTL_FEATURE_USAGE_REPORT report)` ### Parameters #### Report - **report** (ref RTL_FEATURE_USAGE_REPORT) - Required - The feature usage report to send. ### Response #### Success Response (0) - **int** - Returns 0 on success. #### Error Response - **int** - Returns an NTSTATUS error code on failure. ### Request Example ```csharp using Albacore.ViVe; using Albacore.ViVe.NativeStructs; var report = new RTL_FEATURE_USAGE_REPORT { FeatureId = 26008830, ReportingKind = 1, ReportingOptions = 0 }; int result = FeatureManager.NotifyFeatureUsage(ref report); Console.WriteLine(result == 0 ? "Usage reported." : $"Failed: 0x{result:X8}"); ``` ``` -------------------------------- ### ObfuscationHelpers.ObfuscateFeatureId / DeobfuscateFeatureId Source: https://context7.com/thebookisclosed/vive/llms.txt Implement forward and reverse transforms for obfuscating and deobfuscating feature IDs, used for registry key names. ```APIDOC ## ObfuscationHelpers.ObfuscateFeatureId / DeobfuscateFeatureId ### Description Windows stores feature override registry keys under obfuscated numeric names rather than the raw feature ID. These two static helpers implement the forward and reverse transforms, which are used internally by `FeatureManager` when persisting configurations to `HKLM\SYSTEM\CurrentControlSet\Control\FeatureManagement\Overrides`. ### Method - `ObfuscateFeatureId(uint featureId)` - `DeobfuscateFeatureId(uint obfuscatedFeatureId)` ### Parameters #### ObfuscateFeatureId - **featureId** (uint) - Required - The original feature ID to obfuscate. #### DeobfuscateFeatureId - **obfuscatedFeatureId** (uint) - Required - The obfuscated feature ID to deobfuscate. ### Response #### Success Response - **uint** - The obfuscated or deobfuscated feature ID. ### Request Example ```csharp using Albacore.ViVe; uint featureId = 26008830; uint obfuscated = ObfuscationHelpers.ObfuscateFeatureId(featureId); uint deobfuscated = ObfuscationHelpers.DeobfuscateFeatureId(obfuscated); Console.WriteLine($"Original: {featureId}"); Console.WriteLine($"Obfuscated: {obfuscated}"); Console.WriteLine($"Round-tripped: {deobfuscated}"); // equals featureId ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.