Inheritance

You can specify data in the metabase to be inheritable. This means that if you add a data entry to a key and specify it as inheritable, all of the keys subordinate to that key can access that data. This is much more efficient than setting the same data for each key in the metabase. For example, if you add the inheritable data MD_MYDATA for the key /LM, the subkeys /LM/W3SVC and /LM/MSFTPSVC, and others below them can also return MD_MYDATA. Inheritance stops at a subordinate key where the same metabase identifier is set. Inheritance can not skip keys—keys inherit data from the nearest superior key where the identifier is set.

You can specify that an entry is inheritable by setting the METADATA_INHERIT flag in the dwMDAttributes member of the METADATA_RECORD structure that is passed to the SetData method.

When retrieving data, you can specify that inherited data be returned by setting the METADATA_INHERIT flag in the dwMDAttributes member of the METADATA_RECORD structure that is passed to the GetData or EnumData method. For the GetAllData method, you specify this flag in the dwMDAttributes parameter. If this flag is not set, inherited data is not returned.

You can use the METADATA_PARTIAL_PATH flag to specify that inherited data be returned, even if a requested path does not exist. If you add the same inheritable data at the key /LM as in the preceding example, the subkey /LM/MYSVC would return the inheritable data, MD_MYDATA, regardless of whether the key /LM/MYSVC exists in the metabase. The METADATA_PARTIAL_PATH flag only applies if the METADATA_INHERIT flag is also set.

You can use the METADATA_PARTIAL_PATH flag to minimize the number of keys you create in the metabase. For example, when files in a directory have no metabase data of their own, you can specify data as inheritable at the directory key and use the METADATA_PARTIAL_PATH flag to return inherited data for individual files without having to create keys for them.

You can use the METADATA_ISINHERITED flag to determine if retrieved data is local or inherited. If specified on a call to any method that retrieves data, the method will return this flag for those data elements for which the returned data is inherited.