|
|
//+------------------------------------------------------------------- // // File: Context.idl // // Contents: Context interfaces // // History: 04-Dec-97 Gopalk Created // //--------------------------------------------------------------------
cpp_quote("//+-----------------------------------------------------------------") cpp_quote("//") cpp_quote("// Microsoft Windows") cpp_quote("// Copyright (C) Microsoft Corporation, 1992 - 1997.") cpp_quote("//") cpp_quote("//------------------------------------------------------------------")
#ifndef DO_NO_IMPORTS import "wtypes.idl"; import "objidl.idl"; import "unknwn.idl"; #endif
/**************************************************************************** * Context Types * ****************************************************************************/
// Event types enum tagCONTEXTEVENT { CONTEXTEVENT_NONE = 0x00000000,
// Call Events CONTEXTEVENT_CALL = 0x00000001, CONTEXTEVENT_ENTER = 0x00000002, CONTEXTEVENT_LEAVE = 0x00000004, CONTEXTEVENT_RETURN = 0x00000008,
// Buffer Events CONTEXTEVENT_CALLFILLBUFFER = 0x00000010, CONTEXTEVENT_ENTERWITHBUFFER = 0x00000020, CONTEXTEVENT_LEAVEFILLBUFFER = 0x00000040, CONTEXTEVENT_RETURNWITHBUFFER = 0x00000080,
// Begin Events CONTEXTEVENT_BEGINCALL = 0x00000100, CONTEXTEVENT_BEGINENTER = 0x00000200, CONTEXTEVENT_BEGINLEAVE = 0x00000400, CONTEXTEVENT_BEGINRETURN = 0x00000800,
// Finish Events CONTEXTEVENT_FINISHCALL = 0x00001000, CONTEXTEVENT_FINISHENTER = 0x00002000, CONTEXTEVENT_FINISHLEAVE = 0x00004000, CONTEXTEVENT_FINISHRETURN = 0x00008000,
// Buffer Events CONTEXTEVENT_BEGINCALLFILLBUFFER = 0x00010000, CONTEXTEVENT_BEGINENTERWITHBUFFER = 0x00020000, CONTEXTEVENT_FINISHLEAVEFILLBUFFER = 0x00040000, CONTEXTEVENT_FINISHRETURNWITHBUFFER = 0x00080000,
// Exception Events CONTEXTEVENT_LEAVEEXCEPTION = 0x00100000, CONTEXTEVENT_LEAVEEXCEPTIONFILLBUFFER = 0x00200000, CONTEXTEVENT_RETURNEXCEPTION = 0x00400000, CONTEXTEVENT_RETURNEXCEPTIONWITHBUFFER = 0x00800000,
// Other Events CONTEXTEVENT_ADDREFPOLICY = 0x10000000, CONTEXTEVENT_RELEASEPOLICY = 0x20000000 }; typedef DWORD ContextEvent;
enum tagCPFLAGS { CPFLAG_NONE = 0x0,
// Flags to determine whether the property gets copied when the context does CPFLAG_PROPAGATE = 0x1, CPFLAG_EXPOSE = 0x2, CPFLAG_ENVOY = 0x4,
// Flags to determine whether the property receives stub/proxy // create/destroy events. CPFLAG_MONITORSTUB = 0x8, CPFLAG_MONITORPROXY = 0x10,
// Flags to determine whether a property is used in context comparison CPFLAG_DONTCOMPARE = 0x20 }; typedef DWORD CPFLAGS;
#define MSHLFLAGS_NO_IEC 0x8 // don't use IExternalConnextion #define MSHLFLAGS_NO_IMARSHAL 0x10 // don't use IMarshal
/**************************************************************************** * Context Interfaces * ****************************************************************************/
// IEnunContextProperties interface typedef struct tagContextProperty { GUID policyId; CPFLAGS flags; [unique] IUnknown *pUnk; } ContextProperty;
[ object, uuid(000001c1-0000-0000-C000-000000000046), pointer_default(unique) ] interface IEnumContextProps : IUnknown { typedef [unique] IEnumContextProps *LPENUMCONTEXTPROPS;
HRESULT Next([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] ContextProperty *pContextProperties, [out] ULONG *pceltFetched); HRESULT Skip([in] ULONG celt); HRESULT Reset(); HRESULT Clone([out] IEnumContextProps **ppEnumContextProps); HRESULT Count([out] ULONG *pcelt); }
// IContext interface [ local, object, uuid(000001c0-0000-0000-C000-000000000046), pointer_default(unique) ] interface IContext : IUnknown { //typedef [unique] IContext *LPCONTEXT;
HRESULT SetProperty([in] REFGUID rpolicyId, [in] CPFLAGS flags, [in] IUnknown *pUnk); HRESULT RemoveProperty([in] REFGUID rPolicyId); HRESULT GetProperty([in] REFGUID rGuid, [out] CPFLAGS *pFlags, [out] IUnknown **ppUnk); HRESULT EnumContextProps([out] IEnumContextProps **ppEnumContextProps); }
// Interface for context-controlled marshalling [ local, object, uuid(000001D8-0000-0000-C000-000000000046) ] interface IContextMarshaler : IUnknown { typedef [unique] IContextMarshaler *LPCTXMARSHALER;
HRESULT GetMarshalSizeMax([in] REFIID riid, [in, unique] void *pv, [in] DWORD dwDestContext, [in, unique] void *pvDestContext, [in] DWORD mshlflags, [out] DWORD *pSize);
HRESULT MarshalInterface([in, unique] IStream *pStm, [in] REFIID riid, [in, unique] void *pv, [in] DWORD dwDestContext, [in, unique] void *pvDestContext, [in] DWORD mshlflags); }
// IObjContext interface [ local, object, uuid(000001c6-0000-0000-C000-000000000046), pointer_default(unique) ] interface IObjContext : IContext { typedef [ref] HRESULT __stdcall (*PFNCTXCALLBACK)(void* pParam);
HRESULT Freeze(); HRESULT DoCallback([in] PFNCTXCALLBACK pfnCallback, [in] void* pParam, [in] REFIID riid, [in] unsigned int iMethod);
// These methods are here to minimize the code path for marshalling // otherwise I would put them in a separate interface
// The Set methods can only be called before the context is frozen
// Methods to set and get a special marshaller that is invoked for // GetMarshalSizeMax and MarshalInterface if MSHLFLAGS_USE_CTX_MSH is set HRESULT SetContextMarshaler([in] IContextMarshaler *pICM); HRESULT GetContextMarshaler([out] IContextMarshaler **pICM);
// Ugly back-door methods to let us examine or modify the context flags // externally. HRESULT SetContextFlags([in] DWORD dwFlags); // flags |= dwFlags HRESULT ClearContextFlags([in] DWORD dwFlags); // flags &= ~dwFlags HRESULT GetContextFlags([out] DWORD *pdwFlags); }
// IGetContextId [ local, object, uuid(000001dd-0000-0000-C000-000000000046), pointer_default(unique) ] interface IGetContextId : IUnknown { HRESULT GetContextId([out] GUID *pguidCtxtId); };
// IAggregator [ local, object, uuid(000001d8-0000-0000-C000-000000000046), pointer_default(unique) ] interface IAggregator : IUnknown { typedef [unique] IAggregator *IAGGREGATOR;
HRESULT Aggregate([in] IUnknown* pInnerUnk); }
// ICall interface [ local, object, uuid(000001d6-0000-0000-C000-000000000046), pointer_default(unique) ] interface ICall : IUnknown { typedef [unique] ICall *LPCALL;
HRESULT GetCallInfo([out] const void **ppIdentity, [out] IID *piid, [out] DWORD *pdwMethod, [out] HRESULT *phr); HRESULT Nullify([in] HRESULT hr); HRESULT GetServerHR([out] HRESULT *phr); };
// IRpcCall interface [ local, object, uuid(000001c5-0000-0000-C000-000000000046), pointer_default(unique) ] interface IRpcCall : IUnknown { typedef [unique] IRpcCall *LPRPCCALL;
HRESULT GetRpcOleMessage([out] RPCOLEMESSAGE **ppMessage); };
typedef enum _CALLSOURCE { CALLSOURCE_CROSSAPT = 0, CALLSOURCE_CROSSCTX = 1 } CALLSOURCE;
// ICallInfo interface [ local, object, uuid(000001dc-0000-0000-C000-000000000046), pointer_default(unique) ] interface ICallInfo : IUnknown { HRESULT GetCallSource([out] CALLSOURCE* pCallSource); };
// IPolicy interface [ local, object, uuid(000001c2-0000-0000-C000-000000000046), pointer_default(unique) ] interface IPolicy : IUnknown { HRESULT Call([in] ICall *pCall); HRESULT Enter([in] ICall *pCall); HRESULT Leave([in] ICall *pCall); HRESULT Return([in] ICall *pCall);
HRESULT CallGetSize([in] ICall *pCall, [out] ULONG *pcb); HRESULT CallFillBuffer([in] ICall *pCall, [in] void *pvBuf, [out] ULONG *pcb); HRESULT EnterWithBuffer([in] ICall *pCall, [in] void *pvBuf, [in] ULONG cb); HRESULT LeaveGetSize([in] ICall *pCall, [out] ULONG *pcb); HRESULT LeaveFillBuffer([in] ICall *pCall, [in] void *pvBuf, [out] ULONG *pcb); HRESULT ReturnWithBuffer([in] ICall *pCall, [in] void *pvBuf, [in] ULONG cb); ULONG AddRefPolicy(); ULONG ReleasePolicy(); };
// IPolicyAsync interface [ local, object, uuid(000001cd-0000-0000-C000-000000000046), pointer_default(unique) ] interface IPolicyAsync : IUnknown { HRESULT BeginCallGetSize([in] ICall *pCall, [out] ULONG *pcb); HRESULT BeginCall([in] ICall *pCall); HRESULT BeginCallFillBuffer([in] ICall *pCall, [in] void *pvBuf, [out] ULONG *pcb); HRESULT BeginEnter([in] ICall *pCall); HRESULT BeginEnterWithBuffer([in] ICall *pCall, [in] void *pvBuf, [in] ULONG cb); HRESULT BeginLeave([in] ICall *pCall); HRESULT BeginReturn([in] ICall *pCall); HRESULT FinishCall([in] ICall *pCall); HRESULT FinishEnter([in] ICall *pCall); HRESULT FinishLeaveGetSize([in] ICall *pCall, [out] ULONG *pcb); HRESULT FinishLeave([in] ICall *pCall); HRESULT FinishLeaveFillBuffer([in] ICall *pCall, [in] void *pvBuf, [out] ULONG *pcb); HRESULT FinishReturn([in] ICall *pCall); HRESULT FinishReturnWithBuffer([in] ICall *pCall, [in] void *pvBuf, [in] ULONG cb); };
// IPolicySet interface [ local, object, uuid(000001c3-0000-0000-C000-000000000046), pointer_default(unique) ] interface IPolicySet : IUnknown { HRESULT AddPolicy([in] ContextEvent ctxEvent, [in] REFGUID rguid, [in] IPolicy *pPolicy); }
// IComObjIdentity interface [ local, object, uuid(000001d7-0000-0000-C000-000000000046), pointer_default(unique) ] interface IComObjIdentity : IUnknown { BOOL IsServer(); BOOL IsDeactivated(); HRESULT GetIdentity([out] IUnknown** ppUnk); }
// IPolicyMaker interface [ local, object, uuid(000001c4-0000-0000-C000-000000000046), pointer_default(unique) ] interface IPolicyMaker : IUnknown { HRESULT AddClientPoliciesToSet([in] IPolicySet *pPS, [in] IContext *pClientContext, [in] IContext *pServerContext); HRESULT AddEnvoyPoliciesToSet([in] IPolicySet *pPS, [in] IContext *pClientContext, [in] IContext *pServerContext); HRESULT AddServerPoliciesToSet([in] IPolicySet *pPS, [in] IContext *pClientContext, [in] IContext *pServerContext); HRESULT Freeze([in] IObjContext *pObjContext); HRESULT CreateStub([in] IComObjIdentity *pID); HRESULT DestroyStub([in] IComObjIdentity *pID); HRESULT CreateProxy([in] IComObjIdentity *pID); HRESULT DestroyProxy([in] IComObjIdentity *pID); }
// IExceptionNotification interface [ local, object, uuid(000001db-0000-0000-C000-000000000046), pointer_default(unique) ] interface IExceptionNotification : IUnknown { void ServerException([in] void *pExcepPtrs); }
// IAbandonmentNotification interface [ local, object, uuid(000001de-0000-0000-C000-000000000046), pointer_default(unique) ] interface IAbandonmentNotification : IUnknown { void Abandoned (IObjContext* pObjContext); }
// IMarshalEnvoy [ local, object, uuid(000001c8-0000-0000-C000-000000000046), pointer_default(unique) ] interface IMarshalEnvoy : IUnknown { HRESULT GetEnvoyUnmarshalClass([in] DWORD dwDestContext, [out] CLSID* pClsid); HRESULT GetEnvoySizeMax([in] DWORD dwDestContext, [out] DWORD* pcb); HRESULT MarshalEnvoy([in] IStream* pStream, [in] DWORD dwDestContext); HRESULT UnmarshalEnvoy([in] IStream* pStream, [in] REFIID riid, [out, iid_is(riid)] void** ppunk); };
// IWrapperInfo [ local, object, uuid(5052f924-7ab8-11d3-b93f-00c04f990176), pointer_default(unique) ] interface IWrapperInfo : IUnknown { void SetMapping(void *pv); void *GetMapping(); IObjContext *GetServerObjectContext(); IUnknown *GetServerObject(); };
// ICOMDispatchInfo [ local, object, uuid(000001d9-0000-0000-C000-000000000046), pointer_default(unique) ] interface IComDispatchInfo : IUnknown { HRESULT EnableComInits([out] void **ppvCookie); HRESULT DisableComInits([in] void *pvCookie); };
typedef DWORD HActivator;
cpp_quote("STDAPI CoCreateObjectInContext(IUnknown *pUnk, IObjContext *pObjectCtx, REFIID riid, void **ppv);") cpp_quote("STDAPI CoGetApartmentID(APTTYPE dAptType, HActivator* pAptID);") cpp_quote("STDAPI CoDeactivateObject(IUnknown *pUnk, IUnknown **ppCookie);") cpp_quote("STDAPI CoReactivateObject(IUnknown *pUnk, IUnknown *pCookie);") cpp_quote("#define MSHLFLAGS_NO_IEC 0x8 // don't use IExternalConnextion") cpp_quote("#define MSHLFLAGS_NO_IMARSHAL 0x10 // don't use IMarshal")
cpp_quote("#define CONTEXTFLAGS_FROZEN 0x01 // Frozen context") cpp_quote("#define CONTEXTFLAGS_ALLOWUNAUTH 0x02 // Allow unauthenticated calls") cpp_quote("#define CONTEXTFLAGS_ENVOYCONTEXT 0x04 // Envoy context") cpp_quote("#define CONTEXTFLAGS_DEFAULTCONTEXT 0x08 // Default context") cpp_quote("#define CONTEXTFLAGS_STATICCONTEXT 0x10 // Static context") cpp_quote("#define CONTEXTFLAGS_INPROPTABLE 0x20 // Is in property table") cpp_quote("#define CONTEXTFLAGS_INDESTRUCTOR 0x40 // Is in destructor") cpp_quote("#define CONTEXTFLAGS_URTPROPPRESENT 0x80 // URT property added")
|