Changeset 71785 in vbox for trunk/src/VBox
- Timestamp:
- Apr 9, 2018 4:00:47 PM (7 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestSessionImpl.h
r71648 r71785 261 261 int i_fileUnregister(GuestFile *pFile); 262 262 int i_fileRemove(const Utf8Str &strPath, int *pGuestRc); 263 int i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction, 264 FileSharingMode_T aSharingMode, ULONG aCreationMode, 265 const std::vector<FileOpenExFlag_T> &aFlags, 266 ComObjPtr<GuestFile> &pFile, int *prcGuest); 263 267 int i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc); 264 268 int i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc); -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r71648 r71785 1248 1248 } 1249 1249 1250 int GuestSession::i_fileOpen(const GuestFileOpenInfo &openInfo, 1251 ComObjPtr<GuestFile> &pFile, int *prcGuest) 1252 { 1253 LogFlowThisFunc(("strFile=%s, enmAccessMode=%d (%s) enmOpenAction=%d (%s) uCreationMode=%RU32 mfOpenEx=%RU32\n", 1254 openInfo.mFileName.c_str(), openInfo.mAccessMode, openInfo.mpszAccessMode, 1255 openInfo.mOpenAction, openInfo.mpszOpenAction, openInfo.mCreationMode, openInfo.mfOpenEx)); 1250 int GuestSession::i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction, 1251 FileSharingMode_T aSharingMode, ULONG aCreationMode, const std::vector<FileOpenExFlag_T> &aFlags, 1252 ComObjPtr<GuestFile> &pFile, int *prcGuest) 1253 { 1254 GuestFileOpenInfo openInfo; 1255 RT_ZERO(openInfo); 1256 1257 openInfo.mFileName = aPath; 1258 openInfo.mCreationMode = aCreationMode; 1259 openInfo.mAccessMode = aAccessMode; 1260 openInfo.mOpenAction = aOpenAction; 1261 openInfo.mSharingMode = aSharingMode; 1262 1263 /* Combine and validate flags. */ 1264 uint32_t fOpenEx = 0; 1265 for (size_t i = 0; i < aFlags.size(); i++) 1266 fOpenEx = aFlags[i]; 1267 if (fOpenEx) 1268 return VERR_INVALID_PARAMETER; /* FileOpenExFlag not implemented yet. */ 1269 openInfo.mfOpenEx = fOpenEx; 1270 1271 return i_fileOpen(openInfo, pFile, prcGuest); 1272 } 1273 1274 int GuestSession::i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *prcGuest) 1275 { 1276 LogFlowThisFunc(("strFile=%s, enmAccessMode=0x%x, enmOpenAction=0x%x, uCreationMode=%RU32, mfOpenEx=%RU32\n", 1277 openInfo.mFileName.c_str(), openInfo.mAccessMode, openInfo.mOpenAction, openInfo.mCreationMode, 1278 openInfo.mfOpenEx)); 1256 1279 1257 1280 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 3427 3450 openInfo.mCreationMode = aCreationMode; 3428 3451 3429 /* convert + validate aAccessMode to the old format. */ 3430 openInfo.mAccessMode = aAccessMode; 3452 /* Validate aAccessMode. */ 3431 3453 switch (aAccessMode) 3432 3454 { 3433 case (FileAccessMode_T)FileAccessMode_ReadOnly: openInfo.mpszAccessMode = "r"; break; 3434 case (FileAccessMode_T)FileAccessMode_WriteOnly: openInfo.mpszAccessMode = "w"; break; 3435 case (FileAccessMode_T)FileAccessMode_ReadWrite: openInfo.mpszAccessMode = "r+"; break; 3455 case (FileAccessMode_T)FileAccessMode_ReadOnly: 3456 RT_FALL_THRU(); 3457 case (FileAccessMode_T)FileAccessMode_WriteOnly: 3458 RT_FALL_THRU(); 3459 case (FileAccessMode_T)FileAccessMode_ReadWrite: 3460 openInfo.mAccessMode = aAccessMode; 3461 break; 3436 3462 case (FileAccessMode_T)FileAccessMode_AppendOnly: 3437 3463 RT_FALL_THRU(); … … 3442 3468 } 3443 3469 3444 /* convert + validate aOpenAction to the old format. */ 3445 openInfo.mOpenAction = aOpenAction; 3470 /* Validate aOpenAction to the old format. */ 3446 3471 switch (aOpenAction) 3447 3472 { 3448 case (FileOpenAction_T)FileOpenAction_OpenExisting: openInfo.mpszOpenAction = "oe"; break; 3449 case (FileOpenAction_T)FileOpenAction_OpenOrCreate: openInfo.mpszOpenAction = "oc"; break; 3450 case (FileOpenAction_T)FileOpenAction_CreateNew: openInfo.mpszOpenAction = "ce"; break; 3451 case (FileOpenAction_T)FileOpenAction_CreateOrReplace: openInfo.mpszOpenAction = "ca"; break; 3452 case (FileOpenAction_T)FileOpenAction_OpenExistingTruncated: openInfo.mpszOpenAction = "ot"; break; 3473 case (FileOpenAction_T)FileOpenAction_OpenExisting: 3474 RT_FALL_THRU(); 3475 case (FileOpenAction_T)FileOpenAction_OpenOrCreate: 3476 RT_FALL_THRU(); 3477 case (FileOpenAction_T)FileOpenAction_CreateNew: 3478 RT_FALL_THRU(); 3479 case (FileOpenAction_T)FileOpenAction_CreateOrReplace: 3480 RT_FALL_THRU(); 3481 case (FileOpenAction_T)FileOpenAction_OpenExistingTruncated: 3482 RT_FALL_THRU(); 3453 3483 case (FileOpenAction_T)FileOpenAction_AppendOrCreate: 3454 openInfo.m pszOpenAction = "oa"; /** @todo get rid of this one and implement AppendOnly/AppendRead. */3484 openInfo.mOpenAction = aOpenAction; 3455 3485 break; 3456 3486 default: … … 3458 3488 } 3459 3489 3460 /* validate aSharingMode */ 3461 openInfo.mSharingMode = aSharingMode; 3490 /* Validate aSharingMode. */ 3462 3491 switch (aSharingMode) 3463 3492 { 3464 case (FileSharingMode_T)FileSharingMode_All: /* OK */ break; 3493 case (FileSharingMode_T)FileSharingMode_All: 3494 openInfo.mSharingMode = aSharingMode; 3495 break; 3465 3496 case (FileSharingMode_T)FileSharingMode_Read: 3466 3497 case (FileSharingMode_T)FileSharingMode_Write: … … 3485 3516 ComObjPtr <GuestFile> pFile; 3486 3517 int rcGuest; 3487 int vrc = i_fileOpen (openInfo, pFile, &rcGuest);3518 int vrc = i_fileOpenEx(aPath, aAccessMode, aOpenAction, aSharingMode, aCreationMode, aFlags, pFile, &rcGuest); 3488 3519 if (RT_SUCCESS(vrc)) 3489 3520 /* Return directory object to the caller. */
Note:
See TracChangeset
for help on using the changeset viewer.