templeos-info/public/Wb/Adam/Opt/Boot/DskISORedSea.HC.HTML

220 lines
22 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;File/CD DVD&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>FillU16Palindrome</span><span class=cF0>(</span><span class=cF9>CPalindromeU16</span><span class=cF0> *dst,</span><span class=cF9>U16</span><span class=cF0> w)
<a name="l4"></a>{
<a name="l5"></a> dst-&gt;big=</span><span class=cF5>EndianU16</span><span class=cF0>(w);
<a name="l6"></a> dst-&gt;little=w;
<a name="l7"></a>}
<a name="l8"></a>
<a name="l9"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>FillU32Palindrome</span><span class=cF0>(</span><span class=cF9>CPalindromeU32</span><span class=cF0> *dst,</span><span class=cF9>I64</span><span class=cF0> d)
<a name="l10"></a>{
<a name="l11"></a> dst-&gt;big=</span><span class=cF5>EndianU32</span><span class=cF0>(d);
<a name="l12"></a> dst-&gt;little=d;
<a name="l13"></a>}
<a name="l14"></a>
<a name="l15"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CElTorito</span><span class=cF0>
<a name="l16"></a>{
<a name="l17"></a> </span><span class=cF9>U16</span><span class=cF0> w[16];
<a name="l18"></a> </span><span class=cF1>U8</span><span class=cF0> bootable; </span><span class=cF2>//88=bootable 00=not bootable</span><span class=cF0>
<a name="l19"></a> </span><span class=cF1>U8</span><span class=cF0> media_type; </span><span class=cF2>//0=no emulation 4=hard disk</span><span class=cF0>
<a name="l20"></a> </span><span class=cF9>U16</span><span class=cF0> load_seg; </span><span class=cF2>//0000-&gt;07C0</span><span class=cF0>
<a name="l21"></a> </span><span class=cF1>U8</span><span class=cF0> sys_type;
<a name="l22"></a> </span><span class=cF1>U8</span><span class=cF0> zero;
<a name="l23"></a> </span><span class=cF9>U16</span><span class=cF0> sect_cnt;
<a name="l24"></a> </span><span class=cF9>U32</span><span class=cF0> load_rba; </span><span class=cF2>//start addr of virtual disk</span><span class=cF0>
<a name="l25"></a> </span><span class=cF1>U8</span><span class=cF0> zero2[20];
<a name="l26"></a>};
<a name="l27"></a>
<a name="l28"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>RedSeaISO9660Stage1</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *iso_filename,</span><span class=cF1>U8</span><span class=cF0> *stage2_filename)
<a name="l29"></a>{
<a name="l30"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> de;
<a name="l31"></a> </span><span class=cF9>CFile</span><span class=cF0> *out_file=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l32"></a> </span><span class=cF1>U8</span><span class=cF0> *stage1_buf=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BOOT_LOADER_SIZE</span><span class=cF0>);
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>FileFind</span><span class=cF7>(</span><span class=cF0>stage2_filename,&amp;de</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF7>(</span><span class=cF0>out_file=</span><span class=cF5>FOpen</span><span class=cF0>(iso_filename,</span><span class=cF6>&quot;wc+&quot;</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l34"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(stage1_buf,</span><span class=cFD>BDVD_START</span><span class=cF0>,</span><span class=cFD>BDVD_END</span><span class=cF0>-</span><span class=cFD>BDVD_START</span><span class=cF0>);
<a name="l35"></a> *(</span><span class=cFD>BDVD_BLK_LO</span><span class=cF0> -</span><span class=cFD>BDVD_START</span><span class=cF0>+stage1_buf)(</span><span class=cF9>U32</span><span class=cF0> *)=de.clus&gt;&gt;2;
<a name="l36"></a> *(</span><span class=cFD>BDVD_BLK_CNT</span><span class=cF0> -</span><span class=cFD>BDVD_START</span><span class=cF0>+stage1_buf)(</span><span class=cF9>U16</span><span class=cF0> *)=
<a name="l37"></a> (de.size+</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>-1)&gt;&gt;(</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>+2);
<a name="l38"></a> *(</span><span class=cFD>BDVD_SHIFT_BLKS</span><span class=cF0> -</span><span class=cFD>BDVD_START</span><span class=cF0>+stage1_buf)(</span><span class=cF9>U16</span><span class=cF0> *)=de.clus&amp;3;
<a name="l39"></a> </span><span class=cF1>if</span><span class=cF0> (de.clus&amp;3)
<a name="l40"></a> *(</span><span class=cFD>BDVD_BLK_CNT</span><span class=cF0> -</span><span class=cFD>BDVD_START</span><span class=cF0>+stage1_buf)(</span><span class=cF9>U16</span><span class=cF0> *)+=1;
<a name="l41"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file,stage1_buf,
<a name="l42"></a> 20&lt;&lt;2+1&lt;&lt;2,</span><span class=cF3>DVD_BOOT_LOADER_SIZE</span><span class=cF0>/</span><span class=cF3>BLK_SIZE</span><span class=cF0>);
<a name="l43"></a> </span><span class=cF5>FClose</span><span class=cF0>(out_file);
<a name="l44"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l45"></a> </span><span class=cF5>Free</span><span class=cF0>(stage1_buf);
<a name="l46"></a>}
<a name="l47"></a>
<a name="l48"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>RedSeaISO9660</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *iso_filename,</span><span class=cF1>U8</span><span class=cF0> drv_let)
<a name="l49"></a>{
<a name="l50"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF5>Let2Drv</span><span class=cF0>(drv_let);
<a name="l51"></a> </span><span class=cF9>CISOPriDesc</span><span class=cF0> *iso_pri=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>),
<a name="l52"></a> *iso_boot=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>),
<a name="l53"></a> *iso_sup=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>),
<a name="l54"></a> *iso_term=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
<a name="l55"></a> </span><span class=cF9>I64</span><span class=cF0> iso_size=0,i,j;
<a name="l56"></a> </span><span class=cF9>U32</span><span class=cF0> *d;
<a name="l57"></a> </span><span class=cF9>CElTorito</span><span class=cF0> *et=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
<a name="l58"></a> </span><span class=cF1>U8</span><span class=cF0> *zero_buf=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
<a name="l59"></a> </span><span class=cF9>CFile</span><span class=cF0> *out_file=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l60"></a>
<a name="l61"></a> </span><span class=cF1>if</span><span class=cF0> (out_file=</span><span class=cF5>FOpen</span><span class=cF7>(</span><span class=cF0>iso_filename,</span><span class=cF6>&quot;wc+&quot;</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l62"></a> iso_size=</span><span class=cF5>FSize</span><span class=cF0>(out_file)/</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>;
<a name="l63"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;dv-&gt;bd-&gt;drv_offset;i+=4)
<a name="l64"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file,zero_buf,i,4);
<a name="l65"></a>
<a name="l66"></a> iso_pri-&gt;type=</span><span class=cF3>ISOT_PRI_VOL_DESC</span><span class=cF0>;
<a name="l67"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(iso_pri-&gt;id,</span><span class=cF6>&quot;CD001&quot;</span><span class=cF0>);
<a name="l68"></a> iso_pri-&gt;version=1;
<a name="l69"></a> </span><span class=cF5>FillU16Palindrome</span><span class=cF0>(&amp;iso_pri-&gt;vol_set_size,1);
<a name="l70"></a> </span><span class=cF5>FillU16Palindrome</span><span class=cF0>(&amp;iso_pri-&gt;vol_seq_num,1);
<a name="l71"></a> </span><span class=cF5>FillU16Palindrome</span><span class=cF0>(&amp;iso_pri-&gt;log_block_size,</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
<a name="l72"></a> </span><span class=cF5>FillU32Palindrome</span><span class=cF0>(&amp;iso_pri-&gt;vol_space_size,iso_size);
<a name="l73"></a> </span><span class=cF5>FillU32Palindrome</span><span class=cF0>(&amp;iso_pri-&gt;root_dir_record,dv-&gt;root_clus);
<a name="l74"></a> iso_pri-&gt;file_structure_version=1;
<a name="l75"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(iso_pri-&gt;publisher_id,</span><span class=cF6>&quot;TempleOS RedSea&quot;</span><span class=cF0>);
<a name="l76"></a>
<a name="l77"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(iso_sup,iso_pri,</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>);
<a name="l78"></a> iso_sup-&gt;type=</span><span class=cF3>ISOT_SUPPLEMENTARY_DESC</span><span class=cF0>;
<a name="l79"></a>
<a name="l80"></a> iso_boot-&gt;type=</span><span class=cF3>ISOT_BOOT_RECORD</span><span class=cF0>;
<a name="l81"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(iso_boot-&gt;id,</span><span class=cF6>&quot;CD001&quot;</span><span class=cF0>);
<a name="l82"></a> iso_boot-&gt;version=1;
<a name="l83"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(iso_boot</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>+7,</span><span class=cF6>&quot;EL TORITO SPECIFICATION&quot;</span><span class=cF0>);
<a name="l84"></a>
<a name="l85"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file,iso_pri,16&lt;&lt;2,4);
<a name="l86"></a> iso_term-&gt;type=</span><span class=cF3>ISOT_TERMINATOR</span><span class=cF0>;
<a name="l87"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(iso_term-&gt;id,</span><span class=cF6>&quot;CD001&quot;</span><span class=cF0>);
<a name="l88"></a> iso_term-&gt;version=1;
<a name="l89"></a>
<a name="l90"></a> d=iso_boot(</span><span class=cF1>U8</span><span class=cF0> *)+0x47;
<a name="l91"></a> *d=20&lt;&lt;2&gt;&gt;2;
<a name="l92"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file,iso_boot,17&lt;&lt;2,4);
<a name="l93"></a>
<a name="l94"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file,iso_sup,18&lt;&lt;2,4);
<a name="l95"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file,iso_term,19&lt;&lt;2,4);
<a name="l96"></a>
<a name="l97"></a> et-&gt;w[0]=1;
<a name="l98"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(&amp;et-&gt;w[2],</span><span class=cF6>&quot;TempleOS&quot;</span><span class=cF0>);
<a name="l99"></a> et-&gt;w[15]=0xAA55;
<a name="l100"></a> j=0;
<a name="l101"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;16;i++) </span><span class=cF2>//Checksum</span><span class=cF0>
<a name="l102"></a> j+=et-&gt;w[i];
<a name="l103"></a> et-&gt;w[14]=-j;
<a name="l104"></a> et-&gt;bootable=0x88;
<a name="l105"></a> et-&gt;media_type=0;</span><span class=cF2>//0=no emu 2=1.44meg 4=hard drive</span><span class=cF0>
<a name="l106"></a> et-&gt;sect_cnt=4; </span><span class=cF2>//5 seems like the limit, 4 is safer</span><span class=cF0>
<a name="l107"></a> et-&gt;load_rba=20&lt;&lt;2&gt;&gt;2+1;
<a name="l108"></a> </span><span class=cF5>FBlkWrite</span><span class=cF0>(out_file,et,20&lt;&lt;2,4);
<a name="l109"></a> </span><span class=cF5>FClose</span><span class=cF0>(out_file);
<a name="l110"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l111"></a> </span><span class=cF5>Free</span><span class=cF0>(zero_buf);
<a name="l112"></a> </span><span class=cF5>Free</span><span class=cF0>(et);
<a name="l113"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_pri);
<a name="l114"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_boot);
<a name="l115"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_sup);
<a name="l116"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_term);
<a name="l117"></a>}
<a name="l118"></a>
<a name="l119"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>RedSeaISOPass1</span><span class=cF0>(</span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde)
<a name="l120"></a>{
<a name="l121"></a> </span><span class=cF9>I64</span><span class=cF0> dir_entry_cnt=3+</span><span class=cF5>LinkedLstCnt</span><span class=cF0>(tmpde),res=0;
<a name="l122"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde) </span><span class=cF7>{</span><span class=cF0>
<a name="l123"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde-&gt;attr &amp; </span><span class=cF3>RS_ATTR_DIR</span><span class=cF0>) {
<a name="l124"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde-&gt;sub)
<a name="l125"></a> res+=</span><span class=cF5>RedSeaISOPass1</span><span class=cF0>(tmpde-&gt;sub);
<a name="l126"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l127"></a> res+=</span><span class=cF3>BLK_SIZE</span><span class=cF0>; </span><span class=cF2>//Empty dir</span><span class=cF0>
<a name="l128"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l129"></a> res+=</span><span class=cF5>CeilU64</span><span class=cF0>(tmpde-&gt;size,</span><span class=cF3>BLK_SIZE</span><span class=cF0>);
<a name="l130"></a> tmpde=tmpde-&gt;next;
<a name="l131"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l132"></a> res+=</span><span class=cF5>CeilU64</span><span class=cF0>(dir_entry_cnt&lt;&lt;6,</span><span class=cF3>BLK_SIZE</span><span class=cF0>); </span><span class=cF2>//Size in bytes</span><span class=cF0>
<a name="l133"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cF3>CDIR_SIZE</span><span class=cF0>==64
<a name="l134"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l135"></a>}
<a name="l136"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>RedSeaISO</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *_iso_filename=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF1>U8</span><span class=cF0> *_src_dir,
<a name="l137"></a> </span><span class=cF1>U8</span><span class=cF0> *_stage2_filename=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l138"></a>{</span><span class=cF2>//See </span><a href="/Wb/Misc/DoDistro.HC.HTML#l1"><span class=cF4>::/Misc/DoDistro.HC</span></a><span class=cF2>. Must be ISO.C</span><span class=cF0>
<a name="l139"></a> </span><span class=cF9>I64</span><span class=cF0> i,res,root_cnt,root_dir_blks,bitmap_blks,bitmap_blks1;
<a name="l140"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde;
<a name="l141"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cF3>STR_LEN</span><span class=cF0>],*iso_filename,*src_dir,*stage2_filename;
<a name="l142"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv=</span><span class=cF5>DrvMakeFreeSlot</span><span class=cF0>(</span><span class=cF5>DrvNextFreeLet</span><span class=cF7>(</span><span class=cF6>'Q'</span><span class=cF7>)</span><span class=cF0>); </span><span class=cF2>//First </span><a href="/Wb/Kernel/KernelA.HH.HTML#l2605"><span class=cF4>BDT_ISO_FILE_WRITE</span></a><span class=cF0>
<a name="l143"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd=</span><span class=cF5>BlkDevNextFreeSlot</span><span class=cF0>(dv-&gt;drv_let,</span><span class=cF3>BDT_ISO_FILE_WRITE</span><span class=cF0>);
<a name="l144"></a>
<a name="l145"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsDir</span><span class=cF7>(</span><span class=cF0>_src_dir</span><span class=cF7>)</span><span class=cF0>)
<a name="l146"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>&quot;'%s' is not a dir.\n&quot;</span><span class=cF0>,_src_dir);
<a name="l147"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l148"></a> </span><span class=cF1>if</span><span class=cF0> (!_iso_filename)
<a name="l149"></a> _iso_filename=</span><span class=cFB>blkdev</span><span class=cF0>.dft_iso_c_filename;
<a name="l150"></a> iso_filename=</span><span class=cF5>ExtChg</span><span class=cF0>(_iso_filename,</span><span class=cF6>&quot;ISO.C&quot;</span><span class=cF0>);
<a name="l151"></a> src_dir=</span><span class=cF5>DirNameAbs</span><span class=cF0>(_src_dir);
<a name="l152"></a> </span><span class=cF1>if</span><span class=cF0> (_stage2_filename) {
<a name="l153"></a> stage2_filename=</span><span class=cF5>FileNameAbs</span><span class=cF0>(_stage2_filename);
<a name="l154"></a> *stage2_filename=dv-&gt;drv_let;
<a name="l155"></a> i=</span><span class=cF5>StrLen</span><span class=cF0>(src_dir);
<a name="l156"></a> </span><span class=cF1>if</span><span class=cF0> (i!=3) </span><span class=cF2>//If not root</span><span class=cF0>
<a name="l157"></a> i++; </span><span class=cF2>//Skip slash</span><span class=cF0>
<a name="l158"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(stage2_filename+3,stage2_filename+i);
<a name="l159"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l160"></a> stage2_filename=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l161"></a> tmpde=</span><span class=cF5>FilesFind</span><span class=cF0>(src_dir,</span><span class=cF3>FUF_RECURSE</span><span class=cF0>);
<a name="l162"></a> root_cnt=</span><span class=cF5>LinkedLstCnt</span><span class=cF0>(tmpde)+3;
<a name="l163"></a> root_dir_blks=</span><span class=cF5>CeilU64</span><span class=cF0>(root_cnt&lt;&lt;6,</span><span class=cF3>BLK_SIZE</span><span class=cF0>)&gt;&gt;</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>;
<a name="l164"></a> </span><span class=cF1>if</span><span class=cF0> (res=</span><span class=cF5>RedSeaISOPass1</span><span class=cF7>(</span><span class=cF0>tmpde</span><span class=cF7>)</span><span class=cF0>&gt;&gt;</span><span class=cF3>BLK_SIZE_BITS</span><span class=cF0>) {
<a name="l165"></a> bd-&gt;drv_offset=19&lt;&lt;2+(</span><span class=cF3>DVD_BLK_SIZE</span><span class=cF0>*2+</span><span class=cF3>DVD_BOOT_LOADER_SIZE</span><span class=cF0>)/</span><span class=cF3>BLK_SIZE</span><span class=cF0>;
<a name="l166"></a> bitmap_blks=1;
<a name="l167"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l168"></a> bitmap_blks1=bitmap_blks;
<a name="l169"></a> bitmap_blks=(res+bitmap_blks+</span><span class=cF3>BLK_SIZE</span><span class=cF0>&lt;&lt;3-1)/</span><span class=cF3>BLK_SIZE</span><span class=cF0>&lt;&lt;3;
<a name="l170"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (bitmap_blks!=bitmap_blks1);
<a name="l171"></a>
<a name="l172"></a> bd-&gt;max_blk=</span><span class=cF5>CeilI64</span><span class=cF0>(bd-&gt;drv_offset+1+bitmap_blks+res,4);
<a name="l173"></a> bd-&gt;max_blk--; </span><span class=cF2>//Inclusive.</span><span class=cF0>
<a name="l174"></a> bd-&gt;file_dsk_name=</span><span class=cF5>AStrNew</span><span class=cF0>(iso_filename);
<a name="l175"></a> bd-&gt;init_root_dir_blks=root_dir_blks;
<a name="l176"></a> </span><span class=cF5>BlkDevAdd</span><span class=cF0>(bd,,</span><span class=cF3>TRUE</span><span class=cF0>,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l177"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(buf,</span><span class=cF6>&quot;%C:/&quot;</span><span class=cF0>,dv-&gt;drv_let);
<a name="l178"></a> </span><span class=cF5>CopyTree</span><span class=cF0>(src_dir,buf,</span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l179"></a> </span><span class=cF5>RedSeaISO9660Stage1</span><span class=cF0>(iso_filename,stage2_filename);
<a name="l180"></a> </span><span class=cF5>DrvDel</span><span class=cF0>(dv);
<a name="l181"></a> </span><span class=cF5>BlkDevDel</span><span class=cF0>(bd);
<a name="l182"></a> }
<a name="l183"></a> </span><span class=cF5>Free</span><span class=cF0>(stage2_filename);
<a name="l184"></a> </span><span class=cF5>Free</span><span class=cF0>(src_dir);
<a name="l185"></a> </span><span class=cF5>Free</span><span class=cF0>(iso_filename);
<a name="l186"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l187"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l188"></a>}
</span></pre></body>
</html>