ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

static FF_ERROR FF_DetermineFatType ( FF_IOMAN pIoman) [static, private]

Definition at line 573 of file ff_ioman.c.

Referenced by FF_MountPartition().

                                                      {

    FF_PARTITION    *pPart;
    FF_BUFFER       *pBuffer;
    FF_T_UINT32     testLong;
    if(pIoman) {
        pPart = pIoman->pPartition;

        if(pPart->NumClusters < 4085) {
            // FAT12
            pPart->Type = FF_T_FAT12;
#ifdef FF_FAT_CHECK
#ifdef FF_FAT12_SUPPORT
            pBuffer = FF_GetBuffer(pIoman, pIoman->pPartition->FatBeginLBA, FF_MODE_READ);
            {
                if(!pBuffer) {
                    return FF_ERR_DEVICE_DRIVER_FAILED;
                }
                testLong = (FF_T_UINT32) FF_getShort(pBuffer->pBuffer, 0x0000);
            }
            FF_ReleaseBuffer(pIoman, pBuffer);
            if((testLong & 0x3FF) != 0x3F8) {
                return FF_ERR_IOMAN_NOT_FAT_FORMATTED;
            }
#else
            return FF_ERR_IOMAN_NOT_FAT_FORMATTED;
#endif
#endif
#ifdef FF_FAT12_SUPPORT
            return FF_ERR_NONE;
#endif

        } else if(pPart->NumClusters < 65525) {
            // FAT 16
            pPart->Type = FF_T_FAT16;
#ifdef FF_FAT_CHECK
            pBuffer = FF_GetBuffer(pIoman, pIoman->pPartition->FatBeginLBA, FF_MODE_READ);
            {
                if(!pBuffer) {
                    return FF_ERR_DEVICE_DRIVER_FAILED;
                }
                testLong = (FF_T_UINT32) FF_getShort(pBuffer->pBuffer, 0x0000);
            }
            FF_ReleaseBuffer(pIoman, pBuffer);
            if(testLong != 0xFFF8) {
                return FF_ERR_IOMAN_NOT_FAT_FORMATTED;
            }
#endif
            return FF_ERR_NONE;
        }
        else {
            // FAT 32!
            pPart->Type = FF_T_FAT32;
#ifdef FF_FAT_CHECK
            pBuffer = FF_GetBuffer(pIoman, pIoman->pPartition->FatBeginLBA, FF_MODE_READ);
            {
                if(!pBuffer) {
                    return FF_ERR_DEVICE_DRIVER_FAILED;
                }
                testLong = FF_getLong(pBuffer->pBuffer, 0x0000);
            }
            FF_ReleaseBuffer(pIoman, pBuffer);
            if((testLong & 0x0FFFFFF8) != 0x0FFFFFF8 && (testLong & 0x0FFFFFF8) != 0x0FFFFFF0) {
                return FF_ERR_IOMAN_NOT_FAT_FORMATTED;
            }
#endif
            return FF_ERR_NONE;
        }
    }

    return FF_ERR_IOMAN_NOT_FAT_FORMATTED;
}

Generated on Sun May 27 2012 06:00:51 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.