Changeset 28833 in vbox
- Timestamp:
- Apr 27, 2010 2:42:14 PM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
r28800 r28833 147 147 szUser, szPassword, uTimeLimitMS); 148 148 } 149 150 VBoxServiceVerbose(4, "Control: VBoxServiceControlHandleCmdStartProcess returned with %Rrc\n", rc); 149 151 return rc; 150 152 } … … 188 190 AssertPtr(pData); 189 191 190 uint32_t cbRead = _4K; /* Try reading 4k. */ 191 uint8_t *pBuf = (uint8_t*)RTMemAlloc(cbRead); 192 uint32_t cbSize = _4K; 193 uint32_t cbRead = cbSize; 194 uint8_t *pBuf = (uint8_t*)RTMemAlloc(cbSize); 192 195 if (pBuf) 193 196 { 194 rc = VBoxServiceControlExecReadPipeBufferContent(&pData->stdOut, pBuf, cb Read, &cbRead);197 rc = VBoxServiceControlExecReadPipeBufferContent(&pData->stdOut, pBuf, cbSize, &cbRead); 195 198 if (RT_SUCCESS(rc)) 196 199 { … … 208 211 rc = VERR_NOT_FOUND; /* PID not found! */ 209 212 } 213 VBoxServiceVerbose(4, "Control: VBoxServiceControlHandleCmdGetOutput returned with %Rrc\n", rc); 210 214 return rc; 211 215 } -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp
r28800 r28833 264 264 * and that it's now OK to send input to the process. 265 265 */ 266 VBoxServiceVerbose(3, "Control: Process started: PID=%u, CID=%u \n",267 pData->uPID, pThread->uContextID );266 VBoxServiceVerbose(3, "Control: Process started: PID=%u, CID=%u, User=%s, PW=%s\n", 267 pData->uPID, pThread->uContextID, pData->pszUser, pData->pszPassword); 268 268 rc = VbglR3GuestCtrlExecReportStatus(pThread->uClientID, pThread->uContextID, 269 269 pData->uPID, PROC_STS_STARTED, 0 /* u32Flags */, … … 545 545 } 546 546 else 547 { 547 548 pbBuffer = NULL; 549 *pcbToRead = 0; 550 } 548 551 return VINF_SUCCESS; 549 552 } -
trunk/src/VBox/Main/GuestImpl.cpp
r28816 r28833 582 582 pCBData->u32Flags = pData->u32Flags; 583 583 584 /* Allocate data buffer and copy it */ 585 if (pData->cbData && pData->pvData) 586 { 584 /* Make sure we really got something! */ 585 if ( pData->cbData 586 && pData->pvData) 587 { 588 /* Allocate data buffer and copy it */ 587 589 pCBData->pvData = RTMemAlloc(pData->cbData); 588 590 AssertReturn(pCBData->pvData, VERR_NO_MEMORY); 589 591 memcpy(pCBData->pvData, pData->pvData, pData->cbData); 590 592 pCBData->cbData = pData->cbData; 593 } 594 else 595 { 596 pCBData->pvData = NULL; 597 pCBData->cbData = 0; 591 598 } 592 599 ASMAtomicWriteBool(&it->bCalled, true); … … 1039 1046 } while (!it->bCalled); 1040 1047 1041 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1042 1043 /* Did we get some output? */ 1044 pData = (HOSTEXECOUTCALLBACKDATA*)it->pvData; 1045 Assert(it->cbData == sizeof(HOSTEXECOUTCALLBACKDATA)); 1046 AssertPtr(pData); 1047 1048 if ( it->bCalled 1049 && pData->cbData 1050 && pData->pvData) 1048 if (it->bCalled) 1051 1049 { 1052 /* Do we need to resize the array? */ 1053 if (pData->cbData > cbData) 1054 outputData.resize(pData->cbData); 1055 1056 /* Fill output in supplied out buffer. */ 1057 memcpy(outputData.raw(), pData->pvData, pData->cbData); 1058 outputData.resize(pData->cbData); /* Shrink to fit actual buffer size. */ 1050 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1051 1052 /* Did we get some output? */ 1053 pData = (HOSTEXECOUTCALLBACKDATA*)it->pvData; 1054 Assert(it->cbData == sizeof(HOSTEXECOUTCALLBACKDATA)); 1055 AssertPtr(pData); 1056 1057 if (pData->cbData) 1058 { 1059 /* Do we need to resize the array? */ 1060 if (pData->cbData > cbData) 1061 outputData.resize(pData->cbData); 1062 1063 /* Fill output in supplied out buffer. */ 1064 memcpy(outputData.raw(), pData->pvData, pData->cbData); 1065 outputData.resize(pData->cbData); /* Shrink to fit actual buffer size. */ 1066 } 1067 else 1068 vrc = VERR_NO_DATA; /* This is not an error we want to report to COM. */ 1059 1069 } 1060 else 1061 vrc = VERR_NO_DATA; /* This is not an error we want to report to COM. */ 1070 else /* If callback not called within time ... well, that's a timeout! */ 1071 vrc = VERR_TIMEOUT; 1072 1073 if (RT_FAILURE(vrc)) 1074 { 1075 if (vrc == VERR_NO_DATA) 1076 { 1077 /* This is not an error we want to report to COM. */ 1078 } 1079 else if (vrc == VERR_TIMEOUT) 1080 { 1081 rc = setError(VBOX_E_IPRT_ERROR, 1082 tr("The guest did not output within time (%ums)"), aTimeoutMS); 1083 } 1084 else 1085 { 1086 rc = setError(E_UNEXPECTED, 1087 tr("The service call failed with error %Rrc"), vrc); 1088 } 1089 } 1062 1090 } 1063 1091 else
Note:
See TracChangeset
for help on using the changeset viewer.