A couple weeks ago, I received a report from a Policy Plus user of an error in saving the POL file. Based on the error message displayed, the failure occurred when RegistryKey.SetValue couldn't figure out how to write a .NET value as Registry data. Unfortunately, there was no indication what type the problematic value was. I tried editing every kind of policy element and they all worked as expected... until I tried a huge numeric value. Apparently SetValue tries to convert the data to a signed 32-bit integer when writing a DWord value (even though the Registry is unsigned, if I understand correctly), which fails for unsigned integers larger than 2,147,483,647. As a workaround, unsigned integer values are now reinterpreted bitwise as signed integers while writing to the Registry and vice versa when reading.
Various technical articles, IT-related tutorials, software information, and development journals
Saturday, June 26, 2021
Friday, April 30, 2021
Policy Plus - Policy definition ACL fix
Microsoft apparently changed its mind about only publishing policy definitions through Windows Update - new MSIs are now available for download on the web - so I was able to update Policy Plus's Acquire ADMX feature to download the most recent (20H2) definitions, after dealing with the wrinkle that the directory structure inside the MSI archive changed somewhat.
I recently received an issue report from a Policy Plus user stating that acquiring ADMX files failed in the "securing destination" phase on Windows 7 Home. Sure enough, I got the same error when testing on Windows 7 specifically, but not on Windows 10. Evidently, the PolicyDefinitions folder's ACL is different across Windows versions. I fixed the immediate problem by setting the owner to Administrators (using the take-ownership privilege) in a separate step before adding the ACL that allows Administrators full control. While inspecting the ACLs, however, I also noticed that the newly installed policy definition files had ACLs from the temporary directory under the user's profile folder rather than the typical ACL for publicly readable Windows files. ACLs are now inherited from the PolicyDefinitions directory, like they should be. Finally, I added a check for whether Policy Plus is elevated and, if not, made all permission overrides skipped so that normal users can make their own personal, portable policy definitions folder.
These changes are live on GitHub.
Monday, December 21, 2020
Policy Plus - Explicit checkbox elements and policy state detection
This morning I received a report from a Policy Plus user that its assessment of a policy state was inconsistent with that of the real Local Group Policy Editor. The policy had been set to Disabled in the official editor, but Policy Plus reported it as Unknown, which indicates that some Registry evidence favors it being Enabled while other evidence suggest it's Disabled. Indeed, the policy's main Registry value was deleted, but the value corresponding to a checkbox element was present and set to 0. Zero is that element's "off" value, but an unchecked checkbox is different than the whole policy being Disabled.
Experimenting with several different policies involving checkbox elements, I found that the Local Group Policy Editor writes checkbox elements' "off" values to the Registry when the policy is Disabled if the element has data explicitly defined. If the element's data is left implicit/default, disabling the policy deletes its Registry value like I expected. I still think it would be better if things worked the way I had previously assumed, since the way it actually works allows cases (in real policies!) where "policy Enabled but checkbox unchecked" is literally indistinguishable from "policy Disabled", but Policy Plus needs to reflect reality rather than my preferred design.
When judging a policy's state, Policy Plus now considers the presence of a checkbox element's "off" value as weak evidence for the policy being Disabled. When saving the state of Disabled policies, it writes checkbox elements' "off" values, if specified, instead of deleting them. While I was at it, I adjusted the setting editor window to avoid crashing when editing a mixed-state policy, not that there should be any anymore. The changes are live on GitHub.
Saturday, November 28, 2020
Policy Plus - Fix list element REG export
I received a Policy Plus issue report on GitHub stating that the Export REG feature failed. After experimenting with the GPOs on a couple machines, I found what was necessary for the crash: list policy elements that clear the list key before adding values. When the PolFile representing the GPO tried to apply the key clearance, it requested the list of existing values in the target RegFile, which crashed because the REG file implementation of PolicySource is write-only. Changing ApplyDifference to use the ClearKey interface method instead fixed the problem.
But in the course of hunting down the issue and testing the fix, I found multiple other problems related to list elements. The POL editor window had an off-by-one error that caused a crash if adding a "clear the key before adding values" directive to the last key in the list - an easy fix. The list editor window (launched from the setting editor dialog) showed the **delvals. pseudo-value on subsequent launches of the setting editor for list elements that clear the key first. That was caused by the PolFile implementation of GetValueNames returning raw POL value names, which is important for the POL editor window but problematic here. For consistency with the RegistryPolicyProxy implementation, I changed the interface method implementation to return only true values and added another method to get raw POL entries.
The changes are live on GitHub.
Saturday, September 19, 2020
Policy Plus - ADMX download suggestion
Monday, June 1, 2020
Policy Plus - Versioning with Git
Tuesday, January 7, 2020
Policy Plus - More list UI fixes
While investigating that specific policy, I found a problem in the Element Inspector. Even though the list element had a prefix attribute (albeit an empty one), the inspector said "no prefix." I corrected the conditional.
Sunday, January 5, 2020
Policy Plus - REG file tolerance
I also happened to notice that searching for a certain policy made the search dialog say it found a hit but not actually display a result. Apparently I had only put the list-updating code in the progress-update, not completion, handler. So up to 19 policies could never be shown in the search results. I fixed that with a tweak to the search dialog.
Friday, November 15, 2019
Policy Plus - Several fixes
While double-checking that multiTextBoxes work with Semantic Policy, I noticed that Semantic Policy import was broken for user policies; all policies were always imported to the machine policy source. That was an easy fix.
The changes are live on GitHub.
Thursday, August 15, 2019
Policy Plus - Apply button fix
The change, which happens to be the hundredth commit to Policy Plus, is live on GitHub.
Tuesday, July 9, 2019
Policy Plus - Dependencies cleanup
I also investigated a report of an "an item with the same key has already been added" error when loading policy definitions. I was unable to reproduce it; IDs are qualified by the target namespace of the ADMX file that defines them and defining a duplicate target namespace produces a different error. I'll remain on the lookout for problems related to that system.
Sunday, June 30, 2019
Policy Plus - Refresh on Home
The change is live on GitHub.
Monday, June 24, 2019
Policy Plus - ADML language override
If a preferred language code has been set, Policy Plus will use that instead of the locale name.
This change is live on GitHub.
Friday, May 17, 2019
Policy Plus - Similar language ADML loading
Sunday, February 3, 2019
Policy Plus - List fix
While I was investigating that issue, I also noticed that the Find by Registry feature didn't detect keys used for list storage. Both problems should now be fixed - the changes are live on GitHub.
Friday, July 6, 2018
Policy Plus gets its first pull request
Friday, May 18, 2018
Policy Plus - Comments in Semantic Policy
I also updated the ADMX download URL to point to the package for Windows 10 1803.
These changes are live on GitHub.
Monday, March 19, 2018
Policy Plus - Check state inversion fix
Policy Plus - Better ADMX loader
These changes are live on GitHub.
Wednesday, March 7, 2018
Policy Plus - Considering how to improve the ADMX loader
When it comes to missing ADML files, the LGPE fails the load of the corresponding ADMX. (Again, Policy Plus currently fails the entire workspace.) I think ignoring that one ADMX is reasonable; trying to continue using the display codes as the text would work for simple policies, but without the ADML, there's no way to arrange the presentations of extra options.