Changeset 28218 in vbox
- Timestamp:
- Apr 12, 2010 3:58:07 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/GuestControlSvc.h
r28206 r28218 68 68 69 69 /** 70 * Process status when executed in the guest. 71 */ 72 enum eProcessStatus 73 { 74 PROC_STATUS_STARTED = 1, 75 76 PROC_STATUS_TERMINATED = 2 77 }; 78 79 /** 70 80 * The service functions which are callable by host. 71 81 */ … … 178 188 179 189 } VBoxGuestCtrlHGCMMsgExecCmd; 190 191 typedef struct _VBoxGuestCtrlHGCMMsgExecStatus 192 { 193 VBoxGuestHGCMCallInfo hdr; 194 195 HGCMFunctionParameter pid; 196 197 HGCMFunctionParameter status; 198 199 HGCMFunctionParameter flags; 200 201 HGCMFunctionParameter data; 202 203 } VBoxGuestCtrlHGCMMsgExecStatus; 180 204 #pragma pack () 181 205 -
trunk/include/VBox/VBoxGuestLib.h
r27976 r28218 514 514 VBGLR3DECL(int) VbglR3GuestCtrlDisconnect(uint32_t u32ClientId); 515 515 VBGLR3DECL(int) VbglR3GuestCtrlGetHostMsg(uint32_t u32ClientId, uint32_t *puMsg, uint32_t *puNumParms); 516 VBGLR3DECL(int) VbglR3GuestCtrl GetHostCmdExec(uint32_t u32ClientId, uint32_t uNumParms,516 VBGLR3DECL(int) VbglR3GuestCtrlExecGetHostCmd(uint32_t u32ClientId, uint32_t uNumParms, 517 517 char *pszCmd, uint32_t cbCmd, 518 518 uint32_t *puFlags, … … 525 525 char *pszPassword, uint32_t cbPassword, 526 526 uint32_t *puTimeLimit); 527 VBGLR3DECL(int) VbglR3GuestCtrlExecReportStatus(uint32_t u32ClientId, 528 uint32_t u32PID, 529 uint32_t u32Status, 530 uint32_t u32Flags, 531 void *pvData, 532 uint32_t cbData); 527 533 /** @} */ 528 534 # endif /* VBOX_WITH_GUEST_CONTROL defined */ -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestCtrl.cpp
r28086 r28218 117 117 Msg.hdr.u32ClientID = u32ClientId; 118 118 Msg.hdr.u32Function = GUEST_GET_HOST_MSG; /* Tell the host we want our next command. */ 119 Msg.hdr.cParms = 2; 119 Msg.hdr.cParms = 2; /* Just peek for the next message! */ 120 120 121 121 VbglHGCMParmUInt32Set(&Msg.msg, 0); … … 145 145 * @param ppvData 146 146 * @param uNumParms 147 */ 148 VBGLR3DECL(int) VbglR3GuestCtrlGetHostCmdExec(uint32_t u32ClientId, uint32_t uNumParms, 147 ** @todo Docs! 148 */ 149 VBGLR3DECL(int) VbglR3GuestCtrlExecGetHostCmd(uint32_t u32ClientId, uint32_t uNumParms, 149 150 char *pszCmd, uint32_t cbCmd, 150 151 uint32_t *puFlags, … … 214 215 } 215 216 217 218 219 220 /** 221 * Reports the process status (along with some other stuff) to the host. 222 * 223 * @returns VBox status code. 224 ** @todo Docs! 225 */ 226 VBGLR3DECL(int) VbglR3GuestCtrlExecReportStatus(uint32_t u32ClientId, 227 uint32_t u32PID, 228 uint32_t u32Status, 229 uint32_t u32Flags, 230 void *pvData, 231 uint32_t cbData) 232 { 233 VBoxGuestCtrlHGCMMsgExecStatus Msg; 234 235 Msg.hdr.result = VERR_WRONG_ORDER; 236 Msg.hdr.u32ClientID = u32ClientId; 237 Msg.hdr.u32Function = GUEST_EXEC_SEND_STATUS; 238 Msg.hdr.cParms = 4; 239 240 VbglHGCMParmUInt32Set(&Msg.pid, 0); 241 VbglHGCMParmUInt32Set(&Msg.status, 0); 242 VbglHGCMParmUInt32Set(&Msg.flags, 0); 243 VbglHGCMParmPtrSet(&Msg.data, pvData, cbData); 244 245 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); 246 if (RT_SUCCESS(rc)) 247 { 248 int rc2 = Msg.hdr.result; 249 if (RT_FAILURE(rc2)) 250 rc = rc2; 251 } 252 return rc; 253 } 254 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
r28119 r28218 110 110 uint32_t uTimeLimitMS; 111 111 112 int rc = VbglR3GuestCtrl GetHostCmdExec(u32ClientId, uNumParms,112 int rc = VbglR3GuestCtrlExecGetHostCmd(u32ClientId, uNumParms, 113 113 /* Command */ 114 114 szCmd, sizeof(szCmd), -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp
r28119 r28218 512 512 pData->pszCmd = RTStrDup(pszCmd); 513 513 pData->uFlags = uFlags; 514 pData->uNumEnvVars = 0; 515 pData->uNumArgs = 0; /* Initialize in case of RTGetOptArgvFromString() is failing ... */ 514 516 515 517 /* Prepare argument list. */ 516 518 int rc = RTGetOptArgvFromString(&pData->papszArgs, (int*)&pData->uNumArgs, 517 pszArgs ? pszArgs : "", NULL); 519 (uNumArgs > 0) ? pszArgs : "", NULL); 520 /* Did we get the same result? */ 518 521 Assert(uNumArgs == pData->uNumArgs); 522 519 523 if (RT_SUCCESS(rc)) 520 524 { … … 590 594 VBoxServiceVerbose(3, "Control: Thread of process \"%s\" started.", pData->pszCmd); 591 595 596 uint32_t u32ClientID; 597 int rc = VbglR3GuestCtrlConnect(&u32ClientID); 598 if (RT_SUCCESS(rc)) 599 VBoxServiceVerbose(3, "Control: Thread client ID: %#x\n", u32ClientID); 600 else 601 { 602 VBoxServiceError("Control: Thread failed to connect to the guest control service! Error: %Rrc\n", rc); 603 return rc; 604 } 605 592 606 /* 593 607 * Create the environment. 594 608 */ 595 609 RTENV hEnv; 596 intrc = RTEnvClone(&hEnv, RTENV_DEFAULT);610 rc = RTEnvClone(&hEnv, RTENV_DEFAULT); 597 611 if (RT_SUCCESS(rc)) 598 612 { … … 651 665 { 652 666 VBoxServiceVerbose(3, "Control: Process \"%s\" started.\n", pData->pszCmd); 667 rc = VbglR3GuestCtrlExecReportStatus(u32ClientID, 123, PROC_STATUS_STARTED, 668 0 /* u32Flags */, NULL, 0); 653 669 /** @todo Dump a bit more info here. */ 654 670 … … 693 709 } 694 710 711 VbglR3GuestCtrlDisconnect(u32ClientID); 695 712 VBoxServiceVerbose(3, "Control: Thread of process \"%s\" ended with rc=%Rrc.\n", pData->pszCmd, rc); 696 713 -
trunk/src/VBox/HostServices/GuestControl/service.cpp
r28206 r28218 505 505 int rc = VINF_SUCCESS; 506 506 507 HostCmd newCmd; 508 rc = paramBufferAllocate(&newCmd.parmBuf, cParms, paParms); 509 if (RT_SUCCESS(rc)) 510 { 511 mHostCmds.push_back(newCmd); 512 513 /* Limit list size by deleting oldest element. */ 514 if (mHostCmds.size() > 256) /** @todo Use a define! */ 515 mHostCmds.pop_front(); 516 } 517 507 518 /* Some lazy guests to wake up which can process this command right now? */ 508 519 if (!mGuestWaiters.empty()) … … 511 522 rc = notifyGuest(&curCall, eFunction, cParms, paParms); 512 523 mGuestWaiters.pop_front(); 513 }514 else /* No guests waiting, buffer it */515 {516 HostCmd newCmd;517 rc = paramBufferAllocate(&newCmd.parmBuf, cParms, paParms);518 if (RT_SUCCESS(rc))519 {520 mHostCmds.push_back(newCmd);521 522 /* Limit list size by deleting oldest element. */523 if (mHostCmds.size() > 256) /** @todo Use a define! */524 mHostCmds.pop_front();525 }526 524 } 527 525 return rc; -
trunk/src/VBox/Main/GuestImpl.cpp
r28207 r28218 450 450 */ 451 451 PHOSTCALLBACKDATA pCBData = reinterpret_cast<PHOSTCALLBACKDATA>(pvParms); 452 AssertPtr(pCBData); 452 453 AssertReturn(sizeof(HOSTCALLBACKDATA) == cbParms, VERR_INVALID_PARAMETER); 453 454 AssertReturn(HOSTCALLBACKMAGIC == pCBData->u32Magic, VERR_INVALID_PARAMETER); … … 457 458 int rc = VINF_SUCCESS; 458 459 Guest *pGuest = static_cast <Guest *>(pvExtension); 460 AssertPtr(pGuest); 459 461 460 462 switch (u32Function) 461 463 { 464 case GUEST_EXEC_SEND_STATUS: 465 LogFlowFunc(("GUEST_EXEC_SEND_STATUS\n")); 466 break; 467 462 468 default: 463 469 rc = VERR_NOT_SUPPORTED; … … 614 620 cMsWait = RT_MIN(1000, aTimeoutMS - (uint32_t)cMsElapsed); 615 621 } 622 RTThreadSleep(100); 616 623 } while (!mSignalled); 617 624 #if 0
Note:
See TracChangeset
for help on using the changeset viewer.