/*
 * Copyright 2010 Hans Leidekker for CodeWeavers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

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

interface IAssemblyCache;
interface IAssemblyCacheItem;
interface IAssemblyName;

typedef struct _FUSION_INSTALL_REFERENCE_
{
    DWORD   cbSize;
    DWORD   dwFlags;
    GUID    guidScheme;
    LPCWSTR szIdentifier;
    LPCWSTR szNonCannonicalData;
} FUSION_INSTALL_REFERENCE, *LPFUSION_INSTALL_REFERENCE;

typedef struct _ASSEMBLY_INFO
{
    ULONG          cbAssemblyInfo;
    DWORD          dwAssemblyFlags;
    ULARGE_INTEGER uliAssemblySizeInKB;
    LPWSTR         pszCurrentAssemblyPathBuf;
    ULONG          cchBuf;
} ASSEMBLY_INFO;

typedef const struct _FUSION_INSTALL_REFERENCE_ *LPCFUSION_INSTALL_REFERENCE;

[
    object,
    uuid(e707dcde-d1cd-11d2-bab9-00c04f8eceae),
    pointer_default(unique),
    local
]
interface IAssemblyCache : IUnknown
{
    HRESULT UninstallAssembly(
        [in] DWORD flags,
        [in] LPCWSTR name,
        [in] LPCFUSION_INSTALL_REFERENCE ref,
        [out, optional] ULONG *disp);

    HRESULT QueryAssemblyInfo(
        [in] DWORD flags,
        [in] LPCWSTR name,
        [in, out] ASSEMBLY_INFO *info);

    HRESULT CreateAssemblyCacheItem(
        [in] DWORD flags,
        [in] PVOID reserved,
        [out] IAssemblyCacheItem **item,
        [in, optional] LPCWSTR name);

    HRESULT Reserved(
        [out] IUnknown **reserved);

    HRESULT InstallAssembly(
        [in] DWORD flags,
        [in] LPCWSTR path,
        [in] LPCFUSION_INSTALL_REFERENCE ref);
}

[
    object,
    uuid(9e3aaeb4-d1cd-11d2-bab9-00c04f8eceae),
    pointer_default(unique),
    local
]
interface IAssemblyCacheItem : IUnknown
{
    HRESULT CreateStream(
        [in] DWORD flags,
        [in] LPCWSTR name,
        [in] DWORD format,
        [in] DWORD format_flags,
        [out] IStream **stream,
        [in, optional] ULARGE_INTEGER *max_size);

    HRESULT Commit(
        [in] DWORD flags,
        [out, optional] ULONG *disp);

    HRESULT AbortItem();
}

[
    object,
    uuid(cd193bc0-b4bc-11D2-9833-00c04fc31d2e),
    pointer_default(unique),
    local
]
interface IAssemblyName : IUnknown
{
    typedef [public] enum
    {
        ASM_NAME_PUBLIC_KEY,
        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 [public] 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;

    HRESULT SetProperty(
        [in] DWORD id,
        [in] LPVOID property,
        [in] DWORD size);

    HRESULT GetProperty(
        [in] DWORD id,
        [out] LPVOID buffer,
        [in][out] LPDWORD buflen);

    HRESULT Finalize();

    HRESULT GetDisplayName(
        [out] LPWSTR buffer,
        [in][out] LPDWORD buflen,
        [in] DWORD flags);

    HRESULT Reserved(
        [in] REFIID riid,
        [in] IUnknown *pUnkReserved1,
        [in] IUnknown *pUnkReserved2,
        [in] LPCOLESTR szReserved,
        [in] LONGLONG llReserved,
        [in] LPVOID pvReserved,
        [in] DWORD cbReserved,
        [out] LPVOID *ppReserved);

    HRESULT GetName(
        [in][out] LPDWORD buflen,
        [out] LPWSTR buffer);

    HRESULT GetVersion(
        [out] LPDWORD hi,
        [out] LPDWORD low);

    HRESULT IsEqual(
        [in] IAssemblyName *name,
        [in] DWORD flags);

    HRESULT Clone(
        [out] IAssemblyName **name);
}

typedef [unique] IAssemblyName *LPASSEMBLYNAME;
typedef [public] enum
{
    CANOF_PARSE_DISPLAY_NAME = 0x1,
    CANOF_SET_DEFAULT_VALUES = 0x2
} CREATE_ASM_NAME_OBJ_FLAGS;

cpp_quote("HRESULT WINAPI CreateAssemblyCache(IAssemblyCache**,DWORD);")
cpp_quote("HRESULT WINAPI CreateAssemblyNameObject(LPASSEMBLYNAME *,LPCWSTR,DWORD,LPVOID);")
