Professional Web Applications Themes

Registry Search Pattern & Replace String - PERL Beginners

I am not sure what the best way to tackle this problem so here it goes... I want to use the user's input to replace a string value in the registry. The problem is locating the subkey. There is one location that I need to change the string value: \HKLM\SOFTWARE\Funk Software, Inc.\odyssey\client\configuration \userDefaults\profiles\profile#1A1A1AAAAA11111AAAA 1AA1A1A1A1A1A1AAA1111 \authentication ttlsIdentity: UserName Under the "profiles" key, there are two "profile#..." subkeys. There are exactly 40 alphanumerics following the "#". Under both "authentication" keys, they both contain the "ttlsIdentity" string value. If I have to make both the same values, that's fine as long as I ...

  1. #1

    Default Registry Search Pattern & Replace String

    I am not sure what the best way to tackle this problem so here it goes...

    I want to use the user's input to replace a string value in the registry.
    The problem is locating the subkey. There is one location that I need to
    change the string value:

    \\HKLM\SOFTWARE\Funk Software, Inc.\odyssey\client\configuration
    \userDefaults\profiles\profile#1A1A1AAAAA11111AAAA 1AA1A1A1A1A1A1AAA1111
    \authentication

    ttlsIdentity: UserName

    Under the "profiles" key, there are two "profile#..." subkeys. There are
    exactly 40 alphanumerics following the "#".

    Under both "authentication" keys, they both contain the "ttlsIdentity"
    string value. If I have to make both the same values, that's fine as long
    as I change the second "ttlsIdentity" value to the username the user input
    in the script.

    What differetiates the two profile keys are that they contain different
    string values for secondaryAuth in subkey "authentication."

    HKLM
    - SOFTWARE
    - Funk Software, Inc.
    - odyssey
    - client
    - configuration
    - userDefaults
    - profiles
    - profile#8825B0B4471E4123B86A0D08C27FC0A6414F7568
    - authentication
    *secondaryAuth (REG_SZ)= MS-CHAP-V2
    *ttlsIdentity (REG_SZ)= username
    - profile#93976CFE828C6DBFAD79EA46268C893B413F6223
    - authentication
    *secondaryAuth (REG_SZ)= PAP-Token
    *ttlsIdentity (REG_SZ)= username

    Any help would be greatly appreciated!
    Steve Guest

  2. #2

    Default Registry Search Pattern & Replace String

    I am not sure what the best way to tackle this problem so here it goes...

    I want to use the user's input to replace a string value in the registry.
    The problem is locating the subkey. There is one location that I need to
    change the string value:

    \\HKLM\SOFTWARE\Funk Software, Inc.\odyssey\client\configuration
    \userDefaults\profiles\profile#1A1A1AAAAA11111AAAA 1AA1A1A1A1A1A1AAA1111
    \authentication

    ttlsIdentity: UserName

    Under the "profiles" key, there are two "profile#..." subkeys. There are
    exactly 40 alphanumerics following the "#".

    Under both "authentication" keys, they both contain the "ttlsIdentity"
    string value. If I have to make both the same values, that's fine as long
    as I change the second "ttlsIdentity" value to the username the user input
    in the script.

    What differetiates the two profile keys are that they contain different
    string values for secondaryAuth in subkey "authentication."

    HKLM
    - SOFTWARE
    - Funk Software, Inc.
    - odyssey
    - client
    - configuration
    - userDefaults
    - profiles
    - profile#8825B0B4471E4123B86A0D08C27FC0A6414F7568
    - authentication
    *secondaryAuth (REG_SZ)= MS-CHAP-V2
    *ttlsIdentity (REG_SZ)= username
    - profile#93976CFE828C6DBFAD79EA46268C893B413F6223
    - authentication
    *secondaryAuth (REG_SZ)= PAP-Token
    *ttlsIdentity (REG_SZ)= username

    Any help would be greatly appreciated!
    Steve Guest

  3. #3

    Default Favorite Templates for POD?

    I'm using POD for the first time. Unlike POD's counterparts for C# and Java
    programming, POD is pretty unstructured.

    (1) Are there some favorite examples to follow? For example, I learned from
    looking at CGI.pm, but was surprised that there was not set of comments
    preceding each function that describes the function. Is this typical?

    (2) I started to write a little emacs function to insert my standard POD
    skeleton for the beginning of a module and a second emacs function to insert
    my standard POD skeleton for every function. The problem is, being new, I
    don't' have any standards. Can anyone reference me to some POD skeletons for
    functions, modules, global variables and classes?

    (3) When perl programmers doent their functions, are they encouraged to
    use some kind of machine readable notation to indicate if function argument
    is passed by reference or by value, if it is input, output or modified,
    scalar or array or hash etc...? I have not seen this in the perl code I've
    looked at and I am surprised. It seems to me that POD ought to encourage one
    to record all the information necessary to call the function. The same goes
    for classes: is that data member public, private, protected, internal etc...
    Does anyone record these kind of details in the POD fragments? If so, do
    you have an example I could follow?

    Thanks,
    Siegfried

    Siegfried Guest

  4. #4

    Default Re: Registry Search Pattern & Replace String

    From: Steve <com> 

    If you install the Win32::Registry2 patch from
    http://Jenda.Krynicky.cz/#Win32::Registry2 you may do something like
    this:

    use Win32::Registry;
    ...

    my $key = $HKLM->Open('SOFTWARE\Funk Software,
    Inc.\odyssey\client\configuration\userDefaults\pro files');

    foreach my $subkey ($key->GetKeys()) {
    next unless my $subkey = $key->Open("$subkey\\authentication");
    next unless $subkey->GetValue('secondaryAuth') eq 'PAP-Token'
    $subkey->SetValue('ttlsIdentity', REG_SZ, $username)
    }

    Jenda
    P.S.: The code is untested, but should be about right.
    ===== cz === http://Jenda.Krynicky.cz =====
    When it comes to wine, women and song, wizards are allowed
    to get drunk and croon as much as they like.
    -- Terry Pratchett in Sourcery

    Jenda Guest

Similar Threads

  1. Search and replace pattern in a file
    By Perl in forum PERL Beginners
    Replies: 2
    Last Post: January 20th, 01:04 AM
  2. Search replace using 2 lines for pattern
    By Bertrand Mansion in forum PERL Beginners
    Replies: 3
    Last Post: January 18th, 02:27 PM
  3. some stupid questions about string search & replace in perl
    By walala in forum PERL Miscellaneous
    Replies: 21
    Last Post: September 23rd, 06:29 AM
  4. Replies: 3
    Last Post: September 21st, 07:21 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139