(a)
private LONG _Reg_EnumKeyName( in HKEY hkey , in DWORD dwIndex , in LPSTR lpName , inout DWORD cchName) in { assert(null !== hkey); } body { FILETIME ftLastWriteTime; return RegEnumKeyExA(hkey, dwIndex, lpName, cchName , RESERVED, null, null, &ftLastWriteTime); }(b)
class KeyNameSequence { public: char[] GetKeyName(in uint index) { DWORD cSubKeys; DWORD cchSubKeyMaxLen; HKEY hkey = m_key.m_hkey; LONG res = _Reg_GetNumSubKeys(hkey, cSubKeys, cchSubKeyMaxLen); char[] sName = new char[1 + cchSubKeyMaxLen]; DWORD cchName; res = _Reg_EnumKeyName(hkey, index, sName, cchName); assert(ERROR_MORE_DATA != res); if(ERROR_SUCCESS != res) { throw new RegistryException("Invalid key", res); } return sName[0 .. cchName]; } ...(c)
private LONG _Reg_GetNumSubKeys( in HKEY hkey , out DWORD cSubKeys , out DWORD cchSubKeyMaxLen);
Example 1: (a) The definition for helper function _Reg_EnumKeyName(); (b) methods of several of the classes in the registry module; (c) determining the number of subkeys and the maximum length of the names of the subkeys.