VirtualBox

Changeset 93073 in vbox for trunk/src/VBox/Additions/os2


Ignore:
Timestamp:
Dec 24, 2021 1:44:58 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
149082
Message:

os2/VBoxSF: Implemented ERROR_EAS_DIDNT_FIT. ticketref:19453

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFFind.cpp

    r93071 r93073  
    621621                                 * Initialize the structures.
    622622                                 */
    623                                 pFsFsd->hHostDir        = pReq->CreateParms.Handle;
    624                                 pFsFsd->u32Magic        = VBOXSFFS_MAGIC;
    625                                 pFsFsd->pFolder         = pFolder;
    626                                 pFsFsd->pBuf            = pDataBuf;
    627                                 pFsFsd->offLastFile     = 0;
    628                                 pDataBuf->u32Magic      = VBOXSFFSBUF_MAGIC;
    629                                 pDataBuf->cbValid       = 0;
    630                                 pDataBuf->cEntriesLeft  = 0;
    631                                 pDataBuf->pEntry        = NULL;
    632                                 pDataBuf->pFilter       = pFilter;
    633                                 pDataBuf->fMustHaveAttribs   = (uint8_t)(  (fAttribs >> 8)
    634                                                                          & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED));
    635                                 pDataBuf->fExcludedAttribs   = (uint8_t)(~fAttribs & (FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY));
    636                                 pDataBuf->fLongFilenames     = RT_BOOL(fAttribs & FF_ATTR_LONG_FILENAME);
     623                                pFsFsd->hHostDir            = pReq->CreateParms.Handle;
     624                                pFsFsd->u32Magic            = VBOXSFFS_MAGIC;
     625                                pFsFsd->pFolder             = pFolder;
     626                                pFsFsd->pBuf                = pDataBuf;
     627                                pFsFsd->offLastFile         = 0;
     628                                pDataBuf->u32Magic          = VBOXSFFSBUF_MAGIC;
     629                                pDataBuf->cbValid           = 0;
     630                                pDataBuf->cEntriesLeft      = 0;
     631                                pDataBuf->pEntry            = NULL;
     632                                pDataBuf->pFilter           = pFilter;
     633                                pDataBuf->fMustHaveAttribs  = (uint8_t)(  (fAttribs >> 8)
     634                                                                        & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY | FILE_ARCHIVED));
     635                                pDataBuf->fExcludedAttribs  = (uint8_t)(~fAttribs & (FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY));
     636                                pDataBuf->fLongFilenames    = RT_BOOL(fAttribs & FF_ATTR_LONG_FILENAME);
    637637                                LogFlow(("FS32_FINDFIRST: fMustHaveAttribs=%#x fExcludedAttribs=%#x fLongFilenames=%d (fAttribs=%#x)\n",
    638638                                         pDataBuf->fMustHaveAttribs, pDataBuf->fExcludedAttribs, pDataBuf->fLongFilenames, fAttribs));
     
    641641                                rc = vboxSfOs2ReadDirEntries(pFolder, pFsFsd, pDataBuf, uLevel, fFlags,
    642642                                                             pbData, cbData, cMaxMatches ? cMaxMatches : UINT16_MAX, pcMatches);
    643                                 if (rc == NO_ERROR)
     643                                if (rc != ERROR_BUFFER_OVERFLOW)
     644                                { /* likely */ }
     645                                else if (   uLevel == FI_LVL_EAS_FROM_LIST
     646                                         || uLevel == FI_LVL_EAS_FROM_LIST_64)
     647                                {
     648                                    /* If we've got a buffer overflow asking for EAs from a LIST, we are allowed (indeed
     649                                       expected) to fall back to level 2 (EA size) and return ERROR_EAS_DIDNT_FIT.
     650                                       See http://www.edm2.com/index.php/DosFindFirst for somewhat dated details. */
     651                                    rc = vboxSfOs2ReadDirEntries(pFolder, pFsFsd, pDataBuf,
     652                                                                 uLevel == FI_LVL_EAS_FROM_LIST_64
     653                                                                 ? FI_LVL_STANDARD_EASIZE_64 : FI_LVL_STANDARD_EASIZE,
     654                                                                 fFlags, pbData, cbData, 1 /* no more than one! */, pcMatches);
     655                                    if (rc == NO_ERROR)
     656                                        rc = ERROR_EAS_DIDNT_FIT;
     657                                }
     658                                if (rc == NO_ERROR || rc == ERROR_EAS_DIDNT_FIT)
    644659                                {
    645660                                    uint32_t cRefs = ASMAtomicIncU32(&pFolder->cOpenSearches);
     
    753768                                     cMaxMatches ? cMaxMatches : UINT16_MAX, pcMatches);
    754769    }
     770    if (rc != ERROR_BUFFER_OVERFLOW)
     771    { /* likely */ }
     772    else if (   uLevel == FI_LVL_EAS_FROM_LIST
     773             || uLevel == FI_LVL_EAS_FROM_LIST_64)
     774    {
     775        /* If we've got a buffer overflow asking for EAs from a LIST, we are allowed (indeed
     776           expected) to fall back to level 2 (EA size) and return ERROR_EAS_DIDNT_FIT. */
     777        rc = vboxSfOs2ReadDirEntries(pFolder, pFsFsd, pDataBuf,
     778                                     uLevel == FI_LVL_EAS_FROM_LIST_64 ? FI_LVL_STANDARD_EASIZE_64 : FI_LVL_STANDARD_EASIZE,
     779                                     fFlags, pbData, cbData, 1 /* no more than one! */, pcMatches);
     780        if (rc == NO_ERROR)
     781            rc = ERROR_EAS_DIDNT_FIT;
     782    }
    755783
    756784    RT_NOREF(pFsFsi, pszName);
     
    800828    APIRET rc = vboxSfOs2ReadDirEntries(pFolder, pFsFsd, pDataBuf, uLevel, fFlags, pbData, cbData,
    801829                                        cMaxMatches ? cMaxMatches : UINT16_MAX, pcMatches);
     830    if (rc != ERROR_BUFFER_OVERFLOW)
     831    { /* likely */ }
     832    else if (   uLevel == FI_LVL_EAS_FROM_LIST
     833             || uLevel == FI_LVL_EAS_FROM_LIST_64)
     834    {
     835        /* If we've got a buffer overflow asking for EAs from a LIST, we are allowed (indeed
     836           expected) to fall back to level 2 (EA size) and return ERROR_EAS_DIDNT_FIT.
     837           See http://www.edm2.com/index.php/DosFindNext for somewhat dated details. */
     838        rc = vboxSfOs2ReadDirEntries(pFolder, pFsFsd, pDataBuf,
     839                                     uLevel == FI_LVL_EAS_FROM_LIST_64 ? FI_LVL_STANDARD_EASIZE_64 : FI_LVL_STANDARD_EASIZE,
     840                                     fFlags, pbData, cbData, 1 /* no more than one! */, pcMatches);
     841        if (rc == NO_ERROR)
     842            rc = ERROR_EAS_DIDNT_FIT;
     843    }
    802844
    803845    NOREF(pFsFsi);
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