VirtualBox

Changeset 49948 in vbox


Ignore:
Timestamp:
Dec 17, 2013 9:51:45 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
91358
Message:

GuestCtrl/Main: Report back temporary name when calling IGuestSession::DirectoryCreateTemp().

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h

    r49504 r49948  
    150150     *  a certin VBoxService tool's guest stream block. */
    151151    int FromLs(const GuestProcessStreamBlock &strmBlk);
     152    int FromMkTemp(const GuestProcessStreamBlock &strmBlk);
    152153    int FromStat(const GuestProcessStreamBlock &strmBlk);
    153154
     
    285286    size_t GetCount(void) const;
    286287
     288    int GetRc(void) const;
     289
    287290    const char* GetString(const char *pszKey) const;
    288291
  • trunk/src/VBox/Main/include/GuestSessionImpl.h

    r49504 r49948  
    343343    int                     directoryRemoveInternal(const Utf8Str &strPath, uint32_t uFlags, int *pGuestRc);
    344344    int                     directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pGuestRc);
    345     int                     objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, const Utf8Str &strName, int *pGuestRc);
     345    int                     objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, Utf8Str &strName, int *pGuestRc);
    346346    int                     directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo, ComObjPtr<GuestDirectory> &pDirectory, int *pGuestRc);
    347347    int                     directoryQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc);
  • trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp

    r49440 r49948  
    317317        if (RT_FAILURE(rc)) throw rc;
    318318        /** @todo Add complete ls info! */
     319    }
     320    catch (int rc2)
     321    {
     322        rc = rc2;
     323    }
     324
     325    LogFlowFuncLeaveRC(rc);
     326    return rc;
     327}
     328
     329int GuestFsObjData::FromMkTemp(const GuestProcessStreamBlock &strmBlk)
     330{
     331    LogFlowFunc(("\n"));
     332
     333    int rc;
     334
     335    try
     336    {
     337#ifdef DEBUG
     338        strmBlk.DumpToLog();
     339#endif
     340        /* Object name. */
     341        mName = strmBlk.GetString("name");
     342        if (mName.isEmpty()) throw VERR_NOT_FOUND;
     343        /* Assign the stream block's rc. */
     344        rc = strmBlk.GetRc();
    319345    }
    320346    catch (int rc2)
     
    466492
    467493/**
     494 * Gets the return code (name = "rc") of this stream block.
     495 *
     496 * @return  IPRT status code.
     497 */
     498int GuestProcessStreamBlock::GetRc(void) const
     499{
     500    const char *pszValue = GetString("rc");
     501    if (pszValue)
     502    {
     503        return RTStrToInt16(pszValue);
     504    }
     505    return VERR_NOT_FOUND;
     506}
     507
     508/**
    468509 * Returns a string value of a specified key.
    469510 *
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r49632 r49948  
    866866
    867867int GuestSession::objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath,
    868                                            bool fDirectory, const Utf8Str &strName, int *pGuestRc)
    869 {
    870     LogFlowThisFunc(("strTemplate=%s, strPath=%s, fDirectory=%RTbool, strName=%s\n",
    871                      strTemplate.c_str(), strPath.c_str(), fDirectory, strName.c_str()));
     868                                           bool fDirectory, Utf8Str &strName, int *pGuestRc)
     869{
     870    LogFlowThisFunc(("strTemplate=%s, strPath=%s, fDirectory=%RTbool\n",
     871                     strTemplate.c_str(), strPath.c_str(), fDirectory));
    872872
    873873    int vrc = VINF_SUCCESS;
     
    894894    }
    895895
     896    /** @todo Use an internal HGCM command for this operation, since
     897     *        we now can run in a user-dedicated session. */
     898    int guestRc; GuestCtrlStreamObjects stdOut;
    896899    if (RT_SUCCESS(vrc))
    897         vrc = GuestProcessTool::Run(this, procInfo, pGuestRc);
     900        vrc = GuestProcessTool::RunEx(this, procInfo,
     901                                      &stdOut, 1 /* cStrmOutObjects */,
     902                                      &guestRc);
     903    if (   RT_SUCCESS(vrc)
     904        && RT_SUCCESS(guestRc))
     905    {
     906        GuestFsObjData objData;
     907        if (!stdOut.empty())
     908        {
     909            vrc = objData.FromMkTemp(stdOut.at(0));
     910            if (RT_FAILURE(vrc))
     911            {
     912                guestRc = vrc;
     913                vrc = VERR_GSTCTL_GUEST_ERROR;
     914            }
     915        }
     916        else
     917            vrc = VERR_NO_DATA;
     918
     919        if (RT_SUCCESS(vrc))
     920            strName = objData.mName;
     921    }
     922
     923    if (pGuestRc)
     924        *pGuestRc = guestRc;
    898925
    899926    LogFlowFuncLeaveRC(vrc);
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