Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1766 lines
61 KiB

  1. # Registry.pm -- Low-level access to functions/constants from WINREG.h
  2. package Win32API::Registry;
  3. use strict;
  4. use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); #@EXPORT_FAIL);
  5. $VERSION= '0.22';
  6. require Exporter;
  7. require DynaLoader;
  8. @ISA= qw(Exporter DynaLoader);
  9. @EXPORT= qw();
  10. %EXPORT_TAGS= (
  11. Func => [qw( regConstant regLastError
  12. AllowPriv AbortSystemShutdown InitiateSystemShutdown
  13. RegCloseKey RegConnectRegistry RegCreateKey
  14. RegCreateKeyEx RegDeleteKey RegDeleteValue
  15. RegEnumKey RegEnumKeyEx RegEnumValue
  16. RegFlushKey RegGetKeySecurity RegLoadKey
  17. RegNotifyChangeKeyValue RegOpenKey RegOpenKeyEx
  18. RegQueryInfoKey RegQueryMultipleValues RegQueryValue
  19. RegQueryValueEx RegReplaceKey RegRestoreKey
  20. RegSaveKey RegSetKeySecurity RegSetValue
  21. RegSetValueEx RegUnLoadKey )],
  22. FuncA => [qw(
  23. AbortSystemShutdownA InitiateSystemShutdownA
  24. RegConnectRegistryA RegCreateKeyA RegCreateKeyExA
  25. RegDeleteKeyA RegDeleteValueA RegEnumKeyA
  26. RegEnumKeyExA RegEnumValueA RegLoadKeyA
  27. RegOpenKeyA RegOpenKeyExA RegQueryInfoKeyA
  28. RegQueryMultipleValuesA RegQueryValueA RegQueryValueExA
  29. RegReplaceKeyA RegRestoreKeyA RegSaveKeyA
  30. RegSetValueA RegSetValueExA RegUnLoadKeyA )],
  31. FuncW => [qw(
  32. AbortSystemShutdownW InitiateSystemShutdownW
  33. RegConnectRegistryW RegCreateKeyW RegCreateKeyExW
  34. RegDeleteKeyW RegDeleteValueW RegEnumKeyW
  35. RegEnumKeyExW RegEnumValueW RegLoadKeyW
  36. RegOpenKeyW RegOpenKeyExW RegQueryInfoKeyW
  37. RegQueryMultipleValuesW RegQueryValueW RegQueryValueExW
  38. RegReplaceKeyW RegRestoreKeyW RegSaveKeyW
  39. RegSetValueW RegSetValueExW RegUnLoadKeyW )],
  40. HKEY_ => [qw(
  41. HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER
  42. HKEY_DYN_DATA HKEY_LOCAL_MACHINE HKEY_PERFORMANCE_DATA
  43. HKEY_USERS )],
  44. KEY_ => [qw(
  45. KEY_QUERY_VALUE KEY_SET_VALUE KEY_CREATE_SUB_KEY
  46. KEY_ENUMERATE_SUB_KEYS KEY_NOTIFY KEY_CREATE_LINK
  47. KEY_READ KEY_WRITE KEY_EXECUTE
  48. KEY_ALL_ACCESS )],
  49. REG_ => [qw(
  50. REG_OPTION_RESERVED REG_OPTION_NON_VOLATILE REG_OPTION_VOLATILE
  51. REG_OPTION_CREATE_LINK REG_OPTION_BACKUP_RESTORE
  52. REG_OPTION_OPEN_LINK REG_LEGAL_OPTION REG_CREATED_NEW_KEY
  53. REG_OPENED_EXISTING_KEY REG_WHOLE_HIVE_VOLATILE REG_REFRESH_HIVE
  54. REG_NO_LAZY_FLUSH REG_NOTIFY_CHANGE_ATTRIBUTES
  55. REG_NOTIFY_CHANGE_NAME REG_NOTIFY_CHANGE_LAST_SET
  56. REG_NOTIFY_CHANGE_SECURITY REG_LEGAL_CHANGE_FILTER
  57. REG_NONE REG_SZ REG_EXPAND_SZ
  58. REG_BINARY REG_DWORD REG_DWORD_LITTLE_ENDIAN
  59. REG_DWORD_BIG_ENDIAN REG_LINK REG_MULTI_SZ
  60. REG_RESOURCE_LIST REG_FULL_RESOURCE_DESCRIPTOR
  61. REG_RESOURCE_REQUIREMENTS_LIST )],
  62. SE_ => [qw(
  63. SE_ASSIGNPRIMARYTOKEN_NAME SE_AUDIT_NAME
  64. SE_BACKUP_NAME SE_CHANGE_NOTIFY_NAME
  65. SE_CREATE_PAGEFILE_NAME SE_CREATE_PERMANENT_NAME
  66. SE_CREATE_TOKEN_NAME SE_DEBUG_NAME
  67. SE_INCREASE_QUOTA_NAME SE_INC_BASE_PRIORITY_NAME
  68. SE_LOAD_DRIVER_NAME SE_LOCK_MEMORY_NAME
  69. SE_MACHINE_ACCOUNT_NAME SE_PROF_SINGLE_PROCESS_NAME
  70. SE_REMOTE_SHUTDOWN_NAME SE_RESTORE_NAME
  71. SE_SECURITY_NAME SE_SHUTDOWN_NAME
  72. SE_SYSTEMTIME_NAME SE_SYSTEM_ENVIRONMENT_NAME
  73. SE_SYSTEM_PROFILE_NAME SE_TAKE_OWNERSHIP_NAME
  74. SE_TCB_NAME SE_UNSOLICITED_INPUT_NAME )],
  75. );
  76. @EXPORT_OK= ();
  77. { my $ref;
  78. foreach $ref ( values(%EXPORT_TAGS) ) {
  79. push( @EXPORT_OK, @$ref ) unless $ref->[0] =~ /^SE_/;
  80. }
  81. }
  82. $EXPORT_TAGS{ALL}= [ @EXPORT_OK ]; # \@EXPORT_OK once SE_* settles down.
  83. # push( @EXPORT_OK, "JHEREG_TACOSALAD" ); # Used to test Mkconst2perl
  84. push( @EXPORT_OK, @{$EXPORT_TAGS{SE_}} );
  85. bootstrap Win32API::Registry $VERSION;
  86. # Preloaded methods go here.
  87. # To convert C constants to Perl code in cRegistry.pc
  88. # [instead of C or C++ code in cRegistry.h]:
  89. # * Modify F<Makefile.PL> to add WriteMakeFile() =>
  90. # CONST2PERL/postamble => [[ "Win32API::Registry" => ]] WRITE_PERL => 1.
  91. # * Either comment out C<#include "cRegistry.h"> from F<Registry.xs>
  92. # or make F<cRegistry.h> an empty file.
  93. # * Make sure the following C<if> block is not commented out.
  94. # * "nmake clean", "perl Makefile.PL", "nmake"
  95. if( ! defined &REG_NONE ) {
  96. require "Win32API/Registry/cRegistry.pc";
  97. }
  98. # This would be convenient but inconsistant and hard to explain:
  99. #push( @{$EXPORT_TAGS{ALL}}, @{$EXPORT_TAGS{SE_}} )
  100. # if defined &SE_TCB_NAME;
  101. sub regConstant
  102. {
  103. my( $name )= @_;
  104. if( 1 != @_ || ! $name || $name =~ /\W/ ) {
  105. require Carp;
  106. Carp::croak( 'Usage: ',__PACKAGE__,'::regConstant("CONST_NAME")' );
  107. }
  108. my $proto= prototype $name;
  109. if( defined \&$name
  110. && defined $proto
  111. && "" eq $proto ) {
  112. no strict 'refs';
  113. return &$name;
  114. }
  115. return undef;
  116. }
  117. # We provide this for backwards compatibility:
  118. sub constant
  119. {
  120. my( $name )= @_;
  121. my $value= regConstant( $name );
  122. if( defined $value ) {
  123. $!= 0;
  124. return $value;
  125. }
  126. $!= 11; # EINVAL
  127. return 0;
  128. }
  129. BEGIN {
  130. my $code= 'return _regLastError(@_)';
  131. local( $!, $^E )= ( 1, 1 );
  132. if( $! ne $^E ) {
  133. $code= '
  134. local( $^E )= _regLastError(@_);
  135. my $ret= $^E;
  136. return $ret;
  137. ';
  138. }
  139. eval "sub regLastError { $code }";
  140. die "$@" if $@;
  141. }
  142. # Since we ISA DynaLoader which ISA AutoLoader, we ISA AutoLoader so we
  143. # need this next chunk to prevent Win32API::Registry->nonesuch() from
  144. # looking for "nonesuch.al" and producing confusing error messages:
  145. use vars qw($AUTOLOAD);
  146. sub AUTOLOAD {
  147. require Carp;
  148. Carp::croak(
  149. "Can't locate method $AUTOLOAD via package Win32API::Registry" );
  150. }
  151. # Replace "&rout;" with "goto &rout;" when that is supported on Win32.
  152. # Let user omit all buffer sizes:
  153. sub RegEnumKeyExA {
  154. if( 6 == @_ ) { splice(@_,4,0,[]); splice(@_,2,0,[]); }
  155. &_RegEnumKeyExA;
  156. }
  157. sub RegEnumKeyExW {
  158. if( 6 == @_ ) { splice(@_,4,0,[]); splice(@_,2,0,[]); }
  159. &_RegEnumKeyExW;
  160. }
  161. sub RegEnumValueA {
  162. if( 6 == @_ ) { splice(@_,2,0,[]); push(@_,[]); }
  163. &_RegEnumValueA;
  164. }
  165. sub RegEnumValueW {
  166. if( 6 == @_ ) { splice(@_,2,0,[]); push(@_,[]); }
  167. &_RegEnumValueW;
  168. }
  169. sub RegQueryInfoKeyA {
  170. if( 11 == @_ ) { splice(@_,2,0,[]); }
  171. &_RegQueryInfoKeyA;
  172. }
  173. sub RegQueryInfoKeyW {
  174. if( 11 == @_ ) { splice(@_,2,0,[]); }
  175. &_RegQueryInfoKeyW;
  176. }
  177. sub RegEnumKeyA {
  178. push(@_,[]) if 3 == @_;
  179. &_RegEnumKeyA;
  180. }
  181. sub RegEnumKeyW {
  182. push(@_,[]) if 3 == @_;
  183. &_RegEnumKeyW;
  184. }
  185. sub RegGetKeySecurity {
  186. push(@_,[]) if 3 == @_;
  187. &_RegGetKeySecurity;
  188. }
  189. sub RegQueryMultipleValuesA {
  190. push(@_,[]) if 4 == @_;
  191. &_RegQueryMultipleValuesA;
  192. }
  193. sub RegQueryMultipleValuesW {
  194. push(@_,[]) if 4 == @_;
  195. &_RegQueryMultipleValuesW;
  196. }
  197. sub RegQueryValueA {
  198. push(@_,[]) if 3 == @_;
  199. &_RegQueryValueA;
  200. }
  201. sub RegQueryValueW {
  202. push(@_,[]) if 3 == @_;
  203. &_RegQueryValueW;
  204. }
  205. sub RegQueryValueExA {
  206. push(@_,[]) if 5 == @_;
  207. &_RegQueryValueExA;
  208. }
  209. sub RegQueryValueExW {
  210. push(@_,[]) if 5 == @_;
  211. &_RegQueryValueExW;
  212. }
  213. sub RegSetValueA {
  214. push(@_,0) if 4 == @_;
  215. &_RegSetValueA;
  216. }
  217. sub RegSetValueW {
  218. push(@_,0) if 4 == @_;
  219. &_RegSetValueW;
  220. }
  221. sub RegSetValueExA {
  222. push(@_,0) if 5 == @_;
  223. &_RegSetValueExA;
  224. }
  225. sub RegSetValueExW {
  226. push(@_,0) if 5 == @_;
  227. &_RegSetValueExW;
  228. }
  229. # Aliases for non-Unicode functions:
  230. sub AbortSystemShutdown { &AbortSystemShutdownA; }
  231. sub InitiateSystemShutdown { &InitiateSystemShutdownA; }
  232. sub RegConnectRegistry { &RegConnectRegistryA; }
  233. sub RegCreateKey { &RegCreateKeyA; }
  234. sub RegCreateKeyEx { &RegCreateKeyExA; }
  235. sub RegDeleteKey { &RegDeleteKeyA; }
  236. sub RegDeleteValue { &RegDeleteValueA; }
  237. sub RegEnumKey { &RegEnumKeyA; }
  238. sub RegEnumKeyEx { &RegEnumKeyExA; }
  239. sub RegEnumValue { &RegEnumValueA; }
  240. sub RegLoadKey { &RegLoadKeyA; }
  241. sub RegOpenKey { &RegOpenKeyA; }
  242. sub RegOpenKeyEx { &RegOpenKeyExA; }
  243. sub RegQueryInfoKey { &RegQueryInfoKeyA; }
  244. sub RegQueryMultipleValues { &RegQueryMultipleValuesA; }
  245. sub RegQueryValue { &RegQueryValueA; }
  246. sub RegQueryValueEx { &RegQueryValueExA; }
  247. sub RegReplaceKey { &RegReplaceKeyA; }
  248. sub RegRestoreKey { &RegRestoreKeyA; }
  249. sub RegSaveKey { &RegSaveKeyA; }
  250. sub RegSetValue { &RegSetValueA; }
  251. sub RegSetValueEx { &RegSetValueExA; }
  252. sub RegUnLoadKey { &RegUnLoadKeyA; }
  253. 1;
  254. __END__
  255. =head1 NAME
  256. Win32API::Registry - Low-level access to Win32 system API calls from WINREG.H
  257. =head1 SYNOPSIS
  258. use Win32API::Registry 0.21 qw( :ALL );
  259. RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SYSTEM\\Disk", 0, KEY_READ, $key );
  260. or die "Can't open HKEY_LOCAL_MACHINE\\SYSTEM\\Disk: ",
  261. regLastError(),"\n";
  262. RegQueryValueEx( $key, "Information", [], $type, $data, [] );
  263. or die "Can't read HKEY_L*MACHINE\\SYSTEM\\Disk\\Information: ",
  264. regLastError(),"\n";
  265. [...]
  266. RegCloseKey( $key )
  267. or die "Can't close HKEY_LOCAL_MACHINE\\SYSTEM\\Disk: ",
  268. regLastError(),"\n";
  269. =head1 DESCRIPTION
  270. This provides fairly low-level access to the Win32 System API
  271. calls dealing with the Registry [mostly from WINREG.H]. This
  272. is mostly intended to be used by other modules such as
  273. C<Win32::TieRegistry> [which provides an extremely Perl-friendly
  274. method for using the Registry].
  275. For a description of the logical structure of the Registry, see
  276. the documentation for the C<Win32::TieRegistry> module.
  277. To pass in C<NULL> as the pointer to an optional buffer, pass in
  278. an empty list reference, C<[]>.
  279. Beyond raw access to the API calls and related constants, this module
  280. handles smart buffer allocation and translation of return codes.
  281. All calls return a true value for success and a false value for
  282. failure. After any failure, C<$^E> should automatically be set
  283. to indicate the reason. However, current versions of Perl often
  284. overwrite C<$^E> too quickly, so you can use C<regLastError()>
  285. instead, which is only set by Win32API::Registry routines.
  286. C<regLastError()> is also good if you have a really old version
  287. of Perl that does not connect C<$^E> to C<GetLastError()> on
  288. Win32.
  289. Note that C<$!> is not set by these routines except by
  290. C<Win32API::Registry::constant()> when a constant is not defined.
  291. =head2 Exports
  292. Nothing is exported by default. The following tags can be used to
  293. have sets of symbols exported.
  294. [Note that much of the following documentation refers to the
  295. behavior of the underlying API calls which may vary in current
  296. and future versions of the Win32 API without any changes to this
  297. module. Therefore you should check the Win32 API documentation
  298. directly when needed.]
  299. =over
  300. =item :Func
  301. The basic function names:
  302. =over
  303. =item AllowPriv
  304. =item C<AllowPriv( $sPrivName, $bEnable )>
  305. Not a Win32 API call. Enables or disables a specific privilege for
  306. the current process. Returns a true value if successful and a false
  307. value [and sets C<$^E>/C<regLastError()>] on failure. This routine
  308. does not provide a way to tell if a privilege is currently enabled.
  309. C<$sPrivname> is a Win32 privilege name [see L</:SE_>]. For example,
  310. C<"SeBackupPrivilege"> [a.k.a. C<SE_BACKUP_NAME>] controls whether
  311. you can use C<RegSaveKey()> and C<"SeRestorePrivilege"> [a.k.a.
  312. C<SE_RESTORE_NAME>] controls whether you can use C<RegLoadKey()>.
  313. If C<$bEnable> is true, then C<AllowPriv()> tries to enable the
  314. privilege. Otherwise it tries to disable the privilege.
  315. =item AbortSystemShutdown
  316. =item C<AbortSystemShutdown( $sComputerName )>
  317. Tries to abort a remote shutdown request previously made via
  318. C<InitiateSystemShutdown()>. Returns a true value if successful
  319. and a false value [and sets C<$^E>/C<regLastError()>] on failure.
  320. =item InitiateSystemShutdown
  321. =item C<InitiateSystemShutdown( $sComputer, $sMessage, $uTimeoutSecs, $bForce, $bReboot )>
  322. Requests that a [remote] computer be shutdown or rebooted.
  323. Returns a true value if successful and a false value [and
  324. sets C<$^E>/C<regLastError()>] on failure.
  325. C<$sComputer> is the name [or address] of the computer to be
  326. shutdown or rebooted. You can use C<[]> [for C<NULL>] or C<"">
  327. to indicate the local computer.
  328. C<$sMessage> is the message to be displayed in a pop-up window
  329. on the desktop of the computer to be shutdown or rebooted until
  330. the timeout expires or the shutdown is aborted via
  331. C<AbortSystemShutdown()>. With C<$iTimeoutSecs == 0>, the
  332. message will never be visible.
  333. C<$iTimeoutSecs> is the number of seconds to wait before starting
  334. the shutdown.
  335. If C<$bForce> is false, then any applications running on the remote
  336. computer get a chance to prompt the remote user whether they want
  337. to save changes. Also, for any applications that do not exit quickly
  338. enough, the operating system will prompt the user whether they wish
  339. to wait longer for the application to exit or force it to exit now.
  340. At any of these prompts the user can press B<CANCEL> to abort the
  341. shutdown but if no applications have unsaved data, they will likely
  342. all exit quickly and the shutdown will progress with the remote user
  343. having no option to cancel the shutdown.
  344. If C<$bForce> is true, all applications are told to exit immediately
  345. and so will not prompt the user even if there is unsaved data. Any
  346. applications that take too long to exit will be forcibly killed after
  347. a short time. The only way to abort the shutdown is to call
  348. C<AbortSystemShutdown()> before the timeout expires and there is no
  349. way to abort the shutdown once it has begun.
  350. If C<$bReboot> is true, the computer will automatically reboot once
  351. the shutdown is complete. If C<$bReboot> is false, then when the
  352. shutdown is complete the computer will halt at a screen indicating
  353. that the shutdown is complete and offering a way for the user to
  354. start to boot the computer.
  355. You must have the C<"SeRemoteShutdownPrivilege"> privilege
  356. on the remote computer for this call to succeed. If shutting
  357. down the local computer, then the calling process must have
  358. the C<"SeShutdownPrivilege"> privilege and have it enabled.
  359. =item RegCloseKey
  360. =item C<RegCloseKey( $hKey )>
  361. Closes the handle to a Registry key returned by C<RegOpenKeyEx()>,
  362. C<RegConnectRegistry()>, C<RegCreateKeyEx()>, or a few other
  363. routines. Returns a true value if successful and a false value
  364. [and sets C<$^E>/C<regLastError()>] on failure.
  365. =item RegConnectRegistry
  366. =item C<RegConnectRegistry( $sComputer, $hRootKey, $ohKey )>
  367. Connects to one of the root Registry keys of a remote computer.
  368. Returns a true value if successful and a false value [and
  369. sets C<$^E>/C<regLastError()>] on failure.
  370. C<$sComputer> is the name [or address] of a remote computer
  371. whose Registry you wish to access.
  372. C<$hKey> must be either C<HKEY_LOCAL_MACHINE> or C<HKEY_USERS>
  373. and specifies which root Registry key on the remote computer
  374. you wish to have access to.
  375. C<$phKey> will be set to the handle to be used to access the
  376. remote Registry key if the call succeeds.
  377. =item regConstant
  378. =item C<$value= regConstant( $sConstantName )>
  379. Fetch the value of a constant. Returns C<undef> if C<$sConstantName>
  380. is not the name of a constant supported by this module. Never sets
  381. C<$!> nor C<$^E>.
  382. This function is rarely used since you will usually get the value of a
  383. constant by having that constant imported into your package by listing
  384. the constant name in the C<use Win32API::Registry> statement and then
  385. simply using the constant name in your code [perhaps followed by
  386. C<()>]. This function is useful for verifying constant names not in
  387. Perl code, for example, after prompting a user to type in a constant
  388. name.
  389. =item RegCreateKey
  390. =item C<RegCreateKey( $hKey, $sSubKey, $ohSubKey )>
  391. This routine is meant only for compatibility with Windows version
  392. 3.1. Use C<RegCreateKeyEx()> instead.
  393. =item RegCreateKeyEx
  394. =item C<RegCreateKeyEx( $hKey, $sSubKey, $uZero, $sClass, $uOpts, $uAccess, $pSecAttr, $ohNewKey, $ouDisp )>
  395. Creates a new Registry subkey. Returns a true value if successful and
  396. a false value [and sets C<$^E>/C<regLastError()>] on failure.
  397. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  398. a previous call].
  399. C<$sSubKey> is the name of the new subkey to be created.
  400. C<$iZero> is reserved for future use and should always be specified
  401. as C<0>.
  402. C<$sClass> is a string to be used as the class for the new
  403. subkey. We are not aware of any current use for Registry key
  404. class information so the empty string, C<"">, should usually
  405. be used here.
  406. C<$iOpts> is a numeric value containing bits that control options
  407. used while creating the new subkey. C<REG_OPTION_NON_VOLATILE>
  408. is the default. C<REG_OPTION_VOLATILE> [which is ignored on
  409. Windows 95] means the data stored under this key is not kept
  410. in a file and will not be preserved when the system reboots.
  411. C<REG_OPTION_BACKUP_RESTORE> [also ignored on Windows 95] means
  412. ignore the C<$iAccess> parameter and try to open the new key with
  413. the access required to backup or restore the key.
  414. C<$iAccess> is a numeric mask of bits specifying what type of
  415. access is desired when opening the new subkey. See C<RegOpenKeyEx()>.
  416. C<$pSecAttr> is a C<SECURITY_ATTRIBUTES> structure packed into
  417. a Perl string which controls whether the returned handle can be
  418. inherited by child processes. Normally you would pass C<[]> for
  419. this parameter to have C<NULL> passed to the underlying API
  420. indicating that the handle cannot be inherited. If not under
  421. Windows95, then C<$pSecAttr> also allows you to specify
  422. C<SECURITY_DESCRIPTOR> that controls which users will have
  423. what type of access to the new key -- otherwise the new key
  424. inherits its security from its parent key.
  425. C<$phKey> will be set to the handle to be used to access the new
  426. subkey if the call succeeds.
  427. C<$piDisp> will be set to either C<REG_CREATED_NEW_KEY> or
  428. C<REG_OPENED_EXISTING_KEY> to indicate for which reason the
  429. call succeeded. Can be specified as C<[]> if you don't care.
  430. If C<$phKey> and C<$piDisp> start out as integers, then they will
  431. probably remain unchanged if the call fails.
  432. =item RegDeleteKey
  433. =item C<RegDeleteKey( $hKey, $sSubKey )>
  434. Deletes a subkey of an open Registry key provided that the subkey
  435. contains no subkeys of its own [but the subkey may contain values].
  436. Returns a true value if successful and a false value [and sets
  437. C<$^E>/C<regLastError()>] on failure.
  438. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  439. a previous call].
  440. C<$sSubKey> is the name of the subkey to be deleted.
  441. =item RegDeleteValue
  442. =item C<RegDeleteValue( $hKey, $sValueName )>
  443. Deletes a value from an open Registry key. Returns a true value if
  444. successful and a false value [and sets C<$^E>/C<regLastError()>] on
  445. failure.
  446. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  447. a previous call].
  448. C<$sValueKey> is the name of the value to be deleted.
  449. =item RegEnumKey
  450. =item C<RegEnumKey( $hKey, $uIndex, $osName, $ilNameSize )>
  451. This routine is meant only for compatibility with Windows version
  452. 3.1. Use C<RegEnumKeyEx()> instead.
  453. =item RegEnumKeyEx
  454. =item C<RegEnumKeyEx( $hKey, $uIndex, $osName, $iolName, $pNull, $osClass, $iolClass, $opftLastWrite )>
  455. Lets you enumerate the names of all of the subkeys directly under
  456. an open Registry key. Returns a true value if successful and a false
  457. value [and sets C<$^E>/C<regLastError()>] on failure.
  458. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  459. a previous call].
  460. C<$iIndex> is the sequence number of the immediate subkey that
  461. you want information on. Start with this value as C<0> then
  462. repeat the call incrementing this value each time until the
  463. call fails with C<$^E>/C<regLastError()> numerically equal to
  464. C<ERROR_NO_MORE_ITEMS>.
  465. C<$sName> will be set to the name of the subkey. Can be C<[]> if
  466. you don't care about the name.
  467. C<$plName> initially specifies the [minimum] buffer size to be
  468. allocated for C<$sName>. Will be set to the length of the subkey
  469. name if the requested subkey exists even if C<$sName> isn't
  470. successfully set to the subkey name. See L<Buffer sizes> for
  471. more information.
  472. C<$pNull> is reserved for future used and should be passed as C<[]>.
  473. C<$sClass> will be set to the class name for the subkey. Can be
  474. C<[]> if you don't care about the class.
  475. C<$plClass> initially specifies the [minimum] buffer size to be
  476. allocated for C<$sClass> and will be set to the length of the
  477. subkey class name if the requested subkey exists. See L<Buffer
  478. sizes> for more information.
  479. C<$pftLastWrite> will be set to a C<FILETIME> structure packed
  480. into a Perl string and indicating when the subkey was last changed.
  481. Can be C<[]>.
  482. You may omit both C<$plName> and C<$plClass> to get the same effect
  483. as passing in C<[]> for each of them.
  484. =item RegEnumValue
  485. =item C<RegEnumValue( $hKey, $uIndex, $osValName, $iolValName, $pNull, $ouType, $opValData, $iolValData )>
  486. Lets you enumerate the names of all of the values contained in an
  487. open Registry key. Returns a true value if successful and a false
  488. value [and sets C<$^E>/C<regLastError()>] on failure.
  489. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  490. a previous call].
  491. C<$iIndex> is the sequence number of the value that you want
  492. information on. Start with this value as C<0> then repeat the
  493. call incrementing this value each time until the call fails with
  494. C<ERROR_NO_MORE_ITEMS>.
  495. C<$sValName> will be set to the name of the value. Can be C<[]>
  496. if you don't care about the name.
  497. C<$plValName> initially specifies the [minimum] buffer size to be
  498. allocated for C<$sValName>. Will be set to the length of the value
  499. name if the requested value exists even if C<$sValName> isn't
  500. successfully set to the value name. See L<Buffer sizes> for
  501. more information.
  502. C<$pNull> is reserved for future used and should be passed as C<[]>.
  503. C<$piType> will be set to the type of data stored in the value data.
  504. If the call succeeds, it will be set to a C<REG_*> value unless
  505. passed in as C<[]>.
  506. C<$pValData> will be set to the data [packed into a Perl string]
  507. that is stored in the requested value. Can be C<[]> if you don't
  508. care about the value data.
  509. C<$plValData> initially specifies the [minimum] buffer size to be
  510. allocated for C<$sValData> and will be set to the length of the
  511. value data if the requested value exists. See L<Buffer sizes> for
  512. more information.
  513. You may omit both C<$plValName> and C<$plValData> to get the same
  514. effect as passing in C<[]> for each of them.
  515. =item RegFlushKey
  516. =item C<RegFlushKey( $hKey )>
  517. Forces the data stored under an open Registry key to be flushed
  518. to the disk file where the data is preserved between reboots.
  519. Forced flushing is not guaranteed to be efficient so this routine
  520. should almost never be called. Returns a true value if successful
  521. and a false value [and sets C<$^E>/C<regLastError()>] on failure.
  522. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  523. a previous call].
  524. =item RegGetKeySecurity
  525. =item C<RegGetKeySecurity( $hKey, $uSecInfo, $opSecDesc, $iolSecDesc )>
  526. Retrieves one of the C<SECURITY_DESCRIPTOR> structures describing
  527. part of the security for an open Registry key. Returns a true value
  528. if successful and a false value [and sets C<$^E>/C<regLastError()>]
  529. on failure.
  530. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  531. a previous call].
  532. C<$iSecInfo> is a numeric C<SECURITY_INFORMATION> value that
  533. specifies which parts of the C<SECURITY_DESCRIPTOR> structure
  534. to retrieve. Should be C<OWNER_SECURITY_INFORMATION>,
  535. C<GROUP_SECURITY_INFORMATION>, C<DACL_SECURITY_INFORMATION>, or
  536. or C<SACL_SECURITY_INFORMATION> or two or more of these bits
  537. combined using C<|>.
  538. C<$pSecDesc> will be set to the requested C<SECURITY_DESCRIPTOR>
  539. structure [packed into a Perl string].
  540. C<$plSecDesc> initially specifies the [minimum] buffer size to be
  541. allocated for C<$sSecDesc> and will be set to the length of the
  542. security descriptor. See L<Buffer sizes> for more information.
  543. You may omit this parameter to get the same effect as passing in
  544. C<[]> for it.
  545. =item regLastError
  546. =item C<$svError= regLastError();>
  547. =item C<regLastError( $uError );>
  548. Returns the last error encountered by a routine from this module.
  549. It is just like C<$^E> except it isn't changed by anything except
  550. routines from this module. Ideally you could just use C<$^E>, but
  551. current versions of Perl often overwrite C<$^E> before you get a
  552. chance to check it and really old versions of Perl don't really
  553. support C<$^E> under Win32.
  554. Just like C<$^E>, in a numeric context C<regLastError()> returns
  555. the numeric error value while in a string context it returns a
  556. text description of the error [actually it returns a Perl scalar
  557. that contains both values so C<$x= regLastError()> causes C<$x>
  558. to give different values in string vs. numeric contexts]. On old
  559. versions of Perl where C<$^E> isn't tied to C<GetLastError()>,
  560. C<regLastError> simply returns the number of the error and you'll
  561. need to use <Win32::FormatMessage> to get the error string.
  562. The last form sets the error returned by future calls to
  563. C<regLastError()> and should not be used often. C<$uError> must
  564. be a numeric error code. Also returns the dual-valued version
  565. of C<$uError>.
  566. =item RegLoadKey
  567. =item C<RegLoadKey( $hKey, $sSubKey, $sFileName )>
  568. Loads a hive file. That is, it creates a new subkey in the
  569. Registry and associates that subkey with a disk file that contains
  570. a Registry hive so that the new subkey can be used to access the
  571. keys and values stored in that hive. Hives are usually created
  572. via C<RegSaveKey()>. Returns a true value if successful and a
  573. false value [and sets C<$^E>/C<regLastError()>] on failure.
  574. C<$hKey> is the handle to a Registry key that can have hives
  575. loaded to it. This must be C<HKEY_LOCAL_MACHINE>, C<HKEY_USERS>,
  576. or a remote version of one of these from a call to
  577. C<RegConnectRegistry()>.
  578. C<$sSubKey> is the name of the new subkey to created and associated
  579. with the hive file.
  580. C<$sFileName> is the name of the hive file to be loaded. This
  581. file name is interpretted relative to the
  582. C<%SystemRoot%/System32/config> directory on the computer where
  583. the C<$hKey> key resides. If C<$sFileName> is on a FAT file
  584. system, then its name must not have an extension.
  585. You must have the C<SE_RESTORE_NAME> privilege to use this routine.
  586. WARNING: Loading of hive files via a network share may silently
  587. corrupt the hive and so should not be attempted [this is a problem
  588. in at least some versions of the underlying API which this module
  589. does not try to fix or avoid]. To access a hive file located on a
  590. remote computer, connect to the remote computer's Registry and load
  591. the hive via that.
  592. =item RegNotifyChangeKeyValue
  593. =item C<RegNotifyChangeKeyValue( $hKey, $bWatchSubtree, $uNotifyFilter, $hEvent, $bAsync )>
  594. Arranges for your process to be notified when part of the Registry
  595. is changed. Returns a true value if successful and a false value
  596. [and sets C<$^E>/C<regLastError()>] on failure.
  597. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  598. a previous call] for which you wish to be notified when any changes
  599. are made to it.
  600. If C<$bWatchSubtree> is true, then changes to any subkey or
  601. descendant of C<$hKey> are also reported.
  602. C<$iNotifyFilter> controllers what types of changes are reported. It
  603. is a numeric value containing one or more of the following bit masks:
  604. =over
  605. =item C<REG_NOTIFY_CHANGE_NAME>
  606. Notify if a subkey is added or deleted to a monitored key.
  607. =item C<REG_NOTIFY_CHANGE_LAST_SET>
  608. Notify if a value in a monitored key is added, deleted, or modified.
  609. =item C<REG_NOTIFY_CHANGE_SECURITY>
  610. Notify if a security descriptor of a monitored key is changed.
  611. =item C<REG_NOTIFY_CHANGE_ATTRIBUTES>
  612. Notify if any attributes of a monitored key are changed [class
  613. name or security descriptors].
  614. =back
  615. C<$hEvent> is ignored unless C<$bAsync> is true. Otherwise, C<$hEvent>
  616. is a handle to a Win32 I<event> that will be signaled when changes are
  617. to be reported.
  618. If C<$bAsync> is true, then C<RegNotifyChangeKeyValue()> returns
  619. immediately and uses C<$hEvent> to notify your process of changes.
  620. If C<$bAsync> is false, then C<RegNotifyChangeKeyValue()> does
  621. not return until there is a change to be notified of.
  622. This routine does not work with Registry keys on remote computers.
  623. =item RegOpenKey
  624. =item C<RegOpenKey( $hKey, $sSubKey, $ohSubKey )>
  625. This routine is meant only for compatibility with Windows version
  626. 3.1. Use C<RegOpenKeyEx()> instead.
  627. =item RegOpenKeyEx
  628. =item C<RegOpenKeyEx( $hKey, $sSubKey, $uOptions, $uAccess, $ohSubKey )>
  629. Opens an existing Registry key. Returns a true value if successful
  630. and a false value [and sets C<$^E>/C<regLastError()>] on failure.
  631. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  632. a previous call].
  633. C<$sSubKey> is the name of an existing subkey to be opened.
  634. Can be C<""> or C<[]> to open an additional handle to the
  635. key specified by C<$hKey>.
  636. C<$iOptions> is a numeric value containing bits that control options
  637. used while opening the subkey. There are currently no supported
  638. options so this parameter should be specified as C<0>.
  639. C<$iAccess> is a numeric mask of bits specifying what type of
  640. access is desired when opening the new subkey. Should be a
  641. combination of one or more of the following bit masks:
  642. =over
  643. =item C<KEY_ALL_ACCESS>
  644. KEY_READ | KEY_WRITE | KEY_CREATE_LINK
  645. =item C<KEY_READ>
  646. KEY_QUERY_VALUE | KEY_ENUMERATE_SUBKEYS | KEY_NOTIFY | STANDARD_RIGHTS_READ
  647. =item C<KEY_WRITE>
  648. KEY_SET_VALUE | KEY_CREATE_SUB_KEY | STANDARD_RIGHTS_WRITE
  649. =item C<KEY_QUERY_VALUE>
  650. =item C<KEY_SET_VALUE>
  651. =item C<KEY_ENUMERATE_SUB_KEYS>
  652. =item C<KEY_CREATE_SUB_KEY>
  653. =item C<KEY_NOTIFY>
  654. Allows you to use C<RegNotifyChangeKeyValue()> on the opened key.
  655. =item C<KEY_EXECUTE>
  656. Same as C<KEY_READ>.
  657. =item C<KEY_CREATE_LINK>
  658. Gives you permission to create a symbolic link like
  659. C<HKEY_CLASSES_ROOT> and C<HKEY_CURRENT_USER>, though the method for
  660. doing so is not documented [and probably requires use of the mostly
  661. undocumented "native" routines, C<Nt*()> a.k.a. C<Zw*()>].
  662. =back
  663. C<$phKey> will be set to the handle to be used to access the new subkey
  664. if the call succeeds.
  665. =item RegQueryInfoKey
  666. =item C<RegQueryInfoKey( $hKey, $osClass, $iolClass, $pNull, $ocSubKeys, $olSubKey, $olSubClass, $ocValues, $olValName, $olValData, $olSecDesc, $opftTime )>
  667. Gets miscellaneous information about an open Registry key.
  668. Returns a true value if successful and a false value [and
  669. sets C<$^E>/C<regLastError()>] on failure.
  670. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  671. a previous call].
  672. C<$sClass> will be set to the class name for the key. Can be
  673. C<[]> if you don't care about the class.
  674. C<$plClass> initially specifies the [minimum] buffer size to be
  675. allocated for C<$sClass> and will be set to the length of the
  676. key's class name. See L<Buffer sizes> for more information.
  677. You may omit this parameter to get the same effect as passing in
  678. C<[]> for it.
  679. C<$pNull> is reserved for future use and should be passed as C<[]>.
  680. C<$pcSubKeys> will be set to the count of the number of subkeys
  681. directly under this key. Can be C<[]>.
  682. C<$plSubKey> will be set to the length of the longest subkey name.
  683. Can be C<[]>.
  684. C<$plSubClass> will be set to the length of the longest class name
  685. used with an immediate subkey of this key. Can be C<[]>.
  686. C<$pcValues> will be set to the count of the number of values in
  687. this key. Can be C<[]>.
  688. C<$plValName> will be set to the length of the longest value name
  689. in this key. Can be C<[]>.
  690. C<$plValData> will be set to the length of the longest value data
  691. in this key. Can be C<[]>.
  692. C<$plSecDesc> will be set to the length of this key's full security
  693. descriptor.
  694. C<$pftTime> will be set to a C<FILETIME> structure packed
  695. into a Perl string and indicating when this key was last changed.
  696. Can be C<[]>.
  697. =item RegQueryMultipleValues
  698. =item C<RegQueryMultipleValues( $hKey, $ioarValueEnts, $icValueEnts, $opBuffer, $iolBuffer )>
  699. Allows you to use a single call to query several values from a single
  700. open Registry key to maximize efficiency. Returns a true value if
  701. successful and a false value [and sets C<$^E>/C<regLastError()>] on
  702. failure.
  703. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  704. a previous call].
  705. C<$pValueEnts> should contain a list of C<VALENT> structures packed
  706. into a single Perl string. Each C<VALENT> structure should have
  707. the C<ve_valuename> entry [the first 4 bytes] pointing to a string
  708. containing the name of a value stored in this key. The remaining
  709. fields are set if the function succeeds.
  710. C<$cValueEnts> should contain the count of the number of C<VALENT>
  711. structures contained in C<$pValueEnts>.
  712. C<$pBuffer> will be set to the data from all of the requested values
  713. concatenated into a single Perl string.
  714. C<$plBuffer> initially specifies the [minimum] buffer size to be
  715. allocated for C<$sBuffer> and will be set to the total length of
  716. the data to be written to C<$sBuffer>. See L<Buffer sizes> for
  717. more information. You may omit this parameter to get the same
  718. effect as passing in C<[]> for it.
  719. Here is sample code to populate C<$pValueEnts>:
  720. # @ValueNames= ...list of value name strings...;
  721. $cValueEnts= @ValueNames;
  722. $pValueEnts= pack( " p x4 x4 x4 " x $cValueEnts, @ValueNames );
  723. Here is sample code to retrieve the data type and data length
  724. returned in C<$pValueEnts>:
  725. @Lengths= unpack( " x4 L x4 x4 " x $cValueEnts, $pValueEnts );
  726. @Types= unpack( " x4 x4 x4 L " x $cValueEnts, $pValueEnts );
  727. Given the above, and assuming you haven't modified C<$sBuffer> since
  728. the call, you can also extract the value data strings from C<$sBuffer>
  729. by using the pointers returned in C<$pValueEnts>:
  730. @Data= unpack( join( "", map {" x4 x4 P$_ x4 "} @Lengths ),
  731. $pValueEnts );
  732. Much better is to use the lengths and extract directly from
  733. C<$sBuffer> using C<unpack()> [or C<substr()>]:
  734. @Data= unpack( join("",map("P$_",@Lengths)), $sBuffer );
  735. =item RegQueryValue
  736. =item C<RegQueryValue( $hKey, $sSubKey, $osValueData, $iolValueData )>
  737. This routine is meant only for compatibility with Windows version
  738. 3.1. Use C<RegQueryValueEx()> instead. This routine can only
  739. query unamed values [a.k.a. "default values"], that is, values with
  740. a name of C<"">.
  741. =item RegQueryValueEx
  742. =item C<RegQueryValueEx( $hKey, $sValueName, $pNull, $ouType, $opValueData, $iolValueData )>
  743. Lets you look up value data stored in an open Registry key by
  744. specifying the value name. Returns a true value if successful
  745. and a false value [and sets C<$^E>/C<regLastError()>] on failure.
  746. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  747. a previous call].
  748. C<$sValueName> is the name of the value whose data you wish to
  749. retrieve.
  750. C<$pNull> this parameter is reserved for future use and should be
  751. specified as C<[]>.
  752. C<$piType> will be set to indicate what type of data is stored in
  753. the named value. Will be set to a C<REG_*> value if the function
  754. succeeds.
  755. C<$pValueData> will be set to the value data [packed into a Perl
  756. string] that is stored in the named value. Can be C<[]> if you
  757. don't care about the value data.
  758. C<$plValueData> initially specifies the [minimum] buffer size to be
  759. allocated for C<$sValueData> and will be set to the size [always
  760. in bytes] of the data to be written to C<$sValueData>, even if
  761. C<$sValueData> is not successfully written to. See L<Buffer sizes>
  762. for more information.
  763. =item RegReplaceKey
  764. =item C<RegReplaceKey( $hKey, $sSubKey, $sNewFile, $sOldFile )>
  765. Lets you replace an entire hive when the system is next booted.
  766. Returns a true value if successful and a false value [and sets
  767. C<$^E>/C<regLastError()>] on failure.
  768. C<$hKey> is the handle to a Registry key that has hive(s)
  769. loaded in it. This must be C<HKEY_LOCAL_MACHINE>,
  770. C<HKEY_USERS>, or a remote version of one of these from
  771. a call to C<RegConnectRegistry()>.
  772. C<$sSubKey> is the name of the subkey of C<$hKey> whose hive
  773. you wish to have replaced on the next reboot.
  774. C<$sNewFile> is the name of a file that will replace the existing
  775. hive file when the system reboots.
  776. C<$sOldFile> is the file name to save the current hive file to
  777. when the system reboots.
  778. C<$sNewFile> and C<$sOldFile> are interpretted relative to the
  779. C<%SystemRoot%/System32/config> directory on the computer where
  780. the C<$hKey> key resides [I think]. If either file is [would be]
  781. on a FAT file system, then its name must not have an extension.
  782. You must have the C<SE_RESTORE_NAME> privilege to use this routine.
  783. =item RegRestoreKey
  784. =item C<RegRestoreKey( $hKey, $sFileName, $uFlags )>
  785. Reads in a hive file and copies its contents over an existing
  786. Registry tree. Returns a true value if successful and a false
  787. value [and sets C<$^E>/C<regLastError()>] on failure.
  788. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  789. a previous call].
  790. C<$sFileName> is the name of the hive file to be read. For each
  791. value and subkey in this file, a value or subkey will be added
  792. or replaced in C<$hKey>.
  793. C<$uFlags> is usally C<0>. It can also be C<REG_WHOLE_HIVE_VOLATILE>
  794. which, rather than copying the hive over the existing key,
  795. replaces the existing key with a temporary, memory-only Registry
  796. key and then copies the hive contents into it. This option only
  797. works if C<$hKey> is C<HKEY_LOCAL_MACHINE>, C<HKEY_USERS>, or a
  798. remote version of one of these from a call to C<RegConnectRegistry()>.
  799. C<RegRestoreKey> does I<not> delete values nor keys from the
  800. existing Registry tree when there is no corresponding value/key
  801. in the hive file.
  802. =item RegSaveKey
  803. =item C<RegSaveKey( $hKey, $sFileName, $pSecAttr )>
  804. Dumps any open Registry key and all of its subkeys and values into
  805. a new hive file. Returns a true value if successful and a false
  806. value [and sets C<$^E>/C<regLastError()>] on failure.
  807. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  808. a previous call].
  809. C<$sFileName> is the name of the file that the Registry tree
  810. should be saved to. It is interpretted relative to the
  811. C<%SystemRoot%/System32/config> directory on the computer where
  812. the C<$hKey> key resides. If C<$sFileName> is on a FAT file system,
  813. then it must not have an extension.
  814. C<$pSecAttr> contains a C<SECURITY_ATTRIBUTES> structure that specifies
  815. the permissions to be set on the new file that is created. This can
  816. be C<[]>.
  817. You must have the C<SE_RESTORE_NAME> privilege to use this routine.
  818. =item RegSetKeySecurity
  819. =item C<RegSetKeySecurity( $hKey, $uSecInfo, $pSecDesc )>
  820. Sets [part of] the C<SECURITY_DESCRIPTOR> structure describing part
  821. of the security for an open Registry key. Returns a true value if
  822. successful and a false value [and sets C<$^E>/C<regLastError()>] on
  823. failure.
  824. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  825. a previous call].
  826. C<$uSecInfo> is a numeric C<SECURITY_INFORMATION> value that
  827. specifies which C<SECURITY_DESCRIPTOR> structure to set. Should
  828. be C<OWNER_SECURITY_INFORMATION>, C<GROUP_SECURITY_INFORMATION>,
  829. C<DACL_SECURITY_INFORMATION>, or C<SACL_SECURITY_INFORMATION>
  830. or two or more of these bits combined using C<|>.
  831. C<$pSecDesc> contains the new C<SECURITY_DESCRIPTOR> structure
  832. packed into a Perl string.
  833. =item RegSetValue
  834. =item C<RegSetValue( $hKey, $sSubKey, $uType, $sValueData, $lValueData )>
  835. This routine is meant only for compatibility with Windows version
  836. 3.1. Use C<RegSetValueEx()> instead. This routine can only
  837. set unamed values [a.k.a. "default values"].
  838. =item RegSetValueEx
  839. =item C<RegSetValueEx( $hKey, $sName, $uZero, $uType, $pData, $lData )>
  840. Adds or replaces a value in an open Registry key. Returns
  841. a true value if successful and a false value [and sets
  842. C<$^E>/C<regLastError()>] on failure.
  843. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  844. a previous call].
  845. C<$sName> is the name of the value to be set.
  846. C<$uZero> is reserved for future use and should be specified as C<0>.
  847. C<$uType> is the type of data stored in C<$pData>. It should
  848. be a C<REG_*> value.
  849. C<$pData> is the value data packed into a Perl string.
  850. C<$lData> is the length of the value data that is stored in C<$pData>.
  851. You will usually omit this parameter or pass in C<0> to have
  852. C<length($pData)> used. In both of these cases, if C<$iType> is
  853. C<REG_SZ> or C<REG_EXPAND_SZ>, C<RegSetValueEx()> will append a
  854. trailing C<'\0'> to the end of C<$pData> [unless there is already
  855. one].
  856. =item RegUnLoadKey
  857. =item C<RegUnLoadKey( $hKey, $sSubKey )>
  858. Unloads a previously loaded hive file. That is, closes the
  859. hive file then deletes the subkey that was providing access
  860. to it. Returns a true value if successful and a false value
  861. [and sets C<$^E>/C<regLastError()>] on failure.
  862. C<$hKey> is the handle to a Registry key that has hives
  863. loaded in it. This must be C<HKEY_LOCAL_MACHINE>, C<HKEY_USERS>,
  864. or a remote version of one of these from a call to
  865. C<RegConnectRegistry()>.
  866. C<$sSubKey> is the name of the subkey whose hive you wish to
  867. have unloaded.
  868. =item :FuncA
  869. The ASCII-specific function names.
  870. Each of these is identical to the version listed above without the
  871. trailing "A":
  872. AbortSystemShutdownA InitiateSystemShutdownA
  873. RegConnectRegistryA RegCreateKeyA RegCreateKeyExA
  874. RegDeleteKeyA RegDeleteValueA RegEnumKeyA
  875. RegEnumKeyExA RegEnumValueA RegLoadKeyA
  876. RegOpenKeyA RegOpenKeyExA RegQueryInfoKeyA
  877. RegQueryMultipleValuesA RegQueryValueA RegQueryValueExA
  878. RegReplaceKeyA RegRestoreKeyA RegSaveKeyA
  879. RegSetValueA RegSetValueExA RegUnLoadKeyA
  880. =item :FuncW
  881. The UNICODE-specific function names. These are the same as the
  882. versions listed above without the trailing "W" except that string
  883. parameters are UNICODE strings rather than ASCII strings, as
  884. indicated.
  885. =item AbortSystemShutdownW
  886. =item C<AbortSystemShutdownW( $swComputerName )>
  887. C<$swComputerName> is UNICODE.
  888. =item InitiateSystemShutdownW
  889. =item C<InitiateSystemShutdownW( $swComputer, $swMessage, $uTimeoutSecs, $bForce, $bReboot )>
  890. C<$swComputer> and C<$swMessage> are UNICODE.
  891. =item RegConnectRegistryW
  892. =item C<RegConnectRegistryW( $swComputer, $hRootKey, $ohKey )>
  893. C<$swComputer> is UNICODE.
  894. =item RegCreateKeyW
  895. =item C<RegCreateKeyW( $hKey, $swSubKey, $ohSubKey )>
  896. C<$swSubKey> is UNICODE.
  897. =item RegCreateKeyExW
  898. =item C<RegCreateKeyExW( $hKey, $swSubKey, $uZero, $swClass, $uOpts, $uAccess, $pSecAttr, $ohNewKey, $ouDisp )>
  899. C<$swSubKey> and C<$swClass> are UNICODE.
  900. =item RegDeleteKeyW
  901. =item C<RegDeleteKeyW( $hKey, $swSubKey )>
  902. C<$swSubKey> is UNICODE.
  903. =item RegDeleteValueW
  904. =item C<RegDeleteValueW( $hKey, $swValueName )>
  905. C<$swValueName> is UNICODE.
  906. =item RegEnumKeyW
  907. =item C<RegEnumKeyW( $hKey, $uIndex, $oswName, $ilwNameSize )>
  908. C<$oswName> is UNICODE and C<$ilwNameSize> is measured as number of
  909. C<WCHAR>s.
  910. =item RegEnumKeyExW
  911. =item C<RegEnumKeyExW( $hKey, $uIndex, $oswName, $iolwName, $pNull, $oswClass, $iolwClass, $opftLastWrite )>
  912. C<$swName> and C<$swClass> are UNICODE and C<$iolwName> and C<$iolwClass>
  913. are measured as number of C<WCHAR>s.
  914. =item RegEnumValueW
  915. =item C<RegEnumValueW( $hKey, $uIndex, $oswName, $iolwName, $pNull, $ouType, $opData, $iolData )>
  916. C<$oswName> is UNICODE and C<$iolwName> is measured as number
  917. of C<WCHAR>s.
  918. C<$opData> is UNICODE if C<$piType> is C<REG_SZ>, C<REG_EXPAND_SZ>,
  919. or C<REG_MULTI_SZ>. Note that C<$iolData> is measured as number
  920. of bytes even in these cases.
  921. =item RegLoadKeyW
  922. =item C<RegLoadKeyW( $hKey, $swSubKey, $swFileName )>
  923. C<$swSubKey> and C<$swFileName> are UNICODE.
  924. =item RegOpenKeyW
  925. =item C<RegOpenKeyW( $hKey, $swSubKey, $ohSubKey )>
  926. C<$swSubKey> is UNICODE.
  927. =item RegOpenKeyExW
  928. =item C<RegOpenKeyExW( $hKey, $swSubKey, $uOptions, $uAccess, $ohSubKey )>
  929. C<$swSubKey> is UNICODE.
  930. =item RegQueryInfoKeyW
  931. =item C<RegQueryInfoKeyW( $hKey, $oswClass, $iolwClass, $pNull, $ocSubKeys, $olwSubKey, $olwSubClass, $ocValues, $olwValName, $olValData, $olSecDesc, $opftTime )>
  932. C<$swClass> is UNICODE. C<$iolwClass>, C<$olwSubKey>, C<$olwSubClass>,
  933. and C<$olwValName> are measured as number of C<WCHAR>s. Note that
  934. C<$olValData> is measured as number of bytes.
  935. =item RegQueryMultipleValuesW
  936. =item C<RegQueryMultipleValuesW( $hKey, $ioarValueEnts, $icValueEnts, $opBuffer, $iolBuffer )>
  937. The C<ve_valuename> fields of the C<VALENT> [actually C<VALENTW>]
  938. structures in C<$ioarValueEnts> are UNICODE. Values of type C<REG_SZ>,
  939. C<REG_EXPAND_SZ>, and C<REG_MULTI_SZ> are written to C<$opBuffer>
  940. in UNICODE. Note that C<$iolBuffer> and the C<ve_valuelen> fields
  941. of the C<VALENT> [C<VALENTW>] structures are measured as number of
  942. bytes.
  943. =item RegQueryValueW
  944. =item C<RegQueryValueW( $hKey, $swSubKey, $oswValueData, $iolValueData )>
  945. C<$swSubKey> and C<$oswValueData> are UNICODE. Note that
  946. C<$iolValueData> is measured as number of bytes.
  947. =item RegQueryValueExW
  948. =item C<RegQueryValueExW( $hKey, $swName, $pNull, $ouType, $opData, $iolData )>
  949. C<$swName> is UNICODE.
  950. C<$opData> is UNICODE if C<$ouType> is C<REG_SZ>, C<REG_EXPAND_SZ>,
  951. or C<REG_MULTI_SZ>. Note that C<$iolData> is measured as number of
  952. bytes even in these cases.
  953. =item RegReplaceKeyW
  954. =item C<RegReplaceKeyW( $hKey, $swSubKey, $swNewFile, $swOldFile )>
  955. C<$swSubKey>, C<$swNewFile>, and C<$swOldFile> are UNICODE.
  956. =item RegRestoreKeyW
  957. =item C<RegRestoreKeyW( $hKey, $swFileName, $uFlags )>
  958. C<$swFileName> is UNICODE.
  959. =item RegSaveKeyW
  960. =item C<RegSaveKeyW( $hKey, $swFileName, $pSecAttr )>
  961. C<$swFileName> is UNICODE.
  962. =item RegSetValueW
  963. =item C<RegSetValueW( $hKey, $swSubKey, $uType, $swValueData, $lValueData )>
  964. C<$swSubKey> and C<$swValueData> are UNICODE. Note that
  965. C<$lValueData> is measured as number of bytes even though
  966. C<$swValueData> is always UNICODE.
  967. =item RegSetValueExW
  968. =item C<RegSetValueExW( $hKey, $swName, $uZero, $uType, $pData, $lData )>
  969. C<$swName> is UNICODE.
  970. C<$pData> is UNICODE if C<$uType> is C<REG_SZ>, C<REG_EXPAND_SZ>,
  971. or C<REG_MULTI_SZ>. Note that C<$lData> is measured as number of
  972. bytes even in these cases.
  973. =item RegUnLoadKeyW
  974. =item C<RegUnLoadKeyW( $hKey, $swSubKey )>
  975. C<$swSubKey> is UNICODE.
  976. =item :HKEY_
  977. All C<HKEY_*> constants:
  978. HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER
  979. HKEY_DYN_DATA HKEY_LOCAL_MACHINE HKEY_PERFORMANCE_DATA
  980. HKEY_USERS
  981. =item :KEY_
  982. All C<KEY_*> constants:
  983. KEY_QUERY_VALUE KEY_SET_VALUE KEY_CREATE_SUB_KEY
  984. KEY_ENUMERATE_SUB_KEYS KEY_NOTIFY KEY_CREATE_LINK
  985. KEY_READ KEY_WRITE KEY_EXECUTE
  986. KEY_ALL_ACCESS
  987. =item :REG_
  988. All C<REG_*> constants:
  989. REG_CREATED_NEW_KEY REG_OPENED_EXISTING_KEY
  990. REG_LEGAL_CHANGE_FILTER REG_NOTIFY_CHANGE_ATTRIBUTES
  991. REG_NOTIFY_CHANGE_NAME REG_NOTIFY_CHANGE_LAST_SET
  992. REG_NOTIFY_CHANGE_SECURITY REG_LEGAL_OPTION
  993. REG_OPTION_BACKUP_RESTORE REG_OPTION_CREATE_LINK
  994. REG_OPTION_NON_VOLATILE REG_OPTION_OPEN_LINK
  995. REG_OPTION_RESERVED REG_OPTION_VOLATILE
  996. REG_WHOLE_HIVE_VOLATILE REG_REFRESH_HIVE
  997. REG_NO_LAZY_FLUSH
  998. REG_NONE REG_SZ
  999. REG_EXPAND_SZ REG_BINARY
  1000. REG_DWORD REG_DWORD_LITTLE_ENDIAN
  1001. REG_DWORD_BIG_ENDIAN REG_LINK
  1002. REG_MULTI_SZ REG_RESOURCE_LIST
  1003. REG_FULL_RESOURCE_DESCRIPTOR REG_RESOURCE_REQUIREMENTS_LIST
  1004. =item :ALL
  1005. All of the above.
  1006. =item :SE_
  1007. The strings for the following privilege names:
  1008. SE_ASSIGNPRIMARYTOKEN_NAME SE_AUDIT_NAME
  1009. SE_BACKUP_NAME SE_CHANGE_NOTIFY_NAME
  1010. SE_CREATE_PAGEFILE_NAME SE_CREATE_PERMANENT_NAME
  1011. SE_CREATE_TOKEN_NAME SE_DEBUG_NAME
  1012. SE_INCREASE_QUOTA_NAME SE_INC_BASE_PRIORITY_NAME
  1013. SE_LOAD_DRIVER_NAME SE_LOCK_MEMORY_NAME
  1014. SE_MACHINE_ACCOUNT_NAME SE_PROF_SINGLE_PROCESS_NAME
  1015. SE_REMOTE_SHUTDOWN_NAME SE_RESTORE_NAME
  1016. SE_SECURITY_NAME SE_SHUTDOWN_NAME
  1017. SE_SYSTEMTIME_NAME SE_SYSTEM_ENVIRONMENT_NAME
  1018. SE_SYSTEM_PROFILE_NAME SE_TAKE_OWNERSHIP_NAME
  1019. SE_TCB_NAME SE_UNSOLICITED_INPUT_NAME
  1020. It can be difficult to successfully build this module in a way
  1021. that makes these constants available. So some builds of this
  1022. module may not make them available. For such builds, trying
  1023. to export any of these constants will cause a fatal error.
  1024. For this reason, none of these symbols are currently included
  1025. in the C<":ALL"> grouping.
  1026. =back
  1027. =head2 The Win32API:: heirarchy
  1028. This and the other Win32API:: modules are meant to expose the
  1029. nearly raw API calls so they can be used from Perl code in any
  1030. way they might be used from C code. This provides the following
  1031. advantages:
  1032. =over
  1033. =item Many modules can be written by people that don't have a C compiler.
  1034. =item Encourages more module code to be written in Perl [not C].
  1035. Perl code is often much easier to inspect, debug, customize, and
  1036. enhance than XS code.
  1037. =item Allows those already familiar with the Win32 API to get
  1038. off to a quick start.
  1039. =item Provides an interactive tool for exploring even obscure
  1040. details of the Win32 API.
  1041. It can be very useful to interactively explore ad-hoc calls into
  1042. parts of the Win32 API using:
  1043. perl -de 0
  1044. =item Ensures that native Win32 data structures can be used.
  1045. This allows maximum efficiency. It also allows data from one
  1046. module [for example, time or security information from the
  1047. C<Win32API::Registry> or C<Win32API::File> modules] to be used
  1048. with other modules [for example, C<Win32API::Time> and
  1049. C<Win32API::SecDesc>].
  1050. =item Provides a single version of the XS interface to each API
  1051. call where improvements can be collected.
  1052. =back
  1053. =head2 Buffer sizes
  1054. For each parameter that specifies a buffer size, a value of C<0>
  1055. can be passed. For parameter that are pointers to buffer sizes,
  1056. you can also pass in C<NULL> by specifying an empty list reference,
  1057. C<[]>. Both of these cases will ensure that the variable has
  1058. E<some> buffer space allocated to it and pass in that buffer's
  1059. allocated size. Many of the calls indicate, via C<ERROR_MORE_DATA>,
  1060. that the buffer size was not sufficient and the F<Registry.xs>
  1061. code will automatically enlarge the buffer to the required size
  1062. and repeat the call.
  1063. Numeric buffer sizes are used as minimum initial sizes for the
  1064. buffers. The larger of this size and the size of space already
  1065. allocated to the scalar will be passed to the underlying routine.
  1066. If that size was insufficient, and the underlying call provides
  1067. an easy method for determining the needed buffer size, then the
  1068. buffer will be enlarged and the call repeated as above.
  1069. The underlying calls define buffer size parameter as unsigned, so
  1070. negative buffer sizes are treated as very large positive buffer
  1071. sizes which usually cause C<malloc()> to fail.
  1072. To force the F<Registry.xs> code to pass in a specific value for
  1073. a buffer size, preceed the size with an equals sign via C<"=".>.
  1074. Buffer sizes that are passed in as strings starting with an equals
  1075. sign will have the equal sign stripped and the remainder of the string
  1076. interpretted as a number [via C's C<strtoul()> using only base 10]
  1077. which will be passed to the underlying routine [even if the allocated
  1078. buffer is actually larger]. The F<Registry.xs> code will enlarge the
  1079. buffer to the specified size, if needed, but will not enlarge the
  1080. buffer based on the underlying routine requesting more space.
  1081. Some Reg*() calls may not currently set the buffer size when they
  1082. return C<ERROR_MORE_DATA>. But some that are not documented as
  1083. doing so, currently do so anyway. So the code assumes that any
  1084. routine E<might> do this and resizes any buffers and repeats the
  1085. call. We hope that eventually all routines will provide this
  1086. feature.
  1087. When you use C<[]> for a buffer size, you can still find the
  1088. length of the data returned by using C<length($buffer)>. Note
  1089. that this length will be in bytes while a few of the buffer
  1090. sizes would have been in units of wide characters.
  1091. Note that the RegQueryValueEx*() and RegEnumValue*() calls
  1092. will trim the trailing C<'\0'> [if present] from the returned data
  1093. values of type C<REG_SZ> or C<REG_EXPAND_SZ> but only if the
  1094. value data length parameter is omitted [or specified as C<[]>].
  1095. The RegSetValueEx*() calls will add a trailing C<'\0'> [if
  1096. missing] to the supplied data values of type C<REG_SZ> and
  1097. C<REG_EXPAND_SZ> but only if the value data length parameter
  1098. is omitted [or specified as C<0>].
  1099. =head2 Hungarian Notation
  1100. The following abbreviations are used at the start of each parameter
  1101. name to hint at aspects of how the parameter is used. The prefix
  1102. is always in lower case and followed by a capital letter that starts
  1103. the descriptive part of the parameter name. Several of the following
  1104. abbreviations can be combined into a single prefix.
  1105. Probably not all of these prefix notations are used by this module.
  1106. This document section may be included in any C<Win32API> module and
  1107. so covers some notations not used by this specific module.
  1108. =over
  1109. =item s
  1110. A string. In C, a C<'\0'>-terminated C<char *>. In Perl, just a
  1111. string except that it will be truncated at the first C<"\0">, if
  1112. it contains one.
  1113. =item sw
  1114. A wide [UNICODE] string. In C, a C<L'\0'>-terminated C<WCHAR *>.
  1115. In Perl, a string that contains UNICODE data. You can convert a
  1116. string to UNICODE in Perl via:
  1117. $string= "This is an example string";
  1118. $unicode= pack( "S*", unpack("C*",$string), 0 );
  1119. Note how C<, 0> above causes an explicit C<L'\0'> to be added since
  1120. Perl's implicit C<'\0'> that it puts after each of its strings is not
  1121. wide enough to terminate a UNICODE string. So UNICODE strings are
  1122. different than regular strings in that the Perl version of a regular
  1123. string will not include the trialing C<'\0'> while the Perl version
  1124. of a UNICODE string must include the trailing C<L'\0'>.
  1125. If a UNICODE string contains no non-ASCII characters, then you
  1126. can convert it back into a normal string via:
  1127. $string= pack( "C*", unpack("S*",$unicode) );
  1128. $string =~ s/\0$//;
  1129. =item p
  1130. A pointer to some buffer [usually containing some C<struct>]. In C,
  1131. a C<void *> or some other pointer type. In Perl, a string that is
  1132. usually manipulated using C<pack> and C<unpack>. The "p" is usually
  1133. followed by more prefix character(s) to indicate what type of data is
  1134. stored in the bufffer.
  1135. =item a
  1136. A packed array. In C, an array [usually of C<struct>s]. In Perl, a
  1137. string containing the packed data. The "a" is usually followed by
  1138. more prefix character(s) to indicate the data type of the elements.
  1139. These packed arrays are also called "vectors" in places to avoid
  1140. confusion with Perl arrays.
  1141. =item n
  1142. A generic number. In C, any of the integer or floating point data
  1143. types. In Perl, a number; either an integer, unsigned, or double
  1144. [IV, UV, or NV, respectively]. Usually an integer.
  1145. =item iv
  1146. A signed integral value. In C, any of the signed integer data types.
  1147. In Perl, an integer [IV].
  1148. =item u
  1149. An unsigned integral value. In C, any of the unsigned integer data
  1150. types. In Perl, an unsigned integer [UV].
  1151. =item d
  1152. A floating-point number. In C, a C<float> or C<double> or, perhaps,
  1153. a C<long double>. In Perl, a double-precision floating-point number
  1154. [NV].
  1155. =item b
  1156. A Boolean value. In C, any integer data type, though usually via
  1157. a type alias of C<bool> or C<BOOL>, containing either a 0 [false] or
  1158. non-zero [true] value. In Perl, a scalar containing a Boolean value
  1159. [C<0>, C<"">, or C<undef> for "false" and anything else for "true"].
  1160. =item c
  1161. A count of items. In C, any integer data type. In Perl, an unsigned
  1162. integer [UV]. Usually used in conjunction with a "vector" parameter
  1163. [see L</a> above] to indicate the number of elements.
  1164. =item l
  1165. A length [in bytes]. In C, any integer data type. In Perl, an
  1166. unsigned integer [UV]. Usually used in conjunction with a "string"
  1167. or "pointer" parameter [see L</s> and L</p> above] to indicate the
  1168. buffer size or the size of the value stored in the buffer.
  1169. For strings, there is no general rule as to whether the trailing
  1170. C<'\0'> is included in such sizes. For this reason, the C<Win32API>
  1171. modules follow the Perl rule of always allocating one extra byte
  1172. and reporting buffer sizes as being one smaller than allocated in
  1173. case the C<'\0'> is not included in the size.
  1174. =item lw
  1175. A length measured as number of UNICODE characters. In C, a count
  1176. of C<WCHAR>s. In Perl, an unsigned integer [UV] counting "shorts"
  1177. [see "s" and "S" in C<pack> and C<unpack>].
  1178. For UNICODE strings, the trailing C<L'\0'> may or may not be
  1179. included in a length so, again, we always allocate extra room
  1180. for one and don't report that extra space.
  1181. =item h
  1182. A handle. In C, a C<HANDLE> or more-specific handle data type.
  1183. In Perl, an unsigned integer [UV]. In C, these handles are often
  1184. actually some type of pointer, but Perl just treats them as opaque
  1185. numbers, as it should. This prefix is also used for other pointers
  1186. that are treated as integers in Perl code.
  1187. =item r
  1188. A record. In C, almost always a C<struct> or perhaps C<union>. Note
  1189. that C C<struct>s are rarely passed by value so the "r" is almost
  1190. always preceeded by a "p" or "a" [see L</p> and L</a> above]. For
  1191. the very rare unadorned "r", Perl stores the record in the same way
  1192. as a "pr", that is, in a string. For the very rare case where Perl
  1193. explicitly stores a pointer to the C<struct> rather than storing the
  1194. C<struct> directly in a Perl string, the prefix "pp" or "ppr" or even
  1195. "par" is used.
  1196. =item sv
  1197. =item rv
  1198. =item hv
  1199. =item av
  1200. =item cv
  1201. A Perl data type. Respectively, a scalar value [SV], a reference
  1202. [RV] [usually to a scalar], a hash [HV], a Perl array [AV], or a Perl
  1203. code reference [PVCV]. For the "hv", "av", and "cv" prefixes, a
  1204. leading "rv" is usually assumed. For a parameter to an XS subroutine,
  1205. a prefix of "sv" means the parameter is a scalar and so may be a string
  1206. or a number [or C<undef>] or even both at the same time. So "sv"
  1207. doesn't imply a leading "rv".
  1208. =item Input or Output
  1209. Whether a parameter is for input data, output data, or both is usually
  1210. not reflected by the data type prefix. In cases where this is not
  1211. obvious nor reflected in the parameter name proper, we may use the
  1212. following in front of the data type prefix.
  1213. =over
  1214. =item i
  1215. An input parameter given to the API [usually omitted].
  1216. =item o
  1217. An output-only parameter taken from the API. You should not get a
  1218. warning if such a parameter is C<undef> when you pass it into the
  1219. function. You should get an error if such a parameter is read-only.
  1220. You can [usually] pass in C<[]> for such a parameter to have the
  1221. parameter silently ignored.
  1222. The output may be written directly into the Perl variable passed
  1223. to the subroutine, the same way the buffer parameter to Perl's
  1224. C<sysread()>. This method is often avoided in Perl because
  1225. the call then lacks any visual cue that some parameters are being
  1226. overwritten. But this method closely matches the C API which is
  1227. what we are trying to do.
  1228. =item io
  1229. Input given to the API then overwritten with output taken from the
  1230. API. You should get a warning [if B<-w> is in effect] if such a
  1231. parameter is C<undef> when you pass it into the function [unless it
  1232. is a buffer or buffer length parameter]. If the value is read-only,
  1233. then [for most parameters] the output is silently not written. This
  1234. is because it is often convenient to pass in read-only constants for
  1235. many such parameters. You can also usually pass in C<[]> for such
  1236. parameters.
  1237. =back
  1238. =item pp
  1239. =item ppr
  1240. =item par
  1241. =item pap
  1242. These are just unusual combinations of prefix characters described above.
  1243. For each, a pointer is stored in a [4-byte] Perl string. You can
  1244. usually use C<unpack "P"> to access the real data from Perl.
  1245. For "ppr" [and often for "pp"], the pointer points directly at a
  1246. C C<struct>. For "par", the pointer points to the first element
  1247. of a C [packed] array of C<struct>s. For "pap", the pointer points
  1248. to a C [packed] array of pointers to other things.
  1249. =item ap
  1250. Here we have a list of pointers packed into a single Perl string.
  1251. =back
  1252. =head1 BUGS
  1253. The old ActiveState ports of Perl for Win32 [but not, ActivePerl, the
  1254. ActiveState distributions of standard Perl 5.004 and beyond] do not support
  1255. the tools for building extensions and so do not support this extension.
  1256. No routines are provided for using the data returned in the C<FILETIME>
  1257. buffers. Those are in the C<Win32API::Time> module.
  1258. No routines are provided for dealing with UNICODE data effectively.
  1259. See L</:FuncW> above for some simple-minded UNICODE methods.
  1260. Parts of the module test will fail if used on a version of Perl
  1261. that does not yet set C<$^E> based on C<GetLastError()>.
  1262. On NT 4.0 [at least], the RegEnum*() calls do not set the required
  1263. buffer sizes when returning C<ERROR_MORE_DATA> so this module will
  1264. not grow the buffers in such cases. C<Win32::TieRegistry> overcomes
  1265. this by using values from C<RegQueryInfoKey()> for buffer sizes in
  1266. RegEnum* calls.
  1267. On NT 4.0 [at least], C<RegQueryInfoKey()> on C<HKEY_PERFORMANCE_DATA>
  1268. never succeeds. Also, C<RegQueryValueEx()> on C<HKEY_PERFORMANCE_DATA>
  1269. never returns the required buffer size. To access C<HKEY_PERFORMANCE_DATA>
  1270. you will need to keep growing the data buffer until the call succeeds.
  1271. Because C<goto &subroutine> seems to be buggy under Win32 Perl,
  1272. it is not used in the stubs in F<Registry.pm>.
  1273. =head1 AUTHOR
  1274. Tye McQueen, tye@metronet.com, http://www.metronet.com/~tye/.
  1275. =head1 SEE ALSO
  1276. =over
  1277. =item L<Win32::TieRegistry>
  1278. =item L<Win32::Registry>
  1279. =back
  1280. =cut