xentara-utils v2.0.4
The Xentara Utility Library
|
Windows WMI functionality. More...
Classes | |
class | Locator |
A locator for WMI services. More... | |
class | Namespace |
A connection to a WMI namespace on the local machine. More... | |
class | Object |
A WMI object. More... | |
class | ResultSet |
A result set of a WMI query. More... | |
Functions | |
auto | errorCategory () -> const std::error_category & |
Returns an error category for WMI errors. | |
auto | throwError (HRESULT result, const std::string &message) -> void |
Throws an exception after a WMI error. | |
auto | throwError (HRESULT result, const char *message) -> void |
Throws an exception after a WMI error. | |
Windows WMI functionality.
This namespace privides access to the Windows Management Intrumentation (WMI) system.
auto xentara::utils::windows::wmi::errorCategory | ( | ) | -> const std::error_category & |
Returns an error category for WMI errors.
This error category can be used in conjuction with HRESULT return codes returned by methods of Windows Management Intrumentation (WMI) objects. It extends std::system_category by recognizing WMI subsystem specific error.
This category used the IWbemStatusCodeText interface to decode the result code.
The resurned error category can be passed to xentara::utils::windows::throwError() when a method of a WMI object has failed.
#include <xentara/utils/windows/wmi/Errors.hpp>
auto xentara::utils::windows::wmi::throwError | ( | HRESULT | result, |
const char * | message | ||
) | -> void |
Throws an exception after a WMI error.
This function should be called to throw an exception if a WMI function returns an error. It will attempt to get a detailed error message by calling GetErrorInfo(), and throw an exception based on the returned error info. If no error info is available, it will throw an std::system_error using result as error code, and xentara::utils::windows::wmi::errorCategory() as error category.
This function should only be called if FAILED(result) is true (or for which SUCCEEDED(result) is false, which is the same thing).
#include <xentara/utils/windows/wmi/Errors.hpp>
result | The return value of the failed function |
message | A message describing the error |
Exception | This exception is thrown if extended error infomation was available |
std::system | error This exception is thrown if no extended error infomation was available |
auto xentara::utils::windows::wmi::throwError | ( | HRESULT | result, |
const std::string & | message | ||
) | -> void |
Throws an exception after a WMI error.
This function should be called to throw an exception if a WMI function returns an error. It will attempt to get a detailed error message by calling GetErrorInfo(), and throw an exception based on the returned error info. If no error info is available, it will throw an std::system_error using result as error code, and xentara::utils::windows::wmi::errorCategory() as error category.
This function should only be called if FAILED(result) is true (or for which SUCCEEDED(result) is false, which is the same thing).
#include <xentara/utils/windows/wmi/Errors.hpp>
result | The return value of the failed function. |
message | A message describing the error |
Exception | This exception is thrown if extended error infomation was available |
std::system | error This exception is thrown if no extended error infomation was available |