//+---------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1992-1999.
//
//  File:       fusion.idl
//
//  Contents:   Fusion Interfaces
//
//  Classes:
//
//  Functions:
//
//
//----------------------------------------------------------------------------
cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("// fusion.h")
cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("// (C) Copyright 1995-1998 Microsoft Corporation.  All Rights Reserved.")
cpp_quote("//")
cpp_quote("// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF")
cpp_quote("// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO")
cpp_quote("// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A")
cpp_quote("// PARTICULAR PURPOSE.")
cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("")
cpp_quote("#pragma comment(lib,\"uuid.lib\")")
cpp_quote("")
cpp_quote("//---------------------------------------------------------------------------=")
cpp_quote("// Fusion Interfaces.")
cpp_quote("")

import "objidl.idl";
import "oleidl.idl";

cpp_quote("#define STREAM_FORMAT_COMPLIB_MODULE    0")
cpp_quote("#define STREAM_FORMAT_COMPLIB_MANIFEST  1")
cpp_quote("#define STREAM_FORMAT_WIN32_MODULE      2")
cpp_quote("#define STREAM_FORMAT_WIN32_MANIFEST    4")


interface IAssemblyName;
interface IApplicationContext;
interface IAssembly;
interface IAssemblyBindSink;
interface IAssemblyBinding;
interface IAssemblyManifestImport;
interface IAssemblyModuleImport;
interface IAssemblyCacheItem;
interface IAssemblyScavenger;
interface IAssemblyCache;
interface IHistoryAssembly;
interface IHistoryReader;
interface IMetaDataAssemblyImportControl;
interface IFusionLoadContext;

cpp_quote("EXTERN_C const IID IID_IAssemblyName;       ")
cpp_quote("EXTERN_C const IID IID_IApplicationContext;       ")
cpp_quote("EXTERN_C const IID IID_IAssembly;           ")
cpp_quote("EXTERN_C const IID IID_IAssemblyBindSink;   ")
cpp_quote("EXTERN_C const IID IID_IAssemblyBinding;   ")
cpp_quote("EXTERN_C const IID IID_IAssemblyManifestImport;")
cpp_quote("EXTERN_C const IID IID_IAssemblyModuleImport;  ")
cpp_quote("EXTERN_C const IID IID_IAssemblyCacheItem;  ")
cpp_quote("EXTERN_C const IID IID_IAssemblyScavenger;      ")
cpp_quote("EXTERN_C const IID IID_IAssemblyCache;      ")
cpp_quote("EXTERN_C const IID IID_IHistoryAssembly;      ")
cpp_quote("EXTERN_C const IID IID_IHistoryReader;      ")
cpp_quote("EXTERN_C const IID IID_IMetaDataAssemblyImportControl;      ")
cpp_quote("EXTERN_C const IID IID_IFusionLoadContext;      ")

cpp_quote("#ifndef _LPFUSION_DEFINED")
cpp_quote("#define _LPFUSION_DEFINED")

cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_FLAG_REFRESH (0x00000001)")

cpp_quote("#define QUERYASMINFO_FLAG_VALIDATE             (0x1)")
 
// these flags are for dwAssemblyFlags field in struct _ASSEMBLY_INFO  
cpp_quote("#define ASSEMBLYINFO_FLAG_INSTALLED (0x00000001)")
cpp_quote("#define ASSEMBLYINFO_FLAG_PAYLOADRESIDENT (0x00000002)")

typedef struct _ASSEMBLY_INFO
{
    ULONG cbAssemblyInfo; // size of this structure for future expansion
    DWORD dwAssemblyFlags;
    ULARGE_INTEGER uliAssemblySizeInKB;
    LPWSTR pszCurrentAssemblyPathBuf;
    ULONG   cchBuf; // size of path buf.
} ASSEMBLY_INFO;



cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED (1)")
cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_STILL_IN_USE (2)")
cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_ALREADY_UNINSTALLED (3)")
cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_DELETE_PENDING (4)")

cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_DISPOSITION_INSTALLED (1)") // first time install
cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_DISPOSITION_REFRESHED (2)") // overwrite, if existing
cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_DISPOSITION_ALREADY_INSTALLED (3)") // existing, 



cpp_quote("// {8cedc215-ac4b-488b-93c0-a50a49cb2fb8}")
cpp_quote("DEFINE_GUID(FUSION_REFCOUNT_UNINSTALL_SUBKEY_GUID, 0x8cedc215, 0xac4b, 0x488b, 0x93, 0xc0, 0xa5, 0x0a, 0x49, 0xcb, 0x2f, 0xb8);")
cpp_quote("")
cpp_quote("// {b02f9d65-fb77-4f7a-afa5-b391309f11c9}")
cpp_quote("DEFINE_GUID(FUSION_REFCOUNT_FILEPATH_GUID, 0xb02f9d65, 0xfb77, 0x4f7a, 0xaf, 0xa5, 0xb3, 0x91, 0x30, 0x9f, 0x11, 0xc9);")
cpp_quote("")
cpp_quote("// {2ec93463-b0c3-45e1-8364-327e96aea856}")
cpp_quote("DEFINE_GUID(FUSION_REFCOUNT_OPAQUE_STRING_GUID, 0x2ec93463, 0xb0c3, 0x45e1, 0x83, 0x64, 0x32, 0x7e, 0x96, 0xae, 0xa8, 0x56);")


typedef struct _FUSION_INSTALL_REFERENCE_
{
    DWORD  cbSize;
    DWORD  dwFlags;
    GUID   guidScheme; // contains one of the pre-defined guids.
    LPCWSTR szIdentifier;  // unique identifier for app installing this  assembly.
    LPCWSTR szNonCannonicalData;  // data is description; relevent to the guid above 
} FUSION_INSTALL_REFERENCE, *LPFUSION_INSTALL_REFERENCE;

typedef const struct _FUSION_INSTALL_REFERENCE_ *LPCFUSION_INSTALL_REFERENCE;

///////////////////////////////////////////////////////////////////////////////
//
// IAssemblyName
//
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid(CD193BC0-B4BC-11d2-9833-00C04FC31D2E),
        pointer_default(unique)
]
interface IAssemblyName: IUnknown
{
    typedef [unique] IAssemblyName *LPASSEMBLYNAME;

    typedef enum
    {
        ASM_NAME_PUBLIC_KEY = 0,
        ASM_NAME_PUBLIC_KEY_TOKEN,
        ASM_NAME_HASH_VALUE,
        ASM_NAME_NAME,
        ASM_NAME_MAJOR_VERSION,
        ASM_NAME_MINOR_VERSION,
        ASM_NAME_BUILD_NUMBER,
        ASM_NAME_REVISION_NUMBER,
        ASM_NAME_CULTURE,
        ASM_NAME_PROCESSOR_ID_ARRAY,
        ASM_NAME_OSINFO_ARRAY,
        ASM_NAME_HASH_ALGID,
        ASM_NAME_ALIAS,
        ASM_NAME_CODEBASE_URL,
        ASM_NAME_CODEBASE_LASTMOD,
        ASM_NAME_NULL_PUBLIC_KEY,
        ASM_NAME_NULL_PUBLIC_KEY_TOKEN,
        ASM_NAME_CUSTOM,
        ASM_NAME_NULL_CUSTOM,                
        ASM_NAME_MVID,
        ASM_NAME_MAX_PARAMS
    } ASM_NAME;
    
    typedef enum
    {
        ASM_BINDF_FORCE_CACHE_INSTALL = 0x1,
        ASM_BINDF_RFS_INTEGRITY_CHECK = 0x2,
        ASM_BINDF_RFS_MODULE_CHECK    = 0x4,
        ASM_BINDF_BINPATH_PROBE_ONLY  = 0x8,
        ASM_BINDF_SHARED_BINPATH_HINT = 0x10, 
        ASM_BINDF_PARENT_ASM_HINT     = 0x20 
    } ASM_BIND_FLAGS;

    typedef enum
    {
        ASM_DISPLAYF_VERSION    = 0x1,
        ASM_DISPLAYF_CULTURE    = 0x2,
        ASM_DISPLAYF_PUBLIC_KEY_TOKEN = 0x4,
        ASM_DISPLAYF_PUBLIC_KEY = 0x8,
        ASM_DISPLAYF_CUSTOM     = 0x10,
        ASM_DISPLAYF_PROCESSORARCHITECTURE = 0x20,
        ASM_DISPLAYF_LANGUAGEID     = 0x40

    } ASM_DISPLAY_FLAGS;
    
    typedef enum
    {
        ASM_CMPF_NAME            = 0x1,
        ASM_CMPF_MAJOR_VERSION   = 0x2,
        ASM_CMPF_MINOR_VERSION   = 0x4,
        ASM_CMPF_BUILD_NUMBER    = 0x8,
        ASM_CMPF_REVISION_NUMBER = 0x10,
        ASM_CMPF_PUBLIC_KEY_TOKEN = 0x20,
        ASM_CMPF_CULTURE         = 0x40,
        ASM_CMPF_CUSTOM          = 0x80,
        ASM_CMPF_ALL = ASM_CMPF_NAME | ASM_CMPF_MAJOR_VERSION | ASM_CMPF_MINOR_VERSION |
                       ASM_CMPF_REVISION_NUMBER | ASM_CMPF_BUILD_NUMBER |
                       ASM_CMPF_PUBLIC_KEY_TOKEN | ASM_CMPF_CULTURE | ASM_CMPF_CUSTOM,
        // For strongly named assemblies, ASM_CMPF_DEFAULT==ASM_CMPF_ALL.
        // For simply named assemblies, this is also true, however, when
        // performing IAssemblyName::IsEqual, the build number/revision 
        // number will be removed from the comparision.
        ASM_CMPF_DEFAULT = 0x100
    } ASM_CMP_FLAGS;                       

    HRESULT SetProperty(
        [in]    DWORD  PropertyId, 
        [in]    LPVOID pvProperty,
        [in]    DWORD  cbProperty);

    HRESULT GetProperty(
        [in]         DWORD    PropertyId, 
        [out]        LPVOID   pvProperty,
        [in, out]    LPDWORD  pcbProperty);

    HRESULT Finalize();

    HRESULT  GetDisplayName(
        [out]       LPOLESTR  szDisplayName,
        [in, out]   LPDWORD   pccDisplayName,
        [in]        DWORD     dwDisplayFlags);

    HRESULT BindToObject(
        [in]      REFIID               refIID,
        [in]      IAssemblyBindSink   *pAsmBindSink,
        [in]      IApplicationContext *pApplicationContext,
        [in]      LPCOLESTR            szCodeBase,
        [in]      LONGLONG             llFlags,
        [in]      LPVOID               pvReserved,
        [in]      DWORD                cbReserved,
        [out]     LPVOID               *ppv);


    HRESULT GetName(
        [in, out] LPDWORD lpcwBuffer,
        [out] WCHAR *pwzName);
        
    HRESULT GetVersion(
        [out] LPDWORD pdwVersionHi,
        [out] LPDWORD pdwVersionLow);

    HRESULT IsEqual(
        [in] IAssemblyName *pName,
        [in] DWORD dwCmpFlags);
        
    HRESULT Clone(
        [out] IAssemblyName **pName);
        

}

///////////////////////////////////////////////////////////////////////////////
//
// IApplicationContext
//
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid(7c23ff90-33af-11d3-95da-00a024a85b51),
        pointer_default(unique)
]
interface IApplicationContext: IUnknown
{
    cpp_quote("// App context configuration variables")
    cpp_quote("#define ACTAG_APP_BASE_URL            L\"APPBASE\"")
    cpp_quote("#define ACTAG_MACHINE_CONFIG          L\"MACHINE_CONFIG\"")
    cpp_quote("#define ACTAG_APP_PRIVATE_BINPATH     L\"PRIVATE_BINPATH\"")
    cpp_quote("#define ACTAG_APP_SHARED_BINPATH      L\"SHARED_BINPATH\"")
    cpp_quote("#define ACTAG_APP_SNAPSHOT_ID         L\"SNAPSHOT_ID\"")
    cpp_quote("#define ACTAG_APP_CONFIG_FILE         L\"APP_CONFIG_FILE\"")
    cpp_quote("#define ACTAG_APP_ID                  L\"APPLICATION_ID\"")
    cpp_quote("#define ACTAG_APP_SHADOW_COPY_DIRS    L\"SHADOW_COPY_DIRS\"")
    cpp_quote("#define ACTAG_APP_DYNAMIC_BASE        L\"DYNAMIC_BASE\"")
    cpp_quote("#define ACTAG_APP_CACHE_BASE          L\"CACHE_BASE\"")
    cpp_quote("#define ACTAG_APP_NAME                L\"APP_NAME\"")
    cpp_quote("#define ACTAG_DEV_PATH                L\"DEV_PATH\"")
    cpp_quote("#define ACTAG_HOST_CONFIG_FILE        L\"HOST_CONFIG\"")
    cpp_quote("#define ACTAG_SXS_ACTIVATION_CONTEXT  L\"SXS_ACTIVATION_CONTEXT\"")
    cpp_quote("#define ACTAG_APP_CFG_LOCAL_FILEPATH  L\"APP_CFG_LOCAL_FILEPATH\"")
    
    cpp_quote("// App context flag overrides")
    cpp_quote("#define ACTAG_FORCE_CACHE_INSTALL     L\"FORCE_CACHE_INSTALL\"")
    cpp_quote("#define ACTAG_RFS_INTEGRITY_CHECK     L\"RFS_INTEGRITY_CHECK\"")
    cpp_quote("#define ACTAG_RFS_MODULE_CHECK        L\"RFS_MODULE_CHECK\"")
    cpp_quote("#define ACTAG_BINPATH_PROBE_ONLY      L\"BINPATH_PROBE_ONLY\"")

    typedef [unique] IApplicationContext *LPAPPLICATIONCONTEXT;
    
    typedef enum
    {
        APP_CTX_FLAGS_INTERFACE = 0x1
    } APP_FLAGS;

    HRESULT SetContextNameObject(
        [in]    LPASSEMBLYNAME pName);

    HRESULT GetContextNameObject(
        [out]   LPASSEMBLYNAME * ppName);


    HRESULT Set(
        [in]    LPCOLESTR szName, 
        [in]    LPVOID pvValue,
        [in]    DWORD  cbValue,
        [in]    DWORD  dwFlags);

    HRESULT Get(
        [in]         LPCOLESTR szName, 
        [out]        LPVOID   pvValue,
        [in, out]    LPDWORD  pcbValue,
        [in]         DWORD    dwFlags);
        
    HRESULT GetDynamicDirectory(
        [out]         LPWSTR wzDynamicDir,
        [in, out]     LPDWORD pdwSize);
        
    HRESULT GetAppCacheDirectory(
        [out]         LPWSTR wzAppCacheDir,
        [in, out]     LPDWORD pdwSize);
    
    HRESULT RegisterKnownAssembly(
        [in]          IAssemblyName *pName,
        [in]          LPCWSTR pwzAsmURL,
        [out]         IAssembly **ppAsmOut);
    
    HRESULT PrefetchAppConfigFile();
        
    HRESULT SxsActivateContext(ULONG_PTR *lpCookie);
    HRESULT SxsDeactivateContext(ULONG_PTR ulCookie);
        
}


///////////////////////////////////////////////////////////////////////////////
//
// IAssembly
//
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid(ff08d7d4-04c2-11d3-94aa-00c04fc308ff),
        pointer_default(unique)
]
interface IAssembly : IUnknown
{
    typedef [unique] IAssembly *LPASSEMBLY;
    
    typedef enum {
        ASMLOC_UNKNOWN,
        ASMLOC_GAC,
        ASMLOC_DOWNLOAD_CACHE,
        ASMLOC_RUN_FROM_SOURCE
    } ASM_LOCATION;

    HRESULT GetAssemblyNameDef(
        [out] IAssemblyName **ppAssemblyName);

    HRESULT GetNextAssemblyNameRef(
        [in] DWORD nIndex,
        [out] IAssemblyName **ppAssemblyName);
        
    HRESULT GetNextAssemblyModule(
        [in] DWORD nIndex,
        [out] IAssemblyModuleImport **ppModImport);

    HRESULT GetModuleByName(
        [in]       LPCOLESTR               szModuleName,
        [out]      IAssemblyModuleImport **ppModImport);

    HRESULT GetManifestModulePath(
        [out, size_is(*pccModulePath)]  LPOLESTR szModulePath, 
        [in, out]  LPDWORD pccModulePath);
        
    HRESULT GetAssemblyPath(
        [out, size_is(*lpcwBuffer)] LPOLESTR pStr,
        [in, out] LPDWORD lpcwBuffer);

    HRESULT GetAssemblyLocation(
        [out] ASM_LOCATION *pAsmLocation);
        
    HRESULT GetFusionLoadContext(
        [out] IFusionLoadContext **ppLoadContext
        );
        
}


///////////////////////////////////////////////////////////////////////////////
//
// IAssemblyBindSink
//
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid(af0bc960-0b9a-11d3-95ca-00a024a85b51),
        pointer_default(unique)
]
interface IAssemblyBindSink : IUnknown
{
    typedef [unique] IAssemblyBindSink *LPASSEMBLY_BIND_SINK;

    typedef enum
    {
        ASM_NOTIFICATION_START,
        ASM_NOTIFICATION_PROGRESS,
        ASM_NOTIFICATION_SUSPEND,
        ASM_NOTIFICATION_ATTEMPT_NEXT_CODEBASE,
        ASM_NOTIFICATION_BIND_LOG,
        ASM_NOTIFICATION_DONE    
    } ASM_NOTIFICATION;


    HRESULT OnProgress(
        [in]    DWORD          dwNotification,
        [in]    HRESULT        hrNotification,
        [in]    LPCWSTR        szNotification,
        [in]    DWORD          dwProgress,
        [in]    DWORD          dwProgressMax,
        [in]    IUnknown       *pUnk);
}

///////////////////////////////////////////////////////////////////////////////
//
// IAssemblyBinding
//
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid(cfe52a80-12bd-11d3-95ca-00a024a85b51),
        pointer_default(unique)
]
interface IAssemblyBinding : IUnknown
{
    typedef [unique] IAssemblyBinding *LPASSEMBLY_BINDINDING;

    HRESULT Control(
        [in]    HRESULT        hrControl);

    HRESULT DoDefaultUI(
        [in]    HWND    hWnd,
        [in]    DWORD   dwFlags);   
}

///////////////////////////////////////////////////////////////////////////////
//
// IFusionBindLog
//
///////////////////////////////////////////////////////////////////////////////

[
        local,
        object,
        uuid(67E9F87D-8B8A-4a90-9D3E-85ED5B2DCC83),
        pointer_default(unique)
]
interface IFusionBindLog : IUnknown
{
    HRESULT GetResultCode();
    
    HRESULT GetBindLog
    (
        [in]       DWORD             dwDetailLevel,
        [out]      LPWSTR            pwzDebugLog,
        [in, out]  DWORD            *pcbDebugLog
    );
}

///////////////////////////////////////////////////////////////////////////////
//
// IAssemblyManifestImport
// 
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid( de9a68ba-0fa2-11d3-94aa-00c04fc308ff),
        pointer_default(unique)
]
interface IAssemblyManifestImport: IUnknown
{
    typedef [unique] IAssemblyManifestImport *LPASSEMBLY_MANIFEST_IMPORT;
    
    HRESULT GetAssemblyNameDef(
        [out] IAssemblyName **ppAssemblyName);

    HRESULT GetNextAssemblyNameRef(
        [in]        DWORD            nIndex,
        [out]       IAssemblyName ** ppAssemblyName);

    HRESULT GetNextAssemblyModule(
        [in]       DWORD                    nIndex,
        [out]      IAssemblyModuleImport **ppImport);

    HRESULT GetModuleByName(
        [in]       LPCOLESTR               szModuleName,
        [out]      IAssemblyModuleImport **ppModImport);

    HRESULT GetManifestModulePath(
        [out, size_is(*pccModulePath)]  LPOLESTR szModulePath, 
        [in, out]  LPDWORD pccModulePath);
        
}

///////////////////////////////////////////////////////////////////////////////
//
// IMetaDataAssemblyImportControl
// 
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid(cc8529d9-f336-471b-b60a-c7c8ee9b8492),
        pointer_default(unique)
]
interface IMetaDataAssemblyImportControl : IUnknown
{
    HRESULT ReleaseMetaDataAssemblyImport(
        [out] IUnknown **ppUnk
        );
}



///////////////////////////////////////////////////////////////////////////////
//
// IAssemblyModuleImport
//
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid(da0cd4b0-1117-11d3-95ca-00a024a85b51),
        pointer_default(unique)
]
interface IAssemblyModuleImport : IStream
{
    typedef [unique] IAssemblyModuleImport *LPASSEMBLY_MODULE_IMPORT;

    HRESULT GetModuleName(
        [out, size_is(*pccModuleName)]  LPOLESTR szModuleName, 
        [in, out]  LPDWORD pccModuleName);

    HRESULT GetHashAlgId(
        [out]   LPDWORD pdwHashAlgId);

    HRESULT GetHashValue(
        [out, size_is(*pcbHashValue)] BYTE *pbHashValue,
        [in, out] LPDWORD pcbHashValue);

    HRESULT GetFlags(
        [out]  LPDWORD pdwFlags);

    HRESULT GetModulePath(
        [out, size_is(*pccModulePath)]  LPOLESTR szModulePath, 
        [in, out]  LPDWORD pccModulePath);
        
    BOOL IsAvailable();
    
    HRESULT BindToObject(
        [in]       IAssemblyBindSink *pBindSink,
        [in]       IApplicationContext *pAppCtx,
        [in]       LONGLONG llFlags,
        [out]      LPVOID *ppv);
}

///////////////////////////////////////////////////////////////////////////////
//
// IAssemblyCacheItem
//
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid(9e3aaeb4-d1cd-11d2-bab9-00c04f8eceae),
        pointer_default(unique)
]
interface IAssemblyCacheItem : IUnknown
{

    HRESULT CreateStream(
        [in] DWORD dwFlags,                         // For general API flags
        [in] LPCWSTR pszStreamName,                 // Name of the stream to be passed in
        [in] DWORD dwFormat,                        // format of the file to be streamed in.
        [in] DWORD dwFormatFlags,                   // format-specific flags
        [out] IStream **ppIStream,
        [in, optional] ULARGE_INTEGER *puliMaxSize  // Max size of the Stream.
        );
 
    HRESULT Commit
    (
        [in] DWORD dwFlags, // For general API flags like IASSEMBLYCACHEITEM _COMMIT_FLAG_REFRESH 
        [out, optional] ULONG *pulDisposition
    ); 
 
    HRESULT AbortItem(); // If you have created IAssemblyCacheItem and don't plan to use it, its good idea to call AbortItem before releasing it.

}

///////////////////////////////////////////////////////////////////////////////
//
// IAssemblyEnum
//
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid(21b8916c-f28e-11d2-a473-00c04f8ef448),
        pointer_default(unique)
]
interface IAssemblyEnum : IUnknown
{

    HRESULT GetNextAssembly
    (
        [out]                 IApplicationContext **ppAppCtx,
        [out]                 IAssemblyName       **ppName,
        [in]                  DWORD                 dwFlags
    );

    HRESULT Reset(void);

    HRESULT Clone 
    (
        [out] IAssemblyEnum ** ppEnum
    );
    
}

///////////////////////////////////////////////////////////////////////////////
//
// IAssemblyScavenger
//
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid(21b8916c-f28e-11d2-a473-00ccff8ef448),
        pointer_default(unique)
]
interface IAssemblyScavenger : IUnknown
{

    HRESULT  ScavengeAssemblyCache
    (
    );

    HRESULT GetCacheDiskQuotas
    (
        [out] DWORD *pdwZapQuotaInGAC,
        [out] DWORD *pdwDownloadQuotaAdmin,
        [out] DWORD *pdwDownloadQuotaUser
    );

    HRESULT SetCacheDiskQuotas
    (
        [in] DWORD dwZapQuotaInGAC,
        [in] DWORD dwDownloadQuotaAdmin,
        [in] DWORD dwDownloadQuotaUser
    );

    HRESULT  GetCurrentCacheUsage
    (
        [out] DWORD *dwZapUsage,
        [out] DWORD *dwDownloadUsage
    );
}


///////////////////////////////////////////////////////////////////////////////
//
// IAssemblyCache
//
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid(e707dcde-d1cd-11d2-bab9-00c04f8eceae),
        pointer_default(unique)
]

interface IAssemblyCache : IUnknown
{

    HRESULT UninstallAssembly(
        [in] DWORD dwFlags,
        [in] LPCWSTR pszAssemblyName, 
        [in] LPCFUSION_INSTALL_REFERENCE pRefData,
        [out, optional] ULONG *pulDisposition
        );
 
    HRESULT QueryAssemblyInfo(
        [in] DWORD dwFlags,
        [in] LPCWSTR pszAssemblyName,
        [in, out] ASSEMBLY_INFO *pAsmInfo
        );
 
    HRESULT CreateAssemblyCacheItem( 
        [in] DWORD dwFlags,
        [in] PVOID pvReserved,
        [out] IAssemblyCacheItem **ppAsmItem,
        [in, optional] LPCWSTR pszAssemblyName  // uncanonicalized, comma separted name=value pairs.
        );

    HRESULT CreateAssemblyScavenger
    (
                [out]   IAssemblyScavenger **ppAsmScavenger
    );

    HRESULT InstallAssembly( // if you use this, fusion will do the streaming & commit.
        [in] DWORD dwFlags,
        [in] LPCWSTR pszManifestFilePath, 
        [in] LPCFUSION_INSTALL_REFERENCE pRefData
        );

}

///////////////////////////////////////////////////////////////////////////////
//
// IHistoryAssembly
//
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid(e6096a07-e188-4a49-8d50-2a0172a0d205),
        pointer_default(unique)
]
interface IHistoryAssembly : IUnknown
{
    HRESULT GetAssemblyName
    (
        [out] LPWSTR wzAsmName,
        [in, out] DWORD *pdwSize
    );
    
    HRESULT GetPublicKeyToken
    (
        [out] LPWSTR wzPublicKeyToken,
        [in, out] DWORD *pdwSize
    );
    
    HRESULT GetCulture
    (
        [out] LPWSTR wzCulture,
        [in, out] DWORD *pdwSize
    );
    
    HRESULT GetReferenceVersion
    (
        [out] LPWSTR wzVerRef,
        [in, out] DWORD *pdwSize
    );
        
    HRESULT GetActivationDate
    (
        [out] LPWSTR wzActivationDate, 
        [in, out] DWORD *pdwSize
    );
    
    HRESULT GetAppCfgVersion
    (
        [out] LPWSTR pwzVerAppCfg, 
        [in, out] DWORD *pdwSize
    );
    
    HRESULT GetPublisherCfgVersion
    (
        [out] LPWSTR pwzVerPublisherCfg, 
        [in, out] DWORD *pdwSize
    );
    
    HRESULT GetAdminCfgVersion
    (
        [out] LPWSTR pwzAdminCfg,
        [in, out] DWORD *pdwSize
    );
}

///////////////////////////////////////////////////////////////////////////////
//
// IHistoryReader
//
///////////////////////////////////////////////////////////////////////////////
[
        local,
        object,
        uuid(1d23df4d-a1e2-4b8b-93d6-6ea3dc285a54),
        pointer_default(unique)
]
interface IHistoryReader : IUnknown
{
    HRESULT GetFilePath
    (
        [out] LPWSTR wzFilePath,
        [in, out] DWORD *pdwSize
    );
    
    HRESULT GetApplicationName
    (
        [out] LPWSTR wzAppName, 
        [in, out] DWORD *pdwSize
    );

    HRESULT GetEXEModulePath
    (
        [out] LPWSTR wzExePath, 
        [in, out] DWORD *pdwSize
    );
    
    
    HRESULT GetNumActivations
    (
        [out] DWORD *pdwNumActivations
    );
    
    HRESULT GetActivationDate
    (
        [in] DWORD dwIdx, 
        [out] FILETIME *pftDate
    );
    
    HRESULT GetRunTimeVersion
    (
        [in] FILETIME *pftActivationDate,
        [out] LPWSTR wzRunTimeVersion, 
        [in, out] DWORD *pdwSize
    );
    
    HRESULT GetNumAssemblies
    (
        [in] FILETIME *pftActivationDate, 
        [out] DWORD *pdwNumAsms
    );
        
    HRESULT GetHistoryAssembly
    (
        [in] FILETIME *pftActivationDate, 
        [in] DWORD dwIdx,
        [out] IHistoryAssembly **ppHistAsm
    );
}
    
typedef enum {
     CANOF_PARSE_DISPLAY_NAME = 0x1,
     CANOF_SET_DEFAULT_VALUES = 0x2
} CREATE_ASM_NAME_OBJ_FLAGS;


typedef enum
{
    ASM_CACHE_ZAP            = 0x1,
    ASM_CACHE_GAC            = 0x2,
    ASM_CACHE_DOWNLOAD       = 0x4
} ASM_CACHE_FLAGS;


///////////////////////////////////////////////////////////////////////////////
//
// IFusionLoadContext
//
///////////////////////////////////////////////////////////////////////////////

typedef enum {
    LOADCTX_TYPE_DEFAULT,
    LOADCTX_TYPE_LOADFROM,
} LOADCTX_TYPE;


[
        local,
        object,
        uuid(022AB2BA-7367-49fc-A1C5-0E7CC037CAAB),
        pointer_default(unique)
]
interface IFusionLoadContext : IUnknown
{
    LOADCTX_TYPE GetContextType();
}


#pragma midl_echo("STDAPI CreateHistoryReader(LPCWSTR wzFilePath, IHistoryReader **ppHistReader);")
#pragma midl_echo("STDAPI LookupHistoryAssembly(LPCWSTR pwzFilePath, FILETIME *pftActivationDate, LPCWSTR pwzAsmName, LPCWSTR pwzPublicKeyToken, LPCWSTR wzCulture, LPCWSTR pwzVerRef, IHistoryAssembly **pHistAsm);")
#pragma midl_echo("STDAPI GetHistoryFileDirectory(LPWSTR wzDir, DWORD *pdwSize);")

// Publically exported functions from fusion.dll

#pragma midl_echo("STDAPI AddAssemblyToCacheW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow);")
#pragma midl_echo("STDAPI AddAssemblyToCacheA(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);")
#pragma midl_echo("STDAPI RemoveAssemblyFromCacheW(HWND hwnd, HINSTANCE hinst, LPWSTR lpszCmdLine, int nCmdShow);")
#pragma midl_echo("STDAPI RemoveAssemblyFromCacheA(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);")

#pragma midl_echo("STDAPI CreateAssemblyNameObject(LPASSEMBLYNAME *ppAssemblyNameObj, LPCWSTR szAssemblyName, DWORD dwFlags, LPVOID pvReserved);             ")
#pragma midl_echo("STDAPI CreateApplicationContext(IAssemblyName *pName, LPAPPLICATIONCONTEXT *ppCtx);             ")
#pragma midl_echo("STDAPI CreateAssemblyCache(IAssemblyCache **ppAsmCache, DWORD dwReserved); ")
#pragma midl_echo("STDAPI CreateAssemblyEnum(IAssemblyEnum **pEnum, IApplicationContext *pAppCtx, IAssemblyName *pName, DWORD dwFlags, LPVOID pvReserved);      ") 
#pragma midl_echo("STDAPI SetSchemaVersion(DWORD dwNewMinorVersion, DWORD dwCacheId, BOOL fIsNameRes); ")

#pragma midl_echo("HRESULT GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath, PDWORD pcchPath); ")

#pragma midl_echo("STDAPI PreBindAssembly(IApplicationContext *pAppCtx, IAssemblyName *pName, IAssembly *pAsmParent, IAssemblyName **ppNamePostPolicy, LPVOID pvReserved); ")

// Flags for the shfusion.dll init routine
typedef enum 
{
    SH_INIT_FOR_GLOBAL, 
    SH_INIT_FOR_USER 
} SH_INIT_FLAGS;


cpp_quote("#endif")

