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.

Sunday, November 15, 2020

The Windows 10 global microphone off switch

Today I spent a good chunk of time hunting down an audio issue with Windows 10. A USB audio input device (the microphone embedded in a webcam in this case) was recognized by Windows and applications, but never seemed to actually provide any sound. No bar appeared to indicate the level in the sound settings when the microphone was spoken into. Strangely, Google Hangouts just re-muted audio input shortly after the unmute button was pressed. 

After a great deal of messing around, I eventually found a "privacy" switch that essentially completely disables microphone use by desktop applications: Settings → Privacy → Microphone → "allow desktop apps to access your microphone." You'll probably have to scroll down; the switch at the top only affects modern/UWP/Metro apps.

It would be really helpful if there was a clear indication that this setting is off in the places one might try to manage the microphone: the Sound settings page, or at least the troubleshooter.

Saturday, November 7, 2020

JUnit initialization failures are reported like test methods

One of my Gradle plugins processes JUnit results XML files and needs to examine the method in the class file corresponding to each test case. Loading the class and searching for the method specified in the XML usually worked fine, but recently I found out about a crash when looking for the method. Apparently if JUnit 4 is unable to initialize a test class (e.g. the static initializer fails or tests are improperly declared), it still emits a results file with failure information recorded in a test case named classMethod or initializationError. Nothing else seems to distinguish them from real test methods, so my plugin tried and failed to find a method with that name. I adjusted the plugin to watch for those names specifically - providing a useful notice - and gracefully ignore other unknown methods.