VirtualBox

Changeset 57049 in vbox for trunk


Ignore:
Timestamp:
Jul 21, 2015 5:44:38 PM (9 years ago)
Author:
vboxsync
Message:

direnum-r3-nt.cpp: Just use 64KB buffers with remote directories, trying with larger may screw things up royally (STATUS_INVALID_NETWORK_RESPONSE) and we'll never get anything sensible when retrying.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/nt/direnum-r3-nt.cpp

    r57020 r57049  
    258258     * We do this in lazy fashion as some users of RTDirOpen will not actually
    259259     * list any files, just open it for various reasons.
     260     *
     261     * We also reduce the buffer size for networked devices as the windows 7-8.1,
     262     * server 2012, ++ CIFS servers or/and IFSes screws up buffers larger than 64KB.
     263     * There is an alternative hack below, btw.  We'll leave both in for now.
    260264     */
    261265    bool fFirst = false;
    262266    if (!pThis->pabBuffer)
    263267    {
     268        pThis->cbBufferAlloc = _256K;
     269        if (true) /** @todo skip for known local devices, like the boot device? */
     270        {
     271            IO_STATUS_BLOCK Ios2 = RTNT_IO_STATUS_BLOCK_INITIALIZER;
     272            FILE_FS_DEVICE_INFORMATION Info = { 0, 0 };
     273            NTSTATUS rcNt2 = NtQueryVolumeInformationFile(pThis->hDir, &Ios2, &Info, sizeof(Info), FileFsDeviceInformation);
     274            if (   !NT_SUCCESS(rcNt2)
     275                || (Info.Characteristics & FILE_REMOTE_DEVICE)
     276                || Info.DeviceType == FILE_DEVICE_NETWORK
     277                || Info.DeviceType == FILE_DEVICE_NETWORK_FILE_SYSTEM
     278                || Info.DeviceType == FILE_DEVICE_NETWORK_REDIRECTOR
     279                || Info.DeviceType == FILE_DEVICE_SMB)
     280                pThis->cbBufferAlloc = _64K;
     281        }
     282
    264283        fFirst = false;
    265         pThis->cbBufferAlloc = _256K;
    266284        pThis->pabBuffer = (uint8_t *)RTMemAlloc(pThis->cbBufferAlloc);
    267285        if (!pThis->pabBuffer)
     
    348366        else
    349367        {
     368            bool fRestartScan = false;
    350369            for (unsigned iRetry = 0; iRetry < 2; iRetry++)
    351370            {
     
    358377                if (   rcNt == STATUS_INVALID_PARAMETER
    359378                    || rcNt == STATUS_INVALID_PARAMETER_7
     379                    || rcNt == STATUS_INVALID_NETWORK_RESPONSE
    360380                    || iRetry != 0)
    361                     cbBuffer = RT_MIN(cbBuffer / 2, 0x10000);
     381                {
     382                    cbBuffer = RT_MIN(cbBuffer / 2, _64K);
     383                    fRestartScan = true;
     384                }
    362385
    363386                for (;;)
     
    373396                                                RTDIR_NT_SINGLE_RECORD /*ReturnSingleEntry */,
    374397                                                pThis->pNtFilterStr,
    375                                                 FALSE /*RestartScan */);
     398                                                fRestartScan);
    376399                    if (   NT_SUCCESS(rcNt)
    377400                        || cbBuffer == pThis->cbBufferAlloc
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