cpp_quote("#include <winapifamily.h>")

//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (c) Microsoft Corporation. All rights reserved.
//
//  File: objidlbase.idl
//
//--------------------------------------------------------------------------

cpp_quote("//+-------------------------------------------------------------------------")
cpp_quote("//+-------------------------------------------------------------------------")
cpp_quote("//")
cpp_quote("//  Microsoft Windows")
cpp_quote("//  Copyright (c) Microsoft Corporation. All rights reserved.")
cpp_quote("//")
cpp_quote("//--------------------------------------------------------------------------")


cpp_quote("#if(NTDDI_VERSION >= NTDDI_VISTA && !defined(_WIN32_WINNT))")
cpp_quote("#define _WIN32_WINNT 0x0600")
cpp_quote("#endif")

cpp_quote("#if(NTDDI_VERSION >= NTDDI_WS03 && !defined(_WIN32_WINNT))")
cpp_quote("#define _WIN32_WINNT 0x0502")
cpp_quote("#endif")

cpp_quote("#if(NTDDI_VERSION >= NTDDI_WINXP && !defined(_WIN32_WINNT))")
cpp_quote("#define _WIN32_WINNT 0x0501")
cpp_quote("#endif")

cpp_quote("#if(NTDDI_VERSION >= NTDDI_WIN2K && !defined(_WIN32_WINNT))")
cpp_quote("#define _WIN32_WINNT 0x0500")
cpp_quote("#endif")

#if OLE_OBJIDL_PROXY_STUB_BUILD
#define DISABLE_CONSISTENCY_CHK ,disable_consistency_check
#else
#define DISABLE_CONSISTENCY_CHK 
#endif

#if (__midl >= 501)
midl_pragma warning( disable: 2007 )   // file already imported
midl_pragma warning( disable: 2209 )   // ignored redundantly specified attributes
midl_pragma warning( disable: 2298 )   // version ignored for object interfaces
#endif

cpp_quote("#if ( _MSC_VER >= 800 )")
cpp_quote("#if _MSC_VER >= 1200")
cpp_quote("#pragma warning(push)")
cpp_quote("#ifndef _MSC_EXTENSIONS")
cpp_quote("#pragma warning(disable:4309) /* truncation of constant value */")
cpp_quote("#endif")
cpp_quote("#pragma warning(disable:4820) /* padding added after data member */")
cpp_quote("#endif")
cpp_quote("#pragma warning(disable:4201)")
cpp_quote("#endif")
cpp_quote("#if ( _MSC_VER >= 1020 )")
cpp_quote("#pragma once")
cpp_quote("#endif")

#ifndef DO_NO_IMPORTS
import "unknwnbase.idl";
import "wtypesbase.idl";
#endif

cpp_quote("#include <limits.h>")

cpp_quote("#ifndef _OBJIDLBASE_")

#pragma region Application Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

interface IStream;
interface IEnumString;

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Desktop Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

interface IAsyncManager;
interface ICallFactory;
interface ISynchronize;

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Application Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

midl_pragma warning (disable: 2480)
typedef struct _COSERVERINFO
{
    DWORD             dwReserved1;
    LPWSTR            pwszName;
    COAUTHINFO *      pAuthInfo;
    DWORD             dwReserved2;
} COSERVERINFO;
midl_pragma warning (default: 2480)

/****************************************************************************
 *  Component Object Interfaces
 ****************************************************************************/

[
    local,
    object,
    uuid(00000003-0000-0000-C000-000000000046)
]

interface IMarshal : IUnknown
{

    typedef [unique] IMarshal *LPMARSHAL;

    HRESULT GetUnmarshalClass
    (
        [in, annotation("_In_")] REFIID riid,
        [in, unique, annotation("_In_opt_")] void *pv,
        [in, annotation("_In_")] DWORD dwDestContext,
        [in, unique, annotation("_Reserved_")] void *pvDestContext,
        [in, annotation("_In_")] DWORD mshlflags,
        [out, annotation("_Out_")] CLSID *pCid
    );

    HRESULT GetMarshalSizeMax
    (
        [in, annotation("_In_")] REFIID riid,
        [in, unique, annotation("_In_opt_")] void *pv,
        [in, annotation("_In_")] DWORD dwDestContext,
        [in, unique, annotation("_Reserved_")] void *pvDestContext,
        [in, annotation("_In_")] DWORD mshlflags,
        [out, annotation("_Out_")] DWORD *pSize
    );

    HRESULT MarshalInterface
    (
        [in, unique, annotation("_In_")] IStream *pStm,
        [in, annotation("_In_")] REFIID riid,
        [in, unique, annotation("_In_opt_")] void *pv,
        [in, annotation("_In_")] DWORD dwDestContext,
        [in, unique, annotation("_Reserved_")] void *pvDestContext,
        [in, annotation("_In_")] DWORD mshlflags
    );

    HRESULT UnmarshalInterface
    (
        [in, unique, annotation("_In_")] IStream *pStm,
        [in, annotation("_In_")] REFIID riid,
        [out, annotation("_Outptr_")] void **ppv
    );

    HRESULT ReleaseMarshalData
    (
        [in, unique, annotation("_In_")] IStream *pStm
    );

    HRESULT DisconnectObject
    (
        [in, annotation("_In_")] DWORD dwReserved
    );
}

// INoMarshal - marks an object that does not support being marshaled 
// or stored in the global interface table
[
    local,
    object,
    uuid(ecc8691b-c1db-4dc0-855e-65f6c551af49)
]
interface INoMarshal : IUnknown
{
}

// IAgileObject - marks an interface as agile across apartments, e.g. if it 
// aggregates the Free Threaded Marshaler.
[
    local,
    object,
    uuid(94ea2b94-e9cc-49e0-c0ff-ee64ca8f5b90)
]
interface IAgileObject : IUnknown
{
}

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Desktop Family or OneCore Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

[
    local,
    object,
    uuid(00000017-0000-0000-C000-000000000046)
]

interface IActivationFilter : IUnknown
{

// possible values for dwActivationType
typedef enum tagACTIVATIONTYPE { 
    ACTIVATIONTYPE_UNCATEGORIZED    = 0x0,
    ACTIVATIONTYPE_FROM_MONIKER     = 0x1,
    ACTIVATIONTYPE_FROM_DATA        = 0x2,
    ACTIVATIONTYPE_FROM_STORAGE     = 0x4,
    ACTIVATIONTYPE_FROM_STREAM      = 0x8,
    ACTIVATIONTYPE_FROM_FILE        = 0x10
} ACTIVATIONTYPE;

    HRESULT HandleActivation
    (
       [in]     DWORD     dwActivationType,
       [in]     REFCLSID  rclsid,
       [out]    CLSID    *pReplacementClsId
    );
}

[
    local,
    object,
    uuid(000001cf-0000-0000-C000-000000000046)
]

interface IMarshal2 : IMarshal
{

    typedef [unique] IMarshal2 *LPMARSHAL2;
}

[
    local,
    object,
    uuid(00000002-0000-0000-C000-000000000046)
]

interface IMalloc : IUnknown
{

    typedef [unique] IMalloc *LPMALLOC;

    void *Alloc([in, annotation("_In_")] SIZE_T cb);

    void *Realloc ([in, annotation("_In_opt_")] void *pv,
                   [in, annotation("_In_")] SIZE_T cb);

    void Free([in, annotation("_In_opt_")] void *pv);

    //[annotation("_Success_(return != SIZE_MAX)")] #pragma prefast(disable:28285 28309, "MSENG:186222")
    SIZE_T GetSize([in, annotation("_In_opt_ _Post_writable_byte_size_(return)")] void *pv);

    int DidAlloc([in, annotation("_In_opt_")] void *pv);

    void HeapMinimize(void);
}

[
    local,
    object,
    uuid(00000018-0000-0000-C000-000000000046)
]

interface IStdMarshalInfo : IUnknown
{

    typedef [unique] IStdMarshalInfo * LPSTDMARSHALINFO;

    HRESULT GetClassForHandler
    (
        [in, annotation("_In_")] DWORD dwDestContext,
        [in, unique, annotation("_Reserved_")] void *pvDestContext,
        [out, annotation("_Out_")] CLSID *pClsid
    );
}

[
    object,
    local,
    uuid(00000019-0000-0000-C000-000000000046)
]

interface IExternalConnection : IUnknown
{

    typedef [unique] IExternalConnection* LPEXTERNALCONNECTION;


    // bit flags for IExternalConnection
    typedef enum tagEXTCONN
    {
        EXTCONN_STRONG      = 0x0001,   // strong connection
        EXTCONN_WEAK        = 0x0002,   // weak connection (table, container)
        EXTCONN_CALLABLE    = 0x0004,   // table .vs. callable
    } EXTCONN;

    // *** IExternalConnection methods ***
    DWORD AddConnection
    (
        [in, annotation("_In_")] DWORD extconn,
        [in, annotation("_In_")] DWORD reserved
    );

    DWORD ReleaseConnection
    (
        [in, annotation("_In_")] DWORD extconn,
        [in, annotation("_In_")] DWORD reserved,
        [in, annotation("_In_")] BOOL  fLastReleaseCloses
    );
}


typedef [unique] IMultiQI* LPMULTIQI;

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Application Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

typedef struct tagMULTI_QI
{
    const IID  *pIID; // pass this one in
    IUnknown   *pItf; // get these out (you must set to NULL before calling)
    HRESULT     hr;
} MULTI_QI;

[
    object,
    local,
    uuid(00000020-0000-0000-C000-000000000046),
#if (__midl >= 500)
    async_uuid(000e0020-0000-0000-C000-000000000046)
#endif

]

interface IMultiQI : IUnknown
{

    HRESULT QueryMultipleInterfaces
    (
        [in, annotation("_In_")]     ULONG      cMQIs,
        [in, out, annotation("_Inout_updates_(cMQIs)")] MULTI_QI  *pMQIs
    );
}

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Desktop Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

[
 object,
 local,
 uuid(00000021-0000-0000-C000-000000000046)
]
interface IInternalUnknown : IUnknown
{
    HRESULT QueryInternalInterface(
           [in, annotation("_In_")]  REFIID riid,
           [out, annotation("_Outptr_")] void **ppv);
}

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Application Family or OneCore Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

[
    object,
    uuid(00000100-0000-0000-C000-000000000046),
    pointer_default(unique)
]

interface IEnumUnknown : IUnknown
{

    typedef [unique] IEnumUnknown *LPENUMUNKNOWN;

    [local]
    HRESULT Next(
        [in, annotation("_In_")] ULONG celt,
        [out, annotation("_Out_writes_to_(celt,*pceltFetched)")] IUnknown **rgelt,
        [out, annotation("_Out_opt_")] ULONG *pceltFetched);

    [call_as(Next)]
    HRESULT RemoteNext(
        [in] ULONG celt,
        [out, size_is(celt), length_is(*pceltFetched)] IUnknown **rgelt,
        [out] ULONG *pceltFetched);

    HRESULT Skip(
        [in] ULONG celt);

    HRESULT Reset();

    HRESULT Clone(
        [out] IEnumUnknown **ppenum);
}

[
    object,
    uuid(00000101-0000-0000-C000-000000000046),
    pointer_default(unique)
]

interface IEnumString : IUnknown
{

    typedef [unique] IEnumString *LPENUMSTRING;

    [local]
    HRESULT Next(
        [in] ULONG celt,
        [annotation("_Out_writes_to_(celt,*pceltFetched)")]
        LPOLESTR *rgelt,
        [annotation("_Out_opt_")] ULONG *pceltFetched);

    [call_as(Next)]
    HRESULT RemoteNext(
        [in] ULONG celt,
        [out, size_is(celt), length_is(*pceltFetched)]
        LPOLESTR *rgelt,
        [out] ULONG *pceltFetched);


    HRESULT Skip(
        [in] ULONG celt);

    HRESULT Reset();

    HRESULT Clone(
        [out] IEnumString **ppenum);
}

[
    object,
    uuid(0c733a30-2a1c-11ce-ade5-00aa0044773d),
    pointer_default(unique)
]
interface ISequentialStream : IUnknown
{
    [local]
    HRESULT Read(
        [annotation("_Out_writes_bytes_to_(cb, *pcbRead)")]
        void *pv,
        [in, annotation("_In_")] ULONG cb,
        [annotation("_Out_opt_")] ULONG *pcbRead);

    [call_as(Read)]
    HRESULT RemoteRead(
        [out, size_is(cb), length_is(*pcbRead)]
        byte *pv,
        [in] ULONG cb,
        [out] ULONG *pcbRead);

    [local]
    HRESULT Write(
        [annotation("_In_reads_bytes_(cb)")] void const *pv,
        [in, annotation("_In_")] ULONG cb,
        [annotation("_Out_opt_")] ULONG *pcbWritten);

    [call_as(Write)]
    HRESULT RemoteWrite(
        [in, size_is(cb)] byte const *pv,
        [in] ULONG cb,
        [out] ULONG *pcbWritten);
}



[
    object,
    uuid(0000000c-0000-0000-C000-000000000046),
    pointer_default(unique)
]

interface IStream : ISequentialStream
{

    typedef [unique] IStream *LPSTREAM;

    /* Storage stat buffer */

    typedef struct tagSTATSTG
    {
        LPOLESTR pwcsName;
        DWORD type;
        ULARGE_INTEGER cbSize;
        FILETIME mtime;
        FILETIME ctime;
        FILETIME atime;
        DWORD grfMode;
        DWORD grfLocksSupported;
        CLSID clsid;
        DWORD grfStateBits;
    DWORD reserved;
    } STATSTG;


    /* Storage element types */
    typedef enum tagSTGTY
    {
        STGTY_STORAGE   = 1,
        STGTY_STREAM    = 2,
        STGTY_LOCKBYTES = 3,
        STGTY_PROPERTY  = 4
    } STGTY;

    typedef enum tagSTREAM_SEEK
    {
        STREAM_SEEK_SET = 0,
        STREAM_SEEK_CUR = 1,
        STREAM_SEEK_END = 2
    } STREAM_SEEK;

    typedef enum tagLOCKTYPE
    {
        LOCK_WRITE      = 1,
        LOCK_EXCLUSIVE  = 2,
        LOCK_ONLYONCE   = 4
    } LOCKTYPE;

    [local]
    HRESULT Seek(
        [in] LARGE_INTEGER dlibMove,
        [in] DWORD dwOrigin,
        [annotation("_Out_opt_")] ULARGE_INTEGER *plibNewPosition);

    [call_as(Seek)]
    HRESULT RemoteSeek(
        [in] LARGE_INTEGER dlibMove,
        [in] DWORD dwOrigin,
        [out] ULARGE_INTEGER *plibNewPosition);

    HRESULT SetSize(
        [in] ULARGE_INTEGER libNewSize);

    [local]
    HRESULT CopyTo(
        [in, unique, annotation("_In_")] IStream *pstm,
        [in] ULARGE_INTEGER cb,
        [annotation("_Out_opt_")] ULARGE_INTEGER *pcbRead,
        [annotation("_Out_opt_")] ULARGE_INTEGER *pcbWritten);

    [call_as(CopyTo)]
    HRESULT RemoteCopyTo(
        [in, unique] IStream *pstm,
        [in] ULARGE_INTEGER cb,
        [out] ULARGE_INTEGER *pcbRead,
        [out] ULARGE_INTEGER *pcbWritten);

    HRESULT Commit(
        [in] DWORD grfCommitFlags);

    HRESULT Revert();

    HRESULT LockRegion(
        [in] ULARGE_INTEGER libOffset,
        [in] ULARGE_INTEGER cb,
        [in] DWORD dwLockType);

    HRESULT UnlockRegion(
        [in] ULARGE_INTEGER libOffset,
        [in] ULARGE_INTEGER cb,
        [in] DWORD dwLockType);

    HRESULT Stat(
        [out] STATSTG *pstatstg,
        [in] DWORD grfStatFlag);

    HRESULT Clone(
        [out] IStream **ppstm);

}


/****************************************************************************
 *  Object Remoting Interfaces
 ****************************************************************************/

[
    local,
    object,
    uuid(D5F56B60-593B-101A-B569-08002B2DBF7A)
]
interface IRpcChannelBuffer : IUnknown
{

    typedef ULONG RPCOLEDATAREP;

    typedef struct tagRPCOLEMESSAGE
    {
        void             *reserved1;
        RPCOLEDATAREP     dataRepresentation;
        void             *Buffer;
        ULONG             cbBuffer;
        ULONG             iMethod;
        void             *reserved2[5];
        ULONG             rpcFlags;
    } RPCOLEMESSAGE;

    typedef RPCOLEMESSAGE *PRPCOLEMESSAGE;

    HRESULT GetBuffer
    (
        [in,out, annotation("_Inout_")] RPCOLEMESSAGE *pMessage,
        [in, annotation("_In_")] REFIID riid
    );

    HRESULT SendReceive
    (
        [in,out, annotation("_Inout_")] RPCOLEMESSAGE *pMessage,
        [out, annotation("_Out_opt_")] ULONG *pStatus
    );

    HRESULT FreeBuffer
    (
        [in,out, annotation("_Inout_")] RPCOLEMESSAGE *pMessage
    );

    HRESULT GetDestCtx
    (
        [out, annotation("_Out_")] DWORD *pdwDestContext,
        [out, annotation("_Outptr_result_maybenull_")] void **ppvDestContext
    );

    HRESULT IsConnected
    (
        void
    );

}

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Desktop Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

[
    local,
    object,
    uuid(594f31d0-7f19-11d0-b194-00a0c90dc8bf)
]
interface IRpcChannelBuffer2 : IRpcChannelBuffer
{

    HRESULT GetProtocolVersion
    (
        [out, annotation("_Out_")] DWORD *pdwVersion
    );
}

[
    local,
    object,
    uuid(a5029fb6-3c34-11d1-9c99-00c04fb998aa),
    pointer_default(unique)
]
interface IAsyncRpcChannelBuffer : IRpcChannelBuffer2
{

    HRESULT Send(
        [in,out, annotation("_Inout_")] RPCOLEMESSAGE *pMsg,
        [in, annotation("_In_")]     ISynchronize *pSync,
        [out, annotation("_Out_")]    ULONG *pulStatus
        );

    HRESULT Receive(
        [in,out, annotation("_Inout_")] RPCOLEMESSAGE *pMsg,
        [out, annotation("_Out_")]     ULONG *pulStatus);

    HRESULT GetDestCtxEx
    (
        [in, annotation("_In_")] RPCOLEMESSAGE *pMsg,
        [out, annotation("_Out_")] DWORD *pdwDestContext,
        [out, annotation("_Outptr_opt_result_maybenull_")] void **ppvDestContext
    );

};

[
    local,
    object,
    uuid(25B15600-0115-11d0-BF0D-00AA00B8DFD2)
]
interface IRpcChannelBuffer3 : IRpcChannelBuffer2
{

    HRESULT Send
    (
        [in,out, annotation("_Inout_")] RPCOLEMESSAGE *pMsg,
        [out, annotation("_Out_")]    ULONG *pulStatus
    );

    HRESULT Receive
    (
        [in,out, annotation("_Inout_")] RPCOLEMESSAGE *pMsg,
        [in, annotation("_In_")]     ULONG ulSize,
        [out, annotation("_Out_")]    ULONG *pulStatus
    );

    HRESULT Cancel
    (
        [in,out, annotation("_Inout_")] RPCOLEMESSAGE *pMsg
    );

    HRESULT GetCallContext
    (
        [in, annotation("_In_")]  RPCOLEMESSAGE *pMsg,
        [in, annotation("_In_")]  REFIID riid,
        [out, annotation("_Outptr_")] void **pInterface
    );

    HRESULT GetDestCtxEx
    (
        [in, annotation("_In_")] RPCOLEMESSAGE *pMsg,
        [out, annotation("_Out_")] DWORD *pdwDestContext,
        [out, annotation("_Outptr_opt_result_maybenull_")] void **ppvDestContext
    );

    HRESULT GetState
    (
        [in, annotation("_In_")]  RPCOLEMESSAGE   *pMsg,
        [out, annotation("_Out_")] DWORD           *pState
    );

    HRESULT RegisterAsync
    (
        [in,out, annotation("_Inout_")] RPCOLEMESSAGE *pMsg,
        [in, annotation("_In_")] IAsyncManager *pAsyncMgr
    );

}

[
    local,
    object,
    uuid(58a08519-24c8-4935-b482-3fd823333a4f)
]
interface IRpcSyntaxNegotiate : IUnknown
{
    HRESULT NegotiateSyntax ( [in,out, annotation("_Inout_")] RPCOLEMESSAGE * pMsg );
}


[
    local,
    object,
    uuid(D5F56A34-593B-101A-B569-08002B2DBF7A)
]
interface IRpcProxyBuffer : IUnknown
{

    HRESULT Connect
    (
        [in, unique, annotation("_In_")] IRpcChannelBuffer *pRpcChannelBuffer
    );

    void Disconnect
    (
        void
    );

}

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Application Family or OneCore Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

[
    local,
    object,
    uuid(D5F56AFC-593B-101A-B569-08002B2DBF7A)
]
interface IRpcStubBuffer : IUnknown
{

    HRESULT Connect
    (
        [in, annotation("_In_")] IUnknown *pUnkServer
    );

    void Disconnect();

    HRESULT Invoke
    (
        [in,out, annotation("_Inout_")] RPCOLEMESSAGE *_prpcmsg,
        [in, annotation("_In_")] IRpcChannelBuffer *_pRpcChannelBuffer
    );

    IRpcStubBuffer *IsIIDSupported
    (
        [in, annotation("_In_")] REFIID riid
    );

    ULONG CountRefs
    (
        void
    );

    HRESULT DebugServerQueryInterface
    (
        [out, annotation("_Outptr_")] void **ppv
    );

    void DebugServerRelease
    (
        [in, annotation("_In_")] void *pv
    );

}



[
    local,
    object,
    uuid(D5F569D0-593B-101A-B569-08002B2DBF7A)
]
interface IPSFactoryBuffer : IUnknown
{

    HRESULT CreateProxy
    (
        [in, annotation("_In_")] IUnknown *pUnkOuter,
        [in, annotation("_In_")] REFIID riid,
        [out, annotation("_Outptr_")] IRpcProxyBuffer **ppProxy,
        [out, annotation("_Outptr_")] void **ppv
    );

    HRESULT CreateStub
    (
        [in, annotation("_In_")] REFIID riid,
        [in, unique, annotation("_In_opt_")] IUnknown *pUnkServer,
        [out, annotation("_Outptr_")] IRpcStubBuffer **ppStub
    );
}

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Desktop Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

cpp_quote( "#if  (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM" )
cpp_quote( "// This interface is only valid on Windows NT 4.0" )

// This structure contains additional data for hooks.  As a backward
// compatability hack, the entire structure is passed in place of the
// RIID parameter on all hook methods.  Thus the IID must be the first
// parameter.  As a forward compatability hack the second field is the
// current size of the structure.
typedef struct SChannelHookCallInfo
{
    IID               iid;
    DWORD             cbSize;
    GUID              uCausality;
    DWORD             dwServerPid;
    DWORD             iMethod;
    void             *pObject;
} SChannelHookCallInfo;

[
    local,
    object,
    uuid(1008c4a0-7613-11cf-9af1-0020af6e72f4)
]
interface IChannelHook : IUnknown
{
    void ClientGetSize(
        [in, annotation("_In_")]  REFGUID uExtent,
        [in, annotation("_In_")]  REFIID  riid,
        [out, annotation("_Out_")] ULONG  *pDataSize );

    void ClientFillBuffer(
        [in, annotation("_In_")]      REFGUID uExtent,
        [in, annotation("_In_")]      REFIID  riid,
        [in, out, annotation("_Inout_")] ULONG  *pDataSize,
        [in, annotation("_In_")]      void   *pDataBuffer );

    void ClientNotify(
        [in, annotation("_In_")] REFGUID uExtent,
        [in, annotation("_In_")] REFIID  riid,
        [in, annotation("_In_")] ULONG   cbDataSize,
        [in, annotation("_In_")] void   *pDataBuffer,
        [in, annotation("_In_")] DWORD   lDataRep,
        [in, annotation("_In_")] HRESULT hrFault );

    void ServerNotify(
        [in, annotation("_In_")] REFGUID uExtent,
        [in, annotation("_In_")] REFIID  riid,
        [in, annotation("_In_")] ULONG   cbDataSize,
        [in, annotation("_In_")] void   *pDataBuffer,
        [in, annotation("_In_")] DWORD   lDataRep );

    void ServerGetSize(
        [in, annotation("_In_")]  REFGUID uExtent,
        [in, annotation("_In_")]  REFIID  riid,
        [in, annotation("_In_")]  HRESULT hrFault,
        [out, annotation("_Out_")] ULONG  *pDataSize );

    void ServerFillBuffer(
        [in, annotation("_In_")]      REFGUID uExtent,
        [in, annotation("_In_")]      REFIID  riid,
        [in, out, annotation("_Inout_")] ULONG  *pDataSize,
        [in, annotation("_In_")]      void   *pDataBuffer,
        [in, annotation("_In_")]      HRESULT hrFault );
};

cpp_quote( "#endif //DCOM" )

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

cpp_quote( "#if  (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM" )
cpp_quote( "// This interface is only valid on Windows NT 4.0" )

#pragma region Application Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

[
    local,
    object,
    uuid(0000013D-0000-0000-C000-000000000046)
]
interface IClientSecurity : IUnknown
{

    typedef struct tagSOLE_AUTHENTICATION_SERVICE
    {
        DWORD    dwAuthnSvc;
        DWORD    dwAuthzSvc;
        OLECHAR *pPrincipalName;
        HRESULT  hr;
    } SOLE_AUTHENTICATION_SERVICE;

    typedef SOLE_AUTHENTICATION_SERVICE *PSOLE_AUTHENTICATION_SERVICE;

    typedef enum tagEOLE_AUTHENTICATION_CAPABILITIES
    {
        EOAC_NONE             = 0x0,
        EOAC_MUTUAL_AUTH      = 0x1,
        EOAC_STATIC_CLOAKING  = 0x20,
        EOAC_DYNAMIC_CLOAKING = 0x40,
        EOAC_ANY_AUTHORITY    = 0x80,
        EOAC_MAKE_FULLSIC     = 0x100,
        EOAC_DEFAULT          = 0x800,

        // These are only valid for CoInitializeSecurity
        EOAC_SECURE_REFS       = 0x2,
        EOAC_ACCESS_CONTROL    = 0x4,
        EOAC_APPID             = 0x8,
        EOAC_DYNAMIC           = 0x10,
        EOAC_REQUIRE_FULLSIC   = 0x200,
        EOAC_AUTO_IMPERSONATE  = 0x400,
        EOAC_DISABLE_AAA       = 0x1000,
        EOAC_NO_CUSTOM_MARSHAL = 0x2000,
        EOAC_RESERVED1         = 0x4000,
    } EOLE_AUTHENTICATION_CAPABILITIES;

    const OLECHAR *COLE_DEFAULT_PRINCIPAL = (OLECHAR *)((INT_PTR) -1);
    const void    *COLE_DEFAULT_AUTHINFO  = (void *)((INT_PTR) -1);

    typedef struct tagSOLE_AUTHENTICATION_INFO
    {
        DWORD  dwAuthnSvc;
        DWORD  dwAuthzSvc;
        void  *pAuthInfo;
    } SOLE_AUTHENTICATION_INFO, *PSOLE_AUTHENTICATION_INFO;

    typedef struct tagSOLE_AUTHENTICATION_LIST
    {
        DWORD                     cAuthInfo;
        SOLE_AUTHENTICATION_INFO *aAuthInfo;
    } SOLE_AUTHENTICATION_LIST, *PSOLE_AUTHENTICATION_LIST;

    HRESULT QueryBlanket
    (
        [in, annotation("_In_")]  IUnknown                *pProxy,
        [out, annotation("_Out_")] DWORD                  *pAuthnSvc,
        [out, annotation("_Out_opt_")] DWORD              *pAuthzSvc,
        [out, annotation("__RPC__deref_out_opt")] 
              OLECHAR                **pServerPrincName,
        [out, annotation("_Out_opt_")] DWORD              *pAuthnLevel,
        [out, annotation("_Out_opt_")] DWORD              *pImpLevel,
        [out, annotation("_Outptr_result_maybenull_")] void        **pAuthInfo,
        [out, annotation("_Out_opt_")] DWORD              *pCapabilites
    );

    HRESULT SetBlanket
    (
        [in, annotation("_In_")] IUnknown                 *pProxy,
        [in, annotation("_In_")] DWORD                     dwAuthnSvc,
        [in, annotation("_In_")] DWORD                     dwAuthzSvc,
        [in, annotation("__RPC__in_opt")] 
             OLECHAR                  *pServerPrincName,
        [in, annotation("_In_")] DWORD                     dwAuthnLevel,
        [in, annotation("_In_")] DWORD                     dwImpLevel,
        [in, annotation("_In_opt_")] void                 *pAuthInfo,
        [in, annotation("_In_")] DWORD                     dwCapabilities
    );

    HRESULT CopyProxy
    (
        [in, annotation("_In_")]         IUnknown  *pProxy,
        [out, annotation("_Outptr_")] IUnknown **ppCopy
    );
}

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Desktop Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

[
    local,
    object,
    uuid(0000013E-0000-0000-C000-000000000046)
]
interface IServerSecurity : IUnknown
{
    HRESULT QueryBlanket
    (
        [out, annotation("_Out_opt_")] DWORD         *pAuthnSvc,
        [out, annotation("_Out_opt_")] DWORD         *pAuthzSvc,
        [out, annotation("__RPC__deref_out_opt")] 
              OLECHAR **pServerPrincName,
        [out, annotation("_Out_opt_")] DWORD         *pAuthnLevel,
        [out, annotation("_Out_opt_")] DWORD         *pImpLevel,
        [out, annotation("_Outptr_result_maybenull_")] void   **pPrivs,
        [in,out, annotation("_Inout_opt_")] DWORD    *pCapabilities
    );

    HRESULT ImpersonateClient();

    HRESULT RevertToSelf();

    BOOL IsImpersonating();
}

typedef enum tagRPCOPT_PROPERTIES
{
   COMBND_RPCTIMEOUT = 0x01, // Rpc transport-specific timeout.
   COMBND_SERVER_LOCALITY = 0x02, // server locality
   COMBND_RESERVED1 = 0x04, // Reserved
   COMBND_RESERVED2 = 0x05, // Reserved
   COMBND_RESERVED3 = 0x08, // Reserved
   COMBND_RESERVED4 = 0x10, // Reserved
} RPCOPT_PROPERTIES;  

typedef enum tagRPCOPT_SERVER_LOCALITY_VALUES
{
   SERVER_LOCALITY_PROCESS_LOCAL=0,
   SERVER_LOCALITY_MACHINE_LOCAL=1,
   SERVER_LOCALITY_REMOTE=2     
} RPCOPT_SERVER_LOCALITY_VALUES;


[
object,
local,
uuid(00000144-0000-0000-C000-000000000046)
]
interface IRpcOptions : IUnknown
{
    HRESULT Set([in, annotation("_In_")] IUnknown * pPrx,
                [in, annotation("_In_")] RPCOPT_PROPERTIES dwProperty,
                [in, annotation("_In_")] ULONG_PTR dwValue);

    HRESULT Query([in, annotation("_In_")] IUnknown * pPrx,
                  [in, annotation("_In_")] RPCOPT_PROPERTIES dwProperty,
                  [out, annotation("_Out_")] ULONG_PTR * pdwValue);
}

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Application Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

//properties
typedef enum tagGLOBALOPT_PROPERTIES
{
   COMGLB_EXCEPTION_HANDLING = 1,  //defines COM exception handling behavior
   COMGLB_APPID = 2,   //sets the AppID for the process
   COMGLB_RPC_THREADPOOL_SETTING = 3,   // sets the ThreadPool behavior of RPC runtime in the process.
   COMGLB_RO_SETTINGS = 4,   // miscellaneous settings.
   COMGLB_UNMARSHALING_POLICY = 5,  // policy applied to CoUnmarshalInterface
   COMGLB_PROPERTIES_RESERVED1 = 6,
   COMGLB_PROPERTIES_RESERVED2 = 7,
   COMGLB_PROPERTIES_RESERVED3 = 8,
} GLOBALOPT_PROPERTIES;

//values
typedef enum tagGLOBALOPT_EH_VALUES
{
   COMGLB_EXCEPTION_HANDLE=0,
   COMGLB_EXCEPTION_DONOT_HANDLE_FATAL=1,
   COMGLB_EXCEPTION_DONOT_HANDLE=COMGLB_EXCEPTION_DONOT_HANDLE_FATAL, // Alias for compatibility
   COMGLB_EXCEPTION_DONOT_HANDLE_ANY=2
} GLOBALOPT_EH_VALUES;

//values
typedef enum tagGLOBALOPT_RPCTP_VALUES
{
   COMGLB_RPC_THREADPOOL_SETTING_DEFAULT_POOL = 0, // Not legal for Set.
   COMGLB_RPC_THREADPOOL_SETTING_PRIVATE_POOL = 1,
} GLOBALOPT_RPCTP_VALUES;

typedef enum tagGLOBALOPT_RO_FLAGS
{
   // Remove touch messages from the message queue in the STA modal loop.
   COMGLB_STA_MODALLOOP_REMOVE_TOUCH_MESSAGES = 0x1,

   // Flags that control the behavior of input message removal in
   // the STA modal loop when the thread's message queue is attached.
   COMGLB_STA_MODALLOOP_SHARED_QUEUE_REMOVE_INPUT_MESSAGES = 0x2,
   COMGLB_STA_MODALLOOP_SHARED_QUEUE_DONOT_REMOVE_INPUT_MESSAGES = 0x4,

   // Flag to opt-in to the fast rundown option.
   COMGLB_FAST_RUNDOWN = 0x8,

   // Reserved
   COMGLB_RESERVED1 = 0x10,
   COMGLB_RESERVED2 = 0x20,
   COMGLB_RESERVED3 = 0x40,

   // Flag to opt-in to pointer message re-ordering when 
   // queues are attached.
   COMGLB_STA_MODALLOOP_SHARED_QUEUE_REORDER_POINTER_MESSAGES = 0x80,

   COMGLB_RESERVED4 = 0x100,
   COMGLB_RESERVED5 = 0x200,
   COMGLB_RESERVED6 = 0x400,

} GLOBALOPT_RO_FLAGS;

typedef enum tagGLOBALOPT_UNMARSHALING_POLICY_VALUES
{
   COMGLB_UNMARSHALING_POLICY_NORMAL = 0,
   COMGLB_UNMARSHALING_POLICY_STRONG = 1,
   COMGLB_UNMARSHALING_POLICY_HYBRID = 2
} GLOBALOPT_UNMARSHALING_POLICY_VALUES;

[
    object,
    local,
    pointer_default(unique),
    uuid(0000015B-0000-0000-C000-000000000046)
]
interface IGlobalOptions : IUnknown
{
    HRESULT Set([in, annotation("_In_")] GLOBALOPT_PROPERTIES dwProperty,
                [in, annotation("_In_")] ULONG_PTR dwValue);
    HRESULT Query([in, annotation("_In_")] GLOBALOPT_PROPERTIES dwProperty,
                  [out, annotation("_Out_")] ULONG_PTR * pdwValue);
}

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

cpp_quote( "#endif //DCOM" )

#pragma region Application Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

[
 uuid(00000022-0000-0000-C000-000000000046),
 version(1.0),
 pointer_default(unique)
  , object
]

interface ISurrogate : IUnknown
{
    typedef [unique] ISurrogate* LPSURROGATE;

        HRESULT LoadDllServer(
                [in] REFCLSID           Clsid);
        HRESULT FreeSurrogate();
}


[
    local,
    object,
    uuid(00000146-0000-0000-C000-000000000046)
]
interface IGlobalInterfaceTable : IUnknown
{
    typedef [unique] IGlobalInterfaceTable *LPGLOBALINTERFACETABLE;

    HRESULT RegisterInterfaceInGlobal
    (
        [in, annotation("_In_")]  IUnknown *pUnk,
        [in, annotation("_In_")]  REFIID    riid,
        [out, annotation("_Out_")] DWORD    *pdwCookie
    );

    HRESULT RevokeInterfaceFromGlobal
    (
        [in, annotation("_In_")] DWORD      dwCookie
    );

    HRESULT GetInterfaceFromGlobal
    (
        [in, annotation("_In_")]  DWORD          dwCookie,
        [in, annotation("_In_")]  REFIID         riid,
        [out, iid_is(riid), annotation("_Outptr_")] void **ppv
    );
};

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Desktop Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

[
    object,
    uuid(00000030-0000-0000-C000-000000000046)
]

interface ISynchronize : IUnknown
{
    HRESULT Wait([in] DWORD dwFlags, [in] DWORD dwMilliseconds);
    HRESULT Signal();
    HRESULT Reset();
}


[
 local,
 object,
 uuid(00000031-0000-0000-C000-000000000046)
]
interface ISynchronizeHandle : IUnknown
{
    HRESULT GetHandle([out, annotation("_Out_")] HANDLE *ph );
}


[
 local,
 object,
 uuid(00000032-0000-0000-C000-000000000046)
]
interface ISynchronizeEvent : ISynchronizeHandle
{
    HRESULT SetEventHandle([in, annotation("_In_")] HANDLE *ph );
}


[
 local,
 object,
 uuid(00000033-0000-0000-C000-000000000046)
]
interface ISynchronizeContainer : IUnknown
{

    HRESULT AddSynchronize([in, annotation("_In_")] ISynchronize *pSync);

    HRESULT WaitMultiple([in, annotation("_In_")] DWORD dwFlags,
                         [in, annotation("_In_")] DWORD dwTimeOut,
                         [out, annotation("_Outptr_")] ISynchronize **ppSync);


}

[
 local,
 object,
 uuid(00000025-0000-0000-C000-000000000046)
]
interface ISynchronizeMutex : ISynchronize
{
    HRESULT ReleaseMutex();
}



[
 local,
 object,
 uuid(00000029-0000-0000-C000-000000000046)
]

interface ICancelMethodCalls : IUnknown
{
    typedef [unique] ICancelMethodCalls *LPCANCELMETHODCALLS;

    HRESULT Cancel          ([in, annotation("_In_")] ULONG ulSeconds);
    HRESULT TestCancel      (void);
}

[
 local,
 object,
 uuid(0000002A-0000-0000-C000-000000000046)
]
interface IAsyncManager : IUnknown
{
    typedef enum tagDCOM_CALL_STATE
    {
        DCOM_NONE           = 0x0,
        DCOM_CALL_COMPLETE  = 0x1,
        DCOM_CALL_CANCELED  = 0x2,
    } DCOM_CALL_STATE;

    HRESULT CompleteCall  ( [in, annotation("_In_")] HRESULT Result );
    HRESULT GetCallContext( 
        [in, annotation("_In_")] REFIID riid, 
        [out, annotation("_Outptr_")] void **pInterface );
    HRESULT GetState      ( [out, annotation("_Out_")] ULONG *pulStateFlags);
}

[
 local,
 object,
 uuid(1c733a30-2a1c-11ce-ade5-00aa0044773d),
 pointer_default(unique)
]
interface ICallFactory : IUnknown
{
    HRESULT CreateCall(
        [in, annotation("_In_")]     REFIID                riid,
        [in, annotation("_In_opt_")] IUnknown             *pCtrlUnk,
        [in, annotation("_In_")]     REFIID                riid2,
        [out, iid_is(riid2), annotation("_Outptr_")] IUnknown **ppv );
}

[ uuid(00000149-0000-0000-C000-000000000046),
  version(0.0),
  pointer_default(unique),
  local,
  object
]
interface IRpcHelper : IUnknown
{
    HRESULT GetDCOMProtocolVersion(
        [out, annotation("_Out_")] DWORD *pComVersion);

    HRESULT GetIIDFromOBJREF(
         [in, annotation("_In_")] void *pObjRef,
         [out, annotation("_Outptr_")] IID **piid);
}

[local,
 object,
 uuid(eb0cb9e8-7996-11d2-872e-0000f8080859),
]
interface IReleaseMarshalBuffers : IUnknown
{
    HRESULT ReleaseMarshalBuffer(
        [in,out, annotation("_Inout_")]  RPCOLEMESSAGE  *pMsg,
        [in, annotation("_In_")]  DWORD                  dwFlags,
        [in,unique, annotation("_In_opt_")] IUnknown    *pChnl);
}

[
 local,
 object,
 uuid(0000002B-0000-0000-C000-000000000046)
]
interface IWaitMultiple : IUnknown
{
    HRESULT WaitMultiple  (
        [in, annotation("_In_")] DWORD timeout, 
        [out, annotation("_Outptr_")] ISynchronize **pSync );
    HRESULT AddSynchronize( [in, annotation("_In_")] ISynchronize *pSync );
}


[
    local,
    object,
    uuid(00000147-0000-0000-C000-000000000046)
]
interface IAddrTrackingControl : IUnknown
{
    typedef [unique] IAddrTrackingControl* LPADDRTRACKINGCONTROL;

    HRESULT EnableCOMDynamicAddrTracking();
    HRESULT DisableCOMDynamicAddrTracking();
};

[
    local,
    object,
    uuid(00000148-0000-0000-C000-000000000046)
]
interface IAddrExclusionControl : IUnknown
{
    typedef [unique] IAddrExclusionControl* LPADDREXCLUSIONCONTROL;

    HRESULT GetCurrentAddrExclusionList(
        [in, annotation("_In_")]REFIID riid, 
        [out, iid_is(riid), annotation("_Outptr_")]void** ppEnumerator);
    HRESULT UpdateAddrExclusionList([in, annotation("_In_")]IUnknown* pEnumerator);
};

/****************************************************************************
* Pipe interfaces
****************************************************************************/
#if (__midl >= 500)
#define PIPE_ASYNC_UUID(async_iid) async_uuid(async_iid),
#else
#define PIPE_ASYNC_UUID(async_iid)
#endif

#define NEW_PIPE_INTERFACE(iid, async_iid, name, type)                          \
[                                                                               \
    object,                                                                     \
    uuid(iid),                                                                  \
    PIPE_ASYNC_UUID(async_iid)                                                  \
    pointer_default(unique)                                                     \
]                                                                               \
    interface IPipe##name : IUnknown                                            \
    {                                                                           \
        HRESULT Pull                                                            \
        (                                                                       \
            [out, size_is(cRequest), length_is(*pcReturned)] type *buf,         \
            [in]  ULONG  cRequest,                                         \
            [out] ULONG *pcReturned                                             \
        );                                                                      \
                                                                                \
        HRESULT Push                                                            \
        (                                                                       \
            [in, size_is(cSent)] type  *buf,                                    \
            [in] ULONG cSent                                                    \
        );                                                                      \
    }

NEW_PIPE_INTERFACE( DB2F3ACA-2F86-11d1-8E04-00C04FB9989A,
                    DB2F3ACB-2F86-11d1-8E04-00C04FB9989A,
                    Byte,
                    BYTE)
NEW_PIPE_INTERFACE( DB2F3ACC-2F86-11d1-8E04-00C04FB9989A,
                    DB2F3ACD-2F86-11d1-8E04-00C04FB9989A,
                    Long,
                    LONG)
NEW_PIPE_INTERFACE( DB2F3ACE-2F86-11d1-8E04-00C04FB9989A,
                    DB2F3ACF-2F86-11d1-8E04-00C04FB9989A,
                    Double,
                    DOUBLE)


/****************************************************************************
* Context related structures and interfaces
****************************************************************************/
cpp_quote("#if defined USE_COM_CONTEXT_DEF || defined BUILDTYPE_COMSVCS || defined _COMBASEAPI_ || defined _OLE32_")

typedef DWORD CPFLAGS;

typedef struct tagContextProperty {
    GUID policyId;
    CPFLAGS flags;
    [unique] IUnknown *pUnk;
} ContextProperty;


[
    local,
    object,
    uuid(000001c1-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IEnumContextProps : IUnknown
{
    typedef [unique] IEnumContextProps *LPENUMCONTEXTPROPS;

    HRESULT Next([in, annotation("_In_")] ULONG celt,
                 [out, size_is(celt), length_is(*pceltFetched), annotation("_Out_writes_to_(celt, *pceltFetched)")] 
                          ContextProperty *pContextProperties,
                 [out, annotation("_Out_")] ULONG *pceltFetched);
    HRESULT Skip([in, annotation("_In_")] ULONG celt);
    HRESULT Reset();
    HRESULT Clone([out, annotation("_Outptr_")] IEnumContextProps **ppEnumContextProps);
    HRESULT Count([out, annotation("_Out_")] ULONG *pcelt);
}


[
    local,
    object,
    uuid(000001c0-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IContext : IUnknown
{
    //typedef [unique] IContext *LPCONTEXT;

    HRESULT SetProperty([in, annotation("_In_")] REFGUID rpolicyId,
                        [in, annotation("_In_")] CPFLAGS flags,
                        [in, annotation("_In_")] IUnknown *pUnk);
    HRESULT RemoveProperty([in, annotation("_In_")] REFGUID rPolicyId);
    HRESULT GetProperty([in, annotation("_In_")] REFGUID rGuid,
                        [out, annotation("_Out_")] CPFLAGS *pFlags,
                        [out, annotation("_Outptr_")] IUnknown **ppUnk);
    HRESULT EnumContextProps([out, annotation("_Outptr_")] IEnumContextProps **ppEnumContextProps);
}


///////////////////////////////////////////////////////////////////////////////
//NOTE: This is the section where we define OLE  *PUBLIC ONLY* interfaces. If users need to 
//use this definition of this interface they will need to define _OBJIDL_PUBLIC in their code.
///////////////////////////////////////////////////////////////////////////////
#ifdef _OBJIDL_PUBLIC

cpp_quote("#if !defined BUILDTYPE_COMSVCS && ! (defined _COMBASEAPI_ || defined _OLE32_)")

// IObjContext interface
[
    local,
    object,
    uuid(000001c6-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IObjContext : IContext
{

	void Reserved1();
	void Reserved2();
	void Reserved3();
	void Reserved4();
	void Reserved5();
	void Reserved6();
	void Reserved7();

}

cpp_quote("#endif")

#endif

cpp_quote("#endif")

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Application Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

/****************************************************************************
* GetApartmentType  enums
****************************************************************************/
typedef enum _APTTYPEQUALIFIER
{
    APTTYPEQUALIFIER_NONE               = 0,
    APTTYPEQUALIFIER_IMPLICIT_MTA       = 1,
    APTTYPEQUALIFIER_NA_ON_MTA          = 2,
    APTTYPEQUALIFIER_NA_ON_STA          = 3,
    APTTYPEQUALIFIER_NA_ON_IMPLICIT_MTA = 4,
    APTTYPEQUALIFIER_NA_ON_MAINSTA      = 5,
    APTTYPEQUALIFIER_APPLICATION_STA    = 6,
    APTTYPEQUALIFIER_RESERVED_1         = 7,
 } APTTYPEQUALIFIER;


/****************************************************************************
* ICOMThreadingInfo and enums
****************************************************************************/
typedef enum _APTTYPE
{
    APTTYPE_CURRENT         = -1,
    APTTYPE_STA             = 0,
    APTTYPE_MTA             = 1,
    APTTYPE_NA              = 2,
    APTTYPE_MAINSTA         = 3
} APTTYPE;

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Desktop Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

typedef enum _THDTYPE
{
    THDTYPE_BLOCKMESSAGES   = 0,
    THDTYPE_PROCESSMESSAGES = 1
} THDTYPE;

typedef DWORD APARTMENTID;

[
    local,
    object,
    uuid(000001ce-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IComThreadingInfo : IUnknown
{
    HRESULT GetCurrentApartmentType( [out, annotation("_Out_")] APTTYPE* pAptType );
    HRESULT GetCurrentThreadType( [out, annotation("_Out_")] THDTYPE* pThreadType );
    HRESULT GetCurrentLogicalThreadId( [out, annotation("_Out_")] GUID* pguidLogicalThreadId );
    HRESULT SetCurrentLogicalThreadId( [in, annotation("_In_")] REFGUID rguid );
};

[
    object,
    pointer_default(unique),
    uuid(72380d55-8d2b-43a3-8513-2b6ef31434e9)
]
interface IProcessInitControl : IUnknown
{
    HRESULT ResetInitializerTimeout([in] DWORD dwSecondsRemaining);
};

// marker interface for objects that want to opt into the fast rundown feature.
[
    object,
    local,
    pointer_default(unique),
    uuid(00000040-0000-0000-C000-000000000046)
]
interface IFastRundown : IUnknown
{
};


typedef enum CO_MARSHALING_CONTEXT_ATTRIBUTES
{
    CO_MARSHALING_SOURCE_IS_APP_CONTAINER = 0,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_1 = 0x80000000,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_2 = 0x80000001,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_3 = 0x80000002,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_4 = 0x80000003,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_5 = 0x80000004,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_6 = 0x80000005,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_7 = 0x80000006,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_8 = 0x80000007,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_9 = 0x80000008,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_10 = 0x80000009,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_11 = 0x8000000a,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_12 = 0x8000000b,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_13 = 0x8000000c,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_14 = 0x8000000d,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_15 = 0x8000000e,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_16 = 0x8000000f,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_17 = 0x80000010,
    CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_18 = 0x80000011,
} CO_MARSHALING_CONTEXT_ATTRIBUTES;

[
    local,
    object,
    uuid(D8F2F5E6-6102-4863-9F26-389A4676EFDE),
    pointer_default(unique)
]
interface IMarshalingStream : IStream
{
    HRESULT GetMarshalingContextAttribute
    (
        [in] CO_MARSHALING_CONTEXT_ATTRIBUTES attribute,
        [out] ULONG_PTR *pAttributeValue
    );
};

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Application Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

[
    local,
    object,
    uuid(C03F6A43-65A4-9818-987E-E0B810D2A6F2),
    pointer_default(unique)
]
interface IAgileReference : IUnknown
{
cpp_quote("#if defined(__cplusplus) && !defined(CINTERFACE)")
cpp_quote("    EXTERN_C const IID IID_IAgileReference;")
cpp_quote("    extern \"C++\"")
cpp_quote("    {")
cpp_quote("        MIDL_INTERFACE(\"C03F6A43-65A4-9818-987E-E0B810D2A6F2\")")
cpp_quote("        IAgileReference : public IUnknown")
cpp_quote("        {")
cpp_quote("        public:")
cpp_quote("            virtual HRESULT STDMETHODCALLTYPE Resolve( ")
cpp_quote("                /* [in] */ REFIID riid,")
cpp_quote("                /* [iid_is][retval][out] */ void **ppvObjectReference) = 0;")
cpp_quote("")
cpp_quote("            template<class Q>")
cpp_quote("            HRESULT")
cpp_quote("#ifdef _M_CEE_PURE")
cpp_quote("            __clrcall")
cpp_quote("#else")
cpp_quote("            STDMETHODCALLTYPE")
cpp_quote("#endif")
cpp_quote("            Resolve(_COM_Outptr_ Q** pp)")
cpp_quote("            {")
cpp_quote("                return Resolve(__uuidof(Q), (void **)pp);")
cpp_quote("            }")
cpp_quote("")
cpp_quote("        };")
cpp_quote("    } // extern C++")
cpp_quote("#else")
   HRESULT Resolve([in] REFIID riid, 
                   [out, retval, iid_is(riid)] void **ppvObjectReference);
};
cpp_quote("#endif")

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Application Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

cpp_quote ("EXTERN_C const GUID  IID_ICallbackWithNoReentrancyToApplicationSTA;")

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Application Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

typedef struct MachineGlobalObjectTableRegistrationToken__{
    int unused;
}* MachineGlobalObjectTableRegistrationToken;

[
    local,
    object,
    uuid(26d709ac-f70b-4421-a96f-d2878fafb00d),
    pointer_default(unique)
]

interface IMachineGlobalObjectTable : IUnknown
{
    HRESULT RegisterObject(
        [in] REFCLSID clsid,
        [in] LPCWSTR identifier,
        [in] IUnknown *object,
        [out] MachineGlobalObjectTableRegistrationToken *token);

    HRESULT GetObject(
        [in] REFCLSID clsid,
        [in] LPCWSTR identifier,
        [in] REFIID riid,
        [out, iid_is(riid)] void **ppv);

    HRESULT RevokeObject(
        [in] MachineGlobalObjectTableRegistrationToken token);
};

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

#pragma region Application Family or OneCore Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)")

// ISupportAllowLowerTrustActivation - implemented by CLSID_ActivationCapabilities to indicate OS support for CLSCTX_ALLOW_LOWER_TRUST_REGISTRATION.
[
    local,
    object,
    uuid(e9956ef2-3828-4b4b-8fa9-7db61dee4954)
]
interface ISupportAllowLowerTrustActivation : IUnknown
{
}

// ISupportActivationFromPackage - implemented by CLSID_ActivationCapabilities to indicate OS support for CoCreateInstanceFromPackage/CoCreateInstanceExFromPackage/CoGetClassObjectFromPackage.
[
    local,
    object,
    uuid(0a18aae5-5caa-48c5-a9f4-6e46dcd58ad5)
]
interface ISupportActivationFromPackage : IUnknown
{
}

// ISupportCoAddComDependencyOnPackage - implemented by CLSID_ActivationCapabilities to indicate OS support for CoAddComDependencyOnPackage.
[
    local,
    object,
    uuid(c8059efc-4e98-4fd0-bfc6-44190b80b823)
]
interface ISupportCoAddComDependencyOnPackage : IUnknown
{
}

// ISupportServerMustBeEqualOrGreaterPrivilegeActivation - implemented by CLSID_ActivationCapabilities to indicate OS support for CLSCTX_SERVER_MUST_BE_EQUAL_OR_GREATER_PRIVILEGE.
[
    local,
    object,
    uuid(5bdb3ee2-46bc-4313-b5fb-801c360ba5f9)
]
interface ISupportServerMustBeEqualOrGreaterPrivilegeActivation : IUnknown
{
}

// ISupportDoNotElevateServerActivation - implemented by CLSID_ActivationCapabilities to indicate OS support for CLSCTX_DO_NOT_ELEVATE_SERVER.
[
    local,
    object,
    uuid(40aefe22-3ff6-43dc-8108-c8c402d57b5c)
]
interface ISupportDoNotElevateServerActivation : IUnknown
{
}

// ISupportActivateAsActivatorPackaged - implemented by CLSID_ActivationCapabilities to indicate OS support for IdentityType="activateAsActivatorPackaged" in windows.comServer.
[
    local,
    object,
    uuid(765d1df2-f0af-4ef8-aa50-84789ca330ed)
]
interface ISupportActivateAsActivatorPackaged : IUnknown
{
}

// ISupportPackagedComRegistrationVisibility - implemented by CLSID_ActivationCapabilities to indicate OS support for Visibility attributes in windows.comServer/windows.comInterface.
[
    local,
    object,
    uuid(8dc3444e-c7ee-449a-9fb8-b9173988d66a)
]
interface ISupportPackagedComRegistrationVisibility : IUnknown
{
}

// ISupportPackagedComElevationEnabledClasses - implemented by CLSID_ActivationCapabilities to indicate OS support for ElevationEnabled in windows.comServer.
[
    local,
    object,
    uuid(b4219019-f712-4d4f-ade7-f468276af0b8)
]
interface ISupportPackagedComElevationEnabledClasses : IUnknown
{
}

// IPackagedComSyntaxSupport - if implemented by CLSID_ActivationCapabilities, can be used to get the latest version of windows.comServer/windows.comInterface syntax supported by the OS.
// E.g. if the com6 namespace is supported, the supported syntax version is 6 (or greater).
// Support for versions < 6, i.e. com/com2/com3/com4/com5 namespaces, cannot be detected with this interface
// because some OS versions supporting these syntax versions do not implement it.
[
    local,
    object,
    uuid(8f146474-b228-48fb-a58c-105ebb273abc)
]
interface IPackagedComSyntaxSupport : IUnknown
{
    HRESULT GetSupportedVersion(
        [out] UINT32* supportedVersion);
}

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES) */")
#pragma endregion

cpp_quote("#define _OBJIDLBASE_")
cpp_quote("#endif") //_OBJIDLBASE_

cpp_quote("#if ( _MSC_VER >= 800 )")
cpp_quote("#if _MSC_VER >= 1200")
cpp_quote("#pragma warning(pop)")
cpp_quote("#else")
cpp_quote("#pragma warning(default:4201)")
cpp_quote("#endif")
cpp_quote("#endif")
