Changeset 76143 in vbox for trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFFind.cpp
- Timestamp:
- Dec 10, 2018 9:24:46 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 127388
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFFind.cpp
r76109 r76143 467 467 * Resolve path to a folder and folder relative path. 468 468 */ 469 PVBOXSFFOLDER pFolder;470 PSHFLSTRING pStrFolderPath;471 469 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)); 474 475 if (rc == NO_ERROR) 475 476 { 477 PSHFLSTRING pStrFolderPath = &pReq->StrPath; 478 476 479 /* 477 480 * Look for a wildcard filter at the end of the path, saving it all for … … 537 540 else if (pwszFilter) 538 541 { 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); 545 549 pStrFolderPath->String.utf16[pStrFolderPath->u16Length / sizeof(RTUTF16)] = '\0'; 546 550 } … … 559 563 * Make sure we've got a buffer for keeping unused search results. 560 564 */ 565 /** @todo use phys heap for this too? */ 561 566 PVBOXSFFSBUF pDataBuf = NULL; 562 567 if (rc == NO_ERROR) … … 578 583 /* 579 584 * Now, try open the directory for reading. 580 * We pre-use the data buffer for parameter passin to avoid581 * wasting any stack space.582 585 */ 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 p StrFolderPath->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)); 590 593 if (RT_SUCCESS(vrc)) 591 594 { 592 switch (p Params->Result)595 switch (pReq->CreateParms.Result) 593 596 { 594 597 case SHFL_FILE_EXISTS: 595 if (p Params->Handle != SHFL_HANDLE_NIL)598 if (pReq->CreateParms.Handle != SHFL_HANDLE_NIL) 596 599 { 597 600 /* 598 601 * Initialize the structures. 599 602 */ 600 pFsFsd->hHostDir = p Params->Handle;603 pFsFsd->hHostDir = pReq->CreateParms.Handle; 601 604 pFsFsd->u32Magic = VBOXSFFS_MAGIC; 602 605 pFsFsd->pFolder = pFolder; … … 631 634 else 632 635 { 633 vrc = VbglR0SfClose(&g_SfClient, &pFolder->hHostFolder, pFsFsd->hHostDir); 636 AssertCompile(sizeof(VBOXSFCLOSEREQ) < sizeof(*pReq)); 637 vrc = vboxSfOs2HostReqClose(pFolder, (VBOXSFCLOSEREQ *)pReq, pFsFsd->hHostDir); 634 638 AssertRC(vrc); 635 639 pFsFsd->u32Magic = ~VBOXSFFS_MAGIC; … … 641 645 else 642 646 { 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)); 644 649 rc = ERROR_PATH_NOT_FOUND; 645 650 } … … 661 666 662 667 RTMemFree(pDataBuf); 663 if (pFilter != pStrFolderPath)664 vboxSfOs2StrFree(pFilter);665 vboxSfOs2Release PathAndFolder(pStrFolderPath,pFolder);668 vboxSfOs2StrFree(pFilter); 669 VbglR0PhysHeapFree(pReq); 670 vboxSfOs2ReleaseFolder(pFolder); 666 671 } 667 672 … … 801 806 if (pFsFsd->hHostDir != SHFL_HANDLE_NIL) 802 807 { 803 int vrc = VbglR0SfClose(&g_SfClient, &pFolder->hHostFolder, pFsFsd->hHostDir);808 int vrc = vboxSfOs2HostReqCloseSimple(pFolder, pFsFsd->hHostDir); 804 809 AssertRC(vrc); 805 810 }
Note:
See TracChangeset
for help on using the changeset viewer.