Back to Devexpress

RegistryAccessPolicy.AllowOperation(RegistryOperation) Method

corelibraries-devexpress-dot-data-dot-utils-dot-registryaccesspolicy-dot-allowoperation-x28-devexpress-dot-data-dot-utils-dot-registry-dot-internal-dot-registryoperation-x29.md

latest3.5 KB
Original Source

RegistryAccessPolicy.AllowOperation(RegistryOperation) Method

Enables the specified registry operation.

Namespace : DevExpress.Data.Utils

Assembly : DevExpress.Data.Desktop.v25.2.dll

NuGet Packages : DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design

Declaration

csharp
public static void AllowOperation(
    RegistryOperation operation
)
vb
Public Shared Sub AllowOperation(
    operation As RegistryOperation
)

Parameters

NameTypeDescription
operationDevExpress.Data.Utils.Registry.Internal.RegistryOperation

The registry operation.

|

Remarks

Use the AllowOperation method to enable a specific registry operation when a restrictive policy is activated.

Registry operations include:

  • RegistryOperation.QueryValue
  • RegistryOperation.SetValue
  • RegistryOperation.DeleteSubKeyTree
  • RegistryOperation.EnumerateSubKeyTree
  • RegistryOperation.All
  • RegistryOperation.None

The following example suppresses all registry-related operations except for read requests from the system registry:

csharp
using System;
using System.Windows.Forms;
using DevExpress.Data.Utils;
using DevExpress.Data.Utils.Registry.Internal;

namespace DXApplication {
    internal static class Program {
        [STAThread]
        static void Main() {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            RegistryAccessPolicy.SuppressAllOperations();
            RegistryAccessPolicy.AllowOperation(RegistryOperation.EnumerateSubKeyTree);
            RegistryAccessPolicy.AllowOperation(RegistryOperation.QueryValue);
            Application.Run(new Form1());
        }
    }
}
vb
using System;
using System.Windows.Forms;
using DevExpress.Data.Utils;
using DevExpress.Data.Utils.Registry.Internal;

namespace DXApplication {
    internal static class Program {
        [STAThread]
        static void Main() {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            RegistryAccessPolicy.SuppressAllOperations();
            RegistryAccessPolicy.AllowOperation(RegistryOperation.EnumerateSubKeyTree);
            RegistryAccessPolicy.AllowOperation(RegistryOperation.QueryValue);
            Application.Run(new Form1());
        }
    }
}

Tip

Use the IsOperationAllowed method to check whether the specified registry operation is allowed.

Read the following topic for additional information: Registry Access Policy.

See Also

RegistryAccessPolicy Class

RegistryAccessPolicy Members

DevExpress.Data.Utils Namespace