VirtualBox

Changeset 99391 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 13, 2023 4:41:39 PM (23 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156829
Message:

Guest Control/FE/Qt: Fall back to IGuestDirectory::read() if IGuestDirectory::list() is not supported due to older installed Guest Additions. bugref:9783

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h

    r98103 r99391  
    820820    bool isReallyOk() const { return !isNull() && B::mRC == S_OK; }
    821821
     822    /**
     823     * Returns the last result code of this interface.
     824     */
     825    HRESULT rc() const { return B::mRC; }
     826
    822827    // utility operators
    823828
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp

    r99089 r99391  
    528528    if (directory.isOk())
    529529    {
    530         int const cMaxEntries = _4K; /* Maximum number of entries to read at once per List() call. */
     530        int const cMaxEntries = _4K;   /* Maximum number of entries to read at once per List() call. */
     531        bool      fUseRead    = false; /* Whether to use the Read() API or the newer (faster) List() call. */
    531532
    532533        QVector<CFsObjInfo> vecFsInfo = directory.List(cMaxEntries);
     534        /* IGuestDirectory::List() will return VBOX_E_NOT_SUPPORTED if older Guest Additions are installed. */
     535        if (directory.rc() == VBOX_E_NOT_SUPPORTED)
     536        {
     537            CFsObjInfo fsInfo = directory.Read();
     538            if (directory.isOk())
     539            {
     540                vecFsInfo.push_back(fsInfo);
     541                fUseRead = true;
     542            }
     543        }
     544
    533545        QMap<QString, UICustomFileSystemItem*> fileObjects;
    534546
     
    564576            }
    565577
    566             vecFsInfo = directory.List(cMaxEntries);
     578            if (fUseRead)
     579            {
     580                CFsObjInfo fsInfo = directory.Read();
     581                if (directory.isOk())
     582                {
     583                    vecFsInfo.clear();
     584                    vecFsInfo.push_back(fsInfo);
     585                }
     586            }
     587            else
     588                vecFsInfo = directory.List(cMaxEntries);
    567589        }
    568590
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