Changeset 79287 in vbox for trunk/src/VBox/Additions/common/VBoxService
- Timestamp:
- Jun 22, 2019 12:05:44 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 131488
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.