📄 registry.html
字号:
query unamed values [a.k.a. "default values"], that is, values with
a name of <code>""</code>.</p>
</dd>
</li>
<dt><strong><a name="item_regqueryvalueex">RegQueryValueEx</a></strong>
<dt><strong><code>RegQueryValueEx( $hKey, $sValueName, $pNull, $ouType, $opValueData, $iolValueData )</code></strong>
<dd>
<p>Lets you look up value data stored in an open Registry key by
specifying the value name. 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>$sValueName</code> is the name of the value whose data you wish to
retrieve.</p>
</dd>
<dd>
<p><code>$pNull</code> this parameter is reserved for future use and should be
specified as <code>[]</code>.</p>
</dd>
<dd>
<p><code>$piType</code> will be set to indicate what type of data is stored in
the named value. Will be set to a <code>REG_*</code> value if the function
succeeds.</p>
</dd>
<dd>
<p><code>$pValueData</code> will be set to the value data [packed into a Perl
string] that is stored in the named value. Can be <code>[]</code> if you
don't care about the value data.</p>
</dd>
<dd>
<p><code>$plValueData</code> initially specifies the [minimum] buffer size to be
allocated for <code>$sValueData</code> and will be set to the size [always
in bytes] of the data to be written to <code>$sValueData</code>, even if
<code>$sValueData</code> is not successfully written to. See <a href="#buffer_sizes">Buffer sizes</a>
for more information.</p>
</dd>
</li>
<dt><strong><a name="item_regreplacekey">RegReplaceKey</a></strong>
<dt><strong><code>RegReplaceKey( $hKey, $sSubKey, $sNewFile, $sOldFile )</code></strong>
<dd>
<p>Lets you replace an entire hive when the system is next booted.
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 that has <code>hive(s)</code>
loaded in it. This must be <code>HKEY_LOCAL_MACHINE</code>,
<code>HKEY_USERS</code>, or a remote version of one of these from
a call to <a href="#item_regconnectregistry"><code>RegConnectRegistry()</code></a>.</p>
</dd>
<dd>
<p><code>$sSubKey</code> is the name of the subkey of <code>$hKey</code> whose hive
you wish to have replaced on the next reboot.</p>
</dd>
<dd>
<p><code>$sNewFile</code> is the name of a file that will replace the existing
hive file when the system reboots.</p>
</dd>
<dd>
<p><code>$sOldFile</code> is the file name to save the current hive file to
when the system reboots.</p>
</dd>
<dd>
<p><code>$sNewFile</code> and <code>$sOldFile</code> are interpretted relative to the
<code>%SystemRoot%/System32/config</code> directory on the computer where
the <code>$hKey</code> key resides [I think]. If either file is [would be]
on a FAT file system, then its name must not have an extension.</p>
</dd>
<dd>
<p>You must have the <code>SE_RESTORE_NAME</code> privilege to use this routine.</p>
</dd>
</li>
<dt><strong><a name="item_regrestorekey">RegRestoreKey</a></strong>
<dt><strong><code>RegRestoreKey( $hKey, $sFileName, $uFlags )</code></strong>
<dd>
<p>Reads in a hive file and copies its contents over an existing
Registry tree. 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>$sFileName</code> is the name of the hive file to be read. For each
value and subkey in this file, a value or subkey will be added
or replaced in <code>$hKey</code>.</p>
</dd>
<dd>
<p><code>$uFlags</code> is usally <code>0</code>. It can also be <code>REG_WHOLE_HIVE_VOLATILE</code>
which, rather than copying the hive over the existing key,
replaces the existing key with a temporary, memory-only Registry
key and then copies the hive contents into it. This option only
works if <code>$hKey</code> is <code>HKEY_LOCAL_MACHINE</code>, <code>HKEY_USERS</code>, or a
remote version of one of these from a call to <a href="#item_regconnectregistry"><code>RegConnectRegistry()</code></a>.</p>
</dd>
<dd>
<p><a href="#item_regrestorekey"><code>RegRestoreKey</code></a> does <em>not</em> delete values nor keys from the
existing Registry tree when there is no corresponding value/key
in the hive file.</p>
</dd>
</li>
<dt><strong><a name="item_regsavekey">RegSaveKey</a></strong>
<dt><strong><code>RegSaveKey( $hKey, $sFileName, $pSecAttr )</code></strong>
<dd>
<p>Dumps any open Registry key and all of its subkeys and values into
a new hive file. 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>$sFileName</code> is the name of the file that the Registry tree
should be saved to. It is interpretted relative to the
<code>%SystemRoot%/System32/config</code> directory on the computer where
the <code>$hKey</code> key resides. If <code>$sFileName</code> is on a FAT file system,
then it must not have an extension.</p>
</dd>
<dd>
<p><code>$pSecAttr</code> contains a <code>SECURITY_ATTRIBUTES</code> structure that specifies
the permissions to be set on the new file that is created. This can
be <code>[]</code>.</p>
</dd>
<dd>
<p>You must have the <code>SE_RESTORE_NAME</code> privilege to use this routine.</p>
</dd>
</li>
<dt><strong><a name="item_regsetkeysecurity">RegSetKeySecurity</a></strong>
<dt><strong><code>RegSetKeySecurity( $hKey, $uSecInfo, $pSecDesc )</code></strong>
<dd>
<p>Sets [part of] the <code>SECURITY_DESCRIPTOR</code> structure describing part
of the security for 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>$uSecInfo</code> is a numeric <code>SECURITY_INFORMATION</code> value that
specifies which <code>SECURITY_DESCRIPTOR</code> structure to set. Should
be <code>OWNER_SECURITY_INFORMATION</code>, <code>GROUP_SECURITY_INFORMATION</code>,
<code>DACL_SECURITY_INFORMATION</code>, or <code>SACL_SECURITY_INFORMATION</code>
or two or more of these bits combined using <code>|</code>.</p>
</dd>
<dd>
<p><code>$pSecDesc</code> contains the new <code>SECURITY_DESCRIPTOR</code> structure
packed into a Perl string.</p>
</dd>
</li>
<dt><strong><a name="item_regsetvalue">RegSetValue</a></strong>
<dt><strong><code>RegSetValue( $hKey, $sSubKey, $uType, $sValueData, $lValueData )</code></strong>
<dd>
<p>This routine is meant only for compatibility with Windows version
3.1. Use <a href="#item_regsetvalueex"><code>RegSetValueEx()</code></a> instead. This routine can only
set unamed values [a.k.a. "default values"].</p>
</dd>
</li>
<dt><strong><a name="item_regsetvalueex">RegSetValueEx</a></strong>
<dt><strong><code>RegSetValueEx( $hKey, $sName, $uZero, $uType, $pData, $lData )</code></strong>
<dd>
<p>Adds or replaces a value in 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>$sName</code> is the name of the value to be set.</p>
</dd>
<dd>
<p><code>$uZero</code> is reserved for future use and should be specified as <code>0</code>.</p>
</dd>
<dd>
<p><code>$uType</code> is the type of data stored in <code>$pData</code>. It should
be a <code>REG_*</code> value.</p>
</dd>
<dd>
<p><code>$pData</code> is the value data packed into a Perl string.</p>
</dd>
<dd>
<p><code>$lData</code> is the length of the value data that is stored in <code>$pData</code>.
You will usually omit this parameter or pass in <code>0</code> to have
<a href="../../lib/Pod/perlfunc.html#item_length"><code>length($pData)</code></a> used. In both of these cases, if <code>$iType</code> is
<code>REG_SZ</code> or <code>REG_EXPAND_SZ</code>, <a href="#item_regsetvalueex"><code>RegSetValueEx()</code></a> will append a
trailing <code>'\0'</code> to the end of <code>$pData</code> [unless there is already
one].</p>
</dd>
</li>
<dt><strong><a name="item_regunloadkey">RegUnLoadKey</a></strong>
<dt><strong><code>RegUnLoadKey( $hKey, $sSubKey )</code></strong>
<dd>
<p>Unloads a previously loaded hive file. That is, closes the
hive file then deletes the subkey that was providing access
to it. 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 that has hives
loaded in it. This must be <code>HKEY_LOCAL_MACHINE</code>, <code>HKEY_USERS</code>,
or a remote version of one of these from a call to
<a href="#item_regconnectregistry"><code>RegConnectRegistry()</code></a>.</p>
</dd>
<dd>
<p><code>$sSubKey</code> is the name of the subkey whose hive you wish to
have unloaded.</p>
</dd>
</li>
<dt><strong><a name="item__3afunca">:FuncA</a></strong>
<dd>
<p>The ASCII-specific function names.</p>
</dd>
<dd>
<p>Each of these is identical to the version listed above without the
trailing "A":</p>
</dd>
<dd>
<pre>
AbortSystemShutdownA InitiateSystemShutdownA
RegConnectRegistryA RegCreateKeyA RegCreateKeyExA
RegDeleteKeyA RegDeleteValueA RegEnumKeyA
RegEnumKeyExA RegEnumValueA RegLoadKeyA
RegOpenKeyA RegOpenKeyExA RegQueryInfoKeyA
RegQueryMultipleValuesA RegQueryValueA RegQueryValueExA
RegReplaceKeyA RegRestoreKeyA RegSaveKeyA
RegSetValueA RegSetValueExA RegUnLoadKeyA</pre>
</dd>
</li>
<dt><strong><a name="item__3afuncw">:FuncW</a></strong>
<dd>
<p>The UNICODE-specific function names. These are the same as the
versions listed above without the trailing "W" except that string
parameters are UNICODE strings rather than ASCII strings, as
indicated.</p>
</dd>
</li>
<dt><strong><a name="item_abortsystemshutdownw">AbortSystemShutdownW</a></strong>
<dt><strong><code>AbortSystemShutdownW( $swComputerName )</code></strong>
<dd>
<p><code>$swComputerName</code> is UNICODE.</p>
</dd>
</li>
<dt><strong><a name="item_initiatesystemshutdownw">InitiateSystemShutdownW</a></strong>
<dt><strong><code>InitiateSystemShutdownW( $swComputer, $swMessage, $uTimeoutSecs, $bForce, $bReboot )</code></strong>
<dd>
<p><code>$swComputer</code> and <code>$swMessage</code> are UNICODE.</p>
</dd>
</li>
<dt><strong><a name="item_regconnectregistryw">RegConnectRegistryW</a></strong>
<dt><strong><code>RegConnectRegistryW( $swComputer, $hRootKey, $ohKey )</code></strong>
<dd>
<p><code>$swComputer</code> is UNICODE.</p>
</dd>
</li>
<dt><strong><a name="item_regcreatekeyw">RegCreateKeyW</a></strong>
<dt><strong><code>RegCreateKeyW( $hKey, $swSubKey, $ohSubKey )</code></strong>
<dd>
<p><code>$swSubKey</code> is UNICODE.</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -