RegReplaceKey function Null safety advapi32

int RegReplaceKey(
  1. int hKey,
  2. Pointer<Utf16> lpSubKey,
  3. Pointer<Utf16> lpNewFile,
  4. Pointer<Utf16> lpOldFile
)

Replaces the file backing a registry key and all its subkeys with another file, so that when the system is next started, the key and subkeys will have the values stored in the new file.

LSTATUS RegReplaceKeyW(
  HKEY    hKey,
  LPCWSTR lpSubKey,
  LPCWSTR lpNewFile,
  LPCWSTR lpOldFile);

Implementation

int RegReplaceKey(int hKey, Pointer<Utf16> lpSubKey, Pointer<Utf16> lpNewFile,
    Pointer<Utf16> lpOldFile) {
  final _RegReplaceKey = _advapi32.lookupFunction<
      Int32 Function(IntPtr hKey, Pointer<Utf16> lpSubKey,
          Pointer<Utf16> lpNewFile, Pointer<Utf16> lpOldFile),
      int Function(int hKey, Pointer<Utf16> lpSubKey, Pointer<Utf16> lpNewFile,
          Pointer<Utf16> lpOldFile)>('RegReplaceKeyW');
  return _RegReplaceKey(hKey, lpSubKey, lpNewFile, lpOldFile);
}