RegCreateKeyEx function Null safety advapi32

int RegCreateKeyEx(
  1. int hKey,
  2. Pointer<Utf16> lpSubKey,
  3. int Reserved,
  4. Pointer<Utf16> lpClass,
  5. int dwOptions,
  6. int samDesired,
  7. Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes,
  8. Pointer<IntPtr> phkResult,
  9. Pointer<Uint32> lpdwDisposition
)

Creates the specified registry key. If the key already exists, the function opens it. Note that key names are not case sensitive.

LSTATUS RegCreateKeyExW(
  HKEY hKey,
  LPCWSTR lpSubKey,
  DWORD Reserved,
  LPWSTR lpClass,
  DWORD dwOptions,
  REGSAM samDesired,
  const LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  PHKEY phkResult,
  LPDWORD lpdwDisposition
);

Implementation

int RegCreateKeyEx(
    int hKey,
    Pointer<Utf16> lpSubKey,
    int Reserved,
    Pointer<Utf16> lpClass,
    int dwOptions,
    int samDesired,
    Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes,
    Pointer<IntPtr> phkResult,
    Pointer<Uint32> lpdwDisposition) {
  final _RegCreateKeyEx = _advapi32.lookupFunction<
      Int32 Function(
          IntPtr hKey,
          Pointer<Utf16> lpSubKey,
          Uint32 Reserved,
          Pointer<Utf16> lpClass,
          Uint32 dwOptions,
          Uint32 samDesired,
          Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes,
          Pointer<IntPtr> phkResult,
          Pointer<Uint32> lpdwDisposition),
      int Function(
          int hKey,
          Pointer<Utf16> lpSubKey,
          int Reserved,
          Pointer<Utf16> lpClass,
          int dwOptions,
          int samDesired,
          Pointer<SECURITY_ATTRIBUTES> lpSecurityAttributes,
          Pointer<IntPtr> phkResult,
          Pointer<Uint32> lpdwDisposition)>('RegCreateKeyExW');
  return _RegCreateKeyEx(hKey, lpSubKey, Reserved, lpClass, dwOptions,
      samDesired, lpSecurityAttributes, phkResult, lpdwDisposition);
}