//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (c) Microsoft Corporation. All rights reserved.
//
//  File:
//      immact.idl
//
//  Contents:
//      Definition of immediate activator interfaces
//
//  History:
//              VinayKr     10-15-98        Created
//
//--------------------------------------------------------------------------

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

// Opaque Data


//--------------------------------------------------------------------------
//	An immediate activator supports:
//		IStandardActivator
//		IOpaqueDataInfo
//		ISpecialSystemProperties
//
//--------------------------------------------------------------------------

[
    object,
    local,
    uuid(000001b8-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IStandardActivator : IUnknown
{
    HRESULT StandardGetClassObject([in] REFCLSID rclsid,
                           [in] DWORD dwClsCtx,
                           [in] COSERVERINFO *pServerInfo,
                           [in] REFIID riid,
                           [out, iid_is(riid)] void** ppv);

    HRESULT StandardCreateInstance([in] REFCLSID Clsid,
                           [in] IUnknown *punkOuter,
                           [in] DWORD dwClsCtx,
                           [in] COSERVERINFO *pServerInfo,
                           [in] DWORD dwCount,
                           [in, size_is(dwCount)] MULTI_QI *pResults);

    HRESULT StandardGetInstanceFromFile(
                           [in] COSERVERINFO *pServerInfo,
                           [in] CLSID        *pclsidOverride,
                           [in] IUnknown     *punkOuter, 
                           [in] DWORD        dwClsCtx,
                           [in] DWORD        grfMode,
                           [in] OLECHAR      *pwszName,
                           [in] DWORD        dwCount,
                           [in, size_is(dwCount)] MULTI_QI  *pResults);

    HRESULT StandardGetInstanceFromIStorage(
                           [in] COSERVERINFO    *pServerInfo,
                           [in] CLSID           *pclsidOverride,
                           [in] IUnknown        *punkOuter, 
                           [in] DWORD           dwClsCtx,
                           [in] IStorage        *pstg,
                           [in] DWORD           dwCount,
                           [in, size_is(dwCount)] MULTI_QI  *pResults);

    HRESULT Reset();
}


[
    object,
    local,
    uuid(000001A9-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IOpaqueDataInfo : IUnknown
{
    HRESULT AddOpaqueData([in] OpaqueData *pData);
    HRESULT GetOpaqueData([in] REFGUID guid, [out] OpaqueData **pData);
	HRESULT DeleteOpaqueData([in] REFGUID guid);
    HRESULT GetOpaqueDataCount ([out] ULONG* pulCount);
    HRESULT GetAllOpaqueData ([out] OpaqueData** prgData);
}


//  Enum value; means "don't use the session id when trying to find
//  a suitable server for an activation".   Used only in SCM.
typedef enum {  INVALID_SESSION_ID = 0xFFFFFFFF } SESSIDTYPES;


[
    object,
    local,
    uuid(000001b9-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface ISpecialSystemProperties : IUnknown
{
  // fRemoteSessionId should be TRUE if the specified session is to be passed 
  // off-machine.  If bUseConsole is TRUE, dwSessionID is ignored.
  HRESULT SetSessionId([in] ULONG dwSessionId, [in]BOOL bUseConsole, [in] BOOL fRemoteThisSessionId);

  // Gets the current value of the session id.  *pdwSessionId should only be
  // looked at if *pbUseConsole is FALSE.
  HRESULT GetSessionId([out] ULONG *pdwSessionId, [out]BOOL* pbUseConsole);
		
  // Same thing but also gets whether it should remoted off machine or not
  HRESULT GetSessionId2([out] ULONG *pdwSessionId, [out]BOOL* pbUseConsole, [out] BOOL* pfRemoteThisSessionId);
  
  // Get/set whether the client thread doing the activation was impersonating or not
  HRESULT SetClientImpersonating([in]BOOL fClientImpersonating);
  HRESULT GetClientImpersonating([out]BOOL* pfClientImpersonating);

  // Set the partition ID
  HRESULT SetPartitionId([in] REFGUID guidPartiton);

  // Get the partition ID
  HRESULT GetPartitionId([out] GUID* pguidPartiton);

  // Storage for the ProcessRequestType flag (set by custom activators thru the
  // IServerLocationInfo interface)
  HRESULT SetProcessRequestType([in] DWORD dwPRT);
  HRESULT GetProcessRequestType([out] DWORD* pdwPRT);

  // Set the clsctx for the original caller
  HRESULT SetOrigClsctx([in] DWORD dwClsctx);

  // Get the clsctx for the orginal caller
  HRESULT GetOrigClsctx([out] DWORD* dwClsctx);

}