2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html;charset=US-ASCII" >
2021-07-05 20:23:13 +01:00
< meta name = "generator" content = "ZealOS V0.06" >
2021-07-03 05:07:57 +01:00
< style type = "text/css" >
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;background-color:#000000;}
.cFC{color:#ac3535;background-color:#000000;}
.cFD{color:#ad7fa8;background-color:#000000;}
.cFE{color:#fce94f;background-color:#000000;}
.cFF{color:#000000;background-color:#000000;}
< / style >
< / head >
< body >
2021-07-05 01:12:38 +01:00
< pre style = "font-family:monospace;font-size:12pt" >
2021-07-05 01:57:09 +01:00
< a name = "l1" > < / a > < span class = cF2 > //See < / span > < a href = "https://tomawezome.github.io/ZealOS/Doc/Install.DD.html#l1" > < span class = cF4 > Install Documentation< / span > < / a > < span class = cF2 > .< / span > < span class = cF0 >
< a name = "l2" > < / a > < / span > < span class = cF2 > //Study the account examples: < / span > < a href = "https://tomawezome.github.io/ZealOS/Demo/AcctExample/TOS/TOSConfig.CC.html#l1" > < span class = cF4 > Config Strs< / span > < / a > < span class = cF2 > , < / span > < a href = "https://tomawezome.github.io/ZealOS/Demo/AcctExample/TOS/TOSDistro.CC.html#l1" > < span class = cF4 > Update Funs< / span > < / a > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l3" > < / a >
< a name = "l4" > < / a > #< / span > < span class = cF1 > include< / span > < span class = cF0 > < / span > < span class = cF6 > " BootMHD" < / span > < span class = cF0 >
< a name = "l5" > < / a > #< / span > < span class = cF1 > include< / span > < span class = cF0 > < / span > < span class = cF6 > " BootMHD2" < / span > < span class = cF0 >
< a name = "l6" > < / a >
< a name = "l7" > < / a > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " Install" < / span > < span class = cF0 >
< a name = "l8" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l9" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > < / span > < span class = cF3 > BOOT_DIR< / span > < span class = cF0 > < / span > < span class = cF6 > " /0000Boot" < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l10" > < / a > < / span > < span class = cF2 > //Stage 2 of master boot loader< / span > < span class = cF0 >
< a name = "l11" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > < / span > < span class = cF3 > BOOT_DIR_BOOTMHD2_BIN_C< / span > < span class = cF0 > < / span > < span class = cF3 > BOOT_DIR< / span > < span class = cF0 > < / span > < span class = cF6 > " /BootMHD2.BIN.C" < / span > < span class = cF0 >
< a name = "l12" > < / a > < / span > < span class = cF2 > //Old master boot record< / span > < span class = cF0 >
< a name = "l13" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > < / span > < span class = cF3 > BOOT_DIR_OLDMBR_BIN_C< / span > < span class = cF0 > < / span > < span class = cF3 > BOOT_DIR< / span > < span class = cF0 > < / span > < span class = cF6 > " /OldMBR.BIN.C" < / span > < span class = cF0 >
< a name = "l14" > < / a >
< a name = "l15" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > BootMHDOldRead< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > src_drive, < / span > < span class = cF1 > U8< / span > < span class = cF0 > dst_drive)
< a name = "l16" > < / a > {< / span > < span class = cF2 > //Reads MBR from disk drive containing src partition.< / span > < span class = cF0 >
< a name = "l17" > < / a > < / span > < span class = cF2 > //Writes a single blk file to dst BOOT_DIR.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l18" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *bd = < / span > < span class = cF5 > Letter2BlkDev< / span > < span class = cF0 > (src_drive);
< a name = "l19" > < / a > < / span > < span class = cF9 > CDrive< / span > < span class = cF0 > *drive;
< a name = "l20" > < / a > < / span > < span class = cF9 > CMasterBoot< / span > < span class = cF0 > mbr;
2021-07-03 05:07:57 +01:00
< a name = "l21" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l22" > < / a > < / span > < span class = cF5 > Drive< / span > < span class = cF0 > (dst_drive);
< a name = "l23" > < / a > drive = < / span > < span class = cF5 > Fs< / span > < span class = cF0 > -> cur_dv;
2021-07-03 05:07:57 +01:00
< a name = "l24" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l25" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (drive-> fs_type != < / span > < span class = cF3 > FSt_REDSEA< / span > < span class = cF0 > & & drive-> fs_type != < / span > < span class = cF3 > FSt_FAT32< / span > < span class = cF0 > )
< a name = "l26" > < / 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 = "l27" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l28" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l29" > < / a > < / span > < span class = cF2 > //Bypass partition bounds-checking< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l30" > < / a > < / span > < span class = cF5 > BlkDevLock< / span > < span class = cF0 > (bd);
< a name = "l31" > < / a > < / span > < span class = cF5 > AHCIAtaBlksRead< / span > < span class = cF0 > (bd, & mbr, < / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cFE > 1< / span > < span class = cF0 > );
< a name = "l32" > < / a > < / span > < span class = cF5 > BlkDevUnlock< / span > < span class = cF0 > (bd);
2021-07-03 05:07:57 +01:00
< a name = "l33" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l34" > < / a > < / span > < span class = cF5 > Drive< / span > < span class = cF0 > (dst_drive);
< a name = "l35" > < / a > < / span > < span class = cF5 > DirMake< / span > < span class = cF0 > (< / span > < span class = cF3 > BOOT_DIR< / span > < span class = cF0 > );
< a name = "l36" > < / a > < / span > < span class = cF5 > FileWrite< / span > < span class = cF0 > (< / span > < span class = cF3 > BOOT_DIR_OLDMBR_BIN_C< / span > < span class = cF0 > , & mbr, < / span > < span class = cF3 > BLK_SIZE< / span > < span class = cF0 > );
< a name = "l37" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l38" > < / a > }
< a name = "l39" > < / a >
< a name = "l40" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > BootMHDOldWrite< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > src_drive, < / span > < span class = cF1 > U8< / span > < span class = cF0 > dst_drive)
< a name = "l41" > < / a > {< / span > < span class = cF2 > //Reads OldMBR from src drive BOOT_DIR.< / span > < span class = cF0 >
< a name = "l42" > < / a > < / span > < span class = cF2 > //writes it to the MBR of the drive with dst partition.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l43" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *bd = < / span > < span class = cF5 > Letter2BlkDev< / span > < span class = cF0 > (dst_drive);
< a name = "l44" > < / a > < / span > < span class = cF9 > CMasterBoot< / span > < span class = cF0 > *mbr;
2021-07-03 05:07:57 +01:00
< a name = "l45" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l46" > < / a > < / span > < span class = cF5 > Drive< / span > < span class = cF0 > (src_drive);
2021-07-03 05:07:57 +01:00
< a name = "l47" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l48" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (mbr = < / span > < span class = cF5 > FileRead< / span > < span class = cF7 > (< / span > < span class = cF3 > BOOT_DIR_OLDMBR_BIN_C< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l49" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l50" > < / a > < / span > < span class = cF2 > //Bypass partition bounds-checking< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l51" > < / a > < / span > < span class = cF5 > BlkDevLock< / span > < span class = cF0 > (bd);
< a name = "l52" > < / a > < / span > < span class = cF5 > AHCIAtaBlksWrite< / span > < span class = cF0 > (bd, mbr, < / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cFE > 1< / span > < span class = cF0 > );
< a name = "l53" > < / a > < / span > < span class = cF5 > BlkDevUnlock< / span > < span class = cF0 > (bd);
< a name = "l54" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l55" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (mbr);
2021-07-03 05:07:57 +01:00
< a name = "l56" > < / a > }
< a name = "l57" > < / a >
< a name = "l58" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > BootMHDZero< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > dst_drive)
< a name = "l59" > < / a > {< / span > < span class = cF2 > //Set MBR of disk with dst partition to zero.< / span > < span class = cF0 >
< a name = "l60" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l61" > < / a > < / span > < span class = cF2 > //This is dangerous!!< / span > < span class = cF0 >
< a name = "l62" > < / a > < / span > < span class = cF2 > //The ZealOS partitioner doesn't play well< / span > < span class = cF0 >
< a name = "l63" > < / a > < / span > < span class = cF2 > //with other operating systems at this time and you need< / span > < span class = cF0 >
< a name = "l64" > < / a > < / span > < span class = cF2 > //to do this on a drive partitioned by ZealOS< / span > < span class = cF0 >
< a name = "l65" > < / a > < / span > < span class = cF2 > //if you wish to partition with another operating system.< / span > < span class = cF0 >
< a name = "l66" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *bd = < / span > < span class = cF5 > Letter2BlkDev< / span > < span class = cF0 > (dst_drive);
< a name = "l67" > < / a > < / span > < span class = cF9 > CMasterBoot< / span > < span class = cF0 > mbr;
2021-07-03 05:07:57 +01:00
< a name = "l68" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l69" > < / a > < / span > < span class = cF5 > MemSet< / span > < span class = cF0 > (& mbr, < / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cF3 > BLK_SIZE< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l70" > < / a > < / span > < span class = cF2 > //Bypass partition bounds-checking< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l71" > < / a > < / span > < span class = cF5 > BlkDevLock< / span > < span class = cF0 > (bd);
< a name = "l72" > < / a > < / span > < span class = cF5 > AHCIAtaBlksWrite< / span > < span class = cF0 > (bd, & mbr, < / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cFE > 1< / span > < span class = cF0 > );
< a name = "l73" > < / a > < / span > < span class = cF5 > BlkDevUnlock< / span > < span class = cF0 > (bd);
2021-07-03 05:07:57 +01:00
< a name = "l74" > < / a > }
< a name = "l75" > < / a >
< a name = "l76" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > < / span > < span class = cF5 > BootMHDIns< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > drv_let, < / span > < span class = cF1 > U8< / span > < span class = cF0 > *drv_list=< / span > < span class = cF3 > NULL< / span > < span class = cF0 > )
< a name = "l77" > < / a > {< / span > < span class = cF2 > //Create new MBR on the disk that has drv_let as a partition.< / span > < span class = cF0 >
< a name = "l78" > < / a > < / span > < span class = cF2 > //Puts stage 2 in BOOT_DIR of drv_let.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l79" > < / a > < / span > < span class = cF9 > CBlkDev< / span > < span class = cF0 > *bd, *bd1;
< a name = "l80" > < / a > < / span > < span class = cF9 > CDrive< / span > < span class = cF0 > *drive, *p1;
< a name = "l81" > < / a > < / span > < span class = cF9 > CMasterBoot< / span > < span class = cF0 > mbr;
< a name = "l82" > < / a > < / span > < span class = cF9 > CDirEntry< / span > < span class = cF0 > de;
< a name = "l83" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > i, j, size, *_q;
< a name = "l84" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *menu_ptr, *ptr, ch, buf[< / span > < span class = cF3 > STR_LEN< / span > < span class = cF0 > ];
< a name = "l85" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > res = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l86" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l87" > < / a > < / span > < span class = cF1 > try< / span > < span class = cF0 >
< a name = "l88" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l89" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (drv_list)
< a name = "l90" > < / a > {
< a name = "l91" > < / a > < / span > < span class = cF5 > StrCopy< / span > < span class = cF0 > (buf, drv_list);
< a name = "l92" > < / a > < / span > < span class = cF5 > StrUtil< / span > < span class = cF0 > (buf, < / span > < span class = cF3 > SUF_TO_UPPER< / span > < span class = cF0 > );
< a name = "l93" > < / a > }
< a name = "l94" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l95" > < / a > {
< a name = "l96" > < / a > j = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l97" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (i = < / span > < span class = cF6 > 'A'< / span > < span class = cF0 > ; i < = < / span > < span class = cF6 > 'Z'< / span > < span class = cF0 > ; i++)
< a name = "l98" > < / a > buf[j++] = i;
< a name = "l99" > < / a > buf[j++] = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l100" > < / a > }
2021-07-03 05:07:57 +01:00
< a name = "l101" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l102" > < / a > < / span > < span class = cF5 > Drive< / span > < span class = cF0 > (drv_let);
< a name = "l103" > < / a > drive = < / span > < span class = cF5 > Fs< / span > < span class = cF0 > -> cur_dv;
2021-07-03 05:07:57 +01:00
< a name = "l104" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l105" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (drive-> fs_type != < / span > < span class = cF3 > FSt_REDSEA< / span > < span class = cF0 > & & drive-> fs_type != < / span > < span class = cF3 > FSt_FAT32< / span > < span class = cF0 > )
< a name = "l106" > < / 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 = "l107" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l108" > < / a > {
< a name = "l109" > < / a > bd = drive-> bd;
2021-07-03 05:07:57 +01:00
< a name = "l110" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l111" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!< / span > < span class = cF5 > FileFind< / span > < span class = cF7 > (< / span > < span class = cF3 > BOOT_DIR_OLDMBR_BIN_C< / span > < span class = cF0 > ,, < / span > < span class = cF3 > FUF_JUST_FILES< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l112" > < / a > < / span > < span class = cF5 > BootMHDOldRead< / span > < span class = cF0 > (drv_let, drv_let);
2021-07-03 05:07:57 +01:00
< a name = "l113" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l114" > < / a > _q = < / span > < span class = cFD > BMHD2_BLK_ARRAY< / span > < span class = cF0 > ;
< a name = "l115" > < / a > < / span > < span class = cF5 > MemSet< / span > < span class = cF0 > (_q, < / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cF1 > sizeof< / span > < span class = cF7 > (< / span > < span class = cF9 > I64< / span > < span class = cF7 > )< / span > < span class = cF0 > * < / span > < span class = cFE > 8< / span > < span class = cF0 > );
< a name = "l116" > < / a > menu_ptr = < / span > < span class = cFD > BMHD2_BOOT_MESSAGE< / span > < span class = cF0 > ;
< a name = "l117" > < / a > < / span > < span class = cF5 > StrPrint< / span > < span class = cF0 > (menu_ptr, < / span > < span class = cF6 > " \n\r\n\rZealOS Boot Loader\n\r\n\r" < / span > < span class = cF0 > );
< a name = "l118" > < / a > j = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l119" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l120" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF5 > FileFind< / span > < span class = cF7 > (< / span > < span class = cF3 > BOOT_DIR_OLDMBR_BIN_C< / span > < span class = cF0 > , & de, < / span > < span class = cF3 > FUF_JUST_FILES< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l121" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l122" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (de.full_name);
< a name = "l123" > < / a > *_q++ = < / span > < span class = cF5 > Clus2Blk< / span > < span class = cF0 > (drive, de.clus);
< a name = "l124" > < / a > < / span > < span class = cF5 > CatPrint< / span > < span class = cF0 > (menu_ptr, < / span > < span class = cF6 > " 0. Old Boot Record\n\r" < / span > < span class = cF0 > );
< a name = "l125" > < / a > j++;
< a name = "l126" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l127" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l128" > < / a > ptr = buf;
< a name = "l129" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (ch = *ptr++)
< a name = "l130" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l131" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cF7 > (< / span > < span class = cF0 > p1 = < / span > < span class = cF5 > Letter2Drive< / span > < span class = cF0 > (ch, < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > )< / span > < span class = cF7 > )< / span > < span class = cF0 > & & < / span > < span class = cF7 > (< / span > < span class = cF0 > bd1 = p1-> bd< / span > < span class = cF7 > )< / span > < span class = cF0 > & & bd1 == bd)
< a name = "l132" > < / a > {
< a name = "l133" > < / a > *_q = p1-> drv_offset;
< a name = "l134" > < / a > < / span > < span class = cF6 > " Drive %C:%16X\n" < / span > < span class = cF0 > , < / span > < span class = cF5 > Drive2Letter< / span > < span class = cF0 > (p1), *_q;
< a name = "l135" > < / a > < / span > < span class = cF5 > CatPrint< / span > < span class = cF0 > (menu_ptr, < / span > < span class = cF6 > " %d. Drive %C\n\r" < / span > < span class = cF0 > , j++, < / span > < span class = cF5 > Drive2Letter< / span > < span class = cF7 > (< / span > < span class = cF0 > p1< / span > < span class = cF7 > )< / span > < span class = cF0 > );
< a name = "l136" > < / a > _q++;
< a name = "l137" > < / a > }
< a name = "l138" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l139" > < / a > < / span > < span class = cF5 > CatPrint< / span > < span class = cF0 > (menu_ptr, < / span > < span class = cF6 > " \n\rSelection:" < / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l140" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l141" > < / a > size = < / span > < span class = cFD > BMHD2_END< / span > < span class = cF0 > - < / span > < span class = cFD > BMHD2_START< / span > < span class = cF0 > ;
< a name = "l142" > < / a > < / span > < span class = cF5 > FileWrite< / span > < span class = cF0 > (< / span > < span class = cF3 > BOOT_DIR_BOOTMHD2_BIN_C< / span > < span class = cF0 > , < / span > < span class = cFD > BMHD2_START< / span > < span class = cF0 > , size);
2021-07-03 05:07:57 +01:00
< a name = "l143" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l144" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!< / span > < span class = cF5 > FileFind< / span > < span class = cF7 > (< / span > < span class = cF3 > BOOT_DIR_BOOTMHD2_BIN_C< / span > < span class = cF0 > , & de, < / span > < span class = cF3 > FUF_JUST_FILES< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l145" > < / a > < / span > < span class = cF6 > " No Boot Loader Image\n" < / span > < span class = cF0 > ;
< a name = "l146" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l147" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l148" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (de.full_name);
2021-07-03 05:07:57 +01:00
< a name = "l149" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l150" > < / a > *< / span > < span class = cFD > BMHD_BLK_COUNT< / span > < span class = cF0 > (< / span > < span class = cF9 > U16< / span > < span class = cF0 > *) = (size + < / span > < span class = cF3 > BLK_SIZE< / span > < span class = cF0 > - < / span > < span class = cFE > 1< / span > < span class = cF0 > ) > > < / span > < span class = cF3 > BLK_SIZE_BITS< / span > < span class = cF0 > ;
< a name = "l151" > < / a > *< / span > < span class = cFD > BMHD_DAP_BLK< / span > < span class = cF0 > (< / span > < span class = cF9 > I64< / span > < span class = cF0 > *) = < / span > < span class = cF5 > Clus2Blk< / span > < span class = cF0 > (drive, de.clus);
2021-07-03 05:07:57 +01:00
< a name = "l152" > < / a > < / span > < span class = cF2 > //Bypass partition bounds-checking< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l153" > < / a > < / span > < span class = cF5 > BlkDevLock< / span > < span class = cF0 > (bd);
< a name = "l154" > < / a > < / span > < span class = cF5 > AHCIAtaBlksRead< / span > < span class = cF0 > (bd, & mbr, < / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cFE > 1< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l155" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l156" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (i = < / span > < span class = cFE > 0< / span > < span class = cF0 > ; i < < / span > < span class = cFD > BMHD_END< / span > < span class = cF0 > - < / span > < span class = cFD > BMHD_CODE< / span > < span class = cF0 > ; i++)
< a name = "l157" > < / a > mbr.code[i] = < / span > < span class = cFD > BMHD_CODE< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > *)[i];
2021-07-03 05:07:57 +01:00
< a name = "l158" > < / a >
< a name = "l159" > < / a > #< / span > < span class = cF1 > assert< / span > < span class = cF0 > < / span > < span class = cF1 > sizeof< / span > < span class = cF0 > (< / span > < span class = cF9 > CMasterBoot< / span > < span class = cF0 > .code) > = < / span > < span class = cFD > BMHD_END< / span > < span class = cF0 > - < / span > < span class = cFD > BMHD_CODE< / span > < span class = cF0 >
< a name = "l160" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l161" > < / a > < / span > < span class = cF1 > for< / span > < span class = cF0 > (; i < < / span > < span class = cF1 > sizeof< / span > < span class = cF7 > (< / span > < span class = cF9 > CMasterBoot< / span > < span class = cF0 > .code< / span > < span class = cF7 > )< / span > < span class = cF0 > ; i++)
< a name = "l162" > < / a > mbr.code[i] = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l163" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l164" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!mbr.media_id)
< a name = "l165" > < / a > mbr.media_id = < / span > < span class = cF5 > RandU32< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l166" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l167" > < / a > mbr.zero = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l168" > < / a > mbr.signature = < / span > < span class = cFE > 0xAA55< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l169" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l170" > < / a > < / span > < span class = cF5 > AHCIAtaBlksWrite< / span > < span class = cF0 > (bd, & mbr, < / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cFE > 1< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l171" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l172" > < / a > < / span > < span class = cF5 > BlkDevUnlock< / span > < span class = cF0 > (bd);
< a name = "l173" > < / a > res = < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l174" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l175" > < / a > }
< a name = "l176" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l177" > < / a > < / span > < span class = cF1 > catch< / span > < span class = cF0 >
< a name = "l178" > < / a > < / span > < span class = cF5 > PutExcept< / span > < span class = cF0 > ;
< a name = "l179" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > res;
2021-07-03 05:07:57 +01:00
< a name = "l180" > < / a > }
< / span > < / pre > < / body >
< / html >