示例#1
0
        static void Main(string[] args)
        {
            var exception = new System.Security.SecurityException();

            exception.GetType().LogInheritanceHierarchy();
            // Set company as parent key element.
            const string company = "TestCompany";
            // Create subkey tree.
            var subKeyTree = $"{company}\\Applications\\TestApplication";

            // Create key with no permissions.
            CreateRegistryKey(subKeyTree, PermissionState.None);
            Logging.LineSeparator();

            // Create key with unrestricted permissions.
            CreateRegistryKey(subKeyTree, PermissionState.Unrestricted);
            Logging.LineSeparator();

            // Delete key with no permissions.
            DeleteRegistryKey(company, PermissionState.None);
            Logging.LineSeparator();

            // Delete key with unrestricted permissions.
            DeleteRegistryKey(company, PermissionState.Unrestricted);
            Logging.LineSeparator();
        }