2006-10-06 11:21:02 +02:00
|
|
|
/*
|
|
|
|
* 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 <stdarg.h>
|
|
|
|
|
2010-10-01 21:11:09 +02:00
|
|
|
#define COBJMACROS
|
2010-04-02 22:33:12 +02:00
|
|
|
#include "wine/unicode.h"
|
2010-09-21 20:26:04 +02:00
|
|
|
#include "wine/library.h"
|
2006-10-06 11:21:02 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2006-11-01 21:42:30 +01:00
|
|
|
#include "winuser.h"
|
2010-04-02 22:33:12 +02:00
|
|
|
#include "winnls.h"
|
2006-12-11 22:13:48 +01:00
|
|
|
#include "winreg.h"
|
2006-11-01 21:42:30 +01:00
|
|
|
#include "ole2.h"
|
2010-09-21 22:34:18 +02:00
|
|
|
#include "ocidl.h"
|
2010-04-02 22:33:12 +02:00
|
|
|
#include "shellapi.h"
|
2006-10-06 11:21:02 +02:00
|
|
|
|
2008-03-28 11:10:55 +01:00
|
|
|
#include "initguid.h"
|
2010-10-05 00:37:00 +02:00
|
|
|
#include "msxml2.h"
|
2010-08-26 00:14:41 +02:00
|
|
|
#include "corerror.h"
|
2011-09-27 01:06:18 +02:00
|
|
|
#include "cor.h"
|
2007-08-04 03:16:33 +02:00
|
|
|
#include "mscoree.h"
|
2011-09-27 01:06:18 +02:00
|
|
|
#include "corhdr.h"
|
|
|
|
#include "cordebug.h"
|
2010-09-21 22:34:18 +02:00
|
|
|
#include "metahost.h"
|
2011-09-27 01:06:18 +02:00
|
|
|
#include "fusion.h"
|
2010-10-05 00:37:00 +02:00
|
|
|
#include "wine/list.h"
|
2008-03-28 11:10:55 +01:00
|
|
|
#include "mscoree_private.h"
|
2011-10-11 07:08:00 +02:00
|
|
|
#include "rpcproxy.h"
|
2007-08-04 03:16:33 +02:00
|
|
|
|
2006-10-06 11:21:02 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL( mscoree );
|
|
|
|
|
2011-10-11 07:08:00 +02:00
|
|
|
static HINSTANCE MSCOREE_hInstance;
|
|
|
|
|
2012-01-06 04:33:19 +01:00
|
|
|
typedef HRESULT (*fnCreateInstance)(REFIID riid, LPVOID *ppObj);
|
|
|
|
|
2010-10-05 22:50:01 +02:00
|
|
|
char *WtoA(LPCWSTR wstr)
|
|
|
|
{
|
|
|
|
int length;
|
|
|
|
char *result;
|
|
|
|
|
|
|
|
length = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
|
|
|
|
|
|
|
|
result = HeapAlloc(GetProcessHeap(), 0, length);
|
|
|
|
|
|
|
|
if (result)
|
|
|
|
WideCharToMultiByte(CP_UTF8, 0, wstr, -1, result, length, NULL, NULL);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2010-08-25 14:53:05 +02:00
|
|
|
static BOOL get_install_root(LPWSTR install_dir)
|
|
|
|
{
|
|
|
|
const WCHAR dotnet_key[] = {'S','O','F','T','W','A','R','E','\\','M','i','c','r','o','s','o','f','t','\\','.','N','E','T','F','r','a','m','e','w','o','r','k','\\',0};
|
|
|
|
const WCHAR install_root[] = {'I','n','s','t','a','l','l','R','o','o','t',0};
|
|
|
|
|
|
|
|
DWORD len;
|
|
|
|
HKEY key;
|
|
|
|
|
|
|
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, dotnet_key, 0, KEY_READ, &key))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
len = MAX_PATH;
|
|
|
|
if (RegQueryValueExW(key, install_root, 0, NULL, (LPBYTE)install_dir, &len))
|
|
|
|
{
|
|
|
|
RegCloseKey(key);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
RegCloseKey(key);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-01-06 04:33:19 +01:00
|
|
|
typedef struct mscorecf
|
|
|
|
{
|
|
|
|
IClassFactory IClassFactory_iface;
|
|
|
|
LONG ref;
|
|
|
|
|
|
|
|
fnCreateInstance pfnCreateInstance;
|
|
|
|
|
|
|
|
CLSID clsid;
|
|
|
|
} mscorecf;
|
|
|
|
|
|
|
|
static inline mscorecf *impl_from_IClassFactory( IClassFactory *iface )
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, mscorecf, IClassFactory_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI mscorecf_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppobj )
|
|
|
|
{
|
|
|
|
TRACE("%s %p\n", debugstr_guid(riid), ppobj);
|
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualGUID(riid, &IID_IClassFactory))
|
|
|
|
{
|
|
|
|
IClassFactory_AddRef( iface );
|
|
|
|
*ppobj = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ERR("interface %s not implemented\n", debugstr_guid(riid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI mscorecf_AddRef(IClassFactory *iface )
|
|
|
|
{
|
|
|
|
mscorecf *This = impl_from_IClassFactory(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("%p ref=%u\n", This, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI mscorecf_Release(IClassFactory *iface )
|
|
|
|
{
|
|
|
|
mscorecf *This = impl_from_IClassFactory(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("%p ref=%u\n", This, ref);
|
|
|
|
|
|
|
|
if (ref == 0)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI mscorecf_CreateInstance(IClassFactory *iface,LPUNKNOWN pOuter,
|
|
|
|
REFIID riid, LPVOID *ppobj )
|
|
|
|
{
|
|
|
|
mscorecf *This = impl_from_IClassFactory( iface );
|
|
|
|
HRESULT hr;
|
|
|
|
IUnknown *punk;
|
|
|
|
|
|
|
|
TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj );
|
|
|
|
|
|
|
|
*ppobj = NULL;
|
|
|
|
|
|
|
|
if (pOuter)
|
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
|
|
|
|
hr = This->pfnCreateInstance( &This->clsid, (LPVOID*) &punk );
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
hr = IUnknown_QueryInterface( punk, riid, ppobj );
|
|
|
|
|
|
|
|
IUnknown_Release( punk );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WARN("Cannot create an instance object. 0x%08x\n", hr);
|
|
|
|
}
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI mscorecf_LockServer(IClassFactory *iface, BOOL dolock)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%d),stub!\n",iface,dolock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct IClassFactoryVtbl mscorecf_vtbl =
|
|
|
|
{
|
|
|
|
mscorecf_QueryInterface,
|
|
|
|
mscorecf_AddRef,
|
|
|
|
mscorecf_Release,
|
|
|
|
mscorecf_CreateInstance,
|
|
|
|
mscorecf_LockServer
|
|
|
|
};
|
|
|
|
|
2007-08-23 22:22:28 +02:00
|
|
|
HRESULT WINAPI CorBindToRuntimeHost(LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor,
|
|
|
|
LPCWSTR pwszHostConfigFile, VOID *pReserved,
|
|
|
|
DWORD startupFlags, REFCLSID rclsid,
|
|
|
|
REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
2010-10-01 22:43:31 +02:00
|
|
|
HRESULT ret;
|
|
|
|
ICLRRuntimeInfo *info;
|
|
|
|
|
|
|
|
TRACE("(%s, %s, %s, %p, %d, %s, %s, %p)\n", debugstr_w(pwszVersion),
|
2007-08-23 22:22:28 +02:00
|
|
|
debugstr_w(pwszBuildFlavor), debugstr_w(pwszHostConfigFile), pReserved,
|
2010-03-25 21:26:43 +01:00
|
|
|
startupFlags, debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
2007-08-23 22:22:28 +02:00
|
|
|
|
2010-10-01 22:43:31 +02:00
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
ret = get_runtime_info(NULL, pwszVersion, pwszHostConfigFile, startupFlags, 0, TRUE, &info);
|
|
|
|
|
|
|
|
if (SUCCEEDED(ret))
|
2007-08-23 22:22:28 +02:00
|
|
|
{
|
2010-10-01 22:43:31 +02:00
|
|
|
ret = ICLRRuntimeInfo_GetInterface(info, rclsid, riid, ppv);
|
|
|
|
|
|
|
|
ICLRRuntimeInfo_Release(info);
|
2007-08-23 22:22:28 +02:00
|
|
|
}
|
|
|
|
|
2010-10-01 22:43:31 +02:00
|
|
|
return ret;
|
2007-08-23 22:22:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|
|
|
{
|
|
|
|
TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
|
|
|
|
|
2011-10-11 07:08:00 +02:00
|
|
|
MSCOREE_hInstance = hinstDLL;
|
|
|
|
|
2007-08-23 22:22:28 +02:00
|
|
|
switch (fdwReason)
|
|
|
|
{
|
|
|
|
case DLL_WINE_PREATTACH:
|
|
|
|
return FALSE; /* prefer native version */
|
|
|
|
case DLL_PROCESS_ATTACH:
|
2012-05-07 17:48:33 +02:00
|
|
|
runtimehost_init();
|
2007-08-23 22:22:28 +02:00
|
|
|
DisableThreadLibraryCalls(hinstDLL);
|
|
|
|
break;
|
|
|
|
case DLL_PROCESS_DETACH:
|
2011-02-21 21:22:02 +01:00
|
|
|
expect_no_runtimes();
|
2012-05-07 17:48:33 +02:00
|
|
|
if (lpvReserved) break; /* process is terminating */
|
|
|
|
runtimehost_uninit();
|
2007-08-23 22:22:28 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-08-04 03:16:33 +02:00
|
|
|
__int32 WINAPI _CorExeMain2(PBYTE ptrMemory, DWORD cntMemory, LPWSTR imageName, LPWSTR loaderName, LPWSTR cmdLine)
|
2006-10-06 11:21:02 +02:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2006-12-11 14:25:39 +01:00
|
|
|
void WINAPI CorExitProcess(int exitCode)
|
|
|
|
{
|
2011-02-21 21:22:02 +01:00
|
|
|
TRACE("(%x)\n", exitCode);
|
2013-10-24 23:01:11 +02:00
|
|
|
CLRMetaHost_ExitProcess(0, exitCode);
|
2006-12-11 14:25:39 +01:00
|
|
|
}
|
|
|
|
|
2007-08-04 03:16:33 +02:00
|
|
|
VOID WINAPI _CorImageUnloading(PVOID imageBase)
|
2006-10-06 11:21:02 +02:00
|
|
|
{
|
|
|
|
TRACE("(%p): stub\n", imageBase);
|
|
|
|
}
|
|
|
|
|
2007-08-04 03:16:33 +02:00
|
|
|
HRESULT WINAPI _CorValidateImage(PVOID* imageBase, LPCWSTR imageName)
|
2006-10-06 11:21:02 +02:00
|
|
|
{
|
|
|
|
TRACE("(%p, %s): stub\n", imageBase, debugstr_w(imageName));
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
2006-10-13 23:07:17 +02:00
|
|
|
|
2006-12-18 10:40:13 +01:00
|
|
|
HRESULT WINAPI GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD *dwLength)
|
|
|
|
{
|
2010-10-01 21:18:12 +02:00
|
|
|
ICLRRuntimeInfo *info;
|
|
|
|
HRESULT ret;
|
2010-08-25 14:53:05 +02:00
|
|
|
|
2010-10-01 21:18:12 +02:00
|
|
|
TRACE("(%p, %d, %p)!\n", pbuffer, cchBuffer, dwLength);
|
2006-12-18 10:40:13 +01:00
|
|
|
|
2010-10-01 21:18:12 +02:00
|
|
|
if (!dwLength || !pbuffer)
|
2006-12-18 10:40:13 +01:00
|
|
|
return E_POINTER;
|
|
|
|
|
2010-10-01 21:18:12 +02:00
|
|
|
ret = get_runtime_info(NULL, NULL, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
2010-08-25 14:53:05 +02:00
|
|
|
|
2010-10-01 21:18:12 +02:00
|
|
|
if (SUCCEEDED(ret))
|
2010-08-25 14:53:05 +02:00
|
|
|
{
|
2010-10-01 21:18:12 +02:00
|
|
|
*dwLength = cchBuffer;
|
|
|
|
ret = ICLRRuntimeInfo_GetRuntimeDirectory(info, pbuffer, dwLength);
|
2010-08-25 14:53:05 +02:00
|
|
|
|
2010-10-01 21:18:12 +02:00
|
|
|
ICLRRuntimeInfo_Release(info);
|
2010-08-25 14:53:05 +02:00
|
|
|
}
|
2006-12-18 10:40:13 +01:00
|
|
|
|
2010-10-01 21:18:12 +02:00
|
|
|
return ret;
|
2006-12-18 10:40:13 +01:00
|
|
|
}
|
|
|
|
|
2006-10-13 23:07:17 +02:00
|
|
|
HRESULT WINAPI GetCORVersion(LPWSTR pbuffer, DWORD cchBuffer, DWORD *dwLength)
|
|
|
|
{
|
2010-10-01 21:18:12 +02:00
|
|
|
ICLRRuntimeInfo *info;
|
|
|
|
HRESULT ret;
|
2006-10-13 23:07:17 +02:00
|
|
|
|
2010-10-01 21:18:12 +02:00
|
|
|
TRACE("(%p, %d, %p)!\n", pbuffer, cchBuffer, dwLength);
|
2006-10-13 23:07:17 +02:00
|
|
|
|
2010-08-24 12:51:33 +02:00
|
|
|
if (!dwLength || !pbuffer)
|
2006-10-13 23:07:17 +02:00
|
|
|
return E_POINTER;
|
|
|
|
|
2010-10-01 21:18:12 +02:00
|
|
|
ret = get_runtime_info(NULL, NULL, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
2006-10-13 23:07:17 +02:00
|
|
|
|
2010-10-01 21:18:12 +02:00
|
|
|
if (SUCCEEDED(ret))
|
|
|
|
{
|
|
|
|
*dwLength = cchBuffer;
|
|
|
|
ret = ICLRRuntimeInfo_GetVersionString(info, pbuffer, dwLength);
|
2006-10-13 23:07:17 +02:00
|
|
|
|
2010-10-01 21:18:12 +02:00
|
|
|
ICLRRuntimeInfo_Release(info);
|
|
|
|
}
|
2006-10-13 23:07:17 +02:00
|
|
|
|
2010-10-01 21:18:12 +02:00
|
|
|
return ret;
|
2006-10-13 23:07:17 +02:00
|
|
|
}
|
2006-11-01 21:42:30 +01:00
|
|
|
|
2006-12-11 14:25:39 +01:00
|
|
|
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)
|
|
|
|
{
|
2010-08-26 00:14:41 +02:00
|
|
|
HRESULT ret;
|
2010-10-01 21:11:09 +02:00
|
|
|
ICLRRuntimeInfo *info;
|
|
|
|
DWORD length_dummy;
|
2010-08-26 00:14:41 +02:00
|
|
|
|
2010-10-01 21:11:09 +02:00
|
|
|
TRACE("(%s, %s, %s, 0x%08x, 0x%08x, %p, 0x%08x, %p, %p, 0x%08x, %p)\n", debugstr_w(pExe),
|
2006-12-11 14:25:39 +01:00
|
|
|
debugstr_w(pwszVersion), debugstr_w(pConfigurationFile), startupFlags, runtimeInfoFlags, pDirectory,
|
|
|
|
dwDirectory, dwDirectoryLength, pVersion, cchBuffer, dwlength);
|
2010-08-26 00:14:41 +02:00
|
|
|
|
2010-10-01 21:11:09 +02:00
|
|
|
if (!dwDirectoryLength) dwDirectoryLength = &length_dummy;
|
2010-08-26 00:14:41 +02:00
|
|
|
|
2010-10-01 21:11:09 +02:00
|
|
|
if (!dwlength) dwlength = &length_dummy;
|
2010-08-26 00:14:41 +02:00
|
|
|
|
2010-10-01 21:11:09 +02:00
|
|
|
ret = get_runtime_info(pExe, pwszVersion, pConfigurationFile, startupFlags, runtimeInfoFlags, TRUE, &info);
|
2010-08-26 00:14:41 +02:00
|
|
|
|
2010-10-01 21:11:09 +02:00
|
|
|
if (SUCCEEDED(ret))
|
|
|
|
{
|
|
|
|
*dwlength = cchBuffer;
|
|
|
|
ret = ICLRRuntimeInfo_GetVersionString(info, pVersion, dwlength);
|
2010-08-26 00:14:41 +02:00
|
|
|
|
2010-10-01 21:11:09 +02:00
|
|
|
if (SUCCEEDED(ret))
|
2010-08-26 00:14:41 +02:00
|
|
|
{
|
2012-03-15 12:40:25 +01:00
|
|
|
if(pwszVersion)
|
|
|
|
pVersion[0] = pwszVersion[0];
|
|
|
|
|
2010-10-01 21:11:09 +02:00
|
|
|
*dwDirectoryLength = dwDirectory;
|
|
|
|
ret = ICLRRuntimeInfo_GetRuntimeDirectory(info, pDirectory, dwDirectoryLength);
|
2010-08-26 00:14:41 +02:00
|
|
|
}
|
2010-10-01 21:11:09 +02:00
|
|
|
|
|
|
|
ICLRRuntimeInfo_Release(info);
|
2010-08-26 00:14:41 +02:00
|
|
|
}
|
2010-10-01 21:11:09 +02:00
|
|
|
|
2010-08-26 00:14:41 +02:00
|
|
|
return ret;
|
2006-12-11 14:25:39 +01:00
|
|
|
}
|
|
|
|
|
2011-04-28 12:22:45 +02:00
|
|
|
HRESULT WINAPI GetRequestedRuntimeVersion(LPWSTR pExe, LPWSTR pVersion, DWORD cchBuffer, DWORD *dwlength)
|
|
|
|
{
|
2012-03-23 21:41:25 +01:00
|
|
|
TRACE("(%s, %p, %d, %p)\n", debugstr_w(pExe), pVersion, cchBuffer, dwlength);
|
2011-04-28 12:22:45 +02:00
|
|
|
|
|
|
|
if(!dwlength)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
return GetRequestedRuntimeInfo(pExe, NULL, NULL, 0, 0, NULL, 0, NULL, pVersion, cchBuffer, dwlength);
|
|
|
|
}
|
|
|
|
|
2011-04-19 11:28:55 +02:00
|
|
|
HRESULT WINAPI GetRealProcAddress(LPCSTR procname, void **ppv)
|
|
|
|
{
|
|
|
|
FIXME("(%s, %p)\n", debugstr_a(procname), ppv);
|
|
|
|
return CLR_E_SHIM_RUNTIMEEXPORT;
|
|
|
|
}
|
|
|
|
|
2011-01-27 23:05:34 +01:00
|
|
|
HRESULT WINAPI GetFileVersion(LPCWSTR szFilename, LPWSTR szBuffer, DWORD cchBuffer, DWORD *dwLength)
|
|
|
|
{
|
|
|
|
TRACE("(%s, %p, %d, %p)\n", debugstr_w(szFilename), szBuffer, cchBuffer, dwLength);
|
|
|
|
|
|
|
|
if (!szFilename || !dwLength)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
*dwLength = cchBuffer;
|
|
|
|
return CLRMetaHost_GetVersionFromFile(0, szFilename, szBuffer, dwLength);
|
|
|
|
}
|
|
|
|
|
2006-11-01 21:42:30 +01:00
|
|
|
HRESULT WINAPI LoadLibraryShim( LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE * phModDll)
|
|
|
|
{
|
2010-10-27 17:51:19 +02:00
|
|
|
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;
|
2006-12-11 14:25:39 +01:00
|
|
|
|
2010-10-27 17:51:19 +02:00
|
|
|
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;
|
2006-11-01 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
2008-12-20 05:09:28 +01:00
|
|
|
HRESULT WINAPI LockClrVersion(FLockClrVersionCallback hostCallback, FLockClrVersionCallback *pBeginHostSetup, FLockClrVersionCallback *pEndHostSetup)
|
|
|
|
{
|
|
|
|
FIXME("(%p %p %p): stub\n", hostCallback, pBeginHostSetup, pEndHostSetup);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2006-11-01 21:42:30 +01:00
|
|
|
HRESULT WINAPI CoInitializeCor(DWORD fFlags)
|
|
|
|
{
|
|
|
|
FIXME("(0x%08x): stub\n", fFlags);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI GetAssemblyMDImport(LPCWSTR szFileName, REFIID riid, IUnknown **ppIUnk)
|
|
|
|
{
|
2010-03-25 21:26:43 +01:00
|
|
|
FIXME("(%p %s, %s, %p): stub\n", szFileName, debugstr_w(szFileName), debugstr_guid(riid), *ppIUnk);
|
2006-11-01 21:42:30 +01:00
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
2007-12-18 15:55:17 +01:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2008-01-10 05:44:31 +01:00
|
|
|
|
2008-01-21 17:07:43 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2008-03-14 11:27:42 +01:00
|
|
|
HRESULT WINAPI CorBindToRuntimeEx(LPWSTR szVersion, LPWSTR szBuildFlavor, DWORD nflags, REFCLSID rslsid,
|
|
|
|
REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
2010-10-01 22:37:25 +02:00
|
|
|
HRESULT ret;
|
|
|
|
ICLRRuntimeInfo *info;
|
|
|
|
|
|
|
|
TRACE("%s %s %d %s %s %p\n", debugstr_w(szVersion), debugstr_w(szBuildFlavor), nflags, debugstr_guid( rslsid ),
|
2008-03-14 11:27:42 +01:00
|
|
|
debugstr_guid( riid ), ppv);
|
|
|
|
|
2010-10-01 22:37:25 +02:00
|
|
|
*ppv = NULL;
|
|
|
|
|
2011-05-19 19:59:44 +02:00
|
|
|
ret = get_runtime_info(NULL, szVersion, NULL, nflags, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
2010-10-01 22:37:25 +02:00
|
|
|
|
|
|
|
if (SUCCEEDED(ret))
|
2008-03-28 11:10:55 +01:00
|
|
|
{
|
2010-10-01 22:37:25 +02:00
|
|
|
ret = ICLRRuntimeInfo_GetInterface(info, rslsid, riid, ppv);
|
|
|
|
|
|
|
|
ICLRRuntimeInfo_Release(info);
|
2008-03-28 11:10:55 +01:00
|
|
|
}
|
2010-10-01 22:37:25 +02:00
|
|
|
|
|
|
|
return ret;
|
2008-03-14 11:27:42 +01:00
|
|
|
}
|
|
|
|
|
2008-06-08 22:03:22 +02:00
|
|
|
HRESULT WINAPI CorBindToCurrentRuntime(LPCWSTR filename, REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
2014-09-09 21:31:41 +02:00
|
|
|
HRESULT ret;
|
|
|
|
ICLRRuntimeInfo *info;
|
|
|
|
|
|
|
|
TRACE("(%s, %s, %s, %p)\n", debugstr_w(filename), debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
ret = get_runtime_info(NULL, NULL, filename, 0, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
|
|
|
|
|
|
|
|
if (SUCCEEDED(ret))
|
|
|
|
{
|
|
|
|
ret = ICLRRuntimeInfo_GetInterface(info, rclsid, riid, ppv);
|
|
|
|
|
|
|
|
ICLRRuntimeInfo_Release(info);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2008-06-08 22:03:22 +02:00
|
|
|
}
|
|
|
|
|
2010-03-26 22:10:43 +01:00
|
|
|
STDAPI ClrCreateManagedInstance(LPCWSTR pTypeName, REFIID riid, void **ppObject)
|
|
|
|
{
|
2010-10-06 00:15:08 +02:00
|
|
|
HRESULT ret;
|
|
|
|
ICLRRuntimeInfo *info;
|
|
|
|
RuntimeHost *host;
|
|
|
|
MonoObject *obj;
|
|
|
|
IUnknown *unk;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (SUCCEEDED(ret))
|
|
|
|
{
|
|
|
|
ret = ICLRRuntimeInfo_GetRuntimeHost(info, &host);
|
|
|
|
|
|
|
|
ICLRRuntimeInfo_Release(info);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SUCCEEDED(ret))
|
|
|
|
ret = RuntimeHost_CreateManagedInstance(host, pTypeName, NULL, &obj);
|
|
|
|
|
|
|
|
if (SUCCEEDED(ret))
|
|
|
|
ret = RuntimeHost_GetIUnknownForObject(host, obj, &unk);
|
|
|
|
|
|
|
|
if (SUCCEEDED(ret))
|
|
|
|
{
|
|
|
|
ret = IUnknown_QueryInterface(unk, riid, ppObject);
|
|
|
|
IUnknown_Release(unk);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2010-03-26 22:10:43 +01:00
|
|
|
}
|
|
|
|
|
2009-04-29 10:51:07 +02:00
|
|
|
BOOL WINAPI StrongNameSignatureVerification(LPCWSTR filename, DWORD inFlags, DWORD* pOutFlags)
|
|
|
|
{
|
|
|
|
FIXME("(%s, 0x%X, %p): stub\n", debugstr_w(filename), inFlags, pOutFlags);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI StrongNameSignatureVerificationEx(LPCWSTR filename, BOOL forceVerification, BOOL* pVerified)
|
|
|
|
{
|
|
|
|
FIXME("(%s, %u, %p): stub\n", debugstr_w(filename), forceVerification, pVerified);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-09-27 01:06:18 +02:00
|
|
|
HRESULT WINAPI CreateDebuggingInterfaceFromVersion(int nDebugVersion, LPCWSTR version, IUnknown **ppv)
|
2011-04-28 12:03:49 +02:00
|
|
|
{
|
2011-09-27 01:06:18 +02:00
|
|
|
const WCHAR v2_0[] = {'v','2','.','0','.','5','0','7','2','7',0};
|
|
|
|
HRESULT hr = E_FAIL;
|
|
|
|
ICLRRuntimeInfo *runtimeinfo;
|
|
|
|
|
|
|
|
if(nDebugVersion < 1 || nDebugVersion > 4)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
TRACE("(%d %s, %p): stub\n", nDebugVersion, debugstr_w(version), ppv);
|
|
|
|
|
|
|
|
if(!ppv)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if(strcmpW(version, v2_0) != 0)
|
|
|
|
{
|
|
|
|
FIXME("Currently .NET Version '%s' not support.\n", debugstr_w(version));
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nDebugVersion != 3)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
hr = CLRMetaHost_GetRuntime(0, version, &IID_ICLRRuntimeInfo, (void**)&runtimeinfo);
|
|
|
|
if(hr == S_OK)
|
|
|
|
{
|
|
|
|
hr = ICLRRuntimeInfo_GetInterface(runtimeinfo, &CLSID_CLRDebuggingLegacy, &IID_ICorDebug, (void**)ppv);
|
|
|
|
|
|
|
|
ICLRRuntimeInfo_Release(runtimeinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!*ppv)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
return hr;
|
2011-04-28 12:03:49 +02:00
|
|
|
}
|
|
|
|
|
2010-09-21 22:34:18 +02:00
|
|
|
HRESULT WINAPI CLRCreateInstance(REFCLSID clsid, REFIID riid, LPVOID *ppInterface)
|
|
|
|
{
|
2010-09-22 21:09:04 +02:00
|
|
|
TRACE("(%s,%s,%p)\n", debugstr_guid(clsid), debugstr_guid(riid), ppInterface);
|
2010-09-21 22:34:18 +02:00
|
|
|
|
2010-09-22 21:09:04 +02:00
|
|
|
if (IsEqualGUID(clsid, &CLSID_CLRMetaHost))
|
|
|
|
return CLRMetaHost_CreateInstance(riid, ppInterface);
|
2013-10-02 07:48:32 +02:00
|
|
|
if (IsEqualGUID(clsid, &CLSID_CLRMetaHostPolicy))
|
|
|
|
return CLRMetaHostPolicy_CreateInstance(riid, ppInterface);
|
2010-09-22 21:09:04 +02:00
|
|
|
|
|
|
|
FIXME("not implemented for class %s\n", debugstr_guid(clsid));
|
|
|
|
|
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
2010-09-21 22:34:18 +02:00
|
|
|
}
|
|
|
|
|
2013-10-01 02:17:50 +02:00
|
|
|
HRESULT WINAPI CreateInterface(REFCLSID clsid, REFIID riid, LPVOID *ppInterface)
|
|
|
|
{
|
|
|
|
TRACE("(%s,%s,%p)\n", debugstr_guid(clsid), debugstr_guid(riid), ppInterface);
|
|
|
|
|
|
|
|
return CLRCreateInstance(clsid, riid, ppInterface);
|
|
|
|
}
|
|
|
|
|
2008-01-10 05:44:31 +01:00
|
|
|
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
|
|
|
|
{
|
2012-01-06 04:33:19 +01:00
|
|
|
mscorecf *This;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%s, %s, %p): stub\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
|
|
|
|
2008-01-10 05:44:31 +01:00
|
|
|
if(!ppv)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2012-01-06 04:33:19 +01:00
|
|
|
This = HeapAlloc(GetProcessHeap(), 0, sizeof(mscorecf));
|
|
|
|
|
|
|
|
This->IClassFactory_iface.lpVtbl = &mscorecf_vtbl;
|
2012-11-19 23:00:19 +01:00
|
|
|
This->pfnCreateInstance = create_monodata;
|
2012-01-06 04:33:19 +01:00
|
|
|
This->ref = 1;
|
|
|
|
This->clsid = *rclsid;
|
|
|
|
|
|
|
|
hr = IClassFactory_QueryInterface( &This->IClassFactory_iface, riid, ppv );
|
|
|
|
IClassFactory_Release(&This->IClassFactory_iface);
|
|
|
|
|
|
|
|
return hr;
|
2008-01-10 05:44:31 +01:00
|
|
|
}
|
|
|
|
|
2012-05-29 17:35:36 +02:00
|
|
|
static void parse_msi_version_string(const char *version, int *parts)
|
|
|
|
{
|
|
|
|
const char *minor_start, *build_start;
|
|
|
|
|
|
|
|
parts[0] = atoi(version);
|
|
|
|
|
|
|
|
parts[1] = parts[2] = 0;
|
|
|
|
|
|
|
|
minor_start = strchr(version, '.');
|
|
|
|
if (minor_start)
|
|
|
|
{
|
|
|
|
minor_start++;
|
|
|
|
parts[1] = atoi(minor_start);
|
|
|
|
|
|
|
|
build_start = strchr(minor_start, '.');
|
|
|
|
if (build_start)
|
|
|
|
parts[2] = atoi(build_start+1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL install_wine_mono(void)
|
|
|
|
{
|
2013-10-25 00:19:06 +02:00
|
|
|
BOOL is_wow64 = FALSE;
|
2012-05-29 17:35:36 +02:00
|
|
|
HMODULE hmsi;
|
|
|
|
UINT (WINAPI *pMsiGetProductInfoA)(LPCSTR,LPCSTR,LPSTR,DWORD*);
|
|
|
|
char versionstringbuf[15];
|
|
|
|
UINT res;
|
|
|
|
DWORD buffer_size;
|
|
|
|
PROCESS_INFORMATION pi;
|
|
|
|
STARTUPINFOW si;
|
|
|
|
WCHAR app[MAX_PATH];
|
|
|
|
WCHAR *args;
|
|
|
|
LONG len;
|
|
|
|
BOOL ret;
|
|
|
|
|
2017-08-01 20:54:27 +02:00
|
|
|
static const char* mono_version = "4.7.1";
|
2012-05-29 17:35:36 +02:00
|
|
|
static const char* mono_product_code = "{E45D8920-A758-4088-B6C6-31DBB276992E}";
|
|
|
|
|
|
|
|
static const WCHAR controlW[] = {'\\','c','o','n','t','r','o','l','.','e','x','e',0};
|
|
|
|
static const WCHAR argsW[] =
|
|
|
|
{' ','a','p','p','w','i','z','.','c','p','l',' ','i','n','s','t','a','l','l','_','m','o','n','o',0};
|
|
|
|
|
|
|
|
IsWow64Process(GetCurrentProcess(), &is_wow64);
|
|
|
|
|
|
|
|
if (is_wow64)
|
|
|
|
{
|
|
|
|
TRACE("not installing mono in wow64 process\n");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
hmsi = LoadLibraryA("msi");
|
|
|
|
|
|
|
|
if (!hmsi)
|
|
|
|
{
|
|
|
|
ERR("couldn't load msi.dll\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
pMsiGetProductInfoA = (void*)GetProcAddress(hmsi, "MsiGetProductInfoA");
|
|
|
|
|
|
|
|
buffer_size = sizeof(versionstringbuf);
|
|
|
|
|
|
|
|
res = pMsiGetProductInfoA(mono_product_code, "VersionString", versionstringbuf, &buffer_size);
|
|
|
|
|
|
|
|
FreeLibrary(hmsi);
|
|
|
|
|
|
|
|
if (res == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
int current_version[3], wanted_version[3], i;
|
|
|
|
|
|
|
|
TRACE("found installed version %s\n", versionstringbuf);
|
|
|
|
|
|
|
|
parse_msi_version_string(versionstringbuf, current_version);
|
|
|
|
parse_msi_version_string(mono_version, wanted_version);
|
|
|
|
|
|
|
|
for (i=0; i<3; i++)
|
|
|
|
{
|
|
|
|
if (current_version[i] < wanted_version[i])
|
|
|
|
break;
|
|
|
|
else if (current_version[i] > wanted_version[i])
|
|
|
|
{
|
|
|
|
TRACE("installed version is newer than %s, quitting\n", mono_version);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == 3)
|
|
|
|
{
|
|
|
|
TRACE("version %s is already installed, quitting\n", mono_version);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
len = GetSystemDirectoryW(app, MAX_PATH-sizeof(controlW)/sizeof(WCHAR));
|
|
|
|
memcpy(app+len, controlW, sizeof(controlW));
|
|
|
|
|
|
|
|
args = HeapAlloc(GetProcessHeap(), 0, (len*sizeof(WCHAR) + sizeof(controlW) + sizeof(argsW)));
|
|
|
|
if(!args)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
memcpy(args, app, len*sizeof(WCHAR) + sizeof(controlW));
|
|
|
|
memcpy(args + len + sizeof(controlW)/sizeof(WCHAR)-1, argsW, sizeof(argsW));
|
|
|
|
|
|
|
|
TRACE("starting %s\n", debugstr_w(args));
|
|
|
|
|
|
|
|
memset(&si, 0, sizeof(si));
|
|
|
|
si.cb = sizeof(si);
|
|
|
|
ret = CreateProcessW(app, args, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
|
|
|
|
HeapFree(GetProcessHeap(), 0, args);
|
|
|
|
if (ret) {
|
|
|
|
CloseHandle(pi.hThread);
|
|
|
|
WaitForSingleObject(pi.hProcess, INFINITE);
|
|
|
|
CloseHandle(pi.hProcess);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-02-08 09:21:23 +01:00
|
|
|
HRESULT WINAPI DllRegisterServer(void)
|
|
|
|
{
|
2012-05-29 17:35:36 +02:00
|
|
|
install_wine_mono();
|
|
|
|
|
2011-10-11 07:08:00 +02:00
|
|
|
return __wine_register_resources( MSCOREE_hInstance );
|
2010-02-08 09:21:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI DllUnregisterServer(void)
|
|
|
|
{
|
2011-10-11 07:08:00 +02:00
|
|
|
return __wine_unregister_resources( MSCOREE_hInstance );
|
2010-02-08 09:21:23 +01:00
|
|
|
}
|
|
|
|
|
2008-01-10 05:44:31 +01:00
|
|
|
HRESULT WINAPI DllCanUnloadNow(VOID)
|
|
|
|
{
|
2011-02-23 22:29:58 +01:00
|
|
|
return S_FALSE;
|
2008-01-10 05:44:31 +01:00
|
|
|
}
|
2008-03-25 15:21:18 +01:00
|
|
|
|
2012-03-03 06:32:47 +01:00
|
|
|
void WINAPI CoEEShutDownCOM(void)
|
|
|
|
{
|
|
|
|
FIXME("stub.\n");
|
|
|
|
}
|
|
|
|
|
2008-03-25 15:21:18 +01:00
|
|
|
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 );
|
|
|
|
}
|