regSetString function

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

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

A WindowsException is thrown the call falls. @Throwing(WindowsException)

Implementation

void regSetString(
  HKEY hkey,
  String subKey,
  String valueName,
  String value, {
  REG_SAM_FLAGS accessRights = KEY_SET_VALUE,
}) {
  final pValue = value.toNativeUtf16();

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