Wednesday, August 17, 2016

Policy Plus - Works on Home

After installing a fresh copy of Windows 7 Home Premium into a new VM, I tested Policy Plus in it. I immediately noticed that Windows 7 doesn't come with a modern version of the .NET Framework. I installed v4.0 in the VM, but Policy Plus crashed at startup with a bizarre error about Marshal.SizeOf. I installed v4.5, but I got a different bizarre error. I actually needed to install v4.5.2, but in the interest of working on as many machines as possible, I changed Policy Plus's target framework to v4.5.

I then found that though Home editions have some ADMX templates (and Policy Plus loads them fine), it's missing a lot of the more interesting ones. Fortunately, ADMX files can be downloaded legitimately from Microsoft for free, and Policy Plus is happy to load them from any folder.

When I tried to save some changes to the local GPO (which doesn't exist by default on Home), the program crashed because it couldn't find gpt.ini. I added a check for that; now that file will be automatically created if it's missing. I also discovered that Home editions do have gpsvc.dll - the file I was testing for to determine Pro status - but not secpol.msc, so that path test has been changed.

When testing the Registry diff-and-apply routine, I found that instead of being converted to the appropriate object type, POL entries were being passed to the Registry functions as byte arrays (whoops).

Then the big test: whether Windows Home actually cares about these Registry entries. It does, at least with the ones I've tried! RefreshPolicyEx doesn't throw on Home, but it doesn't do anything either, so a reboot or logon/logoff cycle is needed for computer or user settings (respectively) to take effect. The goal of working on all Windows editions is accomplished!

Running perfectly on Windows 7 Home Premium
There's still a lot left to do, though. There are still no comments, no way to search by name/text, and the UX could use polishing. I also have a lot more features in mind that haven't been started yet.

The changes are live on GitHub.

No comments:

Post a Comment