Loading ...
Sorry, an error occurred while loading the content.

222Re: [NTS] Re: Registry Browser (Notetab+Perl)

Expand Messages
  • Sheri
    May 14 9:38 AM
    • 0 Attachment
      Hi again,

      At 01:32 AM 5/14/03 -0700, you wrote:
      >But I still don't know how to READ :-(

      The following works (just change the regular clips to ^!RunPerl these alt versions instead of the other ones). It has all the same stuff in the use statement as yours, except I quickly discovered problems with using "/" (some subbranches have that in their name) as a delimiter and reverted to "\\". All I had to do was replace all my

      "$key->" stuff

      with

      "$Registry->{"$Branch"}"

      Doesn't even need the eval anymore; ditto for _AltPerlRegValScript further down.

      Sheri

      H="_AltPerlRegScript"
      #;5/14/03 alternate version
      use strict;
      my $Registry;
      use Win32::TieRegistry 0.24 (
      TiedRef => \$Registry, Delimiter => "\\\\", ArrayValues => 1,
      SplitMultis => 1, AllowLoad => 1,
      qw( REG_SZ REG_EXPAND_SZ REG_DWORD REG_BINARY REG_MULTI_SZ
      KEY_READ KEY_WRITE KEY_ALL_ACCESS ),
      );
      #my $Branch=$ARGV[0];
      my $Branch = <STDIN>;
      chomp $Branch;
      #double up slashes for use in tieregistry
      $Branch =~ s/\\/\\\\/g;
      my ($key, $valcount, @names, @namesunsort, @subbranches, @subbranches_unsort, $subkeycount);
      @namesunsort = $Registry->{"$Branch"}->ValueNames;
      @names = sort(@namesunsort);
      $valcount = @names;
      if ($valcount>0) {print "Show the $valcount Value Keys\n";}
      @subbranches_unsort = $Registry->{"$Branch"}->SubKeyNames;
      @subbranches = sort(@subbranches_unsort);
      $subkeycount = @subbranches;
      #Problem! $subkeycount isn't working
      if ($subkeycount = 0) {print "No Subkey Branches Found\n";}
      else {
      foreach $_(@subbranches){
      print;
      print "\n";
      }
      }
      if ($valcount>0) {
      print "XSEPX\n";
      print "Return to Subkey Branch Display\n";
      foreach $_(@names){
      print;
      print "\n";
      }
      }


      H="_AltPerlRegValScript"
      #;5/14/03 alternate version
      use strict;
      my $Registry;
      use Win32::TieRegistry 0.24 (
      TiedRef => \$Registry, Delimiter => "\\\\", ArrayValues => 1,
      SplitMultis => 1, AllowLoad => 1,
      qw( REG_SZ REG_EXPAND_SZ REG_DWORD REG_BINARY REG_MULTI_SZ
      KEY_READ KEY_WRITE KEY_ALL_ACCESS ),
      );
      my ($key, $valueString, $valname, $valuetype, $Branch,);
      #double up slashes for use in tieregistry
      while (<STDIN>) {
      chomp; # avoid \n on last field
      ($Branch, $valname) = split(/::/);
      }
      $Branch =~ s/\\/\\\\/g;
      #my $keyq = qq(new Win32::TieRegistry "$Branch");
      #$key = eval($keyq);
      ($valueString,$valuetype) = $Registry->{"$Branch"}->GetValue("$valname");
      if ($valuetype == 3) {print "unprintable data, type $valuetype";}
      elsif ($valuetype == 7) {print "unprintable data, type $valuetype";}
      else {print "Data type\: ", $valuetype, "\n\nValue\: ", $valueString;}
      #end of script
    • Show all 17 messages in this topic