VirtualBox

Changeset 74734 in vbox for trunk


Ignore:
Timestamp:
Oct 10, 2018 11:47:54 AM (6 years ago)
Author:
vboxsync
Message:

Guest Control/Main: Got rid of the "types" array in IGuestSession::copyFromGuest() and IGuestSession::copyToGuest(); the source type will now be resolved internally within those methods.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r74602 r74734  
    1196911969  <interface
    1197011970    name="IGuestSession" extends="$unknown"
    11971     uuid="9880f6e3-c4c1-4031-8ec2-28ee088370e4"
     11971    uuid="07241827-f602-48c8-8511-4d933f3cf0bb"
    1197211972    wsmap="managed"
    1197311973    reservedMethods="8" reservedAttributes="8"
     
    1214712147        <desc>Array of source filters. This uses the
    1214812148          DOS/NT style wildcard characters '?' and '*'.</desc>
    12149       </param>
    12150       <param name="types" type="FsObjType" dir="in" safearray="yes">
    12151         <desc>Array of source <link to="FsObjType"/> types.</desc>
    1215212149      </param>
    1215312150      <param name="flags" type="wstring" dir="in" safearray="yes">
     
    1220512202        <desc>Array of source filters. This uses the
    1220612203          DOS/NT style wildcard characters '?' and '*'.</desc>
    12207       </param>
    12208       <param name="types" type="FsObjType" dir="in" safearray="yes">
    12209         <desc>Array of source <link to="FsObjType"/> types.</desc>
    1221012204      </param>
    1221112205      <param name="flags" type="wstring" dir="in" safearray="yes">
  • trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h

    r72088 r74734  
    11181118     *  extended director's cut version. */
    11191119    int signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int rc, int guestRc, const GuestWaitEventPayload *pPayload);
     1120
    11201121public:
    11211122
     
    11291130    int unregisterWaitEvent(GuestWaitEvent *pEvent);
    11301131    int waitForEvent(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, VBoxEventType_T *pType, IEvent **ppEvent);
     1132
     1133public:
     1134
     1135    static FsObjType_T fileModeToFsObjType(RTFMODE fMode);
    11311136
    11321137protected:
  • trunk/src/VBox/Main/include/GuestSessionImpl.h

    r72070 r74734  
    8383    HRESULT copyFromGuest(const std::vector<com::Utf8Str> &aSources,
    8484                          const std::vector<com::Utf8Str> &aFilters,
    85                           const std::vector<FsObjType_T> &aTypes,
    8685                          const std::vector<com::Utf8Str> &aFlags,
    8786                          const com::Utf8Str &aDestination,
     
    8988    HRESULT copyToGuest(const std::vector<com::Utf8Str> &aSources,
    9089                        const std::vector<com::Utf8Str> &aFilters,
    91                         const std::vector<FsObjType_T> &aTypes,
    9290                        const std::vector<com::Utf8Str> &aFlags,
    9391                        const com::Utf8Str &aDestination,
  • trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp

    r73505 r74734  
    11331133}
    11341134
     1135/**
     1136 * Converts RTFMODE to FsObjType_T.
     1137 *
     1138 * @return  Converted FsObjType_T type.
     1139 * @param   enmType             RTFMODE to convert.
     1140 */
     1141/* static */
     1142FsObjType_T GuestBase::fileModeToFsObjType(RTFMODE fMode)
     1143{
     1144    if (RTFS_IS_FILE(fMode))           return FsObjType_File;
     1145    else if (RTFS_IS_DIRECTORY(fMode)) return FsObjType_Directory;
     1146    else if (RTFS_IS_SYMLINK(fMode))   return FsObjType_Symlink;
     1147
     1148    return FsObjType_Unknown;
     1149}
     1150
    11351151GuestObject::GuestObject(void)
    11361152    : mSession(NULL),
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r73505 r74734  
    28922892
    28932893HRESULT GuestSession::copyFromGuest(const std::vector<com::Utf8Str> &aSources, const std::vector<com::Utf8Str> &aFilters,
    2894                                     const std::vector<FsObjType_T> &aTypes, const std::vector<com::Utf8Str> &aFlags,
    2895                                     const com::Utf8Str &aDestination, ComPtr<IProgress> &aProgress)
     2894                                    const std::vector<com::Utf8Str> &aFlags, const com::Utf8Str &aDestination,
     2895                                    ComPtr<IProgress> &aProgress)
    28962896{
    28972897    AutoCaller autoCaller(this);
     
    29002900    const size_t cSources = aSources.size();
    29012901    if (   aFilters.size() != cSources
    2902         || aTypes.size()   != cSources
    29032902        || aFlags.size()   != cSources)
    29042903    {
     
    29102909    std::vector<com::Utf8Str>::const_iterator itSource = aSources.begin();
    29112910    std::vector<com::Utf8Str>::const_iterator itFilter = aFilters.begin();
    2912     std::vector<FsObjType_T>::const_iterator  itType   = aTypes.begin();
    29132911    std::vector<com::Utf8Str>::const_iterator itFlags  = aFlags.begin();
    29142912
     2913    const bool fContinueOnErrors = false; /** @todo Do we want a flag for that? */
     2914    const bool fFollowSymlinks   = true;  /** @todo Ditto. */
     2915
    29152916    while (itSource != aSources.end())
    29162917    {
     2918        GuestFsObjData objData;
     2919        int rcGuest;
     2920        int vrc = i_fsQueryInfo(*(itSource), fFollowSymlinks, objData, &rcGuest);
     2921        if (   RT_FAILURE(vrc)
     2922            && !fContinueOnErrors)
     2923        {
     2924            if (GuestProcess::i_isGuestError(vrc))
     2925                return setError(E_FAIL, tr("Unable to query type for source '%s': %s"), (*itSource).c_str(),
     2926                                           GuestProcess::i_guestErrorToString(rcGuest).c_str());
     2927            else
     2928                return setError(E_FAIL, tr("Unable to query type for source '%s' (%Rrc)"), (*itSource).c_str(), vrc);
     2929        }
     2930
    29172931        GuestSessionFsSourceSpec source;
    29182932        source.strSource    = *itSource;
    29192933        source.strFilter    = *itFilter;
    2920         source.enmType      = *itType;
     2934        source.enmType      = objData.mType;
    29212935        source.enmPathStyle = i_getPathStyle();
    29222936
     
    29382952        ++itSource;
    29392953        ++itFilter;
    2940         ++itType;
    29412954        ++itFlags;
    29422955    }
     
    29462959
    29472960HRESULT GuestSession::copyToGuest(const std::vector<com::Utf8Str> &aSources, const std::vector<com::Utf8Str> &aFilters,
    2948                                   const std::vector<FsObjType_T> &aTypes, const std::vector<com::Utf8Str> &aFlags,
    2949                                   const com::Utf8Str &aDestination, ComPtr<IProgress> &aProgress)
     2961                                  const std::vector<com::Utf8Str> &aFlags, const com::Utf8Str &aDestination,
     2962                                  ComPtr<IProgress> &aProgress)
    29502963{
    29512964    AutoCaller autoCaller(this);
     
    29542967    const size_t cSources = aSources.size();
    29552968    if (   aFilters.size() != cSources
    2956         || aTypes.size()   != cSources
    29572969        || aFlags.size()   != cSources)
    29582970    {
     
    29642976    std::vector<com::Utf8Str>::const_iterator itSource = aSources.begin();
    29652977    std::vector<com::Utf8Str>::const_iterator itFilter = aFilters.begin();
    2966     std::vector<FsObjType_T>::const_iterator  itType   = aTypes.begin();
    29672978    std::vector<com::Utf8Str>::const_iterator itFlags  = aFlags.begin();
    29682979
     2980    const bool fContinueOnErrors = false; /** @todo Do we want a flag for that? */
     2981
    29692982    while (itSource != aSources.end())
    29702983    {
     2984        RTFSOBJINFO objInfo;
     2985        int vrc = RTPathQueryInfo((*itSource).c_str(), &objInfo, RTFSOBJATTRADD_NOTHING);
     2986        if (   RT_FAILURE(vrc)
     2987            && !fContinueOnErrors)
     2988        {
     2989            return setError(E_FAIL, tr("Unable to query type for source '%s' (%Rrc)"), (*itSource).c_str(), vrc);
     2990        }
     2991
    29712992        GuestSessionFsSourceSpec source;
    29722993        source.strSource    = *itSource;
    29732994        source.strFilter    = *itFilter;
    2974         source.enmType      = *itType;
     2995        source.enmType      = GuestBase::fileModeToFsObjType(objInfo.Attr.fMode);
    29752996        source.enmPathStyle = i_getPathStyle();
    29762997
     
    29933014        ++itSource;
    29943015        ++itFilter;
    2995         ++itType;
    29963016        ++itFlags;
    29973017    }
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