ReactOS 0.4.15-dev-8109-gd7be748
qualifier.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wbemcli.h"
#include "wine/debug.h"
#include "wbemprox_private.h"
Include dependency graph for qualifier.c:

Go to the source code of this file.

Classes

struct  qualifier_set
 

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wbemprox)
 
static struct qualifier_setimpl_from_IWbemQualifierSet (IWbemQualifierSet *iface)
 
static ULONG WINAPI qualifier_set_AddRef (IWbemQualifierSet *iface)
 
static ULONG WINAPI qualifier_set_Release (IWbemQualifierSet *iface)
 
static HRESULT WINAPI qualifier_set_QueryInterface (IWbemQualifierSet *iface, REFIID riid, void **ppvObject)
 
static HRESULT create_qualifier_enum (const WCHAR *class, const WCHAR *member, const WCHAR *name, IEnumWbemClassObject **iter)
 
static HRESULT get_qualifier_value (const WCHAR *class, const WCHAR *member, const WCHAR *name, VARIANT *val, LONG *flavor)
 
static HRESULT WINAPI qualifier_set_Get (IWbemQualifierSet *iface, LPCWSTR wszName, LONG lFlags, VARIANT *pVal, LONG *plFlavor)
 
static HRESULT WINAPI qualifier_set_Put (IWbemQualifierSet *iface, LPCWSTR wszName, VARIANT *pVal, LONG lFlavor)
 
static HRESULT WINAPI qualifier_set_Delete (IWbemQualifierSet *iface, LPCWSTR wszName)
 
static HRESULT WINAPI qualifier_set_GetNames (IWbemQualifierSet *iface, LONG lFlags, SAFEARRAY **pNames)
 
static HRESULT WINAPI qualifier_set_BeginEnumeration (IWbemQualifierSet *iface, LONG lFlags)
 
static HRESULT WINAPI qualifier_set_Next (IWbemQualifierSet *iface, LONG lFlags, BSTR *pstrName, VARIANT *pVal, LONG *plFlavor)
 
static HRESULT WINAPI qualifier_set_EndEnumeration (IWbemQualifierSet *iface)
 
HRESULT WbemQualifierSet_create (const WCHAR *class, const WCHAR *member, LPVOID *ppObj)
 

Variables

static const IWbemQualifierSetVtbl qualifier_set_vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file qualifier.c.

Function Documentation

◆ create_qualifier_enum()

static HRESULT create_qualifier_enum ( const WCHAR class,
const WCHAR member,
const WCHAR name,
IEnumWbemClassObject **  iter 
)
static

Definition at line 95 of file qualifier.c.

97{
98 static const WCHAR fmtW[] =
99 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','Q','U','A','L',
100 'I','F','I','E','R','S',' ','W','H','E','R','E',' ','C','l','a','s','s','=',
101 '\'','%','s','\'',' ','A','N','D',' ','M','e','m','b','e','r','=','\'','%','s','\'',' ',
102 'A','N','D',' ','N','a','m','e','=','\'','%','s','\'',0};
103 static const WCHAR fmt2W[] =
104 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','Q','U','A','L',
105 'I','F','I','E','R','S',' ','W','H','E','R','E',' ','C','l','a','s','s','=',
106 '\'','%','s','\'',' ','A','N','D',' ','M','e','m','b','e','r','=','\'','%','s','\'',0};
107 static const WCHAR fmt3W[] =
108 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','Q','U','A','L',
109 'I','F','I','E','R','S',' ','W','H','E','R','E',' ','C','l','a','s','s','=',
110 '\'','%','s','\'',0};
111 WCHAR *query;
112 HRESULT hr;
113 int len;
114
115 if (member && name)
116 {
117 len = lstrlenW( class ) + lstrlenW( member ) + lstrlenW( name ) + ARRAY_SIZE(fmtW);
118 if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
119 swprintf( query, fmtW, class, member, name );
120 }
121 else if (member)
122 {
123 len = lstrlenW( class ) + lstrlenW( member ) + ARRAY_SIZE(fmt2W);
124 if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
125 swprintf( query, fmt2W, class, member );
126 }
127 else
128 {
129 len = lstrlenW( class ) + ARRAY_SIZE(fmt3W);
130 if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
131 swprintf( query, fmt3W, class );
132 }
133
134 hr = exec_query( query, iter );
135 heap_free( query );
136 return hr;
137}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define ARRAY_SIZE(A)
Definition: main.h:33
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define lstrlenW
Definition: compat.h:750
HRESULT exec_query(const WCHAR *str, IEnumWbemClassObject **result)
Definition: query.c:786
#define swprintf
Definition: precomp.h:40
GLenum GLsizei len
Definition: glext.h:6722
HRESULT hr
Definition: shlfolder.c:183
Definition: name.c:39
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by get_qualifier_value(), and qualifier_set_GetNames().

◆ get_qualifier_value()

static HRESULT get_qualifier_value ( const WCHAR class,
const WCHAR member,
const WCHAR name,
VARIANT val,
LONG flavor 
)
static

Definition at line 139 of file qualifier.c.

141{
142 static const WCHAR intvalueW[] = {'I','n','t','e','g','e','r','V','a','l','u','e',0};
143 static const WCHAR strvalueW[] = {'S','t','r','i','n','g','V','a','l','u','e',0};
144 static const WCHAR boolvalueW[] = {'B','o','o','l','V','a','l','u','e',0};
145 static const WCHAR flavorW[] = {'F','l','a','v','o','r',0};
146 static const WCHAR typeW[] = {'T','y','p','e',0};
149 VARIANT var;
150 HRESULT hr;
151
152 hr = create_qualifier_enum( class, member, name, &iter );
153 if (FAILED( hr )) return hr;
154
155 hr = create_class_object( NULL, iter, 0, NULL, &obj );
156 IEnumWbemClassObject_Release( iter );
157 if (FAILED( hr )) return hr;
158
159 if (flavor)
160 {
161 hr = IWbemClassObject_Get( obj, flavorW, 0, &var, NULL, NULL );
162 if (hr != S_OK) goto done;
163 *flavor = V_I4( &var );
164 }
165 hr = IWbemClassObject_Get( obj, typeW, 0, &var, NULL, NULL );
166 if (hr != S_OK) goto done;
167 switch (V_UI4( &var ))
168 {
169 case CIM_STRING:
170 hr = IWbemClassObject_Get( obj, strvalueW, 0, val, NULL, NULL );
171 break;
172 case CIM_SINT32:
173 hr = IWbemClassObject_Get( obj, intvalueW, 0, val, NULL, NULL );
174 break;
175 case CIM_BOOLEAN:
176 hr = IWbemClassObject_Get( obj, boolvalueW, 0, val, NULL, NULL );
177 break;
178 default:
179 ERR("unhandled type %u\n", V_UI4( &var ));
180 break;
181 }
182
183done:
184 IWbemClassObject_Release( obj );
185 return hr;
186}
#define ERR(fmt,...)
Definition: debug.h:113
#define NULL
Definition: types.h:112
static const WCHAR typeW[]
Definition: name.c:51
HRESULT create_class_object(const WCHAR *name, IEnumWbemClassObject *iter, UINT index, struct record *record, IWbemClassObject **obj)
Definition: class.c:1021
GLuint GLfloat * val
Definition: glext.h:7180
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
const char * var
Definition: shader.c:5666
#define V_I4(A)
Definition: oleauto.h:247
#define V_UI4(A)
Definition: oleauto.h:270
static HRESULT create_qualifier_enum(const WCHAR *class, const WCHAR *member, const WCHAR *name, IEnumWbemClassObject **iter)
Definition: qualifier.c:95
@ CIM_BOOLEAN
Definition: wbemcli.idl:244
@ CIM_STRING
Definition: wbemcli.idl:243
@ CIM_SINT32
Definition: wbemcli.idl:240

Referenced by qualifier_set_Get().

◆ impl_from_IWbemQualifierSet()

static struct qualifier_set * impl_from_IWbemQualifierSet ( IWbemQualifierSet iface)
inlinestatic

Definition at line 44 of file qualifier.c.

46{
47 return CONTAINING_RECORD(iface, struct qualifier_set, IWbemQualifierSet_iface);
48}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by qualifier_set_AddRef(), qualifier_set_Get(), qualifier_set_GetNames(), qualifier_set_QueryInterface(), and qualifier_set_Release().

◆ qualifier_set_AddRef()

static ULONG WINAPI qualifier_set_AddRef ( IWbemQualifierSet iface)
static

Definition at line 50 of file qualifier.c.

52{
54 return InterlockedIncrement( &set->refs );
55}
#define InterlockedIncrement
Definition: armddk.h:53
Definition: _set.h:50
static struct qualifier_set * impl_from_IWbemQualifierSet(IWbemQualifierSet *iface)
Definition: qualifier.c:44

◆ qualifier_set_BeginEnumeration()

static HRESULT WINAPI qualifier_set_BeginEnumeration ( IWbemQualifierSet iface,
LONG  lFlags 
)
static

Definition at line 253 of file qualifier.c.

256{
257 FIXME("%p, %08x\n", iface, lFlags);
258 return E_NOTIMPL;
259}
#define FIXME(fmt,...)
Definition: debug.h:114
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ qualifier_set_Delete()

static HRESULT WINAPI qualifier_set_Delete ( IWbemQualifierSet iface,
LPCWSTR  wszName 
)
static

Definition at line 216 of file qualifier.c.

219{
220 FIXME("%p, %s\n", iface, debugstr_w(wszName));
221 return E_NOTIMPL;
222}
#define debugstr_w
Definition: kernel32.h:32

◆ qualifier_set_EndEnumeration()

static HRESULT WINAPI qualifier_set_EndEnumeration ( IWbemQualifierSet iface)
static

Definition at line 272 of file qualifier.c.

274{
275 FIXME("%p\n", iface);
276 return E_NOTIMPL;
277}

◆ qualifier_set_Get()

static HRESULT WINAPI qualifier_set_Get ( IWbemQualifierSet iface,
LPCWSTR  wszName,
LONG  lFlags,
VARIANT pVal,
LONG plFlavor 
)
static

Definition at line 188 of file qualifier.c.

194{
196
197 TRACE("%p, %s, %08x, %p, %p\n", iface, debugstr_w(wszName), lFlags, pVal, plFlavor);
198 if (lFlags)
199 {
200 FIXME("flags %08x not supported\n", lFlags);
201 return E_NOTIMPL;
202 }
203 return get_qualifier_value( set->class, set->member, wszName, pVal, plFlavor );
204}
static HRESULT get_qualifier_value(const WCHAR *class, const WCHAR *member, const WCHAR *name, VARIANT *val, LONG *flavor)
Definition: qualifier.c:139
#define TRACE(s)
Definition: solgame.cpp:4

◆ qualifier_set_GetNames()

static HRESULT WINAPI qualifier_set_GetNames ( IWbemQualifierSet iface,
LONG  lFlags,
SAFEARRAY **  pNames 
)
static

Definition at line 224 of file qualifier.c.

228{
232 HRESULT hr;
233
234 TRACE("%p, %08x, %p\n", iface, lFlags, pNames);
235 if (lFlags)
236 {
237 FIXME("flags %08x not supported\n", lFlags);
238 return E_NOTIMPL;
239 }
240
241 hr = create_qualifier_enum( set->class, set->member, NULL, &iter );
242 if (FAILED( hr )) return hr;
243
244 hr = create_class_object( NULL, iter, 0, NULL, &obj );
245 IEnumWbemClassObject_Release( iter );
246 if (FAILED( hr )) return hr;
247
248 hr = IWbemClassObject_GetNames( obj, NULL, 0, NULL, pNames );
249 IWbemClassObject_Release( obj );
250 return hr;
251}

◆ qualifier_set_Next()

static HRESULT WINAPI qualifier_set_Next ( IWbemQualifierSet iface,
LONG  lFlags,
BSTR pstrName,
VARIANT pVal,
LONG plFlavor 
)
static

Definition at line 261 of file qualifier.c.

267{
268 FIXME("%p, %08x, %p, %p, %p\n", iface, lFlags, pstrName, pVal, plFlavor);
269 return E_NOTIMPL;
270}

◆ qualifier_set_Put()

static HRESULT WINAPI qualifier_set_Put ( IWbemQualifierSet iface,
LPCWSTR  wszName,
VARIANT pVal,
LONG  lFlavor 
)
static

Definition at line 206 of file qualifier.c.

211{
212 FIXME("%p, %s, %p, %d\n", iface, debugstr_w(wszName), pVal, lFlavor);
213 return E_NOTIMPL;
214}

◆ qualifier_set_QueryInterface()

static HRESULT WINAPI qualifier_set_QueryInterface ( IWbemQualifierSet iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 72 of file qualifier.c.

76{
78
79 TRACE("%p, %s, %p\n", set, debugstr_guid( riid ), ppvObject );
80
81 if ( IsEqualGUID( riid, &IID_IWbemQualifierSet ) ||
83 {
84 *ppvObject = set;
85 }
86 else
87 {
88 FIXME("interface %s not implemented\n", debugstr_guid(riid));
89 return E_NOINTERFACE;
90 }
91 IWbemQualifierSet_AddRef( iface );
92 return S_OK;
93}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ qualifier_set_Release()

static ULONG WINAPI qualifier_set_Release ( IWbemQualifierSet iface)
static

Definition at line 57 of file qualifier.c.

59{
62 if (!refs)
63 {
64 TRACE("destroying %p\n", set);
65 heap_free( set->class );
66 heap_free( set->member );
67 heap_free( set );
68 }
69 return refs;
70}
#define InterlockedDecrement
Definition: armddk.h:52
long LONG
Definition: pedump.c:60

◆ WbemQualifierSet_create()

HRESULT WbemQualifierSet_create ( const WCHAR class,
const WCHAR member,
LPVOID ppObj 
)

Definition at line 293 of file qualifier.c.

294{
295 struct qualifier_set *set;
296
297 TRACE("%p\n", ppObj);
298
299 if (!(set = heap_alloc( sizeof(*set) ))) return E_OUTOFMEMORY;
300
301 set->IWbemQualifierSet_iface.lpVtbl = &qualifier_set_vtbl;
302 if (!(set->class = heap_strdupW( class )))
303 {
304 heap_free( set );
305 return E_OUTOFMEMORY;
306 }
307 if (!member) set->member = NULL;
308 else if (!(set->member = heap_strdupW( member )))
309 {
310 heap_free( set->class );
311 heap_free( set );
312 return E_OUTOFMEMORY;
313 }
314 set->refs = 1;
315
316 *ppObj = &set->IWbemQualifierSet_iface;
317
318 TRACE("returning iface %p\n", *ppObj);
319 return S_OK;
320}
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
static const IWbemQualifierSetVtbl qualifier_set_vtbl
Definition: qualifier.c:279

Referenced by class_object_GetPropertyQualifierSet(), and class_object_GetQualifierSet().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wbemprox  )

Variable Documentation

◆ qualifier_set_vtbl

const IWbemQualifierSetVtbl qualifier_set_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI qualifier_set_Delete(IWbemQualifierSet *iface, LPCWSTR wszName)
Definition: qualifier.c:216
static HRESULT WINAPI qualifier_set_QueryInterface(IWbemQualifierSet *iface, REFIID riid, void **ppvObject)
Definition: qualifier.c:72
static HRESULT WINAPI qualifier_set_BeginEnumeration(IWbemQualifierSet *iface, LONG lFlags)
Definition: qualifier.c:253
static ULONG WINAPI qualifier_set_AddRef(IWbemQualifierSet *iface)
Definition: qualifier.c:50
static HRESULT WINAPI qualifier_set_GetNames(IWbemQualifierSet *iface, LONG lFlags, SAFEARRAY **pNames)
Definition: qualifier.c:224
static ULONG WINAPI qualifier_set_Release(IWbemQualifierSet *iface)
Definition: qualifier.c:57
static HRESULT WINAPI qualifier_set_Get(IWbemQualifierSet *iface, LPCWSTR wszName, LONG lFlags, VARIANT *pVal, LONG *plFlavor)
Definition: qualifier.c:188
static HRESULT WINAPI qualifier_set_Next(IWbemQualifierSet *iface, LONG lFlags, BSTR *pstrName, VARIANT *pVal, LONG *plFlavor)
Definition: qualifier.c:261
static HRESULT WINAPI qualifier_set_EndEnumeration(IWbemQualifierSet *iface)
Definition: qualifier.c:272
static HRESULT WINAPI qualifier_set_Put(IWbemQualifierSet *iface, LPCWSTR wszName, VARIANT *pVal, LONG lFlavor)
Definition: qualifier.c:206

Definition at line 279 of file qualifier.c.

Referenced by WbemQualifierSet_create().