From: Olivia Ryan <olivia.r.dev@gmail.com> --- dlls/msxml6/load_settings.c | 193 +++++++++++++++++++++++++++++++++++- 1 file changed, 191 insertions(+), 2 deletions(-) diff --git a/dlls/msxml6/load_settings.c b/dlls/msxml6/load_settings.c index 0b4b579bc3c..fe07abd5ac1 100644 --- a/dlls/msxml6/load_settings.c +++ b/dlls/msxml6/load_settings.c @@ -20,6 +20,179 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml6); +struct load_settings +{ + IXmlLoadSettings IXmlLoadSettings_iface; + LONG ref; + UINT32 max_element_depth; + boolean prohibit_dtd; + boolean resolve_externals; + boolean validate_on_parse; + boolean element_content_white_space; +}; + +static inline struct load_settings *impl_from_IXmlLoadSettings( IXmlLoadSettings *iface ) +{ + return CONTAINING_RECORD( iface, struct load_settings, IXmlLoadSettings_iface ); +} + +static HRESULT WINAPI load_settings_QueryInterface( IXmlLoadSettings *iface, REFIID iid, void **out ) +{ + struct load_settings *impl = impl_from_IXmlLoadSettings( iface ); + + TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID( iid, &IID_IUnknown ) || + IsEqualGUID( iid, &IID_IInspectable ) || + IsEqualGUID( iid, &IID_IAgileObject ) || + IsEqualGUID( iid, &IID_IXmlLoadSettings )) + { + IInspectable_AddRef( *out = &impl->IXmlLoadSettings_iface ); + return S_OK; + } + + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI load_settings_AddRef( IXmlLoadSettings *iface ) +{ + struct load_settings *impl = impl_from_IXmlLoadSettings( iface ); + ULONG ref = InterlockedIncrement( &impl->ref ); + TRACE( "iface %p, ref %lu.\n", iface, ref ); + return ref; +} + +static ULONG WINAPI load_settings_Release( IXmlLoadSettings *iface ) +{ + struct load_settings *impl = impl_from_IXmlLoadSettings( iface ); + ULONG ref = InterlockedDecrement( &impl->ref ); + TRACE( "iface %p, ref %lu.\n", iface, ref ); + if (!ref) free( impl ); + return ref; +} + +static HRESULT WINAPI load_settings_GetIids( IXmlLoadSettings *iface, ULONG *iid_count, IID **iids ) +{ + FIXME( "iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids ); + return E_NOTIMPL; +} + +static HRESULT WINAPI load_settings_GetRuntimeClassName( IXmlLoadSettings *iface, HSTRING *class_name ) +{ + FIXME( "iface %p, class_name %p stub!\n", iface, class_name ); + return E_NOTIMPL; +} + +static HRESULT WINAPI load_settings_GetTrustLevel( IXmlLoadSettings *iface, TrustLevel *trust_level ) +{ + FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level ); + return E_NOTIMPL; +} + +static HRESULT WINAPI load_settings_get_MaxElementDepth( IXmlLoadSettings *iface, UINT32 *value ) +{ + struct load_settings *impl = impl_from_IXmlLoadSettings( iface ); + TRACE( "iface %p, value %p.\n", iface, value ); + *value = impl->max_element_depth; + return S_OK; +} + +static HRESULT WINAPI load_settings_put_MaxElementDepth( IXmlLoadSettings *iface, UINT32 value ) +{ + struct load_settings *impl = impl_from_IXmlLoadSettings( iface ); + TRACE( "iface %p, value %u.\n", iface, value ); + impl->max_element_depth = value; + return S_OK; +} + +static HRESULT WINAPI load_settings_get_ProhibitDtd( IXmlLoadSettings *iface, boolean *value ) +{ + struct load_settings *impl = impl_from_IXmlLoadSettings( iface ); + TRACE( "iface %p, value %p.\n", iface, value ); + *value = impl->prohibit_dtd; + return S_OK; +} + +static HRESULT WINAPI load_settings_put_ProhibitDtd( IXmlLoadSettings *iface, boolean value ) +{ + struct load_settings *impl = impl_from_IXmlLoadSettings( iface ); + TRACE( "iface %p, value %d.\n", iface, value ); + impl->prohibit_dtd = value; + return S_OK; +} + +static HRESULT WINAPI load_settings_get_ResolveExternals( IXmlLoadSettings *iface, boolean *value ) +{ + struct load_settings *impl = impl_from_IXmlLoadSettings( iface ); + TRACE( "iface %p, value %p.\n", iface, value ); + *value = impl->resolve_externals; + return S_OK; +} + +static HRESULT WINAPI load_settings_put_ResolveExternals( IXmlLoadSettings *iface, boolean value ) +{ + struct load_settings *impl = impl_from_IXmlLoadSettings( iface ); + TRACE( "iface %p, value %d.\n", iface, value ); + impl->resolve_externals = value; + return S_OK; +} + +static HRESULT WINAPI load_settings_get_ValidateOnParse( IXmlLoadSettings *iface, boolean *value ) +{ + struct load_settings *impl = impl_from_IXmlLoadSettings( iface ); + TRACE( "iface %p, value %p.\n", iface, value ); + *value = impl->validate_on_parse; + return S_OK; +} + +static HRESULT WINAPI load_settings_put_ValidateOnParse( IXmlLoadSettings *iface, boolean value ) +{ + struct load_settings *impl = impl_from_IXmlLoadSettings( iface ); + TRACE( "iface %p, value %d.\n", iface, value ); + impl->validate_on_parse = value; + return S_OK; +} + +static HRESULT WINAPI load_settings_get_ElementContentWhiteSpace( IXmlLoadSettings *iface, boolean *value ) +{ + struct load_settings *impl = impl_from_IXmlLoadSettings( iface ); + TRACE( "iface %p, value %p.\n", iface, value ); + *value = impl->element_content_white_space; + return S_OK; +} + +static HRESULT WINAPI load_settings_put_ElementContentWhiteSpace( IXmlLoadSettings *iface, boolean value ) +{ + struct load_settings *impl = impl_from_IXmlLoadSettings( iface ); + TRACE( "iface %p, value %d.\n", iface, value ); + impl->element_content_white_space = value; + return S_OK; +} + +static const struct IXmlLoadSettingsVtbl load_settings_vtbl = +{ + load_settings_QueryInterface, + load_settings_AddRef, + load_settings_Release, + /* IInspectable methods */ + load_settings_GetIids, + load_settings_GetRuntimeClassName, + load_settings_GetTrustLevel, + /* IXmlLoadSettings methods */ + load_settings_get_MaxElementDepth, + load_settings_put_MaxElementDepth, + load_settings_get_ProhibitDtd, + load_settings_put_ProhibitDtd, + load_settings_get_ResolveExternals, + load_settings_put_ResolveExternals, + load_settings_get_ValidateOnParse, + load_settings_put_ValidateOnParse, + load_settings_get_ElementContentWhiteSpace, + load_settings_put_ElementContentWhiteSpace, +}; + struct factory { IActivationFactory IActivationFactory_iface; @@ -87,8 +260,24 @@ static HRESULT WINAPI factory_GetTrustLevel( IActivationFactory *iface, TrustLev static HRESULT WINAPI factory_ActivateInstance( IActivationFactory *iface, IInspectable **instance ) { - FIXME( "iface %p, instance %p stub!\n", iface, instance ); - return E_NOTIMPL; + struct load_settings *impl; + + TRACE( "iface %p, instance %p.\n", iface, instance ); + + *instance = NULL; + if (!(impl = calloc( 1, sizeof(*impl) ))) return E_OUTOFMEMORY; + + impl->IXmlLoadSettings_iface.lpVtbl = &load_settings_vtbl; + impl->ref = 1; + + impl->max_element_depth = 256; + impl->prohibit_dtd = TRUE; + impl->resolve_externals = FALSE; + impl->validate_on_parse = FALSE; + impl->element_content_white_space = TRUE; + + *instance = (IInspectable *)&impl->IXmlLoadSettings_iface; + return S_OK; } static const struct IActivationFactoryVtbl factory_vtbl = -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10622