dwrite: Added initial stub.
[wine/multimedia.git] / dlls / wbemprox / services.c
blob8edd2f6f6856f1f57577cfcb32784d4e66c9d87d
1 /*
2 * Copyright 2012 Hans Leidekker for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define COBJMACROS
21 #include "config.h"
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "initguid.h"
27 #include "objbase.h"
28 #include "wbemcli.h"
30 #include "wine/debug.h"
31 #include "wine/unicode.h"
32 #include "wbemprox_private.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
36 struct client_security
38 IClientSecurity IClientSecurity_iface;
41 static inline struct client_security *impl_from_IClientSecurity( IClientSecurity *iface )
43 return CONTAINING_RECORD( iface, struct client_security, IClientSecurity_iface );
46 static HRESULT WINAPI client_security_QueryInterface(
47 IClientSecurity *iface,
48 REFIID riid,
49 void **ppvObject )
51 struct client_security *cs = impl_from_IClientSecurity( iface );
53 TRACE("%p %s %p\n", cs, debugstr_guid( riid ), ppvObject );
55 if ( IsEqualGUID( riid, &IID_IClientSecurity ) ||
56 IsEqualGUID( riid, &IID_IUnknown ) )
58 *ppvObject = cs;
60 else
62 FIXME("interface %s not implemented\n", debugstr_guid(riid));
63 return E_NOINTERFACE;
65 IClientSecurity_AddRef( iface );
66 return S_OK;
69 static ULONG WINAPI client_security_AddRef(
70 IClientSecurity *iface )
72 FIXME("%p\n", iface);
73 return 2;
76 static ULONG WINAPI client_security_Release(
77 IClientSecurity *iface )
79 FIXME("%p\n", iface);
80 return 1;
83 static HRESULT WINAPI client_security_QueryBlanket(
84 IClientSecurity *iface,
85 IUnknown *pProxy,
86 DWORD *pAuthnSvc,
87 DWORD *pAuthzSvc,
88 OLECHAR **pServerPrincName,
89 DWORD *pAuthnLevel,
90 DWORD *pImpLevel,
91 void **pAuthInfo,
92 DWORD *pCapabilities )
94 FIXME("\n");
95 return WBEM_E_FAILED;
98 static HRESULT WINAPI client_security_SetBlanket(
99 IClientSecurity *iface,
100 IUnknown *pProxy,
101 DWORD AuthnSvc,
102 DWORD AuthzSvc,
103 OLECHAR *pServerPrincName,
104 DWORD AuthnLevel,
105 DWORD ImpLevel,
106 void *pAuthInfo,
107 DWORD Capabilities )
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;
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;
118 static HRESULT WINAPI client_security_CopyProxy(
119 IClientSecurity *iface,
120 IUnknown *pProxy,
121 IUnknown **ppCopy )
123 FIXME("\n");
124 return WBEM_E_FAILED;
127 static const IClientSecurityVtbl client_security_vtbl =
129 client_security_QueryInterface,
130 client_security_AddRef,
131 client_security_Release,
132 client_security_QueryBlanket,
133 client_security_SetBlanket,
134 client_security_CopyProxy
137 IClientSecurity client_security = { &client_security_vtbl };
139 struct wbem_services
141 IWbemServices IWbemServices_iface;
142 LONG refs;
143 WCHAR *namespace;
146 static inline struct wbem_services *impl_from_IWbemServices( IWbemServices *iface )
148 return CONTAINING_RECORD( iface, struct wbem_services, IWbemServices_iface );
151 static ULONG WINAPI wbem_services_AddRef(
152 IWbemServices *iface )
154 struct wbem_services *ws = impl_from_IWbemServices( iface );
155 return InterlockedIncrement( &ws->refs );
158 static ULONG WINAPI wbem_services_Release(
159 IWbemServices *iface )
161 struct wbem_services *ws = impl_from_IWbemServices( iface );
162 LONG refs = InterlockedDecrement( &ws->refs );
163 if (!refs)
165 TRACE("destroying %p\n", ws);
166 heap_free( ws->namespace );
167 heap_free( ws );
169 return refs;
172 static HRESULT WINAPI wbem_services_QueryInterface(
173 IWbemServices *iface,
174 REFIID riid,
175 void **ppvObject )
177 struct wbem_services *ws = impl_from_IWbemServices( iface );
179 TRACE("%p %s %p\n", ws, debugstr_guid( riid ), ppvObject );
181 if ( IsEqualGUID( riid, &IID_IWbemServices ) ||
182 IsEqualGUID( riid, &IID_IUnknown ) )
184 *ppvObject = ws;
186 else if ( IsEqualGUID( riid, &IID_IClientSecurity ) )
188 *ppvObject = &client_security;
189 return S_OK;
191 else
193 FIXME("interface %s not implemented\n", debugstr_guid(riid));
194 return E_NOINTERFACE;
196 IWbemServices_AddRef( iface );
197 return S_OK;
200 static HRESULT WINAPI wbem_services_OpenNamespace(
201 IWbemServices *iface,
202 const BSTR strNamespace,
203 LONG lFlags,
204 IWbemContext *pCtx,
205 IWbemServices **ppWorkingNamespace,
206 IWbemCallResult **ppResult )
208 static const WCHAR cimv2W[] = {'c','i','m','v','2',0};
209 static const WCHAR defaultW[] = {'d','e','f','a','u','l','t',0};
210 struct wbem_services *ws = impl_from_IWbemServices( iface );
212 TRACE("%p, %s, 0x%08x, %p, %p, %p\n", iface, debugstr_w(strNamespace), lFlags,
213 pCtx, ppWorkingNamespace, ppResult);
215 if ((strcmpiW( strNamespace, cimv2W ) && strcmpiW( strNamespace, defaultW )) || ws->namespace)
216 return WBEM_E_INVALID_NAMESPACE;
218 return WbemServices_create( NULL, cimv2W, (void **)ppWorkingNamespace );
221 static HRESULT WINAPI wbem_services_CancelAsyncCall(
222 IWbemServices *iface,
223 IWbemObjectSink *pSink )
225 FIXME("\n");
226 return WBEM_E_FAILED;
229 static HRESULT WINAPI wbem_services_QueryObjectSink(
230 IWbemServices *iface,
231 LONG lFlags,
232 IWbemObjectSink **ppResponseHandler )
234 FIXME("\n");
235 return WBEM_E_FAILED;
238 static HRESULT WINAPI wbem_services_GetObject(
239 IWbemServices *iface,
240 const BSTR strObjectPath,
241 LONG lFlags,
242 IWbemContext *pCtx,
243 IWbemClassObject **ppObject,
244 IWbemCallResult **ppCallResult )
246 static const WCHAR selectW[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',0};
247 IEnumWbemClassObject *iter;
248 WCHAR *query;
249 HRESULT hr;
251 TRACE("%p, %s, 0x%08x, %p, %p, %p\n", iface, debugstr_w(strObjectPath), lFlags,
252 pCtx, ppObject, ppCallResult);
254 if (lFlags) FIXME("unsupported flags 0x%08x\n", lFlags);
256 /* FIXME: parse path */
258 if (!(query = heap_alloc( strlenW( strObjectPath ) * sizeof(WCHAR) + sizeof(selectW) )))
259 return E_OUTOFMEMORY;
260 strcpyW( query, selectW );
261 strcatW( query, strObjectPath );
263 hr = exec_query( query, &iter );
264 heap_free( query );
265 if (hr != S_OK) return hr;
267 hr = WbemClassObject_create( NULL, iter, 0, (void **)ppObject );
268 IEnumWbemClassObject_Release( iter );
269 return hr;
272 static HRESULT WINAPI wbem_services_GetObjectAsync(
273 IWbemServices *iface,
274 const BSTR strObjectPath,
275 LONG lFlags,
276 IWbemContext *pCtx,
277 IWbemObjectSink *pResponseHandler )
279 FIXME("\n");
280 return WBEM_E_FAILED;
283 static HRESULT WINAPI wbem_services_PutClass(
284 IWbemServices *iface,
285 IWbemClassObject *pObject,
286 LONG lFlags,
287 IWbemContext *pCtx,
288 IWbemCallResult **ppCallResult )
290 FIXME("\n");
291 return WBEM_E_FAILED;
294 static HRESULT WINAPI wbem_services_PutClassAsync(
295 IWbemServices *iface,
296 IWbemClassObject *pObject,
297 LONG lFlags,
298 IWbemContext *pCtx,
299 IWbemObjectSink *pResponseHandler )
301 FIXME("\n");
302 return WBEM_E_FAILED;
305 static HRESULT WINAPI wbem_services_DeleteClass(
306 IWbemServices *iface,
307 const BSTR strClass,
308 LONG lFlags,
309 IWbemContext *pCtx,
310 IWbemCallResult **ppCallResult )
312 FIXME("\n");
313 return WBEM_E_FAILED;
316 static HRESULT WINAPI wbem_services_DeleteClassAsync(
317 IWbemServices *iface,
318 const BSTR strClass,
319 LONG lFlags,
320 IWbemContext *pCtx,
321 IWbemObjectSink *pResponseHandler )
323 FIXME("\n");
324 return WBEM_E_FAILED;
327 static HRESULT WINAPI wbem_services_CreateClassEnum(
328 IWbemServices *iface,
329 const BSTR strSuperclass,
330 LONG lFlags,
331 IWbemContext *pCtx,
332 IEnumWbemClassObject **ppEnum )
334 FIXME("\n");
335 return WBEM_E_FAILED;
338 static HRESULT WINAPI wbem_services_CreateClassEnumAsync(
339 IWbemServices *iface,
340 const BSTR strSuperclass,
341 LONG lFlags,
342 IWbemContext *pCtx,
343 IWbemObjectSink *pResponseHandler )
345 FIXME("\n");
346 return WBEM_E_FAILED;
349 static HRESULT WINAPI wbem_services_PutInstance(
350 IWbemServices *iface,
351 IWbemClassObject *pInst,
352 LONG lFlags,
353 IWbemContext *pCtx,
354 IWbemCallResult **ppCallResult )
356 FIXME("\n");
357 return WBEM_E_FAILED;
360 static HRESULT WINAPI wbem_services_PutInstanceAsync(
361 IWbemServices *iface,
362 IWbemClassObject *pInst,
363 LONG lFlags,
364 IWbemContext *pCtx,
365 IWbemObjectSink *pResponseHandler )
367 FIXME("\n");
368 return WBEM_E_FAILED;
371 static HRESULT WINAPI wbem_services_DeleteInstance(
372 IWbemServices *iface,
373 const BSTR strObjectPath,
374 LONG lFlags,
375 IWbemContext *pCtx,
376 IWbemCallResult **ppCallResult )
378 FIXME("\n");
379 return WBEM_E_FAILED;
382 static HRESULT WINAPI wbem_services_DeleteInstanceAsync(
383 IWbemServices *iface,
384 const BSTR strObjectPath,
385 LONG lFlags,
386 IWbemContext *pCtx,
387 IWbemObjectSink *pResponseHandler )
389 FIXME("\n");
390 return WBEM_E_FAILED;
393 static HRESULT WINAPI wbem_services_CreateInstanceEnum(
394 IWbemServices *iface,
395 const BSTR strClass,
396 LONG lFlags,
397 IWbemContext *pCtx,
398 IEnumWbemClassObject **ppEnum )
400 static const WCHAR selectW[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',0};
401 WCHAR *query;
402 HRESULT hr;
404 TRACE("%p, %s, 0%08x, %p, %p\n", iface, debugstr_w(strClass), lFlags, pCtx, ppEnum);
406 if (lFlags) FIXME("unsupported flags 0x%08x\n", lFlags);
408 if (!(query = heap_alloc( strlenW( strClass ) * sizeof(WCHAR) + sizeof(selectW) )))
409 return E_OUTOFMEMORY;
410 strcpyW( query, selectW );
411 strcatW( query, strClass );
413 hr = exec_query( query, ppEnum );
414 heap_free( query );
415 return hr;
418 static HRESULT WINAPI wbem_services_CreateInstanceEnumAsync(
419 IWbemServices *iface,
420 const BSTR strFilter,
421 LONG lFlags,
422 IWbemContext *pCtx,
423 IWbemObjectSink *pResponseHandler )
425 FIXME("\n");
426 return WBEM_E_FAILED;
429 static HRESULT WINAPI wbem_services_ExecQuery(
430 IWbemServices *iface,
431 const BSTR strQueryLanguage,
432 const BSTR strQuery,
433 LONG lFlags,
434 IWbemContext *pCtx,
435 IEnumWbemClassObject **ppEnum )
437 static const WCHAR wqlW[] = {'W','Q','L',0};
439 TRACE("%p, %s, %s, 0x%08x, %p, %p\n", iface, debugstr_w(strQueryLanguage),
440 debugstr_w(strQuery), lFlags, pCtx, ppEnum);
442 if (!strQueryLanguage || !strQuery) return WBEM_E_INVALID_PARAMETER;
443 if (strcmpiW( strQueryLanguage, wqlW )) return WBEM_E_INVALID_QUERY_TYPE;
444 return exec_query( strQuery, ppEnum );
447 static HRESULT WINAPI wbem_services_ExecQueryAsync(
448 IWbemServices *iface,
449 const BSTR strQueryLanguage,
450 const BSTR strQuery,
451 LONG lFlags,
452 IWbemContext *pCtx,
453 IWbemObjectSink *pResponseHandler )
455 FIXME("\n");
456 return WBEM_E_FAILED;
459 static HRESULT WINAPI wbem_services_ExecNotificationQuery(
460 IWbemServices *iface,
461 const BSTR strQueryLanguage,
462 const BSTR strQuery,
463 LONG lFlags,
464 IWbemContext *pCtx,
465 IEnumWbemClassObject **ppEnum )
467 FIXME("\n");
468 return WBEM_E_FAILED;
471 static HRESULT WINAPI wbem_services_ExecNotificationQueryAsync(
472 IWbemServices *iface,
473 const BSTR strQueryLanguage,
474 const BSTR strQuery,
475 LONG lFlags,
476 IWbemContext *pCtx,
477 IWbemObjectSink *pResponseHandler )
479 FIXME("\n");
480 return WBEM_E_FAILED;
483 static HRESULT WINAPI wbem_services_ExecMethod(
484 IWbemServices *iface,
485 const BSTR strObjectPath,
486 const BSTR strMethodName,
487 LONG lFlags,
488 IWbemContext *pCtx,
489 IWbemClassObject *pInParams,
490 IWbemClassObject **ppOutParams,
491 IWbemCallResult **ppCallResult )
493 FIXME("\n");
494 return WBEM_E_FAILED;
497 static HRESULT WINAPI wbem_services_ExecMethodAsync(
498 IWbemServices *iface,
499 const BSTR strObjectPath,
500 const BSTR strMethodName,
501 LONG lFlags,
502 IWbemContext *pCtx,
503 IWbemClassObject *pInParams,
504 IWbemObjectSink *pResponseHandler )
506 FIXME("\n");
507 return WBEM_E_FAILED;
510 static const IWbemServicesVtbl wbem_services_vtbl =
512 wbem_services_QueryInterface,
513 wbem_services_AddRef,
514 wbem_services_Release,
515 wbem_services_OpenNamespace,
516 wbem_services_CancelAsyncCall,
517 wbem_services_QueryObjectSink,
518 wbem_services_GetObject,
519 wbem_services_GetObjectAsync,
520 wbem_services_PutClass,
521 wbem_services_PutClassAsync,
522 wbem_services_DeleteClass,
523 wbem_services_DeleteClassAsync,
524 wbem_services_CreateClassEnum,
525 wbem_services_CreateClassEnumAsync,
526 wbem_services_PutInstance,
527 wbem_services_PutInstanceAsync,
528 wbem_services_DeleteInstance,
529 wbem_services_DeleteInstanceAsync,
530 wbem_services_CreateInstanceEnum,
531 wbem_services_CreateInstanceEnumAsync,
532 wbem_services_ExecQuery,
533 wbem_services_ExecQueryAsync,
534 wbem_services_ExecNotificationQuery,
535 wbem_services_ExecNotificationQueryAsync,
536 wbem_services_ExecMethod,
537 wbem_services_ExecMethodAsync
540 HRESULT WbemServices_create( IUnknown *pUnkOuter, const WCHAR *namespace, LPVOID *ppObj )
542 struct wbem_services *ws;
544 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
546 ws = heap_alloc( sizeof(*ws) );
547 if (!ws) return E_OUTOFMEMORY;
549 ws->IWbemServices_iface.lpVtbl = &wbem_services_vtbl;
550 ws->refs = 1;
551 ws->namespace = heap_strdupW( namespace );
553 *ppObj = &ws->IWbemServices_iface;
555 TRACE("returning iface %p\n", *ppObj);
556 return S_OK;