Sunday, August 13, 2017

Policy Plus - Import/export REG

Today I continued working on the REG import/export feature for Policy Plus. First I wrote the Save method for RegFile, which does its best to produce the exact same results as the Registry Editor. I haven't yet managed to make it linebreak hex strings identically, but that doesn't appear to be a problem.

Then I wrote the Apply method, which is very simple, but with one downfall. The REG format doesn't have a way to express "clear this key" without blowing away the entire subtree. Therefore, it's possible that Policy Plus and the Registry Editor will disagree about what a given REG does, but I'm not aware of any policies that delete a whole tree - key clearance is only used for lists, whose keys don't have subkeys.

To make use of all this new code, I added Import REG and Export REG menu items to the main form. They put up a respective dialog prompting for some settings before performing the import or export. Both ask for a filename and a prefix (so that hive-relative policy Registry entries can be exchanged with absolute Registry paths), but the exporter also allows the user to specify a branch to export. All this appears to work, but I'd like to put it through some more testing before publishing the changes.

The next step (aside from testing) is to add Import and Export buttons to the Edit Raw POL dialog.

No comments:

Post a Comment