/*
 * Copyright 2010 Vincent Povirk 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 "wtypes.idl";
import "propidl.idl";

cpp_quote("#ifdef WINE_NO_UNICODE_MACROS")
cpp_quote("#undef LoadLibrary")
cpp_quote("#endif")

[
    object,
    local,
    uuid(bd39d1d2-ba2f-486a-89b0-b4b0cb466891)
]
interface ICLRRuntimeInfo : IUnknown
{
    HRESULT GetVersionString(
        [out, size_is(*pcchBuffer)] LPWSTR pwzBuffer,
        [in, out] DWORD *pcchBuffer);

    HRESULT GetRuntimeDirectory(
        [out, size_is(*pcchBuffer)] LPWSTR pwzBuffer,
        [in, out] DWORD *pcchBuffer);

    HRESULT IsLoaded(
        [in] HANDLE hndProcess,
        [out, retval] BOOL *pbLoaded);

    HRESULT LoadErrorString(
        [in] UINT iResourceID,
        [out, size_is(*pcchBuffer)] LPWSTR pwzBuffer,
        [in, out] DWORD *pcchBuffer,
        [in] LONG iLocaleid);

    HRESULT LoadLibrary(
        [in] LPCWSTR pwzDllName,
        [out, retval] HMODULE *phndModule);

    HRESULT GetProcAddress(
        [in] LPCSTR pszProcName,
        [out, retval] LPVOID *ppProc);

    HRESULT GetInterface(
        [in] REFCLSID rclsid,
        [in] REFIID riid,
        [out, iid_is(riid), retval] LPVOID *ppUnk);

    HRESULT IsLoadable(
        [out, retval] BOOL *pbLoadable);

    HRESULT SetDefaultStartupFlags(
        [in] DWORD dwStartupFlags,
        [in] LPCWSTR pwzHostConfigFile);

    HRESULT GetDefaultStartupFlags(
        [out] DWORD *pdwStartupFlags,
        [out, size_is(*pcchHostConfigFile)] LPWSTR pwzHostConfigFile,
        [in, out] DWORD *pcchHostConfigFile);

    HRESULT BindAsLegacyV2Runtime();

    HRESULT IsStarted(
        [out] BOOL *pbStarted,
        [out] DWORD *pdwStartupFlags);
};

typedef HRESULT (__stdcall *CallbackThreadSetFnPtr)();
typedef HRESULT (__stdcall *CallbackThreadUnsetFnPtr)();

typedef void (__stdcall *RuntimeLoadedCallbackFnPtr)(
    ICLRRuntimeInfo *pRuntimeInfo,
    CallbackThreadSetFnPtr pfnCallbackThreadSet,
    CallbackThreadUnsetFnPtr pfnCallbackThreadUnset);

cpp_quote("DEFINE_GUID(CLSID_CLRMetaHost, 0x9280188d,0x0e8e,0x4867,0xb3,0x0c,0x7f,0xa8,0x38,0x84,0xe8,0xde);")

[
    object,
    local,
    uuid(d332db9e-b9b3-4125-8207-a14884f53216)
]
interface ICLRMetaHost : IUnknown
{
    HRESULT GetRuntime(
        [in] LPCWSTR pwzVersion,
        [in] REFIID iid,
        [out, iid_is(iid), retval] LPVOID *ppRuntime);

    HRESULT GetVersionFromFile(
        [in] LPCWSTR pwzFilePath,
        [out, size_is(*pcchBuffer)] LPWSTR pwzBuffer,
        [in, out] DWORD *pcchBuffer);

    HRESULT EnumerateInstalledRuntimes(
        [out, retval] IEnumUnknown **ppEnumerator);

    HRESULT EnumerateLoadedRuntimes(
        [in] HANDLE hndProcess,
        [out, retval] IEnumUnknown **ppEnumerator);

    HRESULT RequestRuntimeLoadedNotification(
        [in] RuntimeLoadedCallbackFnPtr pCallbackFunction);

    HRESULT QueryLegacyV2RuntimeBinding(
        [in] REFIID riid,
        [out, iid_is(riid), retval] LPVOID *ppUnk);

    HRESULT ExitProcess(
        [in] INT32 iExitCode);
};

cpp_quote("HRESULT WINAPI CLRCreateInstance(REFCLSID clsid, REFIID riid, LPVOID *ppInterface);")
