VirtualBox

Changeset 28833 in vbox


Ignore:
Timestamp:
Apr 27, 2010 2:42:14 PM (15 years ago)
Author:
vboxsync
Message:

Guest Control: Bugfixes.

Location:
trunk/src/VBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp

    r28800 r28833  
    147147                                           szUser, szPassword, uTimeLimitMS);
    148148    }
     149
     150    VBoxServiceVerbose(4, "Control: VBoxServiceControlHandleCmdStartProcess returned with %Rrc\n", rc);
    149151    return rc;
    150152}
     
    188190            AssertPtr(pData);
    189191
    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);
    192195            if (pBuf)
    193196            {
    194                 rc = VBoxServiceControlExecReadPipeBufferContent(&pData->stdOut, pBuf, cbRead, &cbRead);
     197                rc = VBoxServiceControlExecReadPipeBufferContent(&pData->stdOut, pBuf, cbSize, &cbRead);
    195198                if (RT_SUCCESS(rc))
    196199                {
     
    208211            rc = VERR_NOT_FOUND; /* PID not found! */
    209212    }
     213    VBoxServiceVerbose(4, "Control: VBoxServiceControlHandleCmdGetOutput returned with %Rrc\n", rc);
    210214    return rc;
    211215}
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp

    r28800 r28833  
    264264     * and that it's now OK to send input to the process.
    265265     */
    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);
    268268    rc = VbglR3GuestCtrlExecReportStatus(pThread->uClientID, pThread->uContextID,
    269269                                         pData->uPID, PROC_STS_STARTED, 0 /* u32Flags */,
     
    545545    }
    546546    else
     547    {
    547548        pbBuffer = NULL;
     549        *pcbToRead = 0;
     550    }
    548551    return VINF_SUCCESS;
    549552}
  • trunk/src/VBox/Main/GuestImpl.cpp

    r28816 r28833  
    582582        pCBData->u32Flags = pData->u32Flags;
    583583
    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 */
    587589            pCBData->pvData = RTMemAlloc(pData->cbData);
    588590            AssertReturn(pCBData->pvData, VERR_NO_MEMORY);
    589591            memcpy(pCBData->pvData, pData->pvData, pData->cbData);
    590592            pCBData->cbData = pData->cbData;
     593        }
     594        else
     595        {
     596            pCBData->pvData = NULL;
     597            pCBData->cbData = 0;
    591598        }
    592599        ASMAtomicWriteBool(&it->bCalled, true);
     
    10391046                } while (!it->bCalled);
    10401047   
    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)
    10511049                {
    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. */
    10591069                }
    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                }
    10621090            }
    10631091            else
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette