VirtualBox

Ignore:
Timestamp:
Dec 10, 2018 9:24:46 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
127388
Message:

SharedFolders,os2/VBoxSF: Added SHFL_FN_SET_FILE_SIZE for setting the file size without needing to passing an mostly unused buffer (SHFLOBJINFO). Deprecated most of VbglR0SfXxxx and continued hacking on replacements using OS/2 as testbed. bugref:9172

File:
1 edited

Legend:

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

    r76109 r76143  
    467467     * Resolve path to a folder and folder relative path.
    468468     */
    469     PVBOXSFFOLDER pFolder;
    470     PSHFLSTRING   pStrFolderPath;
    471469    RT_NOREF(pCdFsi);
    472     APIRET rc = vboxSfOs2ResolvePath(pszPath, pCdFsd, offCurDirEnd, &pFolder, &pStrFolderPath);
    473     LogFlow(("FS32_FINDFIRST: vboxSfOs2ResolvePath: -> %u pFolder=%p\n", rc, pFolder));
     470    PVBOXSFFOLDER       pFolder;
     471    VBOXSFCREATEREQ    *pReq;
     472    APIRET rc = vboxSfOs2ResolvePathEx(pszPath, pCdFsd, offCurDirEnd, RT_UOFFSETOF(VBOXSFCREATEREQ, StrPath),
     473                                       &pFolder, (void **)&pReq);
     474    LogFlow(("FS32_FINDFIRST: vboxSfOs2ResolvePathEx: -> %u pReq=%p\n", rc, pReq));
    474475    if (rc == NO_ERROR)
    475476    {
     477        PSHFLSTRING pStrFolderPath = &pReq->StrPath;
     478
    476479        /*
    477480         * Look for a wildcard filter at the end of the path, saving it all for
     
    537540        else if (pwszFilter)
    538541        {
    539             pFilter = pStrFolderPath;
    540             pStrFolderPath = vboxSfOs2StrAlloc(pwszFilter - pFilter->String.utf16);
    541             if (pStrFolderPath)
    542             {
    543                 pStrFolderPath->u16Length = (uint16_t)((uintptr_t)pwszFilter - (uintptr_t)pFilter->String.utf16);
    544                 memcpy(pStrFolderPath->String.utf16, pFilter->String.utf16, pStrFolderPath->u16Length);
     542            /* Copy the whole path for filtering. */
     543            pFilter = vboxSfOs2StrDup(pStrFolderPath);
     544            if (pFilter)
     545            {
     546                /* Strip the filename off the one we're opening. */
     547                pStrFolderPath->u16Length = (uint16_t)((uintptr_t)pwszFilter - (uintptr_t)pStrFolderPath->String.utf16);
     548                pStrFolderPath->u16Size   = pStrFolderPath->u16Length + (uint16_t)sizeof(RTUTF16);
    545549                pStrFolderPath->String.utf16[pStrFolderPath->u16Length / sizeof(RTUTF16)] = '\0';
    546550            }
     
    559563         * Make sure we've got a buffer for keeping unused search results.
    560564         */
     565        /** @todo use phys heap for this too?  */
    561566        PVBOXSFFSBUF pDataBuf = NULL;
    562567        if (rc == NO_ERROR)
     
    578583            /*
    579584             * Now, try open the directory for reading.
    580              * We pre-use the data buffer for parameter passin to avoid
    581              * wasting any stack space.
    582585             */
    583             PSHFLCREATEPARMS pParams = (PSHFLCREATEPARMS)(pDataBuf + 1);
    584             RT_ZERO(*pParams);
    585             pParams->CreateFlags = SHFL_CF_DIRECTORY   | SHFL_CF_ACT_FAIL_IF_NEW  | SHFL_CF_ACT_OPEN_IF_EXISTS
    586                                  | SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_ATTR_READ | SHFL_CF_ACCESS_DENYNONE;
    587             int vrc = VbglR0SfCreate(&g_SfClient, &pFolder->hHostFolder, pStrFolderPath, pParams);
    588             LogFlow(("FS32_FINDFIRST: VbglR0SfCreate(%ls) -> %Rrc Result=%d fMode=%#x hHandle=%#RX64\n",
    589                      pStrFolderPath->String.utf16, vrc, pParams->Result, pParams->Info.Attr.fMode, pParams->Handle));
     586            pReq->CreateParms.CreateFlags = SHFL_CF_DIRECTORY   | SHFL_CF_ACT_FAIL_IF_NEW  | SHFL_CF_ACT_OPEN_IF_EXISTS
     587                                          | SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_ATTR_READ | SHFL_CF_ACCESS_DENYNONE;
     588
     589            int vrc = vboxSfOs2HostReqCreate(pFolder, pReq);
     590            LogFlow(("FS32_FINDFIRST: vboxSfOs2HostReqCreate(%ls) -> %Rrc Result=%d fMode=%#x hHandle=%#RX64\n",
     591                     pStrFolderPath->String.utf16, vrc, pReq->CreateParms.Result, pReq->CreateParms.Info.Attr.fMode,
     592                     pReq->CreateParms.Handle));
    590593            if (RT_SUCCESS(vrc))
    591594            {
    592                 switch (pParams->Result)
     595                switch (pReq->CreateParms.Result)
    593596                {
    594597                    case SHFL_FILE_EXISTS:
    595                         if (pParams->Handle != SHFL_HANDLE_NIL)
     598                        if (pReq->CreateParms.Handle != SHFL_HANDLE_NIL)
    596599                        {
    597600                            /*
    598601                             * Initialize the structures.
    599602                             */
    600                             pFsFsd->hHostDir        = pParams->Handle;
     603                            pFsFsd->hHostDir        = pReq->CreateParms.Handle;
    601604                            pFsFsd->u32Magic        = VBOXSFFS_MAGIC;
    602605                            pFsFsd->pFolder         = pFolder;
     
    631634                            else
    632635                            {
    633                                 vrc = VbglR0SfClose(&g_SfClient, &pFolder->hHostFolder, pFsFsd->hHostDir);
     636                                AssertCompile(sizeof(VBOXSFCLOSEREQ) < sizeof(*pReq));
     637                                vrc = vboxSfOs2HostReqClose(pFolder, (VBOXSFCLOSEREQ *)pReq, pFsFsd->hHostDir);
    634638                                AssertRC(vrc);
    635639                                pFsFsd->u32Magic = ~VBOXSFFS_MAGIC;
     
    641645                        else
    642646                        {
    643                             LogFlow(("FS32_FINDFIRST: VbglR0SfCreate returns NIL handle for '%ls'\n", pStrFolderPath->String.utf16));
     647                            LogFlow(("FS32_FINDFIRST: vboxSfOs2HostReqCreate returns NIL handle for '%ls'\n",
     648                                     pStrFolderPath->String.utf16));
    644649                            rc = ERROR_PATH_NOT_FOUND;
    645650                        }
     
    661666
    662667        RTMemFree(pDataBuf);
    663         if (pFilter != pStrFolderPath)
    664             vboxSfOs2StrFree(pFilter);
    665         vboxSfOs2ReleasePathAndFolder(pStrFolderPath, pFolder);
     668        vboxSfOs2StrFree(pFilter);
     669        VbglR0PhysHeapFree(pReq);
     670        vboxSfOs2ReleaseFolder(pFolder);
    666671    }
    667672
     
    801806    if (pFsFsd->hHostDir != SHFL_HANDLE_NIL)
    802807    {
    803         int vrc = VbglR0SfClose(&g_SfClient, &pFolder->hHostFolder, pFsFsd->hHostDir);
     808        int vrc = vboxSfOs2HostReqCloseSimple(pFolder, pFsFsd->hHostDir);
    804809        AssertRC(vrc);
    805810    }
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