//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1998.
//
//  File:
//      UniSrgt.idl
//
//  Contents:
//      Definition of (currently) private unified surrogate interfaces
//
//  History:
//              WilfR	    03-31-98        Created
//
//--------------------------------------------------------------------------

cpp_quote("//+-----------------------------------------------------------------")
cpp_quote("//")
cpp_quote("//  Microsoft Windows")
cpp_quote("//  Copyright (C) Microsoft Corporation, 1992 - 1998.")
cpp_quote("//")
cpp_quote("//------------------------------------------------------------------")

#ifndef DO_NO_IMPORTS
import "wtypes.idl";
import "objidl.idl";
import "unknwn.idl";
#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] REFGUID rguidProcessID,
                      [in] IProcessLock* pProcessLock,
                      [out] BOOL* pfApplicationAware );
	HRESULT ApplicationLaunch( [in] REFGUID rguidApplID, 
                                   [in] ApplicationType appType );
	HRESULT ApplicationFree( [in] REFGUID rguidApplID );
	HRESULT CatalogRefresh( [in] ULONG ulReserved );
	HRESULT ProcessShutdown( [in] ShutdownType shutdownType );
}


//
// ISurrogateService2
//
[
	object,
	local,
	uuid(000001da-0000-0000-C000-000000000046),
	pointer_default(unique)
]
interface ISurrogateService2 : ISurrogateService
{
    HRESULT PauseProcess();
    HRESULT ResumeProcess();
}


/****************************************************************************
 *                         OLE32 Interface                                  *
 ****************************************************************************/

//
// IPAControl
//
[
    object,
	local,
    uuid(000001d2-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IPAControl : IUnknown
{
	ULONG AddRefOnProcess();
	ULONG ReleaseRefOnProcess();
	void PendingInit();
	void ServicesReady();
	HRESULT SuspendApplication( [in] REFGUID rguidApplID );
	HRESULT PendingApplication( [in] REFGUID rguidApplID );
	HRESULT ResumeApplication( [in] REFGUID rguidApplID );
	HRESULT SuspendAll();
	HRESULT ResumeAll();
	HRESULT ForcedShutdown();
	HRESULT SetIdleTimeoutToZero();
}


/****************************************************************************
 *                         COMSVCS Interfaces                               *
 ****************************************************************************/

//
// IServicesSink
//
[
    object,
    local,
    uuid(000001d3-0000-0000-C000-000000000046),
    pointer_default(unique)
]
interface IServicesSink : IUnknown
{
    void ApplicationLaunch( [in] REFGUID rguidApplID,
                            [in] ApplicationType appType );
    void ApplicationFree( [in] REFGUID rguidApplID );
    void ProcessFree();

    HRESULT PauseApplication();
    HRESULT ResumeApplication();
}


/****************************************************************************
 *                         Surrogate APIs                                   *
 ****************************************************************************/

//
// CoRegisterSurrogateEx
//
// Note: 	For now we re-use the ISurrogate interface -- The LoadDllServer 
//			method will never be called.
//
cpp_quote ("STDAPI CoRegisterSurrogateEx (REFGUID rguidProcessID,		")
cpp_quote ("							  ISurrogate* pSrgt);			")

//
// CoLoadServices
//
cpp_quote ("STDAPI CoLoadServices (REFGUID rguidProcessID,				")
cpp_quote ("					   IPAControl* pPAControl,				")
cpp_quote ("					   REFIID riid, void **ppv );			")

//
// CoLoadServices Function typedef
//
cpp_quote ("typedef HRESULT (STDAPICALLTYPE *FN_CoLoadServices)			")
cpp_quote ("								(REFGUID rguidProcessID,	")
cpp_quote ("								 IPAControl* pPAControl,	")
cpp_quote ("								 REFIID riid, void **ppv );	")
