| 1 |
|
|---|
| 2 | Registry Command Line API Tool
|
|---|
| 3 | ------------------------------
|
|---|
| 4 |
|
|---|
| 5 | This progam is intended to fill a particular need. I needed to make the
|
|---|
| 6 | wine registry look like it would have been if my application would have
|
|---|
| 7 | been installed by its installation program. Since this was not possible I
|
|---|
| 8 | took the following approach.
|
|---|
| 9 |
|
|---|
| 10 | 1 - Use regedit to export my full Windows registry before I install my
|
|---|
| 11 | application.
|
|---|
| 12 |
|
|---|
| 13 | 2 - Use regedit to export my full Windows registry after I had install my
|
|---|
| 14 | application.
|
|---|
| 15 |
|
|---|
| 16 | 3 - Generate the differences between the two image. What I obtain from the
|
|---|
| 17 | diff is what I need to apply to the wine registry.
|
|---|
| 18 |
|
|---|
| 19 | Obvisouly the process is not that straight forward to solve, first,
|
|---|
| 20 | you don't get the diff between two Windows regedit exported .reg file by
|
|---|
| 21 | doing a simple diff. What I had to do is a little more complex, but not
|
|---|
| 22 | that much...
|
|---|
| 23 |
|
|---|
| 24 | (Assuming that the registry picture files are
|
|---|
| 25 | named ./before.reg and ./after.reg)
|
|---|
| 26 |
|
|---|
| 27 | 1 - Parse the before.reg and after.reg file into regFixer.pl, in order to
|
|---|
| 28 | obtain lines in the form [HKEY\Sub1\Sub2\...\Subn]"Value"="Data"
|
|---|
| 29 | (where "Data" can be prefixed by the type identifier : hex:, hex(0000000?)
|
|---|
| 30 | or dword:)
|
|---|
| 31 |
|
|---|
| 32 | 2 - Generate the diff between the before.reg.fix and after.reg.fix
|
|---|
| 33 | into app.diff
|
|---|
| 34 |
|
|---|
| 35 | Now we have a app.reg file that contain what has been done by installing the
|
|---|
| 36 | application. To this we extract the parts that we are interested in using
|
|---|
| 37 | grep (and fix it with sed) and put that into app.added by example
|
|---|
| 38 | ( let's say we keep the added values only ).
|
|---|
| 39 |
|
|---|
| 40 | At this point we know which registry entry to add to the wine registry. It
|
|---|
| 41 | only remains to take the format we have and reset it into a format similar
|
|---|
| 42 | to the one we get from regedit.
|
|---|
| 43 |
|
|---|
| 44 | I say "similar" because there is a tiny difference between Windows regedit
|
|---|
| 45 | export format and the format actually required by the tool.
|
|---|
| 46 |
|
|---|
| 47 | The problem with this (and it is not a big one) is that regedit exports long
|
|---|
| 48 | data streams onto many lines, and since I don't have tons of time I setup
|
|---|
| 49 | another Perl script (regRestorer.pl) that fixes this (this could easily
|
|---|
| 50 | be done in C obviously) (left as exercise ;-) ).
|
|---|
| 51 |
|
|---|
| 52 | So, once you parsed app.added into regRestorer.pl you get an app.reg ready to
|
|---|
| 53 | process by regapi.
|
|---|
| 54 |
|
|---|
| 55 | So, this package comes with a few pieces:
|
|---|
| 56 |
|
|---|
| 57 | regFixer.pl - Will convert the export of regedit
|
|---|
| 58 | into something "diff-able"
|
|---|
| 59 |
|
|---|
| 60 | regRestorer.pl - Will convert "cleaned" diff file into
|
|---|
| 61 | something "regapi-able"
|
|---|
| 62 |
|
|---|
| 63 | regSet.sh - Will do the procedure explained herein
|
|---|
| 64 | for the added key only.
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 | FAQ
|
|---|
| 68 | ---
|
|---|
| 69 |
|
|---|
| 70 | Quick Start Guide
|
|---|
| 71 | -----------------
|
|---|
| 72 | 1 - Get a snapshot of your windows registry in before.reg, (regedit/export)
|
|---|
| 73 | 2 - Install your application,
|
|---|
| 74 | 3 - Get a snapshot of your windows registry in after.reg.
|
|---|
| 75 | 4 - Invoke ./regSet.sh before.reg after.reg
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 | Adding key I have in a regedit export file (nothing to diff with...)
|
|---|
| 79 | ------------------------------------------
|
|---|
| 80 | 1 - Invoke ./regSet.sh /dev/null myRegistry.reg
|
|---|
| 81 |
|
|---|
| 82 | regapi help
|
|---|
| 83 | -----------
|
|---|
| 84 | 1 - regapi has some sort of "man page like" help in it, simply invoke it
|
|---|
| 85 | without any arguments.
|
|---|
| 86 |
|
|---|
| 87 | Hope this is of any use to you.
|
|---|
| 88 |
|
|---|
| 89 | Sylvain St-Germain.
|
|---|