(#10614) Fix setting and clearing read-only attribute on Windows
Previously, we were incorrectly checking the return value of
SetFileAttributes. In cases where we didn't own the file, the call to
set/clear the readonly attribute would fail, but we were not raising
an error.
In fixing this, I uncovered ordering issues whereby we needed to set
the file attributes before setting the owner, both in the tests and
the Puppet::Util::Windows::Security module. I also modified the code
to only call SetFileAttributes if it would actually result in a
change, such as when changing the mode, but not the owner or group.
Paired-with: Nick Lewis <nick@puppetlabs.com>