VirtualBox

Changeset 33247 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Oct 20, 2010 10:01:48 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
66805
Message:

VBoxService/Guest Execution: Update.

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/GuestImpl.cpp

    r33139 r33247  
    683683                case PROC_STS_TEN: /* Terminated normally. */
    684684                    LogRel(("Guest process (PID %u) exited normally\n", pCBData->u32PID)); /** @todo Add process name */
    685                     hr = it->second.pProgress->notifyComplete(S_OK);
    686                     AssertComRC(hr);
    687                     LogFlowFunc(("Proccess (context ID=%u, status=%u) terminated successfully\n",
    688                                  pData->hdr.u32ContextID, pData->u32Status));
     685                    if (!it->second.pProgress->getCompleted())
     686                    {
     687                        hr = it->second.pProgress->notifyComplete(S_OK);
     688                        AssertComRC(hr);
     689
     690                        LogFlowFunc(("Proccess (CID=%u, status=%u) terminated successfully\n",
     691                                     pData->hdr.u32ContextID, pData->u32Status));
     692                    }
    689693                    break;
    690694
     
    724728                    if (pData->u32Flags & ExecuteProcessFlag_IgnoreOrphanedProcesses)
    725729                    {
    726                         hr = it->second.pProgress->notifyComplete(S_OK);
    727                         AssertComRC(hr);
     730                        if (!it->second.pProgress->getCompleted())
     731                        {
     732                            hr = it->second.pProgress->notifyComplete(S_OK);
     733                            AssertComRC(hr);
     734                        }
    728735                    }
    729736                    else
     
    809816                                                                   "%s", errMsg.c_str());
    810817                AssertComRC(hr2);
    811                 LogFlowFunc(("Process (context ID=%u, status=%u) reported error: %s\n",
     818                LogFlowFunc(("Process (CID=%u, status=%u) reported error: %s\n",
    812819                             pData->hdr.u32ContextID, pData->u32Status, errMsg.c_str()));
    813820            }
     
    815822    }
    816823    else
    817         LogFlowFunc(("Unexpected callback (magic=%u, context ID=%u) arrived\n", pData->hdr.u32Magic, pData->hdr.u32ContextID));
     824        LogFlowFunc(("Unexpected callback (magic=%u, CID=%u) arrived\n", pData->hdr.u32Magic, pData->hdr.u32ContextID));
    818825    LogFlowFunc(("Returned with rc=%Rrc\n", vrc));
    819826    return vrc;
     
    867874        }
    868875        else
    869             it->second.pProgress->notifyComplete(S_OK);
     876        {
     877            BOOL fCompleted;
     878            if (   SUCCEEDED(it->second.pProgress->COMGETTER(Completed)(&fCompleted))
     879                && !fCompleted)
     880            {
     881                    /* If we previously got completed notification, don't trigger again. */
     882                it->second.pProgress->notifyComplete(S_OK);
     883            }
     884        }
    870885    }
    871886    else
    872         LogFlowFunc(("Unexpected callback (magic=%u, context ID=%u) arrived\n", pData->hdr.u32Magic, pData->hdr.u32ContextID));
     887        LogFlowFunc(("Unexpected callback (magic=%u, CID=%u) arrived\n", pData->hdr.u32Magic, pData->hdr.u32ContextID));
    873888    return rc;
    874889}
     
    889904        AssertPtr(pCBData);
    890905
    891         /* Nothing to do here yet. */
     906        /* Save bytes processed. */
     907        pCBData->cbProcessed = pData->cbProcessed;
    892908
    893909        /* Was progress canceled before? */
     
    902918        }
    903919        else
    904             it->second.pProgress->notifyComplete(S_OK);
     920        {
     921            BOOL fCompleted;
     922            if (   SUCCEEDED(it->second.pProgress->COMGETTER(Completed)(&fCompleted))
     923                && !fCompleted)
     924            {
     925                    /* If we previously got completed notification, don't trigger again. */
     926                it->second.pProgress->notifyComplete(S_OK);
     927            }
     928        }
    905929    }
    906930    else
    907         LogFlowFunc(("Unexpected callback (magic=%u, context ID=%u) arrived\n", pData->hdr.u32Magic, pData->hdr.u32ContextID));
     931        LogFlowFunc(("Unexpected callback (magic=%u, CID=%u) arrived\n", pData->hdr.u32Magic, pData->hdr.u32ContextID));
    908932    return rc;
    909933}
     
    918942    if (it != mCallbackMap.end())
    919943    {
    920         LogFlowFunc(("Client with context ID=%u disconnected\n", it->first));
     944        LogFlowFunc(("Client with CID=%u disconnected\n", it->first));
    921945        destroyCtrlCallbackContext(it);
    922946    }
     
    13621386}
    13631387
    1364 STDMETHODIMP Guest::SetProcessInput(ULONG aPID, ULONG aFlags, ULONG aTimeoutMS, ComSafeArrayIn(BYTE, aData), ULONG *aBytesWritten)
     1388STDMETHODIMP Guest::SetProcessInput(ULONG aPID, ULONG aFlags, ComSafeArrayIn(BYTE, aData), ULONG *aBytesWritten)
    13651389{
    13661390#ifndef VBOX_WITH_GUEST_CONTROL
     
    13701394
    13711395    CheckComArgExpr(aPID, aPID > 0);
    1372     if (aFlags != 0) /* Flags are not supported at the moment. */
    1373         return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), aFlags);
     1396    CheckComArgOutPointerValid(aBytesWritten);
     1397
     1398    /* Validate flags. */
     1399    if (aFlags)
     1400    {
     1401        if (!(aFlags & ProcessInputFlag_EOF))
     1402            return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), aFlags);
     1403    }
    13741404
    13751405    AutoCaller autoCaller(this);
     
    13801410    try
    13811411    {
     1412        /* Init. */
     1413        *aBytesWritten = 0;
     1414
    13821415        /* Search for existing PID. */
    13831416        GuestProcessMapIterConst itProc = getProcessByPID(aPID);
     
    14091442            {
    14101443                rc = progress->init(static_cast<IGuest*>(this),
    1411                                     Bstr(tr("Getting output of process")).raw(),
    1412                                     TRUE);
     1444                                    Bstr(tr("Setting input for process")).raw(),
     1445                                    TRUE /* Cancelable */);
    14131446            }
    14141447            if (FAILED(rc)) return rc;
    1415 
    1416             /* Adjust timeout */
    1417             if (aTimeoutMS == 0)
    1418                 aTimeoutMS = UINT32_MAX;
    14191448
    14201449            PCALLBACKDATAEXECINSTATUS pData = (PCALLBACKDATAEXECINSTATUS)RTMemAlloc(sizeof(CALLBACKDATAEXECINSTATUS));
     
    14301459
    14311460            com::SafeArray<BYTE> sfaData(ComSafeArrayInArg(aData));
     1461            uint32_t cbSize = sfaData.size();
    14321462
    14331463            VBOXHGCMSVCPARM paParms[6];
     
    14361466            paParms[i++].setUInt32(aPID);
    14371467            paParms[i++].setUInt32(aFlags);
    1438             paParms[i++].setPointer(sfaData.raw(), sfaData.size());
    1439             paParms[i++].setUInt32(sfaData.size());
     1468            paParms[i++].setPointer(sfaData.raw(), cbSize);
     1469            paParms[i++].setUInt32(cbSize);
    14401470
    14411471            int vrc = VINF_SUCCESS;
     
    14641494            if (RT_SUCCESS(vrc))
    14651495            {
    1466                 LogFlowFunc(("Waiting for HGCM callback (timeout=%ldms) ...\n", aTimeoutMS));
     1496                LogFlowFunc(("Waiting for HGCM callback ...\n"));
    14671497
    14681498                /*
     
    14781508
    14791509                    /* Wait until operation completed. */
    1480                     rc = it->second.pProgress->WaitForCompletion(aTimeoutMS);
     1510                    rc = it->second.pProgress->WaitForCompletion(UINT32_MAX /* Wait forever */);
    14811511                    if (FAILED(rc)) throw rc;
    14821512
     
    14911521                            && fCompleted)
    14921522                        {
    1493                             /* Nothing to do here yet. */
     1523                            PCALLBACKDATAEXECINSTATUS pData = (PCALLBACKDATAEXECINSTATUS)it->second.pvData;
     1524                            Assert(it->second.cbData == sizeof(CALLBACKDATAEXECINSTATUS));
     1525                            AssertPtr(pData);
     1526
     1527                            *aBytesWritten = pData->cbProcessed;
    14941528                        }
    1495                         else /* If callback not called within time ... well, that's a timeout! */
    1496                             vrc = VERR_TIMEOUT;
    14971529                    }
    14981530                    else /* Operation was canceled. */
    1499                     {
    15001531                        vrc = VERR_CANCELLED;
    1501                     }
    15021532
    15031533                    if (RT_FAILURE(vrc))
    15041534                    {
    1505                         if (vrc == VERR_TIMEOUT)
    1506                         {
    1507                             rc = setError(VBOX_E_IPRT_ERROR,
    1508                                           tr("The guest did not process input within time (%ums)"), aTimeoutMS);
    1509                         }
    1510                         else if (vrc == VERR_CANCELLED)
     1535                        if (vrc == VERR_CANCELLED)
    15111536                        {
    15121537                            rc = setError(VBOX_E_IPRT_ERROR,
     
    19291954            && !(aFlags & CopyFileFlag_Update)
    19301955            && !(aFlags & CopyFileFlag_FollowLinks))
    1931             return E_INVALIDARG;
     1956        {
     1957            return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), aFlags);
     1958        }
    19321959    }
    19331960
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r33239 r33247  
    76037603
    76047604  <enum
     7605    name="ProcessInputFlag"
     7606    uuid="5d38c1dd-2604-4ddf-92e5-0c0cdd3bdbd5"
     7607  >
     7608    <desc>
     7609      Guest process input flags.
     7610    </desc>
     7611
     7612    <const name="None"     value="0">
     7613      <desc>No flag set.</desc>
     7614    </const>
     7615    <const name="EOF"   value="1">
     7616        <desc>End of file (input) reached.</desc>
     7617    </const>
     7618  </enum>
     7619
     7620  <enum
    76057621    name="CopyFileFlag"
    76067622    uuid="23f79fdf-738a-493d-b80b-42d607c9b916"
     
    76147630    </const>
    76157631
    7616     <const name="Recursive"   value="2">
     7632    <const name="Recursive"   value="1">
    76177633      <desc>Copy directories recursively.</desc>
    76187634    </const>
    76197635
    7620     <const name="Update"      value="4">
     7636    <const name="Update"      value="2">
    76217637      <desc>Copy only when the source file is newer than the destination file or when the destination file is missing.</desc>
    76227638    </const>
    76237639
    7624     <const name="FollowLinks" value="8">
     7640    <const name="FollowLinks" value="4">
    76257641      <desc>Follow symbolic links.</desc>
    76267642    </const>
     
    76297645  <interface
    76307646     name="IGuest" extends="$unknown"
    7631      uuid="c165a809-0882-4c76-9220-746da84b5ecf"
     7647     uuid="5d38c1dd-2604-4ddf-92e5-0c0cdd3bdbd5"
    76327648     wsmap="managed"
    76337649     >
     
    79647980        <desc>
    79657981          Not used, must be set to zero.
    7966         </desc>
    7967       </param>
    7968       <param name="timeoutMS" type="unsigned long" dir="in">
    7969         <desc>
    7970           The maximum timeout value (in msec) to wait for handling
    7971           the input data. Pass 0 for an infinite timeout.
    79727982        </desc>
    79737983      </param>
  • trunk/src/VBox/Main/include/GuestImpl.h

    r33064 r33247  
    9999                              ULONG aTimeoutMS, ULONG *aPID, IProgress **aProgress);
    100100    STDMETHOD(GetProcessOutput)(ULONG aPID, ULONG aFlags, ULONG aTimeoutMS, LONG64 aSize, ComSafeArrayOut(BYTE, aData));
    101     STDMETHOD(SetProcessInput)(ULONG aPID, ULONG aFlags, ULONG aTimeoutMS, ComSafeArrayIn(BYTE, aData), ULONG *aBytesWritten);
     101    STDMETHOD(SetProcessInput)(ULONG aPID, ULONG aFlags, ComSafeArrayIn(BYTE, aData), ULONG *aBytesWritten);
    102102    STDMETHOD(GetProcessStatus)(ULONG aPID, ULONG *aExitCode, ULONG *aFlags, ULONG *aStatus);
    103103    STDMETHOD(CopyToGuest)(IN_BSTR aSource, IN_BSTR aDest, ULONG aFlags, IProgress **aProgress);
Note: See TracChangeset for help on using the changeset viewer.

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