//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1998.
//
//  File:
//      custmact.idl
//
//  Contents:
//      Definition of types needed for custom marshalling
//      of activation properties interfaces.
//
//  History:
//              VinayKr     01-26-98        Created
//
//--------------------------------------------------------------------------
#ifndef DO_NO_IMPORTS
import "wtypes.idl";
import "objidl.idl";
import "obase.idl";
import "contxt.idl";
import "activate.idl";
#endif

/**     Activation related type definitions    **/

interface IActivatorCustomMarshal {

/**
    The following 2 structs must be identical to corresponding
    ones in privact.idl
**/
typedef struct _customREMOTE_REQUEST_SCM_INFO
{
    DWORD                           ClientImpLevel;
    unsigned short                  cRequestedProtseqs;
    [size_is(cRequestedProtseqs)]
    unsigned short                  *pRequestedProtseqs;
} customREMOTE_REQUEST_SCM_INFO;

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


    // BUGBUG: MIDL currently supports /robust with encode/decode
    //         Hence the hack below should be fixed.
    //         Please note that BYTE * data is NOT aligned to 8 by RPC.
    //         thx ryszard, June,2000.
    
    /**     Generic blob definition, with 8 byte aligned buffer     **/
    /**     Must be identical in form to the version in obase.idl   **/
    /**     This is here again because MIDL cannot tolerate our     **/
    /**     standard-issue /robust switch with encode/decode        **/
    typedef struct tagCustomOpaqueData
    {
        GUID guid;
        unsigned long dataLength;
        unsigned long reserved1;
        unsigned long reserved2;
        [size_is((dataLength+7)&~7)] BYTE *data;
    } CustomOpaqueData;


    typedef struct tagInstantiationInfoData
    {
        CLSID classId;
        DWORD classCtx;
                DWORD actvflags;
        BOOL  fIsSurrogate;
        DWORD cIID;
        DWORD instFlag;
        [size_is(cIID)] IID   *pIID;
        DWORD thisSize;
        COMVERSION clientCOMVersion;
    } InstantiationInfoData;

    typedef struct tagLocationInfoData
    {
        [string] WCHAR  *machineName;
        DWORD processId;
        APTID  apartmentId;
        CTXTID contextId;
    } LocationInfoData;

    typedef struct tagActivationContextInfoData
    {
       BOOL  clientOK;
       BOOL  bReserved1;
       DWORD dwReserved1;
       DWORD dwReserved2;
       MInterfacePointer *pIFDClientCtx;
       MInterfacePointer *pIFDPrototypeCtx;
    } ActivationContextInfoData;

    typedef struct tagCustomHeader
    {
        DWORD totalSize;
        DWORD headerSize;
        DWORD cOpaqueData;
        DWORD destCtx;
        DWORD cIfs;
        CLSID classInfoClsid; //BUGBUG temporary for marshalling ClassInfo
        [size_is(cIfs)] CLSID *pclsid;
        [size_is(cIfs)] DWORD *pSizes;
        [size_is(cOpaqueData)] CustomOpaqueData *opaqueData;
    } CustomHeader;

    typedef struct tagPropsOutInfo
    {
        DWORD cIfs;
        [size_is(cIfs)] IID *piid;
        [size_is(cIfs)] HRESULT *phresults;
        [size_is(cIfs)] MInterfacePointer **ppIntfData;
    } PropsOutInfo;

    typedef struct tagSecurityInfoData
    {
        DWORD           dwAuthnFlags;
        COSERVERINFO    *pServerInfo;
        COAUTHIDENTITY  *pAuthIdentityInfo;
    } SecurityInfoData;

    /**     This is for input activation properties       **/
    /**     Must be identical to PRIV_SCM_INFO in actprops.idl  **/
    typedef struct tagCustomPrivScmInfo
    {
        long            Apartment;
        [string] WCHAR *pwszWinstaDesktop;
        ULONG64         ProcessSignature;
        [size_is(EnvBlockLength)]
        WCHAR *         pEnvBlock;
        DWORD           EnvBlockLength;
    } CustomPrivScmInfo;

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

    typedef struct tagScmRequestInfoData
    {
        CustomPrivScmInfo *pScmInfo;
        customREMOTE_REQUEST_SCM_INFO *remoteRequest;
    } ScmRequestInfoData;

    typedef struct tagScmReplyInfoData
    {
        CustomPrivResolverInfo *pResolverInfo;
        customREMOTE_REPLY_SCM_INFO *remoteReply;
    } ScmReplyInfoData;

    typedef struct tagInstanceInfoData
    {
        [string] WCHAR *fileName;
        DWORD   mode;
        MInterfacePointer *ifdROT;
        MInterfacePointer *ifdStg;
    } InstanceInfoData;

    typedef struct tagMarshalledStgInfo
    {
        [unique] IStorage *pstg;
    } MarshalledStgInfo;

    // Bitflag values for the dwFlags member of
    // SpecialPropertiesData below.
    typedef enum
    {
        SPD_FLAG_USE_CONSOLE_SESSION = 0x00000001,
    } SPD_FLAGS;
        
    // NOTE: let's not be adding any more BOOLean properties
    // to this guy by using up an entire DWORD!  Just define a 
    // new bit flag for the dwFlags property and that should be
    // sufficient.  (yes I am guilty too)
    typedef struct tagSpecialPropertiesData
    {
        ULONG dwSessionId;
        BOOL  fRemoteThisSessionId;        
        BOOL  fClientImpersonating;
        BOOL  fPartitionIDPresent;  // Modification for partitions-Sajia
        BOOL  fReserved3;        
        GUID  guidPartition;        // Modification for partitions-Sajia
        DWORD dwPRTFlags;           // process request type flags
        DWORD dwOrigClsctx;
        DWORD dwFlags;              
        DWORD dwReserved[8];
    } SpecialPropertiesData;

}
