Pyrogenesis  trunk
wmi.h
Go to the documentation of this file.
1 /* Copyright (c) 2010 Wildfire Games
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining
4  * a copy of this software and associated documentation files (the
5  * "Software"), to deal in the Software without restriction, including
6  * without limitation the rights to use, copy, modify, merge, publish,
7  * distribute, sublicense, and/or sell copies of the Software, and to
8  * permit persons to whom the Software is furnished to do so, subject to
9  * the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 /*
24  * wrapper for Windows Management Instrumentation
25  */
26 
27 #ifndef INCLUDED_WMI
28 #define INCLUDED_WMI
29 
30 #include <map>
31 
32 // note: we expose the VARIANT value as returned by WMI. this allows other
33 // modules to use the values they want directly, rather than forcing
34 // everything to be converted to/parsed from strings. it does drag in
35 // OLE headers, but this module is entirely Windows-specific anyway.
36 #define _WIN32_DCOM
37 #include "lib/sysdep/os/win/win.h"
38 #include <comdef.h> // VARIANT
39 // contains name and value of all instance properties
40 typedef std::map<std::wstring, VARIANT> WmiInstance;
41 
42 typedef std::vector<WmiInstance> WmiInstances;
43 
44 /**
45  * get all instances of the requested class.
46  **/
47 extern Status wmi_GetClassInstances(const wchar_t* className, WmiInstances& instances);
48 
49 extern void wmi_Shutdown();
50 
51 #endif // #ifndef INCLUDED_WMI
std::vector< WmiInstance > WmiInstances
Definition: wmi.h:42
i64 Status
Error handling system.
Definition: status.h:171
void wmi_Shutdown()
Definition: wmi.cpp:100
Status wmi_GetClassInstances(const wchar_t *className, WmiInstances &instances)
get all instances of the requested class.
Definition: wmi.cpp:106
std::map< std::wstring, VARIANT > WmiInstance
Definition: wmi.h:40