ML Reference
mlWMIInterface.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2011, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_WMIINTERFACE_H
14#define ML_WMIINTERFACE_H
15
17
18#include <string>
19
20#ifdef WIN32
21
22#define _WIN32_DCOM
23
24#include "mlUtilsSystem.h"
25
26#include <ThirdPartyWarningsDisable.h>
27#include <windows.h>
28#include <Wbemidl.h>
29#include <ThirdPartyWarningsRestore.h>
30
31ML_UTILS_START_NAMESPACE
32
36
37public:
39 static WMIInterface* self();
40
42 static void init();
44 static void cleanup();
45
47 std::string queryWMIString(const char* wmiClassName, const char* wmiProperty);
48
50 MLuint32 queryWMIuint32(const char* wmiClassName, const char* wmiProperty);
51
52private:
55
56private:
57 static WMIInterface* _self;
58
59 bool initWMI();
60 void cleanupWMI();
61
62 bool _valid;
63 bool _needsUninitialize;
64
65 IWbemLocator* _locator;
66 IWbemServices* _services;
67
69 VARIANT* queryWMI(const char* wmiClassName, const char* wmiProperty);
70
72 void deleteVariant(VARIANT* var);
73
74};
75
76ML_UTILS_END_NAMESPACE
77
78#endif // WIN32
79
80#endif // __mlWMIInterface_H
Interface to the Windows Management Instrumentation http://msdn.microsoft.com/en-us/library/aa394582....
static WMIInterface * self()
get singleton (creates singleton if init() was not yet called)
static void cleanup()
cleanup of the singleton
static void init()
initializes the singleton
std::string queryWMIString(const char *wmiClassName, const char *wmiProperty)
returns UTF-8 encoded WMI property given the wmiClassName and wmiPropery
MLuint32 queryWMIuint32(const char *wmiClassName, const char *wmiProperty)
returns integer WMI property given the wmiClassName and wmiPropery
unsigned int MLuint32
Definition mlTypeDefs.h:185
#define ML_UTILS_EXPORT
Defines platform dependent DLL export macro for mlUtils.
Definition mlUtilities.h:20