Changeset 288


Ignore:
Timestamp:
Jul 4, 2017, 4:41:30 AM (3 years ago)
Author:
Valery V. Sedletski
Message:

FORMAT: Make volumes formatted with our FORMAT, understandable by winxp exFAT driver.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ufat32/format.c

    r278 r288  
    702702        pEXFATBootSect->ulClusterCount = (ULONG)((dp.TotalSectors - dp.FatSize
    703703            - dp.ReservedSectCount) / dp.SectorsPerCluster);
    704         ulExfatBitmapLen = pEXFATBootSect->ulClusterCount / 8;
     704        ulExfatBitmapLen = (pEXFATBootSect->ulClusterCount / 8) +
     705           (pEXFATBootSect->ulClusterCount % 8 ? 1 : 0);
    705706        ulExfatBitmapClusters = ulExfatBitmapLen / (dp.SectorsPerCluster * dp.BytesPerSect);
    706707        ulExfatBitmapClusters = (ulExfatBitmapLen % (dp.SectorsPerCluster * dp.BytesPerSect)) ?
     
    710711        ulExfatUpCaseClusters = (ulExfatUpCaseLen % (dp.SectorsPerCluster * dp.BytesPerSect)) ?
    711712            ulExfatUpCaseClusters + 1 : ulExfatUpCaseClusters;
    712         pEXFATBootSect->RootDirStrtClus = 2 + ulExfatBitmapClusters + 1;
     713        pEXFATBootSect->RootDirStrtClus = 2 + ulExfatBitmapClusters + ulExfatUpCaseClusters;
    713714        pEXFATBootSect->ulVolSerial = VolumeId;
    714715        pEXFATBootSect->usFsRev = 0x0100;
     
    988989        pDir->u.UpCaseTbl.ulTblCheckSum = GetChkSum2((char *)pUpCase, ulExfatUpCaseLen);
    989990        //
    990         SectorStart += dp.SectorsPerCluster;
     991        SectorStart += ulExfatUpCaseClusters * dp.SectorsPerCluster;
    991992        write_sect ( hDevice, SectorStart, dp.BytesPerSect, pRootDir, dp.SectorsPerCluster );
    992993    }
Note: See TracChangeset for help on using the changeset viewer.