Changeset 55613 in vbox
- Timestamp:
- May 3, 2015 4:12:35 AM (9 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 8 edited
-
idl/VirtualBox.xidl (modified) (4 diffs)
-
include/GuestImpl.h (modified) (2 diffs)
-
include/GuestSessionImpl.h (modified) (4 diffs)
-
src-client/GuestFsObjInfoImpl.cpp (modified) (1 diff)
-
src-client/GuestImpl.cpp (modified) (1 diff)
-
src-client/GuestProcessImpl.cpp (modified) (1 diff)
-
src-client/GuestSessionImpl.cpp (modified) (12 diffs)
-
src-client/GuestSessionImplTasks.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r55611 r55613 10368 10368 10369 10369 <enum 10370 name="PathStyle" 10371 uuid="97303a5b-42e8-0a55-d16f-d2a92c295261" 10372 > 10373 <desc> 10374 The path style of a system. 10375 (Values matches the RTPATH_STR_F_STYLE_XXX defines in iprt/path.h!) 10376 </desc> 10377 <const name="DOS" value="1"> 10378 <desc>DOS-style paths with forward and backward slashes, drive 10379 letters and UNC. Known from DOS, OS/2 and Windows.</desc> 10380 </const> 10381 <const name="UNIX" value="2"> 10382 <desc>UNIX-style paths with forward slashes only.</desc> 10383 </const> 10384 <const name="Unknown" value="8"> 10385 <desc> 10386 The path style is not known, most likely because the guest additions 10387 aren't active yet. 10388 </desc> 10389 </const> 10390 </enum> 10391 10392 <enum 10370 10393 name="FileStatus" 10371 10394 uuid="8c86468b-b97b-4080-8914-e29f5b0abd2c" … … 10776 10799 <interface 10777 10800 name="IGuestSession" extends="$unknown" 10778 uuid=" bb890975-4903-38f8-4bc2-f39341f95533"10801 uuid="c003c35e-4dc4-4111-4771-51befc3c1d30" 10779 10802 wsmap="managed" 10780 10803 > … … 10887 10910 <desc> 10888 10911 Returns all current guest processes. 10912 </desc> 10913 </attribute> 10914 <attribute name="pathStyle" type="PathStyle" readonly="yes"> 10915 <desc> 10916 The style of paths used by the guest. Handy for giving the right kind 10917 of path specifications to <link to="fileOpen"/> and similar methods. 10889 10918 </desc> 10890 10919 </attribute> … … 11462 11491 <param name="acl" type="wstring" dir="in"> 11463 11492 <desc>Actual ACL string to set. Must comply with the guest OS.</desc> 11493 </param> 11494 </method> 11495 11496 <method name="fsExists"> 11497 <desc> 11498 Checks whether a file system object (file, directory, etc) exists in 11499 the guest or not. 11500 11501 <result name="VBOX_E_IPRT_ERROR"> 11502 Error while checking existence of the file specified. 11503 </result> 11504 </desc> 11505 <param name="path" type="wstring" dir="in"> 11506 <desc>Path to the file system object to check the existance of.</desc> 11507 </param> 11508 <param name="followSymlinks" type="boolean" dir="in"> 11509 <desc> 11510 If @c true symbolic links will be followed and the target must 11511 exists and be accessible, otherwise, if @c false we'll be happy 11512 with a dangling symbolic link. 11513 </desc> 11514 </param> 11515 <param name="exists" type="boolean" dir="return"> 11516 <desc>Returns @c true if the file exists, @c false if not.</desc> 11517 </param> 11518 </method> 11519 11520 <method name="fsQueryInfo"> 11521 <desc> 11522 Queries information about a file system object (file, directory, etc) 11523 in the guest. 11524 11525 <result name="VBOX_E_OBJECT_NOT_FOUND"> 11526 The file system object was not found. 11527 </result> 11528 <result name="VBOX_E_IPRT_ERROR"> 11529 Error while querying information. 11530 </result> 11531 </desc> 11532 <param name="path" type="wstring" dir="in"> 11533 <desc>Path to the file system object to gather information about</desc> 11534 </param> 11535 <param name="followSymlinks" type="boolean" dir="in"> 11536 <desc> 11537 Information about symbolic links is returned if @c false. Otherwise, 11538 symbolic links are followed and the returned information concerns 11539 itself with the symlink target if @c true. 11540 </desc> 11541 </param> 11542 <param name="info" type="IGuestFsObjInfo" dir="return"> 11543 <desc><link to="IGuestFsObjInfo"/> object containing the information.</desc> 11464 11544 </param> 11465 11545 </method> -
trunk/src/VBox/Main/include/GuestImpl.h
r55401 r55613 99 99 int i_dispatchToSession(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb); 100 100 uint32_t i_getAdditionsVersion(void) { return mData.mAdditionsVersionFull; } 101 VBOXOSTYPE i_getGuestOSType(void) { return mData.mOSType; } 101 102 int i_sessionRemove(GuestSession *pSession); 102 103 int i_sessionCreate(const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds, … … 178 179 struct Data 179 180 { 180 Data() : m AdditionsRunLevel(AdditionsRunLevelType_None)181 Data() : mOSType(VBOXOSTYPE_Unknown), mAdditionsRunLevel(AdditionsRunLevelType_None) 181 182 , mAdditionsVersionFull(0), mAdditionsRevision(0), mAdditionsFeatures(0) 182 183 { } 183 184 185 VBOXOSTYPE mOSType; /**@< For internal used. VBOXOSTYPE_Unknown if not reported. */ 184 186 Utf8Str mOSTypeId; 185 187 FacilityMap mFacilityMap; -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r55592 r55613 272 272 HRESULT getEnvironmentBase(std::vector<com::Utf8Str> &aEnvironmentBase); 273 273 HRESULT getProcesses(std::vector<ComPtr<IGuestProcess> > &aProcesses); 274 HRESULT getPathStyle(PathStyle_T *aPathStyle); 274 275 HRESULT getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories); 275 276 HRESULT getFiles(std::vector<ComPtr<IGuestFile> > &aFiles); … … 349 350 HRESULT fileSetACL(const com::Utf8Str &aFile, 350 351 const com::Utf8Str &aAcl); 352 HRESULT fsExists(const com::Utf8Str &aPath, 353 BOOL aFollowSymlinks, 354 BOOL *pfExists); 355 HRESULT fsQueryInfo(const com::Utf8Str &aPath, 356 BOOL aFollowSymlinks, 357 ComPtr<IGuestFsObjInfo> &aInfo); 351 358 HRESULT processCreate(const com::Utf8Str &aCommand, 352 359 const std::vector<com::Utf8Str> &aArguments, … … 404 411 int i_directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo, 405 412 ComObjPtr<GuestDirectory> &pDirectory, int *pGuestRc); 406 int i_directoryQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc);413 int i_directoryQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc); 407 414 int i_dispatchToDirectory(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb); 408 415 int i_dispatchToFile(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb); … … 414 421 int i_fileRemoveInternal(const Utf8Str &strPath, int *pGuestRc); 415 422 int i_fileOpenInternal(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc); 416 int i_fileQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc);423 int i_fileQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc); 417 424 int i_fileQuerySizeInternal(const Utf8Str &strPath, int64_t *pllSize, int *pGuestRc); 418 int i_fsQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc);425 int i_fsQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc); 419 426 const GuestCredentials &i_getCredentials(void); 420 427 EventSource *i_getEventSource(void) { return mEventSource; } -
trunk/src/VBox/Main/src-client/GuestFsObjInfoImpl.cpp
r50528 r55613 63 63 /* Enclose the state transition NotReady->InInit->Ready. */ 64 64 AutoInitSpan autoInitSpan(this); 65 AssertReturn(autoInitSpan.isOk(), E_FAIL); 65 AssertReturn(autoInitSpan.isOk(), E_FAIL); /** @todo r=bird: returning COM or IPRT status codes here?*/ 66 66 67 67 mData = objData; -
trunk/src/VBox/Main/src-client/GuestImpl.cpp
r55180 r55613 898 898 * its real status when using new(er) Guest Additions. 899 899 */ 900 mData.mOSType = aOsType; 900 901 mData.mOSTypeId = Global::OSTypeId(aOsType); 901 902 } -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r55599 r55613 2065 2065 } 2066 2066 2067 /** 2068 * <Someone write documentation, pretty please!> 2069 * 2070 * @param pGuestRc Optional. Will be set to VINF_SUCCESS, 2071 * VERR_NOT_EQUAL or VERR_INVALID_STATE if the 2072 * process completed. Should it fail earlier that, 2073 * you're feel free to enlighten the rest of us... 2074 */ 2067 2075 /* static */ 2068 2076 int GuestProcessTool::i_runEx( GuestSession *pGuestSession, -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r55592 r55613 549 549 } 550 550 551 HRESULT GuestSession::getPathStyle(PathStyle_T *aPathStyle) 552 { 553 #ifndef VBOX_WITH_GUEST_CONTROL 554 ReturnComNotImplemented(); 555 #else 556 VBOXOSTYPE enmOsType = mParent->i_getGuestOSType(); 557 if ( enmOsType < VBOXOSTYPE_DOS) 558 { 559 *aPathStyle = PathStyle_Unknown; 560 LogFlowFunc(("returns PathStyle_Unknown\n")); 561 } 562 else if (enmOsType < VBOXOSTYPE_Linux) 563 { 564 *aPathStyle = PathStyle_DOS; 565 LogFlowFunc(("returns PathStyle_DOS\n")); 566 } 567 else 568 { 569 *aPathStyle = PathStyle_UNIX; 570 LogFlowFunc(("returns PathStyle_UNIX\n")); 571 } 572 return S_OK; 573 #endif 574 } 575 551 576 HRESULT GuestSession::getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories) 552 577 { … … 734 759 } 735 760 736 int GuestSession::i_directoryQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc) 737 { 738 LogFlowThisFunc(("strPath=%s\n", strPath.c_str())); 739 740 int vrc = i_fsQueryInfoInternal(strPath, objData, pGuestRc); 761 int GuestSession::i_directoryQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, 762 GuestFsObjData &objData, int *pGuestRc) 763 { 764 LogFlowThisFunc(("strPath=%s fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks)); 765 766 int vrc = i_fsQueryInfoInternal(strPath, fFollowSymlinks, objData, pGuestRc); 741 767 if (RT_SUCCESS(vrc)) 742 768 { … … 1360 1386 } 1361 1387 1362 int GuestSession::i_fileQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc)1363 { 1364 LogFlowThisFunc(("strPath=%s \n", strPath.c_str()));1365 1366 int vrc = i_fsQueryInfoInternal(strPath, objData, pGuestRc);1388 int GuestSession::i_fileQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc) 1389 { 1390 LogFlowThisFunc(("strPath=%s fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks)); 1391 1392 int vrc = i_fsQueryInfoInternal(strPath, fFollowSymlinks, objData, pGuestRc); 1367 1393 if (RT_SUCCESS(vrc)) 1368 1394 { … … 1380 1406 1381 1407 GuestFsObjData objData; 1382 int vrc = i_fileQueryInfoInternal(strPath, objData, pGuestRc);1408 int vrc = i_fileQueryInfoInternal(strPath, false /*fFollowSymlinks*/, objData, pGuestRc); 1383 1409 if (RT_SUCCESS(vrc)) 1384 1410 *pllSize = objData.mObjectSize; … … 1387 1413 } 1388 1414 1389 int GuestSession::i_fsQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc) 1415 /** 1416 * <Someone write documentation, pretty please!> 1417 * 1418 * @param pGuestRc Optional. Will be set to VINF_SUCCESS, 1419 * VERR_NOT_EQUAL or VERR_INVALID_STATE if the 1420 * process completed. May probably be set to a lot of 1421 * other things. Not sure if these things are related 1422 * to the process we ran or what, really. :-( 1423 */ 1424 int GuestSession::i_fsQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc) 1390 1425 { 1391 1426 LogFlowThisFunc(("strPath=%s\n", strPath.c_str())); … … 1409 1444 } 1410 1445 1411 int guestRc; GuestCtrlStreamObjects stdOut; 1446 int guestRc; 1447 GuestCtrlStreamObjects stdOut; 1412 1448 if (RT_SUCCESS(vrc)) 1413 1449 vrc = GuestProcessTool::i_runEx(this, procInfo, … … 2648 2684 2649 2685 GuestFsObjData objData; int guestRc; 2650 int rc = i_directoryQueryInfoInternal(aPath, objData, &guestRc);2686 int rc = i_directoryQueryInfoInternal(aPath, false /*fFollowSymlinks*/, objData, &guestRc); 2651 2687 if (RT_SUCCESS(rc)) 2652 2688 *aExists = objData.mType == FsObjType_Directory; … … 2744 2780 2745 2781 GuestFsObjData objData; int guestRc; 2746 int vrc = i_directoryQueryInfoInternal(aPath, objData, &guestRc);2782 int vrc = i_directoryQueryInfoInternal(aPath, false /*fFollowSymlinks*/, objData, &guestRc); 2747 2783 if (RT_SUCCESS(vrc)) 2748 2784 { … … 3107 3143 3108 3144 GuestFsObjData objData; int guestRc; 3109 int vrc = i_fileQueryInfoInternal(aPath, objData, &guestRc);3145 int vrc = i_fileQueryInfoInternal(aPath, false /*fFollowSymlinks*/, objData, &guestRc); 3110 3146 if (RT_SUCCESS(vrc)) 3111 3147 { … … 3268 3304 3269 3305 GuestFsObjData objData; int guestRc; 3270 int vrc = i_fileQueryInfoInternal(aPath, objData, &guestRc);3306 int vrc = i_fileQueryInfoInternal(aPath, false /*fFollowSymlinks*/, objData, &guestRc); 3271 3307 if (RT_SUCCESS(vrc)) 3272 3308 { … … 3387 3423 #endif /* VBOX_WITH_GUEST_CONTROL */ 3388 3424 } 3425 3389 3426 HRESULT GuestSession::fileSetACL(const com::Utf8Str &aFile, const com::Utf8Str &aAcl) 3390 3427 { … … 3395 3432 3396 3433 ReturnComNotImplemented(); 3434 #endif /* VBOX_WITH_GUEST_CONTROL */ 3435 } 3436 3437 HRESULT GuestSession::fsExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks, BOOL *aExists) 3438 { 3439 #ifndef VBOX_WITH_GUEST_CONTROL 3440 ReturnComNotImplemented(); 3441 #else 3442 LogFlowThisFuncEnter(); 3443 3444 HRESULT hrc = S_OK; 3445 *aExists = false; 3446 if (RT_LIKELY(aPath.isNotEmpty())) 3447 { 3448 GuestFsObjData objData; 3449 int rcGuest; 3450 int vrc = i_fsQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &rcGuest); 3451 if (RT_SUCCESS(vrc)) 3452 *aExists = TRUE; 3453 else if ( vrc == VERR_NOT_A_FILE 3454 || vrc == VERR_PATH_NOT_FOUND 3455 || vrc == VERR_FILE_NOT_FOUND 3456 || vrc == VERR_INVALID_NAME) 3457 hrc = S_OK; /* Ignore these vrc values. */ 3458 else if (vrc == VERR_GSTCTL_GUEST_ERROR) /** @todo What _is_ rcGuest, really? Stuff like VERR_NOT_A_FILE too?? */ 3459 hrc = GuestProcess::i_setErrorExternal(this, rcGuest); 3460 else 3461 hrc = setErrorVrc(vrc, tr("Querying file information for \"%s\" failed: %Rrc"), aPath.c_str(), vrc); 3462 } 3463 /* else: If the file name is empty, there is no way it can exists. So, don't 3464 be a tedious and return E_INVALIDARG, simply return FALSE. */ 3465 LogFlowThisFuncLeave(); 3466 return hrc; 3467 #endif /* VBOX_WITH_GUEST_CONTROL */ 3468 } 3469 3470 HRESULT GuestSession::fsQueryInfo(const com::Utf8Str &aPath, BOOL aFollowSymlinks, ComPtr<IGuestFsObjInfo> &aInfo) 3471 { 3472 #ifndef VBOX_WITH_GUEST_CONTROL 3473 ReturnComNotImplemented(); 3474 #else 3475 LogFlowThisFuncEnter(); 3476 3477 HRESULT hrc = S_OK; 3478 if (RT_LIKELY(aPath.isNotEmpty())) 3479 { 3480 GuestFsObjData Info; 3481 int rcGuest; 3482 int vrc = i_fsQueryInfoInternal(aPath, aFollowSymlinks != FALSE, Info, &rcGuest); 3483 if (RT_SUCCESS(vrc)) 3484 { 3485 ComObjPtr<GuestFsObjInfo> ptrFsObjInfo; 3486 hrc = ptrFsObjInfo.createObject(); 3487 if (SUCCEEDED(hrc)) 3488 { 3489 vrc = ptrFsObjInfo->init(Info); 3490 if (RT_SUCCESS(vrc)) 3491 hrc = ptrFsObjInfo.queryInterfaceTo(aInfo.asOutParam()); 3492 else 3493 hrc = setErrorVrc(vrc); 3494 } 3495 } 3496 else if (vrc == VERR_GSTCTL_GUEST_ERROR) 3497 hrc = GuestProcess::i_setErrorExternal(this, rcGuest); 3498 else 3499 hrc = setErrorVrc(vrc, tr("Querying file information for \"%s\" failed: %Rrc"), aPath.c_str(), vrc); 3500 } 3501 /* else: If the file name is empty, there is no way it can exists. So, don't 3502 be a tedious and return E_INVALIDARG, simply return FALSE. */ 3503 LogFlowThisFuncLeave(); 3504 return hrc; 3397 3505 #endif /* VBOX_WITH_GUEST_CONTROL */ 3398 3506 } -
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r55535 r55613 607 607 */ 608 608 GuestFsObjData objData; int guestRc; 609 int rc = pSession->i_fileQueryInfoInternal(Utf8Str(mSource), objData, &guestRc);609 int rc = pSession->i_fileQueryInfoInternal(Utf8Str(mSource), false /*fFollowSymlinks*/, objData, &guestRc); 610 610 if (RT_FAILURE(rc)) 611 611 {
Note:
See TracChangeset
for help on using the changeset viewer.

