ReactOS  0.4.14-dev-98-gb0d4763
corruntimehost.c File Reference
#include "mscoree_private.h"
#include <assert.h>
#include <shellapi.h>
#include <initguid.h>
Include dependency graph for corruntimehost.c:

Go to the source code of this file.

Classes

struct  DomainEntry
 
struct  dll_fixup
 
struct  vtable_fixup_thunk
 

Macros

#define CAN_FIXUP_VTABLE   0
 
#define CHARS_IN_GUID   39
 
#define ARRAYSIZE(array)   (sizeof(array)/sizeof((array)[0]))
 

Functions

 DEFINE_GUID (IID__AppDomain, 0x05f696dc, 0x2b29, 0x3663, 0xad, 0x8b, 0xc4, 0x38, 0x9c, 0xf2, 0xa7, 0x13)
 
static HRESULT RuntimeHost_AddDomain (RuntimeHost *This, MonoDomain **result)
 
static HRESULT RuntimeHost_GetDefaultDomain (RuntimeHost *This, MonoDomain **result)
 
static void RuntimeHost_DeleteDomain (RuntimeHost *This, MonoDomain *domain)
 
static HRESULT RuntimeHost_GetIUnknownForDomain (RuntimeHost *This, MonoDomain *domain, IUnknown **punk)
 
static RuntimeHostimpl_from_ICLRRuntimeHost (ICLRRuntimeHost *iface)
 
static RuntimeHostimpl_from_ICorRuntimeHost (ICorRuntimeHost *iface)
 
static HRESULT WINAPI corruntimehost_QueryInterface (ICorRuntimeHost *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI corruntimehost_AddRef (ICorRuntimeHost *iface)
 
static ULONG WINAPI corruntimehost_Release (ICorRuntimeHost *iface)
 
static HRESULT WINAPI corruntimehost_CreateLogicalThreadState (ICorRuntimeHost *iface)
 
static HRESULT WINAPI corruntimehost_DeleteLogicalThreadState (ICorRuntimeHost *iface)
 
static HRESULT WINAPI corruntimehost_SwitchInLogicalThreadState (ICorRuntimeHost *iface, DWORD *fiberCookie)
 
static HRESULT WINAPI corruntimehost_SwitchOutLogicalThreadState (ICorRuntimeHost *iface, DWORD **fiberCookie)
 
static HRESULT WINAPI corruntimehost_LocksHeldByLogicalThread (ICorRuntimeHost *iface, DWORD *pCount)
 
static HRESULT WINAPI corruntimehost_MapFile (ICorRuntimeHost *iface, HANDLE hFile, HMODULE *mapAddress)
 
static HRESULT WINAPI corruntimehost_GetConfiguration (ICorRuntimeHost *iface, ICorConfiguration **pConfiguration)
 
static HRESULT WINAPI corruntimehost_Start (ICorRuntimeHost *iface)
 
static HRESULT WINAPI corruntimehost_Stop (ICorRuntimeHost *iface)
 
static HRESULT WINAPI corruntimehost_CreateDomain (ICorRuntimeHost *iface, LPCWSTR friendlyName, IUnknown *identityArray, IUnknown **appDomain)
 
static HRESULT WINAPI corruntimehost_GetDefaultDomain (ICorRuntimeHost *iface, IUnknown **pAppDomain)
 
static HRESULT WINAPI corruntimehost_EnumDomains (ICorRuntimeHost *iface, HDOMAINENUM *hEnum)
 
static HRESULT WINAPI corruntimehost_NextDomain (ICorRuntimeHost *iface, HDOMAINENUM hEnum, IUnknown **appDomain)
 
static HRESULT WINAPI corruntimehost_CloseEnum (ICorRuntimeHost *iface, HDOMAINENUM hEnum)
 
static HRESULT WINAPI corruntimehost_CreateDomainEx (ICorRuntimeHost *iface, LPCWSTR friendlyName, IUnknown *setup, IUnknown *evidence, IUnknown **appDomain)
 
static HRESULT WINAPI corruntimehost_CreateDomainSetup (ICorRuntimeHost *iface, IUnknown **appDomainSetup)
 
static HRESULT WINAPI corruntimehost_CreateEvidence (ICorRuntimeHost *iface, IUnknown **evidence)
 
static HRESULT WINAPI corruntimehost_UnloadDomain (ICorRuntimeHost *iface, IUnknown *appDomain)
 
static HRESULT WINAPI corruntimehost_CurrentDomain (ICorRuntimeHost *iface, IUnknown **appDomain)
 
static HRESULT WINAPI CLRRuntimeHost_QueryInterface (ICLRRuntimeHost *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI CLRRuntimeHost_AddRef (ICLRRuntimeHost *iface)
 
static ULONG WINAPI CLRRuntimeHost_Release (ICLRRuntimeHost *iface)
 
static HRESULT WINAPI CLRRuntimeHost_Start (ICLRRuntimeHost *iface)
 
static HRESULT WINAPI CLRRuntimeHost_Stop (ICLRRuntimeHost *iface)
 
static HRESULT WINAPI CLRRuntimeHost_SetHostControl (ICLRRuntimeHost *iface, IHostControl *pHostControl)
 
static HRESULT WINAPI CLRRuntimeHost_GetCLRControl (ICLRRuntimeHost *iface, ICLRControl **pCLRControl)
 
static HRESULT WINAPI CLRRuntimeHost_UnloadAppDomain (ICLRRuntimeHost *iface, DWORD dwAppDomainId, BOOL fWaitUntilDone)
 
static HRESULT WINAPI CLRRuntimeHost_ExecuteInAppDomain (ICLRRuntimeHost *iface, DWORD dwAppDomainId, FExecuteInAppDomainCallback pCallback, void *cookie)
 
static HRESULT WINAPI CLRRuntimeHost_GetCurrentAppDomainId (ICLRRuntimeHost *iface, DWORD *pdwAppDomainId)
 
static HRESULT WINAPI CLRRuntimeHost_ExecuteApplication (ICLRRuntimeHost *iface, LPCWSTR pwzAppFullName, DWORD dwManifestPaths, LPCWSTR *ppwzManifestPaths, DWORD dwActivationData, LPCWSTR *ppwzActivationData, int *pReturnValue)
 
static HRESULT WINAPI CLRRuntimeHost_ExecuteInDefaultAppDomain (ICLRRuntimeHost *iface, LPCWSTR pwzAssemblyPath, LPCWSTR pwzTypeName, LPCWSTR pwzMethodName, LPCWSTR pwzArgument, DWORD *pReturnValue)
 
HRESULT RuntimeHost_CreateManagedInstance (RuntimeHost *This, LPCWSTR name, MonoDomain *domain, MonoObject **result)
 
HRESULT RuntimeHost_GetIUnknownForObject (RuntimeHost *This, MonoObject *obj, IUnknown **ppUnk)
 
static void get_utf8_args (int *argc, char ***argv)
 
static void CDECL ReallyFixupVTable (struct dll_fixup *fixup)
 
static void FixupVTableEntry (HMODULE hmodule, VTableFixup *vtable_fixup)
 
static void FixupVTable (HMODULE hmodule)
 
__int32 WINAPI _CorExeMain (void)
 
BOOL WINAPI _CorDllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 
void runtimehost_init (void)
 
void runtimehost_uninit (void)
 
HRESULT RuntimeHost_Construct (const CLRRuntimeInfo *runtime_version, loaded_mono *loaded_mono, RuntimeHost **result)
 
HRESULT RuntimeHost_GetInterface (RuntimeHost *This, REFCLSID clsid, REFIID riid, void **ppv)
 
HRESULT RuntimeHost_Destroy (RuntimeHost *This)
 
HRESULT create_monodata (REFIID riid, LPVOID *ppObj)
 

Variables

static HANDLE dll_fixup_heap
 
static struct list dll_fixups
 
static const struct ICorRuntimeHostVtbl corruntimehost_vtbl
 
static const struct ICLRRuntimeHostVtbl CLRHostVtbl
 
static const struct vtable_fixup_thunk thunk_template = {0}
 

Macro Definition Documentation

◆ ARRAYSIZE

#define ARRAYSIZE (   array)    (sizeof(array)/sizeof((array)[0]))

Definition at line 1209 of file corruntimehost.c.

◆ CAN_FIXUP_VTABLE

#define CAN_FIXUP_VTABLE   0

Definition at line 841 of file corruntimehost.c.

◆ CHARS_IN_GUID

#define CHARS_IN_GUID   39

Definition at line 1207 of file corruntimehost.c.

Function Documentation

◆ _CorDllMain()

BOOL WINAPI _CorDllMain ( HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 1083 of file corruntimehost.c.

1084 {
1085  TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
1086 
1087  switch (fdwReason)
1088  {
1089  case DLL_PROCESS_ATTACH:
1090  DisableThreadLibraryCalls(hinstDLL);
1091  FixupVTable(hinstDLL);
1092  break;
1093  case DLL_PROCESS_DETACH:
1094  /* FIXME: clean up the vtables */
1095  break;
1096  }
1097  return TRUE;
1098 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
static IN DWORD IN LPVOID lpvReserved
#define DLL_PROCESS_DETACH
Definition: compat.h:119
#define TRACE(s)
Definition: solgame.cpp:4
static void FixupVTable(HMODULE hmodule)

◆ _CorExeMain()

__int32 WINAPI _CorExeMain ( void  )

Definition at line 1008 of file corruntimehost.c.

1009 {
1010  int exit_code;
1011  int argc;
1012  char **argv;
1013  MonoDomain *domain;
1014  MonoImage *image;
1018  char *filenameA;
1020  RuntimeHost *host;
1021  HRESULT hr;
1022  int i;
1023 
1024  get_utf8_args(&argc, &argv);
1025 
1027 
1028  TRACE("%s", debugstr_w(filename));
1029  for (i=0; i<argc; i++)
1030  TRACE(" %s", debugstr_a(argv[i]));
1031  TRACE("\n");
1032 
1033  filenameA = WtoA(filename);
1034  if (!filenameA)
1035  return -1;
1036 
1038 
1039  hr = get_runtime_info(filename, NULL, NULL, 0, 0, FALSE, &info);
1040 
1041  if (SUCCEEDED(hr))
1042  {
1044 
1045  if (SUCCEEDED(hr))
1046  hr = RuntimeHost_GetDefaultDomain(host, &domain);
1047 
1048  if (SUCCEEDED(hr))
1049  {
1050  image = host->mono->mono_image_open_from_module_handle(GetModuleHandleW(NULL),
1051  filenameA, 1, &status);
1052 
1053  if (image)
1054  assembly = host->mono->mono_assembly_load_from(image, filenameA, &status);
1055 
1056  if (assembly)
1057  {
1058  exit_code = host->mono->mono_jit_exec(domain, assembly, argc, argv);
1059  }
1060  else
1061  {
1062  ERR("couldn't load %s, status=%d\n", debugstr_w(filename), status);
1063  exit_code = -1;
1064  }
1065 
1066  RuntimeHost_DeleteDomain(host, domain);
1067  }
1068  else
1069  exit_code = -1;
1070 
1071  ICLRRuntimeInfo_Release(info);
1072  }
1073  else
1074  exit_code = -1;
1075 
1076  HeapFree(GetProcessHeap(), 0, argv);
1077 
1079 
1080  return exit_code;
1081 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
GLeglImageOES image
Definition: gl.h:2204
static int argc
Definition: ServiceArgs.c:12
static void get_utf8_args(int *argc, char ***argv)
HRESULT hr
Definition: shlfolder.c:183
HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result)
Definition: metahost.c:544
void unload_all_runtimes(void)
Definition: metahost.c:266
char * host
Definition: whois.c:55
#define argv
Definition: mplay32.c:18
const char * filename
Definition: ioapi.h:135
struct _test_info info[]
Definition: SetCursorPos.c:19
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, MonoDomain **result)
smooth NULL
Definition: ftsmooth.c:416
static UINT exit_code
Definition: process.c:78
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
static void FixupVTable(HMODULE hmodule)
#define MAX_PATH
Definition: compat.h:26
static CHAR filenameA[MAX_PATH]
Definition: storage32.c:42
struct _MonoImage MonoImage
#define ERR(fmt,...)
Definition: debug.h:109
char * WtoA(LPCWSTR wstr)
Definition: mscoree_main.c:30
HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file, DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result)
Definition: metahost.c:1247
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:847
MonoImageOpenStatus
struct _MonoDomain MonoDomain
struct _MonoAssembly MonoAssembly
static void RuntimeHost_DeleteDomain(RuntimeHost *This, MonoDomain *domain)
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:394
#define SUCCEEDED(hr)
Definition: intsafe.h:57
Definition: ps.c:97

◆ CLRRuntimeHost_AddRef()

static ULONG WINAPI CLRRuntimeHost_AddRef ( ICLRRuntimeHost iface)
static

Definition at line 463 of file corruntimehost.c.

464 {
466  return ICorRuntimeHost_AddRef(&This->ICorRuntimeHost_iface);
467 }
static RuntimeHost * impl_from_ICLRRuntimeHost(ICLRRuntimeHost *iface)

◆ CLRRuntimeHost_ExecuteApplication()

static HRESULT WINAPI CLRRuntimeHost_ExecuteApplication ( ICLRRuntimeHost iface,
LPCWSTR  pwzAppFullName,
DWORD  dwManifestPaths,
LPCWSTR ppwzManifestPaths,
DWORD  dwActivationData,
LPCWSTR ppwzActivationData,
int pReturnValue 
)
static

Definition at line 522 of file corruntimehost.c.

525 {
526  FIXME("(%p,%s,%u,%u)\n", iface, debugstr_w(pwzAppFullName), dwManifestPaths, dwActivationData);
527  return E_NOTIMPL;
528 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CLRRuntimeHost_ExecuteInAppDomain()

static HRESULT WINAPI CLRRuntimeHost_ExecuteInAppDomain ( ICLRRuntimeHost iface,
DWORD  dwAppDomainId,
FExecuteInAppDomainCallback  pCallback,
void cookie 
)
static

Definition at line 508 of file corruntimehost.c.

510 {
511  FIXME("(%p,%u,%p,%p)\n", iface, dwAppDomainId, pCallback, cookie);
512  return E_NOTIMPL;
513 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CLRRuntimeHost_ExecuteInDefaultAppDomain()

static HRESULT WINAPI CLRRuntimeHost_ExecuteInDefaultAppDomain ( ICLRRuntimeHost iface,
LPCWSTR  pwzAssemblyPath,
LPCWSTR  pwzTypeName,
LPCWSTR  pwzMethodName,
LPCWSTR  pwzArgument,
DWORD pReturnValue 
)
static

Definition at line 530 of file corruntimehost.c.

533 {
535  HRESULT hr;
536  MonoDomain *domain;
538  MonoImage *image;
539  MonoClass *klass;
542  MonoString *str;
543  void *args[2];
544  char *filenameA = NULL, *classA = NULL, *methodA = NULL;
545  char *argsA = NULL, *ns;
546 
547  TRACE("(%p,%s,%s,%s,%s)\n", iface, debugstr_w(pwzAssemblyPath),
548  debugstr_w(pwzTypeName), debugstr_w(pwzMethodName), debugstr_w(pwzArgument));
549 
551  if(hr != S_OK)
552  {
553  ERR("Couldn't get Default Domain\n");
554  return hr;
555  }
556 
557  hr = E_FAIL;
558 
559  This->mono->mono_thread_attach(domain);
560 
561  filenameA = WtoA(pwzAssemblyPath);
562  assembly = This->mono->mono_domain_assembly_open(domain, filenameA);
563  if (!assembly)
564  {
565  ERR("Cannot open assembly %s\n", filenameA);
566  goto cleanup;
567  }
568 
569  image = This->mono->mono_assembly_get_image(assembly);
570  if (!image)
571  {
572  ERR("Couldn't get assembly image\n");
573  goto cleanup;
574  }
575 
576  classA = WtoA(pwzTypeName);
577  ns = strrchr(classA, '.');
578  *ns = '\0';
579  klass = This->mono->mono_class_from_name(image, classA, ns+1);
580  if (!klass)
581  {
582  ERR("Couldn't get class from image\n");
583  goto cleanup;
584  }
585 
586  methodA = WtoA(pwzMethodName);
587  method = This->mono->mono_class_get_method_from_name(klass, methodA, 1);
588  if (!method)
589  {
590  ERR("Couldn't get method from class\n");
591  goto cleanup;
592  }
593 
594  /* The .NET function we are calling has the following declaration
595  * public static int functionName(String param)
596  */
597  argsA = WtoA(pwzArgument);
598  str = This->mono->mono_string_new(domain, argsA);
599  args[0] = str;
600  args[1] = NULL;
601  result = This->mono->mono_runtime_invoke(method, NULL, args, NULL);
602  if (!result)
603  ERR("Couldn't get result pointer\n");
604  else
605  {
606  *pReturnValue = *(DWORD*)This->mono->mono_object_unbox(result);
607  hr = S_OK;
608  }
609 
610 cleanup:
612  HeapFree(GetProcessHeap(), 0, classA);
613  HeapFree(GetProcessHeap(), 0, argsA);
614  HeapFree(GetProcessHeap(), 0, methodA);
615 
616  return hr;
617 }
GLeglImageOES image
Definition: gl.h:2204
HRESULT hr
Definition: shlfolder.c:183
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define E_FAIL
Definition: ddrawi.h:102
static struct _tagASSEMBLY assembly
Definition: match.c:390
#define debugstr_w
Definition: kernel32.h:32
static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, MonoDomain **result)
static RuntimeHost * impl_from_ICLRRuntimeHost(ICLRRuntimeHost *iface)
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
struct _MonoMethod MonoMethod
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
static CHAR filenameA[MAX_PATH]
Definition: storage32.c:42
struct _MonoClass MonoClass
method
Definition: dragdrop.c:53
struct _MonoImage MonoImage
Definition: mxnamespace.c:44
struct _MonoObject MonoObject
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
char * WtoA(LPCWSTR wstr)
Definition: mscoree_main.c:30
char * cleanup(char *str)
Definition: wpickclick.c:99
struct _MonoDomain MonoDomain
struct _MonoAssembly MonoAssembly
GLuint64EXT * result
Definition: glext.h:11304
#define HeapFree(x, y, z)
Definition: compat.h:394
struct _MonoString MonoString

◆ CLRRuntimeHost_GetCLRControl()

static HRESULT WINAPI CLRRuntimeHost_GetCLRControl ( ICLRRuntimeHost iface,
ICLRControl **  pCLRControl 
)
static

Definition at line 494 of file corruntimehost.c.

496 {
497  FIXME("(%p,%p)\n", iface, pCLRControl);
498  return E_NOTIMPL;
499 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CLRRuntimeHost_GetCurrentAppDomainId()

static HRESULT WINAPI CLRRuntimeHost_GetCurrentAppDomainId ( ICLRRuntimeHost iface,
DWORD pdwAppDomainId 
)
static

Definition at line 515 of file corruntimehost.c.

517 {
518  FIXME("(%p,%p)\n", iface, pdwAppDomainId);
519  return E_NOTIMPL;
520 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CLRRuntimeHost_QueryInterface()

static HRESULT WINAPI CLRRuntimeHost_QueryInterface ( ICLRRuntimeHost iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 440 of file corruntimehost.c.

443 {
445  TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
446 
447  if ( IsEqualGUID( riid, &IID_ICLRRuntimeHost ) ||
449  {
450  *ppvObject = iface;
451  }
452  else
453  {
454  FIXME("Unsupported interface %s\n", debugstr_guid(riid));
455  return E_NOINTERFACE;
456  }
457 
458  ICLRRuntimeHost_AddRef( iface );
459 
460  return S_OK;
461 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define FIXME(fmt,...)
Definition: debug.h:110
static RuntimeHost * impl_from_ICLRRuntimeHost(ICLRRuntimeHost *iface)
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ CLRRuntimeHost_Release()

static ULONG WINAPI CLRRuntimeHost_Release ( ICLRRuntimeHost iface)
static

Definition at line 469 of file corruntimehost.c.

470 {
472  return ICorRuntimeHost_Release(&This->ICorRuntimeHost_iface);
473 }
static RuntimeHost * impl_from_ICLRRuntimeHost(ICLRRuntimeHost *iface)

◆ CLRRuntimeHost_SetHostControl()

static HRESULT WINAPI CLRRuntimeHost_SetHostControl ( ICLRRuntimeHost iface,
IHostControl pHostControl 
)
static

Definition at line 487 of file corruntimehost.c.

489 {
490  FIXME("(%p,%p)\n", iface, pHostControl);
491  return E_NOTIMPL;
492 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CLRRuntimeHost_Start()

static HRESULT WINAPI CLRRuntimeHost_Start ( ICLRRuntimeHost iface)
static

Definition at line 475 of file corruntimehost.c.

476 {
477  FIXME("(%p)\n", iface);
478  return E_NOTIMPL;
479 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CLRRuntimeHost_Stop()

static HRESULT WINAPI CLRRuntimeHost_Stop ( ICLRRuntimeHost iface)
static

Definition at line 481 of file corruntimehost.c.

482 {
483  FIXME("(%p)\n", iface);
484  return E_NOTIMPL;
485 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CLRRuntimeHost_UnloadAppDomain()

static HRESULT WINAPI CLRRuntimeHost_UnloadAppDomain ( ICLRRuntimeHost iface,
DWORD  dwAppDomainId,
BOOL  fWaitUntilDone 
)
static

Definition at line 501 of file corruntimehost.c.

503 {
504  FIXME("(%p,%u,%i)\n", iface, dwAppDomainId, fWaitUntilDone);
505  return E_NOTIMPL;
506 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_AddRef()

static ULONG WINAPI corruntimehost_AddRef ( ICorRuntimeHost iface)
static

Definition at line 229 of file corruntimehost.c.

230 {
232 
233  return InterlockedIncrement( &This->ref );
234 }
#define InterlockedIncrement
Definition: armddk.h:53
static RuntimeHost * impl_from_ICorRuntimeHost(ICorRuntimeHost *iface)

◆ corruntimehost_CloseEnum()

static HRESULT WINAPI corruntimehost_CloseEnum ( ICorRuntimeHost iface,
HDOMAINENUM  hEnum 
)
static

Definition at line 363 of file corruntimehost.c.

366 {
367  FIXME("stub %p\n", iface);
368  return E_NOTIMPL;
369 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_CreateDomain()

static HRESULT WINAPI corruntimehost_CreateDomain ( ICorRuntimeHost iface,
LPCWSTR  friendlyName,
IUnknown identityArray,
IUnknown **  appDomain 
)
static

Definition at line 316 of file corruntimehost.c.

321 {
322  FIXME("stub %p\n", iface);
323  return E_NOTIMPL;
324 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_CreateDomainEx()

static HRESULT WINAPI corruntimehost_CreateDomainEx ( ICorRuntimeHost iface,
LPCWSTR  friendlyName,
IUnknown setup,
IUnknown evidence,
IUnknown **  appDomain 
)
static

Definition at line 371 of file corruntimehost.c.

377 {
378  FIXME("stub %p\n", iface);
379  return E_NOTIMPL;
380 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_CreateDomainSetup()

static HRESULT WINAPI corruntimehost_CreateDomainSetup ( ICorRuntimeHost iface,
IUnknown **  appDomainSetup 
)
static

Definition at line 382 of file corruntimehost.c.

385 {
386  FIXME("stub %p\n", iface);
387  return E_NOTIMPL;
388 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_CreateEvidence()

static HRESULT WINAPI corruntimehost_CreateEvidence ( ICorRuntimeHost iface,
IUnknown **  evidence 
)
static

Definition at line 390 of file corruntimehost.c.

393 {
394  FIXME("stub %p\n", iface);
395  return E_NOTIMPL;
396 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_CreateLogicalThreadState()

static HRESULT WINAPI corruntimehost_CreateLogicalThreadState ( ICorRuntimeHost iface)
static

Definition at line 247 of file corruntimehost.c.

249 {
250  FIXME("stub %p\n", iface);
251  return E_NOTIMPL;
252 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_CurrentDomain()

static HRESULT WINAPI corruntimehost_CurrentDomain ( ICorRuntimeHost iface,
IUnknown **  appDomain 
)
static

Definition at line 406 of file corruntimehost.c.

409 {
410  FIXME("stub %p\n", iface);
411  return E_NOTIMPL;
412 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_DeleteLogicalThreadState()

static HRESULT WINAPI corruntimehost_DeleteLogicalThreadState ( ICorRuntimeHost iface)
static

Definition at line 254 of file corruntimehost.c.

256 {
257  FIXME("stub %p\n", iface);
258  return E_NOTIMPL;
259 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_EnumDomains()

static HRESULT WINAPI corruntimehost_EnumDomains ( ICorRuntimeHost iface,
HDOMAINENUM hEnum 
)
static

Definition at line 346 of file corruntimehost.c.

349 {
350  FIXME("stub %p\n", iface);
351  return E_NOTIMPL;
352 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_GetConfiguration()

static HRESULT WINAPI corruntimehost_GetConfiguration ( ICorRuntimeHost iface,
ICorConfiguration **  pConfiguration 
)
static

Definition at line 294 of file corruntimehost.c.

297 {
298  FIXME("stub %p\n", iface);
299  return E_NOTIMPL;
300 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_GetDefaultDomain()

static HRESULT WINAPI corruntimehost_GetDefaultDomain ( ICorRuntimeHost iface,
IUnknown **  pAppDomain 
)
static

Definition at line 326 of file corruntimehost.c.

329 {
331  HRESULT hr;
332  MonoDomain *domain;
333 
334  TRACE("(%p)\n", iface);
335 
337 
338  if (SUCCEEDED(hr))
339  {
340  hr = RuntimeHost_GetIUnknownForDomain(This, domain, pAppDomain);
341  }
342 
343  return hr;
344 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, MonoDomain **result)
static HRESULT RuntimeHost_GetIUnknownForDomain(RuntimeHost *This, MonoDomain *domain, IUnknown **punk)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static RuntimeHost * impl_from_ICorRuntimeHost(ICorRuntimeHost *iface)
struct _MonoDomain MonoDomain
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ corruntimehost_LocksHeldByLogicalThread()

static HRESULT WINAPI corruntimehost_LocksHeldByLogicalThread ( ICorRuntimeHost iface,
DWORD pCount 
)
static

Definition at line 277 of file corruntimehost.c.

280 {
281  FIXME("stub %p\n", iface);
282  return E_NOTIMPL;
283 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_MapFile()

static HRESULT WINAPI corruntimehost_MapFile ( ICorRuntimeHost iface,
HANDLE  hFile,
HMODULE mapAddress 
)
static

Definition at line 285 of file corruntimehost.c.

289 {
290  FIXME("stub %p\n", iface);
291  return E_NOTIMPL;
292 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_NextDomain()

static HRESULT WINAPI corruntimehost_NextDomain ( ICorRuntimeHost iface,
HDOMAINENUM  hEnum,
IUnknown **  appDomain 
)
static

Definition at line 354 of file corruntimehost.c.

358 {
359  FIXME("stub %p\n", iface);
360  return E_NOTIMPL;
361 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_QueryInterface()

static HRESULT WINAPI corruntimehost_QueryInterface ( ICorRuntimeHost iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 206 of file corruntimehost.c.

209 {
211  TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
212 
213  if ( IsEqualGUID( riid, &IID_ICorRuntimeHost ) ||
215  {
216  *ppvObject = iface;
217  }
218  else
219  {
220  FIXME("Unsupported interface %s\n", debugstr_guid(riid));
221  return E_NOINTERFACE;
222  }
223 
224  ICorRuntimeHost_AddRef( iface );
225 
226  return S_OK;
227 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
static RuntimeHost * impl_from_ICorRuntimeHost(ICorRuntimeHost *iface)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ corruntimehost_Release()

static ULONG WINAPI corruntimehost_Release ( ICorRuntimeHost iface)
static

Definition at line 236 of file corruntimehost.c.

237 {
239  ULONG ref;
240 
241  ref = InterlockedDecrement( &This->ref );
242 
243  return ref;
244 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define InterlockedDecrement
Definition: armddk.h:52
static RuntimeHost * impl_from_ICorRuntimeHost(ICorRuntimeHost *iface)
unsigned int ULONG
Definition: retypes.h:1

◆ corruntimehost_Start()

static HRESULT WINAPI corruntimehost_Start ( ICorRuntimeHost iface)
static

Definition at line 302 of file corruntimehost.c.

304 {
305  FIXME("stub %p\n", iface);
306  return S_OK;
307 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

◆ corruntimehost_Stop()

static HRESULT WINAPI corruntimehost_Stop ( ICorRuntimeHost iface)
static

Definition at line 309 of file corruntimehost.c.

311 {
312  FIXME("stub %p\n", iface);
313  return E_NOTIMPL;
314 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_SwitchInLogicalThreadState()

static HRESULT WINAPI corruntimehost_SwitchInLogicalThreadState ( ICorRuntimeHost iface,
DWORD fiberCookie 
)
static

Definition at line 261 of file corruntimehost.c.

264 {
265  FIXME("stub %p\n", iface);
266  return E_NOTIMPL;
267 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_SwitchOutLogicalThreadState()

static HRESULT WINAPI corruntimehost_SwitchOutLogicalThreadState ( ICorRuntimeHost iface,
DWORD **  fiberCookie 
)
static

Definition at line 269 of file corruntimehost.c.

272 {
273  FIXME("stub %p\n", iface);
274  return E_NOTIMPL;
275 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ corruntimehost_UnloadDomain()

static HRESULT WINAPI corruntimehost_UnloadDomain ( ICorRuntimeHost iface,
IUnknown appDomain 
)
static

Definition at line 398 of file corruntimehost.c.

401 {
402  FIXME("stub %p\n", iface);
403  return E_NOTIMPL;
404 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ create_monodata()

HRESULT create_monodata ( REFIID  riid,
LPVOID ppObj 
)

Definition at line 1211 of file corruntimehost.c.

1212 {
1213  static const WCHAR wszCodebase[] = {'C','o','d','e','B','a','s','e',0};
1214  static const WCHAR wszClass[] = {'C','l','a','s','s',0};
1215  static const WCHAR wszFileSlash[] = {'f','i','l','e',':','/','/','/',0};
1216  static const WCHAR wszCLSIDSlash[] = {'C','L','S','I','D','\\',0};
1217  static const WCHAR wszInprocServer32[] = {'\\','I','n','p','r','o','c','S','e','r','v','e','r','3','2',0};
1218  WCHAR path[CHARS_IN_GUID + ARRAYSIZE(wszCLSIDSlash) + ARRAYSIZE(wszInprocServer32) - 1];
1219  MonoDomain *domain;
1222  RuntimeHost *host;
1223  HRESULT hr;
1224  HKEY key;
1225  LONG res;
1226  int offset = 0;
1227  WCHAR codebase[MAX_PATH + 8];
1228  WCHAR classname[350];
1230 
1231  DWORD dwBufLen = 350;
1232 
1233  lstrcpyW(path, wszCLSIDSlash);
1234  StringFromGUID2(riid, path + lstrlenW(wszCLSIDSlash), CHARS_IN_GUID);
1235  lstrcatW(path, wszInprocServer32);
1236 
1237  TRACE("Registry key: %s\n", debugstr_w(path));
1238 
1240  if (res == ERROR_FILE_NOT_FOUND)
1242 
1244  if(res != ERROR_SUCCESS)
1245  {
1246  WARN("Class value cannot be found.\n");
1248  goto cleanup;
1249  }
1250 
1251  TRACE("classname (%s)\n", debugstr_w(classname));
1252 
1253  dwBufLen = MAX_PATH + 8;
1254  res = RegGetValueW( key, NULL, wszCodebase, RRF_RT_REG_SZ, NULL, codebase, &dwBufLen);
1255  if(res != ERROR_SUCCESS)
1256  {
1257  WARN("CodeBase value cannot be found.\n");
1259  goto cleanup;
1260  }
1261 
1262  /* Strip file:/// */
1263  if(strncmpW(codebase, wszFileSlash, strlenW(wszFileSlash)) == 0)
1264  offset = strlenW(wszFileSlash);
1265 
1266  strcpyW(filename, codebase + offset);
1267 
1268  TRACE("codebase (%s)\n", debugstr_w(filename));
1269 
1270  *ppObj = NULL;
1271 
1272 
1273  hr = get_runtime_info(filename, NULL, NULL, 0, 0, FALSE, &info);
1274  if (SUCCEEDED(hr))
1275  {
1277 
1278  if (SUCCEEDED(hr))
1279  hr = RuntimeHost_GetDefaultDomain(host, &domain);
1280 
1281  if (SUCCEEDED(hr))
1282  {
1283  MonoImage *image;
1284  MonoClass *klass;
1285  MonoObject *result;
1286  IUnknown *unk = NULL;
1287  char *filenameA, *ns;
1288  char *classA;
1289 
1291 
1292  host->mono->mono_thread_attach(domain);
1293 
1294  filenameA = WtoA(filename);
1295  assembly = host->mono->mono_domain_assembly_open(domain, filenameA);
1297  if (!assembly)
1298  {
1299  ERR("Cannot open assembly %s\n", filenameA);
1300  goto cleanup;
1301  }
1302 
1303  image = host->mono->mono_assembly_get_image(assembly);
1304  if (!image)
1305  {
1306  ERR("Couldn't get assembly image\n");
1307  goto cleanup;
1308  }
1309 
1310  classA = WtoA(classname);
1311  ns = strrchr(classA, '.');
1312  *ns = '\0';
1313 
1314  klass = host->mono->mono_class_from_name(image, classA, ns+1);
1315  HeapFree(GetProcessHeap(), 0, classA);
1316  if (!klass)
1317  {
1318  ERR("Couldn't get class from image\n");
1319  goto cleanup;
1320  }
1321 
1322  /*
1323  * Use the default constructor for the .NET class.
1324  */
1325  result = host->mono->mono_object_new(domain, klass);
1326  host->mono->mono_runtime_object_init(result);
1327 
1329  if (SUCCEEDED(hr))
1330  {
1331  hr = IUnknown_QueryInterface(unk, &IID_IUnknown, ppObj);
1332 
1333  IUnknown_Release(unk);
1334  }
1335  else
1337  }
1338  else
1340  }
1341  else
1343 
1344 cleanup:
1345  if(info)
1346  ICLRRuntimeInfo_Release(info);
1347 
1348  RegCloseKey(key);
1349 
1350  return hr;
1351 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
GLeglImageOES image
Definition: gl.h:2204
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result)
Definition: metahost.c:544
#define KEY_READ
Definition: nt_native.h:1023
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
char * host
Definition: whois.c:55
#define CHARS_IN_GUID
GLintptr offset
Definition: glext.h:5920
#define RRF_RT_REG_SZ
Definition: driver.c:575
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
WCHAR classname[128]
Definition: startup.c:15
const char * filename
Definition: ioapi.h:135
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4245
#define lstrlenW
Definition: compat.h:407
static struct _tagASSEMBLY assembly
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
WINE_UNICODE_INLINE int strncmpW(const WCHAR *str1, const WCHAR *str2, int n)
Definition: unicode.h:235
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, MonoDomain **result)
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
HRESULT RuntimeHost_GetIUnknownForObject(RuntimeHost *This, MonoObject *obj, IUnknown **ppUnk)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
#define MAX_PATH
Definition: compat.h:26
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
unsigned long DWORD
Definition: ntddk_ex.h:95
static CHAR filenameA[MAX_PATH]
Definition: storage32.c:42
struct _MonoClass MonoClass
struct _MonoImage MonoImage
Definition: mxnamespace.c:44
HKEY key
Definition: reg.c:42
struct _MonoObject MonoObject
#define ARRAYSIZE(array)
#define ERR(fmt,...)
Definition: debug.h:109
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define lstrcpyW
Definition: compat.h:406
char * WtoA(LPCWSTR wstr)
Definition: mscoree_main.c:30
Definition: services.c:325
HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file, DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result)
Definition: metahost.c:1247
GLuint res
Definition: glext.h:9613
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
char * cleanup(char *str)
Definition: wpickclick.c:99
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
struct _MonoDomain MonoDomain
struct _MonoAssembly MonoAssembly
GLuint64EXT * result
Definition: glext.h:11304
#define HeapFree(x, y, z)
Definition: compat.h:394
#define SUCCEEDED(hr)
Definition: intsafe.h:57
Definition: path.c:42

Referenced by DllGetClassObject().

◆ DEFINE_GUID()

DEFINE_GUID ( IID__AppDomain  ,
0x05f696dc  ,
0x2b29  ,
0x3663  ,
0xad  ,
0x8b  ,
0xc4  ,
0x38  ,
0x9c  ,
0xf2  ,
0xa7  ,
0x13   
)

◆ FixupVTable()

static void FixupVTable ( HMODULE  hmodule)
static

Definition at line 985 of file corruntimehost.c.

986 {
988  HRESULT hr;
989  VTableFixup *vtable_fixups;
990  ULONG vtable_fixup_count, i;
991 
993  if (SUCCEEDED(hr))
994  {
995  hr = assembly_get_vtable_fixups(assembly, &vtable_fixups, &vtable_fixup_count);
996  if (CAN_FIXUP_VTABLE)
997  for (i=0; i<vtable_fixup_count; i++)
998  FixupVTableEntry(hmodule, &vtable_fixups[i]);
999  else if (vtable_fixup_count)
1000  FIXME("cannot fixup vtable; expect a crash\n");
1001 
1003  }
1004  else
1005  ERR("failed to read CLR headers, hr=%x\n", hr);
1006 }
HRESULT hr
Definition: shlfolder.c:183
static struct _tagASSEMBLY assembly
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static HMODULE hmodule
Definition: rasapi.c:29
#define FIXME(fmt,...)
Definition: debug.h:110
HRESULT assembly_get_vtable_fixups(ASSEMBLY *assembly, VTableFixup **fixups, DWORD *count)
Definition: assembly.c:294
LONG HRESULT
Definition: typedefs.h:77
HRESULT assembly_from_hmodule(ASSEMBLY **out, HMODULE hmodule)
Definition: assembly.c:245
HRESULT assembly_release(ASSEMBLY *assembly)
Definition: assembly.c:693
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int ULONG
Definition: retypes.h:1
static void FixupVTableEntry(HMODULE hmodule, VTableFixup *vtable_fixup)
#define CAN_FIXUP_VTABLE
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by _CorDllMain(), and _CorExeMain().

◆ FixupVTableEntry()

static void FixupVTableEntry ( HMODULE  hmodule,
VTableFixup vtable_fixup 
)
static

Definition at line 934 of file corruntimehost.c.

935 {
936  /* We can't actually generate code for the functions without loading mono,
937  * and loading mono inside DllMain is a terrible idea. So we make thunks
938  * that call ReallyFixupVTable, which will load the runtime and fill in the
939  * vtable, then do an indirect jump using the (now filled in) vtable. Note
940  * that we have to keep the thunks around forever, as one of them may get
941  * called while we're filling in the table, and we can never be sure all
942  * threads are clear. */
943  struct dll_fixup *fixup;
944 
945  fixup = HeapAlloc(GetProcessHeap(), 0, sizeof(*fixup));
946 
947  fixup->dll = hmodule;
948  fixup->thunk_code = HeapAlloc(dll_fixup_heap, 0, sizeof(struct vtable_fixup_thunk) * vtable_fixup->count);
949  fixup->fixup = vtable_fixup;
950  fixup->vtable = (BYTE*)hmodule + vtable_fixup->rva;
951  fixup->done = 0;
952 
953  if (vtable_fixup->type & COR_VTABLE_32BIT)
954  {
955  DWORD *vtable = fixup->vtable;
956  DWORD *tokens;
957  int i;
958  struct vtable_fixup_thunk *thunks = fixup->thunk_code;
959 
960  if (sizeof(void*) > 4)
961  ERR("32-bit fixup in 64-bit mode; broken image?\n");
962 
963  tokens = fixup->tokens = HeapAlloc(GetProcessHeap(), 0, sizeof(*tokens) * vtable_fixup->count);
964  memcpy(tokens, vtable, sizeof(*tokens) * vtable_fixup->count);
965  for (i=0; i<vtable_fixup->count; i++)
966  {
967  memcpy(&thunks[i], &thunk_template, sizeof(thunk_template));
968  thunks[i].fixup = fixup;
969  thunks[i].function = ReallyFixupVTable;
970  thunks[i].vtable_entry = &vtable[i];
971  vtable[i] = PtrToUint(&thunks[i]);
972  }
973  }
974  else
975  {
976  ERR("unsupported vtable fixup flags %x\n", vtable_fixup->type);
977  HeapFree(dll_fixup_heap, 0, fixup->thunk_code);
979  return;
980  }
981 
982  list_add_tail(&dll_fixups, &fixup->entry);
983 }
#define PtrToUint(p)
Definition: basetsd.h:85
static void * vtable[]
Definition: typelib.c:1231
void * tokens
VTableFixup * fixup
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static HMODULE hmodule
Definition: rasapi.c:29
static struct list dll_fixups
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:714
static void CDECL ReallyFixupVTable(struct dll_fixup *fixup)
unsigned long DWORD
Definition: ntddk_ex.h:95
static HANDLE dll_fixup_heap
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
static const struct vtable_fixup_thunk thunk_template
struct dll_fixup * fixup
#define ERR(fmt,...)
Definition: debug.h:109
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by FixupVTable().

◆ get_utf8_args()

static void get_utf8_args ( int argc,
char ***  argv 
)
static

Definition at line 771 of file corruntimehost.c.

772 {
773  WCHAR **argvw;
774  int size=0, i;
775  char *current_arg;
776 
778 
779  for (i=0; i<*argc; i++)
780  {
781  size += sizeof(char*);
782  size += WideCharToMultiByte(CP_UTF8, 0, argvw[i], -1, NULL, 0, NULL, NULL);
783  }
784  size += sizeof(char*);
785 
786  *argv = HeapAlloc(GetProcessHeap(), 0, size);
787  current_arg = (char*)(*argv + *argc + 1);
788 
789  for (i=0; i<*argc; i++)
790  {
791  (*argv)[i] = current_arg;
792  current_arg += WideCharToMultiByte(CP_UTF8, 0, argvw[i], -1, current_arg, size, NULL, NULL);
793  }
794 
795  (*argv)[*argc] = NULL;
796 
797  HeapFree(GetProcessHeap(), 0, argvw);
798 }
static int argc
Definition: ServiceArgs.c:12
#define WideCharToMultiByte
Definition: compat.h:101
#define argv
Definition: mplay32.c:18
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define CP_UTF8
Definition: nls.h:20
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2013
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
Definition: shell32_main.c:76
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by _CorExeMain().

◆ impl_from_ICLRRuntimeHost()

static RuntimeHost* impl_from_ICLRRuntimeHost ( ICLRRuntimeHost iface)
inlinestatic

Definition at line 195 of file corruntimehost.c.

196 {
197  return CONTAINING_RECORD(iface, RuntimeHost, ICLRRuntimeHost_iface);
198 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by CLRRuntimeHost_AddRef(), CLRRuntimeHost_ExecuteInDefaultAppDomain(), CLRRuntimeHost_QueryInterface(), and CLRRuntimeHost_Release().

◆ impl_from_ICorRuntimeHost()

static RuntimeHost* impl_from_ICorRuntimeHost ( ICorRuntimeHost iface)
inlinestatic

Definition at line 200 of file corruntimehost.c.

201 {
202  return CONTAINING_RECORD(iface, RuntimeHost, ICorRuntimeHost_iface);
203 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by corruntimehost_AddRef(), corruntimehost_GetDefaultDomain(), corruntimehost_QueryInterface(), and corruntimehost_Release().

◆ ReallyFixupVTable()

static void CDECL ReallyFixupVTable ( struct dll_fixup fixup)
static

Definition at line 854 of file corruntimehost.c.

855 {
856  HRESULT hr=S_OK;
859  RuntimeHost *host;
860  char *filenameA;
864  MonoDomain *domain;
865 
866  if (fixup->done) return;
867 
868  /* It's possible we'll have two threads doing this at once. This is
869  * considered preferable to the potential deadlock if we use a mutex. */
870 
872 
873  TRACE("%p,%p,%s\n", fixup, fixup->dll, debugstr_w(filename));
874 
876  if (!filenameA)
877  hr = E_OUTOFMEMORY;
878 
879  if (SUCCEEDED(hr))
881 
882  if (SUCCEEDED(hr))
884 
885  if (SUCCEEDED(hr))
887 
888  if (SUCCEEDED(hr))
889  {
890  host->mono->mono_thread_attach(domain);
891 
892  image = host->mono->mono_image_open_from_module_handle(fixup->dll,
893  filenameA, 1, &status);
894  }
895 
896  if (image)
897  assembly = host->mono->mono_assembly_load_from(image, filenameA, &status);
898 
899  if (assembly)
900  {
901  int i;
902 
903  /* Mono needs an image that belongs to an assembly. */
904  image = host->mono->mono_assembly_get_image(assembly);
905 
906  if (fixup->fixup->type & COR_VTABLE_32BIT)
907  {
908  DWORD *vtable = fixup->vtable;
909  DWORD *tokens = fixup->tokens;
910  for (i=0; i<fixup->fixup->count; i++)
911  {
912  TRACE("%x\n", tokens[i]);
913  vtable[i] = PtrToUint(host->mono->mono_marshal_get_vtfixup_ftnptr(
914  image, tokens[i], fixup->fixup->type));
915  }
916  }
917 
918  fixup->done = 1;
919  }
920 
921  if (info != NULL)
922  ICLRRuntimeInfo_Release(info);
923 
925 
926  if (!fixup->done)
927  {
928  ERR("unable to fixup vtable, hr=%x, status=%d\n", hr, status);
929  /* If we returned now, we'd get an infinite loop. */
930  assert(0);
931  }
932 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
#define PtrToUint(p)
Definition: basetsd.h:85
static void * vtable[]
Definition: typelib.c:1231
HRESULT hr
Definition: shlfolder.c:183
HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result)
Definition: metahost.c:544
char * host
Definition: whois.c:55
#define assert(x)
Definition: debug.h:53
const char * filename
Definition: ioapi.h:135
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, MonoDomain **result)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static CHAR filenameA[MAX_PATH]
Definition: storage32.c:42
struct _MonoImage MonoImage
struct dll_fixup * fixup
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
char * WtoA(LPCWSTR wstr)
Definition: mscoree_main.c:30
HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file, DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result)
Definition: metahost.c:1247
MonoImageOpenStatus
struct _MonoDomain MonoDomain
struct _MonoAssembly MonoAssembly
#define HeapFree(x, y, z)
Definition: compat.h:394
#define SUCCEEDED(hr)
Definition: intsafe.h:57
Definition: ps.c:97

Referenced by FixupVTableEntry().

◆ RuntimeHost_AddDomain()

static HRESULT RuntimeHost_AddDomain ( RuntimeHost This,
MonoDomain **  result 
)
static

Definition at line 49 of file corruntimehost.c.

50 {
51  struct DomainEntry *entry;
52  char *mscorlib_path;
54 
55  EnterCriticalSection(&This->lock);
56 
57  entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry));
58  if (!entry)
59  {
61  goto end;
62  }
63 
64  mscorlib_path = WtoA(This->version->mscorlib_path);
65  if (!mscorlib_path)
66  {
69  goto end;
70  }
71 
72  entry->domain = This->mono->mono_jit_init(mscorlib_path);
73 
74  HeapFree(GetProcessHeap(), 0, mscorlib_path);
75 
76  if (!entry->domain)
77  {
79  res = E_FAIL;
80  goto end;
81  }
82 
83  This->mono->is_started = TRUE;
84 
85  list_add_tail(&This->domains, &entry->entry);
86 
87  *result = entry->domain;
88 
89 end:
90  LeaveCriticalSection(&This->lock);
91 
92  return res;
93 }
#define TRUE
Definition: types.h:120
GLuint GLuint end
Definition: gl.h:1545
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define E_FAIL
Definition: ddrawi.h:102
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
uint32_t entry
Definition: isohybrid.c:63
#define S_OK
Definition: intsafe.h:59
char * WtoA(LPCWSTR wstr)
Definition: mscoree_main.c:30
GLuint res
Definition: glext.h:9613
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
GLuint64EXT * result
Definition: glext.h:11304
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by RuntimeHost_GetDefaultDomain().

◆ RuntimeHost_Construct()

HRESULT RuntimeHost_Construct ( const CLRRuntimeInfo runtime_version,
loaded_mono loaded_mono,
RuntimeHost **  result 
)

Definition at line 1120 of file corruntimehost.c.

1122 {
1123  RuntimeHost *This;
1124 
1125  This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
1126  if ( !This )
1127  return E_OUTOFMEMORY;
1128 
1129  This->ICorRuntimeHost_iface.lpVtbl = &corruntimehost_vtbl;
1130  This->ICLRRuntimeHost_iface.lpVtbl = &CLRHostVtbl;
1131 
1132  This->ref = 1;
1133  This->version = runtime_version;
1134  This->mono = loaded_mono;
1135  list_init(&This->domains);
1136  This->default_domain = NULL;
1138  This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RuntimeHost.lock");
1139 
1140  *result = This;
1141 
1142  return S_OK;
1143 }
static const struct ICorRuntimeHostVtbl corruntimehost_vtbl
#define DWORD_PTR
Definition: treelist.c:76
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
smooth NULL
Definition: ftsmooth.c:416
static const struct ICLRRuntimeHostVtbl CLRHostVtbl
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define S_OK
Definition: intsafe.h:59
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
GLuint64EXT * result
Definition: glext.h:11304
struct loaded_mono loaded_mono

Referenced by CLRRuntimeInfo_GetRuntimeHost().

◆ RuntimeHost_CreateManagedInstance()

HRESULT RuntimeHost_CreateManagedInstance ( RuntimeHost This,
LPCWSTR  name,
MonoDomain domain,
MonoObject **  result 
)

Definition at line 638 of file corruntimehost.c.

640 {
641  HRESULT hr=S_OK;
642  char *nameA=NULL;
643  MonoType *type;
644  MonoClass *klass;
645  MonoObject *obj;
646 
647  if (!domain)
649 
650  if (SUCCEEDED(hr))
651  {
652  nameA = WtoA(name);
653  if (!nameA)
654  hr = E_OUTOFMEMORY;
655  }
656 
657  if (SUCCEEDED(hr))
658  {
659  This->mono->mono_thread_attach(domain);
660 
661  type = This->mono->mono_reflection_type_from_name(nameA, NULL);
662  if (!type)
663  {
664  ERR("Cannot find type %s\n", debugstr_w(name));
665  hr = E_FAIL;
666  }
667  }
668 
669  if (SUCCEEDED(hr))
670  {
671  klass = This->mono->mono_class_from_mono_type(type);
672  if (!klass)
673  {
674  ERR("Cannot convert type %s to a class\n", debugstr_w(name));
675  hr = E_FAIL;
676  }
677  }
678 
679  if (SUCCEEDED(hr))
680  {
681  obj = This->mono->mono_object_new(domain, klass);
682  if (!obj)
683  {
684  ERR("Cannot allocate object of type %s\n", debugstr_w(name));
685  hr = E_FAIL;
686  }
687  }
688 
689  if (SUCCEEDED(hr))
690  {
691  /* FIXME: Detect exceptions from the constructor? */
692  This->mono->mono_runtime_object_init(obj);
693  *result = obj;
694  }
695 
696  HeapFree(GetProcessHeap(), 0, nameA);
697 
698  return hr;
699 }
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define E_FAIL
Definition: ddrawi.h:102
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
MonoDomain * domain
static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, MonoDomain **result)
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
LONG HRESULT
Definition: typedefs.h:77
struct _MonoClass MonoClass
struct _MonoObject MonoObject
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
char * WtoA(LPCWSTR wstr)
Definition: mscoree_main.c:30
Definition: name.c:36
struct _MonoType MonoType
GLuint64EXT * result
Definition: glext.h:11304
#define HeapFree(x, y, z)
Definition: compat.h:394
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by ClrCreateManagedInstance().

◆ RuntimeHost_DeleteDomain()

static void RuntimeHost_DeleteDomain ( RuntimeHost This,
MonoDomain domain 
)
static

Definition at line 113 of file corruntimehost.c.

114 {
115  struct DomainEntry *entry;
116 
117  EnterCriticalSection(&This->lock);
118 
119  LIST_FOR_EACH_ENTRY(entry, &This->domains, struct DomainEntry, entry)
120  {
121  if (entry->domain == domain)
122  {
123  list_remove(&entry->entry);
124  if (This->default_domain == domain)
125  This->default_domain = NULL;
127  break;
128  }
129  }
130 
131  LeaveCriticalSection(&This->lock);
132 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
MonoDomain * domain
smooth NULL
Definition: ftsmooth.c:416
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define GetProcessHeap()
Definition: compat.h:395
uint32_t entry
Definition: isohybrid.c:63
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by _CorExeMain().

◆ RuntimeHost_Destroy()

HRESULT RuntimeHost_Destroy ( RuntimeHost This)

Definition at line 1190 of file corruntimehost.c.

1191 {
1192  struct DomainEntry *cursor, *cursor2;
1193 
1194  This->lock.DebugInfo->Spare[0] = 0;
1195  DeleteCriticalSection(&This->lock);
1196 
1197  LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, &This->domains, struct DomainEntry, entry)
1198  {
1199  list_remove(&cursor->entry);
1201  }
1202 
1203  HeapFree( GetProcessHeap(), 0, This );
1204  return S_OK;
1205 }
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define GetProcessHeap()
Definition: compat.h:395
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
uint32_t entry
Definition: isohybrid.c:63
#define S_OK
Definition: intsafe.h:59
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
const char cursor[]
Definition: icontest.c:13
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by unload_all_runtimes().

◆ RuntimeHost_GetDefaultDomain()

static HRESULT RuntimeHost_GetDefaultDomain ( RuntimeHost This,
MonoDomain **  result 
)
static

Definition at line 95 of file corruntimehost.c.

96 {
98 
99  EnterCriticalSection(&This->lock);
100 
101  if (This->default_domain) goto end;
102 
103  res = RuntimeHost_AddDomain(This, &This->default_domain);
104 
105 end:
106  *result = This->default_domain;
107 
108  LeaveCriticalSection(&This->lock);
109 
110  return res;
111 }
GLuint GLuint end
Definition: gl.h:1545
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
GLuint64EXT * result
Definition: glext.h:11304
static HRESULT RuntimeHost_AddDomain(RuntimeHost *This, MonoDomain **result)

Referenced by _CorExeMain(), CLRRuntimeHost_ExecuteInDefaultAppDomain(), corruntimehost_GetDefaultDomain(), create_monodata(), ReallyFixupVTable(), and RuntimeHost_CreateManagedInstance().

◆ RuntimeHost_GetInterface()

HRESULT RuntimeHost_GetInterface ( RuntimeHost This,
REFCLSID  clsid,
REFIID  riid,
void **  ppv 
)

Definition at line 1145 of file corruntimehost.c.

1146 {
1147  IUnknown *unk;
1148  HRESULT hr;
1149 
1150  if (IsEqualGUID(clsid, &CLSID_CorRuntimeHost))
1151  {
1152  unk = (IUnknown*)&This->ICorRuntimeHost_iface;
1153  IUnknown_AddRef(unk);
1154  }
1155  else if (IsEqualGUID(clsid, &CLSID_CLRRuntimeHost))
1156  {
1157  unk = (IUnknown*)&This->ICLRRuntimeHost_iface;
1158  IUnknown_AddRef(unk);
1159  }
1160  else if (IsEqualGUID(clsid, &CLSID_CorMetaDataDispenser) ||
1161  IsEqualGUID(clsid, &CLSID_CorMetaDataDispenserRuntime))
1162  {
1164  if (FAILED(hr))
1165  return hr;
1166  }
1167  else if (IsEqualGUID(clsid, &CLSID_CLRDebuggingLegacy))
1168  {
1169  hr = CorDebug_Create(&This->ICLRRuntimeHost_iface, &unk);
1170  if (FAILED(hr))
1171  return hr;
1172  }
1173  else
1174  unk = NULL;
1175 
1176  if (unk)
1177  {
1178  hr = IUnknown_QueryInterface(unk, riid, ppv);
1179 
1180  IUnknown_Release(unk);
1181 
1182  return hr;
1183  }
1184  else
1185  FIXME("not implemented for class %s\n", debugstr_guid(clsid));
1186 
1188 }
HRESULT CorDebug_Create(ICLRRuntimeHost *runtimehost, IUnknown **ppUnk)
Definition: cordebug.c:742
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:84
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
HRESULT MetaDataDispenser_CreateInstance(IUnknown **ppUnk)
Definition: metadata.c:169

Referenced by CLRRuntimeInfo_GetInterface().

◆ RuntimeHost_GetIUnknownForDomain()

static HRESULT RuntimeHost_GetIUnknownForDomain ( RuntimeHost This,
MonoDomain domain,
IUnknown **  punk 
)
static

Definition at line 134 of file corruntimehost.c.

135 {
136  HRESULT hr;
137  void *args[1];
139  MonoImage *image;
140  MonoClass *klass;
142  MonoObject *appdomain_object;
143  IUnknown *unk;
144 
145  This->mono->mono_thread_attach(domain);
146 
147  assembly = This->mono->mono_domain_assembly_open(domain, "mscorlib");
148  if (!assembly)
149  {
150  ERR("Cannot load mscorlib\n");
151  return E_FAIL;
152  }
153 
154  image = This->mono->mono_assembly_get_image(assembly);
155  if (!image)
156  {
157  ERR("Couldn't get assembly image\n");
158  return E_FAIL;
159  }
160 
161  klass = This->mono->mono_class_from_name(image, "System", "AppDomain");
162  if (!klass)
163  {
164  ERR("Couldn't get class from image\n");
165  return E_FAIL;
166  }
167 
168  method = This->mono->mono_class_get_method_from_name(klass, "get_CurrentDomain", 0);
169  if (!method)
170  {
171  ERR("Couldn't get method from class\n");
172  return E_FAIL;
173  }
174 
175  args[0] = NULL;
176  appdomain_object = This->mono->mono_runtime_invoke(method, NULL, args, NULL);
177  if (!appdomain_object)
178  {
179  ERR("Couldn't get result pointer\n");
180  return E_FAIL;
181  }
182 
183  hr = RuntimeHost_GetIUnknownForObject(This, appdomain_object, &unk);
184 
185  if (SUCCEEDED(hr))
186  {
187  hr = IUnknown_QueryInterface(unk, &IID__AppDomain, (void**)punk);
188 
189  IUnknown_Release(unk);
190  }
191 
192  return hr;
193 }
GLeglImageOES image
Definition: gl.h:2204
HRESULT hr
Definition: shlfolder.c:183
#define E_FAIL
Definition: ddrawi.h:102
static struct _tagASSEMBLY assembly
Definition: match.c:390
MonoDomain * domain
smooth NULL
Definition: ftsmooth.c:416
struct _MonoMethod MonoMethod
HRESULT RuntimeHost_GetIUnknownForObject(RuntimeHost *This, MonoObject *obj, IUnknown **ppUnk)
LONG HRESULT
Definition: typedefs.h:77
struct _MonoClass MonoClass
method
Definition: dragdrop.c:53
struct _MonoImage MonoImage
struct _MonoObject MonoObject
#define ERR(fmt,...)
Definition: debug.h:109
struct _MonoAssembly MonoAssembly
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by corruntimehost_GetDefaultDomain().

◆ RuntimeHost_GetIUnknownForObject()

HRESULT RuntimeHost_GetIUnknownForObject ( RuntimeHost This,
MonoObject obj,
IUnknown **  ppUnk 
)

Definition at line 711 of file corruntimehost.c.

713 {
716  MonoImage *image;
717  MonoClass *klass;
720  void *args[2];
721 
722  domain = This->mono->mono_object_get_domain(obj);
723 
724  assembly = This->mono->mono_domain_assembly_open(domain, "mscorlib");
725  if (!assembly)
726  {
727  ERR("Cannot load mscorlib\n");
728  return E_FAIL;
729  }
730 
731  image = This->mono->mono_assembly_get_image(assembly);
732  if (!image)
733  {
734  ERR("Couldn't get assembly image\n");
735  return E_FAIL;
736  }
737 
738  klass = This->mono->mono_class_from_name(image, "System.Runtime.InteropServices", "Marshal");
739  if (!klass)
740  {
741  ERR("Couldn't get class from image\n");
742  return E_FAIL;
743  }
744 
745  method = This->mono->mono_class_get_method_from_name(klass, "GetIUnknownForObject", 1);
746  if (!method)
747  {
748  ERR("Couldn't get method from class\n");
749  return E_FAIL;
750  }
751 
752  args[0] = obj;
753  args[1] = NULL;
754  result = This->mono->mono_runtime_invoke(method, NULL, args, NULL);
755  if (!result)
756  {
757  ERR("Couldn't get result pointer\n");
758  return E_FAIL;
759  }
760 
761  *ppUnk = *(IUnknown**)This->mono->mono_object_unbox(result);
762  if (!*ppUnk)
763  {
764  ERR("GetIUnknownForObject returned 0\n");
765  return E_FAIL;
766  }
767 
768  return S_OK;
769 }
GLeglImageOES image
Definition: gl.h:2204
#define E_FAIL
Definition: ddrawi.h:102
static struct _tagASSEMBLY assembly
Definition: match.c:390
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
MonoDomain * domain
smooth NULL
Definition: ftsmooth.c:416
struct _MonoMethod MonoMethod
struct _MonoClass MonoClass
method
Definition: dragdrop.c:53
struct _MonoImage MonoImage
struct _MonoObject MonoObject
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
struct _MonoDomain MonoDomain
struct _MonoAssembly MonoAssembly
GLuint64EXT * result
Definition: glext.h:11304

Referenced by ClrCreateManagedInstance(), create_monodata(), and RuntimeHost_GetIUnknownForDomain().

◆ runtimehost_init()

void runtimehost_init ( void  )

Definition at line 1101 of file corruntimehost.c.

1102 {
1105 }
HANDLE WINAPI HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
Definition: heapmem.c:45
static struct list dll_fixups
static HANDLE dll_fixup_heap
#define HEAP_CREATE_ENABLE_EXECUTE
Definition: mmtypes.h:217
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149

Referenced by DllMain().

◆ runtimehost_uninit()

void runtimehost_uninit ( void  )

Definition at line 1108 of file corruntimehost.c.

1109 {
1110  struct dll_fixup *fixup, *fixup2;
1111 
1114  {
1115  HeapFree(GetProcessHeap(), 0, fixup->tokens);
1116  HeapFree(GetProcessHeap(), 0, fixup);
1117  }
1118 }
VTableFixup * fixup
BOOL WINAPI HeapDestroy(HANDLE hHeap)
Definition: heapmem.c:85
static struct list dll_fixups
#define GetProcessHeap()
Definition: compat.h:395
static HANDLE dll_fixup_heap
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by DllMain().

Variable Documentation

◆ CLRHostVtbl

const struct ICLRRuntimeHostVtbl CLRHostVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI CLRRuntimeHost_ExecuteInDefaultAppDomain(ICLRRuntimeHost *iface, LPCWSTR pwzAssemblyPath, LPCWSTR pwzTypeName, LPCWSTR pwzMethodName, LPCWSTR pwzArgument, DWORD *pReturnValue)
static HRESULT WINAPI CLRRuntimeHost_GetCurrentAppDomainId(ICLRRuntimeHost *iface, DWORD *pdwAppDomainId)
static ULONG WINAPI CLRRuntimeHost_Release(ICLRRuntimeHost *iface)
static HRESULT WINAPI CLRRuntimeHost_Start(ICLRRuntimeHost *iface)
static HRESULT WINAPI CLRRuntimeHost_ExecuteApplication(ICLRRuntimeHost *iface, LPCWSTR pwzAppFullName, DWORD dwManifestPaths, LPCWSTR *ppwzManifestPaths, DWORD dwActivationData, LPCWSTR *ppwzActivationData, int *pReturnValue)
static HRESULT WINAPI CLRRuntimeHost_SetHostControl(ICLRRuntimeHost *iface, IHostControl *pHostControl)
static HRESULT WINAPI CLRRuntimeHost_QueryInterface(ICLRRuntimeHost *iface, REFIID riid, void **ppvObject)
static HRESULT WINAPI CLRRuntimeHost_ExecuteInAppDomain(ICLRRuntimeHost *iface, DWORD dwAppDomainId, FExecuteInAppDomainCallback pCallback, void *cookie)
static HRESULT WINAPI CLRRuntimeHost_GetCLRControl(ICLRRuntimeHost *iface, ICLRControl **pCLRControl)
static HRESULT WINAPI CLRRuntimeHost_UnloadAppDomain(ICLRRuntimeHost *iface, DWORD dwAppDomainId, BOOL fWaitUntilDone)
static HRESULT WINAPI CLRRuntimeHost_Stop(ICLRRuntimeHost *iface)
static ULONG WINAPI CLRRuntimeHost_AddRef(ICLRRuntimeHost *iface)

Definition at line 619 of file corruntimehost.c.

Referenced by RuntimeHost_Construct().

◆ corruntimehost_vtbl

const struct ICorRuntimeHostVtbl corruntimehost_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI corruntimehost_CurrentDomain(ICorRuntimeHost *iface, IUnknown **appDomain)
static ULONG WINAPI corruntimehost_AddRef(ICorRuntimeHost *iface)
static HRESULT WINAPI corruntimehost_CloseEnum(ICorRuntimeHost *iface, HDOMAINENUM hEnum)
static HRESULT WINAPI corruntimehost_DeleteLogicalThreadState(ICorRuntimeHost *iface)
static ULONG WINAPI corruntimehost_Release(ICorRuntimeHost *iface)
static HRESULT WINAPI corruntimehost_Stop(ICorRuntimeHost *iface)
static HRESULT WINAPI corruntimehost_NextDomain(ICorRuntimeHost *iface, HDOMAINENUM hEnum, IUnknown **appDomain)
static HRESULT WINAPI corruntimehost_CreateDomainSetup(ICorRuntimeHost *iface, IUnknown **appDomainSetup)
static HRESULT WINAPI corruntimehost_LocksHeldByLogicalThread(ICorRuntimeHost *iface, DWORD *pCount)
static HRESULT WINAPI corruntimehost_SwitchOutLogicalThreadState(ICorRuntimeHost *iface, DWORD **fiberCookie)
static HRESULT WINAPI corruntimehost_SwitchInLogicalThreadState(ICorRuntimeHost *iface, DWORD *fiberCookie)
static HRESULT WINAPI corruntimehost_MapFile(ICorRuntimeHost *iface, HANDLE hFile, HMODULE *mapAddress)
static HRESULT WINAPI corruntimehost_EnumDomains(ICorRuntimeHost *iface, HDOMAINENUM *hEnum)
static HRESULT WINAPI corruntimehost_GetDefaultDomain(ICorRuntimeHost *iface, IUnknown **pAppDomain)
static HRESULT WINAPI corruntimehost_CreateEvidence(ICorRuntimeHost *iface, IUnknown **evidence)
static HRESULT WINAPI corruntimehost_CreateDomain(ICorRuntimeHost *iface, LPCWSTR friendlyName, IUnknown *identityArray, IUnknown **appDomain)
static HRESULT WINAPI corruntimehost_CreateLogicalThreadState(ICorRuntimeHost *iface)
static HRESULT WINAPI corruntimehost_GetConfiguration(ICorRuntimeHost *iface, ICorConfiguration **pConfiguration)
static HRESULT WINAPI corruntimehost_CreateDomainEx(ICorRuntimeHost *iface, LPCWSTR friendlyName, IUnknown *setup, IUnknown *evidence, IUnknown **appDomain)
static HRESULT WINAPI corruntimehost_Start(ICorRuntimeHost *iface)
static HRESULT WINAPI corruntimehost_UnloadDomain(ICorRuntimeHost *iface, IUnknown *appDomain)
static HRESULT WINAPI corruntimehost_QueryInterface(ICorRuntimeHost *iface, REFIID riid, void **ppvObject)

Definition at line 414 of file corruntimehost.c.

Referenced by RuntimeHost_Construct().

◆ dll_fixup_heap

HANDLE dll_fixup_heap
static

Definition at line 34 of file corruntimehost.c.

Referenced by FixupVTableEntry(), runtimehost_init(), and runtimehost_uninit().

◆ dll_fixups

struct list dll_fixups
static

Definition at line 36 of file corruntimehost.c.

Referenced by FixupVTableEntry(), runtimehost_init(), and runtimehost_uninit().

◆ thunk_template

const struct vtable_fixup_thunk thunk_template = {0}
static

Definition at line 850 of file corruntimehost.c.

Referenced by FixupVTableEntry().