Nikolay Sivov : wbemprox: Implement WbemContext stub.
Alexandre Julliard
julliard at winehq.org
Wed Feb 24 15:45:39 CST 2021
Module: wine
Branch: master
Commit: 0eaccbb15e737aa2532d84d63b4e5991fd05b055
URL: https://source.winehq.org/git/wine.git/?a=commit;h=0eaccbb15e737aa2532d84d63b4e5991fd05b055
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Feb 23 23:06:33 2021 +0300
wbemprox: Implement WbemContext stub.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wbemprox/main.c | 5 ++
dlls/wbemprox/services.c | 175 +++++++++++++++++++++++++++++++++++++++
dlls/wbemprox/tests/services.c | 12 +++
dlls/wbemprox/wbemprox.idl | 7 ++
dlls/wbemprox/wbemprox_private.h | 1 +
include/wbemcli.idl | 9 ++
6 files changed, 209 insertions(+)
diff --git a/dlls/wbemprox/main.c b/dlls/wbemprox/main.c
index 09084414983..0ebbd55aba9 100644
--- a/dlls/wbemprox/main.c
+++ b/dlls/wbemprox/main.c
@@ -112,6 +112,7 @@ static const struct IClassFactoryVtbl wbemprox_cf_vtbl =
};
static wbemprox_cf wbem_locator_cf = { { &wbemprox_cf_vtbl }, WbemLocator_create };
+static wbemprox_cf wbem_context_cf = { { &wbemprox_cf_vtbl }, WbemContext_create };
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
@@ -139,6 +140,10 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv )
{
cf = &wbem_locator_cf.IClassFactory_iface;
}
+ else if (IsEqualGUID( rclsid, &CLSID_WbemContext ))
+ {
+ cf = &wbem_context_cf.IClassFactory_iface;
+ }
if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
return IClassFactory_QueryInterface( cf, iid, ppv );
}
diff --git a/dlls/wbemprox/services.c b/dlls/wbemprox/services.c
index ab7146db2d8..965f1b168f1 100644
--- a/dlls/wbemprox/services.c
+++ b/dlls/wbemprox/services.c
@@ -954,3 +954,178 @@ HRESULT WbemServices_create( const WCHAR *namespace, LPVOID *ppObj )
TRACE("returning iface %p\n", *ppObj);
return S_OK;
}
+
+struct wbem_context
+{
+ IWbemContext IWbemContext_iface;
+ LONG refs;
+};
+
+static struct wbem_context *impl_from_IWbemContext( IWbemContext *iface )
+{
+ return CONTAINING_RECORD( iface, struct wbem_context, IWbemContext_iface );
+}
+
+static HRESULT WINAPI wbem_context_QueryInterface(
+ IWbemContext *iface,
+ REFIID riid,
+ void **obj)
+{
+ TRACE("%p, %s, %p\n", iface, debugstr_guid( riid ), obj );
+
+ if ( IsEqualGUID( riid, &IID_IWbemContext ) ||
+ IsEqualGUID( riid, &IID_IUnknown ) )
+ {
+ *obj = iface;
+ }
+ else
+ {
+ FIXME("interface %s not implemented\n", debugstr_guid(riid));
+ return E_NOINTERFACE;
+ }
+
+ IWbemContext_AddRef( iface );
+ return S_OK;
+}
+
+static ULONG WINAPI wbem_context_AddRef(
+ IWbemContext *iface )
+{
+ struct wbem_context *context = impl_from_IWbemContext( iface );
+ return InterlockedIncrement( &context->refs );
+}
+
+static ULONG WINAPI wbem_context_Release(
+ IWbemContext *iface )
+{
+ struct wbem_context *context = impl_from_IWbemContext( iface );
+ LONG refs = InterlockedDecrement( &context->refs );
+
+ if (!refs)
+ {
+ TRACE("destroying %p\n", context);
+ heap_free( context );
+ }
+ return refs;
+}
+
+static HRESULT WINAPI wbem_context_Clone(
+ IWbemContext *iface,
+ IWbemContext **newcopy )
+{
+ FIXME("%p, %p\n", iface, newcopy);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI wbem_context_GetNames(
+ IWbemContext *iface,
+ LONG flags,
+ SAFEARRAY **names )
+{
+ FIXME("%p, %#x, %p\n", iface, flags, names);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI wbem_context_BeginEnumeration(
+ IWbemContext *iface,
+ LONG flags )
+{
+ FIXME("%p, %#x\n", iface, flags);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI wbem_context_Next(
+ IWbemContext *iface,
+ LONG flags,
+ BSTR *name,
+ VARIANT *value )
+{
+ FIXME("%p, %#x, %p, %p\n", iface, flags, name, value);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI wbem_context_EndEnumeration(
+ IWbemContext *iface )
+{
+ FIXME("%p\n", iface);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI wbem_context_SetValue(
+ IWbemContext *iface,
+ LPCWSTR name,
+ LONG flags,
+ VARIANT *value )
+{
+ FIXME("%p, %s, %#x, %p\n", iface, debugstr_w(name), flags, value);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI wbem_context_GetValue(
+ IWbemContext *iface,
+ LPCWSTR name,
+ LONG flags,
+ VARIANT *value )
+{
+ FIXME("%p, %s, %#x, %p\n", iface, debugstr_w(name), flags, value);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI wbem_context_DeleteValue(
+ IWbemContext *iface,
+ LPCWSTR name,
+ LONG flags )
+{
+ FIXME("%p, %s, %#x\n", iface, debugstr_w(name), flags);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI wbem_context_DeleteAll(
+ IWbemContext *iface )
+{
+ FIXME("%p\n", iface);
+
+ return E_NOTIMPL;
+}
+
+static const IWbemContextVtbl wbem_context_vtbl =
+{
+ wbem_context_QueryInterface,
+ wbem_context_AddRef,
+ wbem_context_Release,
+ wbem_context_Clone,
+ wbem_context_GetNames,
+ wbem_context_BeginEnumeration,
+ wbem_context_Next,
+ wbem_context_EndEnumeration,
+ wbem_context_SetValue,
+ wbem_context_GetValue,
+ wbem_context_DeleteValue,
+ wbem_context_DeleteAll,
+};
+
+HRESULT WbemContext_create( void **obj )
+{
+ struct wbem_context *context;
+
+ TRACE("(%p)\n", obj);
+
+ context = heap_alloc( sizeof(*context) );
+ if (!context) return E_OUTOFMEMORY;
+
+ context->IWbemContext_iface.lpVtbl = &wbem_context_vtbl;
+ context->refs = 1;
+
+ *obj = &context->IWbemContext_iface;
+
+ TRACE("returning iface %p\n", *obj);
+ return S_OK;
+}
diff --git a/dlls/wbemprox/tests/services.c b/dlls/wbemprox/tests/services.c
index cf45ed712b6..a60d39f1ef2 100644
--- a/dlls/wbemprox/tests/services.c
+++ b/dlls/wbemprox/tests/services.c
@@ -149,10 +149,22 @@ static void test_IWbemLocator(void)
IWbemLocator_Release( locator );
}
+static void test_IWbemContext(void)
+{
+ IWbemContext *context;
+ HRESULT hr;
+
+ hr = CoCreateInstance( &CLSID_WbemContext, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemContext, (void **)&context );
+ ok(hr == S_OK, "Failed to create context object, hr %#x.\n", hr);
+
+ IWbemContext_Release( context );
+}
+
START_TEST(services)
{
CoInitialize( NULL );
test_IClientSecurity();
test_IWbemLocator();
+ test_IWbemContext();
CoUninitialize();
}
diff --git a/dlls/wbemprox/wbemprox.idl b/dlls/wbemprox/wbemprox.idl
index 5c6255a39dc..32fee800ee4 100644
--- a/dlls/wbemprox/wbemprox.idl
+++ b/dlls/wbemprox/wbemprox.idl
@@ -27,6 +27,13 @@
]
coclass WbemLocator { interface IWbemLocator; }
+[
+ helpstring("WBEM Call Context"),
+ threading(both),
+ uuid(674b6698-ee92-11d0-ad71-00c04fd8fdff)
+]
+coclass WbemContext { interface IWbemContext; }
+
[
helpstring("WBEM Administrative Locator"),
threading(both),
diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h
index ff9a7f6ff82..ac857b859e8 100644
--- a/dlls/wbemprox/wbemprox_private.h
+++ b/dlls/wbemprox/wbemprox_private.h
@@ -237,6 +237,7 @@ HRESULT create_signature( const WCHAR *, const WCHAR *, enum param_direction,
HRESULT WbemLocator_create(LPVOID *) DECLSPEC_HIDDEN;
HRESULT WbemServices_create(const WCHAR *, LPVOID *) DECLSPEC_HIDDEN;
+HRESULT WbemContext_create(void **) DECLSPEC_HIDDEN;
HRESULT create_class_object(const WCHAR *, IEnumWbemClassObject *, UINT,
struct record *, IWbemClassObject **) DECLSPEC_HIDDEN;
HRESULT EnumWbemClassObject_create(struct query *, LPVOID *) DECLSPEC_HIDDEN;
diff --git a/include/wbemcli.idl b/include/wbemcli.idl
index 4a2c1f785c9..f5c7f1bf44a 100644
--- a/include/wbemcli.idl
+++ b/include/wbemcli.idl
@@ -936,3 +936,12 @@ coclass WbemRefresher
interface IWbemRefresher;
interface IWbemConfigureRefresher;
};
+
+[
+ restricted,
+ uuid(674b6698-ee92-11d0-ad71-00c04fd8fdff)
+]
+coclass WbemContext
+{
+ interface IWbemContext;
+}
More information about the wine-cvs
mailing list