ReactOS  0.4.14-dev-815-ge410a12
services.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 services.c:

Go to the source code of this file.

Classes

struct  client_security
 
struct  async_header
 
struct  async_query
 
struct  wbem_services
 

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wbemprox)
 
static struct client_securityimpl_from_IClientSecurity (IClientSecurity *iface)
 
static HRESULT WINAPI client_security_QueryInterface (IClientSecurity *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI client_security_AddRef (IClientSecurity *iface)
 
static ULONG WINAPI client_security_Release (IClientSecurity *iface)
 
static HRESULT WINAPI client_security_QueryBlanket (IClientSecurity *iface, IUnknown *pProxy, DWORD *pAuthnSvc, DWORD *pAuthzSvc, OLECHAR **pServerPrincName, DWORD *pAuthnLevel, DWORD *pImpLevel, void **pAuthInfo, DWORD *pCapabilities)
 
static HRESULT WINAPI client_security_SetBlanket (IClientSecurity *iface, IUnknown *pProxy, DWORD AuthnSvc, DWORD AuthzSvc, OLECHAR *pServerPrincName, DWORD AuthnLevel, DWORD ImpLevel, void *pAuthInfo, DWORD Capabilities)
 
static HRESULT WINAPI client_security_CopyProxy (IClientSecurity *iface, IUnknown *pProxy, IUnknown **ppCopy)
 
static void free_async (struct async_header *async)
 
static BOOL init_async (struct async_header *async, IWbemObjectSink *sink, void(*proc)(struct async_header *))
 
static DWORD CALLBACK async_proc (LPVOID param)
 
static HRESULT queue_async (struct async_header *async)
 
static struct wbem_servicesimpl_from_IWbemServices (IWbemServices *iface)
 
static ULONG WINAPI wbem_services_AddRef (IWbemServices *iface)
 
static ULONG WINAPI wbem_services_Release (IWbemServices *iface)
 
static HRESULT WINAPI wbem_services_QueryInterface (IWbemServices *iface, REFIID riid, void **ppvObject)
 
static HRESULT WINAPI wbem_services_OpenNamespace (IWbemServices *iface, const BSTR strNamespace, LONG lFlags, IWbemContext *pCtx, IWbemServices **ppWorkingNamespace, IWbemCallResult **ppResult)
 
static HRESULT WINAPI wbem_services_CancelAsyncCall (IWbemServices *iface, IWbemObjectSink *pSink)
 
static HRESULT WINAPI wbem_services_QueryObjectSink (IWbemServices *iface, LONG lFlags, IWbemObjectSink **ppResponseHandler)
 
HRESULT parse_path (const WCHAR *str, struct path **ret)
 
void free_path (struct path *path)
 
WCHARquery_from_path (const struct path *path)
 
static HRESULT create_instance_enum (const struct path *path, IEnumWbemClassObject **iter)
 
HRESULT get_object (const WCHAR *object_path, IWbemClassObject **obj)
 
static HRESULT WINAPI wbem_services_GetObject (IWbemServices *iface, const BSTR strObjectPath, LONG lFlags, IWbemContext *pCtx, IWbemClassObject **ppObject, IWbemCallResult **ppCallResult)
 
static HRESULT WINAPI wbem_services_GetObjectAsync (IWbemServices *iface, const BSTR strObjectPath, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
 
static HRESULT WINAPI wbem_services_PutClass (IWbemServices *iface, IWbemClassObject *pObject, LONG lFlags, IWbemContext *pCtx, IWbemCallResult **ppCallResult)
 
static HRESULT WINAPI wbem_services_PutClassAsync (IWbemServices *iface, IWbemClassObject *pObject, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
 
static HRESULT WINAPI wbem_services_DeleteClass (IWbemServices *iface, const BSTR strClass, LONG lFlags, IWbemContext *pCtx, IWbemCallResult **ppCallResult)
 
static HRESULT WINAPI wbem_services_DeleteClassAsync (IWbemServices *iface, const BSTR strClass, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
 
static HRESULT WINAPI wbem_services_CreateClassEnum (IWbemServices *iface, const BSTR strSuperclass, LONG lFlags, IWbemContext *pCtx, IEnumWbemClassObject **ppEnum)
 
static HRESULT WINAPI wbem_services_CreateClassEnumAsync (IWbemServices *iface, const BSTR strSuperclass, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
 
static HRESULT WINAPI wbem_services_PutInstance (IWbemServices *iface, IWbemClassObject *pInst, LONG lFlags, IWbemContext *pCtx, IWbemCallResult **ppCallResult)
 
static HRESULT WINAPI wbem_services_PutInstanceAsync (IWbemServices *iface, IWbemClassObject *pInst, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
 
static HRESULT WINAPI wbem_services_DeleteInstance (IWbemServices *iface, const BSTR strObjectPath, LONG lFlags, IWbemContext *pCtx, IWbemCallResult **ppCallResult)
 
static HRESULT WINAPI wbem_services_DeleteInstanceAsync (IWbemServices *iface, const BSTR strObjectPath, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
 
static HRESULT WINAPI wbem_services_CreateInstanceEnum (IWbemServices *iface, const BSTR strClass, LONG lFlags, IWbemContext *pCtx, IEnumWbemClassObject **ppEnum)
 
static HRESULT WINAPI wbem_services_CreateInstanceEnumAsync (IWbemServices *iface, const BSTR strFilter, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
 
static HRESULT WINAPI wbem_services_ExecQuery (IWbemServices *iface, const BSTR strQueryLanguage, const BSTR strQuery, LONG lFlags, IWbemContext *pCtx, IEnumWbemClassObject **ppEnum)
 
static void async_exec_query (struct async_header *hdr)
 
static HRESULT WINAPI wbem_services_ExecQueryAsync (IWbemServices *iface, const BSTR strQueryLanguage, const BSTR strQuery, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
 
static HRESULT WINAPI wbem_services_ExecNotificationQuery (IWbemServices *iface, const BSTR strQueryLanguage, const BSTR strQuery, LONG lFlags, IWbemContext *pCtx, IEnumWbemClassObject **ppEnum)
 
static HRESULT WINAPI wbem_services_ExecNotificationQueryAsync (IWbemServices *iface, const BSTR strQueryLanguage, const BSTR strQuery, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
 
static HRESULT WINAPI wbem_services_ExecMethod (IWbemServices *iface, const BSTR strObjectPath, const BSTR strMethodName, LONG lFlags, IWbemContext *pCtx, IWbemClassObject *pInParams, IWbemClassObject **ppOutParams, IWbemCallResult **ppCallResult)
 
static HRESULT WINAPI wbem_services_ExecMethodAsync (IWbemServices *iface, const BSTR strObjectPath, const BSTR strMethodName, LONG lFlags, IWbemContext *pCtx, IWbemClassObject *pInParams, IWbemObjectSink *pResponseHandler)
 
HRESULT WbemServices_create (const WCHAR *namespace, LPVOID *ppObj)
 

Variables

static const IClientSecurityVtbl client_security_vtbl
 
IClientSecurity client_security = { &client_security_vtbl }
 
static const IWbemServicesVtbl wbem_services_vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file services.c.

Function Documentation

◆ async_exec_query()

static void async_exec_query ( struct async_header hdr)
static

Definition at line 670 of file services.c.

671 {
672  struct async_query *query = (struct async_query *)hdr;
675  ULONG count;
676  HRESULT hr;
677 
678  hr = exec_query( query->str, &result );
679  if (hr == S_OK)
680  {
681  for (;;)
682  {
683  IEnumWbemClassObject_Next( result, WBEM_INFINITE, 1, &obj, &count );
684  if (!count) break;
685  IWbemObjectSink_Indicate( query->hdr.sink, 1, &obj );
686  IWbemClassObject_Release( obj );
687  }
688  IEnumWbemClassObject_Release( result );
689  }
690  IWbemObjectSink_SetStatus( query->hdr.sink, WBEM_STATUS_COMPLETE, hr, NULL, NULL );
691  heap_free( query->str );
692 }
char hdr[14]
Definition: iptest.cpp:33
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
HRESULT exec_query(const WCHAR *str, IEnumWbemClassObject **result)
Definition: query.c:786
unsigned int ULONG
Definition: retypes.h:1
GLuint64EXT * result
Definition: glext.h:11304
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by wbem_services_ExecNotificationQueryAsync(), and wbem_services_ExecQueryAsync().

◆ async_proc()

static DWORD CALLBACK async_proc ( LPVOID  param)
static

Definition at line 176 of file services.c.

177 {
178  struct async_header *async = param;
179  HANDLE wait = async->wait;
180 
181  async->proc( async );
182 
184  SetEvent( wait );
185  return ERROR_SUCCESS;
186 }
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
GLfloat param
Definition: glext.h:5796
void(* proc)(struct async_header *)
Definition: services.c:142
HANDLE cancel
Definition: services.c:143
#define INFINITE
Definition: serial.h:102
HANDLE wait
Definition: services.c:144

Referenced by queue_async().

◆ client_security_AddRef()

static ULONG WINAPI client_security_AddRef ( IClientSecurity iface)
static

Definition at line 69 of file services.c.

71 {
72  FIXME("%p\n", iface);
73  return 2;
74 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ client_security_CopyProxy()

static HRESULT WINAPI client_security_CopyProxy ( IClientSecurity iface,
IUnknown pProxy,
IUnknown **  ppCopy 
)
static

Definition at line 118 of file services.c.

122 {
123  FIXME("\n");
124  return WBEM_E_FAILED;
125 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ client_security_QueryBlanket()

static HRESULT WINAPI client_security_QueryBlanket ( IClientSecurity iface,
IUnknown pProxy,
DWORD pAuthnSvc,
DWORD pAuthzSvc,
OLECHAR **  pServerPrincName,
DWORD pAuthnLevel,
DWORD pImpLevel,
void **  pAuthInfo,
DWORD pCapabilities 
)
static

Definition at line 83 of file services.c.

93 {
94  FIXME("\n");
95  return WBEM_E_FAILED;
96 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ client_security_QueryInterface()

static HRESULT WINAPI client_security_QueryInterface ( IClientSecurity iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 46 of file services.c.

50 {
51  struct client_security *cs = impl_from_IClientSecurity( iface );
52 
53  TRACE("%p %s %p\n", cs, debugstr_guid( riid ), ppvObject );
54 
55  if ( IsEqualGUID( riid, &IID_IClientSecurity ) ||
57  {
58  *ppvObject = cs;
59  }
60  else
61  {
62  FIXME("interface %s not implemented\n", debugstr_guid(riid));
63  return E_NOINTERFACE;
64  }
65  IClientSecurity_AddRef( iface );
66  return S_OK;
67 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
uint32_t cs
Definition: isohybrid.c:75
#define FIXME(fmt,...)
Definition: debug.h:110
#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
static struct client_security * impl_from_IClientSecurity(IClientSecurity *iface)
Definition: services.c:41
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ client_security_Release()

static ULONG WINAPI client_security_Release ( IClientSecurity iface)
static

Definition at line 76 of file services.c.

78 {
79  FIXME("%p\n", iface);
80  return 1;
81 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ client_security_SetBlanket()

static HRESULT WINAPI client_security_SetBlanket ( IClientSecurity iface,
IUnknown pProxy,
DWORD  AuthnSvc,
DWORD  AuthzSvc,
OLECHAR pServerPrincName,
DWORD  AuthnLevel,
DWORD  ImpLevel,
void pAuthInfo,
DWORD  Capabilities 
)
static

Definition at line 98 of file services.c.

108 {
109  static const OLECHAR defaultW[] =
110  {'<','C','O','L','E','_','D','E','F','A','U','L','T','_','P','R','I','N','C','I','P','A','L','>',0};
111  const OLECHAR *princname = (pServerPrincName == COLE_DEFAULT_PRINCIPAL) ? defaultW : pServerPrincName;
112 
113  FIXME("%p, %p, %u, %u, %s, %u, %u, %p, 0x%08x\n", iface, pProxy, AuthnSvc, AuthzSvc,
114  debugstr_w(princname), AuthnLevel, ImpLevel, pAuthInfo, Capabilities);
115  return WBEM_NO_ERROR;
116 }
WCHAR OLECHAR
Definition: compat.h:1941
static const WCHAR defaultW[]
Definition: lex.c:42
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110

◆ create_instance_enum()

static HRESULT create_instance_enum ( const struct path path,
IEnumWbemClassObject **  iter 
)
static

Definition at line 447 of file services.c.

448 {
449  WCHAR *query;
450  HRESULT hr;
451 
452  if (!(query = query_from_path( path ))) return E_OUTOFMEMORY;
453  hr = exec_query( query, iter );
454  heap_free( query );
455  return hr;
456 }
HRESULT hr
Definition: shlfolder.c:183
WCHAR * query_from_path(const struct path *path)
Definition: services.c:421
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
HRESULT exec_query(const WCHAR *str, IEnumWbemClassObject **result)
Definition: query.c:786
GLenum query
Definition: glext.h:7781
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by get_object(), and wbem_services_CreateInstanceEnum().

◆ free_async()

static void free_async ( struct async_header async)
static

Definition at line 153 of file services.c.

154 {
155  if (async->sink) IWbemObjectSink_Release( async->sink );
156  CloseHandle( async->cancel );
157  CloseHandle( async->wait );
158  heap_free( async );
159 }
#define CloseHandle
Definition: compat.h:406
IWbemObjectSink * sink
Definition: services.c:141
HANDLE cancel
Definition: services.c:143
HANDLE wait
Definition: services.c:144
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by wbem_services_CancelAsyncCall(), wbem_services_ExecNotificationQueryAsync(), wbem_services_ExecQueryAsync(), and wbem_services_Release().

◆ free_path()

void free_path ( struct path path)

Definition at line 413 of file services.c.

414 {
415  if (!path) return;
416  heap_free( path->class );
417  heap_free( path->filter );
418  heap_free( path );
419 }
WCHAR * filter
WCHAR * class
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by get_object(), wbem_services_CreateInstanceEnum(), and wbem_services_ExecMethod().

◆ get_object()

HRESULT get_object ( const WCHAR object_path,
IWbemClassObject **  obj 
)

Definition at line 458 of file services.c.

459 {
460  IEnumWbemClassObject *iter;
461  struct path *path;
462  HRESULT hr;
463 
464  hr = parse_path( object_path, &path );
465  if (hr != S_OK) return hr;
466 
467  hr = create_instance_enum( path, &iter );
468  if (hr != S_OK)
469  {
470  free_path( path );
471  return hr;
472  }
473  hr = create_class_object( path->class, iter, 0, NULL, obj );
474  IEnumWbemClassObject_Release( iter );
475  free_path( path );
476  return hr;
477 }
HRESULT hr
Definition: shlfolder.c:183
GLsizei const GLchar ** path
Definition: glext.h:7234
void free_path(struct path *path)
Definition: services.c:413
smooth NULL
Definition: ftsmooth.c:416
static HRESULT create_instance_enum(const struct path *path, IEnumWbemClassObject **iter)
Definition: services.c:447
WCHAR * class
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
HRESULT create_class_object(const WCHAR *name, IEnumWbemClassObject *iter, UINT index, struct record *record, IWbemClassObject **obj)
Definition: class.c:1021
HRESULT parse_path(const WCHAR *str, struct path **ret)
Definition: services.c:326

Referenced by wbem_services_GetObject().

◆ impl_from_IClientSecurity()

static struct client_security* impl_from_IClientSecurity ( IClientSecurity iface)
inlinestatic

Definition at line 41 of file services.c.

42 {
43  return CONTAINING_RECORD( iface, struct client_security, IClientSecurity_iface );
44 }
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 client_security_QueryInterface().

◆ impl_from_IWbemServices()

static struct wbem_services* impl_from_IWbemServices ( IWbemServices iface)
inlinestatic

Definition at line 203 of file services.c.

204 {
205  return CONTAINING_RECORD( iface, struct wbem_services, IWbemServices_iface );
206 }
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 wbem_services_AddRef(), wbem_services_CancelAsyncCall(), wbem_services_ExecNotificationQueryAsync(), wbem_services_ExecQueryAsync(), wbem_services_OpenNamespace(), wbem_services_QueryInterface(), and wbem_services_Release().

◆ init_async()

static BOOL init_async ( struct async_header async,
IWbemObjectSink sink,
void(*)(struct async_header *)  proc 
)
static

Definition at line 161 of file services.c.

163 {
164  if (!(async->wait = CreateEventW( NULL, FALSE, FALSE, NULL ))) return FALSE;
165  if (!(async->cancel = CreateEventW( NULL, FALSE, FALSE, NULL )))
166  {
167  CloseHandle( async->wait );
168  return FALSE;
169  }
170  async->proc = proc;
171  async->sink = sink;
172  IWbemObjectSink_AddRef( sink );
173  return TRUE;
174 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
static HANDLE proc()
Definition: pdb.c:32
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
smooth NULL
Definition: ftsmooth.c:416
void(* proc)(struct async_header *)
Definition: services.c:142
IWbemObjectSink * sink
Definition: services.c:141
HANDLE cancel
Definition: services.c:143
HANDLE wait
Definition: services.c:144

Referenced by wbem_services_ExecNotificationQueryAsync(), and wbem_services_ExecQueryAsync().

◆ parse_path()

HRESULT parse_path ( const WCHAR str,
struct path **  ret 
)

Definition at line 326 of file services.c.

327 {
328  struct path *path;
329  const WCHAR *p = str, *q;
330  UINT len;
331 
332  if (!(path = heap_alloc_zero( sizeof(*path) ))) return E_OUTOFMEMORY;
333 
334  if (*p == '\\')
335  {
336  static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
338  DWORD server_len = ARRAY_SIZE(server);
339 
340  p++;
341  if (*p != '\\')
342  {
343  heap_free( path );
345  }
346  p++;
347 
348  q = p;
349  while (*p && *p != '\\') p++;
350  if (!*p)
351  {
352  heap_free( path );
354  }
355 
356  len = p - q;
357  if (!GetComputerNameW( server, &server_len ) || server_len != len || _wcsnicmp( q, server, server_len ))
358  {
359  heap_free( path );
360  return WBEM_E_NOT_SUPPORTED;
361  }
362 
363  q = ++p;
364  while (*p && *p != ':') p++;
365  if (!*p)
366  {
367  heap_free( path );
369  }
370 
371  len = p - q;
372  if (len != ARRAY_SIZE(cimv2W) - 1 || _wcsnicmp( q, cimv2W, ARRAY_SIZE(cimv2W) - 1 ))
373  {
374  heap_free( path );
376  }
377  p++;
378  }
379 
380  q = p;
381  while (*p && *p != '.') p++;
382 
383  len = p - q;
384  if (!(path->class = heap_alloc( (len + 1) * sizeof(WCHAR) )))
385  {
386  heap_free( path );
387  return E_OUTOFMEMORY;
388  }
389  memcpy( path->class, q, len * sizeof(WCHAR) );
390  path->class[len] = 0;
391  path->class_len = len;
392 
393  if (p[0] == '.' && p[1])
394  {
395  q = ++p;
396  while (*q) q++;
397 
398  len = q - p;
399  if (!(path->filter = heap_alloc( (len + 1) * sizeof(WCHAR) )))
400  {
401  heap_free( path->class );
402  heap_free( path );
403  return E_OUTOFMEMORY;
404  }
405  memcpy( path->filter, p, len * sizeof(WCHAR) );
406  path->filter[len] = 0;
407  path->filter_len = len;
408  }
409  *ret = path;
410  return S_OK;
411 }
WCHAR * filter
static rfbScreenInfoPtr server
Definition: vnc.c:74
GLsizei const GLchar ** path
Definition: glext.h:7234
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:440
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
UINT class_len
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
const WCHAR * str
UINT filter_len
WCHAR * class
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
unsigned int UINT
Definition: ndis.h:50
GLfloat GLfloat p
Definition: glext.h:8902
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by get_object(), wbem_services_CreateInstanceEnum(), and wbem_services_ExecMethod().

◆ query_from_path()

WCHAR* query_from_path ( const struct path path)

Definition at line 421 of file services.c.

422 {
423  static const WCHAR selectW[] =
424  {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','%','s',' ',
425  'W','H','E','R','E',' ','%','s',0};
426  static const WCHAR select_allW[] =
427  {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',0};
428  WCHAR *query;
429  UINT len;
430 
431  if (path->filter)
432  {
434  if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
436  }
437  else
438  {
439  len = path->class_len + ARRAY_SIZE(select_allW);
440  if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
441  lstrcpyW( query, select_allW );
442  lstrcatW( query, path->class );
443  }
444  return query;
445 }
WCHAR * filter
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
UINT class_len
smooth NULL
Definition: ftsmooth.c:416
UINT filter_len
WCHAR * class
static const WCHAR selectW[]
Definition: htmlelem.c:38
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
GLenum GLsizei len
Definition: glext.h:6722
#define lstrcpyW
Definition: compat.h:414
#define ARRAY_SIZE(a)
Definition: main.h:24
unsigned int UINT
Definition: ndis.h:50
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
GLenum query
Definition: glext.h:7781

Referenced by create_instance_enum(), get_antecedent_table(), and wbem_services_ExecMethod().

◆ queue_async()

static HRESULT queue_async ( struct async_header async)
static

Definition at line 188 of file services.c.

189 {
191  return HRESULT_FROM_WIN32( GetLastError() );
192 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define WT_EXECUTELONGFUNCTION
Definition: winnt_old.h:1076
BOOL WINAPI QueueUserWorkItem(IN LPTHREAD_START_ROUTINE Function, IN PVOID Context, IN ULONG Flags)
Definition: thread.c:1064
#define S_OK
Definition: intsafe.h:59
static DWORD CALLBACK async_proc(LPVOID param)
Definition: services.c:176

Referenced by wbem_services_ExecNotificationQueryAsync(), and wbem_services_ExecQueryAsync().

◆ wbem_services_AddRef()

static ULONG WINAPI wbem_services_AddRef ( IWbemServices iface)
static

Definition at line 208 of file services.c.

210 {
211  struct wbem_services *ws = impl_from_IWbemServices( iface );
212  return InterlockedIncrement( &ws->refs );
213 }
const char * ws
Definition: skip_ws.cpp:7
#define InterlockedIncrement
Definition: armddk.h:53
static struct wbem_services * impl_from_IWbemServices(IWbemServices *iface)
Definition: services.c:203

◆ wbem_services_CancelAsyncCall()

static HRESULT WINAPI wbem_services_CancelAsyncCall ( IWbemServices iface,
IWbemObjectSink pSink 
)
static

Definition at line 289 of file services.c.

292 {
294  struct async_header *async;
295 
296  TRACE("%p, %p\n", iface, pSink);
297 
298  if (!pSink) return WBEM_E_INVALID_PARAMETER;
299 
301 
302  if (!(async = services->async))
303  {
306  }
307  services->async = NULL;
308  SetEvent( async->cancel );
309 
311 
312  WaitForSingleObject( async->wait, INFINITE );
313  free_async( async );
314  return S_OK;
315 }
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
static void free_async(struct async_header *async)
Definition: services.c:153
HANDLE cancel
Definition: services.c:143
static struct wbem_services * impl_from_IWbemServices(IWbemServices *iface)
Definition: services.c:203
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define INFINITE
Definition: serial.h:102
HANDLE wait
Definition: services.c:144

◆ wbem_services_CreateClassEnum()

static HRESULT WINAPI wbem_services_CreateClassEnum ( IWbemServices iface,
const BSTR  strSuperclass,
LONG  lFlags,
IWbemContext *  pCtx,
IEnumWbemClassObject **  ppEnum 
)
static

Definition at line 553 of file services.c.

559 {
560  FIXME("\n");
561  return WBEM_E_FAILED;
562 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_CreateClassEnumAsync()

static HRESULT WINAPI wbem_services_CreateClassEnumAsync ( IWbemServices iface,
const BSTR  strSuperclass,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemObjectSink pResponseHandler 
)
static

Definition at line 564 of file services.c.

570 {
571  FIXME("\n");
572  return WBEM_E_FAILED;
573 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_CreateInstanceEnum()

static HRESULT WINAPI wbem_services_CreateInstanceEnum ( IWbemServices iface,
const BSTR  strClass,
LONG  lFlags,
IWbemContext *  pCtx,
IEnumWbemClassObject **  ppEnum 
)
static

Definition at line 619 of file services.c.

625 {
626  struct path *path;
627  HRESULT hr;
628 
629  TRACE("%p, %s, 0%08x, %p, %p\n", iface, debugstr_w(strClass), lFlags, pCtx, ppEnum);
630 
631  if (lFlags) FIXME("unsupported flags 0x%08x\n", lFlags);
632 
633  hr = parse_path( strClass, &path );
634  if (hr != S_OK) return hr;
635 
636  hr = create_instance_enum( path, ppEnum );
637  free_path( path );
638  return hr;
639 }
HRESULT hr
Definition: shlfolder.c:183
GLsizei const GLchar ** path
Definition: glext.h:7234
void free_path(struct path *path)
Definition: services.c:413
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static HRESULT create_instance_enum(const struct path *path, IEnumWbemClassObject **iter)
Definition: services.c:447
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
HRESULT parse_path(const WCHAR *str, struct path **ret)
Definition: services.c:326

◆ wbem_services_CreateInstanceEnumAsync()

static HRESULT WINAPI wbem_services_CreateInstanceEnumAsync ( IWbemServices iface,
const BSTR  strFilter,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemObjectSink pResponseHandler 
)
static

Definition at line 641 of file services.c.

647 {
648  FIXME("\n");
649  return WBEM_E_FAILED;
650 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_DeleteClass()

static HRESULT WINAPI wbem_services_DeleteClass ( IWbemServices iface,
const BSTR  strClass,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemCallResult **  ppCallResult 
)
static

Definition at line 531 of file services.c.

537 {
538  FIXME("\n");
539  return WBEM_E_FAILED;
540 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_DeleteClassAsync()

static HRESULT WINAPI wbem_services_DeleteClassAsync ( IWbemServices iface,
const BSTR  strClass,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemObjectSink pResponseHandler 
)
static

Definition at line 542 of file services.c.

548 {
549  FIXME("\n");
550  return WBEM_E_FAILED;
551 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_DeleteInstance()

static HRESULT WINAPI wbem_services_DeleteInstance ( IWbemServices iface,
const BSTR  strObjectPath,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemCallResult **  ppCallResult 
)
static

Definition at line 597 of file services.c.

603 {
604  FIXME("\n");
605  return WBEM_E_FAILED;
606 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_DeleteInstanceAsync()

static HRESULT WINAPI wbem_services_DeleteInstanceAsync ( IWbemServices iface,
const BSTR  strObjectPath,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemObjectSink pResponseHandler 
)
static

Definition at line 608 of file services.c.

614 {
615  FIXME("\n");
616  return WBEM_E_FAILED;
617 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_ExecMethod()

static HRESULT WINAPI wbem_services_ExecMethod ( IWbemServices iface,
const BSTR  strObjectPath,
const BSTR  strMethodName,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemClassObject pInParams,
IWbemClassObject **  ppOutParams,
IWbemCallResult **  ppCallResult 
)
static

Definition at line 820 of file services.c.

829 {
832  struct query *query = NULL;
833  struct path *path;
834  WCHAR *str;
836  struct table *table;
837  HRESULT hr;
838 
839  TRACE("%p, %s, %s, %08x, %p, %p, %p, %p\n", iface, debugstr_w(strObjectPath),
840  debugstr_w(strMethodName), lFlags, pCtx, pInParams, ppOutParams, ppCallResult);
841 
842  if (lFlags) FIXME("flags %08x not supported\n", lFlags);
843 
844  if ((hr = parse_path( strObjectPath, &path )) != S_OK) return hr;
845  if (!(str = query_from_path( path )))
846  {
847  hr = E_OUTOFMEMORY;
848  goto done;
849  }
850  if (!(query = create_query()))
851  {
852  hr = E_OUTOFMEMORY;
853  goto done;
854  }
855  hr = parse_query( str, &query->view, &query->mem );
856  if (hr != S_OK) goto done;
857 
858  hr = execute_view( query->view );
859  if (hr != S_OK) goto done;
860 
861  hr = EnumWbemClassObject_create( query, (void **)&result );
862  if (hr != S_OK) goto done;
863 
864  table = get_view_table( query->view, 0 );
866  if (hr != S_OK) goto done;
867 
868  hr = get_method( table, strMethodName, &func );
869  if (hr != S_OK) goto done;
870 
871  hr = func( obj, pInParams, ppOutParams );
872 
873 done:
874  if (result) IEnumWbemClassObject_Release( result );
875  if (obj) IWbemClassObject_Release( obj );
876  free_query( query );
877  free_path( path );
878  heap_free( str );
879  return hr;
880 }
GLenum func
Definition: glext.h:6028
void free_query(struct query *query)
Definition: query.c:765
const WCHAR * name
HRESULT hr
Definition: shlfolder.c:183
GLsizei const GLchar ** path
Definition: glext.h:7234
void free_path(struct path *path)
Definition: services.c:413
HRESULT EnumWbemClassObject_create(struct query *query, LPVOID *ppObj)
Definition: class.c:199
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
WCHAR * query_from_path(const struct path *path)
Definition: services.c:421
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
static BOOL parse_query(const WCHAR **ptr, parse_data *data, DWORD flags)
Definition: uri.c:2044
#define FIXME(fmt,...)
Definition: debug.h:110
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
HRESULT execute_view(struct view *view)
Definition: query.c:739
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
HRESULT() class_method(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **)
struct list mem
#define S_OK
Definition: intsafe.h:59
HRESULT create_class_object(const WCHAR *name, IEnumWbemClassObject *iter, UINT index, struct record *record, IWbemClassObject **obj)
Definition: class.c:1021
struct view * view
static struct query * create_query(void)
Definition: pdh_main.c:152
struct table * get_view_table(const struct view *view, UINT index)
Definition: query.c:1161
HRESULT get_method(const struct table *table, const WCHAR *name, class_method **func)
Definition: table.c:269
GLuint64EXT * result
Definition: glext.h:11304
HRESULT parse_path(const WCHAR *str, struct path **ret)
Definition: services.c:326
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ wbem_services_ExecMethodAsync()

static HRESULT WINAPI wbem_services_ExecMethodAsync ( IWbemServices iface,
const BSTR  strObjectPath,
const BSTR  strMethodName,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemClassObject pInParams,
IWbemObjectSink pResponseHandler 
)
static

Definition at line 882 of file services.c.

890 {
891  FIXME("\n");
892  return WBEM_E_FAILED;
893 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_ExecNotificationQuery()

static HRESULT WINAPI wbem_services_ExecNotificationQuery ( IWbemServices iface,
const BSTR  strQueryLanguage,
const BSTR  strQuery,
LONG  lFlags,
IWbemContext *  pCtx,
IEnumWbemClassObject **  ppEnum 
)
static

Definition at line 751 of file services.c.

758 {
759  FIXME("\n");
760  return WBEM_E_FAILED;
761 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_ExecNotificationQueryAsync()

static HRESULT WINAPI wbem_services_ExecNotificationQueryAsync ( IWbemServices iface,
const BSTR  strQueryLanguage,
const BSTR  strQuery,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemObjectSink pResponseHandler 
)
static

Definition at line 763 of file services.c.

770 {
774  struct async_header *async;
775  struct async_query *query;
776 
777  TRACE("%p, %s, %s, 0x%08x, %p, %p\n", iface, debugstr_w(strQueryLanguage), debugstr_w(strQuery),
778  lFlags, pCtx, pResponseHandler);
779 
780  if (!pResponseHandler) return WBEM_E_INVALID_PARAMETER;
781 
782  hr = IWbemObjectSink_QueryInterface( pResponseHandler, &IID_IWbemObjectSink, (void **)&sink );
783  if (FAILED(hr)) return hr;
784 
786 
787  if (services->async)
788  {
789  FIXME("handle more than one pending async\n");
790  hr = WBEM_E_FAILED;
791  goto done;
792  }
793  if (!(query = heap_alloc_zero( sizeof(*query) ))) goto done;
794  async = (struct async_header *)query;
795 
796  if (!(init_async( async, sink, async_exec_query )))
797  {
798  free_async( async );
799  goto done;
800  }
801  if (!(query->str = heap_strdupW( strQuery )))
802  {
803  free_async( async );
804  goto done;
805  }
806  hr = queue_async( async );
807  if (hr == S_OK) services->async = async;
808  else
809  {
810  heap_free( query->str );
811  free_async( async );
812  }
813 
814 done:
816  IWbemObjectSink_Release( sink );
817  return hr;
818 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
static void async_exec_query(struct async_header *hdr)
Definition: services.c:670
LONG HRESULT
Definition: typedefs.h:77
static BOOL init_async(struct async_header *async, IWbemObjectSink *sink, void(*proc)(struct async_header *))
Definition: services.c:161
#define S_OK
Definition: intsafe.h:59
static void free_async(struct async_header *async)
Definition: services.c:153
static struct wbem_services * impl_from_IWbemServices(IWbemServices *iface)
Definition: services.c:203
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static HRESULT queue_async(struct async_header *async)
Definition: services.c:188
GLenum query
Definition: glext.h:7781
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ wbem_services_ExecQuery()

static HRESULT WINAPI wbem_services_ExecQuery ( IWbemServices iface,
const BSTR  strQueryLanguage,
const BSTR  strQuery,
LONG  lFlags,
IWbemContext *  pCtx,
IEnumWbemClassObject **  ppEnum 
)
static

Definition at line 652 of file services.c.

659 {
660  static const WCHAR wqlW[] = {'W','Q','L',0};
661 
662  TRACE("%p, %s, %s, 0x%08x, %p, %p\n", iface, debugstr_w(strQueryLanguage),
663  debugstr_w(strQuery), lFlags, pCtx, ppEnum);
664 
665  if (!strQueryLanguage || !strQuery || !strQuery[0]) return WBEM_E_INVALID_PARAMETER;
666  if (wcsicmp( strQueryLanguage, wqlW )) return WBEM_E_INVALID_QUERY_TYPE;
667  return exec_query( strQuery, ppEnum );
668 }
#define debugstr_w
Definition: kernel32.h:32
static const WCHAR wqlW[]
Definition: query.c:30
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define wcsicmp
Definition: string.h:1152
HRESULT exec_query(const WCHAR *str, IEnumWbemClassObject **result)
Definition: query.c:786

◆ wbem_services_ExecQueryAsync()

static HRESULT WINAPI wbem_services_ExecQueryAsync ( IWbemServices iface,
const BSTR  strQueryLanguage,
const BSTR  strQuery,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemObjectSink pResponseHandler 
)
static

Definition at line 694 of file services.c.

701 {
705  struct async_header *async;
706  struct async_query *query;
707 
708  TRACE("%p, %s, %s, 0x%08x, %p, %p\n", iface, debugstr_w(strQueryLanguage), debugstr_w(strQuery),
709  lFlags, pCtx, pResponseHandler);
710 
711  if (!pResponseHandler) return WBEM_E_INVALID_PARAMETER;
712 
713  hr = IWbemObjectSink_QueryInterface( pResponseHandler, &IID_IWbemObjectSink, (void **)&sink );
714  if (FAILED(hr)) return hr;
715 
717 
718  if (services->async)
719  {
720  FIXME("handle more than one pending async\n");
721  hr = WBEM_E_FAILED;
722  goto done;
723  }
724  if (!(query = heap_alloc_zero( sizeof(*query) ))) goto done;
725  async = (struct async_header *)query;
726 
727  if (!(init_async( async, sink, async_exec_query )))
728  {
729  free_async( async );
730  goto done;
731  }
732  if (!(query->str = heap_strdupW( strQuery )))
733  {
734  free_async( async );
735  goto done;
736  }
737  hr = queue_async( async );
738  if (hr == S_OK) services->async = async;
739  else
740  {
741  heap_free( query->str );
742  free_async( async );
743  }
744 
745 done:
747  IWbemObjectSink_Release( sink );
748  return hr;
749 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
static void async_exec_query(struct async_header *hdr)
Definition: services.c:670
LONG HRESULT
Definition: typedefs.h:77
static BOOL init_async(struct async_header *async, IWbemObjectSink *sink, void(*proc)(struct async_header *))
Definition: services.c:161
#define S_OK
Definition: intsafe.h:59
static void free_async(struct async_header *async)
Definition: services.c:153
static struct wbem_services * impl_from_IWbemServices(IWbemServices *iface)
Definition: services.c:203
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static HRESULT queue_async(struct async_header *async)
Definition: services.c:188
GLenum query
Definition: glext.h:7781
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ wbem_services_GetObject()

static HRESULT WINAPI wbem_services_GetObject ( IWbemServices iface,
const BSTR  strObjectPath,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemClassObject **  ppObject,
IWbemCallResult **  ppCallResult 
)
static

Definition at line 479 of file services.c.

486 {
487  TRACE("%p, %s, 0x%08x, %p, %p, %p\n", iface, debugstr_w(strObjectPath), lFlags,
488  pCtx, ppObject, ppCallResult);
489 
490  if (lFlags) FIXME("unsupported flags 0x%08x\n", lFlags);
491 
492  if (!strObjectPath || !strObjectPath[0])
493  return create_class_object( NULL, NULL, 0, NULL, ppObject );
494 
495  return get_object( strObjectPath, ppObject );
496 }
HRESULT get_object(const WCHAR *object_path, IWbemClassObject **obj)
Definition: services.c:458
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT create_class_object(const WCHAR *name, IEnumWbemClassObject *iter, UINT index, struct record *record, IWbemClassObject **obj)
Definition: class.c:1021

◆ wbem_services_GetObjectAsync()

static HRESULT WINAPI wbem_services_GetObjectAsync ( IWbemServices iface,
const BSTR  strObjectPath,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemObjectSink pResponseHandler 
)
static

Definition at line 498 of file services.c.

504 {
505  FIXME("\n");
506  return WBEM_E_FAILED;
507 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_OpenNamespace()

static HRESULT WINAPI wbem_services_OpenNamespace ( IWbemServices iface,
const BSTR  strNamespace,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemServices **  ppWorkingNamespace,
IWbemCallResult **  ppResult 
)
static

Definition at line 268 of file services.c.

275 {
276  static const WCHAR cimv2W[] = {'c','i','m','v','2',0};
277  static const WCHAR defaultW[] = {'d','e','f','a','u','l','t',0};
278  struct wbem_services *ws = impl_from_IWbemServices( iface );
279 
280  TRACE("%p, %s, 0x%08x, %p, %p, %p\n", iface, debugstr_w(strNamespace), lFlags,
281  pCtx, ppWorkingNamespace, ppResult);
282 
283  if ((wcsicmp( strNamespace, cimv2W ) && wcsicmp( strNamespace, defaultW )) || ws->namespace)
285 
286  return WbemServices_create( cimv2W, (void **)ppWorkingNamespace );
287 }
const char * ws
Definition: skip_ws.cpp:7
static const WCHAR defaultW[]
Definition: lex.c:42
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
HRESULT WbemServices_create(const WCHAR *namespace, LPVOID *ppObj)
Definition: services.c:925
#define wcsicmp
Definition: string.h:1152
static struct wbem_services * impl_from_IWbemServices(IWbemServices *iface)
Definition: services.c:203

◆ wbem_services_PutClass()

static HRESULT WINAPI wbem_services_PutClass ( IWbemServices iface,
IWbemClassObject pObject,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemCallResult **  ppCallResult 
)
static

Definition at line 509 of file services.c.

515 {
516  FIXME("\n");
517  return WBEM_E_FAILED;
518 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_PutClassAsync()

static HRESULT WINAPI wbem_services_PutClassAsync ( IWbemServices iface,
IWbemClassObject pObject,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemObjectSink pResponseHandler 
)
static

Definition at line 520 of file services.c.

526 {
527  FIXME("\n");
528  return WBEM_E_FAILED;
529 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_PutInstance()

static HRESULT WINAPI wbem_services_PutInstance ( IWbemServices iface,
IWbemClassObject pInst,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemCallResult **  ppCallResult 
)
static

Definition at line 575 of file services.c.

581 {
582  FIXME("\n");
583  return WBEM_E_FAILED;
584 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_PutInstanceAsync()

static HRESULT WINAPI wbem_services_PutInstanceAsync ( IWbemServices iface,
IWbemClassObject pInst,
LONG  lFlags,
IWbemContext *  pCtx,
IWbemObjectSink pResponseHandler 
)
static

Definition at line 586 of file services.c.

592 {
593  FIXME("\n");
594  return WBEM_E_FAILED;
595 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_QueryInterface()

static HRESULT WINAPI wbem_services_QueryInterface ( IWbemServices iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 240 of file services.c.

244 {
245  struct wbem_services *ws = impl_from_IWbemServices( iface );
246 
247  TRACE("%p %s %p\n", ws, debugstr_guid( riid ), ppvObject );
248 
249  if ( IsEqualGUID( riid, &IID_IWbemServices ) ||
251  {
252  *ppvObject = ws;
253  }
254  else if ( IsEqualGUID( riid, &IID_IClientSecurity ) )
255  {
257  return S_OK;
258  }
259  else
260  {
261  FIXME("interface %s not implemented\n", debugstr_guid(riid));
262  return E_NOINTERFACE;
263  }
264  IWbemServices_AddRef( iface );
265  return S_OK;
266 }
const char * ws
Definition: skip_ws.cpp:7
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
IClientSecurity client_security
Definition: services.c:137
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static struct wbem_services * impl_from_IWbemServices(IWbemServices *iface)
Definition: services.c:203

◆ wbem_services_QueryObjectSink()

static HRESULT WINAPI wbem_services_QueryObjectSink ( IWbemServices iface,
LONG  lFlags,
IWbemObjectSink **  ppResponseHandler 
)
static

Definition at line 317 of file services.c.

321 {
322  FIXME("\n");
323  return WBEM_E_FAILED;
324 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ wbem_services_Release()

static ULONG WINAPI wbem_services_Release ( IWbemServices iface)
static

Definition at line 215 of file services.c.

217 {
218  struct wbem_services *ws = impl_from_IWbemServices( iface );
219  LONG refs = InterlockedDecrement( &ws->refs );
220  if (!refs)
221  {
222  TRACE("destroying %p\n", ws);
223 
224  EnterCriticalSection( &ws->cs );
225  if (ws->async) SetEvent( ws->async->cancel );
226  LeaveCriticalSection( &ws->cs );
227  if (ws->async)
228  {
229  WaitForSingleObject( ws->async->wait, INFINITE );
230  free_async( ws->async );
231  }
232  ws->cs.DebugInfo->Spare[0] = 0;
233  DeleteCriticalSection( &ws->cs );
234  heap_free( ws->namespace );
235  heap_free( ws );
236  }
237  return refs;
238 }
const char * ws
Definition: skip_ws.cpp:7
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define InterlockedDecrement
Definition: armddk.h:52
static void free_async(struct async_header *async)
Definition: services.c:153
static struct wbem_services * impl_from_IWbemServices(IWbemServices *iface)
Definition: services.c:203
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define INFINITE
Definition: serial.h:102
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ WbemServices_create()

HRESULT WbemServices_create ( const WCHAR namespace,
LPVOID ppObj 
)

Definition at line 925 of file services.c.

926 {
927  struct wbem_services *ws;
928 
929  TRACE("(%p)\n", ppObj);
930 
931  ws = heap_alloc( sizeof(*ws) );
932  if (!ws) return E_OUTOFMEMORY;
933 
934  ws->IWbemServices_iface.lpVtbl = &wbem_services_vtbl;
935  ws->refs = 1;
936  ws->namespace = heap_strdupW( namespace );
937  ws->async = NULL;
939  ws->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": wbemprox_services.cs");
940 
941  *ppObj = &ws->IWbemServices_iface;
942 
943  TRACE("returning iface %p\n", *ppObj);
944  return S_OK;
945 }
const char * ws
Definition: skip_ws.cpp:7
#define DWORD_PTR
Definition: treelist.c:76
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
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static const IWbemServicesVtbl wbem_services_vtbl
Definition: services.c:895
#define S_OK
Definition: intsafe.h:59

Referenced by wbem_locator_ConnectServer(), and wbem_services_OpenNamespace().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wbemprox  )

Variable Documentation

◆ client_security

◆ client_security_vtbl

const IClientSecurityVtbl client_security_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI client_security_AddRef(IClientSecurity *iface)
Definition: services.c:69
static HRESULT WINAPI client_security_QueryBlanket(IClientSecurity *iface, IUnknown *pProxy, DWORD *pAuthnSvc, DWORD *pAuthzSvc, OLECHAR **pServerPrincName, DWORD *pAuthnLevel, DWORD *pImpLevel, void **pAuthInfo, DWORD *pCapabilities)
Definition: services.c:83
static ULONG WINAPI client_security_Release(IClientSecurity *iface)
Definition: services.c:76
static HRESULT WINAPI client_security_QueryInterface(IClientSecurity *iface, REFIID riid, void **ppvObject)
Definition: services.c:46
static HRESULT WINAPI client_security_CopyProxy(IClientSecurity *iface, IUnknown *pProxy, IUnknown **ppCopy)
Definition: services.c:118
static HRESULT WINAPI client_security_SetBlanket(IClientSecurity *iface, IUnknown *pProxy, DWORD AuthnSvc, DWORD AuthzSvc, OLECHAR *pServerPrincName, DWORD AuthnLevel, DWORD ImpLevel, void *pAuthInfo, DWORD Capabilities)
Definition: services.c:98

Definition at line 127 of file services.c.

◆ wbem_services_vtbl

const IWbemServicesVtbl wbem_services_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI wbem_services_DeleteClassAsync(IWbemServices *iface, const BSTR strClass, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
Definition: services.c:542
static HRESULT WINAPI wbem_services_ExecNotificationQueryAsync(IWbemServices *iface, const BSTR strQueryLanguage, const BSTR strQuery, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
Definition: services.c:763
static HRESULT WINAPI wbem_services_GetObjectAsync(IWbemServices *iface, const BSTR strObjectPath, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
Definition: services.c:498
static HRESULT WINAPI wbem_services_DeleteClass(IWbemServices *iface, const BSTR strClass, LONG lFlags, IWbemContext *pCtx, IWbemCallResult **ppCallResult)
Definition: services.c:531
static HRESULT WINAPI wbem_services_CancelAsyncCall(IWbemServices *iface, IWbemObjectSink *pSink)
Definition: services.c:289
static HRESULT WINAPI wbem_services_QueryObjectSink(IWbemServices *iface, LONG lFlags, IWbemObjectSink **ppResponseHandler)
Definition: services.c:317
static HRESULT WINAPI wbem_services_ExecMethod(IWbemServices *iface, const BSTR strObjectPath, const BSTR strMethodName, LONG lFlags, IWbemContext *pCtx, IWbemClassObject *pInParams, IWbemClassObject **ppOutParams, IWbemCallResult **ppCallResult)
Definition: services.c:820
static HRESULT WINAPI wbem_services_ExecMethodAsync(IWbemServices *iface, const BSTR strObjectPath, const BSTR strMethodName, LONG lFlags, IWbemContext *pCtx, IWbemClassObject *pInParams, IWbemObjectSink *pResponseHandler)
Definition: services.c:882
static ULONG WINAPI wbem_services_AddRef(IWbemServices *iface)
Definition: services.c:208
static HRESULT WINAPI wbem_services_CreateClassEnumAsync(IWbemServices *iface, const BSTR strSuperclass, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
Definition: services.c:564
static HRESULT WINAPI wbem_services_PutClassAsync(IWbemServices *iface, IWbemClassObject *pObject, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
Definition: services.c:520
static ULONG WINAPI wbem_services_Release(IWbemServices *iface)
Definition: services.c:215
static HRESULT WINAPI wbem_services_CreateInstanceEnumAsync(IWbemServices *iface, const BSTR strFilter, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
Definition: services.c:641
static HRESULT WINAPI wbem_services_CreateInstanceEnum(IWbemServices *iface, const BSTR strClass, LONG lFlags, IWbemContext *pCtx, IEnumWbemClassObject **ppEnum)
Definition: services.c:619
static HRESULT WINAPI wbem_services_OpenNamespace(IWbemServices *iface, const BSTR strNamespace, LONG lFlags, IWbemContext *pCtx, IWbemServices **ppWorkingNamespace, IWbemCallResult **ppResult)
Definition: services.c:268
static HRESULT WINAPI wbem_services_DeleteInstance(IWbemServices *iface, const BSTR strObjectPath, LONG lFlags, IWbemContext *pCtx, IWbemCallResult **ppCallResult)
Definition: services.c:597
static HRESULT WINAPI wbem_services_ExecNotificationQuery(IWbemServices *iface, const BSTR strQueryLanguage, const BSTR strQuery, LONG lFlags, IWbemContext *pCtx, IEnumWbemClassObject **ppEnum)
Definition: services.c:751
static HRESULT WINAPI wbem_services_CreateClassEnum(IWbemServices *iface, const BSTR strSuperclass, LONG lFlags, IWbemContext *pCtx, IEnumWbemClassObject **ppEnum)
Definition: services.c:553
static HRESULT WINAPI wbem_services_PutInstance(IWbemServices *iface, IWbemClassObject *pInst, LONG lFlags, IWbemContext *pCtx, IWbemCallResult **ppCallResult)
Definition: services.c:575
static HRESULT WINAPI wbem_services_PutInstanceAsync(IWbemServices *iface, IWbemClassObject *pInst, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
Definition: services.c:586
static HRESULT WINAPI wbem_services_GetObject(IWbemServices *iface, const BSTR strObjectPath, LONG lFlags, IWbemContext *pCtx, IWbemClassObject **ppObject, IWbemCallResult **ppCallResult)
Definition: services.c:479
static HRESULT WINAPI wbem_services_ExecQuery(IWbemServices *iface, const BSTR strQueryLanguage, const BSTR strQuery, LONG lFlags, IWbemContext *pCtx, IEnumWbemClassObject **ppEnum)
Definition: services.c:652
static HRESULT WINAPI wbem_services_DeleteInstanceAsync(IWbemServices *iface, const BSTR strObjectPath, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
Definition: services.c:608
static HRESULT WINAPI wbem_services_QueryInterface(IWbemServices *iface, REFIID riid, void **ppvObject)
Definition: services.c:240
static HRESULT WINAPI wbem_services_PutClass(IWbemServices *iface, IWbemClassObject *pObject, LONG lFlags, IWbemContext *pCtx, IWbemCallResult **ppCallResult)
Definition: services.c:509
static HRESULT WINAPI wbem_services_ExecQueryAsync(IWbemServices *iface, const BSTR strQueryLanguage, const BSTR strQuery, LONG lFlags, IWbemContext *pCtx, IWbemObjectSink *pResponseHandler)
Definition: services.c:694

Definition at line 895 of file services.c.

Referenced by WbemServices_create().