RegQueryValue function Null safety advapi32

int RegQueryValue(
  1. int hKey,
  2. Pointer<Utf16> lpSubKey,
  3. Pointer<Utf16> lpData,
  4. Pointer<Int32> lpcbData
)

Retrieves the data associated with the default or unnamed value of a specified registry key. The data must be a null-terminated string.

LSTATUS RegQueryValueW(
  HKEY    hKey,
  LPCWSTR lpSubKey,
  LPWSTR  lpData,
  PLONG   lpcbData);

Implementation

int RegQueryValue(int hKey, Pointer<Utf16> lpSubKey, Pointer<Utf16> lpData,
    Pointer<Int32> lpcbData) {
  final _RegQueryValue = _advapi32.lookupFunction<
      Int32 Function(IntPtr hKey, Pointer<Utf16> lpSubKey,
          Pointer<Utf16> lpData, Pointer<Int32> lpcbData),
      int Function(int hKey, Pointer<Utf16> lpSubKey, Pointer<Utf16> lpData,
          Pointer<Int32> lpcbData)>('RegQueryValueW');
  return _RegQueryValue(hKey, lpSubKey, lpData, lpcbData);
}