InitiateShutdown function Null safety advapi32

int InitiateShutdown(
  1. Pointer<Utf16> lpMachineName,
  2. Pointer<Utf16> lpMessage,
  3. int dwGracePeriod,
  4. int dwShutdownFlags,
  5. int dwReason
)

Initiates a shutdown and restart of the specified computer, and restarts any applications that have been registered for restart.

DWORD InitiateShutdownW(
  LPWSTR lpMachineName,
  LPWSTR lpMessage,
  DWORD  dwGracePeriod,
  DWORD  dwShutdownFlags,
  DWORD  dwReason
);

Implementation

int InitiateShutdown(Pointer<Utf16> lpMachineName, Pointer<Utf16> lpMessage,
    int dwGracePeriod, int dwShutdownFlags, int dwReason) {
  final _InitiateShutdown = _advapi32.lookupFunction<
      Uint32 Function(Pointer<Utf16> lpMachineName, Pointer<Utf16> lpMessage,
          Uint32 dwGracePeriod, Uint32 dwShutdownFlags, Uint32 dwReason),
      int Function(
          Pointer<Utf16> lpMachineName,
          Pointer<Utf16> lpMessage,
          int dwGracePeriod,
          int dwShutdownFlags,
          int dwReason)>('InitiateShutdownW');
  return _InitiateShutdown(
      lpMachineName, lpMessage, dwGracePeriod, dwShutdownFlags, dwReason);
}