puppetlabs/puppet-win32-ruby — pull request #5 by joshcooper (2013-06-06 05:04:15+00:00)
Title: (#16080) Protect against misconfigured services

Previously, the `Win32::Service.services` method would raise an exception if any
service was misconfigured. On Windows 2012 in VMware fusion, the tsusbhub
(driver) service is installed by default, so this bug is always triggered
though the same issue could occur in other Windows OS's.

The issue occurs when a service, e.g. tsusbhub, has a Description entry in the
registry of the form:

@[path]dllname,-strID

where strID is the localized description identifier, but the resource with
that identifier is absent from the dll.

This commit updates the `services` method to rescue exceptions related to
`get_config2_info`.

The commit adds a optional parameter to `get_config2_info` so that the caller
can decide whether the handles should be closed. This way if we fail to
retrieve the description, for whatever reason, we can still attempt to lookup
failure actions.

Patch applied using:

git apply --ignore-whitespace --verbose \
--directory=c:/work/puppet-win32-ruby/ruby/lib/ruby/gems/1.9.1/gems/win32-service-0.7.2-x86-mingw32 \
16080-handle-missing-description.patch