Changeset 76665 in vbox
- Timestamp:
- Jan 7, 2019 4:20:09 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/shflsvc.h
r76585 r76665 1501 1501 #define SHFL_LIST_RESTART 2 1502 1502 1503 /** SHFL_FN_LIST parameters. */ 1504 typedef struct VBoxSFParmList 1505 { 1506 /** value32, in: SHFLROOT of the mapping the handle belongs to. */ 1507 HGCMFunctionParameter id32Root; 1508 /** value64, in: SHFLHANDLE of the directory. */ 1509 HGCMFunctionParameter u64Handle; 1510 /** value32, in: List flags SHFL_LIST_XXX. */ 1511 HGCMFunctionParameter f32Flags; 1512 /** value32, in/out: Input buffer size / Returned bytes count. */ 1513 HGCMFunctionParameter cb32Buffer; 1514 /** pointer, in[optional]: SHFLSTRING filter string (full path). */ 1515 HGCMFunctionParameter pStrFilter; 1516 /** pointer, out: Buffer to return listing information in (SHFLDIRINFO). 1517 * When SHFL_LIST_RETURN_ONE is not specfied, multiple record may be 1518 * returned, deriving the entry size using SHFLDIRINFO::name.u16Size. */ 1519 HGCMFunctionParameter pBuffer; 1520 /** value32, out: Set to 1 if the listing is done, 0 if more entries. 1521 * @note Must be set to zero on call as it was declared in/out parameter and 1522 * may be used as such again. */ 1523 HGCMFunctionParameter f32Done; 1524 /** value32, out: Number of entries returned. */ 1525 HGCMFunctionParameter c32Entries; 1526 } VBoxSFParmList; 1527 1528 1503 1529 /** Parameters structure. */ 1504 1530 typedef struct _VBoxSFList -
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFFind.cpp
r76143 r76665 233 233 || pEntry == NULL /* paranoia */) 234 234 { 235 pDataBuf->pEntry = pEntry = (PSHFLDIRINFO)(pDataBuf + 1); 236 pDataBuf->cbValid = pDataBuf->cbBuf - sizeof(*pDataBuf); 237 int vrc = VbglR0SfDirInfo(&g_SfClient, &pFolder->hHostFolder, pFsFsd->hHostDir, pDataBuf->pFilter, 238 cMaxMatches == 1 ? SHFL_LIST_RETURN_ONE : 0, 0 /*index*/, &pDataBuf->cbValid, 239 pEntry, &pDataBuf->cEntriesLeft); 235 pDataBuf->pEntry = pEntry = pDataBuf->pBuf; 236 int vrc = vboxSfOs2HostReqListDir(pFolder, &pDataBuf->Req, pFsFsd->hHostDir, pDataBuf->pFilter, 237 /*cMaxMatches == 1 ? SHFL_LIST_RETURN_ONE :*/ 0, pDataBuf->pBuf, pDataBuf->cbBuf); 240 238 if (RT_SUCCESS(vrc)) 241 239 { 240 pDataBuf->cEntriesLeft = pDataBuf->Req.Parms.c32Entries.u.value32; 241 pDataBuf->cbValid = pDataBuf->Req.Parms.cb32Buffer.u.value32; 242 //Log(("%.*Rhxd\n", pDataBuf->cbValid, pEntry)); 242 243 AssertReturn(pDataBuf->cbValid >= RT_UOFFSETOF(SHFLDIRINFO, name.String), ERROR_SYS_INTERNAL); 243 244 AssertReturn(pDataBuf->cbValid >= RT_UOFFSETOF(SHFLDIRINFO, name.String) + pEntry->name.u16Size, ERROR_SYS_INTERNAL); 244 Log4(("vboxSfOs2ReadDirEntries: VbglR0SfDirInforeturned %#x matches in %#x bytes\n", pDataBuf->cEntriesLeft, pDataBuf->cbValid));245 Log4(("vboxSfOs2ReadDirEntries: vboxSfOs2HostReqListDir returned %#x matches in %#x bytes\n", pDataBuf->cEntriesLeft, pDataBuf->cbValid)); 245 246 } 246 247 else 247 248 { 248 249 if (vrc == VERR_NO_MORE_FILES) 249 Log(("vboxSfOs2ReadDirEntries: VbglR0SfDirInfo failed %Rrc (%d,%d)\n", vrc, pDataBuf->cEntriesLeft, pDataBuf->cbValid)); 250 Log4(("vboxSfOs2ReadDirEntries: vboxSfOs2HostReqListDir returned VERR_NO_MORE_FILES (%d,%d)\n", 251 pDataBuf->Req.Parms.c32Entries.u.value32, pDataBuf->Req.Parms.cb32Buffer.u.value32)); 250 252 else 251 Log4(("vboxSfOs2ReadDirEntries: VbglR0SfDirInfo returned VERR_NO_MORE_FILES (%d,%d)\n", pDataBuf->cEntriesLeft, pDataBuf->cbValid)); 253 Log(("vboxSfOs2ReadDirEntries: vboxSfOs2HostReqListDir failed %Rrc (%d,%d)\n", vrc, 254 pDataBuf->Req.Parms.c32Entries.u.value32, pDataBuf->Req.Parms.cb32Buffer.u.value32)); 252 255 pDataBuf->pEntry = NULL; 253 256 pDataBuf->cEntriesLeft = 0; 257 pDataBuf->cbValid = 0; 254 258 if (cMatches == 0) 255 259 { … … 411 415 { 412 416 pDataBuf->pEntry = pEntry = (PSHFLDIRINFO)&pEntry->name.String.utf8[pEntry->name.u16Size]; 413 uintptr_t offEntry = (uintptr_t)pEntry - (uintptr_t) (pDataBuf + 1);417 uintptr_t offEntry = (uintptr_t)pEntry - (uintptr_t)pDataBuf->pBuf; 414 418 AssertMsgReturn(offEntry + RT_UOFFSETOF(SHFLDIRINFO, name.String) <= pDataBuf->cbValid, 415 419 ("offEntry=%#x cbValid=%#x\n", offEntry, pDataBuf->cbValid), ERROR_SYS_INTERNAL); 420 //Log(("next entry: %p / %#x: u16Size=%#x => size: %#x\n", pEntry, offEntry, RT_UOFFSETOF(SHFLDIRINFO, name.String) + pEntry->name.u16Size)); 416 421 AssertMsgReturn(offEntry + RT_UOFFSETOF(SHFLDIRINFO, name.String) + pEntry->name.u16Size <= pDataBuf->cbValid, 417 ("offEntry=%#x cbValid=%#x\n", offEntry, pDataBuf->cbValid), ERROR_SYS_INTERNAL); 422 ("offEntry=%#x + offName=%#x + cbName=%#x => %#x; cbValid=%#x\n", 423 offEntry, RT_UOFFSETOF(SHFLDIRINFO, name.String), pEntry->name.u16Size, 424 offEntry + RT_UOFFSETOF(SHFLDIRINFO, name.String) + pEntry->name.u16Size, pDataBuf->cbValid), 425 ERROR_SYS_INTERNAL); 426 //Log(("%.*Rhxd\n", RT_UOFFSETOF(SHFLDIRINFO, name.String) + pEntry->name.u16Size, pEntry)); 418 427 } 419 428 else 420 pDataBuf->pEntry = NULL;429 pDataBuf->pEntry = pEntry = NULL; 421 430 } 422 431 … … 561 570 562 571 /* 563 * Make sure we've got a buffer for keeping unused search results.572 * Allocate data/request buffer and another buffer for receiving entries in. 564 573 */ 565 /** @todo use phys heap for this too? */566 PVBOXSFFSBUF pDataBuf = NULL;567 574 if (rc == NO_ERROR) 568 575 { 569 pDataBuf = (PVBOXSFFSBUF)RTMemAlloc(cMaxMatches == 1 ? VBOXSFFSBUF_MIN_SIZE : _16K - ALLOC_HDR_SIZE);576 PVBOXSFFSBUF pDataBuf = (PVBOXSFFSBUF)VbglR0PhysHeapAlloc(sizeof(*pDataBuf)); 570 577 if (pDataBuf) 571 pDataBuf->cbBuf = cMaxMatches == 1 ? VBOXSFFSBUF_MIN_SIZE : _16K - ALLOC_HDR_SIZE; 572 else 573 { 574 pDataBuf = (PVBOXSFFSBUF)RTMemAlloc(VBOXSFFSBUF_MIN_SIZE); 575 if (pDataBuf) 576 pDataBuf->cbBuf = VBOXSFFSBUF_MIN_SIZE; 578 { 579 #define MIN_BUF_SIZE ( RT_ALIGN_32(sizeof(SHFLDIRINFO) + CCHMAXPATHCOMP * sizeof(RTUTF16) + 64 /*fudge*/ + ALLOC_HDR_SIZE, 64) \ 580 - ALLOC_HDR_SIZE) 581 RT_ZERO(*pDataBuf); 582 pDataBuf->cbBuf = cMaxMatches == 1 ? MIN_BUF_SIZE : _16K - ALLOC_HDR_SIZE; 583 pDataBuf->pBuf = (PSHFLDIRINFO)VbglR0PhysHeapAlloc(pDataBuf->cbBuf); 584 if (pDataBuf->pBuf) 585 { /* likely */ } 577 586 else 578 rc = ERROR_NOT_ENOUGH_MEMORY;579 }580 }581 if (rc == NO_ERROR)582 {583 /*584 * Now, try open the directory for reading.585 */586 pReq->CreateParms.CreateFlags = SHFL_CF_DIRECTORY | SHFL_CF_ACT_FAIL_IF_NEW | SHFL_CF_ACT_OPEN_IF_EXISTS587 | 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));593 if (RT_SUCCESS(vrc))594 {595 switch (pReq->CreateParms.Result)596 587 { 597 case SHFL_FILE_EXISTS: 598 if (pReq->CreateParms.Handle != SHFL_HANDLE_NIL) 599 { 600 /* 601 * Initialize the structures. 602 */ 603 pFsFsd->hHostDir = pReq->CreateParms.Handle; 604 pFsFsd->u32Magic = VBOXSFFS_MAGIC; 605 pFsFsd->pFolder = pFolder; 606 pFsFsd->pBuf = pDataBuf; 607 pFsFsd->offLastFile = 0; 608 pDataBuf->u32Magic = VBOXSFFSBUF_MAGIC; 609 pDataBuf->cbValid = 0; 610 pDataBuf->cEntriesLeft = 0; 611 pDataBuf->pEntry = NULL; 612 pDataBuf->pFilter = pFilter; 613 pDataBuf->fMustHaveAttribs = (uint8_t)((fAttribs >> 8) & (RTFS_DOS_MASK_OS2 >> RTFS_DOS_SHIFT)); 614 pDataBuf->fExcludedAttribs = (uint8_t)(~fAttribs 615 & ( (RTFS_DOS_MASK_OS2 & ~(RTFS_DOS_ARCHIVED | RTFS_DOS_READONLY) 616 >> RTFS_DOS_SHIFT))); 617 pDataBuf->fLongFilenames = RT_BOOL(fAttribs & FF_ATTR_LONG_FILENAME); 618 pDataBuf->cMinLocalTimeDelta = vboxSfOs2GetLocalTimeDelta(); 619 620 rc = vboxSfOs2ReadDirEntries(pFolder, pFsFsd, pDataBuf, uLevel, fFlags, 621 pbData, cbData, cMaxMatches ? cMaxMatches : UINT16_MAX, pcMatches); 622 if (rc == NO_ERROR) 588 pDataBuf->pBuf = (PSHFLDIRINFO)VbglR0PhysHeapAlloc(MIN_BUF_SIZE); 589 if (pDataBuf->pBuf) 590 pDataBuf->cbBuf = MIN_BUF_SIZE; 591 else 592 rc = ERROR_NOT_ENOUGH_MEMORY; 593 } 594 } 595 if (rc == NO_ERROR) 596 { 597 /* 598 * Now, try open the directory for reading. 599 */ 600 pReq->CreateParms.CreateFlags = SHFL_CF_DIRECTORY | SHFL_CF_ACT_FAIL_IF_NEW | SHFL_CF_ACT_OPEN_IF_EXISTS 601 | SHFL_CF_ACCESS_READ | SHFL_CF_ACCESS_ATTR_READ | SHFL_CF_ACCESS_DENYNONE; 602 603 int vrc = vboxSfOs2HostReqCreate(pFolder, pReq); 604 LogFlow(("FS32_FINDFIRST: vboxSfOs2HostReqCreate(%ls) -> %Rrc Result=%d fMode=%#x hHandle=%#RX64\n", 605 pStrFolderPath->String.utf16, vrc, pReq->CreateParms.Result, pReq->CreateParms.Info.Attr.fMode, 606 pReq->CreateParms.Handle)); 607 if (RT_SUCCESS(vrc)) 608 { 609 switch (pReq->CreateParms.Result) 610 { 611 case SHFL_FILE_EXISTS: 612 if (pReq->CreateParms.Handle != SHFL_HANDLE_NIL) 623 613 { 624 uint32_t cRefs = ASMAtomicIncU32(&pFolder->cOpenSearches); 625 Assert(cRefs < _4K); RT_NOREF(cRefs); 626 627 /* We keep these on success: */ 628 if (pFilter == pStrFolderPath) 629 pStrFolderPath = NULL; 630 pFilter = NULL; 631 pDataBuf = NULL; 632 pFolder = NULL; 614 /* 615 * Initialize the structures. 616 */ 617 pFsFsd->hHostDir = pReq->CreateParms.Handle; 618 pFsFsd->u32Magic = VBOXSFFS_MAGIC; 619 pFsFsd->pFolder = pFolder; 620 pFsFsd->pBuf = pDataBuf; 621 pFsFsd->offLastFile = 0; 622 pDataBuf->u32Magic = VBOXSFFSBUF_MAGIC; 623 pDataBuf->cbValid = 0; 624 pDataBuf->cEntriesLeft = 0; 625 pDataBuf->pEntry = NULL; 626 pDataBuf->pFilter = pFilter; 627 pDataBuf->fMustHaveAttribs = (uint8_t)((fAttribs >> 8) & (RTFS_DOS_MASK_OS2 >> RTFS_DOS_SHIFT)); 628 pDataBuf->fExcludedAttribs = (uint8_t)(~fAttribs 629 & ( (RTFS_DOS_MASK_OS2 & ~(RTFS_DOS_ARCHIVED | RTFS_DOS_READONLY) 630 >> RTFS_DOS_SHIFT))); 631 pDataBuf->fLongFilenames = RT_BOOL(fAttribs & FF_ATTR_LONG_FILENAME); 632 pDataBuf->cMinLocalTimeDelta = vboxSfOs2GetLocalTimeDelta(); 633 634 rc = vboxSfOs2ReadDirEntries(pFolder, pFsFsd, pDataBuf, uLevel, fFlags, 635 pbData, cbData, cMaxMatches ? cMaxMatches : UINT16_MAX, pcMatches); 636 if (rc == NO_ERROR) 637 { 638 uint32_t cRefs = ASMAtomicIncU32(&pFolder->cOpenSearches); 639 Assert(cRefs < _4K); RT_NOREF(cRefs); 640 641 /* We keep these on success: */ 642 if (pFilter == pStrFolderPath) 643 pStrFolderPath = NULL; 644 pFilter = NULL; 645 pDataBuf = NULL; 646 pFolder = NULL; 647 } 648 else 649 { 650 AssertCompile(sizeof(VBOXSFCLOSEREQ) < sizeof(*pReq)); 651 vrc = vboxSfOs2HostReqClose(pFolder, (VBOXSFCLOSEREQ *)pReq, pFsFsd->hHostDir); 652 AssertRC(vrc); 653 pFsFsd->u32Magic = ~VBOXSFFS_MAGIC; 654 pDataBuf->u32Magic = ~VBOXSFFSBUF_MAGIC; 655 pFsFsd->pFolder = NULL; 656 pFsFsd->hHostDir = NULL; 657 } 633 658 } 634 659 else 635 660 { 636 AssertCompile(sizeof(VBOXSFCLOSEREQ) < sizeof(*pReq)); 637 vrc = vboxSfOs2HostReqClose(pFolder, (VBOXSFCLOSEREQ *)pReq, pFsFsd->hHostDir); 638 AssertRC(vrc); 639 pFsFsd->u32Magic = ~VBOXSFFS_MAGIC; 640 pDataBuf->u32Magic = ~VBOXSFFSBUF_MAGIC; 641 pFsFsd->pFolder = NULL; 642 pFsFsd->hHostDir = NULL; 661 LogFlow(("FS32_FINDFIRST: vboxSfOs2HostReqCreate returns NIL handle for '%ls'\n", 662 pStrFolderPath->String.utf16)); 663 rc = ERROR_PATH_NOT_FOUND; 643 664 } 644 } 645 else 646 { 647 LogFlow(("FS32_FINDFIRST: vboxSfOs2HostReqCreate returns NIL handle for '%ls'\n", 648 pStrFolderPath->String.utf16)); 665 break; 666 667 case SHFL_PATH_NOT_FOUND: 649 668 rc = ERROR_PATH_NOT_FOUND; 650 } 651 break; 652 653 case SHFL_PATH_NOT_FOUND: 654 rc = ERROR_PATH_NOT_FOUND; 655 break; 656 657 default: 658 case SHFL_FILE_NOT_FOUND: 659 rc = ERROR_FILE_NOT_FOUND; 660 break; 669 break; 670 671 default: 672 case SHFL_FILE_NOT_FOUND: 673 rc = ERROR_FILE_NOT_FOUND; 674 break; 675 } 661 676 } 662 } 663 else 664 rc = vboxSfOs2ConvertStatusToOs2(vrc, ERROR_GEN_FAILURE); 677 else 678 rc = vboxSfOs2ConvertStatusToOs2(vrc, ERROR_GEN_FAILURE); 679 } 680 681 if (pDataBuf) 682 { 683 VbglR0PhysHeapFree(pDataBuf->pBuf); 684 pDataBuf->pBuf = NULL; 685 VbglR0PhysHeapFree(pDataBuf); 686 } 665 687 } 666 667 RTMemFree(pDataBuf);668 688 vboxSfOs2StrFree(pFilter); 669 689 VbglR0PhysHeapFree(pReq); … … 818 838 pDataBuf->u32Magic = ~VBOXSFFSBUF_MAGIC; 819 839 pDataBuf->cbBuf = 0; 820 RTMemFree(pDataBuf); 840 841 VbglR0PhysHeapFree(pDataBuf->pBuf); 842 pDataBuf->pBuf = NULL; 843 VbglR0PhysHeapFree(pDataBuf); 821 844 822 845 uint32_t cRefs = ASMAtomicDecU32(&pFolder->cOpenSearches); -
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFInit.cpp
r76448 r76665 102 102 if (RT_FAILURE(rc)) 103 103 RTLogBackdoorPrintf("VBoxSFR0Init: Missing VBoxGuest.sys IDC connection! Check order in Config.kmk!\n"); 104 else if (!(fFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS)) 105 RTLogBackdoorPrintf("VBoxSFR0Init: Embedded buffers feature is missing. Upgrade to latest VirtualBox!\n"); 104 else 105 { 106 if (!(fFeatures & VMMDEV_HVF_HGCM_EMBEDDED_BUFFERS)) 107 RTLogBackdoorPrintf("VBoxSFR0Init: WARNING! Embedded buffers feature is missing. Upgrade to latest VirtualBox!\n"); 108 if (!(fFeatures & VMMDEV_HVF_HGCM_CONTIGUOUS_PAGE_LIST)) 109 RTLogBackdoorPrintf("VBoxSFR0Init: WARNING! Contiguous page list buffers feature is missing. Upgrade to latest VirtualBox!\n"); 110 } 106 111 107 112 /* -
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFInternal.h
r76563 r76665 157 157 158 158 159 /** 160 * VBoxSF File Search Buffer (header). 161 */ 162 typedef struct VBOXSFFSBUF 163 { 159 /** Request structure for vboxSfOs2HostReqListDir. */ 160 typedef struct VBOXSFLISTDIRREQ 161 { 162 VBGLIOCIDCHGCMFASTCALL Hdr; 163 VMMDevHGCMCall Call; 164 VBoxSFParmList Parms; 165 HGCMPageListInfo StrPgLst; 166 HGCMPageListInfo BufPgLst; 167 } VBOXSFLISTDIRREQ; 168 169 /** 170 * More file search data (on physical heap). 171 */ 172 typedef struct VBOXSFFSBUF /**< @todo rename as is no longer buffer. */ 173 { 174 /** The request (must be first). */ 175 VBOXSFLISTDIRREQ Req; 164 176 /** A magic number (VBOXSFFSBUF_MAGIC). */ 165 177 uint32_t u32Magic; 166 /** Amount of buffer space allocated after this header. */167 uint32_t cbBuf;168 178 /** The filter string (full path), NULL if all files are request. */ 169 179 PSHFLSTRING pFilter; 180 /** Size of the buffer for directory entries. */ 181 uint32_t cbBuf; 182 /** Buffer for directory entries on the physical heap. */ 183 PSHFLDIRINFO pBuf; 170 184 /** Must have attributes (shifted down DOS attributes). */ 171 185 uint8_t fMustHaveAttribs; … … 184 198 /** The next entry. */ 185 199 PSHFLDIRINFO pEntry; 200 //uint32_t uPadding3; 186 201 /** Staging area for staging a full FILEFINDBUF4L (+ 32 safe bytes). */ 187 202 uint8_t abStaging[RT_ALIGN_32(sizeof(FILEFINDBUF4L) + 32, 8)]; 188 203 } VBOXSFFSBUF; 189 AssertCompileSizeAlignment(VBOXSFFSBUF, 8);190 204 /** Pointer to a file search buffer. */ 191 205 typedef VBOXSFFSBUF *PVBOXSFFSBUF; 192 206 /** Magic number for VBOXSFFSBUF (Robert Anson Heinlein). */ 193 207 #define VBOXSFFSBUF_MAGIC UINT32_C(0x19070707) 194 /** Minimum buffer size. */195 #define VBOXSFFSBUF_MIN_SIZE ( RT_ALIGN_32(sizeof(VBOXSFFSBUF) + sizeof(SHFLDIRINFO) + CCHMAXPATHCOMP * 4 + ALLOC_HDR_SIZE, 64) \196 - ALLOC_HDR_SIZE)197 208 198 209 … … 878 889 pReq->Parms.pBuf.type = VMMDevHGCMParmType_PageList; 879 890 pReq->Parms.pBuf.u.PageList.size = cbToRead; 880 pReq->Parms.pBuf.u.PageList.offset = RT_UOFFSETOF(VBOXSFREAD EMBEDDEDREQ, abData[0]) - sizeof(VBGLIOCIDCHGCMFASTCALL);891 pReq->Parms.pBuf.u.PageList.offset = RT_UOFFSETOF(VBOXSFREADPGLSTREQ, PgLst) - sizeof(VBGLIOCIDCHGCMFASTCALL); 881 892 pReq->PgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST; 882 893 pReq->PgLst.cPages = (uint16_t)cPages; … … 960 971 pReq->Parms.u64Handle.u.value64 = hHostFile; 961 972 962 pReq->Parms.off64Write.type 963 pReq->Parms.off64Write.u.value64 964 965 pReq->Parms.cb32Write.type 966 pReq->Parms.cb32Write.u.value32 973 pReq->Parms.off64Write.type = VMMDevHGCMParmType_64bit; 974 pReq->Parms.off64Write.u.value64 = offWrite; 975 976 pReq->Parms.cb32Write.type = VMMDevHGCMParmType_32bit; 977 pReq->Parms.cb32Write.u.value32 = cbToWrite; 967 978 968 979 pReq->Parms.pBuf.type = VMMDevHGCMParmType_PageList; 969 980 pReq->Parms.pBuf.u.PageList.size = cbToWrite; 970 pReq->Parms.pBuf.u.PageList.offset = RT_UOFFSETOF(VBOXSFWRITE EMBEDDEDREQ, abData[0]) - sizeof(VBGLIOCIDCHGCMFASTCALL);981 pReq->Parms.pBuf.u.PageList.offset = RT_UOFFSETOF(VBOXSFWRITEPGLSTREQ, PgLst) - sizeof(VBGLIOCIDCHGCMFASTCALL); 971 982 pReq->PgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST; 972 983 pReq->PgLst.cPages = (uint16_t)cPages; … … 982 993 983 994 995 /** 996 * SHFL_FN_LIST request with separate string buffer and buffers for entries, 997 * both allocated on the physical heap. 998 */ 999 DECLINLINE(int) vboxSfOs2HostReqListDir(PVBOXSFFOLDER pFolder, VBOXSFLISTDIRREQ *pReq, uint64_t hHostDir, 1000 PSHFLSTRING pFilter, uint32_t fFlags, PSHFLDIRINFO pBuffer, uint32_t cbBuffer) 1001 { 1002 VBGLIOCIDCHGCMFASTCALL_INIT(&pReq->Hdr, VbglR0PhysHeapGetPhysAddr(pReq), &pReq->Call, g_SfClient.idClient, 1003 SHFL_FN_LIST, SHFL_CPARMS_LIST, sizeof(*pReq)); 1004 1005 pReq->Parms.id32Root.type = VMMDevHGCMParmType_32bit; 1006 pReq->Parms.id32Root.u.value32 = pFolder->hHostFolder.root; 1007 1008 pReq->Parms.u64Handle.type = VMMDevHGCMParmType_64bit; 1009 pReq->Parms.u64Handle.u.value64 = hHostDir; 1010 1011 pReq->Parms.f32Flags.type = VMMDevHGCMParmType_32bit; 1012 pReq->Parms.f32Flags.u.value32 = fFlags; 1013 1014 pReq->Parms.cb32Buffer.type = VMMDevHGCMParmType_32bit; 1015 pReq->Parms.cb32Buffer.u.value32 = cbBuffer; 1016 1017 pReq->Parms.pStrFilter.type = VMMDevHGCMParmType_ContiguousPageList; 1018 pReq->Parms.pStrFilter.u.PageList.offset = RT_UOFFSETOF(VBOXSFLISTDIRREQ, StrPgLst) - sizeof(VBGLIOCIDCHGCMFASTCALL); 1019 pReq->StrPgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST; 1020 pReq->StrPgLst.cPages = 1; 1021 if (pFilter) 1022 { 1023 pReq->Parms.pStrFilter.u.PageList.size = SHFLSTRING_HEADER_SIZE + pFilter->u16Size; 1024 RTGCPHYS32 const GCPhys = VbglR0PhysHeapGetPhysAddr(pFilter); 1025 uint32_t const offFirstPage = GCPhys & PAGE_OFFSET_MASK; 1026 pReq->StrPgLst.offFirstPage = (uint16_t)offFirstPage; 1027 pReq->StrPgLst.aPages[0] = GCPhys - offFirstPage; 1028 } 1029 else 1030 { 1031 pReq->Parms.pStrFilter.u.PageList.size = 0; 1032 pReq->StrPgLst.offFirstPage = 0; 1033 pReq->StrPgLst.aPages[0] = NIL_RTGCPHYS64; 1034 } 1035 1036 pReq->Parms.pBuffer.type = VMMDevHGCMParmType_ContiguousPageList; 1037 pReq->Parms.pBuffer.u.PageList.offset = RT_UOFFSETOF(VBOXSFLISTDIRREQ, BufPgLst) - sizeof(VBGLIOCIDCHGCMFASTCALL); 1038 pReq->Parms.pBuffer.u.PageList.size = cbBuffer; 1039 pReq->BufPgLst.flags = VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST; 1040 pReq->BufPgLst.cPages = 1; 1041 RTGCPHYS32 const GCPhys = VbglR0PhysHeapGetPhysAddr(pBuffer); 1042 uint32_t const offFirstPage = GCPhys & PAGE_OFFSET_MASK; 1043 pReq->BufPgLst.offFirstPage = (uint16_t)offFirstPage; 1044 pReq->BufPgLst.aPages[0] = GCPhys - offFirstPage; 1045 1046 pReq->Parms.f32Done.type = VMMDevHGCMParmType_32bit; 1047 pReq->Parms.f32Done.u.value32 = 0; 1048 1049 pReq->Parms.c32Entries.type = VMMDevHGCMParmType_32bit; 1050 pReq->Parms.c32Entries.u.value32 = 0; 1051 1052 int vrc = VbglR0HGCMFastCall(g_SfClient.handle, &pReq->Hdr, sizeof(*pReq)); 1053 if (RT_SUCCESS(vrc)) 1054 vrc = pReq->Call.header.result; 1055 return vrc; 1056 } 1057 984 1058 /** @} */ 985 1059
Note:
See TracChangeset
for help on using the changeset viewer.