djberg96/win32-service — pull request #8 by joshcooper (2013-06-06 04:20:29+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.