Platform SDK: Registry |
The registry stores data in a hierarchically structured tree. Each node in the tree is called a key. Each key can contain both subkeys and data entries called values. Sometimes, the presence of a key is all the data that an application requires; other times, an application opens a key and uses the values associated with the key. A key can have any number of values, and the values can be in any form. Registry values can be any of the following types:
Type | Description |
---|---|
REG_BINARY | Raw binary data in any form. |
REG_DWORD | A 32-bit number. |
REG_SZ | A null-terminated string. It is a Unicode or ANSI string, depending on whether you use the Unicode or ANSI function. |
REG_MULTI_SZ | An array of null-terminated strings, terminated by two null characters. |
REG_EXPAND_SZ | A null-terminated string that contains unexpanded references to environment variables (for example, "%PATH%"). It is a Unicode or ANSI string, depending on whether you use the Unicode or ANSI function. |
REG_LINK | A Unicode symbolic link. |
REG_NONE | No defined value type. |
Each key has a name consisting of one or more printable characters. Key names cannot include a space, a backslash (\), or a wildcard character (* or ?). Key names beginning with a period (.) are reserved. The name of each subkey is unique with respect to the key that is immediately above it in the hierarchy. Key names are not localized into other languages, although values may be.
The following figure is an example registry key structure as displayed by the Registry Editor.
Each of the HKEY trees is a key. HARDWARE, SAM, SECURITY, SOFTWARE, and SYSTEM are subkeys of HKEY_LOCAL_MACHINE and DESCRIPTION, DEVICEMAP, and RESOURCEMAP are subkeys of HARDWARE key in the preceding figure. Each value consists of a value name and it's associated data, if any. MaxObjectNumber and VgaCompatible are values under the DEVICEMAP subkey containing data.