mscoree: Add support for config stream in GetRequestedRuntime.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=37751 Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4df6d303d6
commit
e41502b429
|
@ -650,33 +650,44 @@ static HRESULT parse_config(VARIANT input, parsed_config_file *result)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT parse_config_file(LPCWSTR filename, parsed_config_file *result)
|
||||
HRESULT parse_config_stream(IStream *stream, parsed_config_file *result)
|
||||
{
|
||||
IStream *stream;
|
||||
VARIANT var;
|
||||
HRESULT hr;
|
||||
HRESULT initresult;
|
||||
|
||||
init_config(result);
|
||||
|
||||
|
||||
hr = CreateConfigStream(filename, &stream);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
initresult = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
|
||||
V_VT(&var) = VT_UNKNOWN;
|
||||
V_UNKNOWN(&var) = (IUnknown*)stream;
|
||||
|
||||
hr = parse_config(var, result);
|
||||
|
||||
IStream_Release(stream);
|
||||
if (SUCCEEDED(initresult))
|
||||
CoUninitialize();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT parse_config_file(LPCWSTR filename, parsed_config_file *result)
|
||||
{
|
||||
HRESULT hr;
|
||||
IStream *stream;
|
||||
|
||||
init_config(result);
|
||||
|
||||
hr = CreateConfigStream(filename, &stream);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = parse_config_stream(stream, result);
|
||||
|
||||
IStream_Release(stream);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
void free_parsed_config_file(parsed_config_file *file)
|
||||
{
|
||||
supported_runtime *cursor, *cursor2;
|
||||
|
|
|
@ -1296,7 +1296,7 @@ static void CDECL ReallyFixupVTable(struct dll_fixup *fixup)
|
|||
hr = E_OUTOFMEMORY;
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
hr = get_runtime_info(filename, NULL, NULL, 0, 0, FALSE, &info);
|
||||
hr = get_runtime_info(filename, NULL, NULL, NULL, 0, 0, FALSE, &info);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
hr = ICLRRuntimeInfo_GetRuntimeHost(info, &host);
|
||||
|
@ -1469,7 +1469,7 @@ __int32 WINAPI _CorExeMain(void)
|
|||
|
||||
FixupVTable(GetModuleHandleW(NULL));
|
||||
|
||||
hr = get_runtime_info(filename, NULL, NULL, 0, 0, FALSE, &info);
|
||||
hr = get_runtime_info(filename, NULL, NULL, NULL, 0, 0, FALSE, &info);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
|
@ -1831,7 +1831,7 @@ HRESULT create_monodata(REFIID riid, LPVOID *ppObj )
|
|||
*ppObj = NULL;
|
||||
|
||||
|
||||
hr = get_runtime_info(filename, NULL, NULL, 0, 0, FALSE, &info);
|
||||
hr = get_runtime_info(filename, NULL, NULL, NULL, 0, 0, FALSE, &info);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = ICLRRuntimeInfo_GetRuntimeHost(info, &host);
|
||||
|
|
|
@ -1126,11 +1126,10 @@ static HRESULT WINAPI metahostpolicy_GetRequestedRuntime(ICLRMetaHostPolicy *ifa
|
|||
pwzVersion, pcchVersion, pwzImageVersion, pcchImageVersion, pdwConfigFlags,
|
||||
debugstr_guid(riid), ppRuntime);
|
||||
|
||||
if (pCfgStream)
|
||||
FIXME("ignoring config file stream\n");
|
||||
|
||||
if (pdwConfigFlags)
|
||||
if (pdwConfigFlags) {
|
||||
FIXME("ignoring config flags\n");
|
||||
*pdwConfigFlags = 0;
|
||||
}
|
||||
|
||||
if(dwPolicyFlags & METAHOST_POLICY_USE_PROCESS_IMAGE_PATH)
|
||||
{
|
||||
|
@ -1145,7 +1144,7 @@ static HRESULT WINAPI metahostpolicy_GetRequestedRuntime(ICLRMetaHostPolicy *ifa
|
|||
if(dwPolicyFlags & METAHOST_POLICY_APPLY_UPGRADE_POLICY)
|
||||
flags |= RUNTIME_INFO_UPGRADE_VERSION;
|
||||
|
||||
hr = get_runtime_info(path, pwzImageVersion, NULL, 0, flags, FALSE, &result);
|
||||
hr = get_runtime_info(path, pwzImageVersion, NULL, pCfgStream, 0, flags, FALSE, &result);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (pwzImageVersion)
|
||||
|
@ -1276,7 +1275,8 @@ static MonoAssembly* CDECL mono_assembly_preload_hook_fn(MonoAssemblyName *aname
|
|||
}
|
||||
|
||||
HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
|
||||
DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result)
|
||||
IStream *config_stream, DWORD startup_flags, DWORD runtimeinfo_flags,
|
||||
BOOL legacy, ICLRRuntimeInfo **result)
|
||||
{
|
||||
static const WCHAR dotconfig[] = {'.','c','o','n','f','i','g',0};
|
||||
static const DWORD supported_startup_flags = 0;
|
||||
|
@ -1297,7 +1297,7 @@ HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
|
|||
if (exefile && !exefile[0])
|
||||
exefile = NULL;
|
||||
|
||||
if (exefile && !config_file)
|
||||
if (exefile && !config_file && !config_stream)
|
||||
{
|
||||
strcpyW(local_config_file, exefile);
|
||||
strcatW(local_config_file, dotconfig);
|
||||
|
@ -1305,10 +1305,13 @@ HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
|
|||
config_file = local_config_file;
|
||||
}
|
||||
|
||||
if (config_file)
|
||||
if (config_file || config_stream)
|
||||
{
|
||||
BOOL found = FALSE;
|
||||
if (config_file)
|
||||
hr = parse_config_file(config_file, &parsed_config);
|
||||
else
|
||||
hr = parse_config_stream(config_stream, &parsed_config);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
|
|
|
@ -205,7 +205,7 @@ HRESULT WINAPI CorBindToRuntimeHost(LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor
|
|||
|
||||
*ppv = NULL;
|
||||
|
||||
ret = get_runtime_info(NULL, pwszVersion, pwszHostConfigFile, startupFlags, 0, TRUE, &info);
|
||||
ret = get_runtime_info(NULL, pwszVersion, pwszHostConfigFile, NULL, startupFlags, 0, TRUE, &info);
|
||||
|
||||
if (SUCCEEDED(ret))
|
||||
{
|
||||
|
@ -274,7 +274,7 @@ HRESULT WINAPI GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD *dwL
|
|||
if (!dwLength || !pbuffer)
|
||||
return E_POINTER;
|
||||
|
||||
ret = get_runtime_info(NULL, NULL, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
||||
ret = get_runtime_info(NULL, NULL, NULL, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
||||
|
||||
if (SUCCEEDED(ret))
|
||||
{
|
||||
|
@ -297,7 +297,7 @@ HRESULT WINAPI GetCORVersion(LPWSTR pbuffer, DWORD cchBuffer, DWORD *dwLength)
|
|||
if (!dwLength || !pbuffer)
|
||||
return E_POINTER;
|
||||
|
||||
ret = get_runtime_info(NULL, NULL, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
||||
ret = get_runtime_info(NULL, NULL, NULL, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
||||
|
||||
if (SUCCEEDED(ret))
|
||||
{
|
||||
|
@ -336,7 +336,7 @@ HRESULT WINAPI GetRequestedRuntimeInfo(LPCWSTR pExe, LPCWSTR pwszVersion, LPCWST
|
|||
|
||||
if (!dwlength) dwlength = &length_dummy;
|
||||
|
||||
ret = get_runtime_info(pExe, pwszVersion, pConfigurationFile, startupFlags, runtimeInfoFlags, TRUE, &info);
|
||||
ret = get_runtime_info(pExe, pwszVersion, pConfigurationFile, NULL, startupFlags, runtimeInfoFlags, TRUE, &info);
|
||||
|
||||
if (SUCCEEDED(ret))
|
||||
{
|
||||
|
@ -482,7 +482,7 @@ HRESULT WINAPI CorBindToRuntimeEx(LPWSTR szVersion, LPWSTR szBuildFlavor, DWORD
|
|||
|
||||
*ppv = NULL;
|
||||
|
||||
ret = get_runtime_info(NULL, szVersion, NULL, nflags, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
||||
ret = get_runtime_info(NULL, szVersion, NULL, NULL, nflags, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
||||
|
||||
if (SUCCEEDED(ret))
|
||||
{
|
||||
|
@ -503,7 +503,7 @@ HRESULT WINAPI CorBindToCurrentRuntime(LPCWSTR filename, REFCLSID rclsid, REFIID
|
|||
|
||||
*ppv = NULL;
|
||||
|
||||
ret = get_runtime_info(NULL, NULL, filename, 0, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
||||
ret = get_runtime_info(NULL, NULL, filename, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
||||
|
||||
if (SUCCEEDED(ret))
|
||||
{
|
||||
|
@ -526,7 +526,7 @@ STDAPI ClrCreateManagedInstance(LPCWSTR pTypeName, REFIID riid, void **ppObject)
|
|||
TRACE("(%s,%s,%p)\n", debugstr_w(pTypeName), debugstr_guid(riid), ppObject);
|
||||
|
||||
/* FIXME: How to determine which runtime version to use? */
|
||||
ret = get_runtime_info(NULL, NULL, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
||||
ret = get_runtime_info(NULL, NULL, NULL, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
||||
|
||||
if (SUCCEEDED(ret))
|
||||
{
|
||||
|
|
|
@ -103,7 +103,8 @@ typedef struct CorDebug
|
|||
} CorDebug;
|
||||
|
||||
extern HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
|
||||
DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result) DECLSPEC_HIDDEN;
|
||||
IStream *config_stream, DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy,
|
||||
ICLRRuntimeInfo **result) DECLSPEC_HIDDEN;
|
||||
|
||||
extern HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result) DECLSPEC_HIDDEN;
|
||||
|
||||
|
@ -122,6 +123,8 @@ typedef struct supported_runtime
|
|||
|
||||
extern HRESULT parse_config_file(LPCWSTR filename, parsed_config_file *result) DECLSPEC_HIDDEN;
|
||||
|
||||
extern HRESULT parse_config_stream(IStream *stream, parsed_config_file *result) DECLSPEC_HIDDEN;
|
||||
|
||||
extern void free_parsed_config_file(parsed_config_file *file) DECLSPEC_HIDDEN;
|
||||
|
||||
typedef enum {
|
||||
|
|
Loading…
Reference in New Issue