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

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

Expand Messages
  • Sheri
    Thanks Alan, From what you ve said, I think that the regedit export file must be a little different in Win 2k than my 98. You should only see the names of
    Message 1 of 17 , May 15, 2003
    • 0 Attachment
      Thanks Alan,

      From what you've said, I think that the regedit export file must be a little different in Win 2k than my 98.

      You should only see the names of Values in that second wizard, and not see or get to select again the branch or any subbranches. (I thought "Value Names" were called "Keys" when I wrote that clip).

      I found a glitch in my Perl registry browser too. Turns out "default" Values are unnamed. A ^$StrTrim$ I was using in the clip was removing blank value names.

      I've made some more changes in my Perl regbrowser and I'm not sure why, but multi's and binary values retrieved no longer crash the clip. Now multis display as "Array(...)" and binaries just show up blank.

      Weird.

      Regards,
      Sheri
    • Sheri
      Hi again Alan, Solved the problem of showing multi values such as the fonts entry for FooWriter. Have to refer to the valueString as an array if the data type
      Message 2 of 17 , May 16, 2003
      • 0 Attachment
        Hi again Alan,

        Solved the problem of showing multi values such as the fonts entry for FooWriter. Have to refer to the valueString as an array if the data type is REG_MULTI_SZ, i.e., @$valueString.

        This version does that and depicts default value names as .Default in clip wizards (but retrieves the actual values using "").

        Sheri

        H="Browse Registry via Perl"
        ;Created by Sheri Pierce 5/10/03
        ;5/16/03 version
        ^!Info This clip captures the currently selected subkey branch and value key name on the clipboard.
        :Start
        ^!Set %Branch%=""
        ^!Set %curdoc%="^$GetDocName$"
        ^!SetWizardLabel
        ^!Set %Root%=HKEY_CLASSES_ROOT|HKEY_CURRENT_USER|HKEY_LOCAL_MACHINE|HKEY_USERS|HKEY_CURRENT_CONFIG
        ^!Set %Branch%="^?{(T=L;H=5)Enter Registry Branch=^%Root%}"
        ^!IfCancel Out
        ^!SetClipboard ^%Branch%
        :PerlSubs
        ^!Setscreenupdate off
        ^!Menu File/New
        ^!InsertText ^%Branch%
        ;^!RunPerl "PerlRegScript"
        ^!RunPerl "AltPerlRegScript"
        ^!IfFileExist ^$GetAppPath$StdError.err PerlError
        ^!SetListDelimiter XSEPX^P
        ^!SetArray %SubsandVals%="^$StrTrim("^$GetText$")$"
        ^!Clip "BrowseRegSubClip"
        ^!DestroyDoc
        ^!SetDocIndex=^$GetDocIndex("^%curdoc%")$
        :ShowSubs
        ^!Set %count%=0
        ^!Set %choices%=""
        ^!If ^$StrPos("\";"^%Branch%";No)$>0 Next Else Skip_2
        ^!Set %choices%="_Up a level|"
        ^!Goto Loop
        ^!Set %choices%="_Up to Root|"
        :Loop
        ^!Inc %count%
        ^!If ^%count%>^%Subkeys0% Doit
        ^!Append %choices% ^%Subkeys^%count%%|
        ^!Goto Loop
        :Doit
        ^!SetWizardLabel ^%Branch%
        ^!Set %oldchosen%=^%chosen%
        ^!Set %chosen%=^?{(T=L;H=15)Select a key=^%choices%}
        ^!IfCancel Out
        ^!If ^%chosen%="Up a level" Up_Level
        ^!If ^%chosen%="Up to Root" Start
        ^!IfMatch "Show the \d+ Value Keys" "^%chosen%" ShowVals
        ^!IfMatch "No Subkey Branches Found" "^%chosen%" Skip_-5
        ^!IfTrue ^$IsEmpty(^%chosen%)$ Skip_-6
        ^!Set %Branch%="^%Branch%\^%chosen%"
        ^!SetClipboard ^%Branch%
        ^!Goto PerlSubs
        :Up_Level
        ^!Set %size%=^$StrSize("^%Branch%")$
        ^!Set %LastSlash%=^$StrPosRight("\";"^%Branch%";No)$
        ^!If ^%LastSlash%=0 Root
        ^!Set %Branch%=^$StrDeleteRight("^%Branch%";^$Calc(^%size%-^%LastSlash%+1)$)$
        ^!Goto PerlSubs
        :Root
        ^!Set %Branch%=""
        ^!Goto Start
        :ShowVals
        ^!Set %count%=0
        ^!Set %keychoices%=""
        :LoopVals
        ^!Inc %count%
        ^!If ^%count%>^%Valkeys0% Dovals
        ^!Append %keychoices% ^%Valkeys^%count%%|
        ^!Goto LoopVals
        :Dovals
        ^!Set %key%=^?{Select key==^%keychoices%}
        ^!IfCancel Out
        ^!IfMatch "Return to Subkey Branch Display.*" "^%key%" ShowSubs
        ^!IfMatch "\.Default" "^%key%" Next Else Skip_1
        ^!Set %key%=""
        ^!SetClipboard ^%Branch%:^%key%
        :PerlInfo
        ^!Menu File/New
        ^!InsertText ^%Branch%::^%key%
        ;^!RunPerl "PerlRegValScript"
        ^!RunPerl "AltPerlRegValScript"
        ^!Set %ValViaPerl%=^$StrTrim(^$GetText$)$
        ^!IfFileExist ^$GetAppPath$StdError.err PerlError
        ^!DestroyDoc
        ^!SetDocIndex=^$GetDocIndex("^%curdoc%")$
        ^!IfTrue ^$IsEmpty(^$GetRegValue("^%Branch%:^%key%")$)$ Next Else Skip_2
        ^!Info Notetab's ^^%caret%$GetRegValue$ function doesn't read this key!^PRegistry Value via Perl^P=^P^%ValViaPerl%
        ^!Goto Skip_1
        ^!Info Registry Value via Notetab GetRegValue (seems to work only when the value contains string or decimal value)^P =^P ^$GetRegValue("^%Branch%:^%key%")$^P===^PRegistry Value via Perl^P=^P^%ValViaPerl%
        ^!Goto Dovals
        :Out
        ^!Info Reminder: the last used branch and valuekey (if any) is on the clipboard.
        ^!ClearVariable %PassBranch%
        ^!Goto End
        :PerlError
        ^!Info Sorry, there was a Perl Error.
        ^!Open ^$GetAppPath$StdError.err


        H="_BrowseRegSubClip"
        ^!SetListDelimiter ^P
        ^!SetArray %Subkeys%=^%SubsandVals1%
        ^!SetArray %Valkeys%=^%SubsandVals2%


        H="_AltPerlRegScript"
        #;5/16/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 ($cntSubKeys,$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);
        $cntSubKeys = @subbranches;
        #%keyInfo= $Registry->{"$Branch"}->Information;
        #Alternate way to get counts
        #( $cntSubKeys )= $Registry->{"$Branch"}->Information( "CntSubKeys" );
        #print "cntSubKeys is $cntSubKeys\n";
        #$savecnt = $cntSubKeys;
        if ($cntSubKeys == 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 \($cntSubKeys\)\n";
        foreach $_(@names){
        if ($_ ne "") {print "$_\n";}
        else {print "\.Default\n";}
        }
        }

        H="_AltPerlRegValScript"
        #;5/16/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 ($valueString, $valname, $valuetype, $Branch,);
        #my $Branch=$ARGV[0];
        #my $Branch = <STDIN>;
        #chomp $Branch;
        #double up slashes for use in tieregistry
        while (<STDIN>) {
        chomp; # avoid \n on last field
        ($Branch, $valname) = split(/::/);
        }
        $Branch =~ s/\\/\\\\/g;
        ($valueString,$valuetype) = $Registry->{"$Branch"}->GetValue("$valname");
        if (($valuetype =~ /MULTI/) or ($valuetype == 7)) {print "Data type\: ", $valuetype, "\nValue\: ", @$valueString;}
        else {print "Data type\: ", $valuetype, "\nValue\: ", $valueString;}
        #end of script
      Your message has been successfully submitted and would be delivered to recipients shortly.