FAT12 Image Reader
Übersicht

FlorianBetreff: FAT12 Image Reader |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hallo
Mit LoadFat wird ein Image in Hauptspeicher eingelesen. FatInfo gibt infos über die FAT12, FAT16 und FAT32 aus. FATCopyFile DateiName1$, Dateiname2$ DateiName1$=Quelle Image DateiName2$=Ziel ListeFAT Gibt die alle Dateien in Verzeichnissen aus. EntpackFat Entpack alle Dateien. http://de.wikipedia.org/wiki/File_Allocation_Table FatFormat Übersicht über die Dateisysteme FAT, HPFS und NTFS NTFS im Vergleich mit FAT und FAT32 FAT32 [=url=http://mitarbeiter.fh-heilbronn.de/~meroth/MM/Speichermedien.pdf]Speichermedien[/url] Code: [AUSKLAPPEN] Const cDatei=1 Const cMem =2 Global FAT Global FATLog=WriteFile("FAT.TXT") Global OSName$ Global BytesPerSec Global SecPerClus Global RsvdSecCnt Global NumFats Global RootEntCnt Global TotSec Global MediaType Global FatSize Global SecPerTrack Global NumHeads Global HiddenSec Global TotSec32 Global DrvNum Global Reserved Global BootSig Global Laufwerksnummer Global FatSize32 Global RootBeginn32 Global VolmumeID Global VolumeLabel$ Global FileSysType$ Global RootDirSectors Global FatSektoren Global FatCluster Global FatType Global Datenbereich Global RootSektor Global FATSpeicher Const cBootSig=$29 Const cFat12 =1 Const cFat16 =2 Const cFat32 =3 Global Dir_Name$ Global Dir_Attribute Global DIR_NTRes Global DIR_CrtTimeTenth Global DIR_CrtTime Global DIR_CrtData Global DIR_LstAccData Global DIR_FstClusHi Global DIR_WrtTime Global DIR_WrtDate Global DIR_FstClusLo Global DIR_FileSize Const ATTR_READ_ONLY = $01 Const ATTR_HIDDEN = $02 Const ATTR_SYSTEM = $04 Const ATTR_VOLUME_ID = $08 Const ATTR_DIRECTORY = $10 Const ATTR_ARCHIVE = $20 Graphics 600,800,0,2 ;LoadFat "FD32.IMG" ;LoadFat "cdboot1.img" LoadFat "fdos1440.img" FatInfo ListeFAT ;FATCopyFile "BIOSINFO.INF","BIOSINFO.INF" WaitKey Function FATCopyFile(Dateiname1$,DateiName2$) If Suche(Dateiname1$)<>-2 Then If SaveFile(DateiName2$, DIR_FstClusLo, DIR_FileSize)=True Then FATLoging "Copy "+FileSysType$+":\"+Dateiname1$+", "+DateiName2$ Return True EndIf EndIf Return False End Function Function CloseFAT() End Function Function LoadFat(DateiName$) If FileType(DateiName$)<>cDatei Then Return False EndIf DateiLang=FileSize(DateiName$) FAT=CreateBank(DateiLang) FileNr=ReadFile(DateiName$) ReadBytes FAT,FileNr,0,DateiLang CloseFile FileNr FATSpeicher=cMem InstFat Return True End Function Function FATLOGING(S$="") If FATLOG<>0 Then WriteLine FATLOG, S$ EndIf End Function Function FatRead(DateiName$) FAT=ReadFile(DateiName$) ReadByte(FAT) ReadByte(FAT) ReadByte(FAT) OSName$=Chr$(ReadByte(FAT)) OSName$=OSName$+Chr$(ReadByte(FAT)) OSName$=OSName$+Chr$(ReadByte(FAT)) OSName$=OSName$+Chr$(ReadByte(FAT)) OSName$=OSName$+Chr$(ReadByte(FAT)) OSName$=OSName$+Chr$(ReadByte(FAT)) OSName$=OSName$+Chr$(ReadByte(FAT)) OSName$=OSName$+Chr$(ReadByte(FAT)) BytesPerSec =ReadShort(FAT) SecPerClus =ReadByte(FAT) RsvdSecCnt =ReadShort(FAT) NumFats =ReadByte(FAT) RootEntCnt =ReadShort(FAT) TotSec =ReadShort(FAT) MediaType =ReadByte(FAT) FatSize =ReadShort(FAT) SecPerTrack =ReadShort(FAT) NumHeads =ReadShort(FAT) HiddenSec =ReadInt(FAT) TotSec32 =ReadInt(FAT) If TotSec32<>0 Then FatSize32 =ReadInt(FAT) Rsvd =ReadByte(FAT) FATVERH =ReadByte(FAT) FATVERN =ReadShort(FAT) RootBeginn32=ReadInt(FAT) FSINFO_FELD =ReadShort(FAT) KVBR =ReadShort(FAT) Reserviert$=Chr$(ReadByte(FAT)) Reserviert$=Reserviert$+Chr$(ReadByte(FAT)) Reserviert$=Reserviert$+Chr$(ReadByte(FAT)) Reserviert$=Reserviert$+Chr$(ReadByte(FAT)) Reserviert$=Reserviert$+Chr$(ReadByte(FAT)) Reserviert$=Reserviert$+Chr$(ReadByte(FAT)) Reserviert$=Reserviert$+Chr$(ReadByte(FAT)) Reserviert$=Reserviert$+Chr$(ReadByte(FAT)) Reserviert$=Reserviert$+Chr$(ReadByte(FAT)) Reserviert$=Reserviert$+Chr$(ReadByte(FAT)) Reserviert$=Reserviert$+Chr$(ReadByte(FAT)) Reserviert$=Reserviert$+Chr$(ReadByte(FAT)) Laufwerksnummer=ReadByte(FAT) Reserviert=ReadByte(FAT) BootSig32 =ReadByte(FAT) VolmumeID =ReadInt(FAT) VolumeLabel$=Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=Mid$(VolumeLabel$,1,Instr(VolumeLabel$+Chr$(0),Chr$(0))-1) FileSysType$=Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=Trim$(FileSysType$) FatType=cFat32 Else DrvNum =ReadByte(FAT) Reserved =ReadByte(FAT) BootSig =ReadByte(FAT) If BootSig=cBootSig Then VolmumeID =ReadInt(FAT) VolumeLabel$=Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) VolumeLabel$=VolumeLabel$+Chr$(ReadByte(FAT)) FileSysType$=Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=FileSysType$+Chr$(ReadByte(FAT)) FileSysType$=Trim$(FileSysType$) Else VolmumeID=0 VolumeLabel$="" FileSysType$="" EndIf RootDirSectors=RootEntCnt/(BytesPerSec/32) FatSektoren=TotSec-RsvdSecCnt-(NumFats*FatSize)-RootDirSectors FatCluster=FatSektoren/SecPerClus If FatCluster<4085 Then FatType=cFat12 RootSektor=BytesPerSec*(RsvdSecCnt+NumFats*FatSize) Datenbereich= RootSektor+RootDirSectors*BytesPerSec ElseIf FatCluster<65525 Then FatType=cFat16 Else FatType=cFat32 EndIf EndIf FATSpeicher=cDatei Return True End Function Function InstFat() OSName$=Chr$(PeekByte(FAT, 3)) OSName$=OSName$+Chr$(PeekByte(FAT, 4)) OSName$=OSName$+Chr$(PeekByte(FAT, 5)) OSName$=OSName$+Chr$(PeekByte(FAT, 6)) OSName$=OSName$+Chr$(PeekByte(FAT, 7)) OSName$=OSName$+Chr$(PeekByte(FAT, 8)) OSName$=OSName$+Chr$(PeekByte(FAT ,9)) OSName$=OSName$+Chr$(PeekByte(FAT,10)) BytesPerSec =PeekShort(FAT,11) SecPerClus =PeekByte (FAT,13) RsvdSecCnt =PeekShort(FAT,14) NumFats =PeekByte (FAT,16) RootEntCnt =PeekShort(FAT,17) TotSec =PeekShort(FAT,19) MediaType =PeekByte (FAT,21) FatSize =PeekShort(FAT,22) SecPerTrack =PeekShort(FAT,24) NumHeads =PeekShort(FAT,26) HiddenSec =PeekInt (FAT,28) TotSec32 =PeekInt (FAT,32) If TotSec32<>0 Then FatSize32 =PeekInt(FAT,36) Rsvd =PeekByte(FAT,40) FATVERH =PeekByte(FAT,41) FATVERN =PeekShort(FAT,42) RootBeginn32=PeekInt(FAT,44) FSINFO_FELD =PeekShort(FAT,48) KVBR =PeekShort(FAT,50) Else DrvNum =PeekByte (FAT,36) Reserved =PeekByte (FAT,37) BootSig =PeekByte (FAT,38) If BootSig=cBootSig Then VolmumeID =PeekInt(FAT,39) VolumeLabel$=Chr$(PeekByte(FAT,43)) VolumeLabel$=VolumeLabel$+Chr$(PeekByte(FAT,44)) VolumeLabel$=VolumeLabel$+Chr$(PeekByte(FAT,45)) VolumeLabel$=VolumeLabel$+Chr$(PeekByte(FAT,46)) VolumeLabel$=VolumeLabel$+Chr$(PeekByte(FAT,47)) VolumeLabel$=VolumeLabel$+Chr$(PeekByte(FAT,48)) VolumeLabel$=VolumeLabel$+Chr$(PeekByte(FAT,49)) VolumeLabel$=VolumeLabel$+Chr$(PeekByte(FAT,50)) VolumeLabel$=VolumeLabel$+Chr$(PeekByte(FAT,51)) VolumeLabel$=VolumeLabel$+Chr$(PeekByte(FAT,52)) VolumeLabel$=VolumeLabel$+Chr$(PeekByte(FAT,53)) FileSysType$=Chr$(PeekByte(FAT,54)) FileSysType$=FileSysType$+Chr$(PeekByte(FAT,55)) FileSysType$=FileSysType$+Chr$(PeekByte(FAT,56)) FileSysType$=FileSysType$+Chr$(PeekByte(FAT,57)) FileSysType$=FileSysType$+Chr$(PeekByte(FAT,58)) FileSysType$=FileSysType$+Chr$(PeekByte(FAT,59)) FileSysType$=FileSysType$+Chr$(PeekByte(FAT,60)) FileSysType$=FileSysType$+Chr$(PeekByte(FAT,61)) FileSysType$=Trim$(FileSysType$) Else VolmumeID=0 VolumeLabel$="" FileSysType$="" EndIf RootDirSectors=RootEntCnt/(BytesPerSec/32) FatSektoren=TotSec-RsvdSecCnt-(NumFats*FatSize)-RootDirSectors FatCluster=FatSektoren/SecPerClus If FatCluster<4085 Then FatType=cFat12 RootSektor=BytesPerSec*(RsvdSecCnt+NumFats*FatSize) Datenbereich= RootSektor+RootDirSectors*BytesPerSec ElseIf FatCluster<65525 Then FatType=cFat16 Else FatType=cFat32 EndIf EndIf End Function Function FatInfo() Print "OSName : "+OSName$ FATLOGING "OSName : "+OSName$ Print "BytesPerSec: "+BytesPerSec FATLOGING "BytesPerSec: "+BytesPerSec Print "SecPerClus : "+SecPerClus FATLOGING "SecPerClus : "+SecPerClus Print "RsvdSecCnt : "+RsvdSecCnt FATLOGING "RsvdSecCnt : "+RsvdSecCnt Print "NumFats : "+NumFats FATLOGING "NumFats : "+NumFats If TotSec32=0 Then Print "RootEntCnt : "+RootEntCnt FATLOGING "RootEntCnt : "+RootEntCnt Print "TotSec : "+TotSec FATLOGING "TotSec : "+TotSec Else Print "RootBeginn32: "+RootBeginn32 FATLOGING "RootBeginn32: "+RootBeginn32 EndIf Select MediaType Case $F0 If TotSec=2880 Then Print "MediaType : 1.44 MB 3.5-inch, 2-sided, 18-sector" FATLOGING "MediaType : 1.44 MB 3.5-inch, 2-sided, 18-sector" Else Print "MediaType : 2.88 MB 3.5-inch, 2-sided, 36-sector" FATLOGING "MediaType : 2.88 MB 3.5-inch, 2-sided, 36-sector" EndIf Case $F9 Print "MediaType : 720 KB 3.5-inch, 2-sided, 9-sector" FATLOGING "MediaType : 720 KB 3.5-inch, 2-sided, 9-sector" Case $F9 Print "MediaType : 1.2 MB 5.25-inch, 2-sided, 15-sector" FATLOGING "MediaType : 1.2 MB 5.25-inch, 2-sided, 15-sector" Case $FD Print "MediaType : 360 KB 5.25-inch, 2-sided, 9-sector" FATLOGING "MediaType : 360 KB 5.25-inch, 2-sided, 9-sector" Case $FF Print "MediaType : 320 KB 5.25-inch, 2-sided, 8-sector" FATLOGING "MediaType : 320 KB 5.25-inch, 2-sided, 8-sector" Case $FC Print "MediaType : 180 KB 5.25-inch, 1-sided, 9-sector" FATLOGING "MediaType : 180 KB 5.25-inch, 1-sided, 9-sector" Case $FE Print "MediaType : 160 KB 5.25-inch, 1-sided, 8-sector" FATLOGING "MediaType : 160 KB 5.25-inch, 1-sided, 8-sector" Case $F8 Print "MediaType : Festplatte" FATLOGING "MediaType : Festplatte" Default Print "MediaType : "+MediaType FATLOGING "MediaType : "+MediaType End Select If TotSec32=0 Then Print "FatSize : "+FatSize FATLOGING "FatSize : "+FatSize Else Print "FatSize32 : "+FatSize32 FATLOGING "FatSize32 : "+FatSize32 EndIf Print "SecPerTrack: "+SecPerTrack FATLOGING "SecPerTrack: "+SecPerTrack Print "NumHeads : "+NumHeads FATLOGING "NumHeads : "+NumHeads If HiddenSec<>0 Then Print "HiddenSec : "+HiddenSec FATLOGING "HiddenSec : "+HiddenSec EndIf If TotSec32<>0 Then Print "TotSec32 : "+TotSec32 FATLOGING "TotSec32 : "+TotSec32 Print "Laufwerksnummer: "+Laufwerksnummer FATLOGING "Laufwerksnummer: "+Laufwerksnummer EndIf If TotSec32=0 Then Print "DrvNum : "+DrvNum FATLOGING "DrvNum : "+DrvNum Print "Reserved : "+Reserved FATLOGING "Reserved : "+Reserved EndIf If TotSec32=0 Then Print "BootSig : "+BootSig FATLOGING "BootSig : "+BootSig EndIf Print "VolmumeID : "+VolmumeID FATLOGING "VolmumeID : "+VolmumeID Print "VolumeLabel: "+VolumeLabel$ FATLOGING "VolumeLabel: "+VolumeLabel$ Print "FileSysType: "+FileSysType$ FATLOGING "FileSysType: "+FileSysType$ Print "FatType : "+FatType FATLOGING "FatType : "+FatType FATLOGING End Function Function FatReadRoot(Pos) Dir_Attribute= PeekByte(FAT,Pos+11) Dir_Name$=Chr$(PeekByte(FAT,Pos)) Dir_Name$=Dir_Name$+Chr$(PeekByte(FAT,Pos+1)) Dir_Name$=Dir_Name$+Chr$(PeekByte(FAT,Pos+2)) Dir_Name$=Dir_Name$+Chr$(PeekByte(FAT,Pos+3)) Dir_Name$=Dir_Name$+Chr$(PeekByte(FAT,Pos+4)) Dir_Name$=Dir_Name$+Chr$(PeekByte(FAT,Pos+5)) Dir_Name$=Dir_Name$+Chr$(PeekByte(FAT,Pos+6)) Dir_Name$=Dir_Name$+Chr$(PeekByte(FAT,Pos+7)) If Not(Dir_Attribute And ATTR_VOLUME_ID) Then Dir_Name$=Trim$(Dir_Name$)+"." EndIf Dir_Name$=Dir_Name$+Chr$(PeekByte(FAT,Pos+8)) Dir_Name$=Dir_Name$+Chr$(PeekByte(FAT,Pos+9)) Dir_Name$=Dir_Name$+Chr$(PeekByte(FAT,Pos+10)) Dir_Name$=Trim$(Dir_Name$) If Right$(Dir_Name$,1)="." Then Dir_Name$=Left$(Dir_Name$,Instr(Dir_Name$,".")-1) DIR_NTRes =PeekByte (FAT,Pos+12) DIR_CrtTimeTenth=PeekByte (FAT,Pos+13) DIR_CrtTime =PeekShort(FAT,Pos+14) DIR_CrtData =PeekShort(FAT,Pos+16) DIR_LstAccData =PeekShort(FAT,Pos+18) DIR_FstClusHi =PeekShort(FAT,Pos+20) DIR_WrtTime =PeekShort(FAT,Pos+22) DIR_WrtDate =PeekShort(FAT,Pos+24) DIR_FstClusLo =PeekShort(FAT,Pos+26) DIR_FileSize =PeekInt (FAT,Pos+28) End Function Function ListeFAT(FatEintrag=-1,Dir$="") If FatEintrag=-1 Then For Nr=0 To RootEntCnt-1 Pos=RootSektor+Nr*32 FatReadRoot Pos If Not(Dir_Attribute And ATTR_DIRECTORY) Then If Not(Dir_Attribute And ATTR_VOLUME_ID) Then If Len(Dir_Name$)>0 Then If DIR_FileSize=>0 Then If Mid$(Dir_Name$,1,1)<>Chr$(229) Then If DIR_FstClusLo>0 Then FATLOGING Datei_Info$(Dir$) Print Datei_Info$(Dir$) EndIf EndIf EndIf EndIf EndIf Else ListeFAT DIR_FstClusLo,Dir$+Dir_Name$+"\" EndIf Next FATLOGING Else While FatEintrag<>$0FFF SektorPos=Datenbereich+(BytesPerSec*SecPerClus*(FatEintrag-2)) For Nr=0 To 15 FatReadRoot SektorPos+Nr*32 If Not(Dir_Attribute And ATTR_DIRECTORY) Then If Len(Dir_Name$)>0 Then If Not(Dir_Attribute And ATTR_VOLUME_ID) Then If DIR_FileSize=>0 Then If Mid$(Dir_Name$,1,1)<>Chr$(229) Then If DIR_FstClusLo>0 Then FATLOGING Datei_Info$(Dir$) Print Datei_Info$(Dir$) EndIf EndIf EndIf EndIf EndIf EndIf Next FatEintrag=GetFAT(FatEintrag) Wend EndIf End Function Function EntpackFat(FatEintrag=-1,Dir$="") If FatEintrag=-1 Then For Nr=0 To RootEntCnt-1 Pos=RootSektor+Nr*32 FatReadRoot Pos If Not(Dir_Attribute And ATTR_DIRECTORY) Then If Not(Dir_Attribute And ATTR_VOLUME_ID) Then If DIR_FileSize=>0 Then If Mid$(Dir_Name$,1,1)<>Chr$(229) Then If Len(Dir_Name$)>0 Then SaveFile Dir$+Dir_Name$,DIR_FstClusLo,DIR_FileSize EndIf EndIf EndIf EndIf Else CreateDir Dir$+Dir_Name$ EntpackFat DIR_FstClusLo,Dir$+Dir_Name$+"\" EndIf Next Else While FatEintrag<>$0FFF SektorPos=Datenbereich+(BytesPerSec*SecPerClus*(FatEintrag-2)) For Nr=0 To 15 FatReadRoot SektorPos+Nr*32 If Not(Dir_Attribute And ATTR_DIRECTORY) Then If Not(Dir_Attribute And ATTR_VOLUME_ID) Then If DIR_FileSize=>0 Then If Mid$(Dir_Name$,1,1)<>Chr$(229) Then If Len(Dir_Name$)>0 Then SaveFile Dir$+Dir_Name$,DIR_FstClusLo,DIR_FileSize EndIf EndIf EndIf EndIf EndIf Next FatEintrag=GetFAT(FatEintrag) Wend EndIf End Function Function IsDatei() If Dir_Attribute And ATTR_VOLUME_ID Then Return False If Dir_Attribute And ATTR_DIRECTORY Then Return False Return True End Function Function Datei_Info$(Dir$="",Option=1) If Dir_Attribute And ATTR_READ_ONLY Then ATTR_NAME$=ATTR_NAME$+"R" If Dir_Attribute And ATTR_SYSTEM Then ATTR_NAME$=ATTR_NAME$+"S" If Dir_Attribute And ATTR_HIDDEN Then ATTR_NAME$=ATTR_NAME$+"H" If Dir_Attribute And ATTR_VOLUME_ID Then ATTR_NAME$=ATTR_NAME$+"V" If Dir_Attribute And ATTR_DIRECTORY Then ATTR_NAME$=ATTR_NAME$+"D" If Dir_Attribute And ATTR_ARCHIVE Then ATTR_NAME$=ATTR_NAME$+"A" FileTyp$=Lower$(Right$(Dir_Name$,3)) Select Option Case 1 Return Dir$+Dir_Name$+String$(" ",25-Len(Dir$+Dir_Name$))+DIR_FileSize+ String$(" ",8-Len(DIR_FileSize))+"Bytes" Default Return Dir$+Dir_Name$+String$(" ",25-Len(Dir$+Dir_Name$))+DIR_FileSize+String$(" ",8-Len(DIR_FileSize))+ATTR_NAME$+String$(" ",6-Len(ATTR_NAME$))+DIR_FstClusLo End Select End Function Function GetFAT(Pos) offset=((Pos)*3)/2+(BytesPerSec*RsvdSecCnt) mode =((Pos) And 1)*4 value =(PeekShort(FAT,offset) Shr mode) And 4095 Return value End Function Function Suche(Dateiname$,FatEintrag=-1) Dateiname$=Lower$(Dateiname$) If Instr(Dateiname$,"\") Then Ordner$=Mid$(Dateiname$,1,Instr(Dateiname$,"\")-1) Dateiname$=Mid$(Dateiname$,Instr(Dateiname$,"\")+1) EndIf If FatEintrag=-1 Then For Nr=0 To RootEntCnt-1 Pos=RootSektor+Nr*32 FatReadRoot Pos If Not(Dir_Attribute And ATTR_DIRECTORY) Then If Not(Dir_Attribute And ATTR_VOLUME_ID) Then If Len(Ordner$)=0 Then If Lower$(Dir_Name$)=Dateiname$ Then Return DIR_FstClusLo EndIf EndIf EndIf Else If Lower$(Dir_Name$)=Ordner$ Then If Len(Dateiname$)>0 Then Return Suche(Dateiname$,DIR_FstClusLo) Else Return DIR_FstClusLo EndIf EndIf EndIf Next Else While FatEintrag<>$0FFF SektorPos=Datenbereich+(BytesPerSec*SecPerClus*(FatEintrag-2)) For Nr=0 To 15 FatReadRoot SektorPos+Nr*32 If Not(Dir_Attribute And ATTR_DIRECTORY) Then If Not(Dir_Attribute And ATTR_VOLUME_ID) Then If Len(Ordner$)=0 Then If Lower$(Dir_Name$)=Dateiname$ Then Return DIR_FstClusLo EndIf EndIf EndIf Else If Len(Dir_Name$)>0 And Lower$(Dir_Name$)=Ordner$ Then If Len(Ordner$)>0 Then Return Suche(Dateiname$,DIR_FstClusLo) Else Return DIR_FstClusLo EndIf EndIf EndIf Next FatEintrag=GetFAT(FatEintrag) Wend EndIf Return -2 End Function Function SaveFile(DateiName$,FatEintrag,Lang) FileNr=WriteFile(DateiName$) If FileNr=0 Then Return False While FatEintrag<>$0FFF If Lang-Geschrieben<BytesPerSec*SecPerClus Then WriteBytes FAT,FileNr, Datenbereich+(BytesPerSec*SecPerClus*(FatEintrag-2)),Lang-Geschrieben Else WriteBytes FAT,FileNr, Datenbereich+(BytesPerSec*SecPerClus*(FatEintrag-2)),BytesPerSec*SecPerClus Geschrieben=Geschrieben+BytesPerSec*SecPerClus EndIf FatEintrag=GetFAT(FatEintrag) Wend CloseFile FileNr Return True End Function Function SaveFileInBank(FatEintrag,Lang) BankNr=CreateBank(Lang) If BankNr=0 Then Return False While FatEintrag<>$0FFF If Lang-Geschrieben<BytesPerSec*SecPerClus Then CopyBank FAT,Datenbereich+(BytesPerSec*SecPerClus*(FatEintrag-2)),BankNr,Geschrieben,Lang-Geschrieben Else CopyBank FAT,Datenbereich+(BytesPerSec*SecPerClus*(FatEintrag-2)),BankNr,Geschrieben,BytesPerSec*SecPerClus Geschrieben=Geschrieben+BytesPerSec*SecPerClus EndIf FatEintrag=GetFAT(FatEintrag) Wend Return BankNr End Function Function SaveBank(Bank,DateiName$) FileNr=WriteFile(DateiName$) If FileNr=0 Then Return False WriteBytes Bank,FileNr,0, BankSize(Bank) CloseFile FileNr Return True End Function |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group