VirtualBox

儲存庫 vbox 的更動 18128


忽略:
時間撮記:
2009-3-23 上午09:39:23 (16 年 以前)
作者:
vboxsync
訊息:

IPRT, Shared Folders: Implemented file attributes access flags for RTFileOpen on Windows host (xTracker #3739).

位置:
trunk
檔案:
修改 3 筆資料

圖例:

未更動
新增
刪除
  • trunk/include/iprt/file.h

    r16997 r18128  
    122122 */
    123123#define RTFILE_O_WRITE_THROUGH      0x00008000
     124
     125/** File attributes access, *CREATE* only.
     126 * @remark  This might not be implemented on all platforms,
     127 *          and will be ignored on those.
     128 */
     129/** Attributes can be read if the file is being opened
     130 * with read access, and can be written with write access.
     131 */
     132#define RTFILE_O_ACCESS_ATTR_DEFAULT 0x00000000
     133/** Attributes can be read. */
     134#define RTFILE_O_ACCESS_ATTR_READ   0x00010000
     135/** Attributes can be written. */
     136#define RTFILE_O_ACCESS_ATTR_WRITE  0x00020000
     137/** Attributes can be both read & written. */
     138#define RTFILE_O_ACCESS_ATTR_READWRITE 0x00030000
     139/** The file attributes access mask. */
     140#define RTFILE_O_ACCESS_ATTR_MASK   0x00030000
     141
    124142/** Unix file mode mask for use when creating files. */
    125143#define RTFILE_O_CREATE_MODE_MASK   0x1ff00000
     
    132150 * @remark  This doesn't validate the access mode properly.
    133151 */
    134 #define RTFILE_O_VALID_MASK          0x1ff0FB73
     152#define RTFILE_O_VALID_MASK          0x1ff3FB73
    135153
    136154/** @} */
  • trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp

    r16486 r18128  
    553553            fOpen |= RTFILE_O_READWRITE;
    554554            Log(("FLAG: SHFL_CF_ACCESS_READWRITE\n"));
     555            break;
     556        }
     557    }
     558
     559    switch (BIT_FLAG(fShflFlags, SHFL_CF_ACCESS_MASK_ATTR))
     560    {
     561        default:
     562        case SHFL_CF_ACCESS_ATTR_NONE:
     563        {
     564            fOpen |= RTFILE_O_ACCESS_ATTR_DEFAULT;
     565            Log(("FLAG: SHFL_CF_ACCESS_ATTR_NONE\n"));
     566            break;
     567        }
     568
     569        case SHFL_CF_ACCESS_ATTR_READ:
     570        {
     571            fOpen |= RTFILE_O_ACCESS_ATTR_READ;
     572            Log(("FLAG: SHFL_CF_ACCESS_ATTR_READ\n"));
     573            break;
     574        }
     575
     576        case SHFL_CF_ACCESS_ATTR_WRITE:
     577        {
     578            fOpen |= RTFILE_O_ACCESS_ATTR_WRITE;
     579            Log(("FLAG: SHFL_CF_ACCESS_ATTR_WRITE\n"));
     580            break;
     581        }
     582
     583        case SHFL_CF_ACCESS_ATTR_READWRITE:
     584        {
     585            fOpen |= RTFILE_O_ACCESS_ATTR_READWRITE;
     586            Log(("FLAG: SHFL_CF_ACCESS_ATTR_READWRITE\n"));
    555587            break;
    556588        }
  • trunk/src/VBox/Runtime/r3/win/fileio-win.cpp

    r16650 r18128  
    209209            return VERR_INVALID_PARAMETER;
    210210    }
     211
    211212    /* RTFileSetMode needs following rights as well. */
    212     dwDesiredAccess |= FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE;
     213    switch (fOpen & RTFILE_O_ACCESS_ATTR_MASK)
     214    {
     215        case RTFILE_O_ACCESS_ATTR_READ:      dwDesiredAccess |= FILE_READ_ATTRIBUTES | SYNCHRONIZE; break;
     216        case RTFILE_O_ACCESS_ATTR_WRITE:     dwDesiredAccess |= FILE_WRITE_ATTRIBUTES | SYNCHRONIZE; break;
     217        case RTFILE_O_ACCESS_ATTR_READWRITE: dwDesiredAccess |= FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE; break;
     218        default:
     219            /* Attributes access is the same as the file access. */
     220            switch (fOpen & RTFILE_O_ACCESS_MASK)
     221            {
     222                case RTFILE_O_READ:      dwDesiredAccess |= FILE_READ_ATTRIBUTES | SYNCHRONIZE; break;
     223                case RTFILE_O_WRITE:     dwDesiredAccess |= FILE_WRITE_ATTRIBUTES | SYNCHRONIZE; break;
     224                case RTFILE_O_READWRITE: dwDesiredAccess |= FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE; break;
     225                default:
     226                    AssertMsgFailed(("Impossible fOpen=%#x\n", fOpen));
     227                    return VERR_INVALID_PARAMETER;
     228            }
     229    }
    213230
    214231    DWORD dwShareMode;
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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