Changeset 69621 in vbox for trunk/src/VBox
- Timestamp:
- Nov 8, 2017 5:34:04 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/fs/fatvfs.cpp
r69619 r69621 1054 1054 PRTFSFATCHAIN pChain) 1055 1055 { 1056 RT_NOREF(pFatCache, pVol, idxCluster, pChain); 1057 return VERR_NOT_IMPLEMENTED; 1056 /* ASSUME that for FAT16 we cache the whole FAT in a single entry. That 1057 way we don't need to deal with entries in different sectors and whatnot. */ 1058 AssertReturn(pFatCache->cEntries == 1, VERR_INTERNAL_ERROR_4); 1059 AssertReturn(pFatCache->cbEntry == pVol->cbFat, VERR_INTERNAL_ERROR_4); 1060 AssertReturn(pFatCache->aEntries[0].offFat == 0, VERR_INTERNAL_ERROR_4); 1061 1062 /* Special case for empty files. */ 1063 if (idxCluster == 0) 1064 return VINF_SUCCESS; 1065 1066 /* Work cluster by cluster. */ 1067 uint8_t const *pbFat = pFatCache->aEntries[0].pbData; 1068 for (;;) 1069 { 1070 /* Validate the cluster, checking for end of file. */ 1071 if ( idxCluster >= pVol->cClusters 1072 || idxCluster < FAT_FIRST_DATA_CLUSTER) 1073 { 1074 if (idxCluster >= FAT_FIRST_FAT16_EOC) 1075 return VINF_SUCCESS; 1076 return VERR_VFS_BOGUS_OFFSET; 1077 } 1078 1079 /* Add cluster to chain. */ 1080 int rc = rtFsFatChain_Append(pChain, idxCluster); 1081 if (RT_FAILURE(rc)) 1082 return rc; 1083 1084 /* Next cluster. */ 1085 idxCluster = RT_MAKE_U16(pbFat[idxCluster * 2], pbFat[idxCluster * 2 + 1]); 1086 } 1058 1087 } 1059 1088 … … 3600 3629 else 3601 3630 rc = VERR_PATH_NOT_FOUND; 3631 LogFlow(("rtFsFatDir_TraversalOpen: %s -> %Rrc\n", pszEntry, rc)); 3602 3632 return rc; 3603 3633 } … … 4292 4322 pShared->fFullyBuffered = true; 4293 4323 } 4324 4325 /* DOS doesn't set a size on directores, so use the cluster length instead. */ 4326 if ( cbDir == 0 4327 && pShared->Core.Clusters.cbChain > 0) 4328 { 4329 cbDir = pShared->Core.Clusters.cbChain; 4330 pShared->Core.cbObject = cbDir; 4331 pShared->cEntries = cbDir / sizeof(FATDIRENTRY); 4332 if (pShared->fFullyBuffered) 4333 pShared->cbAllocatedForEntries = RT_ALIGN_32(cbDir, pThis->cbSector); 4334 } 4294 4335 } 4295 4336 } … … 5020 5061 pThis->idxMaxLastCluster = FAT_LAST_FAT12_DATA_CLUSTER; 5021 5062 pThis->idxEndOfChain = (pbFatSector[1] >> 4) | ((uint32_t)pbFatSector[2] << 4); 5022 idxOurEndOfChain = FAT_FIRST_FAT12_EOC ;5063 idxOurEndOfChain = FAT_FIRST_FAT12_EOC | 0xf; 5023 5064 break; 5024 5065 … … 5028 5069 pThis->idxMaxLastCluster = FAT_LAST_FAT16_DATA_CLUSTER; 5029 5070 pThis->idxEndOfChain = RT_MAKE_U16(pbFatSector[2], pbFatSector[3]); 5030 idxOurEndOfChain = FAT_FIRST_FAT16_EOC ;5071 idxOurEndOfChain = FAT_FIRST_FAT16_EOC | 0xf; 5031 5072 break; 5032 5073 … … 5038 5079 pThis->idxMaxLastCluster = FAT_LAST_FAT32_DATA_CLUSTER; 5039 5080 pThis->idxEndOfChain = RT_MAKE_U32_FROM_U8(pbFatSector[4], pbFatSector[5], pbFatSector[6], pbFatSector[7]); 5040 idxOurEndOfChain = FAT_FIRST_FAT32_EOC ;5081 idxOurEndOfChain = FAT_FIRST_FAT32_EOC | 0xf; 5041 5082 break; 5042 5083
Note:
See TracChangeset
for help on using the changeset viewer.