mscoree: Implement LoadLibraryShim.

This commit is contained in:
Vincent Povirk 2010-10-27 10:51:19 -05:00 committed by Alexandre Julliard
parent 852133973f
commit 1682a92dd5
4 changed files with 53 additions and 6 deletions

View File

@ -249,9 +249,17 @@ static HRESULT WINAPI CLRRuntimeInfo_LoadErrorString(ICLRRuntimeInfo* iface,
static HRESULT WINAPI CLRRuntimeInfo_LoadLibrary(ICLRRuntimeInfo* iface,
LPCWSTR pwzDllName, HMODULE *phndModule)
{
FIXME("%p %s %p\n", iface, debugstr_w(pwzDllName), phndModule);
WCHAR version[MAX_PATH];
HRESULT hr;
DWORD cchBuffer;
return E_NOTIMPL;
TRACE("%p %s %p\n", iface, debugstr_w(pwzDllName), phndModule);
cchBuffer = MAX_PATH;
hr = ICLRRuntimeInfo_GetVersionString(iface, version, &cchBuffer);
if (FAILED(hr)) return hr;
return LoadLibraryShim(pwzDllName, version, NULL, phndModule);
}
static HRESULT WINAPI CLRRuntimeInfo_GetProcAddress(ICLRRuntimeInfo* iface,
@ -947,3 +955,8 @@ HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
return CLR_E_SHIM_RUNTIME;
}
HRESULT force_get_runtime_info(ICLRRuntimeInfo **result)
{
return IUnknown_QueryInterface((IUnknown*)&runtimes[0], &IID_ICLRRuntimeInfo, (void**)result);
}

View File

@ -549,10 +549,42 @@ HRESULT WINAPI GetRequestedRuntimeInfo(LPCWSTR pExe, LPCWSTR pwszVersion, LPCWST
HRESULT WINAPI LoadLibraryShim( LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE * phModDll)
{
FIXME("(%p %s, %p, %p, %p): semi-stub\n", szDllName, debugstr_w(szDllName), szVersion, pvReserved, phModDll);
HRESULT ret=S_OK;
WCHAR dll_filename[MAX_PATH];
WCHAR version[MAX_PATH];
static const WCHAR default_version[] = {'v','1','.','1','.','4','3','2','2',0};
static const WCHAR slash[] = {'\\',0};
DWORD dummy;
if (phModDll) *phModDll = LoadLibraryW(szDllName);
return S_OK;
TRACE("(%p %s, %p, %p, %p)\n", szDllName, debugstr_w(szDllName), szVersion, pvReserved, phModDll);
if (!szDllName || !phModDll)
return E_POINTER;
if (!get_install_root(dll_filename))
{
ERR("error reading registry key for installroot\n");
dll_filename[0] = 0;
}
else
{
if (!szVersion)
{
ret = GetCORVersion(version, MAX_PATH, &dummy);
if (SUCCEEDED(ret))
szVersion = version;
else
szVersion = default_version;
}
strcatW(dll_filename, szVersion);
strcatW(dll_filename, slash);
}
strcatW(dll_filename, szDllName);
*phModDll = LoadLibraryW(dll_filename);
return *phModDll ? S_OK : E_HANDLE;
}
HRESULT WINAPI LockClrVersion(FLockClrVersionCallback hostCallback, FLockClrVersionCallback *pBeginHostSetup, FLockClrVersionCallback *pEndHostSetup)

View File

@ -48,6 +48,8 @@ typedef struct CLRRuntimeInfo
extern HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result);
extern HRESULT force_get_runtime_info(ICLRRuntimeInfo **result);
/* Mono 2.6 embedding */
typedef struct _MonoDomain MonoDomain;
typedef struct _MonoAssembly MonoAssembly;

View File

@ -241,7 +241,7 @@ static void test_loadlibraryshim(void)
}
hr = pLoadLibraryShim(nosuchdll, latest, NULL, &hdll);
todo_wine ok(hr == E_HANDLE, "LoadLibraryShim failed, hr=%x\n", hr);
ok(hr == E_HANDLE, "LoadLibraryShim failed, hr=%x\n", hr);
if (SUCCEEDED(hr))
FreeLibrary(hdll);