Registry.DynData Field

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Note: This API is now obsolete.

Contains dynamic registry data. This field reads the Windows registry base key HKEY_DYN_DATA.

Namespace:   Microsoft.Win32
Assembly:  mscorlib (in mscorlib.dll)

[ObsoleteAttribute("The DynData registry key only works on Win9x, which is no longer supported by the CLR.  On NT-based operating systems, use the PerformanceData registry key instead.")]
public static readonly RegistryKey DynData

Field Value

Type: Microsoft.Win32.RegistryKey

Exception Condition
ObjectDisposedException

The operating system does not support dynamic data; that is, it is not Windows 98, Windows 98 Second Edition, or Windows Millennium Edition (Windows Me).

The Windows 98/Windows Me registry supports both static data (which is stored on disk in the registry) and dynamic data (which changes frequently, such as performance statistics). This dynamic data area is the mechanism that allows Virtual Device Drivers (VxDs) to provide real-time data to Win32 applications that can run remotely as well as locally. It also allows the system monitor to provide performance statistics on remote Windows 98/Windows Me systems.

VxDs are not limited to performance data. They can provide any data they want to pass from Ring 0 to Ring 3 efficiently without monopolizing the CPU. The registry supports dynamic data by storing a pointer to a function that returns a value (or many values). When a Registry call queries values associated with a dynamic key, that function is called to return the desired value or values.

System_CAPS_noteNote

Dynamic keys were introduced in Microsoft Windows 95 to handle dynamic Registry data. They are supported only in Windows 98/Windows Me.

The following example demonstrates how to retrieve the subkeys of this key, and prints their names to the screen. Use the OpenSubKey method to create an instance of the particular subkey of interest. You can then use other operations in RegistryKey to manipulate that key. Note that this example can return no results, since there might not be dynamic data available, or you might not be running Windows 98/ME. Using this key may cause an error on other systems.

using System;
using Microsoft.Win32;

class Reg {
    public static void Main() {

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

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

    static void PrintKeys(RegistryKey rkey) {

        // Retrieve all the subkeys for the specified key.
        String [] names;
        try {
            names = rkey.GetSubKeyNames();
        }
        catch (System.IO.IOException e) {
            Console.WriteLine("HKEY_DYN_DATA is not available on this machine.");
            return;
        }

        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;
        }
    }
}

.NET Framework
Available since 1.1
Return to top
Show: