Home | Info | Community | Development | myReactOS | Contact Us
[protected]
Definition at line 303 of file fatfs.cpp.
Referenced by read_directory().
{ int i; if (_cluster == 0) { if (!_drive._boot_sector.SectorsPerFAT) { // FAT32? [boot_sector32->reserved0==0] BootSector32* boot_sector32 = (BootSector32*) &_drive._boot_sector; DWORD sect = _drive._boot_sector.ReservedSectors + _drive._boot_sector.NumberFATs*boot_sector32->SectorsPerFAT32; // lese Root-Directory ein int RootEntries = boot_sector32->RootSectors * 32; //@@ _secarr = (struct dirsecz*)malloc(sizeof(DWORD) * (_cur_bufs = (int)((_ents=RootEntries)/_drive._bufents))); for(i=0; i<_cur_bufs; i++) _secarr->s[i] = sect+i; _dir = (struct dirent*)malloc((size_t)(_ents+16)*sizeof(union DEntry)); if (!_dir) return false; if (!(_drive.read_sector(*_secarr->s,(Buffer*)_dir,_cur_bufs))) return false; } else { DWORD sect = _drive._boot_sector.ReservedSectors + _drive._boot_sector.NumberFATs*_drive._boot_sector.SectorsPerFAT; // read in root directory _secarr = (struct dirsecz*)malloc(sizeof(DWORD) * (_cur_bufs = (int)((_ents=_drive._boot_sector.RootEntries)/_drive._bufents))); for(i=0; i<_cur_bufs; i++) _secarr->s[i] = sect+i; _dir = (struct dirent*)malloc((size_t)(_ents+16)*sizeof(union DEntry)); if (!_dir) return false; if (!_drive.read_sector(*_secarr->s,(Buffer*)_dir,_cur_bufs)) return false; } } else { Buffer* buf; bool ok; DWORD h = _cluster; _cur_bufs = 0; do { h = _drive.read_FAT(h, ok); if (!ok) return false; _cur_bufs++; } while (h<0x0ffffff0 && h); _secarr = (struct dirsecz*) malloc(sizeof(DWORD) * _cur_bufs); if (!_secarr) return false; _ents = _drive._bufents * (size_t)_cur_bufs * _drive._SClus; if ((buf=(Buffer*)(_dir=(struct dirent*)malloc((size_t) (_ents+16)*sizeof(union DEntry)))) == NULL) return false; h = _cluster; DWORD fdatsec; if (!_drive._boot_sector.SectorsPerFAT) { // FAT32 ? BootSector32* boot_sector32 = (BootSector32*) &_drive._boot_sector; //int RootEntries = boot_sector32->RootSectors * 32; //@@ //fdatsec = _drive._boot_sector.ReservedSectors + _drive._boot_sector.NumberFATs*boot_sector32->SectorsPerFAT32 + RootEntries*sizeof(DEntry)/_drive._boot_sector.BytesPerSector; // dpb.fdirsec fdatsec = _drive._boot_sector.ReservedSectors + _drive._boot_sector.NumberFATs*boot_sector32->SectorsPerFAT32 + boot_sector32->RootSectors; } else fdatsec = _drive._boot_sector.ReservedSectors + _drive._boot_sector.NumberFATs*_drive._boot_sector.SectorsPerFAT + _drive._boot_sector.RootEntries*sizeof(DEntry)/_drive._boot_sector.BytesPerSector; // dpb.fdirsec for(i=0; i<_cur_bufs; i++) { _secarr->s[i] = fdatsec + (DWORD)_drive._SClus*(h-2); h = _drive.read_FAT(h, ok); if (!ok) return false; } for(i=0; i<_cur_bufs; i++) { if ((ok = (_drive.read_sector(_secarr->s[i], buf, _drive._SClus))) == true) AddP(buf, _drive._bufl*_drive._SClus) else { //@@FPara = _secarr->s[i]; return false; } } buf->dat[0] = 0; // Endekennzeichen für Rekurs setzen } return true; }