InitiateShutdown function advapi32

int InitiateShutdown(
  1. PCWSTR? lpMachineName,
  2. PCWSTR? lpMessage,
  3. int dwGracePeriod,
  4. SHUTDOWN_FLAGS dwShutdownFlags,
  5. SHUTDOWN_REASON dwReason,
)

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

To learn more, see learn.microsoft.com/windows/win32/api/winreg/nf-winreg-initiateshutdownw.

Implementation

@pragma('vm:prefer-inline')
int InitiateShutdown(
  PCWSTR? lpMachineName,
  PCWSTR? lpMessage,
  int dwGracePeriod,
  SHUTDOWN_FLAGS dwShutdownFlags,
  SHUTDOWN_REASON dwReason,
) => _InitiateShutdown(
  lpMachineName ?? nullptr,
  lpMessage ?? nullptr,
  dwGracePeriod,
  dwShutdownFlags,
  dwReason,
);