-
Notifications
You must be signed in to change notification settings - Fork 21
/
Win32_Process.cpp
50 lines (35 loc) · 1.3 KB
/
Win32_Process.cpp
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
////////////////////////////////////////////////////////////////////////////////
//! \file Win32_Process.cpp
//! \brief The Win32_Process class definition.
//! \author Chris Oldwood
#include "Common.hpp"
#include "Win32_Process.hpp"
#include "Exception.hpp"
namespace WMI
{
//! The WMI class name this type mirrors.
const tchar* Win32_Process::WMI_CLASS_NAME = TXT("Win32_Process");
////////////////////////////////////////////////////////////////////////////////
//! Construction from the underlying COM object and connection.
Win32_Process::Win32_Process(IWbemClassObjectPtr object, const Connection& connection)
: TypedObject<Win32_Process>(object, connection)
{
}
////////////////////////////////////////////////////////////////////////////////
//! Destructor.
Win32_Process::~Win32_Process()
{
}
////////////////////////////////////////////////////////////////////////////////
//! Terminate the process.
uint32 Win32_Process::Terminate(uint32 reason)
{
const tchar* TERMINATE = TXT("Terminate");
IWbemClassObjectPtr arguments = createArgumentsObject(WMI_CLASS_NAME, TERMINATE);
setArgument(arguments, TXT("Reason"), WCL::Variant((int32)reason));
WCL::Variant returnValue;
execMethod(TERMINATE, arguments, returnValue);
return WCL::getValue<uint32>(WCL::Variant(returnValue, VT_UI4));
}
//namespace WMI
}