Changeset 79287 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Jun 22, 2019 12:05:44 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 131488
- Location:
- trunk/src/VBox/Additions/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibGuestCtrl.cpp
r79252 r79287 1287 1287 1288 1288 /** 1289 * Retrieves a HOST_FILE_SET_SIZE message. 1290 */ 1291 VBGLR3DECL(int) VbglR3GuestCtrlFileGetSetSize(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, uint64_t *pcbNew) 1292 { 1293 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 1294 1295 AssertReturn(pCtx->uNumParms == 3, VERR_INVALID_PARAMETER); 1296 AssertPtrReturn(puHandle, VERR_INVALID_POINTER); 1297 AssertPtrReturn(pcbNew, VERR_INVALID_POINTER); 1298 1299 int rc; 1300 do 1301 { 1302 HGCMMsgFileSetSize Msg; 1303 VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->uClientID, vbglR3GuestCtrlGetMsgFunctionNo(pCtx->uClientID), pCtx->uNumParms); 1304 VbglHGCMParmUInt32Set(&Msg.id32Context, HOST_MSG_FILE_SET_SIZE); 1305 VbglHGCMParmUInt32Set(&Msg.id32Handle, 0); 1306 VbglHGCMParmUInt64Set(&Msg.cb64NewSize, 0); 1307 1308 rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg)); 1309 if (RT_SUCCESS(rc)) 1310 { 1311 Msg.id32Context.GetUInt32(&pCtx->uContextID); 1312 Msg.id32Handle.GetUInt32(puHandle); 1313 Msg.cb64NewSize.GetUInt64(pcbNew); 1314 } 1315 } while (rc == VERR_INTERRUPTED && g_fVbglR3GuestCtrlHavePeekGetCancel); 1316 return rc; 1317 } 1318 1319 1320 /** 1289 1321 * Retrieves a HOST_EXEC_TERMINATE message. 1290 1322 */ … … 1411 1443 1412 1444 1413 VBGLR3DECL(int) VbglR3GuestCtrlFileCbWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, 1414 uint32_t uRc, uint32_t uWritten) 1445 VBGLR3DECL(int) VbglR3GuestCtrlFileCbWrite(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t cbWritten) 1415 1446 { 1416 1447 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); … … 1421 1452 VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_WRITE); 1422 1453 VbglHGCMParmUInt32Set(&Msg.rc, uRc); 1423 VbglHGCMParmUInt32Set(&Msg.u.write.written, uWritten);1454 VbglHGCMParmUInt32Set(&Msg.u.write.written, cbWritten); 1424 1455 1425 1456 return VbglR3HGCMCall(&Msg.hdr, RT_UOFFSET_AFTER(HGCMReplyFileNotify, u.write)); … … 1427 1458 1428 1459 1429 VBGLR3DECL(int) VbglR3GuestCtrlFileCbSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, 1430 uint32_t uRc, uint64_t uOffActual) 1460 VBGLR3DECL(int) VbglR3GuestCtrlFileCbSeek(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t offCurrent) 1431 1461 { 1432 1462 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); … … 1437 1467 VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_SEEK); 1438 1468 VbglHGCMParmUInt32Set(&Msg.rc, uRc); 1439 VbglHGCMParmUInt64Set(&Msg.u.seek.offset, uOffActual);1469 VbglHGCMParmUInt64Set(&Msg.u.seek.offset, offCurrent); 1440 1470 1441 1471 return VbglR3HGCMCall(&Msg.hdr, RT_UOFFSET_AFTER(HGCMReplyFileNotify, u.seek)); … … 1443 1473 1444 1474 1445 VBGLR3DECL(int) VbglR3GuestCtrlFileCbTell(PVBGLR3GUESTCTRLCMDCTX pCtx, 1446 uint32_t uRc, uint64_t uOffActual) 1475 VBGLR3DECL(int) VbglR3GuestCtrlFileCbTell(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t offCurrent) 1447 1476 { 1448 1477 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); … … 1453 1482 VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_TELL); 1454 1483 VbglHGCMParmUInt32Set(&Msg.rc, uRc); 1455 VbglHGCMParmUInt64Set(&Msg.u.tell.offset, uOffActual);1484 VbglHGCMParmUInt64Set(&Msg.u.tell.offset, offCurrent); 1456 1485 1457 1486 return VbglR3HGCMCall(&Msg.hdr, RT_UOFFSET_AFTER(HGCMReplyFileNotify, u.tell)); 1487 } 1488 1489 1490 VBGLR3DECL(int) VbglR3GuestCtrlFileCbSetSize(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint64_t cbNew) 1491 { 1492 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 1493 1494 HGCMReplyFileNotify Msg; 1495 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, GUEST_MSG_FILE_NOTIFY, 4); 1496 VbglHGCMParmUInt32Set(&Msg.context, pCtx->uContextID); 1497 VbglHGCMParmUInt32Set(&Msg.type, GUEST_FILE_NOTIFYTYPE_SET_SIZE); 1498 VbglHGCMParmUInt32Set(&Msg.rc, uRc); 1499 VbglHGCMParmUInt64Set(&Msg.u.SetSize.cb64Size, cbNew); 1500 1501 return VbglR3HGCMCall(&Msg.hdr, RT_UOFFSET_AFTER(HGCMReplyFileNotify, u.SetSize)); 1458 1502 } 1459 1503 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
r79261 r79287 316 316 uint64_t fFlags; 317 317 rc = RTFileModeToFlagsEx(szAccess, szDisposition, NULL /* pszSharing, not used yet */, &fFlags); 318 VGSvcVerbose(4, "[File %s] Opening with fFlags= 0x%x,rc=%Rrc\n", pFile->szName, fFlags, rc);318 VGSvcVerbose(4, "[File %s] Opening with fFlags=%#RX64 -> rc=%Rrc\n", pFile->szName, fFlags, rc); 319 319 if (RT_SUCCESS(rc)) 320 320 { 321 fFlags |= (uCreationMode << RTFILE_O_CREATE_MODE_SHIFT) & RTFILE_O_CREATE_MODE_MASK; 321 322 rc = RTFileOpen(&pFile->hFile, pFile->szName, fFlags); 322 323 if (RT_SUCCESS(rc)) … … 766 767 767 768 769 static int vgsvcGstCtrlSessionHandleFileSetSize(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx) 770 { 771 AssertPtrReturn(pSession, VERR_INVALID_POINTER); 772 AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER); 773 774 /* 775 * Retrieve the request. 776 */ 777 uint32_t uHandle = 0; 778 uint64_t cbNew = 0; 779 int rc = VbglR3GuestCtrlFileGetSetSize(pHostCtx, &uHandle, &cbNew); 780 if (RT_SUCCESS(rc)) 781 { 782 /* 783 * Locate the file and ask for the current position. 784 */ 785 PVBOXSERVICECTRLFILE pFile = vgsvcGstCtrlSessionFileGetLocked(pSession, uHandle); 786 if (pFile) 787 { 788 rc = RTFileSetSize(pFile->hFile, cbNew); 789 VGSvcVerbose(5, "[File %s]: Changing size to %RU64 (%#RX64), rc=%Rrc\n", pFile->szName, cbNew, cbNew, rc); 790 } 791 else 792 { 793 VGSvcError("File %u (%#x) not found!\n", uHandle, uHandle); 794 cbNew = UINT64_MAX; 795 rc = VERR_NOT_FOUND; 796 } 797 798 /* 799 * Report result back to host. 800 */ 801 int rc2 = VbglR3GuestCtrlFileCbSetSize(pHostCtx, rc, cbNew); 802 if (RT_FAILURE(rc2)) 803 { 804 VGSvcError("Failed to report file tell status, rc=%Rrc\n", rc2); 805 if (RT_SUCCESS(rc)) 806 rc = rc2; 807 } 808 } 809 else 810 { 811 VGSvcError("Error fetching parameters for file tell operation: %Rrc\n", rc); 812 VbglR3GuestCtrlMsgSkip(pHostCtx->uClientID, rc, UINT32_MAX); 813 } 814 return rc; 815 } 816 817 768 818 static int vgsvcGstCtrlSessionHandlePathRename(PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx) 769 819 { … … 1287 1337 if (fImpersonated) 1288 1338 rc = vgsvcGstCtrlSessionHandleFileTell(pSession, pHostCtx); 1339 break; 1340 1341 case HOST_MSG_FILE_SET_SIZE: 1342 if (fImpersonated) 1343 rc = vgsvcGstCtrlSessionHandleFileSetSize(pSession, pHostCtx); 1289 1344 break; 1290 1345
Note:
See TracChangeset
for help on using the changeset viewer.