RegCreateKey function Null safety advapi32

int RegCreateKey(
  1. int hKey,
  2. Pointer<Utf16> lpSubKey,
  3. Pointer<IntPtr> phkResult
)

Creates the specified registry key. If the key already exists in the registry, the function opens it.

LSTATUS RegCreateKeyW(
  HKEY    hKey,
  LPCWSTR lpSubKey,
  PHKEY   phkResult);

Implementation

int RegCreateKey(int hKey, Pointer<Utf16> lpSubKey, Pointer<IntPtr> phkResult) {
  final _RegCreateKey = _advapi32.lookupFunction<
      Int32 Function(
          IntPtr hKey, Pointer<Utf16> lpSubKey, Pointer<IntPtr> phkResult),
      int Function(int hKey, Pointer<Utf16> lpSubKey,
          Pointer<IntPtr> phkResult)>('RegCreateKeyW');
  return _RegCreateKey(hKey, lpSubKey, phkResult);
}