ML Reference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00004 00009 //---------------------------------------------------------------------------------- 00010 #ifndef __mlWMIInterface_H 00011 #define __mlWMIInterface_H 00012 00013 #ifdef WIN32 00014 00015 #define _WIN32_DCOM 00016 00017 #ifndef __mlUtilsSystem_H 00018 #include "mlUtilsSystem.h" 00019 #endif 00020 00021 #include "mlSystemWarningsDisable.h" 00022 #include <windows.h> 00023 #include <Wbemidl.h> 00024 #include "mlSystemWarningsRestore.h" 00025 00026 ML_UTILS_START_NAMESPACE 00027 00030 class ML_UTILS_EXPORT WMIInterface { 00031 00032 public: 00034 static WMIInterface* self(); 00035 00037 static void init(); 00039 static void cleanup(); 00040 00042 std::string queryWMIString(const char* wmiClassName, const char* wmiProperty); 00043 00045 MLuint32 queryWMIuint32(const char* wmiClassName, const char* wmiProperty); 00046 00047 private: 00048 WMIInterface(); 00049 ~WMIInterface(); 00050 00051 private: 00052 static WMIInterface* _self; 00053 00054 bool initWMI(); 00055 void cleanupWMI(); 00056 00057 bool _valid; 00058 bool _needsUninitialize; 00059 00060 IWbemLocator* _locator; 00061 IWbemServices* _services; 00062 00064 VARIANT* queryWMI(const char* wmiClassName, const char* wmiProperty); 00065 00067 void deleteVariant(VARIANT* var); 00068 00069 }; 00070 00071 ML_UTILS_END_NAMESPACE 00072 00073 #endif // WIN32 00074 00075 #endif // __mlWMIInterface_H