Changeset 79155 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Jun 14, 2019 4:33:05 PM (6 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/fs/fatvfs.cpp
r76553 r79155 1951 1951 pObj->offEntryInDir = offEntryInDir; 1952 1952 pObj->fAttrib = ((RTFMODE)pDirEntry->fAttrib << RTFS_DOS_SHIFT) & RTFS_DOS_MASK_OS2; 1953 pObj->fAttrib = rtFsModeFromDos(pObj->fAttrib, (char *)&pDirEntry->achName[0], sizeof(pDirEntry->achName), 0 );1953 pObj->fAttrib = rtFsModeFromDos(pObj->fAttrib, (char *)&pDirEntry->achName[0], sizeof(pDirEntry->achName), 0, 0); 1954 1954 pObj->cbObject = pDirEntry->cbFile; 1955 1955 pObj->fMaybeDirtyFat = false; -
trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
r77047 r79155 1322 1322 AssertReturn(pThis->uMagic == RTVFSOBJ_MAGIC, VERR_INVALID_HANDLE); 1323 1323 1324 fMode = rtFsModeNormalize(fMode, NULL, 0 );1324 fMode = rtFsModeNormalize(fMode, NULL, 0, 0); 1325 1325 if (!rtFsModeIsValid(fMode)) 1326 1326 return VERR_INVALID_PARAMETER; … … 2749 2749 AssertPtrNullReturn(phVfsDir, VERR_INVALID_POINTER); 2750 2750 AssertReturn(!(fFlags & ~RTDIRCREATE_FLAGS_VALID_MASK), VERR_INVALID_FLAGS); 2751 fMode = rtFsModeNormalize(fMode, pszRelPath, 0 );2751 fMode = rtFsModeNormalize(fMode, pszRelPath, 0, RTFS_TYPE_DIRECTORY); 2752 2752 AssertReturn(rtFsModeIsValidPermissions(fMode), VERR_INVALID_FMODE); 2753 2753 if (!(fFlags & RTDIRCREATE_FLAGS_NOT_CONTENT_INDEXED_DONT_SET)) … … 3302 3302 AssertReturn(pThis->uMagic == RTVFSSYMLINK_MAGIC, VERR_INVALID_HANDLE); 3303 3303 3304 fMode = rtFsModeNormalize(fMode, NULL, 0 );3304 fMode = rtFsModeNormalize(fMode, NULL, 0, RTFS_TYPE_SYMLINK); 3305 3305 if (!rtFsModeIsValid(fMode)) 3306 3306 return VERR_INVALID_PARAMETER; -
trunk/src/VBox/Runtime/generic/RTDirSetMode-generic.cpp
r78947 r79155 53 53 if (!rtDirValidHandle(hDir)) 54 54 return VERR_INVALID_PARAMETER; 55 56 /* Make sure we flag it as a directory so that it will be converted correctly: */ 57 if (!(fMode & RTFS_UNIX_MASK)) 58 fMode |= RTFS_DOS_DIRECTORY; 59 else if (!(fMode & RTFS_TYPE_MASK)) 60 fMode |= RTFS_TYPE_DIRECTORY; 61 55 62 return RTPathSetMode(hDir->pszPath, fMode); 56 63 } -
trunk/src/VBox/Runtime/include/internal/fs.h
r77754 r79155 44 44 #define RTFSMODE_SYMLINK_REPARSE_TAG UINT32_C(0xa000000c) 45 45 46 RTFMODE rtFsModeFromDos(RTFMODE fMode, const char *pszName, size_t cbName, uint32_t uReparseTag );47 RTFMODE rtFsModeFromUnix(RTFMODE fMode, const char *pszName, size_t cbName );48 RTFMODE rtFsModeNormalize(RTFMODE fMode, const char *pszName, size_t cbName );46 RTFMODE rtFsModeFromDos(RTFMODE fMode, const char *pszName, size_t cbName, uint32_t uReparseTag, RTFMODE fType); 47 RTFMODE rtFsModeFromUnix(RTFMODE fMode, const char *pszName, size_t cbName, RTFMODE fType); 48 RTFMODE rtFsModeNormalize(RTFMODE fMode, const char *pszName, size_t cbName, RTFMODE fType); 49 49 bool rtFsModeIsValid(RTFMODE fMode); 50 50 bool rtFsModeIsValidPermissions(RTFMODE fMode); -
trunk/src/VBox/Runtime/r3/fs.cpp
r78205 r79155 44 44 * Converts dos-style attributes to Unix attributes. 45 45 * 46 * @returns 46 * @returns Normalized mode mask. 47 47 * @param fMode The mode mask containing dos-style attributes only. 48 48 * @param pszName The filename which this applies to (exe check). 49 49 * @param cbName The length of that filename. (optional, set 0) 50 50 * @param uReparseTag The reparse tag if RTFS_DOS_NT_REPARSE_POINT is set. 51 */ 52 RTFMODE rtFsModeFromDos(RTFMODE fMode, const char *pszName, size_t cbName, uint32_t uReparseTag) 53 { 51 * @param fType RTFS_TYPE_XXX to normalize against, 0 if not known. 52 */ 53 RTFMODE rtFsModeFromDos(RTFMODE fMode, const char *pszName, size_t cbName, uint32_t uReparseTag, RTFMODE fType) 54 { 55 Assert(!(fType & ~RTFS_TYPE_MASK)); 56 54 57 fMode &= ~((1 << RTFS_DOS_SHIFT) - 1); 55 58 56 /* everything is readable. */ 59 /* Forcibly set the directory attribute if caller desires it. */ 60 if (fType == RTFS_TYPE_DIRECTORY) 61 fMode |= RTFS_DOS_DIRECTORY; 62 63 /* Everything is readable. */ 57 64 fMode |= RTFS_UNIX_IRUSR | RTFS_UNIX_IRGRP | RTFS_UNIX_IROTH; 58 65 if (fMode & RTFS_DOS_DIRECTORY) 59 /* directories are executable. */66 /* Directories are executable. */ 60 67 fMode |= RTFS_TYPE_DIRECTORY | RTFS_UNIX_IXUSR | RTFS_UNIX_IXGRP | RTFS_UNIX_IXOTH; 61 68 else … … 108 115 * @param pszName The filename which this applies to (hidden check). 109 116 * @param cbName The length of that filename. (optional, set 0) 110 */ 111 RTFMODE rtFsModeFromUnix(RTFMODE fMode, const char *pszName, size_t cbName) 112 { 117 * @param fType RTFS_TYPE_XXX to normalize against, 0 if not known. 118 */ 119 RTFMODE rtFsModeFromUnix(RTFMODE fMode, const char *pszName, size_t cbName, RTFMODE fType) 120 { 121 Assert(!(fType & ~RTFS_TYPE_MASK)); 113 122 NOREF(cbName); 114 123 115 124 fMode &= RTFS_UNIX_MASK; 125 126 if (!(fType & RTFS_TYPE_MASK) && fType) 127 fMode |= fType; 116 128 117 129 if (!(fMode & (RTFS_UNIX_IWUSR | RTFS_UNIX_IWGRP | RTFS_UNIX_IWOTH))) … … 142 154 * @param pszName The filename which this applies to (exe check). 143 155 * @param cbName The length of that filename. (optional, set 0) 144 */ 145 RTFMODE rtFsModeNormalize(RTFMODE fMode, const char *pszName, size_t cbName) 146 { 156 * @param fType RTFS_TYPE_XXX to normalize against, 0 if not known. 157 */ 158 RTFMODE rtFsModeNormalize(RTFMODE fMode, const char *pszName, size_t cbName, RTFMODE fType) 159 { 160 Assert(!(fType & ~RTFS_TYPE_MASK)); 161 147 162 if (!(fMode & RTFS_UNIX_MASK)) 148 fMode = rtFsModeFromDos(fMode, pszName, cbName, RTFSMODE_SYMLINK_REPARSE_TAG );163 fMode = rtFsModeFromDos(fMode, pszName, cbName, RTFSMODE_SYMLINK_REPARSE_TAG, fType); 149 164 else if (!(fMode & RTFS_DOS_MASK)) 150 fMode = rtFsModeFromUnix(fMode, pszName, cbName );165 fMode = rtFsModeFromUnix(fMode, pszName, cbName, fType); 151 166 else if (!(fMode & RTFS_TYPE_MASK)) 152 167 fMode |= fMode & RTFS_DOS_DIRECTORY ? RTFS_TYPE_DIRECTORY : RTFS_TYPE_FILE; -
trunk/src/VBox/Runtime/r3/nt/RTFileSetMode-r3-nt.cpp
r76553 r79155 76 76 HANDLE hNative = (HANDLE)RTFileToNative(hFile); 77 77 AssertReturn(hNative != RTNT_INVALID_HANDLE_VALUE, VERR_INVALID_HANDLE); 78 fMode = rtFsModeNormalize(fMode, NULL, 0 );78 fMode = rtFsModeNormalize(fMode, NULL, 0, RTFS_TYPE_FILE); 79 79 AssertReturn(rtFsModeIsValidPermissions(fMode), VERR_INVALID_FMODE); 80 80 -
trunk/src/VBox/Runtime/r3/nt/RTPathQueryInfo-nt.cpp
r76553 r79155 316 316 pObjInfo->Attr.fMode = rtFsModeFromDos( (pAllInfo->BasicInformation.FileAttributes << RTFS_DOS_SHIFT) 317 317 & RTFS_DOS_MASK_NT, 318 pszPath, pszPath ? strlen(pszPath) : 0, uReparseTag );318 pszPath, pszPath ? strlen(pszPath) : 0, uReparseTag, 0); 319 319 pObjInfo->Attr.enmAdditional = enmAddAttr; 320 320 if (enmAddAttr == RTFSOBJATTRADD_UNIX) … … 403 403 RTTimeSpecSetNtTime(&pObjInfo->ChangeTime, uBuf.NetOpenInfo.ChangeTime.QuadPart); 404 404 pObjInfo->Attr.fMode = rtFsModeFromDos((uBuf.NetOpenInfo.FileAttributes << RTFS_DOS_SHIFT) & RTFS_DOS_MASK_NT, 405 pszPath, strlen(pszPath), 0 /*uReparseTag*/ );405 pszPath, strlen(pszPath), 0 /*uReparseTag*/, 0); 406 406 pObjInfo->Attr.enmAdditional = enmAddAttr; 407 407 … … 585 585 586 586 pObjInfo->Attr.fMode = rtFsModeFromDos((uBuf.Both.FileAttributes << RTFS_DOS_SHIFT) & RTFS_DOS_MASK_NT, 587 pszPath, strlen(pszPath), uBuf.Both.EaSize );587 pszPath, strlen(pszPath), uBuf.Both.EaSize, 0); 588 588 589 589 pObjInfo->Attr.enmAdditional = enmAddAttr; -
trunk/src/VBox/Runtime/r3/nt/RTPathSetMode-r3-nt.cpp
r76553 r79155 41 41 RTDECL(int) RTPathSetMode(const char *pszPath, RTFMODE fMode) 42 42 { 43 fMode = rtFsModeNormalize(fMode, pszPath, 0 );43 fMode = rtFsModeNormalize(fMode, pszPath, 0, 0); 44 44 AssertReturn(rtFsModeIsValidPermissions(fMode), VERR_INVALID_FMODE); 45 45 -
trunk/src/VBox/Runtime/r3/nt/direnum-r3-nt.cpp
r78050 r79155 814 814 815 815 pDirEntry->Info.Attr.fMode = rtFsModeFromDos((pBoth->FileAttributes << RTFS_DOS_SHIFT) & RTFS_DOS_MASK_NT, 816 pszName, cchName, pBoth->EaSize );816 pszName, cchName, pBoth->EaSize, 0); 817 817 } 818 818 #ifdef IPRT_WITH_NT_PATH_PASSTHRU -
trunk/src/VBox/Runtime/r3/nt/dirrel-r3-nt.cpp
r78098 r79155 293 293 AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE); 294 294 AssertReturn(!(fCreate & ~RTDIRCREATE_FLAGS_VALID_MASK), VERR_INVALID_FLAGS); 295 fMode = rtFsModeNormalize(fMode, pszRelPath, 0 );295 fMode = rtFsModeNormalize(fMode, pszRelPath, 0, RTFS_TYPE_DIRECTORY); 296 296 AssertReturn(rtFsModeIsValidPermissions(fMode), VERR_INVALID_FMODE); 297 297 AssertPtrNullReturn(phSubDir, VERR_INVALID_POINTER); … … 491 491 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 492 492 AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE); 493 fMode = rtFsModeNormalize(fMode, pszRelPath, 0 );493 fMode = rtFsModeNormalize(fMode, pszRelPath, 0, 0); 494 494 AssertReturn(rtFsModeIsValidPermissions(fMode), VERR_INVALID_FMODE); 495 495 AssertMsgReturn(RTPATH_F_IS_VALID(fFlags, 0), ("%#x\n", fFlags), VERR_INVALID_FLAGS); -
trunk/src/VBox/Runtime/r3/posix/dir-posix.cpp
r78730 r79155 84 84 85 85 int rc; 86 fMode = rtFsModeNormalize(fMode, pszPath, 0 );86 fMode = rtFsModeNormalize(fMode, pszPath, 0, RTFS_TYPE_DIRECTORY); 87 87 if (rtFsModeIsValidPermissions(fMode)) 88 88 { -
trunk/src/VBox/Runtime/r3/posix/fileio-posix.cpp
r77684 r79155 819 819 * Normalize the mode and call the API. 820 820 */ 821 fMode = rtFsModeNormalize(fMode, NULL, 0 );821 fMode = rtFsModeNormalize(fMode, NULL, 0, RTFS_TYPE_FILE); 822 822 if (!rtFsModeIsValid(fMode)) 823 823 return VERR_INVALID_PARAMETER; -
trunk/src/VBox/Runtime/r3/posix/fs2-posix.cpp
r77754 r79155 132 132 Assert(RTFS_TYPE_MASK == S_IFMT); 133 133 134 pObjInfo->Attr.fMode = rtFsModeFromUnix(fMode, pszName, cbName );134 pObjInfo->Attr.fMode = rtFsModeFromUnix(fMode, pszName, cbName, 0); 135 135 136 136 /* additional unix attribs */ -
trunk/src/VBox/Runtime/r3/posix/path-posix.cpp
r78178 r79155 87 87 88 88 int rc; 89 fMode = rtFsModeNormalize(fMode, pszPath, 0 );89 fMode = rtFsModeNormalize(fMode, pszPath, 0, 0); 90 90 if (rtFsModeIsValidPermissions(fMode)) 91 91 { -
trunk/src/VBox/Runtime/r3/win/dir-win.cpp
r76553 r79155 51 51 */ 52 52 int rc; 53 fMode = rtFsModeNormalize(fMode, pszPath, 0 );53 fMode = rtFsModeNormalize(fMode, pszPath, 0, RTFS_TYPE_DIRECTORY); 54 54 if (rtFsModeIsValidPermissions(fMode)) 55 55 { -
trunk/src/VBox/Runtime/r3/win/direnum-win.cpp
r78050 r79155 345 345 346 346 pDirEntry->Info.Attr.fMode = rtFsModeFromDos((pDir->Data.dwFileAttributes << RTFS_DOS_SHIFT) & RTFS_DOS_MASK_NT, 347 pszName, cchName, pDir->Data.dwReserved0 );347 pszName, cchName, pDir->Data.dwReserved0, 0); 348 348 349 349 /* -
trunk/src/VBox/Runtime/r3/win/fileio-win.cpp
r77681 r79155 1038 1038 RT_ZERO(*pObjInfo); 1039 1039 pObjInfo->Attr.enmAdditional = enmAdditionalAttribs; 1040 pObjInfo->Attr.fMode = rtFsModeFromDos(RTFS_DOS_NT_DEVICE, "", 0, 0 );1040 pObjInfo->Attr.fMode = rtFsModeFromDos(RTFS_DOS_NT_DEVICE, "", 0, 0, 0); 1041 1041 return VINF_SUCCESS; 1042 1042 #else
Note:
See TracChangeset
for help on using the changeset viewer.