Share via


3.7.4.1.14 RpcWinStationShutdownSystem (Opnum 15)

The RpcWinStationShutdownSystem method shuts down the system and optionally logs off all sessions and/or reboots the system. The caller requires SeShutdownPrivilege (see [MSDN-PRVLGECNSTS]) when performing the shutdown locally and SeRemoteShutdownPrivilege (see [MSDN-PRVLGECNSTS]) when performing the shutdown remotely. The caller calls ExitWindowsEx (see [MSDN-ExitWindowsEx]) to perform the actual shutdown once all checks have been completed.

 BOOLEAN RpcWinStationShutdownSystem(
   [in] SERVER_HANDLE hServer,
   [out] DWORD* pResult,
   [in] DWORD ClientLogonId,
   [in] DWORD ShutdownFlags
 );

hServer: Handle to the server object. This is of type SERVER_HANDLE. The hServer MUST be obtained from a previous call to RpcWinStationOpenServer.

pResult:  Failure error code if the call to RpcWinStationShutdownSystem failed. If the call was successful, this parameter MUST be STATUS_SUCCESS (0x00000000).

Value

Meaning

STATUS_SUCCESS

0x00000000

The call succeeded.

STATUS_ACCESS_DENIED

0xC0000022

The caller does not have permission to shut down the system.

ClientLogonId: The session requesting to shut down the system. Ignored when the RPC call is remote.

ShutdownFlags:  Shutdown flags. It MUST be any bitwise OR combination of the following flags.

Value

Meaning

WSD_LOGOFF

0x00000001

Forces sessions to logoff.

WSD_SHUTDOWN

0x00000002

Shuts down the system.

WSD_REBOOT

0x00000004

Reboots after shutdown.

WSD_POWEROFF

0x00000008

Powers off after shutdown.

Return Values:  Returns TRUE if the call succeeded, or FALSE if the method failed. On failure, pResult indicates the failure status code.

Return value/code

Description

0x01

TRUE

Successful completion.

0x00

FALSE

Method call failed.