subkeyNames property
Enumerates the values for the specified open Registry key.
Implementation
Iterable<String> get subkeyNames sync* {
final keyInfo = queryInfo();
// Allocate enough length for the maximum key name (including extra for the
// null terminator).
final keyNameLength = keyInfo.subKeyNameMaxLength + 1;
final lpName = wsalloc(keyNameLength);
final lpcchName = calloc<DWORD>();
try {
for (var idx = 0; idx < keyInfo.subKeyCount; idx++) {
// Set this size each time, since it's reset to the actual length by the
// call.
lpcchName.value = keyNameLength;
final retcode = RegEnumKeyEx(
hkey, idx, lpName, lpcchName, nullptr, nullptr, nullptr, nullptr);
if (retcode == WIN32_ERROR.ERROR_SUCCESS) yield lpName.toDartString();
}
} finally {
free(lpName);
free(lpcchName);
}
}