2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html;charset=US-ASCII" >
2021-12-11 11:10:58 +00:00
< meta name = "generator" content = "ZealOS V1.07" >
2021-07-03 05:07:57 +01:00
< style type = "text/css" >
2021-10-08 07:06:11 +01:00
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
2021-07-03 05:07:57 +01:00
< / style >
< / head >
< body >
2021-07-05 01:12:38 +01:00
< pre style = "font-family:monospace;font-size:12pt" >
2021-07-03 05:07:57 +01:00
< a name = "l1" > < / a > < span class = cF1 > Bool< / span > < span class = cF0 > < / span > < span class = cFD > DriveTypeSet< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > drv_let, < / span > < span class = cF9 > I64< / span > < span class = cF0 > type=< / span > < span class = cF3 > FSt_REDSEA< / span > < span class = cF0 > )
< a name = "l2" > < / a > {< / span > < span class = cF2 > //Very dangerous< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l3" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > i, j, ext_base, drv_num, < / span > < span class = cF1 > offset< / span > < span class = cF0 > , cur_type;
< a name = "l4" > < / a > < / span > < span class = cF9 > CMasterBoot< / span > < span class = cF0 > mbr;
< a name = "l5" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *bd;
2021-07-03 05:07:57 +01:00
< a name = "l6" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l7" > < / a > drv_let = < / span > < span class = cF5 > Letter2Letter< / span > < span class = cF0 > (drv_let);
< a name = "l8" > < / a > bd = < / span > < span class = cF5 > Letter2BlkDev< / span > < span class = cF0 > (drv_let);
< a name = "l9" > < / a > drv_num = bd-> first_drive_let - < / span > < span class = cF6 > 'A'< / span > < span class = cF0 > ;
< a name = "l10" > < / a > < / span > < span class = cF1 > switch< / span > < span class = cF0 > (bd-> type)
< a name = "l11" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l12" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > BDT_ATA< / span > < span class = cF0 > :
< a name = "l13" > < / a > < / span > < span class = cF1 > offset< / span > < span class = cF0 > = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l14" > < / a > ext_base = < / span > < span class = cF3 > INVALID_CLUS< / span > < span class = cF0 > ;
< a name = "l15" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (< / span > < span class = cF3 > TRUE< / span > < span class = cF0 > )
< a name = "l16" > < / a > {
< a name = "l17" > < / a > < / span > < span class = cF5 > AHCIAtaBlksRead< / span > < span class = cF0 > (bd, & mbr, < / span > < span class = cF1 > offset< / span > < span class = cF0 > , < / span > < span class = cFE > 1< / span > < span class = cF0 > );
< a name = "l18" > < / a > j =- < / span > < span class = cFE > 1< / span > < span class = cF0 > ;
< a name = "l19" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (i = < / span > < span class = cFE > 0< / span > < span class = cF0 > ; i < < / span > < span class = cFE > 4< / span > < span class = cF0 > ; i++)
< a name = "l20" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l21" > < / a > cur_type = mbr.p[i].type;
< a name = "l22" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (cur_type)
< a name = "l23" > < / a > {
< a name = "l24" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (cur_type == < / span > < span class = cFE > 5< / span > < span class = cF0 > || cur_type == < / span > < span class = cFE > 15< / span > < span class = cF0 > )
< a name = "l25" > < / a > j = i;
< a name = "l26" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l27" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l28" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (drv_num + < / span > < span class = cF6 > 'A'< / span > < span class = cF0 > == drv_let)
< a name = "l29" > < / a > {
< a name = "l30" > < / a > < / span > < span class = cF1 > switch< / span > < span class = cF0 > (type)
< a name = "l31" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l32" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > FSt_REDSEA< / span > < span class = cF0 > :
< a name = "l33" > < / a > mbr.p[i].type = < / span > < span class = cF3 > MBR_PT_REDSEA< / span > < span class = cF0 > ;
< a name = "l34" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l35" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l36" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > FSt_FAT32< / span > < span class = cF0 > :
< a name = "l37" > < / a > mbr.p[i].type = < / span > < span class = cF3 > MBR_PT_FAT32a< / span > < span class = cF0 > ;
< a name = "l38" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l39" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l40" > < / a > < / span > < span class = cF1 > default< / span > < span class = cF0 > :
< a name = "l41" > < / a > < / span > < span class = cF5 > throw< / span > < span class = cF0 > (< / span > < span class = cF6 > 'Drive'< / span > < span class = cF0 > );
< a name = "l42" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l43" > < / a > mbr.p[i].active = < / span > < span class = cFE > 0x80< / span > < span class = cF0 > ;
< a name = "l44" > < / a > < / span > < span class = cF5 > AHCIAtaBlksWrite< / span > < span class = cF0 > (bd, & mbr, < / span > < span class = cF1 > offset< / span > < span class = cF0 > , < / span > < span class = cFE > 1< / span > < span class = cF0 > );
< a name = "l45" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l46" > < / a > }
< a name = "l47" > < / a > drv_num++;
< a name = "l48" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l49" > < / a > }
< a name = "l50" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l51" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (j < < / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l52" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l53" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!mbr.p[j].< / span > < span class = cF1 > offset< / span > < span class = cF0 > )
< a name = "l54" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l55" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (ext_base == < / span > < span class = cF3 > INVALID_CLUS< / span > < span class = cF0 > )
< a name = "l56" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l57" > < / a > < / span > < span class = cF1 > offset< / span > < span class = cF0 > = mbr.p[j].< / span > < span class = cF1 > offset< / span > < span class = cF0 > ;
< a name = "l58" > < / a > ext_base = < / span > < span class = cF1 > offset< / span > < span class = cF0 > ;
< a name = "l59" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l60" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l61" > < / a > < / span > < span class = cF1 > offset< / span > < span class = cF0 > = mbr.p[j].< / span > < span class = cF1 > offset< / span > < span class = cF0 > +ext_base;
< a name = "l62" > < / a > }
< a name = "l63" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l64" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l65" > < / a > }
< a name = "l66" > < / a >
< a name = "l67" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > Format< / span > < span class = cF0 > (< / span > < span class = cF9 > I64< / span > < span class = cF0 > drv_let, < / span > < span class = cF1 > Bool< / span > < span class = cF0 > quick=< / span > < span class = cF3 > TRUE< / span > < span class = cF0 > , < / span > < span class = cF1 > Bool< / span > < span class = cF0 > confirm=< / span > < span class = cF3 > TRUE< / span > < span class = cF0 > , < / span > < span class = cF9 > I64< / span > < span class = cF0 > type=< / span > < span class = cF3 > FSt_FAT32< / span > < span class = cF0 > )
< a name = "l68" > < / a > {< / span > < span class = cF2 > //Format hard drive or RAM drive.< / span > < span class = cF0 >
< a name = "l69" > < / a > < / span > < span class = cF2 > //Warning: Destroys all prev info.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l70" > < / a > < / span > < span class = cF2 > //quick=FALSE means fill entire drive with zeros.< / span > < span class = cF0 >
2021-12-04 10:03:02 +00:00
< a name = "l71" > < / a > < / span > < span class = cF2 > //Choose < / span > < a href = "https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l3344" > < span class = cF4 > FSt_FAT32< / span > < / a > < span class = cF2 > or < / span > < a href = "https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l3343" > < span class = cF4 > FSt_REDSEA< / span > < / a > < span class = cF2 > .< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l72" > < / a > < / span > < span class = cF2 > //You don't format a CD/DVD with this.< / span > < span class = cF0 >
< a name = "l73" > < / a > < / span > < span class = cF9 > CDrive< / span > < span class = cF0 > *drive = < / span > < span class = cF5 > Letter2Drive< / span > < span class = cF0 > (drv_let);
< a name = "l74" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > old_silent = < / span > < span class = cF5 > IsSilent< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l75" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l76" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (confirm & & !< / span > < span class = cF5 > AreYouSure< / span > < span class = cF0 > )
< a name = "l77" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > ;
< a name = "l78" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!drive)
< a name = "l79" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l80" > < / a > < / span > < span class = cF5 > PrintErr< / span > < span class = cF0 > (< / span > < span class = cF6 > " Invalid Drive\n" < / span > < span class = cF0 > );
< a name = "l81" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > ;
< a name = "l82" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l83" > < / a > < / span > < span class = cF1 > switch< / span > < span class = cF0 > (type)
< a name = "l84" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l85" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > FSt_FAT32< / span > < span class = cF0 > :
< a name = "l86" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (drive-> bd-> type == < / span > < span class = cF3 > BDT_ATA< / span > < span class = cF0 > )
< a name = "l87" > < / a > {
< a name = "l88" > < / a > < / span > < span class = cF5 > Silent< / span > < span class = cF0 > ;
< a name = "l89" > < / a > < / span > < span class = cF5 > Drive< / span > < span class = cF0 > (drv_let);
< a name = "l90" > < / a > < / span > < span class = cF5 > Silent< / span > < span class = cF0 > (old_silent);
< a name = "l91" > < / a > < / span > < span class = cFD > FAT32Format< / span > < span class = cF0 > (drv_let, quick);
< a name = "l92" > < / a > < / span > < span class = cF5 > DiskCacheInvalidate< / span > < span class = cF0 > (< / span > < span class = cF5 > Letter2Drive< / span > < span class = cF7 > (< / span > < span class = cF0 > drv_let< / span > < span class = cF7 > )< / span > < span class = cF0 > );
< a name = "l93" > < / a > < / span > < span class = cF5 > Drive< / span > < span class = cF0 > (drv_let);
< a name = "l94" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l95" > < / a > }
< a name = "l96" > < / a > < / span > < span class = cF6 > " Using RedSea File System.\n" < / span > < span class = cF0 > ;
< a name = "l97" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > FSt_REDSEA< / span > < span class = cF0 > :
< a name = "l98" > < / a > < / span > < span class = cF5 > Silent< / span > < span class = cF0 > ;
< a name = "l99" > < / a > < / span > < span class = cF5 > Drive< / span > < span class = cF0 > (drv_let);
< a name = "l100" > < / a > < / span > < span class = cF5 > Silent< / span > < span class = cF0 > (old_silent);
< a name = "l101" > < / a > < / span > < span class = cFD > RedSeaFormat< / span > < span class = cF0 > (drv_let, quick);
< a name = "l102" > < / a > < / span > < span class = cF5 > DiskCacheInvalidate< / span > < span class = cF0 > (< / span > < span class = cF5 > Letter2Drive< / span > < span class = cF7 > (< / span > < span class = cF0 > drv_let< / span > < span class = cF7 > )< / span > < span class = cF0 > );
< a name = "l103" > < / a > < / span > < span class = cF5 > Drive< / span > < span class = cF0 > (drv_let);
< a name = "l104" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l105" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l106" > < / a > < / span > < span class = cF1 > default< / span > < span class = cF0 > :
< a name = "l107" > < / a > < / span > < span class = cF5 > PrintErr< / span > < span class = cF0 > (< / span > < span class = cF6 > " File System Not Supported\n" < / span > < span class = cF0 > );
< a name = "l108" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l109" > < / a > }
< / span > < / pre > < / body >
< / html >