Changeset 47817 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Aug 16, 2013 3:30:15 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 88078
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestFileImpl.cpp
r47469 r47817 153 153 if (RT_SUCCESS(vrc)) 154 154 { 155 mData.mID = 0; 155 mSession = pSession; 156 157 mData.mID = uFileID; 156 158 mData.mInitialSize = 0; 157 159 mData.mStatus = FileStatus_Undefined; 160 mData.mOpenInfo = openInfo; 158 161 159 162 unconst(mEventSource).createObject(); … … 273 276 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 274 277 275 *aDisposition = getDispositionFromString(mData.mOpenInfo.mDisposition); 278 uint32_t uDisposition = 0; 279 /** @todo Fix me! */ 280 *aDisposition = uDisposition; 276 281 277 282 return S_OK; … … 363 368 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 364 369 365 *aOpenMode = getOpenModeFromString(mData.mOpenInfo.mOpenMode); 370 uint32_t uOpenMode = 0; 371 /** @todo Fix me! */ 372 *aOpenMode = uOpenMode; 366 373 367 374 return S_OK; … … 398 405 AssertPtrReturn(pSvcCb, VERR_INVALID_POINTER); 399 406 400 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);401 402 407 int vrc; 403 408 switch (pCbCtx->uFunction) … … 454 459 if (RT_SUCCESS(vrc)) 455 460 vrc = waitForStatusChange(pEvent, 30 * 1000 /* Timeout in ms */, 456 NULL /* FileStatus */ );461 NULL /* FileStatus */, pGuestRc); 457 462 unregisterWaitEvent(pEvent); 458 463 459 464 LogFlowFuncLeaveRC(vrc); 460 465 return vrc; 461 }462 463 /* static */464 uint32_t GuestFile::getDispositionFromString(const Utf8Str &strDisposition)465 {466 return 0; /** @todo Implement me! */467 }468 469 /* static */470 uint32_t GuestFile::getOpenModeFromString(const Utf8Str &strOpenMode)471 {472 uint32_t uOpenMode = 0;473 474 const char *pc = strOpenMode.c_str();475 while (*pc != '\0')476 {477 switch (*pc++)478 {479 case 'r':480 uOpenMode |= RTFILE_O_READ;481 break;482 483 case 'w':484 uOpenMode |= RTFILE_O_WRITE;485 break;486 487 default:488 /* Silently skip unknown values. */489 break;490 }491 }492 493 return uOpenMode;494 466 } 495 467 … … 543 515 AssertPtrReturn(pSvcCbData, VERR_INVALID_POINTER); 544 516 517 LogFlowThisFuncEnter(); 518 545 519 if (pSvcCbData->mParms < 3) 546 520 return VERR_INVALID_PARAMETER; … … 548 522 int vrc = VINF_SUCCESS; 549 523 550 int idx = 0; /* Current parameter index. */524 int idx = 1; /* Current parameter index. */ 551 525 CALLBACKDATA_FILE_NOTIFY dataCb; 552 526 /* pSvcCb->mpaParms[0] always contains the context ID. */ … … 554 528 pSvcCbData->mpaParms[idx++].getUInt32(&dataCb.rc); 555 529 530 FileStatus_T fileStatus = FileStatus_Undefined; 556 531 int guestRc = (int)dataCb.rc; /* uint32_t vs. int. */ 557 532 533 LogFlowFunc(("uType=%RU32, guestRc=%Rrc\n", 534 dataCb.uType, guestRc)); 535 536 if (RT_FAILURE(guestRc)) 537 { 538 int rc2 = setFileStatus(FileStatus_Error, guestRc); 539 AssertRC(rc2); 540 541 return VINF_SUCCESS; /* Report to the guest. */ 542 } 543 558 544 switch (dataCb.uType) 559 545 { 560 546 case GUEST_FILE_NOTIFYTYPE_ERROR: 561 547 { 562 AssertMsg(mData.mStatus != FileStatus_Error, ("File status already set to error\n"));563 564 548 int rc2 = setFileStatus(FileStatus_Error, guestRc); 565 549 AssertRC(rc2); … … 573 557 pSvcCbData->mpaParms[idx++].getUInt32(&dataCb.u.open.uHandle); 574 558 575 AssertMsg(mData.mID == 0, ("File ID already set to %RU32\n", mData.mID)); 576 mData.mID = dataCb.u.open.uHandle; 577 AssertMsg(mData.mID == VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCbCtx->uContextID), 578 ("File ID %RU32 does not match context ID %RU32\n", mData.mID, 579 VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCbCtx->uContextID))); 559 { 560 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 561 AssertMsg(mData.mID == VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCbCtx->uContextID), 562 ("File ID %RU32 does not match context ID %RU32\n", mData.mID, 563 VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCbCtx->uContextID))); 564 } 580 565 581 566 /* Set the process status. */ … … 599 584 600 585 case GUEST_FILE_NOTIFYTYPE_READ: 586 { 601 587 if (pSvcCbData->mParms == 4) 602 588 { … … 606 592 if (cbRead) 607 593 { 594 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 595 608 596 mData.mOffCurrent += cbRead; 597 598 alock.release(); 609 599 610 600 com::SafeArray<BYTE> data((size_t)cbRead); 611 601 data.initFrom((BYTE*)dataCb.u.read.pvData, cbRead); 602 612 603 fireGuestFileReadEvent(mEventSource, mSession, this, mData.mOffCurrent, 613 604 cbRead, ComSafeArrayAsInParam(data)); … … 617 608 vrc = VERR_NOT_SUPPORTED; 618 609 break; 610 } 619 611 620 612 case GUEST_FILE_NOTIFYTYPE_WRITE: 613 { 621 614 if (pSvcCbData->mParms == 4) 622 615 { 623 616 pSvcCbData->mpaParms[idx++].getUInt32(&dataCb.u.write.cbWritten); 624 617 618 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 619 625 620 mData.mOffCurrent += dataCb.u.write.cbWritten; 621 uint64_t uOffCurrent = mData.mOffCurrent; 622 623 alock.release(); 626 624 627 625 if (dataCb.u.write.cbWritten) 628 fireGuestFileWriteEvent(mEventSource, mSession, this, mData.mOffCurrent,626 fireGuestFileWriteEvent(mEventSource, mSession, this, uOffCurrent, 629 627 dataCb.u.write.cbWritten); 630 628 } … … 632 630 vrc = VERR_NOT_SUPPORTED; 633 631 break; 632 } 634 633 635 634 case GUEST_FILE_NOTIFYTYPE_SEEK: 635 { 636 636 if (pSvcCbData->mParms == 4) 637 637 { 638 638 pSvcCbData->mpaParms[idx++].getUInt64(&dataCb.u.seek.uOffActual); 639 639 640 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 641 640 642 mData.mOffCurrent = dataCb.u.seek.uOffActual; 643 uint64_t uOffCurrent = mData.mOffCurrent; 644 645 alock.release(); 641 646 642 647 if (dataCb.u.seek.uOffActual) 643 648 fireGuestFileOffsetChangedEvent(mEventSource, mSession, this, 644 mData.mOffCurrent, 0 /* Processed */);649 uOffCurrent, 0 /* Processed */); 645 650 } 646 651 else 647 652 vrc = VERR_NOT_SUPPORTED; 648 653 break; 654 } 649 655 650 656 case GUEST_FILE_NOTIFYTYPE_TELL: 657 { 651 658 if (pSvcCbData->mParms == 4) 652 659 { 653 660 pSvcCbData->mpaParms[idx++].getUInt64(&dataCb.u.tell.uOffActual); 654 661 662 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 663 655 664 if (mData.mOffCurrent != dataCb.u.tell.uOffActual) 656 665 { 657 666 mData.mOffCurrent = dataCb.u.tell.uOffActual; 667 uint64_t uOffCurrent = mData.mOffCurrent; 668 669 alock.release(); 658 670 659 671 fireGuestFileOffsetChangedEvent(mEventSource, mSession, this, 660 mData.mOffCurrent, 0 /* Processed */);672 uOffCurrent, 0 /* Processed */); 661 673 } 662 674 } … … 664 676 vrc = VERR_NOT_SUPPORTED; 665 677 break; 678 } 666 679 667 680 default: … … 670 683 } 671 684 672 LogFlowThisFunc(("strName=%s, uType=%RU32, guestRc=%Rrc\n", 673 mData.mOpenInfo.mFileName.c_str(), dataCb.uType, dataCb.rc)); 674 675 if (RT_SUCCESS(vrc)) 676 { 677 /* Nothing to do here yet. */ 678 } 679 else if (vrc == VERR_NOT_SUPPORTED) 680 { 681 /* Also let the callback know. */ 682 guestRc = VERR_NOT_SUPPORTED; 683 } 685 LogFlowThisFunc(("uType=%RU32, guestRc=%Rrc\n", 686 dataCb.uType, dataCb.rc)); 684 687 685 688 LogFlowFuncLeaveRC(vrc); … … 692 695 AssertPtrReturn(pSvcCbData, VERR_INVALID_POINTER); 693 696 694 LogFlowThisFunc(("strFile=%s\n",695 mData.mOpenInfo.mFileName.c_str()));696 697 697 int vrc = setFileStatus(FileStatus_Down, VINF_SUCCESS); 698 698 … … 701 701 } 702 702 703 int GuestFile::openFile(int *pGuestRc) 704 { 705 LogFlowThisFunc(("strFile=%s, strOpenMode=%s, strDisposition=%s, uCreationMode=%RU32\n", 703 int GuestFile::openFile(uint32_t uTimeoutMS, int *pGuestRc) 704 { 705 LogFlowThisFuncEnter(); 706 707 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 708 709 LogFlowThisFunc(("strFile=%s, strOpenMode=%s, strDisposition=%s, uCreationMode=%RU32, uOffset=%RU64\n", 706 710 mData.mOpenInfo.mFileName.c_str(), mData.mOpenInfo.mOpenMode.c_str(), 707 mData.mOpenInfo.mDisposition.c_str(), mData.mOpenInfo.mCreationMode ));711 mData.mOpenInfo.mDisposition.c_str(), mData.mOpenInfo.mCreationMode, mData.mOpenInfo.mInitialOffset)); 708 712 int vrc; 709 713 … … 734 738 paParms[i++].setPointer((void*)mData.mOpenInfo.mDisposition.c_str(), 735 739 (ULONG)mData.mOpenInfo.mDisposition.length() + 1); 740 paParms[i++].setPointer((void*)mData.mOpenInfo.mSharingMode.c_str(), 741 (ULONG)mData.mOpenInfo.mSharingMode.length() + 1); 736 742 paParms[i++].setUInt32(mData.mOpenInfo.mCreationMode); 737 743 paParms[i++].setUInt64(mData.mOpenInfo.mInitialOffset); 738 744 745 alock.release(); /* Drop read lock before sending. */ 746 739 747 vrc = sendCommand(HOST_FILE_OPEN, i, paParms); 740 748 if (RT_SUCCESS(vrc)) 741 vrc = waitForStatusChange(pEvent, 30 * 1000 /* Timeout in ms */,742 NULL /* FileStatus */ );749 vrc = waitForStatusChange(pEvent, uTimeoutMS, 750 NULL /* FileStatus */, pGuestRc); 743 751 744 752 unregisterWaitEvent(pEvent); … … 903 911 } 904 912 905 /* Does not do locking; caller is responsible for that! */906 913 int GuestFile::setFileStatus(FileStatus_T fileStatus, int fileRc) 907 914 { 915 LogFlowThisFuncEnter(); 916 917 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 918 908 919 LogFlowThisFunc(("oldStatus=%ld, newStatus=%ld, fileRc=%Rrc\n", 909 920 mData.mStatus, fileStatus, fileRc)); … … 920 931 if (mData.mStatus != fileStatus) 921 932 { 922 mData.mStatus = fileStatus; 933 mData.mStatus = fileStatus; 934 mData.mLastError = fileRc; 923 935 924 936 ComObjPtr<VirtualBoxErrorInfo> errorInfo; … … 927 939 if (RT_FAILURE(fileRc)) 928 940 { 929 int rc2 = errorInfo->initEx(VBOX_E_IPRT_ERROR, fileRc, 930 COM_IIDOF(IGuestFile), getComponentName(), 931 guestErrorToString(fileRc)); 932 AssertRC(rc2); 933 } 941 hr = errorInfo->initEx(VBOX_E_IPRT_ERROR, fileRc, 942 COM_IIDOF(IGuestFile), getComponentName(), 943 guestErrorToString(fileRc)); 944 ComAssertComRC(hr); 945 } 946 947 /* Copy over necessary data before releasing lock again. */ 948 FileStatus_T fileStatus = mData.mStatus; 949 950 alock.release(); /* Release lock before firing off event. */ 934 951 935 952 fireGuestFileStateChangedEvent(mEventSource, mSession, 936 this, mData.mStatus, errorInfo);953 this, fileStatus, errorInfo); 937 954 } 938 955 … … 1013 1030 } 1014 1031 1015 int GuestFile::waitForStatusChange(GuestWaitEvent *pEvent, 1016 uint32_t uTimeoutMS, FileStatus_T *pFileStatus)1032 int GuestFile::waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, 1033 FileStatus_T *pFileStatus, int *pGuestRc) 1017 1034 { 1018 1035 AssertPtrReturn(pEvent, VERR_INVALID_POINTER); 1036 /* pFileStatus is optional. */ 1019 1037 1020 1038 VBoxEventType_T evtType; … … 1028 1046 Assert(!pFileEvent.isNull()); 1029 1047 1030 HRESULT hr = pFileEvent->COMGETTER(Status)(pFileStatus); 1048 HRESULT hr; 1049 if (pFileStatus) 1050 { 1051 hr = pFileEvent->COMGETTER(Status)(pFileStatus); 1052 ComAssertComRC(hr); 1053 } 1054 1055 ComPtr<IVirtualBoxErrorInfo> errorInfo; 1056 hr = pFileEvent->COMGETTER(Error)(errorInfo.asOutParam()); 1031 1057 ComAssertComRC(hr); 1058 1059 LONG lGuestRc; 1060 hr = errorInfo->COMGETTER(ResultDetail)(&lGuestRc); 1061 ComAssertComRC(hr); 1062 1063 LogFlowThisFunc(("resultDetail=%RI32 (rc=%Rrc)\n", 1064 lGuestRc, lGuestRc)); 1065 1066 if (RT_FAILURE((int)lGuestRc)) 1067 vrc = VERR_GSTCTL_GUEST_ERROR; 1068 1069 if (pGuestRc) 1070 *pGuestRc = (int)lGuestRc; 1032 1071 } 1033 1072 … … 1197 1236 rc = rc2; 1198 1237 1199 /*1200 * Release autocaller before calling uninit.1201 */1202 autoCaller.release();1203 1204 uninit();1205 1206 LogFlowFuncLeaveRC(rc);1207 1238 if (RT_FAILURE(rc)) 1208 1239 { … … 1214 1245 } 1215 1246 1247 LogFlowThisFunc(("Returning rc=%Rrc\n", rc)); 1216 1248 return S_OK; 1217 1249 #endif /* VBOX_WITH_GUEST_CONTROL */ -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r47630 r47817 239 239 mData.mExitCode = 0; 240 240 mData.mPID = 0; 241 mData.m RC= VINF_SUCCESS;241 mData.mLastError = VINF_SUCCESS; 242 242 mData.mStatus = ProcessStatus_Undefined; 243 243 /* Everything else will be set by the actual starting routine. */ … … 967 967 /* Do not allow overwriting an already set error. If this happens 968 968 * this means we forgot some error checking/locking somewhere. */ 969 AssertMsg(RT_SUCCESS(mData.m RC), ("Guest rc already set (to %Rrc)\n", mData.mRC));969 AssertMsg(RT_SUCCESS(mData.mLastError), ("Guest rc already set (to %Rrc)\n", mData.mLastError)); 970 970 } 971 971 else … … 976 976 if (mData.mStatus != procStatus) /* Was there a process status change? */ 977 977 { 978 mData.mStatus = procStatus;979 mData.m RC= procRc;978 mData.mStatus = procStatus; 979 mData.mLastError = procRc; 980 980 981 981 ComObjPtr<VirtualBoxErrorInfo> errorInfo; 982 982 HRESULT hr = errorInfo.createObject(); 983 983 ComAssertComRC(hr); 984 if (RT_FAILURE(mData.m RC))985 { 986 int rc2 = errorInfo->initEx(VBOX_E_IPRT_ERROR, mData.mRC,987 988 guestErrorToString(mData.mRC));989 AssertRC(rc2);984 if (RT_FAILURE(mData.mLastError)) 985 { 986 hr = errorInfo->initEx(VBOX_E_IPRT_ERROR, mData.mLastError, 987 COM_IIDOF(IGuestProcess), getComponentName(), 988 guestErrorToString(mData.mLastError)); 989 ComAssertComRC(hr); 990 990 } 991 991 992 992 /* Copy over necessary data before releasing lock again. */ 993 993 uint32_t uPID = mData.mPID; 994 ProcessStatus_T uStatus = mData.mStatus;994 ProcessStatus_T procStatus = mData.mStatus; 995 995 /** @todo Also handle mSession? */ 996 996 … … 998 998 999 999 fireGuestProcessStateChangedEvent(mEventSource, mSession, this, 1000 uPID, uStatus, errorInfo);1000 uPID, procStatus, errorInfo); 1001 1001 #if 0 1002 1002 /* … … 1408 1408 1409 1409 LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, procStatus=%RU32, procRc=%Rrc, pGuestRc=%p\n", 1410 fWaitFlags, uTimeoutMS, mData.mStatus, mData.m RC, pGuestRc));1410 fWaitFlags, uTimeoutMS, mData.mStatus, mData.mLastError, pGuestRc)); 1411 1411 1412 1412 /* Did some error occur before? Then skip waiting and return. */ … … 1414 1414 { 1415 1415 waitResult = ProcessWaitResult_Error; 1416 AssertMsg(RT_FAILURE(mData.m RC), ("No error rc (%Rrc) set when guest process indicated an error\n", mData.mRC));1416 AssertMsg(RT_FAILURE(mData.mLastError), ("No error rc (%Rrc) set when guest process indicated an error\n", mData.mLastError)); 1417 1417 if (pGuestRc) 1418 *pGuestRc = mData.m RC; /* Return last set error. */1418 *pGuestRc = mData.mLastError; /* Return last set error. */ 1419 1419 return VERR_GSTCTL_GUEST_ERROR; 1420 1420 } … … 1427 1427 { 1428 1428 if (pGuestRc) 1429 *pGuestRc = mData.m RC; /* Return last set error (if any). */1430 return RT_SUCCESS(mData.m RC) ? VINF_SUCCESS : VERR_GSTCTL_GUEST_ERROR;1429 *pGuestRc = mData.mLastError; /* Return last set error (if any). */ 1430 return RT_SUCCESS(mData.mLastError) ? VINF_SUCCESS : VERR_GSTCTL_GUEST_ERROR; 1431 1431 } 1432 1432 -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r47781 r47817 1005 1005 Utf8Str(strName).c_str(), mData.mSession.mID, mData.mFiles.size() - 1, mData.mNumObjects - 1)); 1006 1006 1007 itFiles->second->Release(); 1007 pFile->cancelWaitEvents(); 1008 pFile->Release(); 1008 1009 1009 1010 mData.mFiles.erase(itFiles); … … 1054 1055 int GuestSession::fileOpenInternal(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc) 1055 1056 { 1056 LogFlowThisFunc(("strPath=%s, strOpenMode=%s, strDisposition=%s, uCreationMode=%x, iOffset=%RI64\n",1057 LogFlowThisFunc(("strPath=%s, strOpenMode=%s, strDisposition=%s, uCreationMode=%x, uOffset=%RU64\n", 1057 1058 openInfo.mFileName.c_str(), openInfo.mOpenMode.c_str(), openInfo.mDisposition.c_str(), 1058 1059 openInfo.mCreationMode, openInfo.mInitialOffset)); … … 1111 1112 return rc; 1112 1113 1113 int guestRc; 1114 rc = pFile->openFile(&guestRc); 1114 /* 1115 * Since this is a synchronous guest call we have to 1116 * register the file object first, releasing the session's 1117 * lock and then proceed with the actual opening command 1118 * -- otherwise the file's opening callback would hang 1119 * because the session's lock still is in place. 1120 */ 1121 try 1122 { 1123 /* Add the created file to our vector. */ 1124 mData.mFiles[uNewFileID] = pFile; 1125 mData.mNumObjects++; 1126 Assert(mData.mNumObjects <= VBOX_GUESTCTRL_MAX_OBJECTS); 1127 1128 LogFlowFunc(("Added new guest file \"%s\" (Session: %RU32) (now total %ld files, %ld objects)\n", 1129 openInfo.mFileName.c_str(), mData.mSession.mID, mData.mFiles.size(), mData.mNumObjects)); 1130 1131 alock.release(); /* Release lock before firing off event. */ 1132 1133 fireGuestFileRegisteredEvent(mEventSource, this, pFile, 1134 true /* Registered */); 1135 } 1136 catch (std::bad_alloc &) 1137 { 1138 rc = VERR_NO_MEMORY; 1139 } 1140 1115 1141 if (RT_SUCCESS(rc)) 1116 1142 { 1117 try 1118 { 1119 /* Add the created file to our vector. */ 1120 mData.mFiles[uNewFileID] = pFile; 1121 mData.mNumObjects++; 1122 Assert(mData.mNumObjects <= VBOX_GUESTCTRL_MAX_OBJECTS); 1123 1124 LogFlowFunc(("Added new guest file \"%s\" (Session: %RU32) (now total %ld files, %ld objects)\n", 1125 openInfo.mFileName.c_str(), mData.mSession.mID, mData.mFiles.size(), mData.mNumObjects)); 1126 1127 alock.release(); /* Release lock before firing off event. */ 1128 1129 fireGuestFileRegisteredEvent(mEventSource, this, pFile, 1130 true /* Registered */); 1131 if (pGuestRc) 1132 *pGuestRc = guestRc; 1133 } 1134 catch (std::bad_alloc &) 1135 { 1136 rc = VERR_NO_MEMORY; 1143 int guestRc; 1144 rc = pFile->openFile(30 * 1000 /* 30s timeout */, &guestRc); 1145 if ( rc == VERR_GSTCTL_GUEST_ERROR 1146 && pGuestRc) 1147 { 1148 *pGuestRc = guestRc; 1137 1149 } 1138 1150 } … … 2728 2740 } 2729 2741 2730 STDMETHODIMP GuestSession::FileOpen(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile) 2742 STDMETHODIMP GuestSession::FileOpen(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, IGuestFile **aFile) 2743 { 2744 #ifndef VBOX_WITH_GUEST_CONTROL 2745 ReturnComNotImplemented(); 2746 #else 2747 LogFlowThisFuncEnter(); 2748 2749 Bstr strSharingMode = ""; /* Sharing mode is ignored. */ 2750 2751 return FileOpenEx(aPath, aOpenMode, aDisposition, strSharingMode.raw(), aCreationMode, 2752 0 /* aOffset */, aFile); 2753 #endif /* VBOX_WITH_GUEST_CONTROL */ 2754 } 2755 2756 STDMETHODIMP GuestSession::FileOpenEx(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, IN_BSTR aSharingMode, 2757 ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile) 2731 2758 { 2732 2759 #ifndef VBOX_WITH_GUEST_CONTROL … … 2741 2768 if (RT_UNLIKELY((aDisposition) == NULL || *(aDisposition) == '\0')) 2742 2769 return setError(E_INVALIDARG, tr("No disposition mode specified")); 2770 /* aSharingMode is optional. */ 2743 2771 2744 2772 CheckComArgOutPointerValid(aFile); … … 2750 2778 if (FAILED(hr)) 2751 2779 return hr; 2752 2753 /** @todo Validate open mode. */2754 /** @todo Validate disposition mode. */2755 2780 2756 2781 /** @todo Validate creation mode. */ … … 2761 2786 openInfo.mOpenMode = Utf8Str(aOpenMode); 2762 2787 openInfo.mDisposition = Utf8Str(aDisposition); 2788 openInfo.mSharingMode = Utf8Str(aSharingMode); 2763 2789 openInfo.mCreationMode = aCreationMode; 2764 2790 openInfo.mInitialOffset = aOffset; 2765 2791 2792 uint64_t uFlagsIgnored; 2793 int vrc = RTFileModeToFlagsEx(openInfo.mOpenMode.c_str(), 2794 openInfo.mDisposition.c_str(), 2795 openInfo.mSharingMode.c_str(), 2796 &uFlagsIgnored); 2797 if (RT_FAILURE(vrc)) 2798 return setError(E_INVALIDARG, tr("Invalid open mode / disposition / sharing mode specified")); 2799 2766 2800 ComObjPtr <GuestFile> pFile; int guestRc; 2767 intvrc = fileOpenInternal(openInfo, pFile, &guestRc);2801 vrc = fileOpenInternal(openInfo, pFile, &guestRc); 2768 2802 if (RT_SUCCESS(vrc)) 2769 2803 {
Note:
See TracChangeset
for help on using the changeset viewer.