//+------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1992 - 1995.
//
//  File:   remunk.idl
//
//  The remote version of IUnknown.  This interface exists on every
//  object that is exported.  It is used by clients to query for new
//  interfaces, get additional references (for marshalling), and release
//  outstanding references.
//
//+-------------------------------------------------------------------------
#ifndef DO_NO_IMPORTS
    import "unknwn.idl";
    import "obase.idl";
#endif
typedef struct tagREMQIRESULT
{
    HRESULT         hResult;
    STDOBJREF       std;
} REMQIRESULT;
typedef struct tagREMINTERFACEREF
{
    IPID            ipid;
    unsigned long   cPublicRefs;
    unsigned long   cPrivateRefs;
} REMINTERFACEREF;

    
    
[
    object,
    uuid(00000131-0000-0000-C000-000000000046)

]

interface IRemUnknown : IUnknown
{
    HRESULT RemQueryInterface
    (
        [in] REFIPID                ripid,
        [in] unsigned long          cRefs,
        [in] unsigned short         cIids,
        [in, size_is(cIids)] IID   *iids,
        [out, size_is(,cIids)] REMQIRESULT **ppQIResults
    );

    HRESULT RemAddRef
    (
        [in] unsigned short cInterfaceRefs,
        [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[],
        [out, size_is(cInterfaceRefs)] HRESULT *pResults
    );

    HRESULT RemRelease
    (
        [in] unsigned short cInterfaceRefs,
        [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[]
    );
}


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

interface AsyncIRemUnknown : IUnknown
{

    HRESULT Begin_RemQueryInterface
    (
        [in] REFIPID                ripid,
        [in] unsigned long          cRefs,
        [in] unsigned short         cIids,
        [in] IID   *iids
    );
    
    HRESULT Finish_RemQueryInterface
    (
        [out] REMQIRESULT **ppQIResults
    );


    HRESULT Begin_RemAddRef
    (
        [in] unsigned short cInterfaceRefs,
        [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[]
    );
    HRESULT Finish_RemAddRef
    (
        [out] HRESULT *pResults
    );


    HRESULT Begin_RemRelease
    (
        [in] unsigned short cInterfaceRefs,
        [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[]
    );
    
    HRESULT Finish_RemRelease();
};


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

interface AsyncIRemUnknown2 : IUnknown
{

    HRESULT Begin_RemQueryInterface
    (
        [in] REFIPID                ripid,
        [in] unsigned long          cRefs,
        [in] unsigned short         cIids,
        [in] IID   *iids
    );
    
    HRESULT Finish_RemQueryInterface
    (
        [out] REMQIRESULT **ppQIResults
    );


    HRESULT Begin_RemAddRef
    (
        [in] unsigned short cInterfaceRefs,
        [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[]
    );
    HRESULT Finish_RemAddRef
    (
        [out] HRESULT *pResults
    );


    HRESULT Begin_RemRelease
    (
        [in] unsigned short cInterfaceRefs,
        [in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[]
    );
    
    HRESULT Finish_RemRelease();
    
    HRESULT Begin_RemQueryInterface2
    (
        [in] REFIPID                            ripid,
        [in] unsigned short                     cIids,
        [in, size_is(cIids)] IID                *iids
    );

    HRESULT Finish_RemQueryInterface2(
        [out] HRESULT           *phr,
        [out] MInterfacePointer **ppMIF
    );
};
 

[
    object,
    uuid(00000143-0000-0000-C000-000000000046),

]
//+-------------------------------------------------------------------------
//
//  IRemUnknown2
//
//  Derived from IRemUnknown, this interface supports Remote Query interface
//  for objects that supply additional data beyond the STDOBJREF in their
//  marshaled interface packets.
//
//  The ppMIF that is returned contains an array of marshaled interface
//  pointers, without the headers that CoMarshalInterface adds.
//
//+-------------------------------------------------------------------------
interface IRemUnknown2 : IRemUnknown
{
#ifndef DO_NO_IMPORTS
    import "unknwn.idl";
    import "obase.idl";
#endif

    HRESULT RemQueryInterface2
    (
        [in] REFIPID                            ripid,
        [in] unsigned short                     cIids,
        [in, size_is(cIids)] IID                *iids,
        [out, size_is(cIids)] HRESULT           *phr,
        [out, size_is(cIids)] MInterfacePointer **ppMIF
    );
}


//+-------------------------------------------------------------------------
//
//  The IRemoteQI interface.  This interface exists on every static
//  object.  It is used by clients to query for new and non-statically
//  published interfaces only. It does not do addref and release like
//  IRemUnknown.
//
//+-------------------------------------------------------------------------
[
    object,
    uuid(00000142-0000-0000-C000-000000000046)
]

interface IRemoteQI : IUnknown
{
#ifndef DO_NO_IMPORTS
    import "unknwn.idl";
    import "obase.idl";
#endif

    typedef struct tagREMOTEQIRESULT
    {
        HRESULT         hResult;
        IPID            ipid;
    } REMOTEQIRESULT;

    HRESULT RemoteQI
    (
        [in] unsigned short         cIids,
        [in, size_is(cIids)] IID   *iids,
        [out, size_is(,cIids)] REMOTEQIRESULT **ppQIResults
    );
}
