home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Database Designers / Rational Rose 2000 / Rational Setup.EXE / common / lib / Win32API / Registry.pm < prev   
Encoding:
Perl POD Document  |  1998-11-15  |  43.3 KB  |  1,244 lines

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