Announcement

Collapse
No announcement yet.

Windows XP REG_BINARY registry key scripted editing?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Windows XP REG_BINARY registry key scripted editing?

    I'm toying with increasing simplification of an almost automated solution I've put together at work (way above and beyond, absolutely not called for, and not really required, but I think it would be cool to accomplish), involving a secure wireless software client application. I've pre-configured the MSI (installer package) to automatically store correct license and key values, settings, etc, using Orca (Microsoft's awesome MSI editor), scripted starting and setting to Automatic the Wireless Zero Configuration service in batch, and automated adding of the SSIDs and keys using an obscure command-line app for just such tasks made by Aruba, but one of my last endeavors has me temporarily stumped.

    After the installer has completed, there is a setting whose default is not that which we desire. Therefore, you must open the application, click over to another tab, hit a button, check a box, and hit another button to save that modified setting. Not too bad, but I'm trying to develop a completely automated (unattended) install, so I can blast it out silently to a number of systems after hours.

    Now, my first thought was, "That setting must either be stored in a file, or the registry", so I set out comparing the system's files and registry before and after, and isolated the two registry keys that controlled this setting. They were both REG_BINARY keys, containing about a thousand bytes of data each (in raw hex, as such: 00,0F,6A,34,33,). So, I simply exported a copy of each key (after the setting had been changed) to a .reg file, unchecked the box, saved the setting change, and ran (re-imported, by double-clicking) the .reg files. This accomplished the task (it checked the box for me and the setting was changed), but then I tried it on another system, and it checked the box, but the system failed authentication. Upon closer examination, it turned out that this REG_BINARY key's value controlled not only that setting, but about twenty other settings, and also contained a system-specific authentication key that was generated during installation.

    Hence the conundrum. I will need to modify SOME bytes of the REG_BINARY value, and not others. I performed a comparison between these keys before and after, using WinMerge, and isolated the differences (hence, the pieces I'll need to change, which shouldn't affect the auth key or other settings), but there doesn't seem to be a simple solution for editing a REG_BINARY value. I thought perhaps I could export both keys, and perform a command-line search+replace, then import both modified keys, but every app I tried that claimed to do that failed (most because they didn't support binary files, some for reasons unknown, and they don't have adequate documentation). I looked into VBScripting the solution, but VBScript's REGWRITE command can only write two bytes of data to a REG_BINARY, per Microsoft (wtf?).

    I suppose I could write a program to parse the binary data in the reg exports, but I'd imagine that to be a real bitch, and it's not like I'm adept at reading and patching binary files in any language.

    Does anyone have any idea as to a good method of doing what I'm getting at? I won't be disappointed if no one does, but it would be interesting to hear a solution, nonetheless. If nothing else, it's interesting that there isn't a simple way to automate this, and if there currently isn't, and I or anyone else develops a solution, it should be shared, so others can benefit. I've seen quite a few other people asking about the same thing on various forums, with no decent responses.
    I may be lazy, but I can...zzzZZZzzzZZZzzzZZZ...

  • #2
    I've found a command-line app (Hexalter) that will allow me to automate hex-editing of binaries in the format app.exe [file] offset value (actually, I can edit multiple values at once). This will allow me, albeit somewhat tediously, to batch script a byte-patching of the exported registry keys, before re-importing them, which should solve the problem.
    I may be lazy, but I can...zzzZZZzzzZZZzzzZZZ...

    Comment


    • #3
      This sounds dangerous! :S
      Cant stand the 32 bit and above gaming.
      Gamers for the return of 2d sprite filled games!

      Comment


      • #4
        Nah. The worst it will do is make a broken registry key, which I can easily find and delete if required.
        I may be lazy, but I can...zzzZZZzzzZZZzzzZZZ...

        Comment


        • #5
          So, it turned out that the entire REG_BINARY key was encrypted, thus defeating any chance I had of automated, CLI hex-editing. However, after speaking with the software developers of this particular system, I now have a much easier solution, involving replication of the options set via software profile manipulation (which causes the app to generate the appropriate key and import it into the registry).

          So, problem solved
          I may be lazy, but I can...zzzZZZzzzZZZzzzZZZ...

          Comment


          • #6
            A solution I've taken at times when automating the installation and configuration of [very badly written installers and/or] software, was AutoIt 3. AI3 allows scripting GUI interactions, which is useful when the CLI just won't cut it. (Try configuring Microsoft Office 2003 options that are not available in the Custom Installation Wizard without it. I double dog dare you...)

            Needless (?) to say, AI3 can be quite a lifesaver.

            Comment


            • #7
              But it's not just a matter of emulating keyboard actions, is it? I mean, does it have the ability to determine the correct window to interact with?
              I may be lazy, but I can...zzzZZZzzzZZZzzzZZZ...

              Comment


              • #8
                Yes!

                Comment


                • #9
                  Nice. I shall have to take a look at that. Then, I shall have to see if it's DoD approved, and if not, if I can get it DoD approved for specific purposes...
                  I may be lazy, but I can...zzzZZZzzzZZZzzzZZZ...

                  Comment

                  Working...
                  X