Hi everyone,

I'm having trouble getting StdRegProv to work with Perl
Can someone help me?

I'm using a Windows XP machine, and I'm running perl 5.8.6. I'm logged on as administrator.

These are my futile attempts:
# !/usr/local/bin/perl -w use strict; use Win32; use Win32::OLE qw(in); my $HKEY_CLASSES_ROOT = 0x80000000; # 2147483648 my $HKEY_CURRENT_USER = 0x80000001; # 2147483649 my $HKEY_LOCAL_MACHINE = 0x80000002; # 2147483650 my $HKEY_USERS = 0x80000003; # 2147483651 my $HKEY_CURRENT_CONFIG = 0x80000005; # 2147483653 my $HKEY_DYN_DATA = 0x80000006; # 2147483654 my $KEY_QUERY_VALUE = 0x0001; my $KEY_SET_VALUE = 0x0002; my $KEY_CREATE_SUB_KEY = 0x0004; my $DELETE = 0x00010000; my $strKeyPath = "SYSTEM\\CurrentControlSet"; my @arrSubKeys = (); my @valueNames = (); my @valueTypes = (); my $wmiService = Win32::OLE->GetObject("winmgmts:\\\\.\\ROOT\\default: +StdRegProv"); my $errorMsg = Win32::OLE->LastError(); print "Error message: $errorMsg\n"; my $tempErrorMsg = Win32::GetLastError(); $errorke = Win32::FormatMessage($tempErrorMsg); print "Error message2 : $tempErrorMsg - > $errorMsg\n"; my @tmpArr = (); $strKeyPath = "Console"; my $strValueName = "HistoryBufferSize"; my $tmpValues; my @tmpTest; my $HasAccessRight; @tmpTest = $wmiService->CheckAccess($HKEY_LOCAL_MACHINE, "HKEY_CURRENT +_USER\\Console", $KEY_QUERY_VALUE, $HasAccessRight); print "Key access rights: $HasAccessRight\n"; # Returns nothing print "Key access rights (2): @tmpTest\n"; # Retruns 2 @tmpTest = $wmiService->GetDWORDValue(2147483649, "HKEY_CURRENT_USER\\ +Console", "NumberOfHistoryBuffers", $tmpValues); $errorMsg = Win32::OLE->LastError(); print "Error message: $errorMsg\n"; $tempErrorMsg = Win32::GetLastError(); $errorMsg = Win32::FormatMessage($tempErrorMsg); print "Error message2 : $tempErrorMsg - > $errorMsg\n"; print "Current History Buffer Size: ".$tmpValues."\n"; # Returns nothi +ng print "Current History Buffer Size (2): @tmpTest\n"; # Returns 2

The $log->info is nothing more than a fancy way to print messages both to the screen and into a logfile.
(has been removed by request of liverpole).

The errors that I print to screen all return value 0 (which means success).
Also, no warnings are displayed.

Thanks in advance. UPDATE:
Code snipset has been updated, by request of liverpole

In reply to Windows XP: StdRegProv by jschollen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.