ReactOS  0.4.15-dev-1070-ge1a01de
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 }
HRESULT hr
Definition: shlfolder.c:183
#define lstrlenW
Definition: compat.h:498
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define swprintf(buf, format,...)
Definition: sprintf.c:56
GLenum GLsizei len
Definition: glext.h:6722
#define ARRAY_SIZE(a)
Definition: main.h:24
HRESULT exec_query(const WCHAR *str, IEnumWbemClassObject **result)
Definition: query.c:786
Definition: name.c:38
GLenum query
Definition: glext.h:7781
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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};
147  IEnumWbemClassObject *iter;
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 
183 done:
184  IWbemClassObject_Release( obj );
185  return hr;
186 }
const char * var
Definition: shader.c:5666
HRESULT hr
Definition: shlfolder.c:183
static const WCHAR typeW[]
Definition: name.c:51
#define V_I4(A)
Definition: oleauto.h:247
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
smooth NULL
Definition: ftsmooth.c:416
GLuint GLfloat * val
Definition: glext.h:7180
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define V_UI4(A)
Definition: oleauto.h:270
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:51
HRESULT create_class_object(const WCHAR *name, IEnumWbemClassObject *iter, UINT index, struct record *record, IWbemClassObject **obj)
Definition: class.c:1021
Definition: name.c:38
static HRESULT create_qualifier_enum(const WCHAR *class, const WCHAR *member, const WCHAR *name, IEnumWbemClassObject **iter)
Definition: qualifier.c:95

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 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

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
static struct qualifier_set * impl_from_IWbemQualifierSet(IWbemQualifierSet *iface)
Definition: qualifier.c:44
Definition: _set.h:46

◆ 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:111
#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
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 {
195  struct qualifier_set *set = impl_from_IWbemQualifierSet( iface );
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 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT get_qualifier_value(const WCHAR *class, const WCHAR *member, const WCHAR *name, VARIANT *val, LONG *flavor)
Definition: qualifier.c:139
static struct qualifier_set * impl_from_IWbemQualifierSet(IWbemQualifierSet *iface)
Definition: qualifier.c:44
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: _set.h:46

◆ 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 {
229  struct qualifier_set *set = impl_from_IWbemQualifierSet( iface );
230  IEnumWbemClassObject *iter;
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 }
HRESULT hr
Definition: shlfolder.c:183
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
HRESULT create_class_object(const WCHAR *name, IEnumWbemClassObject *iter, UINT index, struct record *record, IWbemClassObject **obj)
Definition: class.c:1021
static struct qualifier_set * impl_from_IWbemQualifierSet(IWbemQualifierSet *iface)
Definition: qualifier.c:44
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: _set.h:46
static HRESULT create_qualifier_enum(const WCHAR *class, const WCHAR *member, const WCHAR *name, IEnumWbemClassObject **iter)
Definition: qualifier.c:95

◆ 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 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define FIXME(fmt,...)
Definition: debug.h:111
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:51
static struct qualifier_set * impl_from_IWbemQualifierSet(IWbemQualifierSet *iface)
Definition: qualifier.c:44
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
Definition: _set.h:46

◆ qualifier_set_Release()

static ULONG WINAPI qualifier_set_Release ( IWbemQualifierSet iface)
static

Definition at line 57 of file qualifier.c.

59 {
61  LONG refs = InterlockedDecrement( &set->refs );
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 }
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static struct qualifier_set * impl_from_IWbemQualifierSet(IWbemQualifierSet *iface)
Definition: qualifier.c:44
Definition: _set.h:46
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ 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 void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
smooth NULL
Definition: ftsmooth.c:416
static UINT set(struct ID3DXConstantTableImpl *table, IDirect3DDevice9 *device, struct ctab_constant *constant, const void **indata, D3DXPARAMETER_TYPE intype, UINT *size, UINT incol, D3DXPARAMETER_CLASS inclass, UINT index, BOOL is_pointer)
Definition: shader.c:1095
#define TRACE(s)
Definition: solgame.cpp:4
static const IWbemQualifierSetVtbl qualifier_set_vtbl
Definition: qualifier.c:279
#define S_OK
Definition: intsafe.h:51
Definition: _set.h:46
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

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 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 HRESULT WINAPI qualifier_set_EndEnumeration(IWbemQualifierSet *iface)
Definition: qualifier.c:272
static HRESULT WINAPI qualifier_set_QueryInterface(IWbemQualifierSet *iface, REFIID riid, void **ppvObject)
Definition: qualifier.c:72
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_Put(IWbemQualifierSet *iface, LPCWSTR wszName, VARIANT *pVal, LONG lFlavor)
Definition: qualifier.c:206
static ULONG WINAPI qualifier_set_Release(IWbemQualifierSet *iface)
Definition: qualifier.c:57
static HRESULT WINAPI qualifier_set_Delete(IWbemQualifierSet *iface, LPCWSTR wszName)
Definition: qualifier.c:216
static HRESULT WINAPI qualifier_set_BeginEnumeration(IWbemQualifierSet *iface, LONG lFlags)
Definition: qualifier.c:253
static HRESULT WINAPI qualifier_set_Next(IWbemQualifierSet *iface, LONG lFlags, BSTR *pstrName, VARIANT *pVal, LONG *plFlavor)
Definition: qualifier.c:261

Definition at line 279 of file qualifier.c.

Referenced by WbemQualifierSet_create().