RegistryPermission 클래스
레지스트리 변수에 액세스하는 기능을 제어합니다. 이 클래스는 상속될 수 없습니다.
네임스페이스: System.Security.Permissions
어셈블리: mscorlib(mscorlib.dll)
구문
‘선언
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public NotInheritable Class RegistryPermission
Inherits CodeAccessPermission
Implements IUnrestrictedPermission
‘사용 방법
Dim instance As RegistryPermission
[SerializableAttribute]
[ComVisibleAttribute(true)]
public sealed class RegistryPermission : CodeAccessPermission, IUnrestrictedPermission
[SerializableAttribute]
[ComVisibleAttribute(true)]
public ref class RegistryPermission sealed : public CodeAccessPermission, IUnrestrictedPermission
/** @attribute SerializableAttribute() */
/** @attribute ComVisibleAttribute(true) */
public final class RegistryPermission extends CodeAccessPermission implements IUnrestrictedPermission
SerializableAttribute
ComVisibleAttribute(true)
public final class RegistryPermission extends CodeAccessPermission implements IUnrestrictedPermission
설명
RegistryPermission에서는 레지스트리 변수에 대한 보호된 작업을 관리합니다. 레지스트리 변수는 RegistryPermission이 없는 코드가 액세스할 수 있는 메모리 위치에 저장되어서는 안 됩니다. 레지스트리 개체가 트러스트되지 않은 호출자에게 전달되면 나쁜 용도로 사용될 수 있습니다.
RegistryPermissionAccess는 사용할 수 있는 레지스트리 액세스 형식을 정의합니다. 두 개 이상의 액세스 형식이 필요한 경우 다음 코드 샘플에 표시된 대로 비트 OR 연산을 사용하여 액세스 형식을 결합할 수 있습니다.
레지스트리 사용 권한은 정규 절대 경로로 정의되며, 정규 경로 이름으로 확인되어야 합니다. 키 액세스에는 키에 들어 있는 모든 값과 키의 모든 변수에 대한 액세스가 포함됩니다.
경고
RegistryPermission은 HKEY_CURRENT_USER 및 HKEY_USERS를 포함하여 키의 모든 경로에 대한 권한을 부여합니다. 키에 대한 액세스를 Deny하려면 해당 키에 대해 가능한 모든 경로를 Deny해야 합니다. 예를 들어 HKEY_CURRENT_USER\Software\Microsoft\Cryptography에 대한 액세스를 Deny하려면 HKEY_CURRENT_USER\Software\Microsoft\Cryptography, HKEY_USERS\.......\Software\Microsoft\Cryptography 및 키에 액세스할 수 있는 그 밖의 모든 경로를 Deny해야 합니다. 경로가 여러 개인 경우 PermitOnly와 Deny를 함께 사용하는 것이 좋습니다. 이 주제 및 Deny와 함께 PermitOnly를 사용하는 방법에 대한 자세한 내용은 Deny 메서드 사용의 "Deny를 사용할 때의 정식화 문제"를 참조하십시오.
예제
다음 코드 예제에서 RegistryPermissionf
는 CentralProcessor 키의 값을 읽을 수 있는 권한을 나타냅니다. Read와 Write는 RegistryPermissionAccess 열거형 값입니다.
Dim f As New RegistryPermission( _
RegistryPermissionAccess.Read, _
"HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0")
RegistryPermission f = new RegistryPermission(
RegistryPermissionAccess.Read,
"HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
RegistryPermission^ f = gcnew RegistryPermission(
RegistryPermissionAccess::Read,
"HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" );
RegistryPermission f =
new RegistryPermission(RegistryPermissionAccess.Read,
"HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\"
+ "System\\CentralProcessor\\0");
다음 코드 예제에서는 RegistryPermissionf
에 FloatingPointProcessor 키를 읽고 쓸 수 있는 권한을 추가합니다.
f.AddPathList( _
RegistryPermissionAccess.Write Or RegistryPermissionAccess.Read, _
"HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\FloatingPointProcessor\0")
f.AddPathList(
RegistryPermissionAccess.Write | RegistryPermissionAccess.Read,
"HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\FloatingPointProcessor\\0");
f->AddPathList(
(RegistryPermissionAccess) (RegistryPermissionAccess::Write | RegistryPermissionAccess::Read),
"HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\FloatingPointProcessor\\0" );
f.AddPathList(RegistryPermissionAccess.Write |
RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\\HARDWARE\\"
+ "DESCRIPTION\\System\\FloatingPointProcessor\\0");
RegistryPermission f
는 이제 CentralProcessor 키를 읽을 수 있는 권한과 FloatingPointProcessor 키를 읽고 쓸 수 있는 권한을 나타냅니다.
다음 코드 예제에서는 RegistryPermission 메서드의 동작을 보여 줍니다. 이 예제는 메서드의 결과를 보여주기 위한 것이지 메서드를 사용하는 방법을 보여주기 위한 것이 아닙니다.
' This sample demonstrates the IsSubsetOf, Union, Intersect, Copy, ToXml, FromXml
' GetPathList, AddPathList, and SetPathList methods
' of the RegistryPermission class.
Imports System
Imports System.Security
Imports System.Security.Permissions
Imports System.Collections
Public Class RegistryPermissionDemo
Private readPerm1 As New RegistryPermission(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0")
Private readPerm2 As New RegistryPermission(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION")
Private readPerm3 As New RegistryPermission(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\FloatingPointProcessor\0")
Private createPerm1 As New RegistryPermission(RegistryPermissionAccess.Create, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0")
Private readPerm4 As IPermission
' IsSubsetOf determines whether the current permission is a subset of the specified permission.
Private Function IsSubsetOfDemo() As Boolean
Dim returnValue As Boolean = True
If readPerm1.IsSubsetOf(readPerm2) Then
Console.WriteLine(readPerm1.GetPathList(RegistryPermissionAccess.Read) + vbLf + " is a subset of " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + vbLf)
Else
Console.WriteLine(readPerm1.GetPathList(RegistryPermissionAccess.Read) + vbLf + " is not a subset of " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + vbLf)
End If
If createPerm1.IsSubsetOf(readPerm1) Then
Console.WriteLine("RegistryPermissionAccess.Create" + vbLf + " is a subset of " + "RegistryPermissionAccess.Read" + vbLf)
Else
Console.WriteLine("RegistryPermissionAccess.Create" + vbLf + " is not a subset of " + "RegistryPermissionAccess.Read" + vbLf)
End If
Return returnValue
End Function 'IsSubsetOfDemo
' Union creates a new permission that is the union of the current permission and
' the specified permission.
Private Function UnionDemo() As Boolean
Dim returnValue As Boolean = True
readPerm3 = CType(readPerm1.Union(readPerm2), RegistryPermission)
If readPerm3 Is Nothing Then
Console.WriteLine("The union of " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.Read) + " " + vbLf + "and " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + " is null.")
Else
Console.WriteLine("The union of " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.Read) + " " + vbLf + "and " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + " = " + vbLf + vbTab + CType(readPerm3, RegistryPermission).GetPathList(RegistryPermissionAccess.Read).ToString())
End If
Return returnValue
End Function 'UnionDemo
' Intersect creates and returns a new permission that is the intersection of the
' current permission and the permission specified.
Private Function IntersectDemo() As Boolean
Dim returnValue As Boolean = True
readPerm3 = CType(readPerm1.Intersect(readPerm2), RegistryPermission)
If Not (readPerm3 Is Nothing) AndAlso Not (readPerm3.GetPathList(RegistryPermissionAccess.Read) Is Nothing) Then
Console.WriteLine("The intersection of " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.Read) + " " + vbLf + "and " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + " = " + vbLf + vbTab + CType(readPerm3, RegistryPermission).GetPathList(RegistryPermissionAccess.Read).ToString())
Else
Console.WriteLine("The intersection of " + vbLf + readPerm2.GetPathList(RegistryPermissionAccess.Read) + " " + vbLf + "and " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + " is null. ")
End If
Return returnValue
End Function 'IntersectDemo
'Copy creates and returns an identical copy of the current permission.
Private Function CopyDemo() As Boolean
Dim returnValue As Boolean = True
readPerm4 = CType(readPerm1.Copy(), RegistryPermission)
If Not (readPerm4 Is Nothing) Then
Console.WriteLine("Result of copy = " + readPerm4.ToXml().ToString() + vbLf)
Else
Console.WriteLine("Result of copy is null. " + vbLf)
End If
Return returnValue
End Function 'CopyDemo
' ToXml creates an XML encoding of the permission and its current state; FromXml
' reconstructs a permission with the specified state from the XML encoding.
Private Function ToFromXmlDemo() As Boolean
Dim returnValue As Boolean = True
readPerm2 = New RegistryPermission(PermissionState.None)
readPerm2.FromXml(readPerm1.ToXml())
Console.WriteLine("Result of ToFromXml = " + readPerm2.ToString() + vbLf)
Return returnValue
End Function 'ToFromXmlDemo
' AddPathList adds access for the specified registry variables to the existing state of the permission.
' SetPathList sets new access for the specified registry variable names to the existing state of the permission.
' GetPathList gets paths for all registry variables with the specified RegistryPermissionAccess.
Private Function SetGetPathListDemo() As Boolean
Try
Console.WriteLine("********************************************************" + vbLf)
Dim readPerm1 As RegistryPermission
Console.WriteLine("Creating RegistryPermission with AllAccess rights for 'HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0'")
readPerm1 = New RegistryPermission(RegistryPermissionAccess.AllAccess, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0")
Console.WriteLine("Adding 'HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION' to the write access list, " + "and " + vbLf + " 'HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\FloatingPointProcessor\0' " + "to the read access list.")
readPerm1.AddPathList(RegistryPermissionAccess.Write, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION")
readPerm1.AddPathList(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\FloatingPointProcessor\0")
Console.WriteLine("Read access list before SetPathList = " + readPerm1.GetPathList(RegistryPermissionAccess.Read))
Console.WriteLine("Setting read access rights to " + vbLf + "'HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0'")
readPerm1.SetPathList(RegistryPermissionAccess.Read, "HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0")
Console.WriteLine("Read access list after SetPathList = " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.Read))
Console.WriteLine("Write access = " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.Write))
Console.WriteLine("Write access Registry variables = " + vbLf + readPerm1.GetPathList(RegistryPermissionAccess.AllAccess))
Catch e As ArgumentException
' RegistryPermissionAccess.AllAccess can not be used as a parameter for GetPathList.
Console.WriteLine("An ArgumentException occured as a result of using AllAccess. " + _
"AllAccess cannot be used as a parameter in GetPathList because it represents more than one " + _
"type of registry variable access : " + vbLf + e.Message)
End Try
Return True
End Function 'SetGetPathListDemo
' Invoke all demos.
Public Function RunDemo() As Boolean
Dim ret As Boolean = True
Dim retTmp As Boolean
' Call IsSubset demo.
If IsSubsetOfDemo() Then
Console.Out.WriteLine("IsSubset demo completed successfully.")
Else
Console.Out.WriteLine("IsSubset demo failed.")
End If
ret = retTmp AndAlso ret
' Call the Union demo.
retTmp = UnionDemo()
If retTmp Then
Console.Out.WriteLine("Union demo completed successfully.")
Else
Console.Out.WriteLine("Union demo failed.")
End If
ret = retTmp AndAlso ret
' Call the intersect demo.
retTmp = UnionDemo()
If retTmp Then
Console.Out.WriteLine("Intersect demo completed successfully.")
Else
Console.Out.WriteLine("Intersect demo failed.")
End If
ret = retTmp AndAlso ret
' Call the Copy demo.
retTmp = CopyDemo()
If retTmp Then
Console.Out.WriteLine("Copy demo completed successfully.")
Else
Console.Out.WriteLine("Copy demo failed.")
End If
ret = retTmp AndAlso ret
' Call the ToFromXml demo.
retTmp = ToFromXmlDemo()
If retTmp Then
Console.Out.WriteLine("ToFromXml demo completed successfully.")
Else
Console.Out.WriteLine("ToFromXml demo failed.")
End If
ret = retTmp AndAlso ret
' Call the GetPathList demo.
retTmp = SetGetPathListDemo()
If retTmp Then
Console.Out.WriteLine("SetGetPathList demo completed successfully.")
Else
Console.Out.WriteLine("SetGetPathList demo failed.")
End If
ret = retTmp AndAlso ret
Return ret
End Function 'RunDemo
' Test harness.
Public Shared Sub Main(ByVal args() As String)
Try
Dim democase As New RegistryPermissionDemo()
Dim ret As Boolean = democase.RunDemo()
If ret Then
Console.Out.WriteLine("The RegisterPermission demo completed successfully.")
Console.Out.WriteLine("Press the Enter key to exit.")
Dim consoleInput As String = Console.ReadLine()
System.Environment.ExitCode = 100
Else
Console.Out.WriteLine("The RegisterPermission demo failed")
Console.Out.WriteLine("Press the Enter key to exit.")
Dim consoleInput As String = Console.ReadLine()
System.Environment.ExitCode = 101
End If
Catch e As Exception
Console.Out.WriteLine("The RegisterPermission demo failed")
Console.WriteLine(e.ToString())
Console.Out.WriteLine("Press the Enter key to exit.")
Dim consoleInput As String = Console.ReadLine()
System.Environment.ExitCode = 101
End Try
End Sub 'Main
End Class 'RegistryPermissionDemo
// This sample demonstrates the IsSubsetOf, Union, Intersect, Copy, ToXml, FromXml
// GetPathList, AddPathList, and SetPathList methods
// of the RegistryPermission class.
using System;
using System.Security;
using System.Security.Permissions;
using System.Collections;
[assembly: CLSCompliant(true)]
public class RegistryPermissionDemo
{
RegistryPermission readPerm1 = new RegistryPermission(RegistryPermissionAccess.Read,
"HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
RegistryPermission readPerm2 = new RegistryPermission(RegistryPermissionAccess.Read,
"HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION");
RegistryPermission readPerm3 = new RegistryPermission(RegistryPermissionAccess.Read,
"HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\FloatingPointProcessor\\0");
RegistryPermission createPerm1 = new RegistryPermission(RegistryPermissionAccess.Create,
"HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
IPermission readPerm4;
// IsSubsetOf determines whether the current permission is a subset of the specified permission.
private bool IsSubsetOfDemo()
{
bool returnValue = true;
if (readPerm1.IsSubsetOf(readPerm2))
{
Console.WriteLine(readPerm1.GetPathList(RegistryPermissionAccess.Read) +
"\n is a subset of " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + "\n");
}
else
{
Console.WriteLine(readPerm1.GetPathList(RegistryPermissionAccess.Read) +
"\n is not a subset of " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + "\n");
}
if (createPerm1.IsSubsetOf(readPerm1))
{
Console.WriteLine("RegistryPermissionAccess.Create" +
"\n is a subset of " + "RegistryPermissionAccess.Read" + "\n");
}
else
{
Console.WriteLine("RegistryPermissionAccess.Create" +
"\n is not a subset of " + "RegistryPermissionAccess.Read" + "\n");
}
return returnValue;
}
// Union creates a new permission that is the union of the current permission and
// the specified permission.
private bool UnionDemo()
{
bool returnValue = true;
readPerm3 = (RegistryPermission)readPerm1.Union(readPerm2);
if (readPerm3 == null)
{
Console.WriteLine("The union of \n" +
readPerm1.GetPathList(RegistryPermissionAccess.Read) + " \nand "
+ readPerm2.GetPathList(RegistryPermissionAccess.Read) + " is null.");
}
else
{
Console.WriteLine("The union of \n" + readPerm1.GetPathList(RegistryPermissionAccess.Read) +
" \nand " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + " = \n\t"
+ ((RegistryPermission)readPerm3).GetPathList(RegistryPermissionAccess.Read).ToString());
}
return returnValue;
}
// Intersect creates and returns a new permission that is the intersection of the
// current permission and the permission specified.
private bool IntersectDemo()
{
bool returnValue = true;
readPerm3 = (RegistryPermission)readPerm1.Intersect(readPerm2);
if (readPerm3 != null && readPerm3.GetPathList(RegistryPermissionAccess.Read) != null)
{
Console.WriteLine("The intersection of \n" + readPerm1.GetPathList(RegistryPermissionAccess.Read)
+ " \nand " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + " = \n\t"
+ ((RegistryPermission)readPerm3).GetPathList(RegistryPermissionAccess.Read).ToString());
}
else
{
Console.WriteLine("The intersection of \n" + readPerm2.GetPathList(RegistryPermissionAccess.Read)
+ " \nand " + readPerm2.GetPathList(RegistryPermissionAccess.Read) + " is null. ");
}
return returnValue;
}
//Copy creates and returns an identical copy of the current permission.
private bool CopyDemo()
{
bool returnValue = true;
readPerm4 = (RegistryPermission)readPerm1.Copy();
if (readPerm4 != null)
{
Console.WriteLine("Result of copy = " + readPerm4.ToString() + "\n");
}
else
{
Console.WriteLine("Result of copy is null. \n");
}
return returnValue;
}
// ToXml creates an XML encoding of the permission and its current state; FromXml
// reconstructs a permission with the specified state from the XML encoding.
private bool ToFromXmlDemo()
{
bool returnValue = true;
readPerm2 = new RegistryPermission(PermissionState.None);
readPerm2.FromXml(readPerm1.ToXml());
Console.WriteLine("Result of ToFromXml = " + readPerm2.ToString() + "\n");
return returnValue;
}
// AddPathList adds access for the specified registry variables to the existing state of the permission.
// SetPathList sets new access for the specified registry variable names to the existing state of the permission.
// GetPathList gets paths for all registry variables with the specified RegistryPermissionAccess.
private bool SetGetPathListDemo()
{
try
{
Console.WriteLine("********************************************************\n");
RegistryPermission readPerm1;
Console.WriteLine("Creating RegistryPermission with AllAccess rights for 'HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0'");
readPerm1 = new RegistryPermission(RegistryPermissionAccess.AllAccess, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
Console.WriteLine("Adding 'HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION' to the write access list, "
+ "and \n 'HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\FloatingPointProcessor\\0' "
+ "to the read access list.");
readPerm1.AddPathList(RegistryPermissionAccess.Write, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION");
readPerm1.AddPathList(RegistryPermissionAccess.Read,
"HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\FloatingPointProcessor\\0");
Console.WriteLine("Read access list before SetPathList = " +
readPerm1.GetPathList(RegistryPermissionAccess.Read));
Console.WriteLine("Setting read access rights to \n'HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0'");
readPerm1.SetPathList(RegistryPermissionAccess.Read,
"HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
Console.WriteLine("Read access list after SetPathList = \n" +
readPerm1.GetPathList(RegistryPermissionAccess.Read));
Console.WriteLine("Write access = \n" +
readPerm1.GetPathList(RegistryPermissionAccess.Write));
Console.WriteLine("Write access Registry variables = \n" +
readPerm1.GetPathList(RegistryPermissionAccess.AllAccess));
}
catch (ArgumentException e)
{
// RegistryPermissionAccess.AllAccess can not be used as a parameter for GetPathList.
Console.WriteLine("An ArgumentException occured as a result of using AllAccess. "
+ "AllAccess cannot be used as a parameter in GetPathList because it represents more than one "
+ "type of registry variable access : \n" + e);
}
return true;
}
// Invoke all demos.
public bool RunDemo()
{
bool ret = true;
bool retTmp;
// Call IsSubset demo.
if (retTmp = IsSubsetOfDemo()) Console.Out.WriteLine("IsSubset demo completed successfully.");
else Console.Out.WriteLine("IsSubset demo failed.");
ret = retTmp && ret;
// Call the Union demo.
if (retTmp = UnionDemo()) Console.Out.WriteLine("Union demo completed successfully.");
else Console.Out.WriteLine("Union demo failed.");
ret = retTmp && ret;
// Call the intersect demo.
if (retTmp = IntersectDemo()) Console.Out.WriteLine("Intersect demo completed successfully.");
else Console.Out.WriteLine("Intersect demo failed.");
ret = retTmp && ret;
// Call the Copy demo.
if (retTmp = CopyDemo()) Console.Out.WriteLine("Copy demo completed successfully.");
else Console.Out.WriteLine("Copy demo failed.");
ret = retTmp && ret;
// Call the ToFromXml demo.
if (retTmp = ToFromXmlDemo()) Console.Out.WriteLine("ToFromXml demo completed successfully.");
else Console.Out.WriteLine("ToFromXml demo failed.");
ret = retTmp && ret;
// Call the GetPathList demo.
if (retTmp = SetGetPathListDemo()) Console.Out.WriteLine("SetGetPathList demo completed successfully.");
else Console.Out.WriteLine("SetGetPathList demo failed.");
ret = retTmp && ret;
return (ret);
}
// Test harness.
public static void Main(String[] args)
{
try
{
RegistryPermissionDemo democase = new RegistryPermissionDemo();
bool ret = democase.RunDemo();
if (ret)
{
Console.Out.WriteLine("The RegisterPermission demo completed successfully.");
Console.Out.WriteLine("Press the Enter key to exit.");
string consoleInput = Console.ReadLine();
System.Environment.ExitCode = 100;
}
else
{
Console.Out.WriteLine("The RegisterPermission demo failed");
Console.Out.WriteLine("Press the Enter key to exit.");
string consoleInput = Console.ReadLine();
System.Environment.ExitCode = 101;
}
}
catch (Exception e)
{
Console.Out.WriteLine("The RegisterPermission demo failed");
Console.WriteLine(e.ToString());
Console.Out.WriteLine("Press the Enter key to exit.");
string consoleInput = Console.ReadLine();
System.Environment.ExitCode = 101;
}
}
}
상속 계층 구조
System.Object
System.Security.CodeAccessPermission
System.Security.Permissions.RegistryPermission
스레드로부터의 안전성
이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.
플랫폼
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
2.0, 1.1, 1.0에서 지원
참고 항목
참조
RegistryPermission 멤버
System.Security.Permissions 네임스페이스
RegistryPermissionAttribute
RegistryPermissionAccess