RegistryPermission.SetPathList メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > RegistryPermission.SetPathList メソッドの意味・解説 

RegistryPermission.SetPathList メソッド

指定したレジストリ変数名への新しアクセスを、アクセス許可既存の状態に設定します

名前空間: System.Security.Permissions
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub SetPathList ( _
    access As RegistryPermissionAccess, _
    pathList As String _
)
Dim instance As RegistryPermission
Dim access As RegistryPermissionAccess
Dim pathList As String

instance.SetPathList(access, pathList)
public void SetPathList (
    RegistryPermissionAccess access,
    string pathList
)
public:
void SetPathList (
    RegistryPermissionAccess access, 
    String^ pathList
)
public void SetPathList (
    RegistryPermissionAccess access, 
    String pathList
)
public function SetPathList (
    access : RegistryPermissionAccess, 
    pathList : String
)

パラメータ

access

RegistryPermissionAccess 値の 1 つ

pathList

レジストリ変数の (セミコロン区切りの) リスト

例外例外
例外種類条件

ArgumentException

access パラメータが、RegistryPermissionAccess の有効値ではありません。

または

pathList パラメータが、有効な文字列ではありません。

解説解説
使用例使用例

SetPathList メソッド使用するコード例次に示します。このコード例は、RegistryPermission クラストピック取り上げているコード例一部分です。

' 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

// 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;
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
RegistryPermission クラス
RegistryPermission メンバ
System.Security.Permissions 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

RegistryPermission.SetPathList メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



RegistryPermission.SetPathList メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS