' ########################################################################################
' Microsoft Windows
' File: metahost.inc
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_metahost_PBI)
#DEFINE PBX_metahost_PBI
%EQUATE `METAHOST_INC = 1
'/* header files for imported files */
#INCLUDE ONCE "Legacy/COM/Unknwn.inc"
#INCLUDE ONCE "Legacy/COM/OAIdl.inc"
#INCLUDE ONCE "Legacy/COM/OCIdl.inc"
#INCLUDE ONCE "Legacy/System/mscoree.inc"
DECLARE FUNCTION CLRCreateInstance LIB "mscoree.dll" ALIAS "CLRCreateInstance" ( BYREF clsid AS GUID , BYREF riid AS GUID , BYREF ppInterface AS IUnknown ) AS LONG
'EXTERN_C const IID LIBID_CLRMetaHost;
$CLSID_CLRStrongName = GUID$("{B79B0ACD-F5CD-409b-B5A5-A16244610B92}")
$IID_ICLRMetaHost = GUID$("{D332DB9E-B9B3-4125-8207-A14884F53216}")
$CLSID_CLRMetaHost = GUID$("{9280188d-0e8e-4867-b30c-7fa83884e8de}")
$IID_ICLRMetaHostPolicy = GUID$("{E2190695-77B2-492e-8E14-C4B3A7FDD593}")
$CLSID_CLRMetaHostPolicy = GUID$("{2ebcd49a-1b47-4a61-b13a-4a03701e594b}")
$IID_ICLRDebugging = GUID$("{d28f3c5a-9634-4206-a509-477552eefb10}")
$CLSID_CLRDebugging = GUID$("{bacc578d-fbdd-48a4-969f-02d932b74634}")
$IID_ICLRRuntimeInfo = GUID$("{BD39D1D2-BA2F-486a-89B0-B4B0CB466891}")
$IID_ICLRStrongName = GUID$("{9FD93CCF-3280-4391-B3A9-96E1CDE77C8D}")
$CLSID_CLRDebuggingLegacy = GUID$("{DF8395B5-A4BA-450b-A77C-A9A47762C520}")
$CLSID_CLRProfiling = GUID$("{bd097ed8-733e-43fe-8ed7-a95ff9a8448c}")
$IID_ICLRProfiling = GUID$("{b349abe3-b56f-4689-bfcd-76bf39d888ea}")
$IID_ICLRDebuggingLibraryProvider = GUID$("{3151c08d-4d09-4f9b-8838-2880bf18fe51}")
'typedef HRESULT ( __stdcall *CLRCreateInstanceFnPtr )(
' REFCLSID clsid
' REFIID riid
' LPVOID *ppInterface);
'typedef HRESULT ( __stdcall *CreateInterfaceFnPtr )(
' REFCLSID clsid
' REFIID riid
' LPVOID *ppInterface);
'typedef HRESULT ( __stdcall *CallbackThreadSetFnPtr )( void);
'typedef HRESULT ( __stdcall *CallbackThreadUnsetFnPtr )( void);
'typedef void ( __stdcall *RuntimeLoadedCallbackFnPtr )(
' ICLRRuntimeInfo *pRuntimeInfo
' CallbackThreadSetFnPtr pfnCallbackThreadSet
' CallbackThreadUnsetFnPtr pfnCallbackThreadUnset);
' ########################################################################################
' ICLRMetaHost interface
' IID = D332DB9E-B9B3-4125-8207-A14884F53216
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%ICLRMetaHost_INTERFACE_DEFINED)
 %ICLRMetaHost_INTERFACE_DEFINED = 1
INTERFACE ICLRMetaHost $IID_ICLRMetaHost
 INHERIT IAutomation
 ' =====================================================================================
 METHOD GetRuntime ( ' VTable offset = 12
 BYREF pwzVersion AS WSTRINGZ
 , BYREF riid AS GUID
 ) AS IUnknown
 ' =====================================================================================
 METHOD GetVersionFromFile ( ' VTable offset = 16
 BYREF pwzFilePath AS WSTRINGZ
 , BYREF pwzBuffer AS WSTRINGZ
 , BYREF pcchBuffer AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD EnumerateInstalledRuntimes ( ' VTable offset = 20
 ) AS IEnumUnknown
 ' =====================================================================================
 METHOD EnumerateLoadedRuntimes ( ' VTable offset = 24
 BYVAL hndProcess AS DWORD
 ) AS IEnumUnknown
 ' =====================================================================================
 METHOD RequestRuntimeLoadedNotification ( ' VTable offset = 28
 BYVAL pCallbackFunction AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD QueryLegacyV2RuntimeBinding ( ' VTable offset = 32
 BYREF riid AS GUID
 ) AS IUnknown
 ' =====================================================================================
 METHOD ExitProcess ( ' VTable offset = 36
 BYVAL iExitCode AS DWORD
 ) ' void
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __ICLRMetaHost_INTERFACE_DEFINED__ */
' enum METAHOST_POLICY_FLAGS
%EQUATE `METAHOST_POLICY_HIGHCOMPAT = 0
%EQUATE `METAHOST_POLICY_APPLY_UPGRADE_POLICY = &H8
%EQUATE `METAHOST_POLICY_EMULATE_EXE_LAUNCH = &H10
%EQUATE `METAHOST_POLICY_SHOW_ERROR_DIALOG = &H20
%EQUATE `METAHOST_POLICY_USE_PROCESS_IMAGE_PATH = &H40
%EQUATE `METAHOST_POLICY_ENSURE_SKU_SUPPORTED = &H80
' enum METAHOST_CONFIG_FLAGS
%EQUATE `METAHOST_CONFIG_FLAGS_LEGACY_V2_ACTIVATION_POLICY_UNSET = 0
%EQUATE `METAHOST_CONFIG_FLAGS_LEGACY_V2_ACTIVATION_POLICY_TRUE = &H1
%EQUATE `METAHOST_CONFIG_FLAGS_LEGACY_V2_ACTIVATION_POLICY_FALSE = &H2
%EQUATE `METAHOST_CONFIG_FLAGS_LEGACY_V2_ACTIVATION_POLICY_MASK = &H3
' ########################################################################################
' ICLRMetaHostPolicy interface
' IID = E2190695-77B2-492E-8E14-C4B3A7FDD593
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%ICLRMetaHostPolicy_INTERFACE_DEFINED)
 %ICLRMetaHostPolicy_INTERFACE_DEFINED = 1
INTERFACE ICLRMetaHostPolicy $IID_ICLRMetaHostPolicy
 INHERIT IAutomation
 ' =====================================================================================
 METHOD GetRequestedRuntime ( ' VTable offset = 12
 BYVAL dwPolicyFlags AS DWORD
 , BYREF pwzBinary AS WSTRINGZ
 , BYVAL pCfgStream AS IStream
 , BYREF pwzVersion AS WSTRINGZ
 , BYREF pcchVersion AS DWORD
 , BYREF pwzImageVersion AS WSTRINGZ
 , BYREF pcchImageVersion AS DWORD
 , BYREF pdwConfigFlags AS DWORD
 , BYREF riid AS GUID
 ) AS IUnknown
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __ICLRMetaHostPolicy_INTERFACE_DEFINED__ */
' ########################################################################################
' ICLRProfiling interface
' IID = B349ABE3-B56F-4689-BFCD-76BF39D888EA
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%ICLRProfiling_INTERFACE_DEFINED)
 %ICLRProfiling_INTERFACE_DEFINED = 1
INTERFACE ICLRProfiling $IID_ICLRProfiling
 INHERIT IAutomation
 ' =====================================================================================
 METHOD AttachProfiler ( ' VTable offset = 12
 BYVAL dwProfileeProcessID AS DWORD
 , BYVAL dwMillisecondsMax AS DWORD
 , BYREF pClsidProfiler AS GUID
 , BYREF wszProfilerPath AS GUID
 , BYVAL pvClientData AS DWORD
 , BYVAL cbClientData AS DWORD
 ) ' void
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __ICLRProfiling_INTERFACE_DEFINED__ */
TYPE CLR_DEBUGGING_VERSION WORD
 wStructVersion AS WORD
 wMajor AS WORD
 wMinor AS WORD
 wBuild AS WORD
 wRevision AS WORD
END TYPE
' enum CLR_DEBUGGING_PROCESS_FLAGS
%EQUATE `CLR_DEBUGGING_MANAGED_EVENT_PENDING = 1
' ########################################################################################
' ICLRDebuggingLibraryProvider interface
' IID = 3151C08D-4D09-4F9B-8838-2880BF18FE51
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%ICLRDebuggingLibraryProvider_INTERFACE_DEFINED)
 %ICLRDebuggingLibraryProvider_INTERFACE_DEFINED = 1
INTERFACE ICLRDebuggingLibraryProvider $IID_ICLRDebuggingLibraryProvider
 INHERIT IAutomation
 ' =====================================================================================
 METHOD ProvideLibrary ( ' VTable offset = 12
 BYREF pwszFileName AS WSTRINGZ
 , BYVAL dwTimestamp AS DWORD
 , BYVAL dwSizeOfImage AS DWORD
 , BYREF phModule AS DWORD
 ) ' void
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __ICLRDebuggingLibraryProvider_INTERFACE_DEFINED__ */
' ########################################################################################
' ICLRDebugging interface
' IID = D28F3C5A-9634-4206-A509-477552EEFB10
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%ICLRDebugging_INTERFACE_DEFINED)
 %ICLRDebugging_INTERFACE_DEFINED = 1
INTERFACE ICLRDebugging $IID_ICLRDebugging
 INHERIT IAutomation
 ' =====================================================================================
 METHOD OpenVirtualProcess ( ' VTable offset = 12
 BYVAL moduleBaseAddress AS QUAD
 , BYVAL pDataTarget AS IUnknown
 , BYVAL pLibraryProvider AS ICLRDebuggingLibraryProvider
 , BYREF pMaxDebuggerSupportedVersion AS CLR_DEBUGGING_VERSION
 , BYREF riidProcess AS GUID
 , BYREF ppProcess AS IUnknown
 , BYREF pVersion AS CLR_DEBUGGING_VERSION
 , BYREF pdwFlags AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD CanUnloadNow ( ' VTable offset = 16
 BYVAL hModule AS DWORD
 ) ' void
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __ICLRDebugging_INTERFACE_DEFINED__ */
' ########################################################################################
' ICLRRuntimeInfo interface
' IID = BD39D1D2-BA2F-486A-89B0-B4B0CB466891
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%ICLRRuntimeInfo_INTERFACE_DEFINED)
 %ICLRRuntimeInfo_INTERFACE_DEFINED = 1
INTERFACE ICLRRuntimeInfo $IID_ICLRRuntimeInfo
 INHERIT IAutomation
 ' =====================================================================================
 METHOD GetVersionString ( ' VTable offset = 12
 BYREF pwzBuffer AS WSTRINGZ
 , BYREF pcchBuffer AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD GetRuntimeDirectory ( ' VTable offset = 16
 BYREF pwzBuffer AS WSTRINGZ
 , BYREF pcchBuffer AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD IsLoaded ( ' VTable offset = 20
 BYVAL hndProcess AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD LoadErrorString ( ' VTable offset = 24
 BYVAL iResourceID AS DWORD
 , BYREF pwzBuffer AS WSTRINGZ
 , BYREF pcchBuffer AS DWORD
 , BYVAL iLocaleID AS LONG
 ) ' void
 ' =====================================================================================
 METHOD LoadLibrary ( ' VTable offset = 28
 BYREF pwzDllName AS WSTRINGZ
 ) AS DWORD
 ' =====================================================================================
 METHOD GetProcAddress ( ' VTable offset = 32
 BYREF pszProcName AS WSTRINGZ
 ) AS DWORD
 ' =====================================================================================
 METHOD GetInterface ( ' VTable offset = 36
 BYREF rclsid AS GUID
 , BYREF riid AS GUID
 ) AS IUnknown
 ' =====================================================================================
 METHOD IsLoadable ( ' VTable offset = 40
 ) AS LONG
 ' =====================================================================================
 METHOD SetDefaultStartupFlags ( ' VTable offset = 44
 BYVAL dwStartupFlags AS DWORD
 , BYREF pwzHostConfigFile AS WSTRINGZ
 ) ' void
 ' =====================================================================================
 METHOD GetDefaultStartupFlags ( ' VTable offset = 48
 BYREF pdwStartupFlags AS DWORD
 , BYREF pwzHostConfigFile AS WSTRINGZ
 , BYREF pcchHostConfigFile AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD BindAsLegacyV2Runtime ( ' VTable offset = 52
 ) ' void
 ' =====================================================================================
 METHOD IsStarted ( ' VTable offset = 56
 BYREF pbStarted AS LONG
 , BYREF pdwStartupFlags AS DWORD
 ) ' void
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __ICLRRuntimeInfo_INTERFACE_DEFINED__ */
' ########################################################################################
' ICLRStrongName interface
' IID = 9FD93CCF-3280-4391-B3A9-96E1CDE77C8D
' Inherited interface = IUnknown
' ########################################################################################
#IF NOT %DEF(%ICLRStrongName_INTERFACE_DEFINED)
 %ICLRStrongName_INTERFACE_DEFINED = 1
INTERFACE ICLRStrongName $IID_ICLRStrongName
 INHERIT IAutomation
 ' =====================================================================================
 METHOD GetHashFromAssemblyFile ( ' VTable offset = 12
 BYREF pszFilePath AS ASCIIZ
 , BYREF piHashAlg AS DWORD
 , BYVAL pbHash AS BYTE PTR
 , BYVAL cchHash AS DWORD
 , BYREF pchHash AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD GetHashFromAssemblyFileW ( ' VTable offset = 16
 BYREF pszFilePath AS WSTRINGZ
 , BYREF piHashAlg AS DWORD
 , BYVAL pbHash AS BYTE PTR
 , BYVAL cchHash AS DWORD
 , BYREF pchHash AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD GetHashFromBlob ( ' VTable offset = 20
 BYVAL pbBlob AS BYTE PTR
 , BYVAL cchBlob AS DWORD
 , BYREF piHashAlg AS DWORD
 , BYVAL pbHash AS BYTE PTR
 , BYVAL cchHash AS DWORD
 , BYREF pchHash AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD GetHashFromFile ( ' VTable offset = 24
 BYREF pszFilePath AS ASCIIZ
 , BYREF piHashAlg AS DWORD
 , BYVAL pbHash AS BYTE PTR
 , BYVAL cchHash AS DWORD
 , BYREF pchHash AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD GetHashFromFileW ( ' VTable offset = 28
 BYREF pszFilePath AS WSTRINGZ
 , BYREF piHashAlg AS DWORD
 , BYVAL pbHash AS BYTE PTR
 , BYVAL cchHash AS DWORD
 , BYREF pchHash AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD GetHashFromHandle ( ' VTable offset = 32
 BYVAL hFile AS DWORD
 , BYREF piHashAlg AS DWORD
 , BYVAL pbHash AS BYTE PTR
 , BYVAL cchHash AS DWORD
 , BYREF pchHash AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD StrongNameCompareAssemblies ( ' VTable offset = 36
 BYREF pwzAssembly1 AS WSTRINGZ
 , BYREF pwzAssembly2 AS WSTRINGZ
 ) AS DWORD
 ' =====================================================================================
 METHOD StrongNameFreeBuffer ( ' VTable offset = 40
 BYVAL pbMemory AS BYTE
 ) ' void
 ' =====================================================================================
 METHOD StrongNameGetBlob ( ' VTable offset = 44
 BYREF pwzFilePath AS WSTRINGZ
 , BYVAL pbBlob AS BYTE PTR
 , BYREF pcbBlob AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD StrongNameGetBlobFromImage ( ' VTable offset = 48
 BYVAL pbBase AS BYTE PTR
 , BYVAL dwLength AS DWORD
 , BYVAL pbBlob AS BYTE PTR
 , BYREF pcbBlob AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD StrongNameGetPublicKey ( ' VTable offset = 52
 BYREF pwzKeyContainer AS WSTRINGZ
 , BYVAL pbKeyBlob AS BYTE PTR
 , BYVAL cbKeyBlob AS DWORD
 , BYREF ppbPublicKeyBlob AS DWORD
 , BYREF pcbPublicKeyBlob AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD StrongNameHashSize ( ' VTable offset = 56
 BYVAL ulHashAlg AS DWORD
 ) AS DWORD
 ' =====================================================================================
 METHOD StrongNameKeyDelete ( ' VTable offset = 60
 BYREF pwzKeyContainer AS WSTRINGZ
 ) ' void
 ' =====================================================================================
 METHOD StrongNameKeyGen ( ' VTable offset = 64
 BYREF pwzKeyContainer AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 , BYREF ppbKeyBlob AS DWORD
 , BYREF pcbKeyBlob AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD StrongNameKeyGenEx ( ' VTable offset = 68
 BYREF pwzKeyContainer AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 , BYVAL dwKeySize AS DWORD
 , BYREF ppbKeyBlob AS DWORD
 , BYREF pcbKeyBlob AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD StrongNameKeyInstall ( ' VTable offset = 72
 BYREF pwzKeyContainer AS WSTRINGZ
 , BYVAL pbKeyBlob AS BYTE PTR
 , BYVAL cbKeyBlob AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD StrongNameSignatureGeneration ( ' VTable offset = 76
 BYREF pwzFilePath AS WSTRINGZ
 , BYREF pwzKeyContainer AS WSTRINGZ
 , BYVAL pbKeyBlob AS BYTE PTR
 , BYVAL cbKeyBlob AS DWORD
 , BYREF ppbSignatureBlob AS DWORD
 , BYREF pcbSignatureBlob AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD StrongNameSignatureGenerationEx ( ' VTable offset = 80
 BYREF wszFilePath AS WSTRINGZ
 , BYREF wszKeyContainer AS WSTRINGZ
 , BYVAL pbKeyBlob AS BYTE PTR
 , BYVAL cbKeyBlob AS DWORD
 , BYREF ppbSignatureBlob AS DWORD
 , BYREF pcbSignatureBlob AS DWORD
 , BYVAL dwFlags AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD StrongNameSignatureSize ( ' VTable offset = 84
 BYVAL pbPublicKeyBlob AS BYTE PTR
 , BYVAL cbPublicKeyBlob AS DWORD
 , BYREF pcbSize AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD StrongNameSignatureVerification ( ' VTable offset = 88
 BYREF pwzFilePath AS WSTRINGZ
 , BYVAL dwInFlags AS DWORD
 ) AS DWORD
 ' =====================================================================================
 METHOD StrongNameSignatureVerificationEx ( ' VTable offset = 92
 BYREF pwzFilePath AS WSTRINGZ
 , BYVAL fForceVerification AS BYTE
 ) AS BYTE
 ' =====================================================================================
 METHOD StrongNameSignatureVerificationFromImage ( ' VTable offset = 96
 BYVAL pbBase AS BYTE PTR
 , BYVAL dwLength AS DWORD
 , BYVAL dwInFlags AS DWORD
 ) AS DWORD
 ' =====================================================================================
 METHOD StrongNameTokenFromAssembly ( ' VTable offset = 100
 BYREF pwzFilePath AS WSTRINGZ
 , BYREF ppbStrongNameToken AS DWORD
 , BYREF pcbStrongNameToken AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD StrongNameTokenFromAssemblyEx ( ' VTable offset = 104
 BYREF pwzFilePath AS WSTRINGZ
 , BYREF ppbStrongNameToken AS DWORD
 , BYREF pcbStrongNameToken AS DWORD
 , BYREF ppbPublicKeyBlob AS DWORD
 , BYREF pcbPublicKeyBlob AS DWORD
 ) ' void
 ' =====================================================================================
 METHOD StrongNameTokenFromPublicKey ( ' VTable offset = 108
 BYVAL pbPublicKeyBlob AS BYTE PTR
 , BYVAL cbPublicKeyBlob AS DWORD
 , BYREF ppbStrongNameToken AS DWORD
 , BYREF pcbStrongNameToken AS DWORD
 ) ' void
 ' =====================================================================================
END INTERFACE
#ENDIF ' /* __ICLRStrongName_INTERFACE_DEFINED__ */
#ENDIF
