- Timestamp:
- Oct 9, 2018 11:50:22 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/GuestHost/DragAndDrop.h
r74577 r74714 149 149 DnDURIObject(Type type, 150 150 const RTCString &strSrcPathAbs = "", 151 const RTCString &strDstPathAbs = "", 152 uint32_t fMode = 0, uint64_t cbSize = 0); 151 const RTCString &strDstPathAbs = ""); 153 152 virtual ~DnDURIObject(void); 154 153 … … 169 168 const RTCString &GetDestPathAbs(void) const { return m_strTgtPathAbs; } 170 169 171 /** 172 * Returns the file mode of the object. 173 * 174 * Note: Only applies if the object is of type DnDURIObject::Type_File. 175 * 176 * @return File mode. 177 */ 178 uint32_t GetMode(void) const { AssertReturn(m_Type == Type_File, 0); return u.File.fMode; } 179 180 /** 181 * Returns the bytes already processed (read / written). 182 * 183 * Note: Only applies if the object is of type DnDURIObject::Type_File. 184 * 185 * @return Bytes already processed (read / written). 186 */ 187 uint64_t GetProcessed(void) const { AssertReturn(m_Type == Type_File, 0); return u.File.cbProcessed; } 188 189 /** 190 * Returns the file's size (in bytes). 191 * 192 * Note: Only applies if the object is of type DnDURIObject::Type_File. 193 * 194 * @return The file's size (in bytes). 195 */ 196 uint64_t GetSize(void) const { AssertReturn(m_Type == Type_File, 0); return u.File.cbSize; } 170 RTFMODE GetMode(void) const; 171 172 uint64_t GetProcessed(void) const; 173 174 uint64_t GetSize(void) const; 197 175 198 176 /** … … 201 179 * @return The object's type. 202 180 */ 203 Type GetType(void) const { return m_Type; } 204 205 public: 206 207 /** 208 * Sets the bytes to process by the object. 181 Type GetType(void) const { return m_enmType; } 182 183 /** 184 * Returns the object's view. 209 185 * 210 * Note: Only applies if the object is of type DnDURIObject::Type_File. 211 * 212 * @return IPRT return code. 213 * @param cbSize Size (in bytes) to process. 214 */ 215 int SetSize(uint64_t cbSize) { AssertReturn(m_Type == Type_File, 0); u.File.cbSize = cbSize; return VINF_SUCCESS; } 186 * @return The object's view. 187 */ 188 View GetView(void) const { return m_enmView; } 189 190 public: 191 192 int SetSize(uint64_t cbSize); 216 193 217 194 public: … … 220 197 bool IsComplete(void) const; 221 198 bool IsOpen(void) const; 222 int Open(View enmView, uint64_t fOpen, uint32_t fMode = 0); 223 int OpenEx(const RTCString &strPath, Type enmType, View enmView, uint64_t fOpen = 0, uint32_t fMode = 0, DNDURIOBJECTFLAGS = DNDURIOBJECT_FLAGS_NONE); 199 int Open(View enmView, uint64_t fOpen, RTFMODE fMode = 0); 200 int OpenEx(const RTCString &strPath, View enmView, uint64_t fOpen = 0, RTFMODE fMode = 0, DNDURIOBJECTFLAGS = DNDURIOBJECT_FLAGS_NONE); 201 int QueryInfo(View enmView); 224 202 int Read(void *pvBuf, size_t cbBuf, uint32_t *pcbRead); 225 203 void Reset(void); … … 233 211 234 212 void closeInternal(void); 213 int queryInfoInternal(View enmView); 235 214 236 215 protected: 237 216 238 217 /** The object's type. */ 239 Type m_Type; 218 Type m_enmType; 219 /** The object's view. */ 220 View m_enmView; 240 221 /** Absolute path (base) for the source. */ 241 222 RTCString m_strSrcPathAbs; … … 253 234 { 254 235 /** File handle. */ 255 RTFILE hFile;256 /** Used file mode. */257 uint32_t fMode;258 /** Size (in bytes) to read/write. */259 uint64_t cbSize;236 RTFILE hFile; 237 /** File system object information of this file. */ 238 RTFSOBJINFO objInfo; 239 /** Bytes to proces for reading/writing. */ 240 uint64_t cbToProcess; 260 241 /** Bytes processed reading/writing. */ 261 uint64_t cbProcessed;242 uint64_t cbProcessed; 262 243 } File; 244 struct 245 { 246 /** Directory handle. */ 247 RTDIR hDir; 248 /** File system object information of this directory. */ 249 RTFSOBJINFO objInfo; 250 } Dir; 263 251 } u; 264 252 }; -
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibDragAndDrop.cpp
r74574 r74714 510 510 uint32_t fCreationMode = (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR; 511 511 #endif 512 rc = objFile.OpenEx(strPathAbs, DnDURIObject:: Type_File, DnDURIObject::View_Target, fOpen, fCreationMode);512 rc = objFile.OpenEx(strPathAbs, DnDURIObject::View_Target, fOpen, fCreationMode); 513 513 if (RT_SUCCESS(rc)) 514 514 { -
trunk/src/VBox/GuestHost/DragAndDrop/DnDURIList.cpp
r74526 r74714 70 70 { 71 71 /** @todo Add a standard fOpen mode for this list. */ 72 rc = pObjFile->Open(DnDURIObject::View_Source, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE , objInfo.Attr.fMode);72 rc = pObjFile->Open(DnDURIObject::View_Source, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE); 73 73 } 74 else /* Just query the information without opening the file. */ 75 rc = pObjFile->QueryInfo(DnDURIObject::View_Source); 74 76 75 77 if (RT_SUCCESS(rc)) … … 90 92 LogFlowFunc(("Directory '%s' -> '%s' (file mode 0x%x)\n", pcszSource, pcszTarget, objInfo.Attr.fMode)); 91 93 92 DnDURIObject *pObjDir = new DnDURIObject(DnDURIObject::Type_Directory, pcszSource, pcszTarget, 93 objInfo.Attr.fMode, 0 /* Size */); 94 DnDURIObject *pObjDir = new DnDURIObject(DnDURIObject::Type_Directory, pcszSource, pcszTarget); 94 95 if (pObjDir) 95 96 { -
trunk/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp
r74673 r74714 37 37 38 38 DnDURIObject::DnDURIObject(void) 39 : m_Type(Type_Unknown) 39 : m_enmType(Type_Unknown) 40 , m_enmView(View_Unknown) 40 41 , m_fIsOpen(false) 41 42 { … … 45 46 DnDURIObject::DnDURIObject(Type enmType, 46 47 const RTCString &strSrcPathAbs /* = 0 */, 47 const RTCString &strDstPathAbs /* = 0 */ ,48 uint32_t fMode /* = 0 */, uint64_t cbSize /* = 0 */)49 : m_Type(enmType)48 const RTCString &strDstPathAbs /* = 0 */) 49 : m_enmType(enmType) 50 , m_enmView(View_Unknown) 50 51 , m_strSrcPathAbs(strSrcPathAbs) 51 52 , m_strTgtPathAbs(strDstPathAbs) … … 53 54 { 54 55 RT_ZERO(u); 55 56 switch (m_Type)57 {58 case Type_File:59 u.File.fMode = fMode;60 u.File.cbSize = cbSize;61 break;62 63 default:64 break;65 }66 56 } 67 57 … … 82 72 return; 83 73 84 switch (m_ Type)74 switch (m_enmType) 85 75 { 86 76 case Type_File: … … 88 78 RTFileClose(u.File.hFile); 89 79 u.File.hFile = NIL_RTFILE; 90 u.File.fMode = 0;80 RT_ZERO(u.File.objInfo); 91 81 break; 92 82 } 93 83 94 84 case Type_Directory: 95 break; 85 { 86 RTDirClose(u.Dir.hDir); 87 u.Dir.hDir = NIL_RTDIR; 88 RT_ZERO(u.Dir.objInfo); 89 break; 90 } 96 91 97 92 default: … … 112 107 113 108 /** 109 * Returns the directory / file mode of the object. 110 * 111 * @return File / directory mode. 112 */ 113 RTFMODE DnDURIObject::GetMode(void) const 114 { 115 switch (m_enmType) 116 { 117 case Type_File: 118 return u.File.objInfo.Attr.fMode; 119 120 case Type_Directory: 121 return u.Dir.objInfo.Attr.fMode; 122 123 default: 124 break; 125 } 126 127 AssertFailed(); 128 return 0; 129 } 130 131 /** 132 * Returns the bytes already processed (read / written). 133 * 134 * Note: Only applies if the object is of type DnDURIObject::Type_File. 135 * 136 * @return Bytes already processed (read / written). 137 */ 138 uint64_t DnDURIObject::GetProcessed(void) const 139 { 140 if (m_enmType == Type_File) 141 return u.File.cbProcessed; 142 143 return 0; 144 } 145 146 /** 147 * Returns the file's logical size (in bytes). 148 * 149 * Note: Only applies if the object is of type DnDURIObject::Type_File. 150 * 151 * @return The file's logical size (in bytes). 152 */ 153 uint64_t DnDURIObject::GetSize(void) const 154 { 155 if (m_enmType == Type_File) 156 return u.File.cbToProcess; 157 158 return 0; 159 } 160 161 /** 114 162 * Returns whether the processing of the object is complete or not. 115 163 * For file objects this means that all bytes have been processed. … … 121 169 bool fComplete; 122 170 123 switch (m_ Type)171 switch (m_enmType) 124 172 { 125 173 case Type_File: 126 Assert(u.File.cbProcessed <= u.File.cb Size);127 fComplete = u.File.cbProcessed == u.File.cb Size;174 Assert(u.File.cbProcessed <= u.File.cbToProcess); 175 fComplete = u.File.cbProcessed == u.File.cbToProcess; 128 176 break; 129 177 … … 154 202 * @param enmView View to use for opening the object. 155 203 * @param fOpen File open flags to use. 156 * @param fMode 157 * 158 * @remark 159 */ 160 int DnDURIObject::Open(View enmView, uint64_t fOpen /* = 0 */, uint32_t fMode /* = 0 */) 204 * @param fMode File mode to use. 205 */ 206 int DnDURIObject::Open(View enmView, uint64_t fOpen /* = 0 */, RTFMODE fMode /* = 0 */) 161 207 { 162 208 return OpenEx( enmView == View_Source 163 209 ? m_strSrcPathAbs : m_strTgtPathAbs 164 , m_Type, enmView, fOpen, fMode, 0 /* fFlags */);210 , enmView, fOpen, fMode, DNDURIOBJECT_FLAGS_NONE); 165 211 } 166 212 … … 170 216 * @return IPRT status code. 171 217 * @param strPathAbs Absolute path of the object (file / directory / ...). 172 * @param enmType Type of the object.173 218 * @param enmView View of the object. 174 219 * @param fOpen Open mode to use; only valid for file objects. … … 176 221 * @param fFlags Additional DnD URI object flags. 177 222 */ 178 int DnDURIObject::OpenEx(const RTCString &strPathAbs, Type enmType,View enmView,179 uint64_t fOpen /* = 0 */, uint32_tfMode /* = 0 */, DNDURIOBJECTFLAGS fFlags /* = DNDURIOBJECT_FLAGS_NONE */)223 int DnDURIObject::OpenEx(const RTCString &strPathAbs, View enmView, 224 uint64_t fOpen /* = 0 */, RTFMODE fMode /* = 0 */, DNDURIOBJECTFLAGS fFlags /* = DNDURIOBJECT_FLAGS_NONE */) 180 225 { 181 226 AssertReturn(!(fFlags & ~DNDURIOBJECT_FLAGS_VALID_MASK), VERR_INVALID_FLAGS); 182 227 RT_NOREF1(fFlags); 183 228 229 if (m_fIsOpen) 230 return VINF_SUCCESS; 231 184 232 int rc = VINF_SUCCESS; 185 233 … … 202 250 && fOpen) /* Opening mode specified? */ 203 251 { 204 LogFlowThisFunc(("strPath=%s, enm Type=%RU32, enmView=%RU32, fOpen=0x%x, fMode=0x%x, fFlags=0x%x\n",205 strPathAbs.c_str(), enm Type, enmView, fOpen, fMode, fFlags));206 switch ( enmType)252 LogFlowThisFunc(("strPath=%s, enmView=%RU32, fOpen=0x%x, fMode=0x%x, fFlags=0x%x\n", 253 strPathAbs.c_str(), enmView, fOpen, fMode, fFlags)); 254 switch (m_enmType) 207 255 { 208 256 case Type_File: 209 257 { 210 if (!m_fIsOpen) 258 /* 259 * Open files on the source with RTFILE_O_DENY_WRITE to prevent races 260 * where the OS writes to the file while the destination side transfers 261 * it over. 262 */ 263 LogFlowThisFunc(("Opening ...\n")); 264 rc = RTFileOpen(&u.File.hFile, strPathAbs.c_str(), fOpen); 265 if (RT_SUCCESS(rc)) 211 266 { 212 /* 213 * Open files on the source with RTFILE_O_DENY_WRITE to prevent races 214 * where the OS writes to the file while the destination side transfers 215 * it over. 216 */ 217 LogFlowThisFunc(("Opening ...\n")); 218 rc = RTFileOpen(&u.File.hFile, strPathAbs.c_str(), fOpen); 219 if (RT_SUCCESS(rc)) 220 rc = RTFileGetSize(u.File.hFile, &u.File.cbSize); 221 222 if (RT_SUCCESS(rc)) 267 if ( (fOpen & RTFILE_O_WRITE) /* Only set the file mode on write. */ 268 && fMode /* Some file mode to set specified? */) 223 269 { 224 if ( (fOpen & RTFILE_O_WRITE) /* Only set the file mode on write. */ 225 && fMode /* Some file mode to set specified? */) 226 { 227 rc = RTFileSetMode(u.File.hFile, fMode); 228 if (RT_SUCCESS(rc)) 229 u.File.fMode = fMode; 230 } 231 else if (fOpen & RTFILE_O_READ) 232 { 233 #if 0 /** @todo Enable this as soon as RTFileGetMode is implemented. */ 234 rc = RTFileGetMode(u.m_hFile, &m_fMode); 235 #else 236 RTFSOBJINFO ObjInfo; 237 rc = RTFileQueryInfo(u.File.hFile, &ObjInfo, RTFSOBJATTRADD_NOTHING); 238 if (RT_SUCCESS(rc)) 239 u.File.fMode = ObjInfo.Attr.fMode; 240 #endif 241 } 270 rc = RTFileSetMode(u.File.hFile, fMode); 242 271 } 243 244 if (RT_SUCCESS(rc)) 272 else if (fOpen & RTFILE_O_READ) 245 273 { 246 LogFlowThisFunc(("cbSize=%RU64, fMode=0x%x\n", u.File.cbSize, u.File.fMode)); 247 u.File.cbProcessed = 0; 274 rc = queryInfoInternal(enmView); 248 275 } 249 276 } 250 else 251 rc = VINF_SUCCESS; 277 278 if (RT_SUCCESS(rc)) 279 { 280 LogFlowThisFunc(("File cbObject=%RU64, fMode=0x%x\n", 281 u.File.objInfo.cbObject, u.File.objInfo.Attr.fMode)); 282 u.File.cbToProcess = u.File.objInfo.cbObject; 283 u.File.cbProcessed = 0; 284 } 252 285 253 286 break; … … 255 288 256 289 case Type_Directory: 257 rc = VINF_SUCCESS; 290 { 291 rc = RTDirOpen(&u.Dir.hDir, strPathAbs.c_str()); 292 if (RT_SUCCESS(rc)) 293 rc = queryInfoInternal(enmView); 258 294 break; 295 } 259 296 260 297 default: … … 266 303 if (RT_SUCCESS(rc)) 267 304 { 268 m_ Type = enmType;305 m_enmView = enmView; 269 306 m_fIsOpen = true; 270 307 } … … 272 309 LogFlowFuncLeaveRC(rc); 273 310 return rc; 311 } 312 313 /** 314 * Queries information about the object using a specific view, internal version. 315 * 316 * @return IPRT status code. 317 * @param enmView View to use for querying information. 318 */ 319 int DnDURIObject::queryInfoInternal(View enmView) 320 { 321 RT_NOREF(enmView); 322 323 int rc; 324 325 switch (m_enmType) 326 { 327 case Type_File: 328 rc = RTFileQueryInfo(u.File.hFile, &u.File.objInfo, RTFSOBJATTRADD_NOTHING); 329 break; 330 331 case Type_Directory: 332 rc = RTDirQueryInfo(u.Dir.hDir, &u.Dir.objInfo, RTFSOBJATTRADD_NOTHING); 333 break; 334 335 default: 336 rc = VERR_NOT_IMPLEMENTED; 337 break; 338 } 339 340 return rc; 341 } 342 343 /** 344 * Queries information about the object using a specific view. 345 * 346 * @return IPRT status code. 347 * @param enmView View to use for querying information. 348 */ 349 int DnDURIObject::QueryInfo(View enmView) 350 { 351 return queryInfoInternal(enmView); 274 352 } 275 353 … … 354 432 /* pcbRead is optional. */ 355 433 434 AssertMsgReturn(m_fIsOpen, ("Object not in open state\n"), VERR_INVALID_STATE); 435 AssertMsgReturn(m_enmView == View_Source, ("Cannot write to an object which is not in target view\n"), 436 VERR_INVALID_STATE); 437 356 438 size_t cbRead = 0; 357 439 358 440 int rc; 359 switch (m_ Type)441 switch (m_enmType) 360 442 { 361 443 case Type_File: 362 444 { 363 rc = OpenEx(m_strSrcPathAbs, Type_File, View_Source, 364 /* Use some sensible defaults. */ 365 RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE, 0 /* fFlags */); 445 rc = RTFileRead(u.File.hFile, pvBuf, cbBuf, &cbRead); 366 446 if (RT_SUCCESS(rc)) 367 447 { 368 rc = RTFileRead(u.File.hFile, pvBuf, cbBuf, &cbRead); 369 if (RT_SUCCESS(rc)) 448 u.File.cbProcessed += cbRead; 449 Assert(u.File.cbProcessed <= u.File.cbToProcess); 450 451 /* End of file reached or error occurred? */ 452 if ( u.File.cbToProcess 453 && u.File.cbProcessed == u.File.cbToProcess) 370 454 { 371 u.File.cbProcessed += cbRead; 372 Assert(u.File.cbProcessed <= u.File.cbSize); 373 374 /* End of file reached or error occurred? */ 375 if ( u.File.cbSize 376 && u.File.cbProcessed == u.File.cbSize) 377 { 378 rc = VINF_EOF; 379 } 455 rc = VINF_EOF; 380 456 } 381 457 } 382 383 458 break; 384 459 } … … 414 489 Close(); 415 490 416 m_Type = Type_Unknown; 491 m_enmType = Type_Unknown; 492 m_enmView = View_Unknown; 417 493 m_strSrcPathAbs = ""; 418 494 m_strTgtPathAbs = ""; 419 495 420 496 RT_ZERO(u); 497 } 498 499 /** 500 * Sets the bytes to process by the object. 501 * 502 * Note: Only applies if the object is of type DnDURIObject::Type_File. 503 * 504 * @return IPRT return code. 505 * @param cbSize Size (in bytes) to process. 506 */ 507 int DnDURIObject::SetSize(uint64_t cbSize) 508 { 509 AssertReturn(m_enmType == Type_File, VERR_INVALID_PARAMETER); 510 511 /** @todo Implement sparse file support here. */ 512 513 u.File.cbToProcess = cbSize; 514 return VINF_SUCCESS; 421 515 } 422 516 … … 435 529 /* pcbWritten is optional. */ 436 530 531 AssertMsgReturn(m_fIsOpen, ("Object not in open state\n"), VERR_INVALID_STATE); 532 AssertMsgReturn(m_enmView == View_Target, ("Cannot write to an object which is not in target view\n"), 533 VERR_INVALID_STATE); 534 437 535 size_t cbWritten = 0; 438 536 439 537 int rc; 440 switch (m_ Type)538 switch (m_enmType) 441 539 { 442 540 case Type_File: 443 541 { 444 rc = OpenEx(m_strTgtPathAbs, Type_File, View_Target, 445 /* Use some sensible defaults. */ 446 RTFILE_O_OPEN_CREATE | RTFILE_O_DENY_WRITE | RTFILE_O_WRITE, 0 /* fFlags */); 542 rc = RTFileWrite(u.File.hFile, pvBuf, cbBuf, &cbWritten); 447 543 if (RT_SUCCESS(rc)) 448 { 449 rc = RTFileWrite(u.File.hFile, pvBuf, cbBuf, &cbWritten); 450 if (RT_SUCCESS(rc)) 451 u.File.cbProcessed += cbWritten; 452 } 544 u.File.cbProcessed += cbWritten; 453 545 break; 454 546 } -
trunk/src/VBox/Main/include/GuestDnDPrivate.h
r74526 r74714 390 390 public: 391 391 392 int createIntermediate(DnDURIObject::Type enmType = DnDURIObject::Type_Unknown)392 int createIntermediate(DnDURIObject::Type enmType) 393 393 { 394 394 reset(); -
trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp
r74574 r74714 798 798 * Create new intermediate object to work with. 799 799 */ 800 rc = objCtx.createIntermediate( );800 rc = objCtx.createIntermediate(DnDURIObject::Type_File); 801 801 } 802 802 … … 824 824 } 825 825 826 LogRel2(("DnD: Absolute file path on the host now is'%s'\n", pszPathAbs));826 LogRel2(("DnD: Absolute file path for guest file on the host is now '%s'\n", pszPathAbs)); 827 827 828 828 /** @todo Add sparse file support based on fFlags? (Use Open(..., fFlags | SPARSE). */ 829 rc = pObj->OpenEx(pszPathAbs, DnDURIObject:: Type_File, DnDURIObject::View_Target,829 rc = pObj->OpenEx(pszPathAbs, DnDURIObject::View_Target, 830 830 RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_WRITE, 831 831 (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR); … … 836 836 AssertRC(rc2); 837 837 } 838 else 839 LogRel(("DnD: Error opening/creating guest file '%s' on host, rc=%Rrc\n", pszPathAbs, rc)); 838 840 } 839 841 … … 854 856 } 855 857 856 if (RT_FAILURE(rc))857 {858 LogRel2(("DnD: Error opening/creating guest file '%s' on host, rc=%Rrc\n",859 pObj->GetDestPathAbs().c_str(), rc));860 break;861 }862 863 858 } while (0); 859 860 if (RT_FAILURE(rc)) 861 LogRel(("DnD: Error receiving guest file header, rc=%Rrc\n", rc)); 864 862 865 863 LogFlowFuncLeaveRC(rc); … … 923 921 rc = updateProgress(&pCtx->mData, pCtx->mpResp, cbWritten); 924 922 } 925 else /* Something went wrong; close the object. */926 pObj->Close();923 else 924 LogRel(("DnD: Error writing guest file data for '%s', rc=%Rrc\n", pObj->GetDestPathAbs().c_str(), rc)); 927 925 928 926 if (RT_SUCCESS(rc)) … … 931 929 { 932 930 /** @todo Sanitize path. */ 933 LogRel2(("DnD: File transfer to host complete: %s\n", pObj->GetDestPathAbs().c_str()));931 LogRel2(("DnD: Transferring guest file '%s' to host complete\n", pObj->GetDestPathAbs().c_str())); 934 932 pCtx->mURI.processObject(*pObj); 935 933 objCtx.reset(); 936 934 } 937 935 } 938 else939 {940 /** @todo What to do when the host's disk is full? */941 LogRel(("DnD: Error writing guest file to host to '%s': %Rrc\n", pObj->GetDestPathAbs().c_str(), rc));942 }943 936 944 937 } while (0); 938 939 if (RT_FAILURE(rc)) 940 LogRel(("DnD: Error receiving guest file data, rc=%Rrc\n", rc)); 945 941 946 942 LogFlowFuncLeaveRC(rc); -
trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
r74574 r74714 910 910 return VERR_BUFFER_OVERFLOW; 911 911 912 LogRel2(("DnD: Transferring host directory to guest: %s\n", strPath.c_str()));912 LogRel2(("DnD: Transferring host directory '%s' to guest\n", strPath.c_str())); 913 913 914 914 pMsg->setType(HOST_DND_HG_SND_DIR); … … 943 943 if (!pObj->IsOpen()) 944 944 { 945 LogRel2(("DnD: Opening host file for transferring to guest: %s\n", strPathSrc.c_str()));946 rc = pObj->OpenEx(strPathSrc, DnDURIObject:: Type_File, DnDURIObject::View_Source,947 RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE , 0 /* fFlags */);945 LogRel2(("DnD: Opening host file '%s' for transferring to guest\n", strPathSrc.c_str())); 946 rc = pObj->OpenEx(strPathSrc, DnDURIObject::View_Source, 947 RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE); 948 948 if (RT_FAILURE(rc)) 949 LogRel(("DnD: Error opening host file '%s', rc=%Rrc\n", strPathSrc.c_str(), rc));949 LogRel(("DnD: Opening host file '%s' failed, rc=%Rrc\n", strPathSrc.c_str(), rc)); 950 950 } 951 951 … … 998 998 } 999 999 1000 if (RT_FAILURE(rc)) 1001 LogRel(("DnD: Sending host file to guest failed, rc=%Rrc\n", rc)); 1002 1000 1003 LogFlowFuncLeaveRC(rc); 1001 1004 return rc; … … 1063 1066 if (pObj->IsComplete()) /* Done reading? */ 1064 1067 { 1065 LogRel2(("DnD: File transfer to guest complete: %s\n", pObj->GetSourcePathAbs().c_str()));1068 LogRel2(("DnD: Transferring file '%s' to guest complete\n", pObj->GetSourcePathAbs().c_str())); 1066 1069 LogFlowFunc(("File '%s' complete\n", pObj->GetSourcePathAbs().c_str())); 1067 1070 … … 1071 1074 } 1072 1075 } 1076 1077 if (RT_FAILURE(rc)) 1078 LogRel(("DnD: Reading from host file '%s' failed, rc=%Rrc\n", pObj->GetSourcePathAbs().c_str(), rc)); 1073 1079 1074 1080 LogFlowFuncLeaveRC(rc); … … 1465 1471 AssertPtr(pCurObj); 1466 1472 1467 uint32_t fMode = pCurObj->GetMode();1468 LogRel3(("DnD: Processing: srcPath=%s, dstPath=%s, fMode=0x%x, cbSize=%RU32, fIsDir=%RTbool, fIsFile=%RTbool\n",1473 DnDURIObject::Type enmType = pCurObj->GetType(); 1474 LogRel3(("DnD: Processing: srcPath=%s, dstPath=%s, enmType=%RU32, cbSize=%RU32\n", 1469 1475 pCurObj->GetSourcePathAbs().c_str(), pCurObj->GetDestPathAbs().c_str(), 1470 fMode, pCurObj->GetSize(), 1471 RTFS_IS_DIRECTORY(fMode), RTFS_IS_FILE(fMode))); 1472 1473 if (RTFS_IS_DIRECTORY(fMode)) 1476 enmType, pCurObj->GetSize())); 1477 1478 if (enmType == DnDURIObject::Type_Directory) 1474 1479 { 1475 1480 rc = i_sendDirectory(pCtx, &objCtx, pMsg); 1476 1481 } 1477 else if ( RTFS_IS_FILE(fMode))1482 else if (DnDURIObject::Type_File) 1478 1483 { 1479 1484 rc = i_sendFile(pCtx, &objCtx, pMsg); … … 1481 1486 else 1482 1487 { 1483 AssertMsgFailed((" fMode=0x%xis not supported for srcPath=%s, dstPath=%s\n",1484 fMode, pCurObj->GetSourcePathAbs().c_str(), pCurObj->GetDestPathAbs().c_str()));1488 AssertMsgFailed(("enmType=%RU32 is not supported for srcPath=%s, dstPath=%s\n", 1489 enmType, pCurObj->GetSourcePathAbs().c_str(), pCurObj->GetDestPathAbs().c_str())); 1485 1490 rc = VERR_NOT_SUPPORTED; 1486 1491 }
Note:
See TracChangeset
for help on using the changeset viewer.