wbemdisp: Pass context value to ConnectServer().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-03-02 09:25:06 +03:00 committed by Alexandre Julliard
parent 65ed5d9cc6
commit 93858d787d
1 changed files with 32 additions and 11 deletions

View File

@ -35,6 +35,22 @@
WINE_DEFAULT_DEBUG_CHANNEL(wbemdisp);
struct namedvalueset
{
ISWbemNamedValueSet ISWbemNamedValueSet_iface;
LONG refs;
IWbemContext *context;
};
static struct namedvalueset *unsafe_valueset_impl_from_IDispatch(IDispatch *iface);
static IWbemContext * unsafe_get_context_from_namedvalueset( IDispatch *disp )
{
struct namedvalueset *valueset = unsafe_valueset_impl_from_IDispatch( disp );
return valueset ? valueset->context : NULL;
}
static WCHAR *heap_strdupW( const WCHAR *src )
{
WCHAR *dst;
@ -2751,6 +2767,7 @@ static HRESULT WINAPI locator_ConnectServer(
{
struct locator *locator = impl_from_ISWbemLocator( iface );
IWbemServices *services;
IWbemContext *context;
BSTR resource;
HRESULT hr;
@ -2758,8 +2775,6 @@ static HRESULT WINAPI locator_ConnectServer(
debugstr_w(strNamespace), debugstr_w(strUser), strPassword, debugstr_w(strLocale),
debugstr_w(strAuthority), iSecurityFlags, objWbemNamedValueSet, objWbemServices );
if (objWbemNamedValueSet) FIXME( "context not supported\n" );
if (!locator->locator)
{
hr = CoCreateInstance( &CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemLocator,
@ -2767,9 +2782,11 @@ static HRESULT WINAPI locator_ConnectServer(
if (hr != S_OK) return hr;
}
context = unsafe_get_context_from_namedvalueset( objWbemNamedValueSet );
if (!(resource = build_resource_string( strServer, strNamespace ))) return E_OUTOFMEMORY;
hr = IWbemLocator_ConnectServer( locator->locator, resource, strUser, strPassword, strLocale,
iSecurityFlags, strAuthority, NULL, &services );
iSecurityFlags, strAuthority, context, &services );
SysFreeString( resource );
if (hr != S_OK) return hr;
@ -3047,14 +3064,6 @@ static HRESULT ISWbemSecurity_create( ISWbemSecurity **obj )
return S_OK;
}
struct namedvalueset
{
ISWbemNamedValueSet ISWbemNamedValueSet_iface;
LONG refs;
IWbemContext *context;
};
struct namedvalue
{
ISWbemNamedValue ISWbemNamedValue_iface;
@ -3478,6 +3487,18 @@ static const ISWbemNamedValueSetVtbl namedvalueset_vtbl =
namedvalueset_DeleteAll,
};
static struct namedvalueset *unsafe_valueset_impl_from_IDispatch(IDispatch *iface)
{
if (!iface)
return NULL;
if (iface->lpVtbl != (IDispatchVtbl *)&namedvalueset_vtbl)
{
FIXME( "External implementations are not supported.\n" );
return NULL;
}
return CONTAINING_RECORD(iface, struct namedvalueset, ISWbemNamedValueSet_iface);
}
HRESULT SWbemNamedValueSet_create( void **obj )
{
struct namedvalueset *set;