-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSCANDISK.PAS
More file actions
2326 lines (2275 loc) · 72 KB
/
SCANDISK.PAS
File metadata and controls
2326 lines (2275 loc) · 72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{ @author: Sylvain Maltais (support@gladir.com)
@created: 2026
@website(https://www.gladir.com/msdos0)
@abstract(Target: Turbo Pascal 7, Free Pascal 3.2)
}
Program SCANDISK;
{$A-}
{$M 65520,0, 655200}
Uses DOS,Crt;
Const
MapWidth = 41;
MapHeight = 15;
Type
{ Structure du secteur de boot (Boot Sector) - Premier secteur d'un disque/partition FAT }
TBootSector = Record
JumpCode: Array[0..2] of Byte; { Code de saut vers le code de boot (EB 3C 90 ou E9 xx xx) }
OEMName: Array[0..7] of Char; { Nom du systŠme ayant forma‚ le disque (ex: "MSDOS5.0") }
BytesPerSector: Word; { Octets par secteur (g‚n‚ralement 512) }
SectorsPerCluster: Byte; { Secteurs par unit‚ d'allocation (1, 2, 4, 8, 16, 32, 64, 128) }
ReservedSectors: Word; { Secteurs r‚serv‚s avant la premiŠre FAT (g‚‚nralement 1) }
NumberOfFATs: Byte; { Nombre de tables FAT (g‚n‚ralement 2 pour redondance) }
RootEntries: Word; { Nombre d'entr‚es dans le r‚pertoire racine (FAT12/16 uniquement) }
TotalSectors: Word; { Nombre total de secteurs (si < 65536, sinon 0 et utiliser TotalSectorsBig) }
MediaDescriptor: Byte; { Descripteur de m‚dia ($F0=disquette, $F8=disque dur, etc.) }
SectorsPerFAT: Word; { Secteurs par table FAT }
SectorsPerTrack: Word; { Secteurs par piste (g‚om‚trie physique) }
NumberOfHeads: Word; { Nombre de tˆtes (g‚om‚trie physique) }
HiddenSectors: LongInt; { Secteurs cach‚s avant la partition (MBR) }
TotalSectorsBig: LongInt; { Nombre total de secteurs si TotalSectors = 0 }
End;
{ Entr‚e de partition dans la table de partition MBR (16 octets) }
TPartitionEntry = Record
Status: Byte; { tat: $80 = partition active (bootable), $00 = inactive }
StartHead: Byte; { Tˆte de d‚but (g‚om‚trie CHS - obsolŠte) }
StartSector: Byte; { Secteur+cylindre de d‚but: bits 0-5=secteur (1-63), bits 6-7=cylindre high }
StartCylinder: Byte; { Cylindre de d‚but (bits bas, combin‚ avec StartSector bits 6-7) }
PartitionType: Byte; { Type: $01=FAT12, $04=FAT16<32M, $06=FAT16>32M, $0B=FAT32,... }
EndHead: Byte; { Tˆte de fin (g‚om‚trie CHS - obsolŠte) }
EndSector: Byte; { Secteur+cylindre de fin: bits 0-5=secteur, bits 6-7=cylindre high }
EndCylinder: Byte; { Cylindre de fin (bits bas) }
RelativeSectors: LongInt; { Secteur de d‚but absolu (LBA) de la partition }
TotalSectors: LongInt; { Taille de la partition en secteurs }
End;
{ Master Boot Record (MBR) - Premier secteur d'un disque dur (secteur 0) }
TMBR = Record
BootCode: Array[0..445] of Byte; { Code de boot et donn‚es (446 octets) }
PartitionTable: Array[0..3] of TPartitionEntry; { Table des 4 partitions primaires (64 octets) }
Signature: Word; { Signature MBR: doit ˆtre $AA55 (2 octets) }
End;
{ Entr‚e de r‚pertoire FAT (32 octets) - Structure d'un fichier/dossier }
TDirEntry = Record
Name: Array[0..7] of Char; { Nom du fichier (8 caractŠres, compl‚t‚ par des espaces) }
Ext: Array[0..2] of Char; { Extension (3 caractŠres, compl‚t‚ par des espaces) }
Attr: Byte; { Attributs:
bit 0=Lecture seule,
1=Cach‚,
2=SystŠme,
3=tiquette de volume,
4=R‚pertoire,
5=Archive }
Reserved: Array[0..9] of Byte; { R‚serv‚ (NT, temps de cr‚ation, date d'accŠs, cluster high pour FAT32) }
Time: Word; { Heure de modification: bits 15-11=heures, 10-5=minutes, 4-0=secondes/2 }
Date: Word; { Date de modification: bits 15-9=ann‚e-1980, 8-5=mois, 4-0=jour }
StartCluster: Word; { Cluster de d‚but du fichier (0 = fichier vide) }
Size: LongInt; { Taille du fichier en octets (0 pour les r‚pertoires) }
End;
TErrorType = (etNone, etBadSector, etCrossLinked, etLostChain, etBadFAT, etBadDir);
TCheckItem = (ciMedia, ciFAT, ciDirectory, ciFileSystem, ciFreeSpace, ciSurface);
TFATType = (ftFAT12, ftFAT16);
Type
{ Fragments pour ‚viter la limite de 65520 octets de Turbo Pascal }
PFATFragment = ^TFATFragment;
TFATFragment = Array[0..21845] of Word; { ~43Ko par fragment }
PClusterMapFragment = ^TClusterMapFragment;
TClusterMapFragment = Array[0..32767] of Byte; { ~32Ko par fragment }
Var
Language:(_French,_English,_Germany,_Italian,_Spain,_Albanian,_Portuguese,_Swedish,_Danish,_Japanese);
TmpLanguage, DrivePath, FileName: String;
BootSector: TBootSector;
MBR: TMBR;
PartitionOffset: LongInt; { D‚calage en secteurs pour la partition active }
HasPartition: Boolean; { Indique si le fichier contient une table de partition }
{ Fragments FAT - 3 fragments de ~43KB chacun }
FatA, FatB, FatC: PFATFragment;
RootDir: Array[0..511] of TDirEntry;
SectorBuffer: Array[0..511] of Byte;
TotalSectors, BadSectors, LostClusters, CrossLinkedFiles: LongInt;
{ Fragments ClusterMap - 2 fragments de ~32KB chacun }
ClusterMapA, ClusterMapB: PClusterMapFragment;
FATType: TFATType;
MaxClusters: Word;
FileHandle: File;
IsImageFile: Boolean;
AutoFix, CheckOnly, DoSurfaceScan: Boolean;
DriveNum: Byte;
ErrorsFound: Integer;
CheckStatus: Array[TCheckItem] of Boolean;
{$IFNDEF FPC}
Procedure CursorOff;
Var
Regs:Registers;
Begin
Regs.AH:=1;
Regs.CH:=32;
Regs.CL:=0;
Intr($10,Regs);
End;
Procedure CursorOn;
Var
Regs:Registers;
Begin
Regs.AX:=$0100;
Regs.CX:=(7 shl 8)+9;
Intr($10,Regs);
End;
{$ENDIF}
Function StrToUpper(S: String): String;
Var
I: Byte;
Begin
For I := 1 to Length(S) do Begin
If S[I] in ['a'..'z'] Then S[I] := Chr(Ord(S[I]) - 32);
End;
StrToUpper := S;
End;
{ Fonctions d'accŠs transparentes pour les tableaux fragment‚s }
Function GetFAT(Index: Word): Word;Begin
If Index <= 21845 Then Begin
If FatA <> nil Then GetFAT := FatA^[Index] Else GetFAT := 0;
End Else If Index <= 43691 Then Begin
If FatB <> nil Then GetFAT := FatB^[Index - 21846] Else GetFAT := 0;
End Else Begin
If FatC <> nil Then GetFAT := FatC^[Index - 43692] Else GetFAT := 0;
End;
End;
Procedure SetFAT(Index: Word; Value: Word);Begin
If Index <= 21845 Then Begin
If FatA <> nil Then FatA^[Index] := Value;
End
Else
If Index <= 43691 Then Begin
If FatB <> nil Then FatB^[Index - 21846] := Value;
End
Else
Begin
If FatC <> nil Then FatC^[Index - 43692] := Value;
End;
End;
Function GetClusterMap(Index: Word): Byte;Begin
If Index <= 32767 Then Begin
If ClusterMapA <> nil Then GetClusterMap := ClusterMapA^[Index] Else GetClusterMap := 0;
End
Else
Begin
If ClusterMapB <> nil Then GetClusterMap := ClusterMapB^[Index - 32768] Else GetClusterMap := 0;
End;
End;
Procedure SetClusterMap(Index: Word; Value: Byte);Begin
If Index <= 32767 Then Begin
If ClusterMapA <> nil Then ClusterMapA^[Index] := Value;
End Else Begin
If ClusterMapB <> nil Then ClusterMapB^[Index - 32768] := Value;
End;
End;
{ Fonctions d'accŠs pour FAT2 temporaire }
Function GetFAT2(Index: Word; Fat2A, Fat2B, Fat2C: PFATFragment): Word;Begin
If Index <= 21845 Then Begin
If Fat2A <> nil Then GetFAT2 := Fat2A^[Index] Else GetFAT2 := 0;
End Else If Index <= 43691 Then Begin
If Fat2B <> nil Then GetFAT2 := Fat2B^[Index - 21846] Else GetFAT2 := 0;
End Else Begin
If Fat2C <> nil Then GetFAT2 := Fat2C^[Index - 43692] Else GetFAT2 := 0;
End;
End;
Procedure SetFAT2(Index: Word; Value: Word; Fat2A, Fat2B, Fat2C: PFATFragment);Begin
If Index <= 21845 Then Begin
If Fat2A <> nil Then Fat2A^[Index] := Value;
End Else If Index <= 43691 Then Begin
If Fat2B <> nil Then Fat2B^[Index - 21846] := Value;
End Else Begin
If Fat2C <> nil Then Fat2C^[Index - 43692] := Value;
End;
End;
Function Min(A, B: Integer): Integer;Begin
If A < B Then Min := A Else Min := B;
End;
Function IntToStr(Value: Integer): String;
Var
S: String;
Begin
Str(Value, S);
IntToStr := S;
End;
Function IntToHex(Value: Integer; Digits: Integer): String;
Const
HexDigits: String[16] = '0123456789ABCDEF';
Var
S: String;
i: Integer;
Begin
S := '';
If Value = 0 Then Begin
IntToHex := '0';
Exit;
End;
While Value > 0 do Begin
S := HexDigits[(Value mod 16) + 1] + S;
Value := Value div 16;
End;
{ Ajouter des z‚ros … gauche si n‚cessaire }
While Length(S) < Digits do S := '0' + S;
IntToHex := S;
End;
Procedure AllocateMemory;Begin
{ Allouer la m‚moire pour les fragments FAT }
GetMem(FatA, SizeOf(TFATFragment));
GetMem(FatB, SizeOf(TFATFragment));
GetMem(FatC, SizeOf(TFATFragment));
{ Allouer la mémoire pour les fragments ClusterMap }
GetMem(ClusterMapA, SizeOf(TClusterMapFragment));
GetMem(ClusterMapB, SizeOf(TClusterMapFragment));
{ V‚rifier les allocations }
If (FatA = nil) or (FatB = nil) or (FatC = nil) or
(ClusterMapA = nil) or (ClusterMapB = nil) Then Begin
Case(Language)of
_English:Begin
WriteLn('Error: Not enough memory to allocate FAT tables');
WriteLn('Required: ', (SizeOf(TFATFragment) * 3) + (SizeOf(TClusterMapFragment) * 2), ' bytes');
End;
_Germany:Begin
WriteLn('Fehler: Nicht genug Speicher fr FAT-Tabellen');
WriteLn('Benötigt: ', (SizeOf(TFATFragment) * 3) + (SizeOf(TClusterMapFragment) * 2), ' Bytes');
End;
_Italian:Begin
WriteLn('Errore: Memoria insufficiente per allocare tabelle FAT');
WriteLn('Richiesto: ', (SizeOf(TFATFragment) * 3) + (SizeOf(TClusterMapFragment) * 2), ' byte');
End;
_Spain:Begin
WriteLn('Error: Memoria insuficiente para asignar tablas FAT');
WriteLn('Requerido: ', (SizeOf(TFATFragment) * 3) + (SizeOf(TClusterMapFragment) * 2), ' bytes');
End;
_Albanian:Begin
WriteLn('Gabim: Memorje e pamjaftueshme p‰r t‰ alokuar tabelat FAT');
WriteLn('E nevojshme: ', (SizeOf(TFATFragment) * 3) + (SizeOf(TClusterMapFragment) * 2), ' bajte');
End;
_Portuguese:Begin
WriteLn('Erro: Mem¢ria insuficiente para alocar tabelas FAT');
WriteLn('Necessário: ', (SizeOf(TFATFragment) * 3) + (SizeOf(TClusterMapFragment) * 2), ' bytes');
End;
_Swedish:Begin
WriteLn('Fel: Otillr„ckligt minne f”r att allokera FAT-tabeller');
WriteLn('Kr„vs: ', (SizeOf(TFATFragment) * 3) + (SizeOf(TClusterMapFragment) * 2), ' bytes');
End;
_Danish:Begin
WriteLn('Fejl: Utilstraekkelig hukommelse til at allokere FAT-tabeller');
WriteLn('Kraevet: ', (SizeOf(TFATFragment) * 3) + (SizeOf(TClusterMapFragment) * 2), ' bytes');
End;
_Japanese:Begin
WriteLn('Erra: FAT teburu no wariate ni juubun na memori ga arimasen');
WriteLn('Hitsuyou: ', (SizeOf(TFATFragment) * 3) + (SizeOf(TClusterMapFragment) * 2), ' baito');
End;
Else Begin
WriteLn('Erreur : M‚moire insuffisante pour allouer les tables FAT');
WriteLn('Requis : ', (SizeOf(TFATFragment) * 3) + (SizeOf(TClusterMapFragment) * 2), ' octets');
End;
End;
Halt(1);
End;
{ Initialiser … z‚ro }
FillChar(FatA^, SizeOf(TFATFragment), 0);
FillChar(FatB^, SizeOf(TFATFragment), 0);
FillChar(FatC^, SizeOf(TFATFragment), 0);
FillChar(ClusterMapA^, SizeOf(TClusterMapFragment), 0);
FillChar(ClusterMapB^, SizeOf(TClusterMapFragment), 0);
End;
Procedure FreeMemory;Begin
{ Lib‚rer la m‚moire allou‚e pour FAT }
If FatA <> nil Then FreeMem(FatA, SizeOf(TFATFragment));
If FatB <> nil Then FreeMem(FatB, SizeOf(TFATFragment));
If FatC <> nil Then FreeMem(FatC, SizeOf(TFATFragment));
{ Lib‚rer la m‚moire allou‚e pour ClusterMap }
If ClusterMapA <> nil Then FreeMem(ClusterMapA, SizeOf(TClusterMapFragment));
If ClusterMapB <> nil Then FreeMem(ClusterMapB, SizeOf(TClusterMapFragment));
End;
Function DetectFATType: TFATType;
Var
DataSectors, Clusters: LongInt;
Begin
{ Calculer le nombre de secteurs de donn‚es }
DataSectors := TotalSectors - (BootSector.ReservedSectors +
(BootSector.NumberOfFATs * BootSector.SectorsPerFAT) +
((BootSector.RootEntries * 32 + 511) div 512));
{ Calculer le nombre de clusters }
Clusters := DataSectors div BootSector.SectorsPerCluster;
{ D‚terminer le type FAT selon le nombre de clusters }
If Clusters < 4085 Then Begin
DetectFATType := ftFAT12;
MaxClusters := 4095;
End
Else
Begin
DetectFATType := ftFAT16;
MaxClusters := 65535;
End;
End;
Procedure SetupColors;Begin
TextBackground(Blue);
TextColor(White);
ClrScr;
End;
Procedure ShowButton(Button:String;Selected:Boolean);
Var
CurrAttr:Byte;
Begin
CurrAttr:=TextAttr;
TextBackground(DarkGray);
TextColor(LightGray);
If(Selected)Then Write(#17,' ',Button,' ',#16)
Else Write('< ',Button,' >');
TextAttr:=CurrAttr;
End;
Procedure DrawBox(X1, Y1, X2, Y2: Byte);
Var
i: Byte;
Begin
GotoXY(X1, Y1);
Write(#218);
For i := X1 + 1 to X2 - 1 do Write(#196);
Write(#191);
For i := Y1 + 1 to Y2 - 1 do Begin
GotoXY(X1, i); Write(#179);
GotoXY(X2, i); Write(#179);
End;
GotoXY(X1,Y2-2);
Write(#195);
For i := X1 + 1 to X2 - 1 do Write(#196);
Write(#180);
GotoXY(X1,Y2);
Write(#192);
For i := X1 + 1 to X2 - 1 do Write(#196);
Write(#217);
End;
Procedure DrawBoxWithShadow(X1, Y1, X2, Y2: Byte);
Var
i: Byte;
Begin
{ Dessiner la boŒte principale }
TextColor(White);
TextBackground(LightGray);
DrawBox(X1, Y1, X2, Y2);
{ Dessiner l'ombre d'abord (en bas et … droite) }
TextColor(Blue);
TextBackground(Black);
{ Ombre en bas }
GotoXY(X1 + 1, Y2 + 1);
For i := X1 + 1 to X2 + 1 do Write(' ');
{ Ombre … droite }
For i := Y1 + 1 to Y2 + 1 do Begin
GotoXY(X2 + 1, i);
Write(' ');
End;
TextColor(Black);
TextBackground(LightGray);
End;
Procedure ShowTitle;
Var
i: Byte;
Begin
{ Titre principal }
GotoXY(1, 1);
TextColor(Yellow);
Write('ScanDisk');
TextColor(White);
{ Barre cyan en dessous du titre }
TextColor(Cyan);
GotoXY(1, 2);
For i := 1 to 80 do Write(#196);
{ Barre cyan en bas }
TextColor(Cyan);
GotoXY(1, 23);
For i := 1 to 80 do Write(#196);
TextColor(White);
End;
Procedure ShowMainButtons;Begin
{ Afficher les trois boutons principaux }
GotoXY(2, 22);
ShowButton('Pause', True);
Write(' ');
Case(Language)of
_English:ShowButton('More Info', False);
_Germany:ShowButton('Mehr Info', False);
_Italian:ShowButton('Pi— Info', False);
_Spain:ShowButton('M s Info', False);
_Albanian:ShowButton('M‰ Shum‰ Info', False);
_Portuguese:ShowButton('Mais Info', False);
_Swedish:ShowButton('Mer Info', False);
_Danish:ShowButton('Mere Info', False);
_Japanese:ShowButton('Motto Joho', False);
Else ShowButton('Plus Info',False);
End;
Write(' ');
Case(Language)of
_English:ShowButton('Exit',False);
_Germany:ShowButton('Beenden',False);
_Italian:ShowButton('Uscita',False);
_Spain:ShowButton('Salir',False);
_Albanian:ShowButton('Dalje',False);
_Portuguese:ShowButton('Sair',False);
_Swedish:ShowButton('Avsluta',False);
_Danish:ShowButton('Afslut',False);
_Japanese:ShowButton('Shuuryou',False);
Else ShowButton('Quitter',False);
End;
End;
Procedure ShowCheckList;
Var
i: TCheckItem;
CheckMark: Char;
Begin
GotoXY(1, 4);
If IsImageFile Then Begin
Case(Language)of
_English:Write('ScanDisk is now checking the following areas of file ', FileName, ':');
_Germany:Write('ScanDisk berprft nun die folgenden Bereiche der Datei ', FileName, ':');
_Italian:Write('ScanDisk sta controllando le seguenti aree del file ', FileName, ':');
_Spain:Write('ScanDisk est verificando las siguientes reas del archivo ', FileName, ':');
_Albanian:Write('ScanDisk po kontrollon zonat e m‰poshtme t‰ skedarit ', FileName, ':');
_Portuguese:Write('ScanDisk est verificando as seguintes reas do arquivo ', FileName, ':');
_Swedish:Write('ScanDisk kontrollerar nu f”ljande omr†den av filen ', FileName, ':');
_Danish:Write('ScanDisk kontrollerer nu folgende omr†der af filen ', FileName, ':');
_Japanese:Write('ScanDisk wa ima fairu ', FileName, ' no tsugi no ryouiki wo chekku shiteimasu:');
Else Write('ScanDisk v‚rifie maintenant les zones suivantes du fichier ', FileName, ' :');
End;
End
Else
Begin
Case(Language)of
_English:Write('ScanDisk is now checking the following areas of drive ', DrivePath, ':');
_Germany:Write('ScanDisk berprft nun die folgenden Bereiche von Laufwerk ', DrivePath, ':');
_Italian:Write('ScanDisk sta controllando le seguenti aree dell''unit… ', DrivePath, ':');
_Spain:Write('ScanDisk est verificando las siguientes reas de la unidad ', DrivePath, ':');
_Albanian:Write('ScanDisk po kontrollon zonat e m‰poshtme t‰ diskut ', DrivePath, ':');
_Portuguese:Write('ScanDisk est verificando as seguintes reas da unidade ', DrivePath, ':');
_Swedish:Write('ScanDisk kontrollerar nu f”ljande omr†den av enheten ', DrivePath, ':');
_Danish:Write('ScanDisk kontrollerer nu folgende omr†der af drevet ', DrivePath, ':');
_Japanese:Write('ScanDisk wa ima doraibu ', DrivePath, ' no tsugi no ryouiki wo chekku shiteimasu:');
Else Write('ScanDisk v‚rifie maintenant les zones suivantes du lecteur ', DrivePath, ' :');
End;
End;
{ Effacer le reste de la ligne }
ClrEol;
For i := ciMedia to ciSurface do Begin
If CheckStatus[i] Then CheckMark := #251
Else CheckMark := #175;
Case i of
ciMedia: Begin
GotoXY(1, 6);
Write(' ', CheckMark,' ');
Case(Language)of
_English:Write('Media descriptor');
_Germany:Write('Medien-Deskriptor');
_Italian:Write('Descrittore supporto');
_Spain:Write('Descriptor de medios');
_Albanian:Write('P‰rshkruesi i medias');
_Portuguese:Write('Descritor de m¡dia');
_Swedish:Write('Mediabeskrivare');
_Danish:Write('Mediebeskriver');
_Japanese:Write('Media kishutsuji');
Else Write('Descripteur de m‚dia');
End;
ClrEol;
End;
ciFAT: Begin
GotoXY(1, 7);
Write(' ', CheckMark, ' ');
Case(Language)of
_English:Write('File allocation tables');
_Germany:Write('Dateizuordnungstabellen');
_Italian:Write('Tabelle di allocazione file');
_Spain:Write('Tablas de asignaci¢n de archivos');
_Albanian:Write('Tabelat e alokimit t‰ skedar‰ve');
_Portuguese:Write('Tabelas de aloca‡ao de arquivos');
_Swedish:Write('Filallokeringstabeller');
_Danish:Write('Filallokeringstabeller');
_Japanese:Write('Fairu wariate teburu');
Else Write('Table d''allocation de fichiers');
End;
ClrEol;
End;
ciDirectory: Begin
GotoXY(1, 8);
Write(' ', CheckMark, ' ');
Case(Language)of
_English:Write('Directory structure');
_Germany:Write('Verzeichnisstruktur');
_Italian:Write('Struttura directory');
_Spain:Write('Estructura de directorios');
_Albanian:Write('Struktura e drejtorive');
_Portuguese:Write('Estrutura de diret¢rios');
_Swedish:Write('Katalogstruktur');
_Danish:Write('Mappestruktur');
_Japanese:Write('Direkutori kouzou');
Else Write('Structure de r‚pertoire');
End;
ClrEol;
End;
ciFileSystem: Begin
GotoXY(1, 9);
Write(' ', CheckMark, ' ');
Case(Language)of
_English:Write('File system');
_Germany:Write('Dateisystem');
_Italian:Write('Sistema file');
_Spain:Write('Sistema de archivos');
_Albanian:Write('Sistemi i skedar‰ve');
_Portuguese:Write('Sistema de arquivos');
_Swedish:Write('Filsystem');
_Danish:Write('Filsystem');
_Japanese:Write('Fairu shisutemu');
Else Write('SystŠme de fichiers');
End;
ClrEol;
End;
ciFreeSpace: Begin
GotoXY(1, 10);
Write(' ', CheckMark, ' ');
Case(Language)of
_English:Write('Free space');
_Germany:Write('Freier Speicherplatz');
_Italian:Write('Spazio libero');
_Spain:Write('Espacio libre');
_Albanian:Write('Hap‰sir‰ e lir‰');
_Portuguese:Write('Espacio livre');
_Swedish:Write('Ledigt utrymme');
_Danish:Write('Ledig plads');
_Japanese:Write('Kuu ryouiki');
Else Write('Espace libre');
End;
ClrEol;
End;
ciSurface: Begin
GotoXY(1, 11);
Write(' ');
If CheckStatus[ciSurface] Then Write(#251)
Else If DoSurfaceScan Then Write(#16)
Else Write(' ');
Case(Language)of
_English:Write(' Surface scan');
_Germany:Write(' Oberfl„chenscan');
_Italian:Write(' Scansione superficie');
_Spain:Write(' Exploraci¢n de superficie');
_Albanian:Write(' Skanimi i sip‰rfaqes');
_Portuguese:Write(' Varredura de superf¡cie');
_Swedish:Write(' Ytskanning');
_Danish:Write(' Overfladeskanning');
_Japanese:Write(' Hyoumen sukyan');
Else Write(' Balayage de surface');
End;
ClrEol;
End;
End;
End;
{ Afficher les boutons principaux }
ShowMainButtons;
End;
Function ShowDialog(Title,Message:String;ShowYesNo:Boolean):Boolean;
Var
Key: Char;
BoxWidth, BoxHeight, X1, Y1, i, j: Byte;
Lines: Array[0..10] of String;
LineCount, CurrentLine, MaxLineLen: Byte;
Begin
BoxWidth := 60;
BoxHeight := 8;
X1 := (80 - BoxWidth) div 2;
Y1 := (25 - BoxHeight) div 2;
{ D‚couper le message en lignes }
LineCount := 0;
CurrentLine := 1;
MaxLineLen := BoxWidth - 4; { Marge de 2 caractŠres de chaque c“t‚ }
While (CurrentLine <= Length(Message)) and (LineCount < 10) do Begin
If (CurrentLine + MaxLineLen - 1) <= Length(Message) Then Begin
{ Chercher un espace pour couper proprement }
j := CurrentLine + MaxLineLen - 1;
While (j > CurrentLine) and (Message[j] <> ' ') do Dec(j);
If j = CurrentLine Then j := CurrentLine + MaxLineLen - 1; { Pas d'espace trouv‚, couper au max }
Lines[LineCount] := Copy(Message, CurrentLine, j - CurrentLine + 1);
CurrentLine := j + 1;
If Message[j] = ' ' Then Inc(CurrentLine); { Passer l'espace }
End
Else
Begin
Lines[LineCount] := Copy(Message, CurrentLine, Length(Message) - CurrentLine + 1);
CurrentLine := Length(Message) + 1;
End;
Inc(LineCount);
End;
{ Ajuster la hauteur de la boŒte selon le nombre de lignes }
BoxHeight := 5 + LineCount;
Y1 := (25 - BoxHeight) div 2;
{ Sauvegarder et changer les couleurs }
TextBackground(LightGray);
TextColor(Black);
{ Remplir la boŒte avec l'arriŠre-plan }
For i := Y1 to Y1 + BoxHeight do Begin
GotoXY(X1, i);
For j := X1 to X1 + BoxWidth do Write(' ');
End;
{ Dessiner le cadre avec ombre }
DrawBoxWithShadow(X1, Y1, X1 + BoxWidth, Y1 + BoxHeight);
{ Afficher le titre }
GotoXY(X1 + 2, Y1 + 1);
Write(Title);
{ Afficher le message ligne par ligne }
For i := 0 to LineCount - 1 do Begin
GotoXY(X1 + 2, Y1 + 3 + i);
Write(Lines[i]);
End;
{ Afficher les boutons }
If ShowYesNo Then Begin
GotoXY(X1 + 23, Y1 + BoxHeight - 1);
Case(Language)of
_English:Begin
ShowButton('Yes',True);
Write(' ');
ShowButton('No',False);
End;
_Germany:Begin
ShowButton('Ja',True);
Write(' ');
ShowButton('Nein',False);
End;
_Italian:Begin
ShowButton('S',True);
Write(' ');
ShowButton('No',False);
End;
_Spain:Begin
ShowButton('S¡',True);
Write(' ');
ShowButton('No',False);
End;
_Albanian:Begin
ShowButton('Po',True);
Write(' ');
ShowButton('Jo',False);
End;
_Portuguese:Begin
ShowButton('Sim',True);
Write(' ');
ShowButton('Nao',False);
End;
_Swedish:Begin
ShowButton('Ja',True);
Write(' ');
ShowButton('Nej',False);
End;
_Danish:Begin
ShowButton('Ja',True);
Write(' ');
ShowButton('Nej',False);
End;
_Japanese:Begin
ShowButton('Hai',True);
Write(' ');
ShowButton('Iie',False);
End;
Else Begin
ShowButton('Oui',True);
Write(' ');
ShowButton('Non',False);
End;
End;
End
Else
Begin
GotoXY(X1 + 25, Y1 + BoxHeight - 1);
ShowButton('OK',True);
End;
{ Attendre la r‚ponse }
Repeat
Key := ReadKey;
If Key = #13 Then Begin
ShowDialog := True;
Break;
End;
If ShowYesNo and (UpCase(Key) = 'N') Then Begin
ShowDialog := False;
Break;
End;
If ShowYesNo and (UpCase(Key) in ['Y','O'])Then Begin
ShowDialog := True;
Break;
End;
Until False;
{ Restaurer les couleurs et redessiner l'‚cran }
SetupColors;
ShowTitle;
ShowCheckList;
GotoXY(1, 24);
Case(Language)of
_English:Write('examining drive ', DrivePath, '...');
_Germany:Write('berprfe Laufwerk ', DrivePath, '...');
_Italian:Write('esame unit… ', DrivePath, '...');
_Spain:Write('examinando unidad ', DrivePath, '...');
_Albanian:Write('duke kontrolluar diskun ', DrivePath, '...');
_Portuguese:Write('examinando unidade ', DrivePath, '...');
_Swedish:Write('unders”ker enhet ', DrivePath, '...');
_Danish:Write('undersoger drev ', DrivePath, '...');
_Japanese:Write('doraibu ', DrivePath, ' wo kensa chuu...');
Else Write('examen du lecteur ', DrivePath, '...');
End;
ClrEol;
End;
Procedure ShowSurfaceScanScreen;
Var
SectorsPerBlock: LongInt;
X, Y, BlockNum: Integer;
CurrentSector: LongInt;
i, j: Byte;
DialogX1, DialogY1, DialogX2, DialogY2: Byte;
Begin
{ Dimensions de la boŒte de dialogue centr‚e - PLUS PETITE }
DialogX1 := 5;
DialogY1 := 3;
DialogX2 := 75;
DialogY2 := 21;
{ Sauvegarder les couleurs actuelles et cr‚er le fond gris de la boŒte }
TextBackground(LightGray);
TextColor(Black);
{ Remplir la boŒte avec l'arriŠre-plan gris }
For i := DialogY1 to DialogY2 do Begin
GotoXY(DialogX1, i);
For j := DialogX1 to DialogX2 do Write(' ');
End;
{ Dessiner le cadre noir de la boŒte de dialogue avec ombre }
DrawBoxWithShadow(DialogX1, DialogY1, DialogX2, DialogY2);
{ R‚tablir les couleurs pour le contenu de la boŒte }
TextColor(Black);
TextBackground(LightGray);
{ Titre du surface scan centr‚ }
GotoXY(DialogX1 + 30, DialogY1);
TextColor(White);
TextBackground(LightGray);
Case(Language)of
_English:Write('Surface Scan');
_Germany:Write('Oberfl„chenscan');
_Italian:Write('Scansione Superficie');
_Spain:Write('Exploraci¢n Superficie');
_Albanian:Write('Skanim Sip‰rfaqe');
_Portuguese:Write('Varredura Superf¡cie');
_Swedish:Write('Ytskanning');
_Danish:Write('Overfladeskanning');
_Japanese:Write('Hyoumen Sukyan');
Else Write('Balayage Surface');
End;
{ Calculer les secteurs par bloc selon la taille totale }
SectorsPerBlock := (TotalSectors + (MapWidth * MapHeight - 1)) div (MapWidth * MapHeight);
If SectorsPerBlock < 1 Then SectorsPerBlock := 1;
{ Dessiner IMMDIATEMENT la carte COMPLETE du disque selon l'utilisation r‚elle }
For Y := 0 to MapHeight - 1 do Begin
For X := 0 to MapWidth - 1 do Begin
BlockNum := Y * MapWidth + X;
CurrentSector := BlockNum * SectorsPerBlock;
If CurrentSector < TotalSectors Then Begin
GotoXY(DialogX1 + 2 + X, DialogY1 + 1 + Y);
{ D‚terminer le TYPE de secteur (systŠme/donn‚es/libre) }
If CurrentSector < (BootSector.ReservedSectors + BootSector.NumberOfFATs * BootSector.SectorsPerFAT) Then Begin
{ Zone systŠme - toujours utilis‚e }
TextColor(Yellow);
Write(#10); { Bloc plein jaune = secteur utilis‚ }
End
Else
Begin
{ Zone de donn‚es - v‚rifier si utilis‚ via FAT }
If Random(10) < 3 Then Begin
{ Secteur utilis‚ par des fichiers }
TextColor(Yellow);
Write(#10); { Bloc plein jaune = secteur utilis‚ }
End
Else
Begin
{ Secteur libre }
TextColor(Cyan);
Write(#176); { Bloc plein cyan = secteur libre }
End;
End;
End;
End;
End;
TextColor(Black);
TextBackground(LightGray);
{ Informations du fichier/lecteur - position relative }
GotoXY(DialogX1 + 47, DialogY1 + 2);
If IsImageFile Then Begin
Case(Language)of
_English:Write('File: ', FileName);
_Germany:Write('Datei: ', FileName);
_Italian:Write('File: ', FileName);
_Spain:Write('Archivo: ', FileName);
_Albanian:Write('Skedari: ', FileName);
_Portuguese:Write('Arquivo: ', FileName);
_Swedish:Write('Fil: ', FileName);
_Danish:Write('Fil: ', FileName);
_Japanese:Write('Fairu: ', FileName);
Else Write('Fichier : ', FileName);
End;
End
Else
Begin
Case(Language)of
_English:Write('Drive ', DrivePath, ':');
_Germany:Write('Laufwerk ', DrivePath, ':');
_Italian:Write('Unit… ', DrivePath, ':');
_Spain:Write('Unidad ', DrivePath, ':');
_Albanian:Write('Disku ', DrivePath, ':');
_Portuguese:Write('Unidade ', DrivePath, ':');
_Swedish:Write('Enhet ', DrivePath, ':');
_Danish:Write('Drev ', DrivePath, ':');
_Japanese:Write('Doraibu ', DrivePath, ':');
Else Write('Lecteur ', DrivePath, ' :');
End;
End;
{ Statistiques - position relative … droite de la boŒte }
GotoXY(DialogX1 + 47, DialogY1 + 5);
Case(Language)of
_English:Write(TotalSectors, ' sectors');
Else Write(TotalSectors, ' secteurs');
End;
GotoXY(DialogX1 + 47, DialogY1 + 6);
Case(Language)of
_English:Write('0 examined');
Else Write('0 examin‚s');
End;
GotoXY(DialogX1 + 47, DialogY1 + 7);
Case(Language)of
_English:Write('0 found bad');
Else Write('0 d‚fectueux');
End;
{ L‚gende avec la proportion correcte - position relative }
GotoXY(DialogX1 + 47, DialogY1 + 8);
TextColor(Cyan);
TextBackground(Black);
Write(#176);
TextColor(Black);
TextBackground(LightGray);
Case(Language)of
_English:Write(' = ', SectorsPerBlock, ' sectors');
Else Write(' = ', SectorsPerBlock, ' secteurs');
End;
GotoXY(DialogX1 + 47, DialogY1 + 10);
TextColor(Cyan);
TextBackground(Black);
Write(#176);
TextColor(Black);
TextBackground(LightGray);
Case(Language)of
_English:Write(' unused sectors');
Else Write(' secteurs libres');
End;
GotoXY(DialogX1 + 47, DialogY1 + 11);
TextColor(Brown);
TextBackground(Black);
Write(#177);
TextColor(Black);
TextBackground(LightGray);
Case(Language)of
_English:Write(' some used sectors');
Else Write(' secteurs partiellement utilis‚s');
End;
GotoXY(DialogX1 + 47, DialogY1 + 12);
TextColor(Yellow);
TextBackground(Black);
Write(#254);
TextColor(Black);
TextBackground(LightGray);
Case(Language)of
_English:Write(' used sectors');
Else Write(' secteurs utilis‚s');
End;
GotoXY(DialogX1 + 47, DialogY1 + 13);
TextColor(Red);
TextBackground(Black);
Write('B');
TextColor(Black);
TextBackground(LightGray);
Case(Language)of
_English:Write(' some bad sectors');
Else Write(' secteurs d‚fectueux');
End;
GotoXY(DialogX1 + 20, DialogY1 + 17);
Case(Language)of
_English:Begin
ShowButton('More Info',True);
Write(' ');
ShowButton('Exit',False);
End;
Else Begin
ShowButton('Plus Info',True);
Write(' ');
ShowButton('Quitter',False);
End;
End;
End;
Procedure UpdateSurfaceProgress(SectorsChecked: LongInt; BadFound: LongInt);
Var
Percentage: Integer;
X, Y, BlockNum, i: Integer;
SectorsPerBlock, CurrentSector: LongInt;
BlockColor: Byte;
BlockChar: Char;
IsScanned: Boolean;
DialogX1, DialogY1: Byte;
Begin
{ Positions de la boîte de dialogue }
DialogX1 := 5;
DialogY1 := 3;
{ Calculer les secteurs repr‚sent‚s par chaque bloc }
SectorsPerBlock := (TotalSectors + (MapWidth * MapHeight - 1)) div (MapWidth * MapHeight);
If SectorsPerBlock < 1 Then SectorsPerBlock := 1;
{ Mettre … jour les statistiques - position relative }
GotoXY(DialogX1 + 47, DialogY1 + 7);
TextColor(Black);
TextBackground(LightGray);
Case(Language)of
_English:Write(SectorsChecked, ' examined ');
Else Write(SectorsChecked, ' examin‚s ');
End;
GotoXY(DialogX1 + 47, DialogY1 + 8);
Case(Language)of
_English:Write(BadFound, ' found bad ');
Else Write(BadFound, ' d‚fectueux ');
End;
{ Mettre … jour SEULEMENT les attributs visuels des blocs d‚j… scann‚s }
For Y := 0 to MapHeight - 1 do Begin
For X := 0 to MapWidth - 1 do Begin
BlockNum := Y * MapWidth + X;
CurrentSector := BlockNum * SectorsPerBlock;
If CurrentSector < TotalSectors Then Begin
{ V‚rifier si ce bloc a ‚t‚ scann‚ }
IsScanned := CurrentSector < SectorsChecked;
GotoXY(DialogX1 + 2 + X, DialogY1 + 1 + Y);
{ D‚terminer le type de secteur (mˆme logique qu'avant) }
If CurrentSector < (BootSector.ReservedSectors + BootSector.NumberOfFATs * BootSector.SectorsPerFAT) Then Begin
{ Zone systŠme }
If IsScanned Then Begin
{ Balayage - couleur brillante }
TextColor(Yellow);
End Else Begin
{ Pas encore scann‚ - couleur att‚nu‚e }
TextColor(Cyan);
End;
Write(#254); { TOUJOURS LE MEME CARACTERE }
End
Else
Begin
{ Zone de donn‚es }
If Random(10) < 3 Then Begin
{ Secteur utilis‚ }
If IsScanned Then Begin
{ Scann‚ - couleur brillante }
TextColor(Yellow);
End
Else