Commit 4ce33c69 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

mscoree: Implement config file parsing.

parent 4b3f3021
MODULE = mscoree.dll MODULE = mscoree.dll
IMPORTS = dbghelp uuid shell32 advapi32 IMPORTS = dbghelp uuid shell32 advapi32 ole32 oleaut32 shlwapi
C_SRCS = \ C_SRCS = \
assembly.c \ assembly.c \
config.c \
corruntimehost.c \ corruntimehost.c \
metahost.c \ metahost.c \
mscoree_main.c mscoree_main.c
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "ole2.h" #include "ole2.h"
#include "corhdr.h" #include "corhdr.h"
#include "metahost.h" #include "metahost.h"
#include "wine/list.h"
#include "mscoree_private.h" #include "mscoree_private.h"
#include "wine/debug.h" #include "wine/debug.h"
......
...@@ -32,10 +32,10 @@ ...@@ -32,10 +32,10 @@
#include "cor.h" #include "cor.h"
#include "mscoree.h" #include "mscoree.h"
#include "metahost.h" #include "metahost.h"
#include "wine/list.h"
#include "mscoree_private.h" #include "mscoree_private.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL( mscoree ); WINE_DEFAULT_DEBUG_CHANNEL( mscoree );
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "corerror.h" #include "corerror.h"
#include "mscoree.h" #include "mscoree.h"
#include "metahost.h" #include "metahost.h"
#include "wine/list.h"
#include "mscoree_private.h" #include "mscoree_private.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -1041,15 +1042,15 @@ extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj) ...@@ -1041,15 +1042,15 @@ extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj)
HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file, HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result) 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; static const DWORD supported_startup_flags = 0;
static const DWORD supported_runtime_flags = RUNTIME_INFO_UPGRADE_VERSION; static const DWORD supported_runtime_flags = RUNTIME_INFO_UPGRADE_VERSION;
int i; int i;
WCHAR local_version[MAX_PATH]; WCHAR local_version[MAX_PATH];
ULONG local_version_size = MAX_PATH; ULONG local_version_size = MAX_PATH;
WCHAR local_config_file[MAX_PATH];
HRESULT hr; HRESULT hr;
parsed_config_file parsed_config;
if (config_file)
FIXME("ignoring config filename %s\n", debugstr_w(config_file));
if (startup_flags & ~supported_startup_flags) if (startup_flags & ~supported_startup_flags)
FIXME("unsupported startup flags %x\n", startup_flags & ~supported_startup_flags); FIXME("unsupported startup flags %x\n", startup_flags & ~supported_startup_flags);
...@@ -1057,6 +1058,43 @@ HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file, ...@@ -1057,6 +1058,43 @@ HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
if (runtimeinfo_flags & ~supported_runtime_flags) if (runtimeinfo_flags & ~supported_runtime_flags)
FIXME("unsupported runtimeinfo flags %x\n", runtimeinfo_flags & ~supported_runtime_flags); FIXME("unsupported runtimeinfo flags %x\n", runtimeinfo_flags & ~supported_runtime_flags);
if (exefile && !config_file)
{
strcpyW(local_config_file, exefile);
strcatW(local_config_file, dotconfig);
config_file = local_config_file;
}
if (config_file)
{
int found=0;
hr = parse_config_file(config_file, &parsed_config);
if (SUCCEEDED(hr))
{
supported_runtime *entry;
LIST_FOR_EACH_ENTRY(entry, &parsed_config.supported_runtimes, supported_runtime, entry)
{
hr = CLRMetaHost_GetRuntime(0, entry->version, &IID_ICLRRuntimeInfo, (void**)result);
if (SUCCEEDED(hr))
{
found = 1;
break;
}
}
}
else
{
WARN("failed to parse config file %s, hr=%x\n", debugstr_w(config_file), hr);
}
free_parsed_config_file(&parsed_config);
if (found)
return S_OK;
}
if (exefile && !version) if (exefile && !version)
{ {
hr = CLRMetaHost_GetVersionFromFile(0, exefile, local_version, &local_version_size); hr = CLRMetaHost_GetVersionFromFile(0, exefile, local_version, &local_version_size);
......
...@@ -32,12 +32,16 @@ ...@@ -32,12 +32,16 @@
#include "ole2.h" #include "ole2.h"
#include "ocidl.h" #include "ocidl.h"
#include "shellapi.h" #include "shellapi.h"
#include "xmldom.h"
#include "xmldso.h"
#include "initguid.h" #include "initguid.h"
#include "msxml2.h"
#include "cor.h" #include "cor.h"
#include "corerror.h" #include "corerror.h"
#include "mscoree.h" #include "mscoree.h"
#include "metahost.h" #include "metahost.h"
#include "wine/list.h"
#include "mscoree_private.h" #include "mscoree_private.h"
#include "wine/debug.h" #include "wine/debug.h"
......
...@@ -54,6 +54,21 @@ extern HRESULT force_get_runtime_info(ICLRRuntimeInfo **result); ...@@ -54,6 +54,21 @@ extern HRESULT force_get_runtime_info(ICLRRuntimeInfo **result);
extern HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result); extern HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result);
typedef struct parsed_config_file
{
struct list supported_runtimes;
} parsed_config_file;
typedef struct supported_runtime
{
struct list entry;
LPWSTR version;
} supported_runtime;
extern HRESULT parse_config_file(LPCWSTR filename, parsed_config_file *result);
extern void free_parsed_config_file(parsed_config_file *file);
/* Mono 2.6 embedding */ /* Mono 2.6 embedding */
typedef struct _MonoDomain MonoDomain; typedef struct _MonoDomain MonoDomain;
typedef struct _MonoAssembly MonoAssembly; typedef struct _MonoAssembly MonoAssembly;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment