⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 registry.html

📁 perl教程
💻 HTML
📖 第 1 页 / 共 5 页
字号:
remote computer, connect to the remote computer's Registry and load
the hive via that.</p>
</dd>
</li>
<dt><strong><a name="item_regnotifychangekeyvalue">RegNotifyChangeKeyValue</a></strong>

<dt><strong><code>RegNotifyChangeKeyValue( $hKey, $bWatchSubtree, $uNotifyFilter, $hEvent, $bAsync )</code></strong>

<dd>
<p>Arranges for your process to be notified when part of the Registry
is changed.  Returns a true value if successful and a false value
[and sets <a href="../../lib/Pod/perlvar.html#item___e"><code>$^E</code></a>/<a href="#item_reglasterror"><code>regLastError()</code></a>] on failure.</p>
</dd>
<dd>
<p><code>$hKey</code> is the handle to a Registry key [either <code>HKEY_*</code> or from
a previous call] for which you wish to be notified when any changes
are made to it.</p>
</dd>
<dd>
<p>If <code>$bWatchSubtree</code> is true, then changes to any subkey or
descendant of <code>$hKey</code> are also reported.</p>
</dd>
<dd>
<p><code>$iNotifyFilter</code> controllers what types of changes are reported.  It
is a numeric value containing one or more of the following bit masks:</p>
</dd>
<dl>
<dt><strong><a name="item_reg_notify_change_name"><code>REG_NOTIFY_CHANGE_NAME</code></a></strong>

<dd>
<p>Notify if a subkey is added or deleted to a monitored key.</p>
</dd>
</li>
<dt><strong><a name="item_reg_notify_change_last_set"><code>REG_NOTIFY_CHANGE_LAST_SET</code></a></strong>

<dd>
<p>Notify if a value in a monitored key is added, deleted, or modified.</p>
</dd>
</li>
<dt><strong><a name="item_reg_notify_change_security"><code>REG_NOTIFY_CHANGE_SECURITY</code></a></strong>

<dd>
<p>Notify if a security descriptor of a monitored key is changed.</p>
</dd>
</li>
<dt><strong><a name="item_reg_notify_change_attributes"><code>REG_NOTIFY_CHANGE_ATTRIBUTES</code></a></strong>

<dd>
<p>Notify if any attributes of a monitored key are changed [class
name or security descriptors].</p>
</dd>
</li>
</dl>
<p><code>$hEvent</code> is ignored unless <code>$bAsync</code> is true.  Otherwise, <code>$hEvent</code>
is a handle to a Win32 <em>event</em> that will be signaled when changes are
to be reported.</p>
<p>If <code>$bAsync</code> is true, then <a href="#item_regnotifychangekeyvalue"><code>RegNotifyChangeKeyValue()</code></a> returns
immediately and uses <code>$hEvent</code> to notify your process of changes.
If <code>$bAsync</code> is false, then <a href="#item_regnotifychangekeyvalue"><code>RegNotifyChangeKeyValue()</code></a> does
not return until there is a change to be notified of.</p>
<p>This routine does not work with Registry keys on remote computers.</p>
<dt><strong><a name="item_regopenkey">RegOpenKey</a></strong>

<dt><strong><code>RegOpenKey( $hKey, $sSubKey, $ohSubKey )</code></strong>

<dd>
<p>This routine is meant only for compatibility with Windows version
3.1.  Use <a href="#item_regopenkeyex"><code>RegOpenKeyEx()</code></a> instead.</p>
</dd>
</li>
<dt><strong><a name="item_regopenkeyex">RegOpenKeyEx</a></strong>

<dt><strong><code>RegOpenKeyEx( $hKey, $sSubKey, $uOptions, $uAccess, $ohSubKey )</code></strong>

<dd>
<p>Opens an existing Registry key.  Returns a true value if successful
and a false value [and sets <a href="../../lib/Pod/perlvar.html#item___e"><code>$^E</code></a>/<a href="#item_reglasterror"><code>regLastError()</code></a>] on failure.</p>
</dd>
<dd>
<p><code>$hKey</code> is the handle to a Registry key [either <code>HKEY_*</code> or from
a previous call].</p>
</dd>
<dd>
<p><code>$sSubKey</code> is the name of an existing subkey to be opened.
Can be <code>&quot;&quot;</code> or <code>[]</code> to open an additional handle to the
key specified by <code>$hKey</code>.</p>
</dd>
<dd>
<p><code>$iOptions</code> is a numeric value containing bits that control options
used while opening the subkey.  There are currently no supported
options so this parameter should be specified as <code>0</code>.</p>
</dd>
<dd>
<p><code>$iAccess</code> is a numeric mask of bits specifying what type of
access is desired when opening the new subkey.  Should be a
combination of one or more of the following bit masks:</p>
</dd>
<dl>
<dt><strong><a name="item_key_all_access"><code>KEY_ALL_ACCESS</code></a></strong>

<dd>
<pre>
    KEY_READ | KEY_WRITE | KEY_CREATE_LINK</pre>
</dd>
<dt><strong><a name="item_key_read"><code>KEY_READ</code></a></strong>

<dd>
<pre>
    KEY_QUERY_VALUE | KEY_ENUMERATE_SUBKEYS | KEY_NOTIFY | STANDARD_RIGHTS_READ</pre>
</dd>
<dt><strong><a name="item_key_write"><code>KEY_WRITE</code></a></strong>

<dd>
<pre>
    KEY_SET_VALUE | KEY_CREATE_SUB_KEY | STANDARD_RIGHTS_WRITE</pre>
</dd>
<dt><strong><a name="item_key_query_value"><code>KEY_QUERY_VALUE</code></a></strong>

<dt><strong><a name="item_key_set_value"><code>KEY_SET_VALUE</code></a></strong>

<dt><strong><a name="item_key_enumerate_sub_keys"><code>KEY_ENUMERATE_SUB_KEYS</code></a></strong>

<dt><strong><a name="item_key_create_sub_key"><code>KEY_CREATE_SUB_KEY</code></a></strong>

<dt><strong><a name="item_key_notify"><code>KEY_NOTIFY</code></a></strong>

<dd>
<p>Allows you to use <a href="#item_regnotifychangekeyvalue"><code>RegNotifyChangeKeyValue()</code></a> on the opened key.</p>
</dd>
</li>
<dt><strong><a name="item_key_execute"><code>KEY_EXECUTE</code></a></strong>

<dd>
<p>Same as <a href="#item_key_read"><code>KEY_READ</code></a>.</p>
</dd>
</li>
<dt><strong><a name="item_key_create_link"><code>KEY_CREATE_LINK</code></a></strong>

<dd>
<p>Gives you permission to create a symbolic link like
<code>HKEY_CLASSES_ROOT</code> and <code>HKEY_CURRENT_USER</code>, though the method for
doing so is not documented [and probably requires use of the mostly
undocumented &quot;native&quot; routines, <code>Nt*()</code> a.k.a. <code>Zw*()</code>].</p>
</dd>
</li>
</dl>
<p><code>$phKey</code> will be set to the handle to be used to access the new subkey
if the call succeeds.</p>
<dt><strong><a name="item_regqueryinfokey">RegQueryInfoKey</a></strong>

<dt><strong><code>RegQueryInfoKey( $hKey, $osClass, $iolClass, $pNull, $ocSubKeys, $olSubKey, $olSubClass, $ocValues, $olValName, $olValData, $olSecDesc, $opftTime )</code></strong>

<dd>
<p>Gets miscellaneous information about an open Registry key.
Returns a true value if successful and a false value [and
sets <a href="../../lib/Pod/perlvar.html#item___e"><code>$^E</code></a>/<a href="#item_reglasterror"><code>regLastError()</code></a>] on failure.</p>
</dd>
<dd>
<p><code>$hKey</code> is the handle to a Registry key [either <code>HKEY_*</code> or from
a previous call].</p>
</dd>
<dd>
<p><code>$sClass</code> will be set to the class name for the key.  Can be
<code>[]</code> if you don't care about the class.</p>
</dd>
<dd>
<p><code>$plClass</code> initially specifies the [minimum] buffer size to be
allocated for <code>$sClass</code> and will be set to the length of the
key's class name.  See <a href="#buffer_sizes">Buffer sizes</a> for more information.
You may omit this parameter to get the same effect as passing in
<code>[]</code> for it.</p>
</dd>
<dd>
<p><code>$pNull</code> is reserved for future use and should be passed as <code>[]</code>.</p>
</dd>
<dd>
<p><code>$pcSubKeys</code> will be set to the count of the number of subkeys
directly under this key.  Can be <code>[]</code>.</p>
</dd>
<dd>
<p><code>$plSubKey</code> will be set to the length of the longest subkey name.
Can be <code>[]</code>.</p>
</dd>
<dd>
<p><code>$plSubClass</code> will be set to the length of the longest class name
used with an immediate subkey of this key.  Can be <code>[]</code>.</p>
</dd>
<dd>
<p><code>$pcValues</code> will be set to the count of the number of values in
this key.  Can be <code>[]</code>.</p>
</dd>
<dd>
<p><code>$plValName</code> will be set to the length of the longest value name
in this key.  Can be <code>[]</code>.</p>
</dd>
<dd>
<p><code>$plValData</code> will be set to the length of the longest value data
in this key.  Can be <code>[]</code>.</p>
</dd>
<dd>
<p><code>$plSecDesc</code> will be set to the length of this key's full security
descriptor.</p>
</dd>
<dd>
<p><code>$pftTime</code> will be set to a <code>FILETIME</code> structure packed
into a Perl string and indicating when this key was last changed.
Can be <code>[]</code>.</p>
</dd>
</li>
<dt><strong><a name="item_regquerymultiplevalues">RegQueryMultipleValues</a></strong>

<dt><strong><code>RegQueryMultipleValues( $hKey, $ioarValueEnts, $icValueEnts, $opBuffer, $iolBuffer )</code></strong>

<dd>
<p>Allows you to use a single call to query several values from a single
open Registry key to maximize efficiency.  Returns a true value if
successful and a false value [and sets <a href="../../lib/Pod/perlvar.html#item___e"><code>$^E</code></a>/<a href="#item_reglasterror"><code>regLastError()</code></a>] on
failure.</p>
</dd>
<dd>
<p><code>$hKey</code> is the handle to a Registry key [either <code>HKEY_*</code> or from
a previous call].</p>
</dd>
<dd>
<p><code>$pValueEnts</code> should contain a list of <code>VALENT</code> structures packed
into a single Perl string.  Each <code>VALENT</code> structure should have
the <code>ve_valuename</code> entry [the first 4 bytes] pointing to a string
containing the name of a value stored in this key.  The remaining
fields are set if the function succeeds.</p>
</dd>
<dd>
<p><code>$cValueEnts</code> should contain the count of the number of <code>VALENT</code>
structures contained in <code>$pValueEnts</code>.</p>
</dd>
<dd>
<p><code>$pBuffer</code> will be set to the data from all of the requested values
concatenated into a single Perl string.</p>
</dd>
<dd>
<p><code>$plBuffer</code> initially specifies the [minimum] buffer size to be
allocated for <code>$sBuffer</code> and will be set to the total length of
the data to be written to <code>$sBuffer</code>.  See <a href="#buffer_sizes">Buffer sizes</a> for
more information.  You may omit this parameter to get the same
effect as passing in <code>[]</code> for it.</p>
</dd>
<dd>
<p>Here is sample code to populate <code>$pValueEnts</code>:</p>
</dd>
<dd>
<pre>
    <span class="comment"># @ValueNames= ...list of value name strings...;</span>
    <span class="variable">$cValueEnts</span><span class="operator">=</span> <span class="variable">@ValueNames</span><span class="operator">;</span>
    <span class="variable">$pValueEnts</span><span class="operator">=</span> <span class="keyword">pack</span><span class="operator">(</span> <span class="string">" p x4 x4 x4 "</span> <span class="operator">x</span> <span class="variable">$cValueEnts</span><span class="operator">,</span> <span class="variable">@ValueNames</span> <span class="operator">);</span>
</pre>
</dd>
<dd>
<p>Here is sample code to retrieve the data type and data length
returned in <code>$pValueEnts</code>:</p>
</dd>
<dd>
<pre>
    <span class="variable">@Lengths</span><span class="operator">=</span> <span class="keyword">unpack</span><span class="operator">(</span> <span class="string">" x4 L x4 x4 "</span> <span class="operator">x</span> <span class="variable">$cValueEnts</span><span class="operator">,</span> <span class="variable">$pValueEnts</span> <span class="operator">);</span>
    <span class="variable">@Types</span><span class="operator">=</span>   <span class="keyword">unpack</span><span class="operator">(</span> <span class="string">" x4 x4 x4 L "</span> <span class="operator">x</span> <span class="variable">$cValueEnts</span><span class="operator">,</span> <span class="variable">$pValueEnts</span> <span class="operator">);</span>
</pre>
</dd>
<dd>
<p>Given the above, and assuming you haven't modified <code>$sBuffer</code> since
the call, you can also extract the value data strings from <code>$sBuffer</code>
by using the pointers returned in <code>$pValueEnts</code>:</p>
</dd>
<dd>
<pre>
    <span class="variable">@Data</span><span class="operator">=</span>    <span class="keyword">unpack</span><span class="operator">(</span>  <span class="keyword">join</span><span class="operator">(</span> <span class="string">""</span><span class="operator">,</span> <span class="keyword">map</span> <span class="operator">{</span><span class="string">" x4 x4 P$_ x4 "</span><span class="operator">}</span> <span class="variable">@Lengths</span> <span class="operator">),</span>
                <span class="variable">$pValueEnts</span>  <span class="operator">);</span>
</pre>
</dd>
<dd>
<p>Much better is to use the lengths and extract directly from
<code>$sBuffer</code> using <a href="../../lib/Pod/perlfunc.html#item_unpack"><code>unpack()</code></a> [or <a href="../../lib/Pod/perlvar.html#item_substr"><code>substr()</code></a>]:</p>
</dd>
<dd>
<pre>
    <span class="variable">@Data</span><span class="operator">=</span> <span class="keyword">unpack</span><span class="operator">(</span> <span class="keyword">join</span><span class="operator">(</span><span class="string">""</span><span class="operator">,</span><span class="keyword">map</span><span class="operator">(</span><span class="string">"P$_"</span><span class="operator">,</span><span class="variable">@Lengths</span><span class="operator">)),</span> <span class="variable">$sBuffer</span> <span class="operator">);</span>
</pre>
</dd>
</li>
<dt><strong><a name="item_regqueryvalue">RegQueryValue</a></strong>

<dt><strong><code>RegQueryValue( $hKey, $sSubKey, $osValueData, $iolValueData )</code></strong>

<dd>
<p>This routine is meant only for compatibility with Windows version
3.1.  Use <a href="#item_regqueryvalueex"><code>RegQueryValueEx()</code></a> instead.  This routine can only

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -