regGetString function Null safety

String regGetString(
  1. int hkey,
  2. String subKey,
  3. String valueName,
  4. {int accessRights = KEY_QUERY_VALUE}

Gets a Windows registry value o0f type REG_SZ hkey is typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE.

See the following link for additional values:

subKey is name of the registry key you want to open. This is typically something like 'Environment'.

accessRights defines what rights are requried for the opened key. This is typically one of KEY_ALL_ACCESS, KEY_QUERY_VALUE, KEY_READ, KEY_SET_VALUE Refer to the following link for a full set of options.

throws WindowsException if the get failes


String regGetString(
  int hkey,
  String subKey,
  String valueName, {
  int accessRights = KEY_QUERY_VALUE,
}) {
  late final String value;

  final pResult =
      _regGetValue(hkey, subKey, valueName, accessRights: accessRights);
  try {
    value = pResult.toDartString();
  } finally {;
  return value;