//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1998.
//
//  File:
//      activate.idl
//
//  Contents:
//      Definition of (currently) private COM system activation interface.
//
//  History:
//              VinayKr     01-16-98        Created(actprops)
//              SatishT     01-23-98        Added property interfaces
//              SatishT     02-03-98        Separated
//              vinaykr     02-20-98        Created privact,
//                                          distilled actprops/merged
//
//--------------------------------------------------------------------------

#ifndef DO_NO_IMPORTS
import "obase.idl";
import "wtypes.idl";
import "objidl.idl";
#ifdef RAW
import "iface.idl";
#endif
#endif


#ifndef RAW
import "activate.idl";
typedef struct _PRIV_SCM_INFO
{
    long            Apartment;
    [string] WCHAR *pwszWinstaDesktop;
    ULONG64         ProcessSignature;
    [size_is(EnvBlockLength)]
    WCHAR *         pEnvBlock;
    DWORD           EnvBlockLength;
} PRIV_SCM_INFO;

/**     This is for output activation properties       **/
/**     Must be identical to PRIV_RESOLVER_INFO in actprops.idl  **/
typedef struct _PRIV_RESOLVER_INFO
{
    OXID                      OxidServer;
    DUALSTRINGARRAY *         pServerORBindings;
    OXID_INFO                 OxidInfo;
    MID                       LocalMidOfRemote;
    DWORD                     DllServerModel;
    [string] WCHAR *          pwszDllServer;
    BOOL                      FoundInROT;
} PRIV_RESOLVER_INFO;

typedef struct _REMOTE_REQUEST_SCM_INFO
{
    DWORD                           ClientImpLevel;
    unsigned short                  cRequestedProtseqs;
    [size_is(cRequestedProtseqs)]
    unsigned short                  *pRequestedProtseqs;
} REMOTE_REQUEST_SCM_INFO;

typedef struct _REMOTE_REPLY_SCM_INFO
{
    OXID                            Oxid;
    DUALSTRINGARRAY                 *pdsaOxidBindings;
    IPID                            ipidRemUnknown;
    DWORD                           authnHint;
    COMVERSION                      serverVersion;
} REMOTE_REPLY_SCM_INFO;

/**
        Interfaces for private info exchange between OLE32 and SCM
**/
[
    object,
    local,
    uuid(000001AA-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IScmRequestInfo : IUnknown
{
    HRESULT SetScmInfo([in] PRIV_SCM_INFO *pScmInfo);
    HRESULT GetScmInfo([out] PRIV_SCM_INFO **ppScmInfo);
    HRESULT SetRemoteRequestInfo([in] REMOTE_REQUEST_SCM_INFO *pRemoteReq);
    HRESULT GetRemoteRequestInfo([out] REMOTE_REQUEST_SCM_INFO **ppRemoteReq);
}

[
    object,
    local,
    uuid(000001B6-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IScmReplyInfo : IUnknown
{
    HRESULT SetResolverInfo([in] PRIV_RESOLVER_INFO *pResolverInfo);
    HRESULT GetResolverInfo([out] PRIV_RESOLVER_INFO **ppResolverInfo);
    HRESULT SetRemoteReplyInfo([in] REMOTE_REPLY_SCM_INFO *pRemoteReply);
    HRESULT GetRemoteReplyInfo([out] REMOTE_REPLY_SCM_INFO **ppRemoteReply);
}

[
    object,
    uuid(000001AB-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IInstantiationInfo : IUnknown
{
}



/**     This is purely a backdoor for *setting* legacy properties easily    **/
[
    object,
    local,
    uuid(000001AC-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface ILegacyInfo : IUnknown
{
    HRESULT SetCOSERVERINFO([in] COSERVERINFO *pServerInfo);
    HRESULT GetCOSERVERINFO([out] COSERVERINFO **ppServerInfo);
}

/**
        Interface for defining GetPersistentInstance parameters
**/
[
    object,
    local,
    uuid(000001AD-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IInstanceInfo : IUnknown
{
    HRESULT SetStorage([in, unique] IStorage *pStg);
    HRESULT GetStorage([out] IStorage **ppStg);
    HRESULT SetStorageIFD([in] MInterfacePointer *pStgIFD);
    HRESULT GetStorageIFD([out] MInterfacePointer **ppStgIFD);
    HRESULT SetFile([in, string, unique] WCHAR *pwszFileName, [in] DWORD dwMode);
    HRESULT GetFile([out, string] WCHAR **ppwszFileName, [out] DWORD *pdwMode);

    // Currently used by SCM in Remote Activation Requests
    HRESULT SetIfdROT(MInterfacePointer *pIfdROT);
    HRESULT GetIfdROT(MInterfacePointer **ppIfdROT);

}

[
    object,
    local,
    uuid(000001AE-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IPrivActivationContextInfo : IActivationContextInfo
{
    HRESULT SetClientContext([in] IContext *pClientContext);
    HRESULT SetPrototypeContext([in] IContext *pContext);
    HRESULT PrototypeExists([out] BOOL *pBExists);
}

/**
    Private act props interfaces
**/
[
    object,
    local,
    uuid(000001AF-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IActivationProperties:IMarshal2
{
    HRESULT SetDestCtx([in] DWORD dwDestCtx);
    HRESULT SetMarshalFlags([in] DWORD dwMarshalFlags);
    HRESULT SetLocalBlob([in] void *blob);
    HRESULT GetLocalBlob([out] void **blob);
}

[
    object,
    local,
    uuid(000001B0-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IPrivActivationPropertiesOut:IActivationPropertiesOut
{
    HRESULT SetObjectInterfaces([in] DWORD cIfs,
                                [in] IID *pIID,
                                [in] IUnknown *pUnk);

    HRESULT SetMarshalledResults([in] DWORD cIfs,
                             [in] IID *pIID,
                             [in] HRESULT *pHr,
                             [in] MInterfacePointer **pIntfData);

    HRESULT GetMarshalledResults([out] DWORD *pcIfs,
                             [out] IID **pIID,
                             [out] HRESULT **pHr,
                             [out] MInterfacePointer ***pIntfData);

}

[
    object,
    local,
    uuid(000001B5-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IPrivActivationPropertiesIn:IActivationPropertiesIn
{
    HRESULT PrivGetReturnActivationProperties([out] IPrivActivationPropertiesOut **ppActOut);
    HRESULT GetCOMVersion([out] COMVERSION *pVersion);
    HRESULT GetClsid([out] CLSID *pClsid);
    HRESULT GetClientToken([out] HANDLE *pHandle);
    //Returns maximum distance travelled
    HRESULT GetDestCtx([out] DWORD *pdwDestCtx);
};

typedef enum {
    MARSHOPT_NO_OID_REGISTER = 1,
} MARSHAL_OPTIONS;


//
// Optional interface used by COM+ infrastructure components that
// want to influence how they are marshalled server-side.
//
[
    uuid(4c1e39e1-e3e3-4296-aa86-ec938d896e92),
    local,
    object
]
interface IMarshalOptions : IUnknown
{
    void GetStubMarshalFlags([out]DWORD* pdwFlags); // see MARSHAL_OPTIONS above
};


#else //RAW

//IDSCM Replacement
[
    uuid(00000136-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface ISCMActivator // <==> ISCMLocalActivator
{
    #include "comhndl.h"
    COM_DEFINES(ISCMActivator)

    HRESULT SCMActivatorGetClassObject(
                    COM_HANDLE
                    [in,unique]  MInterfacePointer *pActProperties,
                    [out] MInterfacePointer **ppActProperties
                    );

    HRESULT SCMActivatorCreateInstance(
                    COM_HANDLE
                    [in,unique]  MInterfacePointer *pUnkOuter,
                    [in,unique]  MInterfacePointer *pActProperties,
                    [out] MInterfacePointer **ppActProperties
                    );
}


#endif //RAW
