regSetString function

void regSetString(
  1. int hkey,
  2. String subKey,
  3. String valueName,
  4. String value, {
  5. int accessRights = KEY_SET_VALUE,
})

Sets a Windows registry key to a string value of type REG_SZ.

A WindowsException is thrown the call falls.

Implementation

void regSetString(
  int hkey,
  String subKey,
  String valueName,
  String value, {
  int accessRights = KEY_SET_VALUE,
}) {
  final pValue = TEXT(value);

  try {
    _regSetValue(
        hkey, subKey, valueName, pValue.cast(), (value.length + 1) * 2, REG_SZ,
        accessRights: accessRights);
  } finally {
    calloc.free(pValue);
  }
}