-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstance.h
More file actions
117 lines (101 loc) · 4.23 KB
/
instance.h
File metadata and controls
117 lines (101 loc) · 4.23 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//***************************************************************************
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Instance.h
//
// Purpose: Definition of CInstance class
//
//***************************************************************************
#pragma once
#include <Windows.h> // LONG, DWORD, BYTE, HRESULT, LPCWSTR vs.
#include <oaidl.h> // VARIANT, SAFEARRAY
#include <wbemcli.h> // IWbemClassObject
#include <comdef.h> // _bstr_t, vbstring vs. (opsiyonel)
#include <winapifamily.h>
// Önden bildirmler (forward declarations)
class MethodContext;
class CHString;
class WBEMTime;
class WBEMTimeSpan;
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#define WBEMINT64 CHString
#define WBEMINT16 short
// POLARITY tanýmý yoksa aþaðýdaki gibi boþ býrakabilirsiniz
#ifndef POLARITY
#define POLARITY
#endif
///////////////////////////////////////////
//
// CLASS CInstance
//
// base instance class
// encapsulation of IWbemClassObject
///////////////////////////////////////////
class
__declspec(uuid("3402945E-D19A-11d2-B35E-00104BC97924"))
POLARITY CInstance
{
public:
CInstance(_In_ IWbemClassObject* piClassObject, _In_ MethodContext* pMethodContext);
virtual ~CInstance();
// AddRef/Release
LONG AddRef(void);
LONG Release(void);
// Get and Set for various data types
bool SetNull(LPCWSTR name);
bool SetStringArray(LPCWSTR name, const SAFEARRAY& strArray);
bool SetWORD(LPCWSTR name, WORD w);
bool SetDWORD(LPCWSTR name, DWORD d);
bool Setbool(LPCWSTR name, bool b);
bool SetVariant(LPCWSTR name, const VARIANT& variant);
#ifdef FRAMEWORK_ALLOW_DEPRECATED
bool SetCharSplat(LPCWSTR name, DWORD dwResID);
#endif
bool SetCharSplat(LPCWSTR name, LPCWSTR pStr);
bool SetCharSplat(LPCWSTR name, LPCSTR pStr);
bool SetWCHARSplat(LPCWSTR name, LPCWSTR pStr);
bool SetDateTime(LPCWSTR name, const WBEMTime& wbemtime);
bool SetTimeSpan(LPCWSTR name, const WBEMTimeSpan& wbemtimespan);
bool SetWBEMINT64(LPCWSTR name, const WBEMINT64& wbemint64);
bool SetWBEMINT64(LPCWSTR name, const LONGLONG i64Value);
bool SetWBEMINT64(LPCWSTR name, const ULONGLONG i64Value);
bool SetWBEMINT16(LPCWSTR name, const WBEMINT16& wbemint16);
bool SetByte(LPCWSTR name, BYTE b);
bool SetEmbeddedObject(LPCWSTR name, _Inout_ CInstance& cInstance);
bool SetDOUBLE(LPCWSTR name, DOUBLE dub);
bool SetCHString(LPCWSTR name, LPCWSTR str);
bool SetCHString(LPCWSTR name, const CHString& str);
bool SetCHString(LPCWSTR name, LPCSTR str);
bool GetStringArray(LPCWSTR name, SAFEARRAY*& strArray) const;
bool GetCHString(LPCWSTR name, CHString& str) const;
bool GetWCHAR(LPCWSTR name, _Outptr_ LPWSTR* pW) const;
bool GetWORD(LPCWSTR name, WORD& w) const;
bool GetDWORD(LPCWSTR name, DWORD& d) const;
bool Getbool(LPCWSTR name, bool& b) const;
bool GetVariant(LPCWSTR name, VARIANT& variant) const;
bool GetDateTime(LPCWSTR name, WBEMTime& wbemtime) const;
bool GetTimeSpan(LPCWSTR name, WBEMTimeSpan& wbemtimespan) const;
bool GetWBEMINT64(LPCWSTR name, WBEMINT64& wbemint64) const;
bool GetWBEMINT64(LPCWSTR name, LONGLONG& i64Value) const;
bool GetWBEMINT64(LPCWSTR name, ULONGLONG& i64Value) const;
bool GetWBEMINT16(LPCWSTR name, WBEMINT16& wbemint16) const;
bool GetByte(LPCWSTR name, BYTE& b) const;
bool GetEmbeddedObject(LPCWSTR name, CInstance** pInstance, MethodContext* pMethodContext) const;
bool GetDOUBLE(LPCWSTR name, DOUBLE& dub) const;
bool IsNull(LPCWSTR name) const;
bool GetStatus(LPCWSTR name, bool& a_Exists, VARTYPE& a_VarType) const;
HRESULT Commit(void);
IWbemClassObject* GetClassObjectInterface();
MethodContext* GetMethodContext() const;
protected:
// All items in this section intended for Microsoft internal use only
// use by third parties is unsupported and unrecommended
void LogError(LPCWSTR errorStr, LPCWSTR pFunctionName, LPCWSTR pArgs = NULL, HRESULT hError = -1) const;
IWbemClassObject* m_piClassObject;
MethodContext* m_pMethodContext;
LONG m_nRefCount;
friend class CWbemProviderGlue;
};
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */