regDeleteKey function

void regDeleteKey(
  1. int hkey,
  2. String subKey
)

Deletes an registry key.

subKey maybe be a path such as Microsoft/Windows A WindowsException is thrown if the delete fails.

Implementation

void regDeleteKey(
  int hkey,
  String subKey,
) {
  final pSubKey = TEXT(subKey);

  try {
    final result = RegDeleteKeyEx(hkey, pSubKey, KEY_WOW64_64KEY, 0);
    if (result != ERROR_SUCCESS) {
      throw WindowsException(HRESULT_FROM_WIN32(result));
    }
  } finally {
    calloc.free(pSubKey);
  }
}