//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (c) Microsoft Corporation. All rights reserved.
//
//  File: objidl.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_WINLH && !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("#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 "unknwn.idl";
import "wtypes.idl";
#endif

interface IStream;
interface IMoniker;
interface IEnumMoniker;
interface IEnumString;
interface IRunningObjectTable;
interface IStorage;
interface IEnumSTATSTG;
interface IAdviseSink;
interface IBindCtx;
interface IEnumMoniker;
interface IAsyncManager;
interface ICallFactory;
interface ISynchronize;

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("__deref_out")] void **ppv
    );

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

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

[
    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);

    SIZE_T GetSize([in, annotation("__in_opt")] void *pv);

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

    void HeapMinimize(void);
}

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

interface IMallocSpy : IUnknown
{

    typedef [unique] IMallocSpy *LPMALLOCSPY;

    SIZE_T PreAlloc
    (
        [in, annotation("__in")] SIZE_T cbRequest
    );

    void  *PostAlloc
    (
        [in, annotation("__in")] void *pActual
    );

    void  *PreFree
    (
        [in, annotation("__in")] void *pRequest,
        [in, annotation("__in")] BOOL  fSpyed
    );

    void  PostFree
    (
        [in, annotation("__in")] BOOL  fSpyed
    );

    SIZE_T PreRealloc
    (
        [in, annotation("__in")] void   *pRequest,
        [in, annotation("__in")] SIZE_T   cbRequest,
        [out, annotation("__deref_out")] void **ppNewRequest,
        [in, annotation("__in")] BOOL    fSpyed
    );

    void  *PostRealloc
    (
        [in, annotation("__in")] void *pActual,
        [in, annotation("__in")] BOOL  fSpyed
    );

    void  *PreGetSize
    (
        [in, annotation("__in")] void *pRequest,
        [in, annotation("__in")] BOOL  fSpyed
    );

    SIZE_T PostGetSize
    (
        [in, annotation("__in")] SIZE_T cbActual,
        [in, annotation("__in")] BOOL  fSpyed
    );

    void  *PreDidAlloc
    (
        [in, annotation("__in")] void *pRequest,
        [in, annotation("__in")] BOOL  fSpyed
    );

    int   PostDidAlloc
    (
        [in, annotation("__in")] void *pRequest,
        [in, annotation("__in")] BOOL  fSpyed,
        [in, annotation("__in")] int   fActual
    );

    void  PreHeapMinimize(void);

    void  PostHeapMinimize(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;

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")] MULTI_QI  *pMQIs
    );
}


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

[
    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_ecount_part(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);
}


/****************************************************************************
 *  Binding Interfaces
 ****************************************************************************/

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

interface IBindCtx : IUnknown
{

    typedef [unique] IBindCtx *LPBC;

    typedef [unique] IBindCtx *LPBINDCTX;

cpp_quote("#if defined(__cplusplus)")
cpp_quote("    typedef __struct_bcount(cbStruct) struct tagBIND_OPTS {")
cpp_quote("    DWORD           cbStruct;")
cpp_quote("    DWORD           grfFlags;")
cpp_quote("    DWORD           grfMode;")
cpp_quote("    DWORD           dwTickCountDeadline;")
cpp_quote("    } BIND_OPTS, * LPBIND_OPTS;")
cpp_quote("#else")

    typedef struct tagBIND_OPTS {
    DWORD       cbStruct;       //  sizeof(BIND_OPTS)
    DWORD       grfFlags;
    DWORD       grfMode;
    DWORD       dwTickCountDeadline;
    } BIND_OPTS, * LPBIND_OPTS;

cpp_quote("#endif")

cpp_quote("#if defined(__cplusplus)")
cpp_quote("    typedef struct tagBIND_OPTS2 : tagBIND_OPTS {")
cpp_quote("    DWORD           dwTrackFlags;")
cpp_quote("    DWORD           dwClassContext;")
cpp_quote("    LCID            locale;")
cpp_quote("    COSERVERINFO *  pServerInfo;")
cpp_quote("    } BIND_OPTS2, * LPBIND_OPTS2;")
cpp_quote("#else")

midl_pragma warning (disable: 2480)
    typedef struct tagBIND_OPTS2 {
    DWORD           cbStruct;       //  sizeof(BIND_OPTS2)
    DWORD           grfFlags;
    DWORD           grfMode;
    DWORD           dwTickCountDeadline;
    DWORD           dwTrackFlags;
    DWORD           dwClassContext;
    LCID            locale;
    COSERVERINFO *  pServerInfo;
    } BIND_OPTS2, * LPBIND_OPTS2;


cpp_quote("#endif")

cpp_quote("#if defined(__cplusplus)")
cpp_quote("    typedef struct tagBIND_OPTS3 : tagBIND_OPTS2 {")
cpp_quote("   HWND           hwnd;")
cpp_quote("    } BIND_OPTS3, * LPBIND_OPTS3;")
cpp_quote("#else")

    typedef struct tagBIND_OPTS3 {
    DWORD           cbStruct;       //  sizeof(BIND_OPTS3)
    DWORD           grfFlags;
    DWORD           grfMode;
    DWORD           dwTickCountDeadline;
    DWORD           dwTrackFlags;
    DWORD           dwClassContext;
    LCID            locale;
    COSERVERINFO *  pServerInfo;
    HWND            hwnd;
    } BIND_OPTS3, * LPBIND_OPTS3;

cpp_quote("#endif")


    typedef enum tagBIND_FLAGS
    {
        BIND_MAYBOTHERUSER = 1,
        BIND_JUSTTESTEXISTENCE = 2
    } BIND_FLAGS;

    HRESULT RegisterObjectBound
    (
        [in, unique] IUnknown *punk
    );

    HRESULT RevokeObjectBound
    (
        [in, unique] IUnknown *punk
    );

    HRESULT ReleaseBoundObjects
    (
        void
    );

    [local]
    HRESULT SetBindOptions
    (
        [in] BIND_OPTS *pbindopts
    );

    [call_as(SetBindOptions)]
    HRESULT RemoteSetBindOptions
    (
        [in] BIND_OPTS2 *pbindopts
    );

    [local]
    HRESULT GetBindOptions
    (
        [in, out] BIND_OPTS *pbindopts
    );

    [call_as(GetBindOptions)]
    HRESULT RemoteGetBindOptions
    (
        [in, out] BIND_OPTS2 *pbindopts
    );

    HRESULT GetRunningObjectTable
    (
        [out] IRunningObjectTable **pprot
    );

    HRESULT RegisterObjectParam(
        [in] LPOLESTR pszKey,
        [in, unique] IUnknown *punk
    );

    HRESULT GetObjectParam(
        [in] LPOLESTR pszKey,
        [out] IUnknown **ppunk
    );

    HRESULT EnumObjectParam
    (
        [out] IEnumString **ppenum
    );

    HRESULT RevokeObjectParam
    (
        [in] LPOLESTR pszKey
    );
}

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

interface IEnumMoniker : IUnknown
{

    typedef [unique] IEnumMoniker *LPENUMMONIKER;

    [local]
    HRESULT Next(
        [in] ULONG celt,
        [annotation("__out_ecount_part(celt,*pceltFetched)")]
        IMoniker **rgelt,
        [annotation("__out_opt")] ULONG *pceltFetched);

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


    HRESULT Skip(
        [in] ULONG celt);

    HRESULT Reset();

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

[
    object,
    uuid(00000126-0000-0000-C000-000000000046)
]
interface IRunnableObject : IUnknown
{

    typedef [unique] IRunnableObject *LPRUNNABLEOBJECT;

    HRESULT GetRunningClass(
        [out] LPCLSID lpClsid);

    HRESULT Run(
        [in] LPBINDCTX pbc);

    [local]
    BOOL IsRunning();

    [call_as(IsRunning)]
    HRESULT RemoteIsRunning();

    HRESULT LockRunning(
        [in] BOOL fLock,
        [in] BOOL fLastUnlockCloses);

    HRESULT SetContainedObject(
        [in] BOOL fContained);
}

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

interface IRunningObjectTable : IUnknown
{

    typedef [unique] IRunningObjectTable *LPRUNNINGOBJECTTABLE;

    HRESULT Register
    (
        [in] DWORD grfFlags,
        [in, unique] IUnknown *punkObject,
        [in, unique] IMoniker *pmkObjectName,
        [out] DWORD *pdwRegister
    );

    HRESULT Revoke
    (
        [in] DWORD dwRegister
    );

    HRESULT IsRunning
    (
        [in, unique] IMoniker *pmkObjectName
    );

    HRESULT GetObject
    (
        [in, unique] IMoniker *pmkObjectName,
        [out] IUnknown **ppunkObject
    );

    HRESULT NoteChangeTime
    (
        [in] DWORD dwRegister,
        [in] FILETIME *pfiletime
    );

    HRESULT GetTimeOfLastChange
    (
        [in, unique] IMoniker *pmkObjectName,
        [out] FILETIME *pfiletime
    );

    HRESULT EnumRunning
    (
        [out] IEnumMoniker **ppenumMoniker
    );

}

[
    object,
    uuid(0000010c-0000-0000-C000-000000000046)
]

interface IPersist : IUnknown
{

    typedef [unique] IPersist *LPPERSIST;

    HRESULT GetClassID
    (
        [out] CLSID *pClassID
    );
}

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

interface IPersistStream : IPersist
{

    typedef [unique] IPersistStream *LPPERSISTSTREAM;

    HRESULT IsDirty
    (
        void
    );

    HRESULT Load
    (
        [in, unique] IStream *pStm
    );

    HRESULT Save
    (
        [in, unique] IStream *pStm,
        [in] BOOL fClearDirty
    );

    HRESULT GetSizeMax
    (
        [out] ULARGE_INTEGER *pcbSize
    );

}

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

interface IMoniker : IPersistStream
{

    typedef [unique] IMoniker *LPMONIKER;

    // system moniker types; returned from IsSystemMoniker.
    typedef enum tagMKSYS
    {
        MKSYS_NONE = 0,
        MKSYS_GENERICCOMPOSITE = 1,
        MKSYS_FILEMONIKER = 2,
        MKSYS_ANTIMONIKER = 3,
        MKSYS_ITEMMONIKER = 4,
        MKSYS_POINTERMONIKER = 5,
    //  MKSYS_URLMONIKER = 6,
        MKSYS_CLASSMONIKER = 7,
        MKSYS_OBJREFMONIKER = 8,
        MKSYS_SESSIONMONIKER = 9,
        MKSYS_LUAMONIKER = 10
    }MKSYS;


    typedef [v1_enum] enum tagMKREDUCE
    {
        MKRREDUCE_ONE           =   3<<16,

        MKRREDUCE_TOUSER        =   2<<16,
        MKRREDUCE_THROUGHUSER   =   1<<16,
        MKRREDUCE_ALL           =   0
    } MKRREDUCE;


    [local]
    HRESULT BindToObject(
        [in, unique] IBindCtx *pbc,
        [in, unique] IMoniker *pmkToLeft,
        [in] REFIID riidResult,
        [out, iid_is(riidResult)] void **ppvResult);

    [call_as(BindToObject)]
    HRESULT RemoteBindToObject(
        [in, unique] IBindCtx *pbc,
        [in, unique] IMoniker *pmkToLeft,
        [in] REFIID riidResult,
        [out, iid_is(riidResult)] IUnknown **ppvResult);

    [local]
    HRESULT BindToStorage(
        [in, unique] IBindCtx *pbc,
        [in, unique] IMoniker *pmkToLeft,
        [in] REFIID riid,
        [out, iid_is(riid)] void **ppvObj);

    [call_as(BindToStorage)]
    HRESULT RemoteBindToStorage(
        [in, unique] IBindCtx *pbc,
        [in, unique] IMoniker *pmkToLeft,
        [in] REFIID riid,
        [out, iid_is(riid)] IUnknown **ppvObj);

    HRESULT Reduce(
        [in, unique] IBindCtx *pbc,
        [in] DWORD dwReduceHowFar,
        [in, out, unique] IMoniker **ppmkToLeft,
        [out] IMoniker **ppmkReduced);

    HRESULT ComposeWith(
        [in, unique] IMoniker *pmkRight,
        [in] BOOL fOnlyIfNotGeneric,
        [out] IMoniker **ppmkComposite);

    HRESULT Enum(
        [in] BOOL fForward,
        [out] IEnumMoniker **ppenumMoniker);

    HRESULT IsEqual(
        [in, unique] IMoniker *pmkOtherMoniker);

    HRESULT Hash(
        [out] DWORD *pdwHash);

    HRESULT IsRunning(
        [in, unique] IBindCtx *pbc,
        [in, unique] IMoniker *pmkToLeft,
        [in, unique] IMoniker *pmkNewlyRunning);

    HRESULT GetTimeOfLastChange(
        [in, unique] IBindCtx *pbc,
        [in, unique] IMoniker *pmkToLeft,
        [out] FILETIME *pFileTime);

    HRESULT Inverse(
        [out] IMoniker **ppmk);

    HRESULT CommonPrefixWith(
        [in, unique] IMoniker *pmkOther,
        [out] IMoniker **ppmkPrefix);

    HRESULT RelativePathTo(
        [in, unique] IMoniker *pmkOther,
        [out] IMoniker **ppmkRelPath);

    HRESULT GetDisplayName(
        [in, unique] IBindCtx *pbc,
        [in, unique] IMoniker *pmkToLeft,
        [out] LPOLESTR *ppszDisplayName);

    HRESULT ParseDisplayName(
        [in, unique] IBindCtx *pbc,
        [in, unique] IMoniker *pmkToLeft,
        [in] LPOLESTR pszDisplayName,
        [out] ULONG *pchEaten,
        [out] IMoniker **ppmkOut);

    HRESULT IsSystemMoniker(
        [out] DWORD *pdwMksys);

}

[
    object,
    uuid(f29f6bc0-5021-11ce-aa15-00006901293f),
    pointer_default(unique)
]

interface IROTData : IUnknown
{
    HRESULT GetComparisonData(
        [out, size_is(cbMax)] byte *pbData,
        [in]  ULONG cbMax,
        [out] ULONG *pcbData);
}

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

interface IEnumString : IUnknown
{

    typedef [unique] IEnumString *LPENUMSTRING;

    [local]
    HRESULT Next(
        [in] ULONG celt,
        [annotation("__RPC__out_ecount_part(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);
}


/****************************************************************************
 *  Structured Storage Interfaces
 ****************************************************************************/

[
    object,
    uuid(0c733a30-2a1c-11ce-ade5-00aa0044773d),
    pointer_default(unique)
]
interface ISequentialStream : IUnknown
{
    [local]
    HRESULT Read(
        [annotation("__out_bcount_part(cb, *pcbRead)")]
        void *pv,
        [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_bcount(cb)")] void const *pv,
        [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 */

cpp_quote("//FSSpec is Macintosh only, defined in macos\files.h")

cpp_quote("#ifdef _MAC")

cpp_quote("    typedef struct tagSTATSTG")
cpp_quote("    {                      ")
cpp_quote("        LPOLESTR pwcsName;")
cpp_quote("            FSSpec *pspec;")
cpp_quote("        DWORD type;")
cpp_quote("        ULARGE_INTEGER cbSize;")
cpp_quote("        FILETIME mtime;")
cpp_quote("        FILETIME ctime;")
cpp_quote("        FILETIME atime;")
cpp_quote("        DWORD grfMode;")
cpp_quote("        DWORD grfLocksSupported;")
cpp_quote("        CLSID clsid;")
cpp_quote("        DWORD grfStateBits;")
cpp_quote("        DWORD reserved;")
cpp_quote("    } STATSTG;")

cpp_quote("#else //_MAC")

    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;

cpp_quote("#endif //_MAC")

    /* 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] 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,
    uuid(0000000d-0000-0000-C000-000000000046),
    pointer_default(unique)
]

interface IEnumSTATSTG : IUnknown
{

    typedef [unique] IEnumSTATSTG *LPENUMSTATSTG;

    [local]
    HRESULT Next(
        [in] ULONG celt,
        [annotation("__out_ecount_part(celt,*pceltFetched)")] STATSTG *rgelt,
        [annotation("__out_opt")] ULONG *pceltFetched);

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

    HRESULT Skip(
        [in] ULONG celt);

    HRESULT Reset();

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

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

interface IStorage : IUnknown
{

    typedef [unique] IStorage * LPSTORAGE;

    typedef struct tagRemSNB
    {
        unsigned long ulCntStr;
        unsigned long ulCntChar;
        [size_is(ulCntChar)] OLECHAR rgString[];
    } RemSNB;

    typedef [unique] RemSNB * wireSNB;
    typedef [wire_marshal(wireSNB)] LPOLESTR *SNB;

    HRESULT CreateStream(
        [in, string] const OLECHAR *pwcsName,
        [in] DWORD grfMode,
        [in] DWORD reserved1,
        [in] DWORD reserved2,
        [out] IStream **ppstm);

    [local]
    HRESULT OpenStream(
        [in, string] const OLECHAR *pwcsName,
        [in, unique] void *reserved1,
        [in] DWORD grfMode,
        [in] DWORD reserved2,
        [out] IStream **ppstm);

    [call_as(OpenStream)]
    HRESULT RemoteOpenStream(
        [in, string] const OLECHAR *pwcsName,
        [in] unsigned long cbReserved1,
        [in, unique, size_is(cbReserved1)] byte *reserved1,
        [in] DWORD grfMode,
        [in] DWORD reserved2,
        [out] IStream **ppstm);

    HRESULT CreateStorage(
        [in, string] const OLECHAR *pwcsName,
        [in] DWORD grfMode,
        [in] DWORD reserved1,
        [in] DWORD reserved2,
        [out] IStorage **ppstg);

    HRESULT OpenStorage(
        [in, unique, string] const OLECHAR *pwcsName,
        [in, unique] IStorage *pstgPriority,
        [in] DWORD grfMode,
        [in, unique] SNB snbExclude,
        [in] DWORD reserved,
        [out] IStorage **ppstg);

    [local]
    HRESULT CopyTo(
        [in] DWORD ciidExclude,
        [in, unique, size_is(ciidExclude)] IID const *rgiidExclude,
        [in, unique, annotation("__RPC__in_opt")] SNB snbExclude,
        [in, unique] IStorage *pstgDest);

    [call_as(CopyTo)]
    HRESULT RemoteCopyTo(
        [in] DWORD ciidExclude,
        [in, unique, size_is(ciidExclude) DISABLE_CONSISTENCY_CHK] IID const *rgiidExclude,
        [in, unique] SNB snbExclude,
        [in, unique] IStorage *pstgDest);

    HRESULT MoveElementTo(
        [in, string] const OLECHAR * pwcsName,
        [in, unique] IStorage *pstgDest,
        [in, string] const OLECHAR *pwcsNewName,
        [in] DWORD grfFlags);

    HRESULT Commit(
        [in] DWORD grfCommitFlags);

    HRESULT Revert();

    [local]
    HRESULT EnumElements(
        [in] DWORD reserved1,
        [in, unique, size_is(1)] void *reserved2,
        [in] DWORD reserved3,
        [out] IEnumSTATSTG **ppenum);


    [call_as(EnumElements)]
    HRESULT RemoteEnumElements(
        [in] DWORD reserved1,
        [in] unsigned long cbReserved2,
        [in, unique, size_is(cbReserved2)] byte *reserved2,
        [in] DWORD reserved3,
        [out] IEnumSTATSTG **ppenum);

    HRESULT DestroyElement(
        [in, string] const OLECHAR *pwcsName);

    HRESULT RenameElement(
        [in, string] const OLECHAR *pwcsOldName,
        [in, string] const OLECHAR *pwcsNewName);

    HRESULT SetElementTimes(
        [in, unique, string] const OLECHAR *pwcsName,
        [in, unique] FILETIME const *pctime,
        [in, unique] FILETIME const *patime,
        [in, unique] FILETIME const *pmtime);

    HRESULT SetClass(
        [in] REFCLSID clsid);

    HRESULT SetStateBits(
        [in] DWORD grfStateBits,
        [in] DWORD grfMask);

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




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

interface IPersistFile : IPersist
{

    typedef [unique] IPersistFile *LPPERSISTFILE;

    HRESULT IsDirty
    (
        void
    );

    HRESULT Load
    (
        [in] LPCOLESTR pszFileName,
        [in] DWORD dwMode
    );

    HRESULT Save
    (
        [in, unique] LPCOLESTR pszFileName,
        [in] BOOL fRemember
    );

    HRESULT SaveCompleted
    (
        [in, unique] LPCOLESTR pszFileName
    );

    HRESULT GetCurFile
    (
        [out] LPOLESTR *ppszFileName
    );
}

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

interface IPersistStorage : IPersist
{

    typedef [unique] IPersistStorage *LPPERSISTSTORAGE;

    HRESULT IsDirty
    (
        void
    );

    HRESULT InitNew
    (
        [in, unique] IStorage *pStg
    );

    HRESULT Load
    (
        [in, unique] IStorage *pStg
    );

    HRESULT Save
    (
        [in, unique] IStorage *pStgSave,
        [in] BOOL fSameAsLoad
    );

    HRESULT SaveCompleted
    (
        [in, unique] IStorage *pStgNew
    );

    HRESULT HandsOffStorage
    (
        void
    );
}

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

interface ILockBytes : IUnknown
{

    typedef [unique] ILockBytes *LPLOCKBYTES;

    [local]
    HRESULT ReadAt(
        [in] ULARGE_INTEGER ulOffset,
        [out, size_is(cb), length_is(*pcbRead), annotation("__out_bcount_part(cb, *pcbRead)")]
        void *pv,
        [in] ULONG cb,
        [out,annotation("__out_opt")] ULONG *pcbRead);

    [call_as(ReadAt)]
    HRESULT _stdcall RemoteReadAt(
        [in] ULARGE_INTEGER ulOffset,
        [out, size_is(cb), length_is(*pcbRead)]
        byte *pv,
        [in] ULONG cb,
        [out] ULONG *pcbRead);

    [local]
    HRESULT WriteAt(
        [in] ULARGE_INTEGER ulOffset,
        [in, size_is(cb), annotation("__in_bcount(cb)")] void const *pv,
        [in] ULONG cb,
        [out, annotation("__out_opt")] ULONG *pcbWritten);

    [call_as(WriteAt)]
    HRESULT RemoteWriteAt(
        [in] ULARGE_INTEGER ulOffset,
        [in, size_is(cb)] byte const *pv,
        [in] ULONG cb,
        [out] ULONG *pcbWritten);

    HRESULT Flush();

    HRESULT SetSize(
        [in] ULARGE_INTEGER cb);

    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);
}

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

interface IEnumFORMATETC : IUnknown
{

    typedef [unique] IEnumFORMATETC *LPENUMFORMATETC;


midl_pragma warning( disable: 2480 )
    typedef struct tagDVTARGETDEVICE {
        DWORD tdSize;
        WORD tdDriverNameOffset;
        WORD tdDeviceNameOffset;
        WORD tdPortNameOffset;
        WORD tdExtDevmodeOffset;
        [size_is(tdSize - sizeof(DWORD) - 4*sizeof(WORD))]
        BYTE tdData[];
    }DVTARGETDEVICE;
midl_pragma warning( default: 2480 )


    typedef CLIPFORMAT *LPCLIPFORMAT;

    typedef struct tagFORMATETC {
        CLIPFORMAT cfFormat;
        [unique] DVTARGETDEVICE * ptd;
        DWORD dwAspect;
        LONG lindex;
        DWORD tymed;
    }FORMATETC, *LPFORMATETC;

    [local]
    HRESULT Next(
        [in] ULONG celt,
        [annotation("__out_ecount_part(celt,*pceltFetched)")] FORMATETC *rgelt,
        [annotation("__out_opt")] ULONG *pceltFetched);

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

    HRESULT Skip(
        [in] ULONG celt);

    HRESULT Reset();

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

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

interface IEnumSTATDATA : IUnknown
{

    typedef [unique] IEnumSTATDATA *LPENUMSTATDATA;

    //Advise Flags
    typedef enum tagADVF
    {
        ADVF_NODATA = 1,
        ADVF_PRIMEFIRST = 2,
        ADVF_ONLYONCE = 4,
        ADVF_DATAONSTOP = 64,
        ADVFCACHE_NOHANDLER = 8,
        ADVFCACHE_FORCEBUILTIN = 16,
        ADVFCACHE_ONSAVE = 32
    } ADVF;


    // Stats for data; used by several enumerations and by at least one
    // implementation of IDataAdviseHolder; if a field is not used, it
    // will be NULL.

    typedef struct tagSTATDATA
    {                              // field used by:
        FORMATETC formatetc;       // EnumAdvise, EnumData (cache), EnumFormats
        DWORD advf;                // EnumAdvise, EnumData (cache)
        [unique] IAdviseSink * pAdvSink; // EnumAdvise
        DWORD dwConnection;        // EnumAdvise
    } STATDATA;
    typedef STATDATA *LPSTATDATA;

    [local]
    HRESULT Next(
        [in] ULONG celt,
        [annotation("__out_ecount_part(celt,*pceltFetched)")] STATDATA *rgelt,
        [annotation("__out_opt")] ULONG *pceltFetched);

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

    HRESULT Skip(
        [in] ULONG celt);

    HRESULT Reset();

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

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

interface IRootStorage : IUnknown
{

    typedef [unique] IRootStorage *LPROOTSTORAGE;

    HRESULT SwitchToFile
    (
        [in] LPOLESTR pszFile
    );
}


/****************************************************************************
 *  Notification Interfaces
 ****************************************************************************/

[
    object,
    uuid(0000010f-0000-0000-C000-000000000046),
#if (__midl >= 500)
    async_uuid(00000150-0000-0000-C000-000000000046),
#endif
    pointer_default(unique)
]

interface IAdviseSink : IUnknown
{

    typedef IAdviseSink *LPADVISESINK;

    typedef [v1_enum] enum tagTYMED {
        TYMED_HGLOBAL = 1,
        TYMED_FILE = 2,
        TYMED_ISTREAM = 4,
        TYMED_ISTORAGE = 8,
        TYMED_GDI = 16,
        TYMED_MFPICT = 32,
        TYMED_ENHMF = 64,
        TYMED_NULL = 0
    } TYMED;

    cpp_quote("#ifndef RC_INVOKED")
    cpp_quote("#if _MSC_VER >= 1200")
    cpp_quote("#pragma warning(push)")
    cpp_quote("#endif")
    cpp_quote("#pragma warning(disable:4200)")
    cpp_quote("#endif")

    typedef struct tagRemSTGMEDIUM {
        DWORD tymed;
        DWORD dwHandleType;
        unsigned long pData;
        unsigned long pUnkForRelease;
        unsigned long cbData;
        [size_is(cbData)] byte data[];
    } RemSTGMEDIUM;
    cpp_quote("#ifndef RC_INVOKED")
    cpp_quote("#if _MSC_VER >= 1200")
    cpp_quote("#pragma warning(pop)")
    cpp_quote("#else")
    cpp_quote("#pragma warning(default:4200)")
    cpp_quote("#endif")
    cpp_quote("#endif")


cpp_quote("#ifdef NONAMELESSUNION")
cpp_quote("typedef struct tagSTGMEDIUM {")
cpp_quote("    DWORD tymed;")
cpp_quote("    union {")
cpp_quote("        HBITMAP hBitmap;")
cpp_quote("        HMETAFILEPICT hMetaFilePict;")
cpp_quote("        HENHMETAFILE hEnhMetaFile;")
cpp_quote("        HGLOBAL hGlobal;")
cpp_quote("        LPOLESTR lpszFileName;")
cpp_quote("        IStream *pstm;")
cpp_quote("        IStorage *pstg;")
cpp_quote("        } u;")
cpp_quote("    IUnknown *pUnkForRelease;")
cpp_quote("}uSTGMEDIUM;")
cpp_quote("#else")

    typedef struct tagSTGMEDIUM {
    DWORD tymed;
    [switch_type(DWORD), switch_is((DWORD) tymed)]
        union
        {
        [case(TYMED_GDI)]
            HBITMAP hBitmap;
        [case(TYMED_MFPICT)]
            HMETAFILEPICT hMetaFilePict;
        [case(TYMED_ENHMF)]
            HENHMETAFILE hEnhMetaFile;
        [case(TYMED_HGLOBAL)]
            HGLOBAL hGlobal;
        [case(TYMED_FILE)]
            LPOLESTR lpszFileName;
        [case(TYMED_ISTREAM)]
            IStream *pstm;
        [case(TYMED_ISTORAGE)]
            IStorage *pstg;
        [default]
                ;
        } DUMMYUNIONNAME;
        [unique] IUnknown *pUnkForRelease;
    }uSTGMEDIUM;

cpp_quote("#endif /* !NONAMELESSUNION */")


//
//  wireSTGMEDIUM
//
// These flags are #defined (not enumerated) in wingdi.
// We need to repeat #defines to avoid conflict in the generated file.
//

/* Object Definitions for EnumObjects() */
#define OBJ_PEN             1
#define OBJ_BRUSH           2
#define OBJ_DC              3
#define OBJ_METADC          4
#define OBJ_PAL             5
#define OBJ_FONT            6
#define OBJ_BITMAP          7
#define OBJ_REGION          8
#define OBJ_METAFILE        9
#define OBJ_MEMDC           10
#define OBJ_EXTPEN          11
#define OBJ_ENHMETADC       12
#define OBJ_ENHMETAFILE     13

    typedef union _GDI_OBJECT switch( DWORD ObjectType ) u
    {
        case OBJ_BITMAP:    wireHBITMAP     hBitmap;
        case OBJ_PAL:       wireHPALETTE    hPalette;
        default:            wireHGLOBAL     hGeneric;
    } GDI_OBJECT;

    typedef struct _userSTGMEDIUM
    {
        union _STGMEDIUM_UNION switch( DWORD tymed ) u
        {
        case TYMED_NULL:        ;
        case TYMED_MFPICT:      wireHMETAFILEPICT   hMetaFilePict;
        case TYMED_ENHMF:       wireHENHMETAFILE    hHEnhMetaFile;
        case TYMED_GDI:         GDI_OBJECT *        hGdiHandle;
        case TYMED_HGLOBAL:     wireHGLOBAL         hGlobal;
        case TYMED_FILE:        LPOLESTR            lpszFileName;
        case TYMED_ISTREAM:     BYTE_BLOB *         pstm;
        case TYMED_ISTORAGE:    BYTE_BLOB *         pstg;
        } DUMMYUNIONNAME;
        IUnknown *              pUnkForRelease;
    } userSTGMEDIUM;

    typedef [unique] userSTGMEDIUM  * wireSTGMEDIUM;
    typedef [wire_marshal( wireSTGMEDIUM )] uSTGMEDIUM STGMEDIUM;

    typedef [unique] userSTGMEDIUM  * wireASYNC_STGMEDIUM;
    typedef [wire_marshal( wireASYNC_STGMEDIUM )] STGMEDIUM ASYNC_STGMEDIUM;

    typedef STGMEDIUM *LPSTGMEDIUM;

    typedef struct _userFLAG_STGMEDIUM
    {
        long                ContextFlags;
        long                fPassOwnership;
        userSTGMEDIUM       Stgmed;
    } userFLAG_STGMEDIUM;

    typedef [unique] userFLAG_STGMEDIUM  * wireFLAG_STGMEDIUM;

    typedef [wire_marshal( wireFLAG_STGMEDIUM )]
        struct _FLAG_STGMEDIUM
        {
                long                ContextFlags;
                long                fPassOwnership;
                STGMEDIUM           Stgmed;
        } FLAG_STGMEDIUM;


    [local]
    void OnDataChange(
        [in, unique] FORMATETC *pFormatetc,
        [in, unique] STGMEDIUM *pStgmed);

    [local]
    void OnViewChange(
        [in] DWORD dwAspect,
        [in] LONG lindex);

    [local]
    void OnRename(
        [in] IMoniker *pmk);

    [local]
    void OnSave();

    [local]
    void OnClose();

#if (__midl >= 500)
// Currently used temporary definitons.

    [call_as(OnDataChange)]
    HRESULT  RemoteOnDataChange(
        [in, unique] FORMATETC *pFormatetc,
        [in, unique] ASYNC_STGMEDIUM *pStgmed);

    [call_as(OnViewChange)]
    HRESULT  RemoteOnViewChange(
        [in] DWORD dwAspect,
        [in] LONG lindex);

    [call_as(OnRename)]
    HRESULT  RemoteOnRename(
        [in] IMoniker *pmk);

    [call_as(OnSave)]
    HRESULT  RemoteOnSave(
        );
#elif (__midl > 302)
// Currently used temporary definitons.

    [call_as(OnDataChange), async]
    HRESULT  RemoteOnDataChange(
        [in] IAsyncManager **ppIAM,
        [in, unique] FORMATETC *pFormatetc,
        [in, unique] ASYNC_STGMEDIUM *pStgmed);

    [call_as(OnViewChange), async]
    HRESULT  RemoteOnViewChange(
        [in] IAsyncManager **ppIAM,
        [in] DWORD dwAspect,
        [in] LONG lindex);

    [call_as(OnRename), async]
    HRESULT  RemoteOnRename(
        [in] IAsyncManager **ppIAM,
        [in] IMoniker *pmk);

    [call_as(OnSave), async]
    HRESULT  RemoteOnSave(
        [in] IAsyncManager **ppIAM
        );
#else
// Old definitions kept for convenience.

    [call_as(OnDataChange), async]
    void RemoteOnDataChange(
        [in, unique] FORMATETC *pFormatetc,
        [in, unique] ASYNC_STGMEDIUM *pStgmed);

    [call_as(OnViewChange), async]
    void RemoteOnViewChange(
        [in] DWORD dwAspect,
        [in] LONG lindex);

    [call_as(OnRename), async]
    void RemoteOnRename(
        [in] IMoniker *pmk);

    [call_as(OnSave), async]
    void RemoteOnSave();

#endif  // MIDL > 302

    [call_as(OnClose)]
    HRESULT RemoteOnClose();
}

[
    object,
    uuid(00000125-0000-0000-C000-000000000046),
#if (__midl >= 500)
    async_uuid(00000151-0000-0000-C000-000000000046),
#endif
    pointer_default(unique)
]

interface IAdviseSink2 : IAdviseSink
{

    typedef [unique] IAdviseSink2 *LPADVISESINK2;

    [local]
    void OnLinkSrcChange(
        [in, unique] IMoniker *pmk);

#if (__midl >= 500)
// Currently used temporary definiton

    [call_as(OnLinkSrcChange)]
    HRESULT RemoteOnLinkSrcChange(
        [in, unique] IMoniker *pmk);
#elif (__midl > 302)
// Currently used temporary definiton

    [call_as(OnLinkSrcChange), async]
    HRESULT RemoteOnLinkSrcChange(
        [in] IAsyncManager **ppIAM,
        [in, unique] IMoniker *pmk);
#else
// Old one for convenience.
    [call_as(OnLinkSrcChange), async]
    void RemoteOnLinkSrcChange(
        [in, unique] IMoniker *pmk);
#endif
}

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

interface IDataObject : IUnknown
{

    typedef [unique] IDataObject *LPDATAOBJECT;

    //DATA format DIRection
    typedef enum tagDATADIR
    {
        DATADIR_GET = 1,
        DATADIR_SET = 2
    } DATADIR;

    [local]
    HRESULT GetData(
        [in, unique] FORMATETC *pformatetcIn,
        [out] STGMEDIUM *pmedium);

    [call_as(GetData)]
    HRESULT RemoteGetData(
        [in, unique] FORMATETC *pformatetcIn,
        [out] STGMEDIUM *pRemoteMedium);

    [local]
    HRESULT GetDataHere(
        [in, unique] FORMATETC *pformatetc,
        [in, out] STGMEDIUM *pmedium);

    [call_as(GetDataHere)]
    HRESULT RemoteGetDataHere(
        [in, unique] FORMATETC *pformatetc,
        [in, out] STGMEDIUM *pRemoteMedium);

    HRESULT QueryGetData(
        [in, unique] FORMATETC *pformatetc);


    HRESULT GetCanonicalFormatEtc(
        [in, unique] FORMATETC *pformatectIn,
        [out] FORMATETC *pformatetcOut);

    [local]
    HRESULT SetData(
        [in, unique] FORMATETC *pformatetc,
        [in, unique] STGMEDIUM *pmedium,
        [in] BOOL fRelease);

    [call_as(SetData)]
    HRESULT RemoteSetData(
        [in, unique] FORMATETC *pformatetc,
        [in, unique] FLAG_STGMEDIUM *pmedium,
        [in] BOOL fRelease);

    HRESULT EnumFormatEtc(
        [in] DWORD dwDirection,
        [out] IEnumFORMATETC **ppenumFormatEtc);

    HRESULT DAdvise(
        [in] FORMATETC *pformatetc,
        [in] DWORD advf,
        [in, unique] IAdviseSink *pAdvSink,
        [out] DWORD *pdwConnection);

    HRESULT DUnadvise(
        [in] DWORD dwConnection);

    HRESULT EnumDAdvise(
        [out] IEnumSTATDATA **ppenumAdvise);

}

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

interface IDataAdviseHolder : IUnknown
{

    typedef [unique] IDataAdviseHolder *LPDATAADVISEHOLDER;

    HRESULT Advise
    (
        [in, unique, annotation("__in_opt")] IDataObject *pDataObject,
        [in, unique, annotation("__in")] FORMATETC *pFetc,
        [in, annotation("__in")] DWORD advf,
        [in, unique, annotation("__in")] IAdviseSink *pAdvise,
        [out, annotation("__out")] DWORD *pdwConnection
    );

    HRESULT Unadvise
    (
        [in, annotation("__in")] DWORD dwConnection
    );

    HRESULT EnumAdvise
    (
        [out, annotation("__deref_out")] IEnumSTATDATA **ppenumAdvise
    );

    HRESULT SendOnDataChange
    (
        [in, unique, annotation("__in")] IDataObject *pDataObject,
        [in, annotation("__reserved")] DWORD dwReserved,
        [in, annotation("__in")] DWORD advf
    );

}

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

interface IMessageFilter : IUnknown
{

    typedef [unique] IMessageFilter *LPMESSAGEFILTER;

// call type used by IMessageFilter::HandleIncomingMessage
typedef enum tagCALLTYPE
{
    CALLTYPE_TOPLEVEL = 1,      // toplevel call - no outgoing call
    CALLTYPE_NESTED   = 2,      // callback on behalf of previous outgoing call - should always handle
    CALLTYPE_ASYNC    = 3,      // aysnchronous call - can NOT be rejected
    CALLTYPE_TOPLEVEL_CALLPENDING = 4,  // new toplevel call with new LID
    CALLTYPE_ASYNC_CALLPENDING    = 5   // async call - can NOT be rejected
} CALLTYPE;

// status of server call - returned by IMessageFilter::HandleIncomingCall
// and passed to  IMessageFilter::RetryRejectedCall
typedef enum tagSERVERCALL
{
    SERVERCALL_ISHANDLED    = 0,
    SERVERCALL_REJECTED     = 1,
    SERVERCALL_RETRYLATER   = 2
} SERVERCALL;

// Pending type indicates the level of nesting
typedef enum tagPENDINGTYPE
{
    PENDINGTYPE_TOPLEVEL = 1, // toplevel call
    PENDINGTYPE_NESTED   = 2  // nested call
} PENDINGTYPE;

// return values of MessagePending
typedef enum tagPENDINGMSG
{
    PENDINGMSG_CANCELCALL  = 0, // cancel the outgoing call
    PENDINGMSG_WAITNOPROCESS  = 1, // wait for the return and don't dispatch the message
    PENDINGMSG_WAITDEFPROCESS = 2  // wait and dispatch the message

} PENDINGMSG;

// additional interface information about the incoming call
typedef struct tagINTERFACEINFO
{
    IUnknown    *pUnk;      // the pointer to the object
    IID         iid;        // interface id
    WORD        wMethod;    // interface method
} INTERFACEINFO, *LPINTERFACEINFO;

    DWORD HandleInComingCall
    (
        [in, annotation("__in")] DWORD dwCallType,
        [in, annotation("__in")] HTASK htaskCaller,
        [in, annotation("__in")] DWORD dwTickCount,
        [in, annotation("__in_opt")] LPINTERFACEINFO lpInterfaceInfo
    );

    DWORD RetryRejectedCall
    (
        [in, annotation("__in")] HTASK htaskCallee,
        [in, annotation("__in")] DWORD dwTickCount,
        [in, annotation("__in")] DWORD dwRejectType
    );

    DWORD MessagePending
    (
        [in, annotation("__in")] HTASK htaskCallee,
        [in, annotation("__in")] DWORD dwTickCount,
        [in, annotation("__in")] DWORD dwPendingType
    );
}


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

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

    typedef unsigned long 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("__deref_out_opt")] void **ppvDestContext
    );

    HRESULT IsConnected
    (
        void
    );

}

[
    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("__deref_out")] 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("__deref_out")] void **pInterface
    );

    HRESULT GetDestCtxEx
    (
        [in, annotation("__in")] RPCOLEMESSAGE *pMsg,
        [out, annotation("__out")] DWORD *pdwDestContext,
        [out, annotation("__deref_out")] 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
    );

}

[
    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("__deref_out")] 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("__deref_out")] IRpcProxyBuffer **ppProxy,
        [out, annotation("__deref_out")] void **ppv
    );

    HRESULT CreateStub
    (
        [in, annotation("__in")] REFIID riid,
        [in, unique, annotation("__in_opt")] IUnknown *pUnkServer,
        [out, annotation("__deref_out")] IRpcStubBuffer **ppStub
    );
}

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("")
cpp_quote("// Well-known Property Set Format IDs")
extern const FMTID FMTID_SummaryInformation;
extern const FMTID FMTID_DocSummaryInformation;
extern const FMTID FMTID_UserDefinedProperties;
extern const FMTID FMTID_DiscardableInformation;
extern const FMTID FMTID_ImageSummaryInformation;
extern const FMTID FMTID_AudioSummaryInformation;
extern const FMTID FMTID_VideoSummaryInformation;
extern const FMTID FMTID_MediaFileSummaryInformation;


/****************************************************************************
 *  Connection Point Interfaces
 ****************************************************************************/
#ifdef __INCLUDE_CPIFS
interface IConnectionPointContainer;
interface IConnectionPoint;
interface IEnumConnections;
interface IEnumConnectionPoints;

[
    object,
    uuid(B196B286-BAB4-101A-B69C-00AA00341D07),
    pointer_default(unique)
]
interface IConnectionPoint : IUnknown
{
    typedef IConnectionPoint * PCONNECTIONPOINT;
    typedef IConnectionPoint * LPCONNECTIONPOINT;

    HRESULT GetConnectionInterface
    (
        [out]           IID * piid
    );

    HRESULT GetConnectionPointContainer
    (
        [out]           IConnectionPointContainer ** ppCPC
    );

    HRESULT Advise
    (
        [in]    IUnknown * pUnkSink,
        [out]   DWORD *    pdwCookie
    );

    HRESULT Unadvise
    (
        [in]    DWORD dwCookie
    );

    HRESULT EnumConnections
    (
        [out]   IEnumConnections ** ppEnum
    );
}

[
    object,
    uuid(B196B284-BAB4-101A-B69C-00AA00341D07),
    pointer_default(unique)
]
interface IConnectionPointContainer : IUnknown
{
    typedef IConnectionPointContainer * PCONNECTIONPOINTCONTAINER;
    typedef IConnectionPointContainer * LPCONNECTIONPOINTCONTAINER;

    HRESULT EnumConnectionPoints
    (
        [out]   IEnumConnectionPoints ** ppEnum
    );

    HRESULT FindConnectionPoint
    (
        [in]    REFIID riid,
        [out]   IConnectionPoint ** ppCP
    );
}


[
    object,
    uuid(B196B287-BAB4-101A-B69C-00AA00341D07),
    pointer_default(unique)
]
interface IEnumConnections : IUnknown
{
    typedef IEnumConnections * PENUMCONNECTIONS;
    typedef IEnumConnections * LPENUMCONNECTIONS;

    typedef struct tagCONNECTDATA
    {
        IUnknown *  pUnk;
        DWORD       dwCookie;
    } CONNECTDATA;

    typedef struct tagCONNECTDATA * PCONNECTDATA;
    typedef struct tagCONNECTDATA * LPCONNECTDATA;

    [local]
    HRESULT Next(
        [in, annotation("__in")]    ULONG           cConnections,
        [annotation("__out_ecount_part(cConnections, *lpcFetched)")]
                                    CONNECTDATA *   rgcd,
        [annotation("__out_opt")]   ULONG *         lpcFetched
    );

    [call_as(Next)]
    HRESULT RemoteNext(
        [in]                            ULONG           cConnections,
        [out,
         size_is(cConnections),
         length_is(*lpcFetched)]        CONNECTDATA *   rgcd,
        [out]                           ULONG *         lpcFetched
    );

    HRESULT Skip
    (
        [in]    ULONG cConnections
    );

    HRESULT Reset
    (
        void
    );

    HRESULT Clone
    (
        [out]   IEnumConnections ** ppEnum
    );
}


[
    object,
    uuid(B196B285-BAB4-101A-B69C-00AA00341D07),
    pointer_default(unique)
]
interface IEnumConnectionPoints : IUnknown
{
    typedef IEnumConnectionPoints * PENUMCONNECTIONPOINTS;
    typedef IEnumConnectionPoints * LPENUMCONNECTIONPOINTS;

    [local]
    HRESULT Next(
        [in, annotation("__in")]    ULONG               cConnections,
        [annotation("__out_ecount_part(cConnections,*lpcFetched)")]
                                    IConnectionPoint ** rgpcn,
        [annotation("__out_opt")]   ULONG *             lpcFetched
    );

    [call_as(Next)]
    HRESULT RemoteNext(
        [in]                        ULONG               cConnections,
        [out,
         size_is(cConnections),
         length_is(*lpcFetched)]    IConnectionPoint ** rgpcn,
        [out]                       ULONG *             lpcFetched
    );

    HRESULT Skip
    (
        [in]    ULONG   cConnections
    );

    HRESULT Reset
    (
        void
    );

    HRESULT Clone
    (
        [out]   IEnumConnectionPoints **    ppEnum
    );
}
#endif // __INCLUDE_CPIFS


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

[
    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_NO_CUSTOM_MARSHAL = 0x2000,
        EOAC_DISABLE_AAA       = 0x1000
    } EOLE_AUTHENTICATION_CAPABILITIES;

    const OLECHAR *COLE_DEFAULT_PRINCIPAL = (OLECHAR *) -1;
    const void    *COLE_DEFAULT_AUTHINFO  = (void *) -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("__deref_out_opt")] 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("__deref_out")] IUnknown **ppCopy
    );
}

[
    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("__deref_out_opt")] void   **pPrivs,
        [in,out, annotation("__inout_opt")] DWORD    *pCapabilities
    );

    HRESULT ImpersonateClient();

    HRESULT RevertToSelf();

    BOOL IsImpersonating();
}

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

interface IClassActivator : IUnknown
{
    HRESULT GetClassObject(
        [in] REFCLSID rclsid,
        [in] DWORD dwClassContext,
        [in] LCID locale,
        [in] REFIID riid,
        [out, iid_is(riid)] void **ppv);
}

typedef enum tagRPCOPT_PROPERTIES
{
   COMBND_RPCTIMEOUT = 0x01, // Rpc transport-specific timeout.
   COMBND_SERVER_LOCALITY = 0x02 // server locality
} 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("__deref_out")] ULONG_PTR * pdwValue);
}

//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.
} 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;


[
    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("__deref_out")] ULONG_PTR * pdwValue);
}


cpp_quote( "#endif //DCOM" )


[
    object,
    uuid(99caf010-415e-11cf-8814-00aa00b569f5),
    pointer_default(unique)
]

interface IFillLockBytes: IUnknown
{
    [local]
    HRESULT FillAppend
    (
        [in, size_is(cb), annotation("__in_bcount(cb)")] void const *pv,
        [in, annotation("__in")] ULONG cb,
        [out, annotation("__out")] ULONG *pcbWritten
    );

    [call_as(FillAppend)]
    HRESULT _stdcall RemoteFillAppend(
        [in, size_is(cb)] byte const *pv,
        [in] ULONG cb,
        [out] ULONG *pcbWritten);

    [local]
    HRESULT FillAt
    (
        [in, annotation("__in")] ULARGE_INTEGER ulOffset,
        [in, size_is(cb), annotation("__in_bcount(cb)")] void const *pv,
        [in, annotation("__in")] ULONG cb,
        [out, annotation("__out")] ULONG *pcbWritten
    );

    [call_as(FillAt)]
    HRESULT _stdcall RemoteFillAt(
        [in] ULARGE_INTEGER ulOffset,
        [in, size_is(cb)] byte const *pv,
        [in] ULONG cb,
        [out] ULONG *pcbWritten);

    HRESULT SetFillSize
    (
        [in] ULARGE_INTEGER ulSize
    );

    HRESULT Terminate
    (
        [in] BOOL bCanceled
    );
}


[
    object,
    uuid(a9d758a0-4617-11cf-95fc-00aa00680db4),
    pointer_default(unique)
]

interface IProgressNotify: IUnknown
{
    HRESULT OnProgress
    (
        [in] DWORD dwProgressCurrent,
        [in] DWORD dwProgressMaximum,
        [in] BOOL  fAccurate,
        [in] BOOL  fOwner
    );
}


[
    local,
    object,
    uuid(0e6d4d90-6738-11cf-9608-00aa00680db4),
    pointer_default(unique)
]

interface ILayoutStorage: IUnknown
{
        typedef struct tagStorageLayout
        {
            DWORD LayoutType;
            OLECHAR *pwcsElementName;
            LARGE_INTEGER cOffset;
            LARGE_INTEGER cBytes;
        } StorageLayout;

        HRESULT __stdcall LayoutScript
        (
            [in, annotation("__in_ecount(nEntries)")] StorageLayout *pStorageLayout,
            [in, annotation("__in")] DWORD nEntries,
            [in, annotation("__reserved")] DWORD glfInterleavedFlag
        );
        HRESULT __stdcall BeginMonitor(void);

        HRESULT __stdcall EndMonitor(void);

        HRESULT __stdcall ReLayoutDocfile
        (
            [in, annotation("__RPC__in")] OLECHAR *pwcsNewDfName
        );

        HRESULT __stdcall ReLayoutDocfileOnILockBytes
        (
            [in, annotation("__in")] ILockBytes *pILockBytes
        );


}




[
 object,
 uuid(30f3d47a-6447-11d1-8e3c-00c04fb9386d)
]
interface IBlockingLock: IUnknown
{
        HRESULT Lock([in] DWORD dwTimeout);

        HRESULT Unlock(void);
}


[
 object,
 uuid(bc0bf6ae-8878-11d1-83e9-00c04fc2c6d4)
]
interface ITimeAndNoticeControl: IUnknown
{
        HRESULT SuppressChanges([in] DWORD res1,
                                [in] DWORD res2);

}



[
 object,
 uuid(8d19c834-8879-11d1-83e9-00c04fc2c6d4)
]
interface IOplockStorage: IUnknown
{
        HRESULT CreateStorageEx([in] LPCWSTR pwcsName,
                                [in] DWORD grfMode,
                                [in] DWORD stgfmt,
                                [in] DWORD grfAttrs,
                                [in] REFIID riid,
                                [out, iid_is(riid)] void**ppstgOpen);

        HRESULT OpenStorageEx([in] LPCWSTR pwcsName,
                              [in] DWORD grfMode,
                              [in] DWORD stgfmt,
                              [in] DWORD grfAttrs,
                              [in] REFIID riid,
                              [out, iid_is(riid)] void**ppstgOpen);
}



[
 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("__deref_out")] void **ppv
    );
};


[
    object,
    uuid(0e6d4d92-6738-11cf-9608-00aa00680db4),
    pointer_default(unique)
]

interface IDirectWriterLock : IUnknown
{

    HRESULT WaitForWriteAccess ([in] DWORD dwTimeout);

    HRESULT ReleaseWriteAccess ();

    HRESULT HaveWriteAccess ();

}

[
    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("__deref_out")] 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("__deref_out")] 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("__deref_out")] 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("__deref_out")] 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("__deref_out")] ISynchronize **pSync );
    HRESULT AddSynchronize( [in, annotation("__in")] ISynchronize *pSync );
}


[
 object,
 uuid(00000026-0000-0000-C000-000000000046)
]
interface IUrlMon : IUnknown
{
    HRESULT AsyncGetClassBits(
        [in]         REFCLSID   rclsid,
        [in, unique] LPCWSTR    pszTYPE,
        [in, unique] LPCWSTR    pszExt,
        [in]         DWORD      dwFileVersionMS,
        [in]         DWORD      dwFileVersionLS,
        [in, unique] LPCWSTR    pszCodeBase,
        [in]         IBindCtx * pbc,
        [in]         DWORD      dwClassContext,
        [in]         REFIID     riid,
        [in]         DWORD      flags);
}

[
local,
object,
uuid(00000145-0000-0000-C000-000000000046)
]
interface IForegroundTransfer : IUnknown
{
    HRESULT AllowForegroundTransfer(
        [in, annotation("__reserved")] void *lpvReserved);
}

[
    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("__deref_out")]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)



/****************************************************************************
* Thumbnail generator interface
****************************************************************************/

[uuid(969dc708-5c76-11d1-8d86-0000f804b057),
    object
]
interface IThumbnailExtractor : IUnknown
{
    HRESULT ExtractThumbnail (
        [in] IStorage *pStg,
        [in] ULONG ulLength,
        [in] ULONG ulHeight,
        [out] ULONG *pulOutputLength,
        [out] ULONG *pulOutputHeight,
        [out] HBITMAP *phOutputBitmap
        );


    HRESULT OnFileUpdated (
        [in] IStorage *pStg
        );
}

/****************************************************************************
* Dummy Interface to force inclusion of HICON and HDC in proxy/stub code....
****************************************************************************/

[
    object,
    pointer_default(unique),
    uuid(947990de-cc28-11d2-a0f7-00805f858fb1)
]
interface IDummyHICONIncluder : IUnknown
{
        HRESULT Dummy([in]HICON h1, [in] HDC h2);
}

/****************************************************************************
* Context related structures and interfaces
****************************************************************************/
cpp_quote("#if defined USE_COM_CONTEXT_DEF || defined BUILDTYPE_COMSVCS || 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_ecount_part(celt, *pceltFetched)")] 
                          ContextProperty *pContextProperties,
                 [out, annotation("__out")] ULONG *pceltFetched);
    HRESULT Skip([in, annotation("__in")] ULONG celt);
    HRESULT Reset();
    HRESULT Clone([out, annotation("__deref_out")] 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("__deref_out")] IUnknown **ppUnk);
    HRESULT EnumContextProps([out, annotation("__deref_out")] 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 _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")

/****************************************************************************
 *                         Surrogate Types				                    *
 ****************************************************************************/

//
// ApplicationType
//
typedef enum tagApplicationType 
{ 
	ServerApplication, 
	LibraryApplication 
} ApplicationType;

//
// ShutdownType
//
typedef enum tagShutdownType 
{ 
	IdleShutdown, 
	ForcedShutdown
} ShutdownType;


/****************************************************************************
 *                         Surrogate Services Interfaces                    *
 ****************************************************************************/

//
// IProcessLock
//
[
    object,
	local,
    uuid(000001d5-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IProcessLock : IUnknown
{
	ULONG AddRefOnProcess();
	ULONG ReleaseRefOnProcess();
}


//
// ISurrogateService
//
[
    object,
    local,
    uuid(000001d4-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface ISurrogateService : IUnknown
{
        HRESULT Init( [in, annotation("__in")] REFGUID rguidProcessID,
                      [in, annotation("__in")] IProcessLock* pProcessLock,
                      [out, annotation("__out")] BOOL* pfApplicationAware );
        HRESULT ApplicationLaunch( [in, annotation("__in")] REFGUID rguidApplID, 
                                   [in, annotation("__in")] ApplicationType appType );
        HRESULT ApplicationFree( [in, annotation("__in")] REFGUID rguidApplID );
        HRESULT CatalogRefresh( [in, annotation("__reserved")] ULONG ulReserved );
        HRESULT ProcessShutdown( [in, annotation("__in")] ShutdownType shutdownType );
}

/****************************************************************************
* 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;


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

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);
};

cpp_quote( "#if  (_WIN32_WINNT >= 0x0501 )" )

[
    local,
    object,
    uuid(00000034-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IInitializeSpy : IUnknown
{
   typedef [unique] IInitializeSpy *LPINITIALIZESPY;

   HRESULT PreInitialize(
       [in, annotation("__in")] DWORD dwCoInit, 
       [in, annotation("__in")] DWORD dwCurThreadAptRefs);
   HRESULT PostInitialize(
       [in, annotation("__in")] HRESULT hrCoInit, 
       [in, annotation("__in")] DWORD dwCoInit, 
       [in, annotation("__in")] DWORD dwNewThreadAptRefs);
   HRESULT PreUninitialize([in, annotation("__in")] DWORD dwCurThreadAptRefs);
   HRESULT PostUninitialize([in, annotation("__in")] DWORD dwNewThreadAptRefs);
};

cpp_quote( "#endif" )

#ifdef COMBOX_SANDBOX

[
    object,
    uuid(ACF3F4F7-5D11-4ce9-BCD9-5E3828CB8830),
    pointer_default(unique)
]
interface ISurrogateServer : IUnknown
{
	typedef [unique] ISurrogateServer * LPSURROGATESERVER;

	HRESULT GetProcessId
	(
		[out] DWORD *pdwProcId
	);
}

typedef enum {
    SURROGATE_NOTIFY_GET_RESTRICTED_TOK,
	SURROGATE_NOTIFY_CREATE,
	SURROGATE_NOTIFY_TERMINATE,
	SURROGATE_NOTIFY_FAULT,
	SURROGATE_NOTIFY_HANG,
	SURROGATE_NOTIFY_SHIM
} SURROGATE_NOTIFICATION;

typedef enum {
    ISCLR_UNINITIALIZED,
    ISCLR_SANDBOX,
    ISCLR_CONTINUE_IN_PROC
} LOAD_MODE;

typedef struct {
    DWORD Flags;
    DWORD DisableSidCount;
    PSID_AND_ATTRIBUTES SidsToDisable;
    DWORD DeletePrivilegeCount;
    void *PrivilegesToDelete;
    DWORD RestrictedSidCount;
    PSID_AND_ATTRIBUTES SidsToRestrict;
} RESTRICTED_TOK_FIELDS;

[
    object,
    uuid(6066AC88-B1E4-4796-9024-F8950A1C5B18),
    pointer_default(unique)
]
interface ISurrogateClient : IUnknown
{
    typedef [unique] ISurrogateClient * LPSURROGATECLIENT;

    HRESULT LoadRequest
    (
        [in]  LPWSTR            dllPath,
        [in]  GUID              clsGuid,
        [in, out] LOAD_MODE         *loadMode,
        [in, out] LPSURROGATESERVER *ppSurrogateServer
    );

    HRESULT SurrogateCallback
    (
        [in] SURROGATE_NOTIFICATION snEvent, 
        [in, unique] LPSURROGATESERVER pSurrogateServer,
        [in, out, unique, size_is(pbSize)] byte *pb,
        [in] UINT pbSize
    );
}

[
    object,
    local,
    uuid(0000015C-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface ISurrogateManager : IUnknown
{
    HRESULT RegisterSurrogateClient
    (
        [in, annotation("__in")] LPSURROGATECLIENT pSurrClient
    );

    HRESULT RevokeSurrogateClient
    (
        [in, annotation("__in")] LPSURROGATECLIENT pSurrClient
    );

    HRESULT CreateSurrogateServer
    (
        [out, annotation("__deref_out")] LPSURROGATESERVER *ppSurrServer
    );
}

#endif // COMBOX_SANDBOX

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")















