Changeset 33247 in vbox for trunk/src/VBox/Main
- Timestamp:
- Oct 20, 2010 10:01:48 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 66805
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/GuestImpl.cpp
r33139 r33247 683 683 case PROC_STS_TEN: /* Terminated normally. */ 684 684 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 } 689 693 break; 690 694 … … 724 728 if (pData->u32Flags & ExecuteProcessFlag_IgnoreOrphanedProcesses) 725 729 { 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 } 728 735 } 729 736 else … … 809 816 "%s", errMsg.c_str()); 810 817 AssertComRC(hr2); 811 LogFlowFunc(("Process ( contextID=%u, status=%u) reported error: %s\n",818 LogFlowFunc(("Process (CID=%u, status=%u) reported error: %s\n", 812 819 pData->hdr.u32ContextID, pData->u32Status, errMsg.c_str())); 813 820 } … … 815 822 } 816 823 else 817 LogFlowFunc(("Unexpected callback (magic=%u, contextID=%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)); 818 825 LogFlowFunc(("Returned with rc=%Rrc\n", vrc)); 819 826 return vrc; … … 867 874 } 868 875 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 } 870 885 } 871 886 else 872 LogFlowFunc(("Unexpected callback (magic=%u, contextID=%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)); 873 888 return rc; 874 889 } … … 889 904 AssertPtr(pCBData); 890 905 891 /* Nothing to do here yet. */ 906 /* Save bytes processed. */ 907 pCBData->cbProcessed = pData->cbProcessed; 892 908 893 909 /* Was progress canceled before? */ … … 902 918 } 903 919 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 } 905 929 } 906 930 else 907 LogFlowFunc(("Unexpected callback (magic=%u, contextID=%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)); 908 932 return rc; 909 933 } … … 918 942 if (it != mCallbackMap.end()) 919 943 { 920 LogFlowFunc(("Client with contextID=%u disconnected\n", it->first));944 LogFlowFunc(("Client with CID=%u disconnected\n", it->first)); 921 945 destroyCtrlCallbackContext(it); 922 946 } … … 1362 1386 } 1363 1387 1364 STDMETHODIMP Guest::SetProcessInput(ULONG aPID, ULONG aFlags, ULONG aTimeoutMS,ComSafeArrayIn(BYTE, aData), ULONG *aBytesWritten)1388 STDMETHODIMP Guest::SetProcessInput(ULONG aPID, ULONG aFlags, ComSafeArrayIn(BYTE, aData), ULONG *aBytesWritten) 1365 1389 { 1366 1390 #ifndef VBOX_WITH_GUEST_CONTROL … … 1370 1394 1371 1395 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 } 1374 1404 1375 1405 AutoCaller autoCaller(this); … … 1380 1410 try 1381 1411 { 1412 /* Init. */ 1413 *aBytesWritten = 0; 1414 1382 1415 /* Search for existing PID. */ 1383 1416 GuestProcessMapIterConst itProc = getProcessByPID(aPID); … … 1409 1442 { 1410 1443 rc = progress->init(static_cast<IGuest*>(this), 1411 Bstr(tr(" Getting output ofprocess")).raw(),1412 TRUE );1444 Bstr(tr("Setting input for process")).raw(), 1445 TRUE /* Cancelable */); 1413 1446 } 1414 1447 if (FAILED(rc)) return rc; 1415 1416 /* Adjust timeout */1417 if (aTimeoutMS == 0)1418 aTimeoutMS = UINT32_MAX;1419 1448 1420 1449 PCALLBACKDATAEXECINSTATUS pData = (PCALLBACKDATAEXECINSTATUS)RTMemAlloc(sizeof(CALLBACKDATAEXECINSTATUS)); … … 1430 1459 1431 1460 com::SafeArray<BYTE> sfaData(ComSafeArrayInArg(aData)); 1461 uint32_t cbSize = sfaData.size(); 1432 1462 1433 1463 VBOXHGCMSVCPARM paParms[6]; … … 1436 1466 paParms[i++].setUInt32(aPID); 1437 1467 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); 1440 1470 1441 1471 int vrc = VINF_SUCCESS; … … 1464 1494 if (RT_SUCCESS(vrc)) 1465 1495 { 1466 LogFlowFunc(("Waiting for HGCM callback (timeout=%ldms) ...\n", aTimeoutMS));1496 LogFlowFunc(("Waiting for HGCM callback ...\n")); 1467 1497 1468 1498 /* … … 1478 1508 1479 1509 /* Wait until operation completed. */ 1480 rc = it->second.pProgress->WaitForCompletion( aTimeoutMS);1510 rc = it->second.pProgress->WaitForCompletion(UINT32_MAX /* Wait forever */); 1481 1511 if (FAILED(rc)) throw rc; 1482 1512 … … 1491 1521 && fCompleted) 1492 1522 { 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; 1494 1528 } 1495 else /* If callback not called within time ... well, that's a timeout! */1496 vrc = VERR_TIMEOUT;1497 1529 } 1498 1530 else /* Operation was canceled. */ 1499 {1500 1531 vrc = VERR_CANCELLED; 1501 }1502 1532 1503 1533 if (RT_FAILURE(vrc)) 1504 1534 { 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) 1511 1536 { 1512 1537 rc = setError(VBOX_E_IPRT_ERROR, … … 1929 1954 && !(aFlags & CopyFileFlag_Update) 1930 1955 && !(aFlags & CopyFileFlag_FollowLinks)) 1931 return E_INVALIDARG; 1956 { 1957 return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), aFlags); 1958 } 1932 1959 } 1933 1960 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r33239 r33247 7603 7603 7604 7604 <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 7605 7621 name="CopyFileFlag" 7606 7622 uuid="23f79fdf-738a-493d-b80b-42d607c9b916" … … 7614 7630 </const> 7615 7631 7616 <const name="Recursive" value=" 2">7632 <const name="Recursive" value="1"> 7617 7633 <desc>Copy directories recursively.</desc> 7618 7634 </const> 7619 7635 7620 <const name="Update" value=" 4">7636 <const name="Update" value="2"> 7621 7637 <desc>Copy only when the source file is newer than the destination file or when the destination file is missing.</desc> 7622 7638 </const> 7623 7639 7624 <const name="FollowLinks" value=" 8">7640 <const name="FollowLinks" value="4"> 7625 7641 <desc>Follow symbolic links.</desc> 7626 7642 </const> … … 7629 7645 <interface 7630 7646 name="IGuest" extends="$unknown" 7631 uuid=" c165a809-0882-4c76-9220-746da84b5ecf"7647 uuid="5d38c1dd-2604-4ddf-92e5-0c0cdd3bdbd5" 7632 7648 wsmap="managed" 7633 7649 > … … 7964 7980 <desc> 7965 7981 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 handling7971 the input data. Pass 0 for an infinite timeout.7972 7982 </desc> 7973 7983 </param> -
trunk/src/VBox/Main/include/GuestImpl.h
r33064 r33247 99 99 ULONG aTimeoutMS, ULONG *aPID, IProgress **aProgress); 100 100 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); 102 102 STDMETHOD(GetProcessStatus)(ULONG aPID, ULONG *aExitCode, ULONG *aFlags, ULONG *aStatus); 103 103 STDMETHOD(CopyToGuest)(IN_BSTR aSource, IN_BSTR aDest, ULONG aFlags, IProgress **aProgress);
Note:
See TracChangeset
for help on using the changeset viewer.