Source code of Windows XP (NT5)
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.

1243 lines
42 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 $AUTOLOAD);
  5. $VERSION = '0.151';
  6. require Exporter;
  7. require DynaLoader;
  8. @ISA = qw(Exporter DynaLoader);
  9. # Items to export into callers namespace by default. Note: do not export
  10. # names by default without a very good reason. Use EXPORT_OK instead.
  11. # Do not simply export all your public functions/methods/constants.
  12. @EXPORT= qw();
  13. %EXPORT_TAGS= (
  14. Func => [qw( AllowPriv
  15. AbortSystemShutdown InitiateSystemShutdown
  16. RegCloseKey RegConnectRegistry RegCreateKey
  17. RegCreateKeyEx RegDeleteKey RegDeleteValue
  18. RegEnumKey RegEnumKeyEx RegEnumValue
  19. RegFlushKey RegGetKeySecurity RegLoadKey
  20. RegNotifyChangeKeyValue RegOpenKey RegOpenKeyEx
  21. RegQueryInfoKey RegQueryMultipleValues RegQueryValue
  22. RegQueryValueEx RegReplaceKey RegRestoreKey
  23. RegSaveKey RegSetKeySecurity RegSetValue
  24. RegSetValueEx RegUnLoadKey )],
  25. FuncA => [qw(
  26. AbortSystemShutdownA InitiateSystemShutdownA
  27. RegConnectRegistryA RegCreateKeyA RegCreateKeyExA
  28. RegDeleteKeyA RegDeleteValueA RegEnumKeyA
  29. RegEnumKeyExA RegEnumValueA RegLoadKeyA
  30. RegOpenKeyA RegOpenKeyExA RegQueryInfoKeyA
  31. RegQueryMultipleValuesA RegQueryValueA RegQueryValueExA
  32. RegReplaceKeyA RegRestoreKeyA RegSaveKeyA
  33. RegSetValueA RegSetValueExA RegUnLoadKeyA )],
  34. FuncW => [qw(
  35. AbortSystemShutdownW InitiateSystemShutdownW
  36. RegConnectRegistryW RegCreateKeyW RegCreateKeyExW
  37. RegDeleteKeyW RegDeleteValueW RegEnumKeyW
  38. RegEnumKeyExW RegEnumValueW RegLoadKeyW
  39. RegOpenKeyW RegOpenKeyExW RegQueryInfoKeyW
  40. RegQueryMultipleValuesW RegQueryValueW RegQueryValueExW
  41. RegReplaceKeyW RegRestoreKeyW RegSaveKeyW
  42. RegSetValueW RegSetValueExW RegUnLoadKeyW )],
  43. HKEY_ => [qw(
  44. HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER
  45. HKEY_DYN_DATA HKEY_LOCAL_MACHINE HKEY_PERFORMANCE_DATA
  46. HKEY_USERS )],
  47. KEY_ => [qw(
  48. KEY_QUERY_VALUE KEY_SET_VALUE KEY_CREATE_SUB_KEY
  49. KEY_ENUMERATE_SUB_KEYS KEY_NOTIFY KEY_CREATE_LINK
  50. KEY_READ KEY_WRITE KEY_EXECUTE
  51. KEY_ALL_ACCESS )],
  52. REG_ => [qw(
  53. REG_OPTION_RESERVED REG_OPTION_NON_VOLATILE REG_OPTION_VOLATILE
  54. REG_OPTION_CREATE_LINK REG_OPTION_BACKUP_RESTORE
  55. REG_OPTION_OPEN_LINK REG_LEGAL_OPTION REG_CREATED_NEW_KEY
  56. REG_OPENED_EXISTING_KEY REG_WHOLE_HIVE_VOLATILE REG_REFRESH_HIVE
  57. REG_NO_LAZY_FLUSH REG_NOTIFY_CHANGE_ATTRIBUTES
  58. REG_NOTIFY_CHANGE_NAME REG_NOTIFY_CHANGE_LAST_SET
  59. REG_NOTIFY_CHANGE_SECURITY REG_LEGAL_CHANGE_FILTER
  60. REG_NONE REG_SZ REG_EXPAND_SZ
  61. REG_BINARY REG_DWORD REG_DWORD_LITTLE_ENDIAN
  62. REG_DWORD_BIG_ENDIAN REG_LINK REG_MULTI_SZ
  63. REG_RESOURCE_LIST REG_FULL_RESOURCE_DESCRIPTOR
  64. REG_RESOURCE_REQUIREMENTS_LIST )],
  65. );
  66. @EXPORT_OK= ();
  67. { my $ref;
  68. foreach $ref ( values(%EXPORT_TAGS) ) {
  69. push( @EXPORT_OK, @$ref );
  70. }
  71. }
  72. $EXPORT_TAGS{ALL}= \@EXPORT_OK;
  73. #######################################################################
  74. # This AUTOLOAD is used to 'autoload' constants from the constant()
  75. # XS function. If a constant is not found then control is passed
  76. # to the AUTOLOAD in AutoLoader.
  77. sub AUTOLOAD {
  78. my($constname);
  79. ($constname = $AUTOLOAD) =~ s/.*:://;
  80. #reset $! to zero to reset any current errors.
  81. $!=0;
  82. my $val = constant($constname, @_ ? $_[0] : 0);
  83. if ($! != 0) {
  84. if ($! =~ /Invalid/) {
  85. $AutoLoader::AUTOLOAD = $AUTOLOAD;
  86. goto &AutoLoader::AUTOLOAD;
  87. }
  88. else {
  89. my($pack,$file,$line)= caller;
  90. die "Your vendor has not defined ", __PACKAGE__,
  91. " macro $constname, used at $file line $line.";
  92. }
  93. }
  94. eval "sub $AUTOLOAD { $val }";
  95. goto &$AUTOLOAD;
  96. }
  97. bootstrap Win32API::Registry $VERSION;
  98. # Preloaded methods go here.
  99. # Replace "&rout;" with "goto &rout;" when that is supported on Win32.
  100. # Let user omit all buffer sizes:
  101. sub RegEnumKeyExA {
  102. if( 6 == @_ ) { splice(@_,4,0,[]); splice(@_,2,0,[]); }
  103. &_RegEnumKeyExA;
  104. }
  105. sub RegEnumKeyExW {
  106. if( 6 == @_ ) { splice(@_,4,0,[]); splice(@_,2,0,[]); }
  107. &_RegEnumKeyExW;
  108. }
  109. sub RegEnumValueA {
  110. if( 6 == @_ ) { splice(@_,2,0,[]); push(@_,[]); }
  111. &_RegEnumValueA;
  112. }
  113. sub RegEnumValueW {
  114. if( 6 == @_ ) { splice(@_,2,0,[]); push(@_,[]); }
  115. &_RegEnumValueW;
  116. }
  117. sub RegQueryInfoKeyA {
  118. if( 11 == @_ ) { splice(@_,2,0,[]); }
  119. &_RegQueryInfoKeyA;
  120. }
  121. sub RegQueryInfoKeyW {
  122. if( 11 == @_ ) { splice(@_,2,0,[]); }
  123. &_RegQueryInfoKeyW;
  124. }
  125. sub RegGetKeySecurity {
  126. push(@_,[]) if 3 == @_;
  127. &_RegGetKeySecurity;
  128. }
  129. sub RegQueryMultipleValuesA {
  130. push(@_,[]) if 4 == @_;
  131. &_RegQueryMultipleValuesA;
  132. }
  133. sub RegQueryMultipleValuesW {
  134. push(@_,[]) if 4 == @_;
  135. &_RegQueryMultipleValuesW;
  136. }
  137. sub RegQueryValueA {
  138. push(@_,[]) if 3 == @_;
  139. &_RegQueryValueA;
  140. }
  141. sub RegQueryValueW {
  142. push(@_,[]) if 3 == @_;
  143. &_RegQueryValueW;
  144. }
  145. sub RegQueryValueExA {
  146. push(@_,[]) if 5 == @_;
  147. &_RegQueryValueExA;
  148. }
  149. sub RegQueryValueExW {
  150. push(@_,[]) if 5 == @_;
  151. &_RegQueryValueExW;
  152. }
  153. sub RegEnumKeyA {
  154. push(@_,0) if 3 == @_;
  155. &_RegEnumKeyA;
  156. }
  157. sub RegEnumKeyW {
  158. push(@_,0) if 3 == @_;
  159. &_RegEnumKeyW;
  160. }
  161. sub RegSetValueA {
  162. push(@_,0) if 4 == @_;
  163. &_RegSetValueA;
  164. }
  165. sub RegSetValueW {
  166. push(@_,0) if 4 == @_;
  167. &_RegSetValueW;
  168. }
  169. sub RegSetValueExA {
  170. push(@_,0) if 5 == @_;
  171. &_RegSetValueExA;
  172. }
  173. sub RegSetValueExW {
  174. push(@_,0) if 5 == @_;
  175. &_RegSetValueExW;
  176. }
  177. # Aliases for non-Unicode functions:
  178. sub AbortSystemShutdown { &AbortSystemShutdownA; }
  179. sub InitiateSystemShutdown { &InitiateSystemShutdownA; }
  180. sub RegConnectRegistry { &RegConnectRegistryA; }
  181. sub RegCreateKey { &RegCreateKeyA; }
  182. sub RegCreateKeyEx { &RegCreateKeyExA; }
  183. sub RegDeleteKey { &RegDeleteKeyA; }
  184. sub RegDeleteValue { &RegDeleteValueA; }
  185. sub RegEnumKey { &RegEnumKeyA; }
  186. sub RegEnumKeyEx { &RegEnumKeyExA; }
  187. sub RegEnumValue { &RegEnumValueA; }
  188. sub RegLoadKey { &RegLoadKeyA; }
  189. sub RegOpenKey { &RegOpenKeyA; }
  190. sub RegOpenKeyEx { &RegOpenKeyExA; }
  191. sub RegQueryInfoKey { &RegQueryInfoKeyA; }
  192. sub RegQueryMultipleValues { &RegQueryMultipleValuesA; }
  193. sub RegQueryValue { &RegQueryValueA; }
  194. sub RegQueryValueEx { &RegQueryValueExA; }
  195. sub RegReplaceKey { &RegReplaceKeyA; }
  196. sub RegRestoreKey { &RegRestoreKeyA; }
  197. sub RegSaveKey { &RegSaveKeyA; }
  198. sub RegSetValue { &RegSetValueA; }
  199. sub RegSetValueEx { &RegSetValueExA; }
  200. sub RegUnLoadKey { &RegUnLoadKeyA; }
  201. # Autoload methods go after =cut, and are processed by the autosplit program.
  202. 1;
  203. __END__
  204. =head1 NAME
  205. Win32API::Registry - Low-level access to Win32 system API calls from WINREG.H
  206. =head1 SYNOPSIS
  207. use Win32API::Registry 0.13 qw( :ALL );
  208. RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SYSTEM\\Disk", 0, KEY_READ, $key );
  209. or die "Can't open HKEY_LOCAL_MACHINE\\SYSTEM\\Disk: $^E\n";
  210. RegQueryValueEx( $key, "Information", [], $type, $data, [] );
  211. or die "Can't read HKEY_L*MACHINE\\SYSTEM\\Disk\\Information: $^E\n";
  212. [...]
  213. RegCloseKey( $key )
  214. and die "Can't close HKEY_LOCAL_MACHINE\\SYSTEM\\Disk: $^E\n";
  215. =head1 DESCRIPTION
  216. This provides fairly low-level access to the Win32 System API
  217. calls dealing with the Registry (mostly from WINREG.H). This
  218. is mostly intended to be used by other modules such as
  219. C<Win32::TieRegistry> [which provides an extremely Perl-friendly
  220. method for using the Registry].
  221. For a description of the logical structure of the Registry, see
  222. the documentation for the C<Win32::TieRegistry> module.
  223. To pass in C<NULL> as the pointer to an optional buffer, pass in
  224. an empty list reference, C<[]>.
  225. Beyond raw access to the API calls and related constants, this module
  226. handles smart buffer allocation and translation of return codes.
  227. All calls return a true value for success and a false value for
  228. failure. After any failure, C<$^E> should automatically be set to
  229. indicate the reason. If you have a version of Perl that does not
  230. yet connect C<$^E> to C<GetLastError()> under Win32, then you can
  231. use C<$iError= Win32::GetLastError()> to get the numeric error
  232. code and pass that to C<Win32::FormatMessage($iError)> to to get
  233. the descriptive string, or just
  234. C<Win32::FormatMessage(Win32::GetLastError())>.
  235. Note that C<$!> is not set by these routines except by
  236. C<Win32API::Registry::constant()> when a constant is not defined.
  237. =head2 The Win32API:: heirarchy
  238. This and the other Win32API:: modules are meant to expose the
  239. nearly raw API calls so they can be used from Perl code in any
  240. way they might be used from C code. This provides the following
  241. advantages:
  242. =over
  243. =item Many modules can be written by people that don't have a C compiler.
  244. =item Encourages more module code to be written in Perl [not C].
  245. Perl code is often much easier to inspect, debug, customize, and
  246. enhance than XS code.
  247. =item Allows those already familiar with the Win32 API to get
  248. off to a quick start.
  249. =item Provides an interactive tool [Perl] for exploring even
  250. obscure details of the Win32 API.
  251. =item Ensures that native Win32 data structures can be used.
  252. This allows maximum efficiency. It also allows data from one
  253. module [for example, time or security information from the
  254. C<Win32API::Registry> or C<Win32API::File> modules] to be used
  255. with other modules [for example, C<Win32API::Time> and
  256. C<Win32API::Security>].
  257. =item Provides a single version of the XS interface to each API
  258. call where improvements can be collected.
  259. =back
  260. =head2 Buffer sizes
  261. For each argument that specifies a buffer size, a value of C<0>
  262. can be passed. For arguments that are pointers to buffer sizes,
  263. you can also pass in C<NULL> by specifying an empty list reference,
  264. C<[]>. Both of these cases will ensure that the variable has
  265. E<some> buffer space allocated to it and pass in that buffer's
  266. allocated size. Many of the calls indicate, via C<ERROR_MORE_DATA>,
  267. that the buffer size was not sufficient and the F<Registry.xs>
  268. code will automatically enlarge the buffer to the required size
  269. and repeat the call.
  270. Numeric buffer sizes are used as minimum initial sizes for the
  271. buffers. The larger of this size and the size of space already
  272. allocated to the scalar will be passed to the underlying routine.
  273. If that size was insufficient, and the underlying call provides
  274. an easy method for determining the needed buffer size, then the
  275. buffer will be enlarged and the call repeated as above.
  276. The underlying calls define buffer size arguments as unsigned, so
  277. negative buffer sizes are treated as very large positive buffer
  278. sizes which usually cause C<malloc()> to fail.
  279. To force the F<Registry.xs> code to pass in a specific value for
  280. a buffer size, preceed the size with C<"=">. Buffer sizes that
  281. are passed in as strings starting with an equal sign will have
  282. the equal sign stripped and the remainder of the string interpretted
  283. as a number [via C's C<strtoul()> using only base 10] which will be
  284. passed to the underlying routine [even if the allocated buffer is
  285. actually larger]. The F<Registry.xs> code will enlarge the buffer
  286. to the specified size, if needed, but will not enlarge the buffer
  287. based on the underlying routine requesting more space.
  288. Some Reg*() calls may not currently set the buffer size when they
  289. return C<ERROR_MORE_DATA>. But some that are not documented as
  290. doing so, currently do so anyway. So the code assumes that any
  291. routine E<might> do this and resizes any buffers and repeats the
  292. call. We hope that eventually all routines will provide this
  293. feature.
  294. When you use C<[]> for a buffer size, you can still find the
  295. length of the data returned by using C<length($buffer)>. Note
  296. that this length will be in bytes while a few of the buffer
  297. sizes would have been in units of wide characters.
  298. Note that the RegQueryValueEx*() and RegEnumValue*() calls
  299. will trim the trailing C<'\0'> [if present] from the returned data
  300. values of type C<REG_SZ> or C<REG_EXPAND_SZ> but only if the
  301. value data length argument is omitted [or specified as C<[]>].
  302. The RegSetValueEx*() calls will add a trailing C<'\0'> [if
  303. missing] to the supplied data values of type C<REG_SZ> and
  304. C<REG_EXPAND_SZ> but only if the value data length argument is
  305. omitted [or specified as C<0>].
  306. =head2 Exports
  307. Nothing is exported by default. The following tags can be used to
  308. have sets of symbols exported.
  309. [Note that much of the following documentation refers to the
  310. behavior of the underlying API calls which may vary in current
  311. and future versions of the Win32 API without any changes to this
  312. module. Therefore you should check the Win32 API documentation
  313. directly when needed.]
  314. =over
  315. =item :Func
  316. The basic function names:
  317. =over
  318. =item AllowPriv( $sPrivName, $bEnable )
  319. Not a Win32 API call. Enables or disables a specific privilege for
  320. the current process. Returns a true value if successful and a false
  321. value [and sets C<$^E>] on failure. This routine does not provide
  322. a way to tell if a privilege is current enabled.
  323. C<$sPrivname> is a Win32 privilege name [see the C<SE_*_NAME>
  324. macros of F<winnt.h>]. For example, C<"SeBackupPrivilege"> [a.k.a.
  325. C<SE_BACKUP_NAME>] controls whether you can use C<RegSaveKey()>
  326. and C<"SeRestorePrivilege"> [a.k.a. C<SE_RESTORE_NAME>] controls
  327. whether you can use C<RegLoadKey()>.
  328. If C<$bEnable> is true, then C<AllowPriv()> tries to enable the
  329. privilege. Otherwise it tries to disable the privilege.
  330. =item AbortSystemShutdown( $sComputerName )
  331. Tries to abort a remote shutdown request previously made via
  332. C<InitiateSystemShutdown()>.
  333. =item InitiateSystemShutdown( $sComputer, $sMessage, $iTimeoutSecs, $bForce, $bReboot )
  334. Requests that a [remote] computer be shutdown or rebooted.
  335. C<$sComputer> is the name [or address] of the computer to be
  336. shutdown or rebooted. You can use C<[]> [for C<NULL>] or C<"">
  337. to indicate the local computer.
  338. C<$sMessage> is the message to be displayed in a pop-up window
  339. on the desktop of the computer to be shutdown or rebooted until
  340. the timeout expires or the shutdown is aborted via
  341. C<AbortSystemShutdown()>. With C<$iTimeoutSecs == 0>, the message
  342. will never be visible.
  343. C<$iTimeoutSecs> is the number of seconds to wait before starting
  344. the shutdown.
  345. If C<$bForce> is false, then any applications running on the remote
  346. computer get a chance to prompt the remote user whether they want
  347. to save changes. Also, for any applications that do not exit quickly
  348. enough, the operating system will prompt the user whether they wish
  349. to wait longer for the application to exit or force it to exit now.
  350. At any of these prompts the user can press B<CANCEL> to abort the
  351. shutdown but if no applications have unsaved data, they will likely
  352. all exit quickly and the shutdown will progress with the remote user
  353. having no option to cancel the shutdown.
  354. If C<$bForce> is true, all applications are told to exit immediately
  355. and so will not prompt the user even if there is unsaved data. Any
  356. applications that take too long to exit will be forcibly killed after
  357. a short time. The only way to abort the shutdown is to call
  358. C<AbortSystemShutdown()> before the timeout expires and there is no
  359. way to abort the shutdown once it has begun.
  360. If C<$bReboot> is true, the computer will automatically reboot once
  361. the shutdown is complete. If C<$bReboot> is false, then when the
  362. shutdown is complete the computer will halt at a screen indicating
  363. that the shutdown is complete and offering a way for the user to
  364. start to boot the computer.
  365. You must have the C<"SeRemoteShutdownPrivilege"> privilege
  366. on the remote computer for this call to succeed. If shutting
  367. down the local computer, then the calling process must have
  368. the C<"SeShutdownPrivilege"> privilege and have it enabled.
  369. =item RegCloseKey( $hKey )
  370. Closes the handle to a Registry key returned by C<RegOpenKeyEx()>,
  371. C<RegConnectRegistry()>, C<RegCreateKeyEx()>, or a few other
  372. routines.
  373. =item RegConnectRegistry( $sComputer, $hKey, $phKey )
  374. Connects to one of the root Registry keys of a remote computer.
  375. C<$sComputer> is the name [or address] of a remote computer you
  376. whose Registry you wish to access.
  377. C<$hKey> must be either C<HKEY_LOCAL_MACHINE> or C<HKEY_USERS>
  378. and specifies which root Registry key on the remote computer
  379. you wish to have access to.
  380. C<$phKey> will be set to the handle to be used to access the remote
  381. Registry key.
  382. =item RegCreateKey( $hKey, $sSubKey, $phKey )
  383. This routine is meant only for compatibility with Windows version
  384. 3.1. Use C<RegCreateKeyEx()> instead.
  385. =item RegCreateKeyEx( $hKey, $sSubKey, $iZero, $sClass, $iOpts, $iAccess, $pSecAttr, $phKey, $piDisp )
  386. Creates a new Registry subkey.
  387. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  388. a previous call].
  389. C<$sSubKey> is the name of the new subkey to be created.
  390. C<$iZero> is reserved for future use and should always be specified
  391. as C<0>.
  392. C<$sClass> is a string to be used as the class for the new
  393. subkey. We are not aware of any current use for Registry key
  394. class information so the empty string, C<"">, should usually
  395. be used here.
  396. C<$iOpts> is a numeric value containing bits that control options
  397. used while creating the new subkey. C<REG_OPTION_NON_VOLATILE>
  398. is the default. C<REG_OPTION_VOLATILE> [which is ignored on
  399. Windows 95] means the data stored under this key is not kept in a
  400. file and will not be preserved when the system reboots.
  401. C<REG_OPTION_BACKUP_RESTORE> [also ignored on Windows 95] means
  402. ignore the C<$iAccess> parameter and try to open the new key with
  403. the access required to backup or restore the key.
  404. C<$iAccess> is a numeric mask of bits specifying what type of
  405. access is desired when opening the new subkey. See C<RegOpenKeyEx()>.
  406. C<$pSecAttr> is a C<SECURITY_ATTRIBUTES> structure packed into
  407. a Perl string which controls whether the returned handle can be
  408. inherited by child processes. Normally you would pass C<[]> for
  409. this argument to have C<NULL> passed to the underlying API
  410. indicating that the handle cannot be inherited. If not under
  411. Windows95, then C<$pSecAttr> also allows you to specify
  412. C<SECURITY_DESCRIPTOR> that controls which users will have
  413. what type of access to the new key -- otherwise the new key
  414. inherits its security from its parent key.
  415. C<$phKey> will be set to the handle to be used to access the new subkey.
  416. C<$piDisp> will be set to either C<REG_CREATED_NEW_KEY> or
  417. C<REG_OPENED_EXISTING_KEY> to indicate for which reason the
  418. call succeeded. Can be specified as C<[]> if you don't care.
  419. If C<$phKey> and C<$piDisp> start out is integers, then they will
  420. probably remain unchanged if the call fails.
  421. =item RegDeleteKey( $hKey, $sSubKey )
  422. Deletes a subkey of an open Registry key provided that the subkey
  423. contains no subkeys of its own [but the subkey may contain values].
  424. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  425. a previous call].
  426. C<$sSubKey> is the name of the subkey to be deleted.
  427. =item RegDeleteValue( $hKey, $sValueName )
  428. Deletes a values from an open Registry key provided.
  429. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  430. a previous call].
  431. C<$sValueKey> is the name of the value to be deleted.
  432. =item RegEnumKey( $hKey, $iIndex, $sName, $lNameSize )
  433. This routine is meant only for compatibility with Windows version
  434. 3.1. Use C<RegEnumKeyEx()> instead.
  435. =item RegEnumKeyEx( $hKey, $iIndex, $sName, $plName, $pNull, $sClass, $plClass, $pftLastWrite )
  436. Lets you enumerate the names of all of the subkeys directly under
  437. an open Registry key.
  438. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  439. a previous call].
  440. C<$iIndex> is the sequence number of the immediate subkey that you
  441. want information on. Start with this value as C<0> then repeat
  442. the call incrementing this value each time until the call fails
  443. with C<ERROR_NO_MORE_ITEMS>.
  444. C<$sName> will be set to the name of the subkey. Can be C<[]> if
  445. you don't care about the name.
  446. C<$plName> initially specifies the [minimum] buffer size to be
  447. allocated for C<$sName>. Will be set to the length of the subkey
  448. name if the requested subkey exists even if C<$sName> isn't
  449. successfully set to the subkey name. See L<Buffer sizes> for
  450. more information.
  451. C<$pNull> is reserved for future used and should be passed as C<[]>.
  452. C<$sClass> will be set to the class name for the subkey. Can be
  453. C<[]> if you don't care about the class.
  454. C<$plClass> initially specifies the [minimum] buffer size to be
  455. allocated for C<$sClass> and will be set to the length of the
  456. subkey class name if the requested subkey exists. See L<Buffer
  457. sizes> for more information.
  458. C<$pftLastWrite> will be set to a C<FILETIME> structure packed
  459. into a Perl string and indicating when the subkey was last changed.
  460. Can be C<[]>.
  461. You may omit both C<$plName> and C<$plClass> to get the same effect
  462. as passing in C<[]> for each of them.
  463. =item RegEnumValue( $hKey, $iIndex, $sValName, $plValName, $pNull, $piType, $pValData, $plValData )
  464. Lets you enumerate the names of all of the values contained in an
  465. open Registry key.
  466. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  467. a previous call].
  468. C<$iIndex> is the sequence number of the value that you want
  469. information on. Start with this value as C<0> then repeat the
  470. call incrementing this value each time until the call fails with
  471. C<ERROR_NO_MORE_ITEMS>.
  472. C<$sValName> will be set to the name of the value. Can be C<[]>
  473. if you don't care about the name.
  474. C<$plValName> initially specifies the [minimum] buffer size to be
  475. allocated for C<$sValName>. Will be set to the length of the value
  476. name if the requested value exists even if C<$sValName> isn't
  477. successfully set to the value name. See L<Buffer sizes> for
  478. more information.
  479. C<$pNull> is reserved for future used and should be passed as C<[]>.
  480. C<$piType> will be set to the type of data stored in the value data.
  481. If the call succeeds, it will be set to a C<REG_*> value unless
  482. passed in as C<[]>.
  483. C<$pValData> will be set to the data [packed into a Perl string]
  484. that is stored in the requested value. Can be C<[]> if you don't
  485. care about the value data.
  486. C<$plValData> initially specifies the [minimum] buffer size to be
  487. allocated for C<$sValData> and will be set to the length of the
  488. value data if the requested value exists. See L<Buffer sizes> for
  489. more information.
  490. You may omit both C<$plValName> and C<$plValData> to get the same
  491. effect as passing in C<[]> for each of them.
  492. =item RegFlushKey( $hKey )
  493. Forces that data stored under an open Registry key to be flushed
  494. to the disk file where the data is preserved between reboots.
  495. Forced flushing is not guaranteed to be efficient so this routine
  496. should almost never be called.
  497. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  498. a previous call].
  499. =item RegGetKeySecurity( $hKey, $iSecInfo, $pSecDesc, $plSecDesc )
  500. Retrieves one of the C<SECURITY_DESCRIPTOR> structures describing
  501. part of the security for an open Registry key.
  502. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  503. a previous call].
  504. C<$iSecInfo> is a numeric C<SECURITY_INFORMATION> value that
  505. specifies which C<SECURITY_DESCRIPTOR> structure to retrieve. Should
  506. be C<OWNER_SECURITY_INFORMATION>, C<GROUP_SECURITY_INFORMATION>,
  507. C<DACL_SECURITY_INFORMATION>, or C<SACL_SECURITY_INFORMATION>.
  508. C<$pSecDesc> will be set to the requested C<SECURITY_DESCRIPTOR>
  509. structure [packed into a Perl string].
  510. C<$plSecDesc> initially specifies the [minimum] buffer size to be
  511. allocated for C<$sSecDesc> and will be set to the length of the
  512. security descriptor. See L<Buffer sizes> for more information.
  513. You may omit this parameter to get the same effect as passing in
  514. C<[]> for it.
  515. =item RegLoadKey( $hKey, $sSubKey, $sFileName )
  516. Loads a hive file. That is, it creates a new subkey in the
  517. Registry and associates that subkey with a disk file that contains
  518. a Registry hive so that the new subkey can be used to access the
  519. keys and values stored in that hive. Hives are usually created
  520. via C<RegSaveKey()>.
  521. C<$hKey> is the handle to a Registry key that can have hives
  522. loaded to it. This must be C<HKEY_LOCAL_MACHINE>, C<HKEY_USERS>,
  523. or a remote version of one of these from a call to
  524. C<RegConnectRegistry()>.
  525. C<$sSubKey> is the name of the new subkey to created and associated
  526. with the hive file.
  527. C<$sFileName> is the name of the hive file to be loaded. This
  528. file name is interpretted relative to the
  529. C<%SystemRoot%/System32/config> directory on the computer where
  530. the C<$hKey> key resides.
  531. Loading of hive files located on network shares may fail or
  532. corrupt the hive and so should not be attempted.
  533. =item RegNotifyChangeKeyValue( $hKey, $bWatchSubtree, $iNotifyFilter, $hEvent, $bAsync )
  534. Arranges for your process to be notified when part of the Registry
  535. is changed.
  536. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  537. a previous call] for which you wish to be notified when any changes
  538. are made to it.
  539. If C<$bWatchSubtree> is true, then changes to any subkey or
  540. descendant of C<$hKey> are also reported.
  541. C<$iNotifyFilter> controllers what types of changes are reported. It
  542. is a numeric value containing one or more of the following bit masks:
  543. =over
  544. =item REG_NOTIFY_CHANGE_NAME
  545. Notify if a subkey is added or deleted to a monitored key.
  546. =item REG_NOTIFY_CHANGE_LAST_SET
  547. Notify if a value in a monitored key is added, deleted, or modified.
  548. =item REG_NOTIFY_CHANGE_SECURITY
  549. Notify a security descriptor of a monitored key is changed.
  550. =item REG_NOTIFY_CHANGE_ATTRIBUTES
  551. Notify if any attributes of a monitored key are changed [class
  552. name or security descriptors].
  553. =back
  554. C<$hEvent> is ignored unless C<$bAsync> is true. Otherwise, C<$hEvent>
  555. is a handle to a Win32 I<event> that will be signaled when changes are
  556. to be reported.
  557. If C<$bAsync> is true, then C<RegNotifyChangeKeyValue()> returns
  558. immediately and uses C<$hEvent> to notify your process of changes.
  559. If C<$bAsync> is false, then C<RegNotifyChangeKeyValue()> does
  560. not return until there is a change to be notified of.
  561. This routine does not work with Registry keys on remote computers.
  562. =item RegOpenKey( $hKey, $sSubKey, $phKey )
  563. This routine is meant only for compatibility with Windows version
  564. 3.1. Use C<RegOpenKeyEx()> instead.
  565. =item RegOpenKeyEx( $hKey, $sSubKey, $iOptions, $iAccess, $phKey )
  566. Opens an existing Registry key.
  567. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  568. a previous call].
  569. C<$sSubKey> is the name of an existing subkey to be opened.
  570. Can be C<""> or C<[]> to open an additional handle to the
  571. key specified by C<$hKey>.
  572. C<$iOptions> is a numeric value containing bits that control options
  573. used while open the subkey. There are currently no supported options
  574. so this parameters should be specified as C<0>.
  575. C<$iAccess> is a numeric mask of bits specifying what type of
  576. access is desired when opening the new subkey. Should be a
  577. combination of one or more of the following bit masks:
  578. =over
  579. =item KEY_ALL_ACCESS
  580. KEY_READ | KEY_WRITE | KEY_CREATE_LINK
  581. =item KEY_READ
  582. KEY_QUERY_VALUE | KEY_ENUMERATE_SUBKEYS | KEY_NOTIFY | STANDARD_RIGHTS_READ
  583. =item KEY_WRITE
  584. KEY_SET_VALUE | KEY_CREATE_SUB_KEY | STANDARD_RIGHTS_WRITE
  585. =item KEY_QUERY_VALUE
  586. =item KEY_SET_VALUE
  587. =item KEY_ENUMERATE_SUB_KEYS
  588. =item KEY_CREATE_SUB_KEY
  589. =item KEY_NOTIFY
  590. =item KEY_EXECUTE
  591. Same as C<KEY_READ>.
  592. =item KEY_CREATE_LINK
  593. Allows you to create a symbolic link like C<HKEY_CLASSES_ROOT>
  594. and C<HKEY_CURRENT_USER> if the method for doing so were documented.
  595. =back
  596. C<$phKey> will be set to the handle to be used to access the new subkey.
  597. =item RegQueryInfoKey( $hKey, $sClass, $plClass, $pNull, $pcSubKeys, $plSubKey, $plSubClass, $pcValues, $plValName, $plValData, $plSecDesc, $pftTime )
  598. Gets miscellaneous information about an open Registry key.
  599. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  600. a previous call].
  601. C<$sClass> will be set to the class name for the key. Can be
  602. C<[]> if you don't care about the class.
  603. C<$plClass> initially specifies the [minimum] buffer size to be
  604. allocated for C<$sClass> and will be set to the length of the
  605. key's class name. See L<Buffer sizes> for more information.
  606. You may omit this parameter to get the same effect as passing in
  607. C<[]> for it.
  608. C<$pNull> is reserved for future used and should be passed as C<[]>.
  609. C<$pcSubKeys> will be set to the count of the number of subkeys directly
  610. under this key. Can be C<[]>.
  611. C<$plSubKey> will be set to the length of the longest subkey name.
  612. Can be C<[]>.
  613. C<$plSubClass> will be set to the length of the longest class name
  614. used with an immediate subkey of this key. Can be C<[]>.
  615. C<$pcValues> will be set to the count of the number of values in
  616. this key. Can be C<[]>.
  617. C<$plValName> will be set to the length of the longest value name
  618. in this key. Can be C<[]>.
  619. C<$plValData> will be set to the length of the longest value data
  620. in this key. Can be C<[]>.
  621. C<$plSecDesc> will be set to the length of this key's [longest?]
  622. security descriptor.
  623. C<$pftTime> will be set to a C<FILETIME> structure packed
  624. into a Perl string and indicating when this key was last changed.
  625. Can be C<[]>.
  626. =item RegQueryMultipleValues( $hKey, $pValueEnts, $cValueEnts, $pBuffer, $plBuffer )
  627. Allows you to use a single call to query several values from a
  628. single open Registry key to maximize efficiency.
  629. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  630. a previous call].
  631. C<$pValueEnts> should contain a list of C<VALENT> structures packed
  632. into a single Perl string. Each C<VALENT> structure should have
  633. the C<ve_valuename> entry pointing to a string containing the name
  634. of a value stored in this key. The remaining fields are set if
  635. the function succeeds.
  636. C<$cValueEnts> should contain the count of the number of C<VALENT>
  637. structures contained in C<$pValueEnts>.
  638. C<$pBuffer> will be set to the data from all of the requested values
  639. concatenated into a single Perl string.
  640. C<$plBuffer> initially specifies the [minimum] buffer size to be
  641. allocated for C<$sBuffer> and will be set to the total length of
  642. the data to be written to C<$sBuffer>. See L<Buffer sizes> for
  643. more information. You may omit this parameter to get the same
  644. effect as passing in C<[]> for it.
  645. Here is sample code to populate C<$pValueEnts>:
  646. $cValueEnts= @ValueNames;
  647. $pValueEnts= pack( " p x4 x4 x4 " x $cValueEnts, @ValueNames );
  648. Here is sample code to retrieve the data type and data length
  649. returned in C<$pValueEnts>:
  650. @Lengths= unpack( " x4 L x4 x4 " x $cValueEnts, $pValueEnts );
  651. @Types= unpack( " x4 x4 x4 L " x $cValueEnts, $pValueEnts );
  652. Given the above, and assuming you haven't modified C<$sBuffer> since
  653. the call, you can also extract the value data strings from C<$sBuffer>
  654. by using the pointers returned in C<$pValueEnts>:
  655. @Data= unpack( join( "", map(" x4 x4 P$_ x4 ",@Lengths) ),
  656. $pValueEnts );
  657. Much better is to use the lengths and extract directly from
  658. C<$sBuffer> using C<unpack()> [or C<substr()>]:
  659. @Data= unpack( join("",map("P$_",@Lengths)), $sBuffer );
  660. =item RegQueryValue( $hKey, $sSubKey, $sValueData, $plValueData )
  661. This routine is meant only for compatibility with Windows version
  662. 3.1. Use C<RegQueryValueEx()> instead. This routine can only
  663. query unamed values (a.k.a. "default values").
  664. =item RegQueryValueEx( $hKey, $sValueName, $pNull, $piType, $pValueData, $plValueData )
  665. Lets you look up value data using the name of the value stored in an
  666. open Registry key.
  667. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  668. a previous call].
  669. C<$sValueName> is the name of the value whose data you wish to
  670. retrieve.
  671. C<$pNull> this parameter is reserved for future use and should be
  672. specified as C<[]>.
  673. C<$piType> will be set to indicate what type of data is stored in
  674. the named value. Will be set to a C<REG_*> value if the function
  675. succeeds.
  676. C<$pValueData> will be set to the value data [packed into a Perl
  677. string] that is stored in the named value. Can be C<[]> if you
  678. don't care about the value data.
  679. C<$plValueData> initially specifies the [minimum] buffer size to be
  680. allocated for C<$sValueData> and will be set to the size [always
  681. in bytes] of the data to be written to C<$sValueData>. See
  682. L<Buffer sizes> for more information.
  683. =item RegReplaceKey( $hKey, $sSubKey, $sNewFile, $sOldFile )
  684. Lets you replace an entire hive when the system is next booted.
  685. C<$hKey> is the handle to a Registry key that has hives
  686. loaded in it. This must be C<HKEY_LOCAL_MACHINE>,
  687. C<HKEY_USERS>, or a remote version of one of these from
  688. a call to C<RegConnectRegistry()>.
  689. C<$sSubKey> is the name of the subkey of C<$hKey> whose hive
  690. you wish to have replaced on the next reboot.
  691. C<$sNewFile> is the name of a file that will replace the existing
  692. hive file when the system reboots.
  693. C<$sOldFile> is the file name to save the current hive file to
  694. when the system reboots.
  695. =item RegRestoreKey( $hKey, $sFileName, $iFlags )
  696. Reads in a hive file and copies its contents over an existing
  697. Registry tree.
  698. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  699. a previous call].
  700. C<$sFileName> is the name of the hive file to be read. For each
  701. value and subkey in this file, a value or subkey will be added
  702. or replaced in C<$hKey>.
  703. C<$iFlags> is usally C<0>. It can also be C<REG_WHOLE_HIVE_VOLATILE>
  704. which, rather than copying the hive over the existing key,
  705. replaces the existing key with a temporary, memory-only Registry
  706. key and then copies the hive contents into it. This option only
  707. works if C<$hKey> is C<HKEY_LOCAL_MACHINE>, C<HKEY_USERS>, or a
  708. remote version of one of these from a call to C<RegConnectRegistry()>.
  709. =item RegSaveKey( $hKey, $sFileName, $pSecAttr )
  710. Dumps any open Registry key and all of its subkeys and values into
  711. a new hive file.
  712. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  713. a previous call].
  714. C<$sFileName> is the name of the file that the Registry tree should
  715. be saved to. It is interpretted relative to the
  716. C<%SystemRoot%/System32/config> directory on the computer where
  717. the C<$hKey> key resides.
  718. C<$pSecAttr> contains a C<SECURITY_ATTRIBUTES> structure that specifies
  719. the permissions to be set on the new file that is created. This can
  720. be C<[]>.
  721. =item RegSetKeySecurity( $hKey, $iSecInfo, $pSecDesc )
  722. Sets one of the C<SECURITY_DESCRIPTOR> structures describing part
  723. of the security for an open Registry key.
  724. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  725. a previous call].
  726. C<$iSecInfo> is a numeric C<SECURITY_INFORMATION> value that
  727. specifies which C<SECURITY_DESCRIPTOR> structure to set. Should
  728. be C<OWNER_SECURITY_INFORMATION>, C<GROUP_SECURITY_INFORMATION>,
  729. C<DACL_SECURITY_INFORMATION>, or C<SACL_SECURITY_INFORMATION>.
  730. C<$pSecDesc> contains the new C<SECURITY_DESCRIPTOR> structure
  731. packed into a Perl string.
  732. =item RegSetValue( $hKey, $sSubKey, $iType, $sValueData, $lValueData )
  733. This routine is meant only for compatibility with Windows version
  734. 3.1. Use C<RegSetValueEx()> instead. This routine can only
  735. set unamed values (a.k.a. "default values").
  736. =item RegSetValueEx( $hKey, $sValueName, $iZero, $iType, $pValueData, $lValueData )
  737. Sets a value.
  738. C<$hKey> is the handle to a Registry key [either C<HKEY_*> or from
  739. a previous call].
  740. C<$sValueName> is the name of the value to be set.
  741. C<$iZero> is reserved for future use and should be specified as C<0>.
  742. C<$iType> is the type of data stored in C<$pValueData>. It should
  743. be a C<REG_*> value.
  744. C<$pValueData> is the value data packed into a Perl string.
  745. C<$lValueData> the length of the value data that is stored in
  746. C<$pValueData>. You will usually omit this parameter or pass
  747. in C<0> to have C<length($pValueData)> used. In both of these
  748. cases, if C<$iType> is C<REG_SZ> or C<REG_EXPAND_SZ>,
  749. C<RegSetValueEx()> will append a trailing C<'\0'> to the end
  750. of C<$pValueData> [unless there is already one].
  751. =item RegUnLoadKey( $hKey, $sSubKey )
  752. Unloads a previously loaded hive file. That is, closes the
  753. hive file then deletes the subkey that was providing access
  754. to it.
  755. C<$hKey> is the handle to a Registry key that has hives
  756. loaded in it. This must be C<HKEY_LOCAL_MACHINE>, C<HKEY_USERS>,
  757. or a remote version of one of these from a call to
  758. C<RegConnectRegistry()>.
  759. C<$sSubKey> is the name of the subkey whose hive you wish to
  760. have unloaded.
  761. =item :FuncA
  762. The ASCI-specific function names.
  763. Each of these is identical to version listed above without the
  764. trailing "A":
  765. AbortSystemShutdownA InitiateSystemShutdownA
  766. RegConnectRegistryA RegCreateKeyA RegCreateKeyExA
  767. RegDeleteKeyA RegDeleteValueA RegEnumKeyA
  768. RegEnumKeyExA RegEnumValueA RegLoadKeyA
  769. RegOpenKeyA RegOpenKeyExA RegQueryInfoKeyA
  770. RegQueryMultipleValuesA RegQueryValueA RegQueryValueExA
  771. RegReplaceKeyA RegRestoreKeyA RegSaveKeyA
  772. RegSetValueA RegSetValueExA RegUnLoadKeyA
  773. =item :FuncW
  774. The UNICODE-specific function names. These are the same as the
  775. version listed above without the trailing "W" except that string
  776. parameters are UNICODE strings rather than ASCII strings, as
  777. indicated.
  778. =item AbortSystemShutdownW( $sComputerName )
  779. C<$sComputerName> is UNICODE.
  780. =item InitiateSystemShutdownW( $sComputer, $sMessage, $iTimeoutSecs, $bForce, $bReboot )
  781. C<$sComputer> is UNICODE.
  782. =item RegConnectRegistryW( $sComputer, $hKey, $phKey )
  783. C<$sComputer> is UNICODE.
  784. =item RegCreateKeyW( $hKey, $sSubKey, $phKey )
  785. C<$sSubKey> is UNICODE.
  786. =item RegCreateKeyExW( $hKey, $sSubKey, $iZero, $sClass, $iOpts, $iAccess, $pSecAttr, $phKey, $piDisp )
  787. C<$sSubKey> and C<$sClass> are UNICODE.
  788. =item RegDeleteKeyW( $hKey, $sSubKey )
  789. C<$sSubKey> is UNICODE.
  790. =item RegDeleteValueW( $hKey, $sValueName )
  791. C<$sValueName> is UNICODE.
  792. =item RegEnumKeyW( $hKey, $iIndex, $sName, $lwNameSize )
  793. C<$sName> is UNICODE and C<$lwNameSize> is measured as number
  794. of C<WCHAR>s.
  795. =item RegEnumKeyExW( $hKey, $iIndex, $sName, $plwName, $pNull, $sClass, $plwClass, $pftLastWrite )
  796. C<$sName> and C<$sClass> are UNICODE and C<$plwName> and C<$plwClass>
  797. are measured as number of C<WCHAR>s.
  798. =item RegEnumValueW( $hKey, $iIndex, $sValName, $plwValName, $pNull, $piType, $pValData, $plValData )
  799. C<$sValName> is UNICODE and C<$plwValName> is measured as number
  800. of C<WCHAR>s.
  801. C<$sValData> is UNICODE if C<$piType> is C<REG_SZ>, C<REG_EXPAND_SZ>,
  802. or C<REG_MULTI_SZ>. Note that C<$plValData> is measured as number
  803. of bytes even in these cases.
  804. =item RegLoadKeyW( $hKey, $sSubKey, $sFileName )
  805. C<$sSubKey> and C<$sFileName> are UNICODE.
  806. =item RegOpenKeyW( $hKey, $sSubKey, $phKey )
  807. C<$sSubKey> is UNICODE.
  808. =item RegOpenKeyExW( $hKey, $sSubKey, $iOptions, $iAccess, $phKey )
  809. C<$sSubKey> is UNICODE.
  810. =item RegQueryInfoKeyW( $hKey, $sClass, $plwClass, $pNull, $pcSubKeys, $plwSubKey, $plwSubClass, $pcValues, $plwValName, $plValData, $plSecDesc, $pftTime )
  811. C<$sClass> is UNICODE. C<$plwClass>, C<$plwSubKey>, C<$plwSubClass>,
  812. and C<$plwValName> are measured as number of C<WCHAR>s. Note that
  813. C<$plValData> is measured as number of bytes.
  814. =item RegQueryMultipleValuesW( $hKey, $pValueEnts, $cValueEnts, $pBuffer, $plBuffer )
  815. The C<ve_valuename> fields of the C<VALENT> structures in
  816. C<$pValueEnts> are UNICODE. Values of type C<REG_SZ>, C<REG_EXPAND_SZ>,
  817. and C<REG_MULTI_SZ> are written to C<$pBuffer> in UNICODE.
  818. Note that C<$plBuffer> and the C<ve_valuelen> fields of the
  819. C<VALENT> structures are measured as number of bytes.
  820. =item RegQueryValueW( $hKey, $sSubKey, $sValueData, $plValueData )
  821. C<$sSubKey> and C<$sValueData> is UNICODE. Note that C<$plValueData>
  822. is measured as number of bytes.
  823. =item RegQueryValueExW( $hKey, $sValueName, $pNull, $piType, $pValueData, $plValueData )
  824. C<$sValueName> is UNICODE.
  825. C<$sValueData> is UNICODE if C<$piType> is C<REG_SZ>, C<REG_EXPAND_SZ>,
  826. or C<REG_MULTI_SZ>. Note that C<$plValueData> is measured as number
  827. of bytes even in these cases.
  828. =item RegReplaceKeyW( $hKey, $sSubKey, $sNewFile, $sOldFile )
  829. C<$sSubKey>, C<$sNewFile>, and C<$sOldFile> are UNICODE.
  830. =item RegRestoreKeyW( $hKey, $sFileName, $iFlags )
  831. C<$sFileName> is UNICODE.
  832. =item RegSaveKeyW( $hKey, $sFileName, $pSecAttr )
  833. C<$sFileName> is UNICODE.
  834. =item RegSetValueW( $hKey, $sSubKey, $iType, $sValueData, $lValueData )
  835. C<$sSubKey> and C<$sValueData> is UNICODE. Note that
  836. C<$lValueData> is measured as number of bytes.
  837. =item RegSetValueExW( $hKey, $sValueName, $iZero, $iType, $pValueData, $lValueData )
  838. C<$sValueName> is UNICODE.
  839. C<$sValueData> is UNICODE if C<$iType> is C<REG_SZ>, C<REG_EXPAND_SZ>,
  840. or C<REG_MULTI_SZ>. Note that C<$lValueData> is measured as number
  841. of bytes even in these cases.
  842. =item RegUnLoadKeyW( $hKey, $sSubKey )
  843. C<$sSubKey> is UNICODE.
  844. =item :HKEY_
  845. All C<HKEY_*> constants:
  846. HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER
  847. HKEY_DYN_DATA HKEY_LOCAL_MACHINE HKEY_PERFORMANCE_DATA
  848. HKEY_USERS
  849. =item :KEY_
  850. All C<KEY_*> constants:
  851. KEY_QUERY_VALUE KEY_SET_VALUE KEY_CREATE_SUB_KEY
  852. KEY_ENUMERATE_SUB_KEYS KEY_NOTIFY KEY_CREATE_LINK
  853. KEY_READ KEY_WRITE KEY_EXECUTE
  854. KEY_ALL_ACCESS
  855. =item :REG_
  856. All C<REG_*> constants:
  857. REG_OPTION_RESERVED REG_OPTION_NON_VOLATILE REG_OPTION_VOLATILE
  858. REG_OPTION_CREATE_LINK REG_OPTION_BACKUP_RESTORE
  859. REG_OPTION_OPEN_LINK REG_LEGAL_OPTION REG_CREATED_NEW_KEY
  860. REG_OPENED_EXISTING_KEY REG_WHOLE_HIVE_VOLATILE REG_REFRESH_HIVE
  861. REG_NO_LAZY_FLUSH REG_NOTIFY_CHANGE_ATTRIBUTES
  862. REG_NOTIFY_CHANGE_NAME REG_NOTIFY_CHANGE_LAST_SET
  863. REG_NOTIFY_CHANGE_SECURITY REG_LEGAL_CHANGE_FILTER
  864. REG_NONE REG_SZ REG_EXPAND_SZ
  865. REG_BINARY REG_DWORD REG_DWORD_LITTLE_ENDIAN
  866. REG_DWORD_BIG_ENDIAN REG_LINK REG_MULTI_SZ
  867. REG_RESOURCE_LIST REG_FULL_RESOURCE_DESCRIPTOR
  868. REG_RESOURCE_REQUIREMENTS_LIST
  869. =item :ALL
  870. All of the above.
  871. =back
  872. =head1 BUGS
  873. The ActiveState ports of Perl for Win32 [but not the ActiveState
  874. bundles of standard Perl 5.004 and beyond] do not support the
  875. tools for building extensions and so do not support this extension.
  876. No routines are provided for using the data returned in the C<FILETIME>
  877. buffers. Those will be in C<Win32API::Time> when it becomes available.
  878. No routines are provided for dealing with UNICODE data effectively.
  879. Such are available elsewhere.
  880. Parts of the module test will fail if used on a version of Perl that
  881. does not yet set C<$^E> based on C<GetLastError()>.
  882. On NT 4.0 (at least), the RegEnum* calls do not set the required
  883. buffer sizes when returning C<ERROR_MORE_DATA> so this module will
  884. not grow the buffers in such cases. C<Win32::TieRegistry> overcomes
  885. this by using values from C<RegQueryInfoKey()> for buffer sizes in
  886. RegEnum* calls.
  887. On NT 4.0 (at least), C<RegQueryInfoKey()> on C<HKEY_PERFORMANCE_DATA>
  888. never succeeds. Also, C<RegQueryValueEx()> on C<HKEY_PERFORMANCE_DATA>
  889. never returns the required buffer size. To access C<HKEY_PERFORMANCE_DATA>
  890. you will need to keep growing the data buffer until the call succeeds.
  891. Because C<goto &subroutine> seems to be buggy under Win32, it is not
  892. used in the stubs in F<Registry.pm>.
  893. Using C<undef> as an argument to any of the stubs in F<Registry.pm>
  894. may cause warnings when the C<undef> is then passed to the function
  895. from F<Registry.xs> that does the real work.
  896. =head1 AUTHOR
  897. Tye McQueen, tye@metronet.com, http://www.metronet.com/~tye/.
  898. =head1 SEE ALSO
  899. =over
  900. =item L<Win32::TieRegistry>
  901. =item L<Win32::Registry>
  902. =back
  903. =cut