forked from chrisoldwood/WMI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWin32_OperatingSystem.hpp
More file actions
96 lines (70 loc) · 2.5 KB
/
Win32_OperatingSystem.hpp
File metadata and controls
96 lines (70 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
////////////////////////////////////////////////////////////////////////////////
//! \file Win32_OperatingSystem.hpp
//! \brief The Win32_OperatingSystem class declaration.
//! \author Chris Oldwood
// Check for previous inclusion
#ifndef WMI_WIN32_OPERATINGSYSTEM_HPP
#define WMI_WIN32_OPERATINGSYSTEM_HPP
#if _MSC_VER > 1000
#pragma once
#endif
#include "TypedObject.hpp"
#include "DateTime.hpp"
#include <Core/StringUtils.hpp>
namespace WMI
{
////////////////////////////////////////////////////////////////////////////////
//! The C++ facade for the Win32_OperatingSystem WMI class.
class Win32_OperatingSystem : public TypedObject<Win32_OperatingSystem>
{
public:
//! Construction from the underlying COM object and connection.
Win32_OperatingSystem(IWbemClassObjectPtr object, const Connection& connection);
//! Destructor.
virtual ~Win32_OperatingSystem();
//
// WMI typed properties.
//
//! Operating system was last booted.
CDateTime LastBootUpTime() const;
//! Number of kilobytes of virtual memory currently unused and available.
uint64 FreeVirtualMemory() const;
//! Operating system instance within a computer system.
tstring Name() const;
//! Number of kilobytes of virtual memory.
uint64 TotalVirtualMemorySize() const;
//
// Constants.
//
//! The WMI class name this type mirrors.
static const tchar* WMI_CLASS_NAME;
};
////////////////////////////////////////////////////////////////////////////////
//! Operating system was last booted.
inline CDateTime Win32_OperatingSystem::LastBootUpTime() const
{
return parseDateTime(getProperty<tstring>(TXT("LastBootUpTime")));
}
////////////////////////////////////////////////////////////////////////////////
//! Number of kilobytes of virtual memory currently unused and available.
inline uint64 Win32_OperatingSystem::FreeVirtualMemory() const
{
tstring value = getProperty<tstring>(TXT("FreeVirtualMemory"));
return Core::parse<uint64>(value);
}
////////////////////////////////////////////////////////////////////////////////
//! Operating system instance within a computer system.
inline tstring Win32_OperatingSystem::Name() const
{
return getProperty<tstring>(TXT("Name"));
}
////////////////////////////////////////////////////////////////////////////////
//! Number of kilobytes of virtual memory.
inline uint64 Win32_OperatingSystem::TotalVirtualMemorySize() const
{
tstring value = getProperty<tstring>(TXT("TotalVirtualMemorySize"));
return Core::parse<uint64>(value);
}
//namespace WMI
}
#endif // WMI_WIN32_OPERATINGSYSTEM_HPP