VirtualBox

Changeset 57500 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Aug 21, 2015 4:54:50 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
102287
Message:

DnD: Use a separate context for URI object when transferring, misc cleanups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp

    r57372 r57500  
    414414                    if (pszPathAbs)
    415415                    {
    416                         rc = RTDirCreate(pszPathAbs, (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRWXU, 0);
     416#ifdef RT_OS_WINDOWS
     417                        uint32_t fCreationMode = (fMode & RTFS_DOS_MASK) | RTFS_DOS_NT_NORMAL;
     418#else
     419                        uint32_t fCreationMode = (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRWXU;
     420#endif
     421                        rc = RTDirCreate(pszPathAbs, fCreationMode, 0);
    417422                        if (RT_SUCCESS(rc))
    418423                            rc = DnDDirDroppedAddDir(&dirDroppedFiles, pszPathAbs);
     
    455460                    if (   RT_SUCCESS(rc)
    456461                        && (   uNextMsg == DragAndDropSvc::HOST_DND_HG_SND_FILE_HDR
    457                              /* Protocol v1 always sends the file name, so try opening every time. */
     462                             /* Protocol v1 always sends the file name, so opening the file every time. */
    458463                            || pCtx->uProtocol <= 1)
    459464                       )
     
    465470                                         szPathName, cbPathName, fMode, cbFileSize));
    466471
    467                             uint64_t fOpen = RTFILE_O_WRITE | RTFILE_O_DENY_ALL;
     472                            uint64_t fOpen = RTFILE_O_WRITE | RTFILE_O_DENY_WRITE;
    468473                            if (pCtx->uProtocol <= 1)
    469474                                fOpen |= RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND;
     
    475480                            {
    476481                                RTCString strPathAbs(pszPathAbs);
    477                                 rc = objFile.OpenEx(strPathAbs, DnDURIObject::File, DnDURIObject::Target, fOpen,
    478                                                     (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR);
     482#ifdef RT_OS_WINDOWS
     483                                uint32_t fCreationMode = (fMode & RTFS_DOS_MASK) | RTFS_DOS_NT_NORMAL;
     484#else
     485                                uint32_t fCreationMode = (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR;
     486#endif
     487                                rc = objFile.OpenEx(strPathAbs, DnDURIObject::File, DnDURIObject::Target, fOpen, fCreationMode);
    479488                                if (RT_SUCCESS(rc))
    480489                                {
     
    927936            rc = VINF_PERMISSION_DENIED;
    928937
    929         /* Set the protocol version to use. */
    930         pCtx->uProtocol = 2;
    931 
    932         Assert(Info.u32ClientID);
    933         pCtx->uClientID = Info.u32ClientID;
     938        if (RT_SUCCESS(rc))
     939        {
     940            /* Set the protocol version to use. */
     941            pCtx->uProtocol = 2;
     942
     943            Assert(Info.u32ClientID);
     944            pCtx->uClientID = Info.u32ClientID;
     945        }
    934946    }
    935947
     
    941953         *       does not implement this command.
    942954         */
    943         DragAndDropSvc::VBOXDNDCONNECTPMSG Msg;
     955        DragAndDropSvc::VBOXDNDCONNECTMSG Msg;
    944956        RT_ZERO(Msg);
    945957        Msg.hdr.result      = VERR_WRONG_ORDER;
     
    11421154{
    11431155    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     1156    AssertReturn(uStatus > DragAndDropSvc::DND_PROGRESS_UNKNOWN, VERR_INVALID_PARAMETER);
    11441157
    11451158    DragAndDropSvc::VBOXDNDHGEVTPROGRESSMSG Msg;
     
    11471160    Msg.hdr.result      = VERR_WRONG_ORDER;
    11481161    Msg.hdr.u32ClientID = pCtx->uClientID;
    1149     Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_HG_EVT_PROGRESS;
     1162    Msg.hdr.u32Function = uStatus;
    11501163    Msg.hdr.cParms      = 3;
    11511164
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette