ZealOS/docs/System/Registry.CC.html

265 lines
28 KiB
HTML
Raw Normal View History

2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.08">
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>
<pre style="font-family:monospace;font-size:12pt">
2021-07-03 05:07:57 +01:00
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Registry&quot;</span><span class=cF0>
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>REGISTRY_FILENAME</span><span class=cF0> </span><span class=cF6>&quot;~/Registry.CC&quot;</span><span class=cF0>
<a name="l3"></a>
<a name="l4"></a></span><span class=cF9>CDoc</span><span class=cF0> *</span><span class=cFB>sys_registry_doc</span><span class=cF0> = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l5"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFB>sys_message_flags</span><span class=cF0>[</span><span class=cFE>1</span><span class=cF0>] = {</span><span class=cFE>0</span><span class=cF0>};
<a name="l6"></a></span><span class=cF1>F64</span><span class=cF0> </span><span class=cFB>registry_version</span><span class=cF0>;
<a name="l7"></a>
<a name="l8"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>RegCache</span><span class=cF0>()
<a name="l9"></a>{
<a name="l10"></a> </span><span class=cF1>Bool</span><span class=cF0> old_silent;
2021-07-03 05:07:57 +01:00
<a name="l11"></a>
<a name="l12"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFB>sys_registry_doc</span><span class=cF0>)
<a name="l13"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l14"></a> old_silent = </span><span class=cF5>Silent</span><span class=cF0>;
<a name="l15"></a> </span><span class=cFB>sys_registry_doc</span><span class=cF0> = </span><span class=cF5>DocRead</span><span class=cF0>(</span><span class=cF3>REGISTRY_FILENAME</span><span class=cF0>);
<a name="l16"></a> </span><span class=cF5>Silent</span><span class=cF0>(old_silent);
<a name="l17"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l18"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l19"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l20"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l21"></a>}
<a name="l22"></a>
<a name="l23"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>RegDefault</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *path, </span><span class=cF1>U8</span><span class=cF0> *val, </span><span class=cF1>Bool</span><span class=cF0> is_system_entry=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l24"></a>{</span><span class=cF2>//Add code doc tree branch to registry.</span><span class=cF0>
<a name="l25"></a> </span><span class=cF1>Bool</span><span class=cF0> res, unlock_doc;
2021-07-03 05:07:57 +01:00
<a name="l26"></a>
<a name="l27"></a> </span><span class=cF5>RegCache</span><span class=cF0>;
<a name="l28"></a> unlock_doc = </span><span class=cF5>DocLock</span><span class=cF0>(</span><span class=cFB>sys_registry_doc</span><span class=cF0>);
<a name="l29"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>DocTreeFind</span><span class=cF7>(</span><span class=cFB>sys_registry_doc</span><span class=cF0>, path</span><span class=cF7>)</span><span class=cF0>)
<a name="l30"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l31"></a> </span><span class=cF5>DocTreeMake</span><span class=cF0>(</span><span class=cFB>sys_registry_doc</span><span class=cF0>, path);
<a name="l32"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(</span><span class=cFB>sys_registry_doc</span><span class=cF0>, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, val);
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (is_system_entry)
<a name="l34"></a> {
<a name="l35"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0> == </span><span class=cFB>sys_task</span><span class=cF0>)
<a name="l36"></a> </span><span class=cF5>ExePrint</span><span class=cF0>(</span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, val);
<a name="l37"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l38"></a> </span><span class=cF5>Sys</span><span class=cF0>(</span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, val);
<a name="l39"></a> }
<a name="l40"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DriveIsWritable</span><span class=cF7>(</span><span class=cF0>*</span><span class=cFB>sys_registry_doc</span><span class=cF0>-&gt;filename.name</span><span class=cF7>)</span><span class=cF0>)
<a name="l41"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(</span><span class=cFB>sys_registry_doc</span><span class=cF0>);
<a name="l42"></a> res = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l43"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l44"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l45"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
<a name="l47"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(</span><span class=cFB>sys_registry_doc</span><span class=cF0>);
2021-07-03 05:07:57 +01:00
<a name="l48"></a>
<a name="l49"></a> </span><span class=cF1>return</span><span class=cF0> res;
2021-07-03 05:07:57 +01:00
<a name="l50"></a>}
<a name="l51"></a>
<a name="l52"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>RegExe</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *path)
<a name="l53"></a>{</span><span class=cF2>//Execute doc tree branch in registry.</span><span class=cF0>
<a name="l54"></a> </span><span class=cF5>RegCache</span><span class=cF0>;
2021-07-03 05:07:57 +01:00
<a name="l55"></a>
<a name="l56"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>DocTreeExe</span><span class=cF0>(</span><span class=cFB>sys_registry_doc</span><span class=cF0>, path);
2021-07-03 05:07:57 +01:00
<a name="l57"></a>}
<a name="l58"></a>
<a name="l59"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *path, </span><span class=cF1>U8</span><span class=cF0> *format, ...)
<a name="l60"></a>{</span><span class=cF2>//Rewrite doc tree branch in registry.</span><span class=cF0>
<a name="l61"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
2021-07-03 05:07:57 +01:00
<a name="l62"></a>
<a name="l63"></a> </span><span class=cF5>RegCache</span><span class=cF0>;
<a name="l64"></a> res = </span><span class=cF5>DocTreeWriteJoin</span><span class=cF0>(</span><span class=cFB>sys_registry_doc</span><span class=cF0>, path, </span><span class=cF3>TRUE</span><span class=cF0>, format, argc, argv);
2021-07-03 05:07:57 +01:00
<a name="l65"></a>
<a name="l66"></a> </span><span class=cF1>return</span><span class=cF0> res;
2021-07-03 05:07:57 +01:00
<a name="l67"></a>}
<a name="l68"></a>
<a name="l69"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>RegCount</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *path)
<a name="l70"></a>{</span><span class=cF2>//Tree branch count in registry.</span><span class=cF0>
<a name="l71"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
<a name="l72"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *tree_branch, *start_indent, *end_indent;
<a name="l73"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock_doc = </span><span class=cF5>DocLock</span><span class=cF0>(</span><span class=cFB>sys_registry_doc</span><span class=cF0>);
2021-07-03 05:07:57 +01:00
<a name="l74"></a>
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DocTreeFind</span><span class=cF7>(</span><span class=cFB>sys_registry_doc</span><span class=cF0>, path, &amp;tree_branch, &amp;start_indent, &amp;end_indent</span><span class=cF7>)</span><span class=cF0>)
<a name="l76"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l77"></a> end_indent = end_indent-&gt;next;
<a name="l78"></a> </span><span class=cF1>while</span><span class=cF0> (start_indent != end_indent)
<a name="l79"></a> {
<a name="l80"></a> res++;
<a name="l81"></a> start_indent = start_indent-&gt;next;
<a name="l82"></a> }
<a name="l83"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l84"></a> </span><span class=cF1>if</span><span class=cF0> (unlock_doc)
<a name="l85"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(</span><span class=cFB>sys_registry_doc</span><span class=cF0>);
2021-07-03 05:07:57 +01:00
<a name="l86"></a>
<a name="l87"></a> </span><span class=cF1>return</span><span class=cF0> res;
2021-07-03 05:07:57 +01:00
<a name="l88"></a>}
<a name="l89"></a>
<a name="l90"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>RegAppend</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *path, </span><span class=cF1>U8</span><span class=cF0> *format, ...)
<a name="l91"></a>{</span><span class=cF2>//Append to doc tree branch in registry.</span><span class=cF0>
<a name="l92"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
2021-07-03 05:07:57 +01:00
<a name="l93"></a>
<a name="l94"></a> </span><span class=cF5>RegCache</span><span class=cF0>;
<a name="l95"></a> res = </span><span class=cF5>DocTreeAppendJoin</span><span class=cF0>(</span><span class=cFB>sys_registry_doc</span><span class=cF0>, path, </span><span class=cF3>TRUE</span><span class=cF0>, format, argc, argv);
2021-07-03 05:07:57 +01:00
<a name="l96"></a>
<a name="l97"></a> </span><span class=cF1>return</span><span class=cF0> res;
2021-07-03 05:07:57 +01:00
<a name="l98"></a>}
<a name="l99"></a>
<a name="l100"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>OneTimePopUp</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *_flags, </span><span class=cF9>I64</span><span class=cF0> flag_num, </span><span class=cF1>U8</span><span class=cF0> *message)
<a name="l101"></a>{</span><span class=cF2>//See </span><a href="https://tomawezome.github.io/ZealOS/Apps/X-Caliber/X-Caliber.CC.html#l1"><span class=cF4>::/Apps/X-Caliber/X-Caliber.CC</span></a><span class=cF2>.</span><span class=cF0>
<a name="l102"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l103"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l104"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
2021-07-03 05:07:57 +01:00
<a name="l105"></a>
<a name="l106"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>_flags, flag_num</span><span class=cF7>)</span><span class=cF0>)
<a name="l107"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (message)
<a name="l109"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, message);
<a name="l110"></a> doc_e = </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;\n$CB,\&quot;Do not show this message again.\&quot;,LE=1$&quot;</span><span class=cF0>);
<a name="l111"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;$CM+CX,0,4$$BT,\&quot;OKAY\&quot;,LE=1$\n&quot;</span><span class=cF0>);
<a name="l112"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PopUpMenu</span><span class=cF7>(</span><span class=cF0>doc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cFE>1</span><span class=cF0> &amp;&amp; doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_CHECKED_COLLAPSED</span><span class=cF0>)
<a name="l113"></a> {
<a name="l114"></a> </span><span class=cF5>LBts</span><span class=cF0>(_flags, flag_num);
<a name="l115"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l116"></a> }
<a name="l117"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l118"></a> </span><span class=cF7>}</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l119"></a>
<a name="l120"></a> </span><span class=cF1>return</span><span class=cF0> res;
2021-07-03 05:07:57 +01:00
<a name="l121"></a>}
<a name="l122"></a>
<a name="l123"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>RegOneTimePopUp</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> flag_num, </span><span class=cF1>U8</span><span class=cF0> *message)
<a name="l124"></a>{</span><span class=cF2>//You're not supposed to make system pop-up flags, only me.</span><span class=cF0>
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>OneTimePopUp</span><span class=cF7>(</span><span class=cFB>sys_message_flags</span><span class=cF0>, flag_num,message</span><span class=cF7>)</span><span class=cF0>)
<a name="l126"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>&quot;System/SysMessageFlags&quot;</span><span class=cF0>, </span><span class=cF6>&quot;sys_message_flags[0]=0x%X;\n&quot;</span><span class=cF0>, </span><span class=cFB>sys_message_flags</span><span class=cF0>[</span><span class=cFE>0</span><span class=cF0>]);
2021-07-03 05:07:57 +01:00
<a name="l127"></a>}
<a name="l128"></a>
<a name="l129"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>RegInit</span><span class=cF0>()
<a name="l130"></a>{
<a name="l131"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cF3>STR_LEN</span><span class=cF0>];
<a name="l132"></a> </span><span class=cF1>Bool</span><span class=cF0> version_present;
2021-07-03 05:07:57 +01:00
<a name="l133"></a>
<a name="l134"></a> </span><span class=cF5>RegDefault</span><span class=cF0>(</span><span class=cF6>&quot;System/SysMessageFlags&quot;</span><span class=cF0>, </span><span class=cF6>&quot;sys_message_flags[0]=0;\n&quot;</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l135"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;registry_version=%4.3f;\n&quot;</span><span class=cF0>, </span><span class=cFB>sys_os_version</span><span class=cF0>);
<a name="l136"></a> version_present = </span><span class=cF5>RegDefault</span><span class=cF0>(</span><span class=cF6>&quot;System/SysRegVer&quot;</span><span class=cF0>, buf, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l137"></a> </span><span class=cF5>RegExe</span><span class=cF0>(</span><span class=cF6>&quot;System&quot;</span><span class=cF0>);
<a name="l138"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>registry_version</span><span class=cF0> != </span><span class=cFB>sys_os_version</span><span class=cF0>)
<a name="l139"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l140"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>&quot;System/SysRegVer&quot;</span><span class=cF0>, buf);
<a name="l141"></a> </span><span class=cF5>RegExe</span><span class=cF0>(</span><span class=cF6>&quot;System&quot;</span><span class=cF0>);
<a name="l142"></a> </span><span class=cF7>}</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l143"></a>}
<a name="l144"></a>
<a name="l145"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Boot/Once;Registry/Once&quot;</span><span class=cF0>
<a name="l146"></a>#</span><span class=cF1>help_file</span><span class=cF0> </span><span class=cF6>&quot;::/Doc/Once&quot;</span><span class=cF0>
<a name="l147"></a>
<a name="l148"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SysOnceFlush</span><span class=cF0>()
<a name="l149"></a>{</span><span class=cF2>//Flush SysOnce() buf.</span><span class=cF0>
<a name="l150"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>&quot;Once/System&quot;</span><span class=cF0>, </span><span class=cF6>&quot;&quot;</span><span class=cF0>);
2021-07-03 05:07:57 +01:00
<a name="l151"></a>}
<a name="l152"></a>
<a name="l153"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>OnceFlush</span><span class=cF0>()
<a name="l154"></a>{</span><span class=cF2>//Flush Once() buf.</span><span class=cF0>
<a name="l155"></a> </span><span class=cF5>RegWrite</span><span class=cF0>(</span><span class=cF6>&quot;Once/User&quot;</span><span class=cF0>, </span><span class=cF6>&quot;&quot;</span><span class=cF0>);
2021-07-03 05:07:57 +01:00
<a name="l156"></a>}
<a name="l157"></a>
<a name="l158"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SysOnce</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *format, ...)
<a name="l159"></a>{</span><span class=cF2>//Add System code to </span><a href="https://tomawezome.github.io/ZealOS/Home/Registry.CC.html#l1"><span class=cF4>~/Registry.CC</span></a><span class=cF2>, executed next boot.</span><span class=cF0>
<a name="l160"></a> </span><span class=cF1>U8</span><span class=cF0> *buf = </span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, format, argc, argv);
2021-07-03 05:07:57 +01:00
<a name="l161"></a>
<a name="l162"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>, </span><span class=cF3>RLf_ONCE_SYSTEM</span><span class=cF7>)</span><span class=cF0>)
<a name="l163"></a> </span><span class=cF5>SysOnceFlush</span><span class=cF0>;
<a name="l164"></a> </span><span class=cF5>RegAppend</span><span class=cF0>(</span><span class=cF6>&quot;Once/System&quot;</span><span class=cF0>, </span><span class=cF6>&quot;%s\n&quot;</span><span class=cF0>, buf);
<a name="l165"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
2021-07-03 05:07:57 +01:00
<a name="l166"></a>}
<a name="l167"></a>
<a name="l168"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>Once</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *format, ...)
<a name="l169"></a>{</span><span class=cF2>//Add User code to </span><a href="https://tomawezome.github.io/ZealOS/Home/Registry.CC.html#l1"><span class=cF4>~/Registry.CC</span></a><span class=cF2>, executed next boot.</span><span class=cF0>
<a name="l170"></a> </span><span class=cF1>U8</span><span class=cF0> *buf = </span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, format, argc, argv);
2021-07-03 05:07:57 +01:00
<a name="l171"></a>
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>, </span><span class=cF3>RLf_ONCE_USER</span><span class=cF7>)</span><span class=cF0>)
<a name="l173"></a> </span><span class=cF5>OnceFlush</span><span class=cF0>;
<a name="l174"></a> </span><span class=cF5>RegAppend</span><span class=cF0>(</span><span class=cF6>&quot;Once/User&quot;</span><span class=cF0>, </span><span class=cF6>&quot;%s\n&quot;</span><span class=cF0>, buf);
<a name="l175"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
2021-07-03 05:07:57 +01:00
<a name="l176"></a>}
<a name="l177"></a>
<a name="l178"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SysOnceDrive</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *format, ...)
<a name="l179"></a>{</span><span class=cF2>//Add System code to drv </span><a href="https://tomawezome.github.io/ZealOS/Home/Registry.CC.html#l1"><span class=cF4>~/Registry.CC</span></a><span class=cF2>, executed next boot.</span><span class=cF0>
<a name="l180"></a> </span><span class=cF1>U8</span><span class=cF0> *buf = </span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, format, argc, argv);
<a name="l181"></a> </span><span class=cF9>I64</span><span class=cF0> old_drive_let = *</span><span class=cFB>sys_registry_doc</span><span class=cF0>-&gt;filename.name;
2021-07-03 05:07:57 +01:00
<a name="l182"></a>
<a name="l183"></a> </span><span class=cF1>if</span><span class=cF0> (drv_let)
<a name="l184"></a> *</span><span class=cFB>sys_registry_doc</span><span class=cF0>-&gt;filename.name = drv_let;
<a name="l185"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>, </span><span class=cF3>RLf_ONCE_SYSTEM</span><span class=cF7>)</span><span class=cF0>)
<a name="l186"></a> </span><span class=cF5>SysOnceFlush</span><span class=cF0>;
<a name="l187"></a> </span><span class=cF5>RegAppend</span><span class=cF0>(</span><span class=cF6>&quot;Once/System&quot;</span><span class=cF0>, </span><span class=cF6>&quot;%s\n&quot;</span><span class=cF0>, buf);
<a name="l188"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l189"></a> *</span><span class=cFB>sys_registry_doc</span><span class=cF0>-&gt;filename.name = old_drive_let;
2021-07-03 05:07:57 +01:00
<a name="l190"></a>}
<a name="l191"></a>
<a name="l192"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>OnceDrive</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> drv_let=</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *format, ...)
<a name="l193"></a>{</span><span class=cF2>//Add User code to drv </span><a href="https://tomawezome.github.io/ZealOS/Home/Registry.CC.html#l1"><span class=cF4>~/Registry.CC</span></a><span class=cF2>, executed next boot.</span><span class=cF0>
<a name="l194"></a> </span><span class=cF1>U8</span><span class=cF0> *buf = </span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, format, argc, argv);
<a name="l195"></a> </span><span class=cF9>I64</span><span class=cF0> old_drive_let = *</span><span class=cFB>sys_registry_doc</span><span class=cF0>-&gt;filename.name;
2021-07-03 05:07:57 +01:00
<a name="l196"></a>
<a name="l197"></a> </span><span class=cF1>if</span><span class=cF0> (drv_let)
<a name="l198"></a> *</span><span class=cFB>sys_registry_doc</span><span class=cF0>-&gt;filename.name = drv_let;
<a name="l199"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>, </span><span class=cF3>RLf_ONCE_USER</span><span class=cF7>)</span><span class=cF0>)
<a name="l200"></a> </span><span class=cF5>OnceFlush</span><span class=cF0>;
<a name="l201"></a> </span><span class=cF5>RegAppend</span><span class=cF0>(</span><span class=cF6>&quot;Once/User&quot;</span><span class=cF0>, </span><span class=cF6>&quot;%s\n&quot;</span><span class=cF0>, buf);
<a name="l202"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l203"></a> *</span><span class=cFB>sys_registry_doc</span><span class=cF0>-&gt;filename.name = old_drive_let;
2021-07-03 05:07:57 +01:00
<a name="l204"></a>}
<a name="l205"></a>
<a name="l206"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>OnceExe</span><span class=cF0>()
<a name="l207"></a>{</span><span class=cF2>//Execute Once code. Call goes in </span><a href="https://tomawezome.github.io/ZealOS/Home/Once.CC.html#l1"><span class=cF4>~/Once.CC</span></a><span class=cF2>.</span><span class=cF0>
<a name="l208"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l209"></a> </span><span class=cF7>{</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l210"></a>
<a name="l211"></a> </span><span class=cF5>RegDefault</span><span class=cF0>(</span><span class=cF6>&quot;Once/System&quot;</span><span class=cF0>, </span><span class=cF6>&quot;&quot;</span><span class=cF0>);
<a name="l212"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>RegCount</span><span class=cF7>(</span><span class=cF6>&quot;Once/System&quot;</span><span class=cF7>)</span><span class=cF0> &gt; </span><span class=cFE>2</span><span class=cF0>)
<a name="l213"></a> {
<a name="l214"></a> </span><span class=cF5>Sys</span><span class=cF0>(</span><span class=cF6>&quot;RegExe(\&quot;Once/System\&quot;);&quot;</span><span class=cF0>);
<a name="l215"></a> </span><span class=cF5>SysOnceFlush</span><span class=cF0>;
<a name="l216"></a> }
<a name="l217"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>, </span><span class=cF3>RLf_ONCE_SYSTEM</span><span class=cF0>);
2021-07-03 05:07:57 +01:00
<a name="l218"></a>
<a name="l219"></a> </span><span class=cF5>RegDefault</span><span class=cF0>(</span><span class=cF6>&quot;Once/User&quot;</span><span class=cF0>, </span><span class=cF6>&quot;&quot;</span><span class=cF0>);
<a name="l220"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>RegCount</span><span class=cF7>(</span><span class=cF6>&quot;Once/User&quot;</span><span class=cF7>)</span><span class=cF0> &gt; </span><span class=cFE>2</span><span class=cF0>)
<a name="l221"></a> {
<a name="l222"></a> </span><span class=cF5>RegExe</span><span class=cF0>(</span><span class=cF6>&quot;Once/User&quot;</span><span class=cF0>);
<a name="l223"></a> </span><span class=cF5>OnceFlush</span><span class=cF0>;
<a name="l224"></a> }
<a name="l225"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>, </span><span class=cF3>RLf_ONCE_USER</span><span class=cF0>);
2021-07-03 05:07:57 +01:00
<a name="l226"></a>
<a name="l227"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l228"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l229"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l230"></a> </span><span class=cF5>SysOnceFlush</span><span class=cF0>;
<a name="l231"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>, </span><span class=cF3>RLf_ONCE_SYSTEM</span><span class=cF0>);
<a name="l232"></a> </span><span class=cF5>OnceFlush</span><span class=cF0>;
<a name="l233"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>, </span><span class=cF3>RLf_ONCE_USER</span><span class=cF0>);
<a name="l234"></a> </span><span class=cF7>}</span><span class=cF0>
2021-07-03 05:07:57 +01:00
<a name="l235"></a>}
</span></pre></body>
</html>