Changeset 28286 in vbox for trunk/src/VBox/Additions/common/VBoxService
- Timestamp:
- Apr 14, 2010 10:02:30 AM (15 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
r28218 r28286 96 96 static int VBoxServiceControlHandleCmdExec(uint32_t u32ClientId, uint32_t uNumParms) 97 97 { 98 uint32_t uContextID; 98 99 char szCmd[_1K]; 99 100 uint32_t uFlags; … … 110 111 uint32_t uTimeLimitMS; 111 112 112 int rc = VbglR3GuestCtrlExecGetHostCmd(u32ClientId, uNumParms, 113 if (uNumParms != 14) 114 return VERR_INVALID_PARAMETER; 115 116 int rc = VbglR3GuestCtrlExecGetHostCmd(u32ClientId, 117 uNumParms, 118 &uContextID, 113 119 /* Command */ 114 120 szCmd, sizeof(szCmd), … … 134 140 else 135 141 { 136 rc = VBoxServiceControlExecProcess( szCmd, uFlags, szArgs, uNumArgs,142 rc = VBoxServiceControlExecProcess(uContextID, szCmd, uFlags, szArgs, uNumArgs, 137 143 szEnv, cbEnv, uNumEnvVars, 138 144 szStdIn, szStdOut, szStdErr, -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp
r28244 r28286 235 235 236 236 237 static int VBoxServiceControlExecProcLoop(uint32_t uClientID, RTPROCESS hProcess, RTMSINTERVAL cMillies, RTPOLLSET hPollSet, 237 static int VBoxServiceControlExecProcLoop(PVBOXSERVICECTRLTHREADDATA pData, 238 RTPROCESS hProcess, RTMSINTERVAL cMillies, RTPOLLSET hPollSet, 238 239 RTPIPE hStdInW, RTPIPE hStdOutR, RTPIPE hStdErrR) 239 240 { … … 256 257 RTMSINTERVAL cMsPollCur = 0; 257 258 259 /* Assign PID to thread data. */ 260 pData->uPID = hProcess; 261 258 262 /* 259 263 * Before entering the loop, tell the host that we've started the guest 260 264 * and that it's now OK to send input to the process. 261 265 */ 262 rc = VbglR3GuestCtrlExecReportStatus(uClientID, hProcess, 263 PROC_STS_STARTED, 0 /* u32Flags */, 266 AssertPtr(pData); 267 rc = VbglR3GuestCtrlExecReportStatus(pData->uClientID, pData->uContextID, 268 pData->uPID, PROC_STS_STARTED, 0 /* u32Flags */, 264 269 NULL /* pvData */, 0 /* cbData */); 265 270 … … 446 451 } 447 452 448 VBoxServiceVerbose(3, "Control: Process ended: Status=%u, Flags=%u\n", uStatus, uFlags); 449 rc = VbglR3GuestCtrlExecReportStatus(uClientID, hProcess, 450 uStatus, uFlags, 453 VBoxServiceVerbose(3, "Control: Process ended: PID=%u, Status=%u, Flags=%u\n", 454 pData->uPID, uStatus, uFlags); 455 rc = VbglR3GuestCtrlExecReportStatus(pData->uClientID, pData->uContextID, 456 pData->uPID, uStatus, uFlags, 451 457 NULL /* pvData */, 0 /* cbData */); 452 458 } … … 509 515 510 516 /** Allocates and gives back a thread data struct which then can be used by the worker thread. */ 511 PVBOXSERVICECTRLTHREADDATA VBoxServiceControlExecAllocateThreadData(const char *pszCmd, uint32_t uFlags, 517 PVBOXSERVICECTRLTHREADDATA VBoxServiceControlExecAllocateThreadData(uint32_t u32ContextID, 518 const char *pszCmd, uint32_t uFlags, 512 519 const char *pszArgs, uint32_t uNumArgs, 513 520 const char *pszEnv, uint32_t cbEnv, uint32_t uNumEnvVars, … … 519 526 return NULL; 520 527 528 /* ClientID will be assigned when thread is started! */ 529 pData->uContextID = u32ContextID; 521 530 pData->pszCmd = RTStrDup(pszCmd); 522 531 pData->uFlags = uFlags; … … 601 610 */ 602 611 RTThreadUserSignal(RTThreadSelf()); 603 VBoxServiceVerbose(3, "Control: Thread of process \"%s\" started.\n", pData->pszCmd); 604 605 uint32_t u32ClientID; 606 int rc = VbglR3GuestCtrlConnect(&u32ClientID); 612 VBoxServiceVerbose(3, "Control: Thread of process \"%s\" started\n", pData->pszCmd); 613 614 int rc = VbglR3GuestCtrlConnect(&pData->uClientID); 607 615 if (RT_FAILURE(rc)) 608 616 { … … 685 693 686 694 /* Enter the process loop. */ 687 rc = VBoxServiceControlExecProcLoop( u32ClientID,695 rc = VBoxServiceControlExecProcLoop(pData, 688 696 hProcess, pData->uTimeLimitMS, hPollSet, 689 697 hStdInW, hStdOutR, hStdErrR); … … 704 712 else /* Something went wrong; report error! */ 705 713 { 706 int rc2 = VbglR3GuestCtrlExecReportStatus( u32ClientID, 0 /* PID */,714 int rc2 = VbglR3GuestCtrlExecReportStatus(pData->uClientID, pData->uContextID, pData->uPID, 707 715 PROC_STS_ERROR, rc, 708 716 NULL /* pvData */, 0 /* cbData */); … … 726 734 } 727 735 728 VbglR3GuestCtrlDisconnect( u32ClientID);736 VbglR3GuestCtrlDisconnect(pData->uClientID); 729 737 VBoxServiceVerbose(3, "Control: Thread of process \"%s\" ended with rc=%Rrc\n", pData->pszCmd, rc); 730 738 … … 743 751 } 744 752 745 int VBoxServiceControlExecProcess( const char *pszCmd, uint32_t uFlags,753 int VBoxServiceControlExecProcess(uint32_t uContextID, const char *pszCmd, uint32_t uFlags, 746 754 const char *pszArgs, uint32_t uNumArgs, 747 755 const char *pszEnv, uint32_t cbEnv, uint32_t uNumEnvVars, … … 750 758 { 751 759 PVBOXSERVICECTRLTHREADDATA pThreadData = 752 VBoxServiceControlExecAllocateThreadData(pszCmd, uFlags, 760 VBoxServiceControlExecAllocateThreadData(uContextID, 761 pszCmd, uFlags, 753 762 pszArgs, uNumArgs, 754 763 pszEnv, cbEnv, uNumEnvVars, -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h
r28251 r28286 129 129 typedef struct 130 130 { 131 uint32_t uClientID; 132 uint32_t uContextID; 133 uint32_t uPID; 131 134 char *pszCmd; 132 135 uint32_t uFlags; … … 213 216 214 217 #ifdef VBOX_WITH_GUEST_CONTROL 215 extern int VBoxServiceControlExecProcess( const char *pszCmd, uint32_t uFlags,218 extern int VBoxServiceControlExecProcess(uint32_t uContext, const char *pszCmd, uint32_t uFlags, 216 219 const char *pszArgs, uint32_t uNumArgs, 217 220 const char *pszEnv, uint32_t cbEnv, uint32_t uNumEnvVars,
Note:
See TracChangeset
for help on using the changeset viewer.