RegQueryValueEx function Null safety advapi32

int RegQueryValueEx (
  1. int hKey,
  2. Pointer<Utf16> lpValueName,
  3. Pointer<Uint32> lpReserved,
  4. Pointer<Uint32> lpType,
  5. Pointer<Uint8> lpData,
  6. Pointer<Uint32> lpcbData
)

Retrieves the type and data for the specified value name associated with an open registry key. To ensure that any string values (REG_SZ, REG_MULTI_SZ, and REG_EXPAND_SZ) returned are null-terminated, use the RegGetValue function.

LSTATUS RegQueryValueExW(
  HKEY    hKey,
  LPCWSTR lpValueName,
  LPDWORD lpReserved,
  LPDWORD lpType,
  LPBYTE  lpData,
  LPDWORD lpcbData
);

Implementation

int RegQueryValueEx(
    int hKey,
    Pointer<Utf16> lpValueName,
    Pointer<Uint32> lpReserved,
    Pointer<Uint32> lpType,
    Pointer<Uint8> lpData,
    Pointer<Uint32> lpcbData) {
  final _RegQueryValueEx = _advapi32.lookupFunction<
      Int32 Function(
          IntPtr hKey,
          Pointer<Utf16> lpValueName,
          Pointer<Uint32> lpReserved,
          Pointer<Uint32> lpType,
          Pointer<Uint8> lpData,
          Pointer<Uint32> lpcbData),
      int Function(
          int hKey,
          Pointer<Utf16> lpValueName,
          Pointer<Uint32> lpReserved,
          Pointer<Uint32> lpType,
          Pointer<Uint8> lpData,
          Pointer<Uint32> lpcbData)>('RegQueryValueExW');
  return _RegQueryValueEx(
      hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);
}