|
Confdump Agent
1.4.0
|
Access to a WMI (Wbem) server. More...
#include <WbemServices.hpp>
Public Member Functions | |
| WbemServices (ComContext::Guard comGuard) | |
| ~WbemServices () | |
| void | connect () |
| Connect to a WMI server. | |
| void | setWmiNamespace (QString ns) |
| Set the namespace to connect() to. | |
| boost::iterator_range < WbemQueryIterator > | execQuery (const Query &) |
| Run a WMI query. | |
| boost::iterator_range < WbemQueryIterator > | listAllClasses () |
| Enumerate WMI classes in the current namespace. | |
Private Member Functions | |
| WbemServices () | |
Private Attributes | |
| ComContext::Guard | comGuard_ |
| This ensures that COM stays initialized. | |
| boost::shared_ptr< IWbemServices > | services_ |
| QString | wmiNamespace_ |
| WmiLists | wmiLists_ |
Access to a WMI (Wbem) server.
This encapsulates the requirement of COM initialization, allows to connect to a Wbem server and then to run a query.
Definition at line 115 of file WbemServices.hpp.
The (non-NULL!) ComContext::Guard will be kept alive while this object needs it and ensure that COM is initialized.
Definition at line 79 of file WbemServices.cpp.
Definition at line 85 of file WbemServices.cpp.
| Confdump::System::Wmi::WbemServices::WbemServices | ( | ) | [private] |
Connect to a WMI server.
Connect to localhost, with the configured namespace (which defaults to CIMv2).
| NoSuchNamespace | |
| WmiError | |
| ComError |
Definition at line 134 of file WbemServices.cpp.
References services_, and wmiNamespace_.
| boost::iterator_range< WbemQueryIterator > Confdump::System::Wmi::WbemServices::execQuery | ( | const Query & | query | ) |
Run a WMI query.
| NoSuchClass | |
| WmiError | |
| ComError |
Definition at line 148 of file WbemServices.cpp.
References Confdump::System::Wmi::Query::getClass(), Confdump::System::Wmi::Query::getQuery(), Confdump::System::Wmi::guardComObject(), Confdump::System::Wmi::NoSuchClass::hresult(), Confdump::System::Wmi::Win32Error::hresult(), Confdump::System::Wmi::WmiLists::isTableAllowed(), services_, Confdump::System::Wmi::throwOnWmiError(), wmiLists_, and wmiNamespace_.
| boost::iterator_range< WbemQueryIterator > Confdump::System::Wmi::WbemServices::listAllClasses | ( | ) |
Enumerate WMI classes in the current namespace.
Definition at line 180 of file WbemServices.cpp.
References Confdump::System::Wmi::guardComObject(), services_, and Confdump::System::Wmi::throwOnWmiError().
| void Confdump::System::Wmi::WbemServices::setWmiNamespace | ( | QString | ns | ) |
Set the namespace to connect() to.
Default: CIMv2.
| RuntimeError | if the namespace is not allowed (this a security feature to prevent any system modification that could be made by unknown WMI modules). |
Definition at line 140 of file WbemServices.cpp.
References Confdump::System::Wmi::WmiLists::isNamespaceAllowed(), wmiLists_, and wmiNamespace_.
This ensures that COM stays initialized.
Definition at line 175 of file WbemServices.hpp.
boost::shared_ptr<IWbemServices> Confdump::System::Wmi::WbemServices::services_ [private] |
Definition at line 176 of file WbemServices.hpp.
Referenced by connect(), execQuery(), and listAllClasses().
Definition at line 178 of file WbemServices.hpp.
Referenced by execQuery(), and setWmiNamespace().
QString Confdump::System::Wmi::WbemServices::wmiNamespace_ [private] |
Definition at line 177 of file WbemServices.hpp.
Referenced by connect(), execQuery(), and setWmiNamespace().
1.7.6.1