4 Protocol Examples

The following example shows a sample call from a client to a server, asking the server to reboot in 30 seconds and to display a message.

In this example, the client contacts the server with the following WsdrInitiateShutdown call.

 ULONG = (return value, not yet set)
 WsdrInitiateShutdown(
     [ in ] handle_t Binding = (set by RpcBindingFromStringBinding()),
     [ in, unique ] PREG_UNICODE_STRING lpMessage = 
 L"Restarting system. Please save your work.",
     [ in ] DWORD dwGracePeriod = 30,
     [ in ] DWORD dwShudownFlags = SHUTDOWN_RESTART,
     [ in ] DWORD dwReason = SHUTDN_MAJOR_OTHER,
     [ in, unique ] PREG_UNICODE_STRING lpClientHint = L""
     );

The server receives this call, verifies that the caller has sufficient privileges to shut down the computer, displays the message to the interactively logged on users, and after waiting 30 seconds, reboots the server.

The server responds with the following WsdrInitiateShutdown return.

  
 ULONG = ERROR_SUCCESS
 WsdrInitiateShutdown(
     [ in ] handle_t Binding = (unchanged),
     [ in, unique ] PREG_UNICODE_STRING lpMessage = (unchanged),
     [ in ] DWORD dwGracePeriod = (unchanged),
     [ in ] DWORD dwShudownFlags = (unchanged),
     [ in ] DWORD dwReason = (unchanged),
     [ in, unique ] PREG_UNICODE_STRING lpClientHint = (unchanged)
     );
Show: