puppetlabs/cfacter — pull request #187 by MikaelSmith (2014-10-15 22:48:20+00:00)
Title: (CFACT-111) Fix crash-on-exit in Win Server 2008r2

Calling CoUninitialize should not be done at exit, as DLL shutdown can
mess it up. Create a re-usable class, wmi, that can be used to manage
the connection. As an optimization we share a copy between all resolvers
that need it, using shared_ptr to ensure it's released when no longer
needed.

CoInitSecurity is unsafe to call more than once in a process/thread, and
the defaults are sufficient. Therefore we let the API ensure security is
setup instead of doing so explicitly.