registryとは? わかりやすく解説

Weblio 辞書 > 辞書・百科事典 > デジタル大辞泉 > registryの意味・解説 

レジストリー【registry】

読み方:れじすとりー

米国マイクロソフト社のオペレーティングシステムウインドウズにおける、システム・アプリケーションソフト・デバイスドライバーなどの各種設定情報記録したデータベース


レジストリ

【英】registry

レジストリとは、Windowsにおいて、システムプログラムハードウェアユーザプログラムなどのシステム情報格納されているデータベースのことである。

レジストリが広く使われる前までは、アプリケーションソフトシステム情報は、テキストファイルそれぞれ格納されていた。このテキストファイルに付く拡張子iniであることが多かったことから、「INIファイル」と呼ばれていた。

レジストリは、システム情報統一的に管理するために、また、ユーザーごとに設定され情報管理効率的に行うために利用されている。

Windowsでは、レジストリへのアクセスが多いとされている。そのため、レジストリデフラグツールを使用することで無駄な領域クリーンアップして、レジストリを最適な状態にしておくことが望ましいとされている。

なお、インターネット上でIPアドレスAS番号などのリソース割り当て管理している機構はインターネットレジストリと呼ばれており、略してレジストリと呼ばれる場合もある。


参照リンク
Microsoft Windows レジストリの説明 - (Microsoft
OSのほかの用語一覧
Windows:  Palladium  PC99  PC95  レジストリ  レジストリエディタ  リストア  リソース

Registry クラス

Windows レジストリルート キーを表す RegistryKey オブジェクト、およびキー/値ペアアクセスするための static メソッド提供します

名前空間: Microsoft.Win32
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<ComVisibleAttribute(True)> _
Public NotInheritable Class
 Registry
[ComVisibleAttribute(true)] 
public static class Registry
[ComVisibleAttribute(true)] 
public ref class Registry abstract sealed
/** @attribute ComVisibleAttribute(true) */ 
public final class Registry
ComVisibleAttribute(true) 
public final class Registry
解説解説

このクラスには、Windows実行されているコンピュータレジストリ見つかった標準ルート キーセットありますレジストリは、アプリケーションユーザー既定システム設定に関する情報格納する機能です。たとえば、アプリケーション終了した後も保持する必要のある情報レジストリ格納しておくと、そのアプリケーション再読み込み時に同じ情報アクセスできます。たとえば、色の設定画面位置ウィンドウサイズなどを格納できますこのようなデータユーザー別に制御するには、情報レジストリ内の異な位置格納します

Registry クラスによって公開される基本 (ルート) RegistryKey インスタンスは、レジストリでのサブキーと値の基本的なストレージ機構表しますレジストリ内容キー存在依存しているため、すべてのキー読み取り専用です。Registry により公開公開されるキー次のとおりです。

CurrentUser

ユーザー設定に関する情報格納されています。

LocalMachine

ローカル コンピュータ構成情報格納されます。

ClassesRoot

型およびクラスとそのプロパティに関する情報格納されます。

Users

既定ユーザー構成に関する情報格納されます。

PerformanceData

ソフトウェア コンポーネントパフォーマンスに関する情報格納されます。

CurrentConfig

ユーザー共通のハードウェア情報格納されます。

DynData

動的データ格納されます。

レジストリから格納または取得する情報ルート キー確認したら、RegistryKey クラス使用してサブキーを追加または削除したり、特定のキーの値を操作したできます

プラグ アンド プレイ インターフェイス使用すると、ハードウェア デバイス情報自動的にレジストリに登録できますデバイス ドライバインストールするソフトウェアは、標準 API書き込むことで、レジストリ情報登録します

値を取得および設定する静的メソッド
使用例使用例

このセクションには、2 つコード例含まれています。最初の例ではルート キー示し2 番目の例では、staticGetValue メソッドSetValue メソッド示してます。

例 1

HKEY_USERS キーのサブキーを取得し、これらのサブキーの名前を画面出力する方法次のコード例示します必要な特定のサブキーのインスタンス作成するには、OpenSubKey メソッド使用します次にRegistryKey別の演算使用して、そのキー操作します。

Imports System
Imports Microsoft.Win32

Class Reg
    
    Public Shared Sub Main()
        
        ' Create a RegistryKey, which will access the HKEY_USERS
        ' key in the registry of this machine.
        Dim rk As RegistryKey = Registry.Users
        
        ' Print out the keys.
        PrintKeys(rk)
    End Sub    
    
    Shared Sub PrintKeys(rkey As
 RegistryKey)
        
        ' Retrieve all the subkeys for the specified key.
        Dim names As String()
 = rkey.GetSubKeyNames()
        
        Dim icount As Integer
 = 0
        
        Console.WriteLine("Subkeys of " & rkey.Name)
        Console.WriteLine("-----------------------------------------------")
        
        ' Print the contents of the array to the console.
        Dim s As String
        For Each s In  names
            Console.WriteLine(s)
            
            ' The following code puts a limit on the number
            ' of keys displayed.  Comment it out to print the
            ' complete list.
            icount += 1            
            If icount >= 10 Then
                Exit For
            End If
        Next s
    End Sub
End Class
using System;
using Microsoft.Win32;

class Reg {
    public static void Main()
 {

        // Create a RegistryKey, which will access the HKEY_USERS
        // key in the registry of this machine.
        RegistryKey rk = Registry.Users;

        // Print out the keys.
        PrintKeys(rk);
    }

    static void PrintKeys(RegistryKey rkey)
 {

        // Retrieve all the subkeys for the specified key.
        String [] names = rkey.GetSubKeyNames();

        int icount = 0;

        Console.WriteLine("Subkeys of " + rkey.Name);
        Console.WriteLine("-----------------------------------------------");

        // Print the contents of the array to the console.
        foreach (String s in names) {
            Console.WriteLine(s);

            // The following code puts a limit on the number
            // of keys displayed.  Comment it out to print the
            // complete list.
            icount++;
            if (icount >= 10)
                break;
        }
    }
}
using namespace System;
using namespace Microsoft::Win32;
void PrintKeys( RegistryKey ^ rkey )
{
   
   // Retrieve all the subkeys for the specified key.
   array<String^>^names = rkey->GetSubKeyNames();
   int icount = 0;
   Console::WriteLine( "Subkeys of {0}", rkey->Name );
   Console::WriteLine( "-----------------------------------------------"
 );
   
   // Print the contents of the array to the console.
   System::Collections::IEnumerator^ enum0 = names->GetEnumerator();
   while ( enum0->MoveNext() )
   {
      String^ s = safe_cast<String^>(enum0->Current);
      Console::WriteLine( s );
      
      // The following code puts a limit on the number
      // of keys displayed.  Comment it out to print the
      // complete list.
      icount++;
      if ( icount >= 10 )
            break;
   }
}

int main()
{
   
   // Create a RegistryKey, which will access the HKEY_USERS
   // key in the registry of this machine.
   RegistryKey ^ rk = Registry::Users;
   
   // Print out the keys.
   PrintKeys( rk );
}

import System.*;
import Microsoft.Win32.*;

class Reg
{
    public static void main(String[]
 args)
    {
        // Create a RegistryKey, which will access the HKEY_USERS
        // key in the registry of this machine.
        RegistryKey rk = Registry.Users;
        // Print out the keys.
        PrintKeys(rk);
    } //main

    static void PrintKeys(RegistryKey rKey)
    {
        // Retrieve all the subkeys for the specified key.
        String names[] = rKey.GetSubKeyNames();

        int iCount = 0;

        Console.WriteLine("Subkeys of " + rKey.get_Name());
        Console.WriteLine("-----------------------------------------------");
        // Print the contents of the array to the console.
        String s = null;
        for (int iCtr = 0; iCtr < names.get_Length();
 iCtr++) {
            s = names[iCtr];
            Console.WriteLine(s);
            // The following code puts a limit on the number
            // of keys displayed.  Comment it out to print the
            // complete list.
            iCount++;
            if (iCount >= 10) {
                break;
            }
        }
    } //PrintKeys
} //Reg

例 2

サンプル キー作成し、そのキー複数データ型の値を格納した後、その値を取得して表示するコード例次に示します。この例では、既定の (無名の) 名前/値ペア並べ替え取得する方法、および名前/値ペアが存在しない場合defaultValue使用方法示してます。

Imports System
Imports Microsoft.Win32

Public Class Example
    Public Shared Sub Main()
        ' The name of the key must include a valid root.
        Const userRoot As String
 = "HKEY_CURRENT_USER"
        Const subkey As String
 = "RegistrySetValueExample"
        Const keyName As String
 = userRoot & "\" & subkey

        ' Integer values can be stored without specifying the
        ' registry data type, but Long values will be stored
        ' as strings unless you specify the type. Note that
        ' the integer is stored in the default name/value
        ' pair.
        Registry.SetValue(keyName, "", 5280)
        Registry.SetValue(keyName, "TestLong", 12345678901234,
 _
            RegistryValueKind.QWord)

        ' Strings with expandable environment variables are
        ' stored as ordinary strings unless you specify the
        ' data type.
        Registry.SetValue(keyName, "TestExpand", "My
 path: %path%")
        Registry.SetValue(keyName, "TestExpand2",
 "My path: %path%", _
            RegistryValueKind.ExpandString)

        ' Arrays of strings are stored automatically as 
        ' MultiString. Similarly, arrays of Byte are stored
        ' automatically as Binary.
        Dim strings() As String
 = {"One", "Two",
 "Three"}
        Registry.SetValue(keyName, "TestArray", strings)

        ' Your default value is returned if the name/value pair
        ' does not exist.
        Dim noSuch As String
 = _
            Registry.GetValue(keyName, "NoSuchName",
 _
            "Return this default if NoSuchName does not exist.")
        Console.WriteLine(vbCrLf & "NoSuchName: {0}",
 noSuch)

        ' Retrieve the Integer and Long values, specifying 
        ' numeric default values in case the name/value pairs
        ' do not exist. The Integer value is retrieved from the
        ' default (nameless) name/value pair for the key.
        Dim tInteger As Integer
 = _
            Registry.GetValue(keyName, "", -1)
        Console.WriteLine("(Default): {0}", tInteger)
        Dim tLong As Long
 = Registry.GetValue(keyName, _
             "TestLong", Long.MinValue)
        Console.WriteLine("TestLong: {0}", tLong)

        ' When retrieving a MultiString value, you can specify
        ' an array for the default return value. The value is
        ' declared inline, but could also be declared as:
        ' Dim default() As String = {"Default value."}
        '
        Dim tArray() As String
 = _
            Registry.GetValue(keyName, "TestArray",
 _
            New String() {"Default
 if TestArray does not exist."})
        For i As Integer
 = 0 To tArray.Length - 1
            Console.WriteLine("TestArray({0}): {1}",
 i, tArray(i))
        Next

        ' A string with embedded environment variables is not
        ' expanded if it was stored as an ordinary string.
        Dim tExpand As String
 = Registry.GetValue(keyName, _
             "TestExpand", "Default
 if TestExpand does not exist.")
        Console.WriteLine("TestExpand: {0}", tExpand)

        ' A string stored as ExpandString is expanded.
        Dim tExpand2 As String
 = Registry.GetValue(keyName, _
             "TestExpand2", "Default
 if TestExpand2 does not exist.")
        Console.WriteLine("TestExpand2: {0}...", _
            tExpand2.Substring(0, 40))

        Console.WriteLine(vbCrLf & _
            "Use the registry editor to examine the key.")
        Console.WriteLine("Press the Enter key to delete the key.")
        Console.ReadLine()
        Registry.CurrentUser.DeleteSubKey(subkey)
    End Sub
End Class
'
' This code example produces output similar to the following:
'
'NoSuchName: Return this default if NoSuchName does not exist.
'(Default): 5280
'TestLong: 12345678901234
'TestArray(0): One
'TestArray(1): Two
'TestArray(2): Three
'TestExpand: My path: %path%
'TestExpand2: My path: D:\Program Files\Microsoft.NET\...
'
'Use the registry editor to examine the key.
'Press the Enter key to delete the key.
using System;
using Microsoft.Win32;

public class Example
{
    public static void Main()
    {
        // The name of the key must include a valid root.
        const string userRoot = "HKEY_CURRENT_USER";
        const string subkey = "RegistrySetValueExample";
        const string keyName = userRoot + "\\"
 + subkey;

        // An int value can be stored without specifying the
        // registry data type, but long values will be stored
        // as strings unless you specify the type. Note that
        // the int is stored in the default name/value
        // pair.
        Registry.SetValue(keyName, "", 5280);
        Registry.SetValue(keyName, "TestLong", 12345678901234,
            RegistryValueKind.QWord);

        // Strings with expandable environment variables are
        // stored as ordinary strings unless you specify the
        // data type.
        Registry.SetValue(keyName, "TestExpand", "My path: %path%");
        Registry.SetValue(keyName, "TestExpand2", "My path: %path%"
,
            RegistryValueKind.ExpandString);

        // Arrays of strings are stored automatically as 
        // MultiString. Similarly, arrays of Byte are stored
        // automatically as Binary.
        string[] strings = {"One", "Two",
 "Three"};
        Registry.SetValue(keyName, "TestArray", strings);

        // Your default value is returned if the name/value pair
        // does not exist.
        string noSuch = (string) Registry.GetValue(keyName,
 
            "NoSuchName",
            "Return this default if
 NoSuchName does not exist.");
        Console.WriteLine("\r\nNoSuchName: {0}", noSuch);

        // Retrieve the int and long values, specifying 
        // numeric default values in case the name/value pairs
        // do not exist. The int value is retrieved from the
        // default (nameless) name/value pair for the key.
        int tInteger = (int) Registry.GetValue(keyName,
 "", -1);
        Console.WriteLine("(Default): {0}", tInteger);
        long tLong = (long) Registry.GetValue(keyName, "TestLong",
            long.MinValue);
        Console.WriteLine("TestLong: {0}", tLong);

        // When retrieving a MultiString value, you can specify
        // an array for the default return value. 
        string[] tArray = (string[]) Registry.GetValue(keyName
,
            "TestArray",
            new string[] {"Default if
 TestArray does not exist."});
        for(int i=0; i<tArray.Length; i++)
        {
            Console.WriteLine("TestArray({0}): {1}", i, tArray[i]);
        }

        // A string with embedded environment variables is not
        // expanded if it was stored as an ordinary string.
        string tExpand = (string) Registry.GetValue(keyName
,
             "TestExpand", 
             "Default if TestExpand does not exist.");
        Console.WriteLine("TestExpand: {0}", tExpand);

        // A string stored as ExpandString is expanded.
        string tExpand2 = (string) Registry.GetValue(keyName
,
            "TestExpand2",
            "Default if TestExpand2 does not exist.");
        Console.WriteLine("TestExpand2: {0}...",
            tExpand2.Substring(0, 40));

        Console.WriteLine("\r\nUse the registry editor to examine the key.");
        Console.WriteLine("Press the Enter key to delete the key.");
        Console.ReadLine();
        Registry.CurrentUser.DeleteSubKey(subkey);
    }
}
//
// This code example produces output similar to the following:
//
//NoSuchName: Return this default if NoSuchName does not exist.
//(Default): 5280
//TestLong: 12345678901234
//TestArray(0): One
//TestArray(1): Two
//TestArray(2): Three
//TestExpand: My path: %path%
//TestExpand2: My path: D:\Program Files\Microsoft.NET\...
//
//Use the registry editor to examine the key.
//Press the Enter key to delete the key.
using namespace System;
using namespace Microsoft::Win32;

int main()
{   
    // The name of the key must include a valid root.
    String^ userRoot = "HKEY_CURRENT_USER";
    String^ subKey = "RegistrySetValueExample2";
    String^ keyName = String::Concat(userRoot, "\\", subKey);
    
    // An int value can be stored without specifying the
    // registry data type, but Int64 values will be stored
    // as strings unless you specify the type. Note that
    // the int is stored in the default name/value
    // pair.
    Registry::SetValue(keyName, "", 5280);
    Registry::SetValue(keyName, "TestInt64", 12345678901234, 
        RegistryValueKind::QWord);
    
    // Strings with expandable environment variables are
    // stored as ordinary strings unless you specify the
    // data type.
    Registry::SetValue(keyName, "TestExpand", "My path: %path%");
    Registry::SetValue(keyName, "TestExpand2", "My path: %path%",
 
        RegistryValueKind::ExpandString);
    
    // Arrays of strings are stored automatically as 
    // MultiString. Similarly, arrays of Byte are stored
    // automatically as Binary.
    array<String^>^ strings  = {"One", "Two", "Three"};
    Registry::SetValue(keyName, "TestArray", strings);
    
    // Your default value is returned if the name/value pair
    // does not exist.
    String^ noSuch = (String^)Registry::GetValue(keyName, 
        "NoSuchName", 
        "Return this default if
 NoSuchName does not exist.");
    Console::WriteLine("\r\nNoSuchName: {0}", noSuch);
    
    // Retrieve the int and Int64 values, specifying 
    // numeric default values in case the name/value pairs
    // do not exist. The int value is retrieved from the
    // default (nameless) name/value pair for the key.
    int testInteger = (int)Registry::GetValue(keyName,
 "", -1);
    Console::WriteLine("(Default): {0}", testInteger);
    long long testInt64 = (long long)Registry::GetValue(keyName, 
        "TestInt64", System::Int64::MinValue);
    Console::WriteLine("TestInt64: {0}", testInt64);
    
    // When retrieving a MultiString value, you can specify
    // an array for the default return value. 
    array<String^>^ testArray = (array<String^>^)Registry::GetValue(
        keyName, "TestArray", 
        gcnew array<String^> {"Default if TestArray
 does not exist."});
    for (int i = 0; i < testArray->Length;
 i++)
    {
        Console::WriteLine("TestArray({0}): {1}", i, testArray[i]);
    }
    
    // A string with embedded environment variables is not
    // expanded if it was stored as an ordinary string.
    String^ testExpand = (String^)Registry::GetValue(keyName, 
        "TestExpand", "Default if TestExpand does
 not exist.");
    Console::WriteLine("TestExpand: {0}", testExpand);
    
    // A string stored as ExpandString is expanded.
    String^ testExpand2 = (String^)Registry::GetValue(keyName, 
        "TestExpand2", "Default if TestExpand2
 does not exist.");
    Console::WriteLine(
        "TestExpand2: {0}...", testExpand2->Substring(0, 40));
    Console::WriteLine(
        "\r\nUse the registry editor to examine the key.");
    Console::WriteLine("Press the Enter key to delete the key.");
    Console::ReadLine();
    Registry::CurrentUser->DeleteSubKey(subKey);
}
//
// This code example produces output similar to the following:
//
// NoSuchName: Return this default if NoSuchName does not exist.
// (Default): 5280
// TestInt64: 12345678901234
// TestArray(0): One
// TestArray(1): Two
// TestArray(2): Three
// TestExpand: My path: %path%
// TestExpand2: My path: D:\Program Files\Microsoft.NET\...
//
// Use the registry editor to examine the key.
// Press the Enter key to delete the key.
継承階層継承階層
System.Object
  Microsoft.Win32.Registry
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Registry メンバ
Microsoft.Win32 名前空間
RegistryHive
RegistryKey

Registry フィールド


Registry メソッド


Registry メンバ

Windows レジストリルート キーを表す RegistryKey オブジェクト、およびキー/値ペアアクセスするための static メソッド提供します

Registry データ型公開されるメンバを以下の表に示します


パブリック フィールドパブリック フィールド
パブリック メソッドパブリック メソッド
参照参照

関連項目

Registry クラス
Microsoft.Win32 名前空間
RegistryHive
RegistryKey

レジストリー

(registry から転送)

出典: フリー百科事典『ウィキペディア(Wikipedia)』 (2023/10/22 09:00 UTC 版)

レジストリーレジストリ (registry)




「レジストリー」の続きの解説一覧


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

辞書ショートカット

すべての辞書の索引

「registry」の関連用語

registryのお隣キーワード
検索ランキング

   

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



registryのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
デジタル大辞泉デジタル大辞泉
(C)Shogakukan Inc.
株式会社 小学館
IT用語辞典バイナリIT用語辞典バイナリ
Copyright © 2005-2024 Weblio 辞書 IT用語辞典バイナリさくいん。 この記事は、IT用語辞典バイナリレジストリの記事を利用しております。
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.
ウィキペディアウィキペディア
All text is available under the terms of the GNU Free Documentation License.
この記事は、ウィキペディアのレジストリー (改訂履歴)の記事を複製、再配布したものにあたり、GNU Free Documentation Licenseというライセンスの下で提供されています。 Weblio辞書に掲載されているウィキペディアの記事も、全てGNU Free Documentation Licenseの元に提供されております。

©2024 GRAS Group, Inc.RSS