VirtualBox

Changeset 3960 in vbox for trunk/src


Ignore:
Timestamp:
Aug 1, 2007 1:16:09 PM (17 years ago)
Author:
vboxsync
Message:

Corrections

Location:
trunk/src/VBox/HostServices/SharedFolders
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedFolders/testcase/tstShflCase.cpp

    r3959 r3960  
    202202    strcpy(pDirEntry->szName, pszFullPath);
    203203    strcat(pDirEntry->szName, "\\*");
    204     rc = rtDirOpenFiltered (&hSearch, pDirEntry->szName, RTDIRFILTER_WINNT);
     204    rc = RTDirOpenFiltered (&hSearch, pDirEntry->szName, RTDIRFILTER_WINNT);
    205205    *(pszStartComponent-1) = RTPATH_DELIMITER;
    206206    if (VBOX_FAILURE(rc))
     
    211211        uint32_t cbDirEntrySize = cbDirEntry;
    212212
    213         rc = rtDirReadEx(hSearch, pDirEntry, &cbDirEntrySize, RTFSOBJATTRADD_NOTHING);
     213        rc = RTDirReadEx(hSearch, pDirEntry, &cbDirEntrySize, RTFSOBJATTRADD_NOTHING);
    214214        if (rc == VERR_NO_MORE_FILES)
    215215            break;
     
    238238        RTMemFree(pDirEntry);
    239239
    240     rtDirClose(hSearch);
     240    RTDirClose(hSearch);
    241241    return rc;
    242242}
  • trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp

    r3955 r3960  
    9494    LogFlowFunc(("%s, %s, %s\n", pszFullPath, delimLast, delimSecondLast));
    9595}
    96 #if 0
     96
    9797static int vbsfCorrectCasing(char *pszFullPath, char *pszStartComponent)
    9898{
    99     PRTDIRENTRYEX  pDirEntry = 0, pDirEntryOrg;
    100     uint32_t       cbDirEntry, cbBufferOrg;
     99    PRTDIRENTRYEX  pDirEntry = NULL;
     100    uint32_t       cbDirEntry, cbComponent;
    101101    int            rc = VERR_FILE_NOT_FOUND;
    102     RTDIR          hSearch;
     102    PRTDIR         hSearch;
     103
     104    cbComponent = strlen(pszStartComponent);
    103105
    104106    cbDirEntry = 4096;
    105     pDirEntryOrg = pDirEntry  = (PRTDIRENTRYEX)RTMemAlloc(cbDirEntry);
     107    pDirEntry  = (PRTDIRENTRYEX)RTMemAlloc(cbDirEntry);
    106108    if (pDirEntry == 0)
    107109    {
     
    111113
    112114    /** @todo this is quite inefficient, especially for directories with many files */
    113     rc = RTDirOpenFiltered (&hSearch, pszFullPath, RTDIRFILTER_WINNT);
     115    Assert(pszFullPath < pszStartComponent-1);
     116    Assert(*(pszStartComponent-1) == RTPATH_DELIMITER);
     117    *(pszStartComponent-1) = 0;
     118    strcpy(pDirEntry->szName, pszFullPath);
     119    strcat(pDirEntry->szName, "\\*");
     120    rc = RTDirOpenFiltered (&hSearch, pDirEntry->szName, RTDIRFILTER_WINNT);
     121    *(pszStartComponent-1) = RTPATH_DELIMITER;
    114122    if (VBOX_FAILURE(rc))
    115123        goto end;
     
    118126    {
    119127        uint32_t cbDirEntrySize = cbDirEntry;
    120         uint32_t cbNeeded;
    121 
    122         pDirEntry = pDirEntryOrg;
    123 
    124         rc = RTDirReadEx(DirHandle, pDirEntry, &cbDirEntrySize, RTFSOBJATTRADD_NOTHING);
     128
     129        rc = RTDirReadEx(hSearch, pDirEntry, &cbDirEntrySize, RTFSOBJATTRADD_NOTHING);
    125130        if (rc == VERR_NO_MORE_FILES)
    126         {
    127             *pIndex = 0; /* listing completed */
    128131            break;
    129         }
    130132
    131133        if (VINF_SUCCESS != rc && rc != VWRN_NO_DIRENT_INFO)
     
    137139                continue;
    138140        }
    139 
    140     }
    141     Assert(rc != VINF_SUCCESS);
     141        if (    pDirEntry->cbName == cbComponent
     142            &&  !RTStrICmp(pszStartComponent, &pDirEntry->szName[0]))
     143        {
     144            Log(("Found original name %s (%s)\n", &pDirEntry->szName[0], pszStartComponent));
     145            strcpy(pszStartComponent, &pDirEntry->szName[0]);
     146            rc = VINF_SUCCESS;
     147            break;
     148        }
     149    }
     150    Assert(VBOX_SUCCESS(rc));
    142151
    143152end:
     
    148157    return rc;
    149158}
    150 #endif
    151159
    152160static int vbsfBuildFullPath (SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pPath,
     
    301309        {
    302310            RTFSOBJINFO info;
    303             rc = RTPathQueryInfo (pszFullPath, &info, RTFSOBJATTRADD_NOTHING);
     311            rc = RTPathQueryInfo(pszFullPath, &info, RTFSOBJATTRADD_NOTHING);
    304312            if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND)
    305313            {
    306314                uint32_t len = strlen(pszFullPath);
    307315                char    *src = pszFullPath + len - 1;
    308                
     316       
    309317                Log(("Handle case insenstive guest fs on top of host case sensitive fs for %s\n", pszFullPath));
    310318
     
    338346                    {
    339347                        char *end = src;
     348                        bool fEndOfString = true;
    340349
    341350                        while(*end)
     
    345354                            end++;
    346355                        }
    347                         if (!*end)
    348                             break;
    349 
    350                         *end = 0;
    351                    
    352                         rc = RTPathQueryInfo(src, &info, RTFSOBJATTRADD_NOTHING);
    353                         Assert(rc == VINF_SUCCESS || rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND);
     356
     357                        if (*end == RTPATH_DELIMITER)
     358                        {
     359                            fEndOfString = false;
     360                            *end = 0;
     361                            rc = RTPathQueryInfo(src, &info, RTFSOBJATTRADD_NOTHING);
     362                            Assert(rc == VINF_SUCCESS || rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND);
     363                        }
     364                        else
     365                            rc = VERR_FILE_NOT_FOUND;
     366           
    354367                        if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND)
    355368                        {
     
    359372                                break;
    360373                        }
     374
     375                        if (fEndOfString)
     376                            break;
    361377
    362378                        *end = RTPATH_DELIMITER;
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