Changeset 84548 in vbox for trunk/src/VBox/Additions/common/VBoxService
- Timestamp:
- May 26, 2020 5:43:31 PM (5 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
r84243 r84548 247 247 const uint64_t fGuestFeatures = VBOX_GUESTCTRL_GF_0_SET_SIZE 248 248 | VBOX_GUESTCTRL_GF_0_PROCESS_ARGV0 249 | VBOX_GUESTCTRL_GF_0_PROCESS_DYNAMIC_SIZES; 249 | VBOX_GUESTCTRL_GF_0_PROCESS_DYNAMIC_SIZES 250 | VBOX_GUESTCTRL_GF_0_SHUTDOWN; 250 251 251 252 rc = VbglR3GuestCtrlReportFeatures(g_idControlSvcClient, fGuestFeatures, &g_fControlHostFeatures0); -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
r84215 r84548 34 34 #include <iprt/process.h> 35 35 #include <iprt/rand.h> 36 #include <iprt/system.h> /* For RTShutdown. */ 36 37 37 38 #include "VBoxServiceInternal.h" … … 990 991 991 992 /** 993 * Handles shutting down / rebooting the guest OS. 994 * 995 * @returns VBox status code. 996 * @param pSession Guest session. 997 * @param pHostCtx Host context. 998 */ 999 static int vgsvcGstCtrlSessionHandleShutdown(PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx) 1000 { 1001 AssertPtrReturn(pSession, VERR_INVALID_POINTER); 1002 AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER); 1003 1004 /* 1005 * Retrieve the request. 1006 */ 1007 uint32_t fAction; 1008 int rc = VbglR3GuestCtrlGetShutdown(pHostCtx, &fAction); 1009 if (RT_SUCCESS(rc)) 1010 { 1011 VGSvcVerbose(1, "Host requested to %s system ...\n", (fAction & RTSYSTEM_SHUTDOWN_REBOOT) ? "reboot" : "shutdown"); 1012 1013 /* Reply first to the host, in order to avoid host hangs when issuing the guest shutdown. */ 1014 rc = VbglR3GuestCtrlMsgReply(pHostCtx, VINF_SUCCESS); 1015 if (RT_FAILURE(rc)) 1016 { 1017 VGSvcError("Failed to reply to shutdown / reboot request, rc=%Rrc\n", rc); 1018 } 1019 else 1020 { 1021 rc = RTSystemShutdown(0 /*cMsDelay*/, 1022 fAction | RTSYSTEM_SHUTDOWN_PLANNED, 1023 "VBoxService"); 1024 if (RT_FAILURE(rc)) 1025 VGSvcError("%s system failed with %Rrc\n", (fAction & RTSYSTEM_SHUTDOWN_REBOOT) ? "Rebooting" : "Shuting down"); 1026 } 1027 } 1028 else 1029 { 1030 VGSvcError("Error fetching parameters for shutdown / reboot request: %Rrc\n", rc); 1031 VbglR3GuestCtrlMsgSkip(pHostCtx->uClientID, rc, UINT32_MAX); 1032 } 1033 1034 return rc; 1035 } 1036 1037 1038 /** 992 1039 * Handles getting the user's home directory. 993 1040 * … … 1412 1459 if (fImpersonated) 1413 1460 rc = vgsvcGstCtrlSessionHandlePathUserHome(pSession, pHostCtx); 1461 break; 1462 1463 case HOST_MSG_SHUTDOWN: 1464 rc = vgsvcGstCtrlSessionHandleShutdown(pSession, pHostCtx); 1414 1465 break; 1415 1466
Note:
See TracChangeset
for help on using the changeset viewer.