From a9cda7093b5a29511e0eb063dbe26a81b68769ea Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Sun, 7 Sep 2008 11:48:34 +0000 Subject: [PATCH] - Add mscoree from wine svn path=/trunk/; revision=36025 --- reactos/dll/win32/mscoree/corruntimehost.c | 288 +++++++++++++++ reactos/dll/win32/mscoree/mscoree.rbuild | 11 + reactos/dll/win32/mscoree/mscoree.spec | 117 ++++++ reactos/dll/win32/mscoree/mscoree_main.c | 384 ++++++++++++++++++++ reactos/dll/win32/mscoree/mscoree_private.h | 26 ++ reactos/dll/win32/win32.rbuild | 3 + 6 files changed, 829 insertions(+) create mode 100644 reactos/dll/win32/mscoree/corruntimehost.c create mode 100644 reactos/dll/win32/mscoree/mscoree.rbuild create mode 100644 reactos/dll/win32/mscoree/mscoree.spec create mode 100644 reactos/dll/win32/mscoree/mscoree_main.c create mode 100644 reactos/dll/win32/mscoree/mscoree_private.h diff --git a/reactos/dll/win32/mscoree/corruntimehost.c b/reactos/dll/win32/mscoree/corruntimehost.c new file mode 100644 index 00000000000..9de9bf5497b --- /dev/null +++ b/reactos/dll/win32/mscoree/corruntimehost.c @@ -0,0 +1,288 @@ +/* + * + * Copyright 2008 Alistair Leslie-Hughes + * + * 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 + */ + +#define COBJMACROS + +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "ole2.h" + +#include "cor.h" +#include "mscoree.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL( mscoree ); + +typedef struct _corruntimehost +{ + const struct ICorRuntimeHostVtbl *lpVtbl; + LONG ref; +} corruntimehost; + +static inline corruntimehost *impl_from_ICorRuntimeHost( ICorRuntimeHost *iface ) +{ + return (corruntimehost *)((char*)iface - FIELD_OFFSET(corruntimehost, lpVtbl)); +} + +/*** IUnknown methods ***/ +static HRESULT WINAPI corruntimehost_QueryInterface(ICorRuntimeHost* iface, + REFIID riid, + void **ppvObject) +{ + corruntimehost *This = impl_from_ICorRuntimeHost( iface ); + TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + + if ( IsEqualGUID( riid, &IID_ICorRuntimeHost ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *ppvObject = iface; + } + else + { + FIXME("Unsupported interface %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + + ICorRuntimeHost_AddRef( iface ); + + return S_OK; +} + +static ULONG WINAPI corruntimehost_AddRef(ICorRuntimeHost* iface) +{ + corruntimehost *This = impl_from_ICorRuntimeHost( iface ); + return InterlockedIncrement( &This->ref ); +} + +static ULONG WINAPI corruntimehost_Release(ICorRuntimeHost* iface) +{ + corruntimehost *This = impl_from_ICorRuntimeHost( iface ); + ULONG ref; + + ref = InterlockedDecrement( &This->ref ); + if ( ref == 0 ) + { + HeapFree( GetProcessHeap(), 0, This ); + } + + return ref; +} + +/*** ICorRuntimeHost methods ***/ +static HRESULT WINAPI corruntimehost_CreateLogicalThreadState( + ICorRuntimeHost* iface) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_DeleteLogicalThreadState( + ICorRuntimeHost* iface) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_SwitchInLogicalThreadState( + ICorRuntimeHost* iface, + DWORD *fiberCookie) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_SwitchOutLogicalThreadState( + ICorRuntimeHost* iface, + DWORD **fiberCookie) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_LocksHeldByLogicalThread( + ICorRuntimeHost* iface, + DWORD *pCount) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_MapFile( + ICorRuntimeHost* iface, + HANDLE hFile, + HMODULE *mapAddress) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_GetConfiguration( + ICorRuntimeHost* iface, + ICorConfiguration **pConfiguration) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_Start( + ICorRuntimeHost* iface) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_Stop( + ICorRuntimeHost* iface) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_CreateDomain( + ICorRuntimeHost* iface, + LPCWSTR friendlyName, + IUnknown *identityArray, + IUnknown **appDomain) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_GetDefaultDomain( + ICorRuntimeHost* iface, + IUnknown **pAppDomain) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_EnumDomains( + ICorRuntimeHost* iface, + HDOMAINENUM *hEnum) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_NextDomain( + ICorRuntimeHost* iface, + HDOMAINENUM hEnum, + IUnknown **appDomain) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_CloseEnum( + ICorRuntimeHost* iface, + HDOMAINENUM hEnum) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_CreateDomainEx( + ICorRuntimeHost* iface, + LPCWSTR friendlyName, + IUnknown *setup, + IUnknown *evidence, + IUnknown **appDomain) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_CreateDomainSetup( + ICorRuntimeHost* iface, + IUnknown **appDomainSetup) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_CreateEvidence( + ICorRuntimeHost* iface, + IUnknown **evidence) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_UnloadDomain( + ICorRuntimeHost* iface, + IUnknown *appDomain) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI corruntimehost_CurrentDomain( + ICorRuntimeHost* iface, + IUnknown **appDomain) +{ + FIXME("stub %p\n", iface); + return E_NOTIMPL; +} + +static const struct ICorRuntimeHostVtbl corruntimehost_vtbl = +{ + corruntimehost_QueryInterface, + corruntimehost_AddRef, + corruntimehost_Release, + corruntimehost_CreateLogicalThreadState, + corruntimehost_DeleteLogicalThreadState, + corruntimehost_SwitchInLogicalThreadState, + corruntimehost_SwitchOutLogicalThreadState, + corruntimehost_LocksHeldByLogicalThread, + corruntimehost_MapFile, + corruntimehost_GetConfiguration, + corruntimehost_Start, + corruntimehost_Stop, + corruntimehost_CreateDomain, + corruntimehost_GetDefaultDomain, + corruntimehost_EnumDomains, + corruntimehost_NextDomain, + corruntimehost_CloseEnum, + corruntimehost_CreateDomainEx, + corruntimehost_CreateDomainSetup, + corruntimehost_CreateEvidence, + corruntimehost_UnloadDomain, + corruntimehost_CurrentDomain +}; + +IUnknown* create_corruntimehost(void) +{ + corruntimehost *This; + + This = HeapAlloc( GetProcessHeap(), 0, sizeof *This ); + if ( !This ) + return NULL; + + This->lpVtbl = &corruntimehost_vtbl; + This->ref = 1; + + FIXME("return iface %p\n", This); + + return (IUnknown*) &This->lpVtbl; +} diff --git a/reactos/dll/win32/mscoree/mscoree.rbuild b/reactos/dll/win32/mscoree/mscoree.rbuild new file mode 100644 index 00000000000..7c805276357 --- /dev/null +++ b/reactos/dll/win32/mscoree/mscoree.rbuild @@ -0,0 +1,11 @@ + + + . + wine + kernel32 + advapi32 + uuid + corruntimehost.c + mscoree_main.c + mscoree.spec + diff --git a/reactos/dll/win32/mscoree/mscoree.spec b/reactos/dll/win32/mscoree/mscoree.spec new file mode 100644 index 00000000000..0195b621df8 --- /dev/null +++ b/reactos/dll/win32/mscoree/mscoree.spec @@ -0,0 +1,117 @@ +17 stub InitErrors +18 stub PostError +19 stub InitSSAutoEnterThread +20 stub UpdateError +22 stdcall LoadStringRC(long ptr long long) +23 stub ReOpenMetaDataWithMemory + +@ stub CallFunctionShim +@ stub CloseCtrs +@ stub ClrCreateManagedInstance +@ stub CoEEShutDownCOM +@ stdcall CoInitializeCor(long) +@ stub CoInitializeEE +@ stub CoUninitializeCor +@ stub CoUninitializeEE +@ stub CollectCtrs +@ stdcall CorBindToCurrentRuntime(wstr ptr ptr ptr) +@ stub CorBindToRuntime +@ stub CorBindToRuntimeByCfg +@ stub CorBindToRuntimeByPath +@ stub CorBindToRuntimeByPathEx +@ stdcall CorBindToRuntimeEx(wstr wstr long ptr ptr ptr) +@ stdcall CorBindToRuntimeHost(wstr wstr wstr ptr long ptr ptr ptr) +@ stub CorDllMainWorker +@ stdcall CorExitProcess(long) +@ stub CorGetSvc +@ stub CorIsLatestSvc +@ stub CorMarkThreadInThreadPool +@ stub CorTickleSvc +@ stub CreateConfigStream +@ stub CreateDebuggingInterfaceFromVersion +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stub DllRegisterServer +@ stub DllUnregisterServer +@ stub EEDllGetClassObjectFromClass +@ stub EEDllRegisterServer +@ stub EEDllUnregisterServer +@ stdcall GetAssemblyMDImport(ptr ptr ptr) +@ stub GetCORRequiredVersion +@ stub GetCORRootDirectory +@ stdcall GetCORSystemDirectory(ptr long ptr) +@ stdcall GetCORVersion(ptr long ptr) +@ stub GetCompileInfo +@ stub GetFileVersion +@ stub GetHashFromAssemblyFile +@ stub GetHashFromAssemblyFileW +@ stub GetHashFromBlob +@ stub GetHashFromFile +@ stub GetHashFromFileW +@ stub GetHashFromHandle +@ stub GetHostConfigurationFile +@ stub GetMetaDataInternalInterface +@ stub GetMetaDataInternalInterfaceFromPublic +@ stub GetMetaDataPublicInterfaceFromInternal +@ stub GetPermissionRequests +@ stub GetPrivateContextsPerfCounters +@ stub GetProcessExecutableHeap +@ stub GetRealProcAddress +@ stdcall GetRequestedRuntimeInfo(wstr wstr wstr long long ptr long ptr ptr long ptr) +@ stub GetRequestedRuntimeVersion +@ stub GetRequestedRuntimeVersionForCLSID +@ stub GetStartupFlags +@ stub GetTargetForVTableEntry +@ stub GetTokenForVTableEntry +@ stdcall GetVersionFromProcess(ptr ptr long ptr) +@ stub GetXMLElement +@ stub GetXMLElementAttribute +@ stub GetXMLObject +@ stdcall LoadLibraryShim(ptr ptr ptr ptr) +@ stub LoadLibraryWithPolicyShim +@ stdcall LoadStringRCEx(long long ptr long long ptr) +@ stub LockClrVersion +@ stub MetaDataGetDispenser +@ stdcall ND_CopyObjDst(ptr ptr long long) +@ stdcall ND_CopyObjSrc(ptr long ptr long) +@ stdcall ND_RI2(ptr long) +@ stdcall ND_RI4(ptr long) +@ stdcall -ret64 ND_RI8(ptr long) +@ stdcall ND_RU1(ptr long) +@ stdcall ND_WI2(ptr long long) +@ stdcall ND_WI4(ptr long long) +@ stdcall ND_WI8(ptr long double) +@ stdcall ND_WU1(ptr long long) +@ stub OpenCtrs +@ stub ReOpenMetaDataWithMemoryEx +@ stub RunDll@ShimW +@ stub RuntimeOSHandle +@ stub RuntimeOpenImage +@ stub RuntimeReleaseHandle +@ stub SetTargetForVTableEntry +@ stub StrongNameCompareAssemblies +@ stub StrongNameErrorInfo +@ stub StrongNameFreeBuffer +@ stub StrongNameGetBlob +@ stub StrongNameGetBlobFromImage +@ stub StrongNameGetPublicKey +@ stub StrongNameHashSize +@ stub StrongNameKeyDelete +@ stub StrongNameKeyGen +@ stub StrongNameKeyGenEx +@ stub StrongNameKeyInstall +@ stub StrongNameSignatureGeneration +@ stub StrongNameSignatureGenerationEx +@ stub StrongNameSignatureSize +@ stub StrongNameSignatureVerification +@ stub StrongNameSignatureVerificationEx +@ stub StrongNameSignatureVerificationFromImage +@ stub StrongNameTokenFromAssembly +@ stub StrongNameTokenFromAssemblyEx +@ stub StrongNameTokenFromPublicKey +@ stub TranslateSecurityAttributes +@ stdcall _CorDllMain(long long ptr) +@ stdcall _CorExeMain2(ptr long ptr ptr ptr) +@ stdcall _CorExeMain() +@ stdcall _CorImageUnloading(ptr) +@ stdcall _CorValidateImage(ptr ptr) diff --git a/reactos/dll/win32/mscoree/mscoree_main.c b/reactos/dll/win32/mscoree/mscoree_main.c new file mode 100644 index 00000000000..c08118acc5c --- /dev/null +++ b/reactos/dll/win32/mscoree/mscoree_main.c @@ -0,0 +1,384 @@ +/* + * Implementation of mscoree.dll + * Microsoft Component Object Runtime Execution Engine + * + * Copyright 2006 Paul Chitescu + * + * 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 + */ + +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "ole2.h" + +#include "initguid.h" +#include "cor.h" +#include "mscoree.h" +#include "mscoree_private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL( mscoree ); + +static LPWSTR get_mono_exe(void) +{ + static const WCHAR mono_exe[] = {'b','i','n','\\','m','o','n','o','.','e','x','e',' ',0}; + static const WCHAR mono_key[] = {'S','o','f','t','w','a','r','e','\\','N','o','v','e','l','l','\\','M','o','n','o',0}; + static const WCHAR defaul_clr[] = {'D','e','f','a','u','l','t','C','L','R',0}; + static const WCHAR install_root[] = {'S','d','k','I','n','s','t','a','l','l','R','o','o','t',0}; + static const WCHAR slash[] = {'\\',0}; + + WCHAR version[64], version_key[MAX_PATH], root[MAX_PATH], *ret; + DWORD len, size; + HKEY key; + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, mono_key, 0, KEY_READ, &key)) + return NULL; + + len = sizeof(version); + if (RegQueryValueExW(key, defaul_clr, 0, NULL, (LPBYTE)version, &len)) + { + RegCloseKey(key); + return NULL; + } + RegCloseKey(key); + + lstrcpyW(version_key, mono_key); + lstrcatW(version_key, slash); + lstrcatW(version_key, version); + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, version_key, 0, KEY_READ, &key)) + return NULL; + + len = sizeof(root); + if (RegQueryValueExW(key, install_root, 0, NULL, (LPBYTE)root, &len)) + { + RegCloseKey(key); + return NULL; + } + RegCloseKey(key); + + size = len + sizeof(slash) + sizeof(mono_exe); + if (!(ret = HeapAlloc(GetProcessHeap(), 0, size))) return NULL; + + lstrcpyW(ret, root); + lstrcatW(ret, slash); + lstrcatW(ret, mono_exe); + + return ret; +} + +HRESULT WINAPI CorBindToRuntimeHost(LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor, + LPCWSTR pwszHostConfigFile, VOID *pReserved, + DWORD startupFlags, REFCLSID rclsid, + REFIID riid, LPVOID *ppv) +{ + WCHAR *mono_exe; + + FIXME("(%s, %s, %s, %p, %d, %p, %p, %p): semi-stub!\n", debugstr_w(pwszVersion), + debugstr_w(pwszBuildFlavor), debugstr_w(pwszHostConfigFile), pReserved, + startupFlags, rclsid, riid, ppv); + + if (!(mono_exe = get_mono_exe())) + { + MESSAGE("wine: Install the Windows version of Mono to run .NET executables\n"); + return E_FAIL; + } + + HeapFree(GetProcessHeap(), 0, mono_exe); + + return S_OK; +} + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) + { + //case DLL_WINE_PREATTACH: + //return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + break; + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +BOOL WINAPI _CorDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + FIXME("(%p, %d, %p): stub\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + break; + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +__int32 WINAPI _CorExeMain(void) +{ + STARTUPINFOW si; + PROCESS_INFORMATION pi; + WCHAR *mono_exe, *cmd_line; + DWORD size, exit_code; + + if (!(mono_exe = get_mono_exe())) + { + MESSAGE("install the Windows version of Mono to run .NET executables\n"); + return -1; + } + + size = (lstrlenW(mono_exe) + lstrlenW(GetCommandLineW()) + 1) * sizeof(WCHAR); + if (!(cmd_line = HeapAlloc(GetProcessHeap(), 0, size))) + { + HeapFree(GetProcessHeap(), 0, mono_exe); + return -1; + } + + lstrcpyW(cmd_line, mono_exe); + HeapFree(GetProcessHeap(), 0, mono_exe); + lstrcatW(cmd_line, GetCommandLineW()); + + TRACE("new command line: %s\n", debugstr_w(cmd_line)); + + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + if (!CreateProcessW(NULL, cmd_line, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) + { + HeapFree(GetProcessHeap(), 0, cmd_line); + return -1; + } + HeapFree(GetProcessHeap(), 0, cmd_line); + + /* wait for the process to exit */ + WaitForSingleObject(pi.hProcess, INFINITE); + GetExitCodeProcess(pi.hProcess, &exit_code); + + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); + + return (int)exit_code; +} + +__int32 WINAPI _CorExeMain2(PBYTE ptrMemory, DWORD cntMemory, LPWSTR imageName, LPWSTR loaderName, LPWSTR cmdLine) +{ + TRACE("(%p, %u, %s, %s, %s)\n", ptrMemory, cntMemory, debugstr_w(imageName), debugstr_w(loaderName), debugstr_w(cmdLine)); + FIXME("Directly running .NET applications not supported.\n"); + return -1; +} + +void WINAPI CorExitProcess(int exitCode) +{ + FIXME("(%x) stub\n", exitCode); + ExitProcess(exitCode); +} + +VOID WINAPI _CorImageUnloading(PVOID imageBase) +{ + TRACE("(%p): stub\n", imageBase); +} + +HRESULT WINAPI _CorValidateImage(PVOID* imageBase, LPCWSTR imageName) +{ + TRACE("(%p, %s): stub\n", imageBase, debugstr_w(imageName)); + return E_FAIL; +} + +HRESULT WINAPI GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD *dwLength) +{ + FIXME("(%p, %d, %p): stub!\n", pbuffer, cchBuffer, dwLength); + + if (!dwLength) + return E_POINTER; + + *dwLength = 0; + + return S_OK; +} + +HRESULT WINAPI GetCORVersion(LPWSTR pbuffer, DWORD cchBuffer, DWORD *dwLength) +{ + static const WCHAR version[] = {'v','1','.','1','.','4','3','2','2',0}; + + FIXME("(%p, %d, %p): semi-stub!\n", pbuffer, cchBuffer, dwLength); + + if (!dwLength) + return E_POINTER; + + *dwLength = lstrlenW(version); + + if (cchBuffer < *dwLength) + return ERROR_INSUFFICIENT_BUFFER; + + if (pbuffer) + lstrcpyW(pbuffer, version); + + return S_OK; +} + +HRESULT WINAPI GetRequestedRuntimeInfo(LPCWSTR pExe, LPCWSTR pwszVersion, LPCWSTR pConfigurationFile, + DWORD startupFlags, DWORD runtimeInfoFlags, LPWSTR pDirectory, DWORD dwDirectory, DWORD *dwDirectoryLength, + LPWSTR pVersion, DWORD cchBuffer, DWORD *dwlength) +{ + FIXME("(%s, %s, %s, 0x%08x, 0x%08x, %p, 0x%08x, %p, %p, 0x%08x, %p) stub\n", debugstr_w(pExe), + debugstr_w(pwszVersion), debugstr_w(pConfigurationFile), startupFlags, runtimeInfoFlags, pDirectory, + dwDirectory, dwDirectoryLength, pVersion, cchBuffer, dwlength); + return GetCORVersion(pVersion, cchBuffer, dwlength); +} + +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); + + if (phModDll) *phModDll = LoadLibraryW(szDllName); + return S_OK; +} + +HRESULT WINAPI CoInitializeCor(DWORD fFlags) +{ + FIXME("(0x%08x): stub\n", fFlags); + return S_OK; +} + +HRESULT WINAPI GetAssemblyMDImport(LPCWSTR szFileName, REFIID riid, IUnknown **ppIUnk) +{ + FIXME("(%p %s, %p, %p): stub\n", szFileName, debugstr_w(szFileName), riid, *ppIUnk); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +HRESULT WINAPI GetVersionFromProcess(HANDLE hProcess, LPWSTR pVersion, DWORD cchBuffer, DWORD *dwLength) +{ + FIXME("(%p, %p, %d, %p): stub\n", hProcess, pVersion, cchBuffer, dwLength); + return E_NOTIMPL; +} + +HRESULT WINAPI LoadStringRCEx(LCID culture, UINT resId, LPWSTR pBuffer, int iBufLen, int bQuiet, int* pBufLen) +{ + HRESULT res = S_OK; + if ((iBufLen <= 0) || !pBuffer) + return E_INVALIDARG; + pBuffer[0] = 0; + if (resId) { + FIXME("(%d, %x, %p, %d, %d, %p): semi-stub\n", culture, resId, pBuffer, iBufLen, bQuiet, pBufLen); + res = E_NOTIMPL; + } + else + res = E_FAIL; + if (pBufLen) + *pBufLen = lstrlenW(pBuffer); + return res; +} + +HRESULT WINAPI LoadStringRC(UINT resId, LPWSTR pBuffer, int iBufLen, int bQuiet) +{ + return LoadStringRCEx(-1, resId, pBuffer, iBufLen, bQuiet, NULL); +} + +HRESULT WINAPI CorBindToRuntimeEx(LPWSTR szVersion, LPWSTR szBuildFlavor, DWORD nflags, REFCLSID rslsid, + REFIID riid, LPVOID *ppv) +{ + FIXME("%s %s %d %s %s %p\n", debugstr_w(szVersion), debugstr_w(szBuildFlavor), nflags, debugstr_guid( rslsid ), + debugstr_guid( riid ), ppv); + + if(IsEqualGUID( riid, &IID_ICorRuntimeHost )) + { + *ppv = create_corruntimehost(); + return S_OK; + } + *ppv = NULL; + return E_NOTIMPL; +} + +HRESULT WINAPI CorBindToCurrentRuntime(LPCWSTR filename, REFCLSID rclsid, REFIID riid, LPVOID *ppv) +{ + FIXME("(%s, %s, %s, %p): stub\n", debugstr_w(filename), debugstr_guid(rclsid), debugstr_guid(riid), ppv); + return E_NOTIMPL; +} + +HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + FIXME("(%p, %p, %p): stub\n", rclsid, riid, ppv); + if(!ppv) + return E_INVALIDARG; + + return E_NOTIMPL; +} + +HRESULT WINAPI DllCanUnloadNow(VOID) +{ + FIXME("stub\n"); + return S_OK; +} + +INT WINAPI ND_RU1( const void *ptr, INT offset ) +{ + return *((const BYTE *)ptr + offset); +} + +INT WINAPI ND_RI2( const void *ptr, INT offset ) +{ + return *(const SHORT *)((const BYTE *)ptr + offset); +} + +INT WINAPI ND_RI4( const void *ptr, INT offset ) +{ + return *(const INT *)((const BYTE *)ptr + offset); +} + +INT64 WINAPI ND_RI8( const void *ptr, INT offset ) +{ + return *(const INT64 *)((const BYTE *)ptr + offset); +} + +void WINAPI ND_WU1( void *ptr, INT offset, BYTE val ) +{ + *((BYTE *)ptr + offset) = val; +} + +void WINAPI ND_WI2( void *ptr, INT offset, SHORT val ) +{ + *(SHORT *)((BYTE *)ptr + offset) = val; +} + +void WINAPI ND_WI4( void *ptr, INT offset, INT val ) +{ + *(INT *)((BYTE *)ptr + offset) = val; +} + +void WINAPI ND_WI8( void *ptr, INT offset, INT64 val ) +{ + *(INT64 *)((BYTE *)ptr + offset) = val; +} + +void WINAPI ND_CopyObjDst( const void *src, void *dst, INT offset, INT size ) +{ + memcpy( (BYTE *)dst + offset, src, size ); +} + +void WINAPI ND_CopyObjSrc( const void *src, INT offset, void *dst, INT size ) +{ + memcpy( dst, (const BYTE *)src + offset, size ); +} diff --git a/reactos/dll/win32/mscoree/mscoree_private.h b/reactos/dll/win32/mscoree/mscoree_private.h new file mode 100644 index 00000000000..f329455fff1 --- /dev/null +++ b/reactos/dll/win32/mscoree/mscoree_private.h @@ -0,0 +1,26 @@ +/* + * + * Copyright 2008 Alistair Leslie-Hughes + * + * 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 + */ + +#ifndef __MSCOREE_PRIVATE__ +#define __MSCOREE_PRIVATE__ + +extern IUnknown* create_corruntimehost(void); + + +#endif /* __MSCOREE_PRIVATE__ */ diff --git a/reactos/dll/win32/win32.rbuild b/reactos/dll/win32/win32.rbuild index bd011344499..92c472e3c24 100644 --- a/reactos/dll/win32/win32.rbuild +++ b/reactos/dll/win32/win32.rbuild @@ -154,6 +154,9 @@ + + +