Changeset 42657 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Aug 7, 2012 12:17:06 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 79855
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r42636 r42657 1702 1702 LogFlowThisFuncEnter(); 1703 1703 1704 AutoCaller autoCaller(this); 1705 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1706 1707 ReturnComNotImplemented(); 1704 if (RT_UNLIKELY((aTemplate) == NULL || *(aTemplate) == '\0')) 1705 return setError(E_INVALIDARG, tr("No file to remove specified")); 1706 1707 AutoCaller autoCaller(this); 1708 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1709 1710 GuestProcessStartupInfo procInfo; 1711 GuestProcessStream streamOut; 1712 int rc = VINF_SUCCESS; 1713 1714 try /* Can this be done without exceptions? */ 1715 { 1716 Utf8Str strTemplate(aTemplate); 1717 procInfo.mName = Utf8StrFmt(tr("Creating temporary directory from template \"%s\"", 1718 strTemplate.c_str())); 1719 procInfo.mCommand = Utf8Str(VBOXSERVICE_TOOL_MKTEMP); 1720 /* Construct arguments. */ 1721 procInfo.mArguments.push_back(Utf8Str("--machinereadable")); 1722 procInfo.mArguments.push_back(Bstr(aTemplate)); /* The template we want to use. */ 1723 } 1724 catch (...) 1725 { 1726 return E_OUTOFMEMORY; 1727 } 1728 1729 ComObjPtr<GuestProcess> pProcess; 1730 rc = processCreateExInteral(procInfo, pProcess); 1731 if (RT_SUCCESS(rc)) 1732 { 1733 GuestProcessWaitResult waitRes; 1734 BYTE byBuf[_64K]; 1735 size_t cbRead; 1736 1737 for (;;) 1738 { 1739 rc = pProcess->waitFor(ProcessWaitForFlag_StdOut, 1740 30 * 1000 /* Timeout */, waitRes); 1741 if ( RT_FAILURE(rc) 1742 || waitRes.mResult != ProcessWaitResult_StdOut) 1743 { 1744 break; 1745 } 1746 1747 rc = pProcess->readData(OUTPUT_HANDLE_ID_STDOUT, sizeof(byBuf), 1748 30 * 1000 /* Timeout */, byBuf, sizeof(byBuf), 1749 &cbRead); 1750 if (RT_FAILURE(rc)) 1751 break; 1752 1753 rc = streamOut.AddData(byBuf, cbRead); 1754 if (RT_FAILURE(rc)) 1755 break; 1756 } 1757 1758 LogFlowThisFunc(("rc=%Rrc, cbRead=%RU32, cbStreamOut=%RU32\n", 1759 rc, cbRead, streamOut.GetSize())); 1760 } 1761 1762 if (RT_FAILURE(rc)) 1763 return setError(E_FAIL, tr("Error while creating temporary directory: %Rrc"), rc); 1764 if (!streamOut.GetSize()) 1765 return setError(E_FAIL, tr("No return code after creating temporary directory")); 1766 GuestProcessStreamBlock streamBlock; 1767 rc = streamOut.ParseBlock(streamBlock); 1768 if (RT_SUCCESS(rc)) 1769 { 1770 streamBlock.GetString("name"); 1771 int64_t i64rc; 1772 if (RT_FAILURE(streamBlock.GetInt64Ex("rc", &i64rc))) 1773 return setError(E_FAIL, tr("No return code after creating temporary directory")); 1774 // *aReturnCode = (LONG)i64rc; 1775 } 1776 else 1777 return setError(E_FAIL, tr("Error while getting return code from creating temporary directory: %Rrc"), rc); 1778 return S_OK; 1708 1779 #endif /* VBOX_WITH_GUEST_CONTROL */ 1709 1780 } … … 1969 2040 } 1970 2041 1971 STDMETHODIMP GuestSession::FileRemove(IN_BSTR aPath , LONG *aReturnCode)2042 STDMETHODIMP GuestSession::FileRemove(IN_BSTR aPath) 1972 2043 { 1973 2044 #ifndef VBOX_WITH_GUEST_CONTROL … … 2046 2117 if (RT_FAILURE(streamBlock.GetInt64Ex("rc", &i64rc))) 2047 2118 return setError(E_FAIL, tr("No return code after deleting file")); 2048 *aReturnCode = (LONG)i64rc;2049 2119 } 2050 2120 else … … 2154 2224 2155 2225 return hr; 2156 #endif /* VBOX_WITH_GUEST_CONTROL */2157 }2158 2159 STDMETHODIMP GuestSession::FileRemove(IN_BSTR aPath)2160 {2161 #ifndef VBOX_WITH_GUEST_CONTROL2162 ReturnComNotImplemented();2163 #else2164 LogFlowThisFuncEnter();2165 2166 AutoCaller autoCaller(this);2167 if (FAILED(autoCaller.rc())) return autoCaller.rc();2168 2169 ReturnComNotImplemented();2170 2226 #endif /* VBOX_WITH_GUEST_CONTROL */ 2171 2227 }
Note:
See TracChangeset
for help on using the changeset viewer.