Udostępnij za pośrednictwem


IObjectSafetyImpl Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at IObjectSafetyImpl Class.

This class provides a default implementation of the IObjectSafety interface to allow a client to retrieve and set an object's safety levels.

Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

Syntax

template <class T,DWORD dwSupportedSafety>  
class IObjectSafetyImpl

Parameters

T
Your class, derived from IObjectSafetyImpl.

dwSupportedSafety
Specifies the supported safety options for the control. Can be one of the following values:

  • INTERFACESAFE_FOR_UNTRUSTED_CALLER The interface identified by the SetInterfaceSafetyOptions parameter riid should be made safe for scripting.

  • INTERFACESAFE_FOR_UNTRUSTED_DATA The interface identified by the SetInterfaceSafetyOptions parameter riid should be made safe for untrusted data during initialization.

Members

Public Methods

Name Description
IObjectSafetyImpl::GetInterfaceSafetyOptions Retrieves the safety options supported by the object, as well as the safety options currently set for the object.
IObjectSafetyImpl::SetInterfaceSafetyOptions Makes the object safe for initialization or scripting.

Public Data Members

Name Description
IObjectSafetyImpl::m_dwCurrentSafety Stores the object's current safety level.

Remarks

Class IObjectSafetyImpl provides a default implementation of IObjectSafety. The IObjectSafety interface allows a client to retrieve and set an object's safety levels. For example, a web browser can call IObjectSafety::SetInterfaceSafetyOptions to make a control safe for initialization or safe for scripting.

Note that using the IMPLEMENTED_CATEGORY macro with the CATID_SafeForScripting and CATID_SafeForInitializing component categories provides an alternative way of specifying that a component is safe.

Related Articles ATL Tutorial, Creating an ATL Project

Inheritance Hierarchy

IObjectSafety

IObjectSafetyImpl

Requirements

Header: atlctl.h

IObjectSafetyImpl::GetInterfaceSafetyOptions

Retrieves the safety options supported by the object, as well as the safety options currently set for the object.

HRESULT GetInterfaceSafetyOptions(  
    REFIID riid,
    DWORD* pdwSupportedOptions,
    DWORD* pdwEnabledOptions);

Remarks

The implementation returns the appropriate values for any interface supported by the object's implementation of IUnknown::QueryInterface.

Important

Any object that supports IObjectSafety is responsible for its own security, and that of any object it delegates. The programmer must take into account issues arising from running code in the user's context, cross-site scripting and perform suitable zone checking.

See IObjectSafety::GetInterfaceSafetyOptions in the Windows SDK.

IObjectSafetyImpl::m_dwCurrentSafety

Stores the object's current safety level.

DWORD m_dwCurrentSafety;

IObjectSafetyImpl::SetInterfaceSafetyOptions

Makes the object safe for initialization or scripting by setting the m_dwCurrentSafety member to the appropriate value.

HRESULT SetInterfaceSafetyOptions(  
    REFIID riid,
    DWORD dwOptionsSetMask,
    DWORD dwEnabledOptions);

Remarks

The implementation returns E_NOINTERFACE for any interface not supported by the object's implementation of IUnknown::QueryInterface.

Important

Any object that supports IObjectSafety is responsible for its own security, and that of any object it delegates. The programmer must take into account issues arising from running code in the user's context, cross-site scripting and perform suitable zone checking.

See IObjectSafety::SetInterfaceSafetyOptions in the Windows SDK.

See Also

IObjectSafety Interface
Class Overview