ReactOS 0.4.16-dev-2332-g4cba65d
corruntimehost.c
Go to the documentation of this file.
1/*
2 *
3 * Copyright 2008 Alistair Leslie-Hughes
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#define COBJMACROS
21
22#include <assert.h>
23#include <stdarg.h>
24
25#include "windef.h"
26#include "winbase.h"
27#include "winuser.h"
28#include "winnls.h"
29#include "winreg.h"
30#include "ole2.h"
31#include "shellapi.h"
32#include "shlwapi.h"
33
34#include "cor.h"
35#include "mscoree.h"
36#include "metahost.h"
37#include "corhdr.h"
38#include "cordebug.h"
39#include "wine/list.h"
40#include "mscoree_private.h"
41
42#include "wine/debug.h"
43
45
46#include "initguid.h"
47
48DEFINE_GUID(IID__AppDomain, 0x05f696dc,0x2b29,0x3663,0xad,0x8b,0xc4,0x38,0x9c,0xf2,0xa7,0x13);
49
51{
52 struct list entry;
54};
55
56static HANDLE dll_fixup_heap; /* using a separate heap so we can have execute permission */
57
60{
61 0, 0, &fixup_list_cs,
64 0, 0, { (DWORD_PTR)(__FILE__ ": fixup_list_cs") }
65};
66static CRITICAL_SECTION fixup_list_cs = { &fixup_list_cs_debug, -1, 0, 0, 0, 0 };
67
68static struct list dll_fixups;
69
71
73{
74 struct list entry;
77 void *thunk_code; /* pointer into dll_fixup_heap */
79 void *vtable;
80 void *tokens; /* pointer into process heap */
81};
82
84{
85 ULONG size;
88 GUID clsid;
89 GUID alias;
91 GUID tlbid;
103};
104
106{
116};
117
119{
120 MonoDomain *prev_domain = mono_domain_get();
121
122 if (prev_domain == domain)
123 /* Do not set or restore domain. */
124 return NULL;
125
127
128 return prev_domain;
129}
130
131static void domain_restore(MonoDomain *prev_domain)
132{
133 if (prev_domain != NULL)
134 mono_domain_set(prev_domain, FALSE);
135}
136
138{
139 WCHAR exe_config[MAX_PATH];
141 char *base_dirA, *config_pathA, *slash;
143 static BOOL configured_domain;
144
146
148
149 if (configured_domain) goto end;
150
151 if (!config_path)
152 {
153 GetModuleFileNameW(NULL, exe_config, MAX_PATH);
154 lstrcatW(exe_config, L".config");
155
156 config_path = exe_config;
157 }
158
159 config_pathA = WtoA(config_path);
160 if (!config_pathA)
161 {
163 goto end;
164 }
165
167 base_dirA = WtoA(base_dir);
168 if (!base_dirA)
169 {
170 free(config_pathA);
172 goto end;
173 }
174
175 slash = strrchr(base_dirA, '\\');
176 if (slash)
177 *(slash + 1) = 0;
178
179 TRACE("setting base_dir: %s, config_path: %s\n", base_dirA, config_pathA);
180 mono_domain_set_config(*result, base_dirA, config_pathA);
181
182 free(config_pathA);
183 free(base_dirA);
184
185end:
186
187 configured_domain = TRUE;
188
190
191 return res;
192}
193
194static BOOL RuntimeHost_GetMethod(MonoDomain *domain, const char *assemblyname,
195 const char *namespace, const char *typename, const char *methodname, int arg_count,
197{
200 MonoClass *klass;
201
202 if (!assemblyname)
203 {
205 }
206 else
207 {
209 assembly = mono_assembly_open(assemblyname, &status);
210 if (!assembly)
211 {
212 ERR("Cannot load assembly %s, status=%i\n", assemblyname, status);
213 return FALSE;
214 }
215
217 if (!image)
218 {
219 ERR("Couldn't get assembly image for %s\n", assemblyname);
220 return FALSE;
221 }
222 }
223
224 klass = mono_class_from_name(image, namespace, typename);
225 if (!klass)
226 {
227 ERR("Couldn't get class %s.%s from image\n", namespace, typename);
228 return FALSE;
229 }
230
231 *method = mono_class_get_method_from_name(klass, methodname, arg_count);
232 if (!*method)
233 {
234 ERR("Couldn't get method %s from class %s.%s\n", methodname, namespace, typename);
235 return FALSE;
236 }
237
238 return TRUE;
239}
240
242 const char *assemblyname, const char *namespace, const char *typename, const char *methodname,
243 MonoObject *obj, void **args, int arg_count, MonoObject **result);
244
246 const char *methodname, MonoMethod *method, MonoObject *obj, void **args, MonoObject **result)
247{
248 MonoObject *exc;
249 static const char *get_hresult = "get_HResult";
250
252 if (exc)
253 {
254 HRESULT hr;
255 MonoObject *hr_object;
256
257 if (methodname != get_hresult)
258 {
259 /* Map the exception to an HRESULT. */
260 hr = RuntimeHost_Invoke(This, domain, NULL, "System", "Exception", get_hresult,
261 exc, NULL, 0, &hr_object);
262 if (SUCCEEDED(hr))
263 hr = *(HRESULT*)mono_object_unbox(hr_object);
264 if (SUCCEEDED(hr))
265 hr = E_FAIL;
266 }
267 else
268 hr = E_FAIL;
269 *result = NULL;
270 return hr;
271 }
272
273 return S_OK;
274}
275
277 const char *assemblyname, const char *namespace, const char *typename, const char *methodname,
278 MonoObject *obj, void **args, int arg_count, MonoObject **result)
279{
281 MonoDomain *prev_domain;
282 HRESULT hr;
283
284 *result = NULL;
285
286 prev_domain = domain_attach(domain);
287
288 if (!RuntimeHost_GetMethod(domain, assemblyname, namespace, typename, methodname,
289 arg_count, &method))
290 {
291 domain_restore(prev_domain);
292 return E_FAIL;
293 }
294
296 if (FAILED(hr))
297 {
298 ERR("Method %s.%s:%s raised an exception, hr=%lx\n", namespace, typename, methodname, hr);
299 }
300
301 domain_restore(prev_domain);
302
303 return hr;
304}
305
307 const char *assemblyname, const char *namespace, const char *typename, const char *methodname,
308 MonoObject *obj, void **args, int arg_count, MonoObject **result)
309{
311 MonoDomain *prev_domain;
312 HRESULT hr;
313
314 *result = NULL;
315
316 if (!obj)
317 {
318 ERR("\"this\" object cannot be null\n");
319 return E_POINTER;
320 }
321
322 prev_domain = domain_attach(domain);
323
324 if (!RuntimeHost_GetMethod(domain, assemblyname, namespace, typename, methodname,
325 arg_count, &method))
326 {
327 domain_restore(prev_domain);
328 return E_FAIL;
329 }
330
332 if (!method)
333 {
334 ERR("Object %p does not support method %s.%s:%s\n", obj, namespace, typename, methodname);
335 domain_restore(prev_domain);
336 return E_FAIL;
337 }
338
340 if (FAILED(hr))
341 {
342 ERR("Method %s.%s:%s raised an exception, hr=%lx\n", namespace, typename, methodname, hr);
343 }
344
345 domain_restore(prev_domain);
346
347 return hr;
348}
349
351 IUnknown *unk, MonoObject **obj)
352{
353 HRESULT hr;
354 void *args[1];
356
357 args[0] = &unk;
358 hr = RuntimeHost_Invoke(This, domain, NULL, "System.Runtime.InteropServices", "Marshal", "GetObjectForIUnknown",
359 NULL, args, 1, &result);
360
361 if (SUCCEEDED(hr))
362 {
363 *obj = result;
364 }
365 return hr;
366}
367
369 IUnknown *evidence, MonoDomain **result)
370{
371 HRESULT res;
372 char *nameA;
374 void *args[3];
375 MonoObject *new_domain, *id;
376
378 if (FAILED(res))
379 {
380 return res;
381 }
382
383 nameA = WtoA(name);
384 if (!nameA)
385 {
386 return E_OUTOFMEMORY;
387 }
388
389 args[0] = mono_string_new(domain, nameA);
390 free(nameA);
391
392 if (!args[0])
393 {
394 return E_OUTOFMEMORY;
395 }
396
397 if (evidence)
398 {
400 if (FAILED(res))
401 {
402 return res;
403 }
404 }
405 else
406 {
407 args[1] = NULL;
408 }
409
410 if (setup)
411 {
413 if (FAILED(res))
414 {
415 return res;
416 }
417 }
418 else
419 {
420 args[2] = NULL;
421 }
422
423 res = RuntimeHost_Invoke(This, domain, NULL, "System", "AppDomain", "CreateDomain",
424 NULL, args, 3, &new_domain);
425
426 if (FAILED(res))
427 {
428 return res;
429 }
430
431 /* new_domain is not the AppDomain itself, but a transparent proxy.
432 * So, we'll retrieve its ID, and use that to get the real domain object.
433 * We can't do a regular invoke, because that will bypass the proxy.
434 * Instead, do a vcall.
435 */
436
437 res = RuntimeHost_VirtualInvoke(This, domain, NULL, "System", "AppDomain", "get_Id",
438 new_domain, NULL, 0, &id);
439
440 if (FAILED(res))
441 {
442 return res;
443 }
444
445 TRACE("returning domain id %d\n", *(int *)mono_object_unbox(id));
446
448
449 return S_OK;
450}
451
453{
454 HRESULT hr;
455 MonoObject *appdomain_object;
456 IUnknown *unk;
457
458 hr = RuntimeHost_Invoke(This, domain, NULL, "System", "AppDomain", "get_CurrentDomain",
459 NULL, NULL, 0, &appdomain_object);
460
461 if (SUCCEEDED(hr))
462 hr = RuntimeHost_GetIUnknownForObject(This, appdomain_object, &unk);
463
464 if (SUCCEEDED(hr))
465 {
466 hr = IUnknown_QueryInterface(unk, &IID__AppDomain, (void**)punk);
467
468 IUnknown_Release(unk);
469 }
470
471 return hr;
472}
473
475{
476 HRESULT hr;
477 void *args[2];
480
482 if (FAILED(hr))
483 {
484 ERR("Cannot get domain, hr=%lx\n", hr);
485 return;
486 }
487
488 args[0] = &exitcode;
489 args[1] = NULL;
490 RuntimeHost_Invoke(This, domain, NULL, "System", "Environment", "Exit",
491 NULL, args, 1, &dummy);
492
493 ERR("Process should have exited\n");
494}
495
497{
498 return CONTAINING_RECORD(iface, RuntimeHost, ICLRRuntimeHost_iface);
499}
500
502{
503 return CONTAINING_RECORD(iface, RuntimeHost, ICorRuntimeHost_iface);
504}
505
506/*** IUnknown methods ***/
508 REFIID riid,
509 void **ppvObject)
510{
512 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
513
514 if ( IsEqualGUID( riid, &IID_ICorRuntimeHost ) ||
516 {
517 *ppvObject = iface;
518 }
519 else
520 {
521 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
522 return E_NOINTERFACE;
523 }
524
525 ICorRuntimeHost_AddRef( iface );
526
527 return S_OK;
528}
529
531{
533
534 return InterlockedIncrement( &This->ref );
535}
536
538{
540 ULONG ref;
541
542 ref = InterlockedDecrement( &This->ref );
543
544 return ref;
545}
546
547/*** ICorRuntimeHost methods ***/
549 ICorRuntimeHost* iface)
550{
551 FIXME("stub %p\n", iface);
552 return E_NOTIMPL;
553}
554
556 ICorRuntimeHost* iface)
557{
558 FIXME("stub %p\n", iface);
559 return E_NOTIMPL;
560}
561
563 ICorRuntimeHost* iface,
564 DWORD *fiberCookie)
565{
566 FIXME("stub %p\n", iface);
567 return E_NOTIMPL;
568}
569
571 ICorRuntimeHost* iface,
572 DWORD **fiberCookie)
573{
574 FIXME("stub %p\n", iface);
575 return E_NOTIMPL;
576}
577
579 ICorRuntimeHost* iface,
580 DWORD *pCount)
581{
582 FIXME("stub %p\n", iface);
583 return E_NOTIMPL;
584}
585
587 ICorRuntimeHost* iface,
589 HMODULE *mapAddress)
590{
591 FIXME("stub %p\n", iface);
592 return E_NOTIMPL;
593}
594
596 ICorRuntimeHost* iface,
598{
599 FIXME("stub %p\n", iface);
600 return E_NOTIMPL;
601}
602
604 ICorRuntimeHost* iface)
605{
608
609 TRACE("%p\n", This);
610
612}
613
615 ICorRuntimeHost* iface)
616{
617 FIXME("stub %p\n", iface);
618 return E_NOTIMPL;
619}
620
622 ICorRuntimeHost* iface,
623 LPCWSTR friendlyName,
624 IUnknown *identityArray,
625 IUnknown **appDomain)
626{
627 return ICorRuntimeHost_CreateDomainEx(iface, friendlyName, NULL, NULL, appDomain);
628}
629
631 ICorRuntimeHost* iface,
632 IUnknown **pAppDomain)
633{
635 HRESULT hr;
637
638 TRACE("(%p)\n", iface);
639
641
642 if (SUCCEEDED(hr))
643 {
645 }
646
647 return hr;
648}
649
651 ICorRuntimeHost* iface,
652 HDOMAINENUM *hEnum)
653{
654 FIXME("stub %p\n", iface);
655 return E_NOTIMPL;
656}
657
659 ICorRuntimeHost* iface,
660 HDOMAINENUM hEnum,
661 IUnknown **appDomain)
662{
663 FIXME("stub %p\n", iface);
664 return E_NOTIMPL;
665}
666
668 ICorRuntimeHost* iface,
669 HDOMAINENUM hEnum)
670{
671 FIXME("stub %p\n", iface);
672 return E_NOTIMPL;
673}
674
676 ICorRuntimeHost* iface,
677 LPCWSTR friendlyName,
679 IUnknown *evidence,
680 IUnknown **appDomain)
681{
683 HRESULT hr;
685
686 if (!friendlyName || !appDomain)
687 {
688 return E_POINTER;
689 }
690 if (!is_mono_started)
691 {
692 return E_FAIL;
693 }
694
695 TRACE("(%p)\n", iface);
696
697 hr = RuntimeHost_AddDomain(This, friendlyName, setup, evidence, &domain);
698
699 if (SUCCEEDED(hr))
700 {
702 }
703
704 return hr;
705}
706
708 ICorRuntimeHost* iface,
709 IUnknown **appDomainSetup)
710{
712 HRESULT hr;
715 static const WCHAR classnameW[] = {'S','y','s','t','e','m','.','A','p','p','D','o','m','a','i','n','S','e','t','u','p',',','m','s','c','o','r','l','i','b',0};
716
717 TRACE("(%p)\n", iface);
718
720
721 if (SUCCEEDED(hr))
723
724 if (SUCCEEDED(hr))
725 hr = RuntimeHost_GetIUnknownForObject(This, obj, appDomainSetup);
726
727 return hr;
728}
729
731 ICorRuntimeHost* iface,
732 IUnknown **evidence)
733{
734 FIXME("stub %p\n", iface);
735 return E_NOTIMPL;
736}
737
739 ICorRuntimeHost* iface,
740 IUnknown *appDomain)
741{
742 FIXME("stub %p\n", iface);
743 return E_NOTIMPL;
744}
745
747 ICorRuntimeHost* iface,
748 IUnknown **appDomain)
749{
750 FIXME("stub %p\n", iface);
751 return E_NOTIMPL;
752}
753
754static const struct ICorRuntimeHostVtbl corruntimehost_vtbl =
755{
778};
779
781 REFIID riid,
782 void **ppvObject)
783{
785 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
786
787 if ( IsEqualGUID( riid, &IID_ICLRRuntimeHost ) ||
789 {
790 *ppvObject = iface;
791 }
792 else
793 {
794 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
795 return E_NOINTERFACE;
796 }
797
798 ICLRRuntimeHost_AddRef( iface );
799
800 return S_OK;
801}
802
804{
806 return ICorRuntimeHost_AddRef(&This->ICorRuntimeHost_iface);
807}
808
810{
812 return ICorRuntimeHost_Release(&This->ICorRuntimeHost_iface);
813}
814
816{
819
820 TRACE("%p\n", This);
821
823}
824
826{
827 FIXME("(%p)\n", iface);
828 return E_NOTIMPL;
829}
830
832 IHostControl *pHostControl)
833{
834 FIXME("(%p,%p)\n", iface, pHostControl);
835 return E_NOTIMPL;
836}
837
839 ICLRControl **pCLRControl)
840{
841 FIXME("(%p,%p)\n", iface, pCLRControl);
842 return E_NOTIMPL;
843}
844
846 DWORD dwAppDomainId, BOOL fWaitUntilDone)
847{
848 FIXME("(%p,%lu,%i)\n", iface, dwAppDomainId, fWaitUntilDone);
849 return E_NOTIMPL;
850}
851
854{
855 FIXME("(%p,%lu,%p,%p)\n", iface, dwAppDomainId, pCallback, cookie);
856 return E_NOTIMPL;
857}
858
860 DWORD *pdwAppDomainId)
861{
862 FIXME("(%p,%p)\n", iface, pdwAppDomainId);
863 return E_NOTIMPL;
864}
865
867 LPCWSTR pwzAppFullName, DWORD dwManifestPaths, LPCWSTR *ppwzManifestPaths,
868 DWORD dwActivationData, LPCWSTR *ppwzActivationData, int *pReturnValue)
869{
870 FIXME("(%p,%s,%lu,%lu)\n", iface, debugstr_w(pwzAppFullName), dwManifestPaths, dwActivationData);
871 return E_NOTIMPL;
872}
873
875 LPCWSTR pwzAssemblyPath, LPCWSTR pwzTypeName, LPCWSTR pwzMethodName,
876 LPCWSTR pwzArgument, DWORD *pReturnValue)
877{
879 HRESULT hr;
880 MonoDomain *domain, *prev_domain;
883 char *filenameA = NULL, *classA = NULL, *methodA = NULL;
884 char *argsA = NULL, *ns;
885
886 TRACE("(%p,%s,%s,%s,%s)\n", iface, debugstr_w(pwzAssemblyPath),
887 debugstr_w(pwzTypeName), debugstr_w(pwzMethodName), debugstr_w(pwzArgument));
888
890
891 if (FAILED(hr))
892 return hr;
893
894 prev_domain = domain_attach(domain);
895
896 if (SUCCEEDED(hr))
897 {
898 filenameA = WtoA(pwzAssemblyPath);
899 if (!filenameA) hr = E_OUTOFMEMORY;
900 }
901
902 if (SUCCEEDED(hr))
903 {
904 classA = WtoA(pwzTypeName);
905 if (!classA) hr = E_OUTOFMEMORY;
906 }
907
908 if (SUCCEEDED(hr))
909 {
910 ns = strrchr(classA, '.');
911 if (ns)
912 *ns = '\0';
913 else
915 }
916
917 if (SUCCEEDED(hr))
918 {
919 methodA = WtoA(pwzMethodName);
920 if (!methodA) hr = E_OUTOFMEMORY;
921 }
922
923 /* The .NET function we are calling has the following declaration
924 * public static int functionName(String param)
925 */
926 if (SUCCEEDED(hr))
927 {
928 argsA = WtoA(pwzArgument);
929 if (!argsA) hr = E_OUTOFMEMORY;
930 }
931
932 if (SUCCEEDED(hr))
933 {
934 str = mono_string_new(domain, argsA);
935 if (!str) hr = E_OUTOFMEMORY;
936 }
937
938 if (SUCCEEDED(hr))
939 {
940 hr = RuntimeHost_Invoke(This, domain, filenameA, classA, ns+1, methodA,
941 NULL, (void**)&str, 1, &result);
942 }
943
944 if (SUCCEEDED(hr))
945 *pReturnValue = *(DWORD*)mono_object_unbox(result);
946
947 domain_restore(prev_domain);
948
950 free(classA);
951 free(argsA);
952 free(methodA);
953
954 return hr;
955}
956
957static const struct ICLRRuntimeHostVtbl CLRHostVtbl =
958{
971};
972
973/* Create an instance of a type given its name, by calling its constructor with
974 * no arguments. Note that result MUST be in the stack, or the garbage
975 * collector may free it prematurely. */
978{
980 char *nameA=NULL;
981 MonoType *type;
982 MonoClass *klass;
984 MonoDomain *prev_domain;
985
986 if (!domain)
988
989 if (FAILED(hr))
990 return hr;
991
992 prev_domain = domain_attach(domain);
993
994 if (SUCCEEDED(hr))
995 {
996 nameA = WtoA(name);
997 if (!nameA)
999 }
1000
1001 if (SUCCEEDED(hr))
1002 {
1004 if (!type)
1005 {
1006 ERR("Cannot find type %s\n", debugstr_w(name));
1007 hr = E_FAIL;
1008 }
1009 }
1010
1011 if (SUCCEEDED(hr))
1012 {
1014 if (!klass)
1015 {
1016 ERR("Cannot convert type %s to a class\n", debugstr_w(name));
1017 hr = E_FAIL;
1018 }
1019 }
1020
1021 if (SUCCEEDED(hr))
1022 {
1023 obj = mono_object_new(domain, klass);
1024 if (!obj)
1025 {
1026 ERR("Cannot allocate object of type %s\n", debugstr_w(name));
1027 hr = E_FAIL;
1028 }
1029 }
1030
1031 if (SUCCEEDED(hr))
1032 {
1033 /* FIXME: Detect exceptions from the constructor? */
1034 mono_runtime_object_init(obj);
1035 *result = obj;
1036 }
1037
1038 domain_restore(prev_domain);
1039
1040 free(nameA);
1041
1042 return hr;
1043}
1044
1045/* Get an IUnknown pointer for a Mono object.
1046 *
1047 * This is just a "light" wrapper around
1048 * System.Runtime.InteropServices.Marshal:GetIUnknownForObject
1049 *
1050 * NOTE: The IUnknown* is created with a reference to the object.
1051 * Until they have a reference, objects must be in the stack to prevent the
1052 * garbage collector from freeing them. */
1054 IUnknown **ppUnk)
1055{
1058 HRESULT hr;
1059
1061
1062 hr = RuntimeHost_Invoke(This, domain, NULL, "System.Runtime.InteropServices", "Marshal", "GetIUnknownForObject",
1063 NULL, (void**)&obj, 1, &result);
1064
1065 if (SUCCEEDED(hr))
1066 *ppUnk = *(IUnknown**)mono_object_unbox(result);
1067 else
1068 *ppUnk = NULL;
1069
1070 return hr;
1071}
1072
1073static void get_utf8_args(int *argc, char ***argv)
1074{
1075 WCHAR **argvw;
1076 int size=0, i;
1077 char *current_arg;
1078
1080
1081 for (i=0; i<*argc; i++)
1082 {
1083 size += sizeof(char*);
1084 size += WideCharToMultiByte(CP_UTF8, 0, argvw[i], -1, NULL, 0, NULL, NULL);
1085 }
1086 size += sizeof(char*);
1087
1088 *argv = malloc(size);
1089 current_arg = (char*)(*argv + *argc + 1);
1090
1091 for (i=0; i<*argc; i++)
1092 {
1093 (*argv)[i] = current_arg;
1095 }
1096
1097 (*argv)[*argc] = NULL;
1098
1099 LocalFree(argvw);
1100}
1101
1102#if __i386__
1103
1104# define CAN_FIXUP_VTABLE 1
1105
1106#include "pshpack1.h"
1107
1108struct vtable_fixup_thunk
1109{
1110 /* push %ecx */
1111 BYTE i7;
1112 /* sub $0x4,%esp */
1113 BYTE i1[3];
1114 /* mov fixup,(%esp) */
1115 BYTE i2[3];
1116 struct dll_fixup *fixup;
1117 /* mov function,%eax */
1118 BYTE i3;
1119 void (CDECL *function)(struct dll_fixup *);
1120 /* call *%eax */
1121 BYTE i4[2];
1122 /* pop %eax */
1123 BYTE i5;
1124 /* pop %ecx */
1125 BYTE i8;
1126 /* jmp *vtable_entry */
1127 BYTE i6[2];
1128 void *vtable_entry;
1129};
1130
1131static const struct vtable_fixup_thunk thunk_template = {
1132 0x51,
1133 {0x83,0xec,0x04},
1134 {0xc7,0x04,0x24},
1135 NULL,
1136 0xb8,
1137 NULL,
1138 {0xff,0xd0},
1139 0x58,
1140 0x59,
1141 {0xff,0x25},
1142 NULL
1143};
1144
1145#include "poppack.h"
1146
1147#elif __x86_64__ /* !__i386__ */
1148
1149# define CAN_FIXUP_VTABLE 1
1150
1151#include "pshpack1.h"
1152
1153struct vtable_fixup_thunk
1154{
1155 /* push %rbp;
1156 mov %rsp, %rbp
1157 sub $0x80, %rsp ; 0x8*4 + 0x10*4 + 0x20
1158 */
1159 BYTE i1[11];
1160 /*
1161 mov %rcx, 0x60(%rsp); mov %rdx, 0x68(%rsp); mov %r8, 0x70(%rsp); mov %r9, 0x78(%rsp);
1162 movaps %xmm0,0x20(%rsp); ...; movaps %xmm3,0x50(%esp)
1163 */
1164 BYTE i2[40];
1165 /* mov function,%rax */
1166 BYTE i3[2];
1167 void (CDECL *function)(struct dll_fixup *);
1168 /* mov fixup,%rcx */
1169 BYTE i4[2];
1170 struct dll_fixup *fixup;
1171 /* call *%rax */
1172 BYTE i5[2];
1173 /*
1174 mov 0x60(%rsp),%rcx; mov 0x68(%rsp),%rdx; mov 0x70(%rsp),%r8; mov 0x78(%rsp),%r9;
1175 movaps 0x20(%rsp),xmm0; ...; movaps 0x50(%esp),xmm3
1176 */
1177 BYTE i6[40];
1178 /* mov %rbp, %rsp
1179 pop %rbp
1180 */
1181 BYTE i7[4];
1182 /* mov vtable_entry, %rax */
1183 BYTE i8[2];
1184 void *vtable_entry;
1185 /* mov [%rax],%rax
1186 jmp %rax */
1187 BYTE i9[5];
1188};
1189
1190static const struct vtable_fixup_thunk thunk_template = {
1191 {0x55,0x48,0x89,0xE5, 0x48,0x81,0xEC,0x80,0x00,0x00,0x00},
1192 {0x48,0x89,0x4C,0x24,0x60, 0x48,0x89,0x54,0x24,0x68,
1193 0x4C,0x89,0x44,0x24,0x70, 0x4C,0x89,0x4C,0x24,0x78,
1194 0x0F,0x29,0x44,0x24,0x20, 0x0F,0x29,0x4C,0x24,0x30,
1195 0x0F,0x29,0x54,0x24,0x40, 0x0F,0x29,0x5C,0x24,0x50,
1196 },
1197 {0x48,0xB8},
1198 NULL,
1199 {0x48,0xB9},
1200 NULL,
1201 {0xFF,0xD0},
1202 {0x48,0x8B,0x4C,0x24,0x60, 0x48,0x8B,0x54,0x24,0x68,
1203 0x4C,0x8B,0x44,0x24,0x70, 0x4C,0x8B,0x4C,0x24,0x78,
1204 0x0F,0x28,0x44,0x24,0x20, 0x0F,0x28,0x4C,0x24,0x30,
1205 0x0F,0x28,0x54,0x24,0x40, 0x0F,0x28,0x5C,0x24,0x50,
1206 },
1207 {0x48,0x89,0xEC, 0x5D},
1208 {0x48,0xB8},
1209 NULL,
1210 {0x48,0x8B,0x00,0xFF,0xE0}
1211};
1212
1213#include "poppack.h"
1214
1215#else /* !__i386__ && !__x86_64__ */
1216
1217# define CAN_FIXUP_VTABLE 0
1218
1220{
1222 void (CDECL *function)(struct dll_fixup *fixup);
1224};
1225
1226static const struct vtable_fixup_thunk thunk_template = {0};
1227
1228#endif
1229
1231{
1232 struct dll_fixup *fixup;
1233 DWORD result = 0;
1234 DWORD rva;
1235 int i;
1236
1237 TRACE("%p,%p\n", hinst, ppVTEntry);
1238
1239 rva = (BYTE*)ppVTEntry - (BYTE*)hinst;
1240
1243 {
1244 if (fixup->dll != hinst)
1245 continue;
1246 if (rva < fixup->fixup->rva || (rva - fixup->fixup->rva >= fixup->fixup->count * sizeof(ULONG_PTR)))
1247 continue;
1248 i = (rva - fixup->fixup->rva) / sizeof(ULONG_PTR);
1249 result = ((ULONG_PTR*)fixup->tokens)[i];
1250 break;
1251 }
1253
1254 TRACE("<-- %lx\n", result);
1255 return result;
1256}
1257
1259{
1260 HRESULT hr=S_OK;
1262 ICLRRuntimeInfo *info=NULL;
1264 char *filenameA;
1269
1270 if (fixup->done) return;
1271
1272 /* It's possible we'll have two threads doing this at once. This is
1273 * considered preferable to the potential deadlock if we use a mutex. */
1274
1276
1277 TRACE("%p,%p,%s\n", fixup, fixup->dll, debugstr_w(filename));
1278
1280 if (!filenameA)
1281 hr = E_OUTOFMEMORY;
1282
1283 if (SUCCEEDED(hr))
1285
1286 if (SUCCEEDED(hr))
1288
1289 if (SUCCEEDED(hr))
1291
1292 if (SUCCEEDED(hr))
1293 {
1294 MonoDomain *prev_domain;
1295
1296 prev_domain = domain_attach(domain);
1297
1299
1300 if (assembly)
1301 {
1302 int i;
1303
1304 /* Mono needs an image that belongs to an assembly. */
1306
1307#if __x86_64__
1308 if (fixup->fixup->type & COR_VTABLE_64BIT)
1309#else
1310 if (fixup->fixup->type & COR_VTABLE_32BIT)
1311#endif
1312 {
1313 void **vtable = fixup->vtable;
1314 ULONG_PTR *tokens = fixup->tokens;
1315 for (i=0; i<fixup->fixup->count; i++)
1316 {
1318 image, tokens[i], fixup->fixup->type);
1319 }
1320 }
1321
1322 fixup->done = TRUE;
1323 }
1324
1325 domain_restore(prev_domain);
1326 }
1327
1328 if (info != NULL)
1329 ICLRRuntimeInfo_Release(info);
1330
1331 free(filenameA);
1332
1333 if (!fixup->done)
1334 {
1335 ERR("unable to fixup vtable, hr=%lx, status=%d\n", hr, status);
1336 /* If we returned now, we'd get an infinite loop. */
1337 assert(0);
1338 }
1339}
1340
1341static void FixupVTableEntry(HMODULE hmodule, VTableFixup *vtable_fixup)
1342{
1343 /* We can't actually generate code for the functions without loading mono,
1344 * and loading mono inside DllMain is a terrible idea. So we make thunks
1345 * that call ReallyFixupVTable, which will load the runtime and fill in the
1346 * vtable, then do an indirect jump using the (now filled in) vtable. Note
1347 * that we have to keep the thunks around forever, as one of them may get
1348 * called while we're filling in the table, and we can never be sure all
1349 * threads are clear. */
1350 struct dll_fixup *fixup;
1351
1352 fixup = malloc(sizeof(*fixup));
1353
1354 fixup->dll = hmodule;
1355 fixup->thunk_code = HeapAlloc(dll_fixup_heap, 0, sizeof(struct vtable_fixup_thunk) * vtable_fixup->count);
1356 fixup->fixup = vtable_fixup;
1357 fixup->vtable = (BYTE*)hmodule + vtable_fixup->rva;
1358 fixup->done = FALSE;
1359
1360#if __x86_64__
1361 if (vtable_fixup->type & COR_VTABLE_64BIT)
1362#else
1363 if (vtable_fixup->type & COR_VTABLE_32BIT)
1364#endif
1365 {
1366 void **vtable = fixup->vtable;
1368 int i;
1369 struct vtable_fixup_thunk *thunks = fixup->thunk_code;
1370
1371 tokens = fixup->tokens = malloc(sizeof(*tokens) * vtable_fixup->count);
1372 memcpy(tokens, vtable, sizeof(*tokens) * vtable_fixup->count);
1373 for (i=0; i<vtable_fixup->count; i++)
1374 {
1375 thunks[i] = thunk_template;
1376 thunks[i].fixup = fixup;
1377 thunks[i].function = ReallyFixupVTable;
1378 thunks[i].vtable_entry = &vtable[i];
1379 vtable[i] = &thunks[i];
1380 }
1381 }
1382 else
1383 {
1384 ERR("unsupported vtable fixup flags %x\n", vtable_fixup->type);
1385 HeapFree(dll_fixup_heap, 0, fixup->thunk_code);
1386 free(fixup);
1387 return;
1388 }
1389
1391 list_add_tail(&dll_fixups, &fixup->entry);
1393}
1394
1396{
1397 VTableFixup *vtable_fixups;
1398 ULONG vtable_fixup_count, i;
1399
1400 assembly_get_vtable_fixups(assembly, &vtable_fixups, &vtable_fixup_count);
1401 if (CAN_FIXUP_VTABLE)
1402 for (i=0; i<vtable_fixup_count; i++)
1403 FixupVTableEntry(hmodule, &vtable_fixups[i]);
1404 else if (vtable_fixup_count)
1405 FIXME("cannot fixup vtable; expect a crash\n");
1406}
1407
1409{
1411 HRESULT hr;
1412
1414 if (SUCCEEDED(hr))
1415 {
1418 }
1419 else
1420 ERR("failed to read CLR headers, hr=%lx\n", hr);
1421}
1422
1424{
1425 static const WCHAR dotconfig[] = {'.','c','o','n','f','i','g',0};
1426 static const WCHAR scW[] = {';',0};
1427 int exit_code;
1428 int argc;
1429 char **argv;
1434 WCHAR filename[MAX_PATH], config_file[MAX_PATH], *temp, **priv_path;
1435 SIZE_T config_file_dir_size;
1436 char *filenameA;
1437 ICLRRuntimeInfo *info;
1439 parsed_config_file parsed_config;
1440 HRESULT hr;
1441 int i, number_of_private_paths = 0;
1442
1444
1446
1447 TRACE("%s argc=%i\n", debugstr_w(filename), argc);
1448
1450 if (!filenameA)
1451 {
1452 free(argv);
1453 return -1;
1454 }
1455
1457
1458 wcscpy(config_file, filename);
1459 wcscat(config_file, dotconfig);
1460
1461 hr = parse_config_file(config_file, &parsed_config);
1462 if (SUCCEEDED(hr) && parsed_config.private_path && parsed_config.private_path[0])
1463 {
1464#ifndef __REACTOS__
1465 WCHAR *save;
1466#endif
1467 for(i = 0; parsed_config.private_path[i] != 0; i++)
1468 if (parsed_config.private_path[i] == ';') number_of_private_paths++;
1469 if (parsed_config.private_path[wcslen(parsed_config.private_path) - 1] != ';') number_of_private_paths++;
1470 config_file_dir_size = (wcsrchr(config_file, '\\') - config_file) + 1;
1471 priv_path = malloc((number_of_private_paths + 1) * sizeof(WCHAR *));
1472 /* wcstok ignores trailing semicolons */
1473#ifdef __REACTOS__
1474 temp = wcstok(parsed_config.private_path, scW);
1475#else
1476 temp = wcstok_s(parsed_config.private_path, scW, &save);
1477#endif
1478 for (i = 0; i < number_of_private_paths; i++)
1479 {
1480 priv_path[i] = malloc((config_file_dir_size + wcslen(temp) + 1) * sizeof(WCHAR));
1481 memcpy(priv_path[i], config_file, config_file_dir_size * sizeof(WCHAR));
1482 wcscpy(priv_path[i] + config_file_dir_size, temp);
1483#ifdef __REACTOS__
1484 temp = wcstok(NULL, scW);
1485#else
1486 temp = wcstok_s(NULL, scW, &save);
1487#endif
1488 }
1489 priv_path[number_of_private_paths] = NULL;
1490 if (InterlockedCompareExchangePointer((void **)&private_path, priv_path, NULL))
1491 ERR("private_path was already set\n");
1492 }
1493
1494 free_parsed_config_file(&parsed_config);
1495
1497
1498 if (SUCCEEDED(hr))
1499 {
1501
1502 if (SUCCEEDED(hr))
1503 hr = RuntimeHost_GetDefaultDomain(host, config_file, &domain);
1504
1505 if (SUCCEEDED(hr))
1506 {
1508 filenameA, 1, &status);
1509
1510 if (image)
1512
1513 if (assembly)
1514 {
1515 mono_callspec_set_assembly(assembly);
1516
1517 exit_code = mono_jit_exec(domain, assembly, argc, argv);
1518 }
1519 else
1520 {
1521 ERR("couldn't load %s, status=%d\n", debugstr_w(filename), status);
1522 exit_code = -1;
1523 }
1524 }
1525 else
1526 exit_code = -1;
1527
1528 ICLRRuntimeInfo_Release(info);
1529 }
1530 else
1531 exit_code = -1;
1532
1533 free(argv);
1534
1535 if (domain)
1536 {
1537 mono_thread_manage();
1538 mono_runtime_quit();
1539 }
1540
1542
1543 return exit_code;
1544}
1545
1547{
1549 HRESULT hr;
1550
1551 TRACE("(%p, %ld, %p)\n", hinstDLL, fdwReason, lpvReserved);
1552
1553 hr = assembly_from_hmodule(&assembly, hinstDLL);
1554 if (SUCCEEDED(hr))
1555 {
1556 NativeEntryPointFunc NativeEntryPoint=NULL;
1557
1558 assembly_get_native_entrypoint(assembly, &NativeEntryPoint);
1560 {
1561 if (!NativeEntryPoint)
1562 DisableThreadLibraryCalls(hinstDLL);
1564 }
1566 /* FIXME: clean up the vtables on DLL_PROCESS_DETACH */
1567 if (NativeEntryPoint)
1568 return NativeEntryPoint(hinstDLL, fdwReason, lpvReserved);
1569 }
1570 else
1571 ERR("failed to read CLR headers, hr=%lx\n", hr);
1572
1573 return TRUE;
1574}
1575
1576/* called from DLL_PROCESS_ATTACH */
1578{
1581}
1582
1583/* called from DLL_PROCESS_DETACH */
1585{
1586 struct dll_fixup *fixup, *fixup2;
1587
1590 {
1591 free(fixup->tokens);
1592 free(fixup);
1593 }
1594}
1595
1597{
1599
1600 This = malloc(sizeof *This);
1601 if ( !This )
1602 return E_OUTOFMEMORY;
1603
1604 This->ICorRuntimeHost_iface.lpVtbl = &corruntimehost_vtbl;
1605 This->ICLRRuntimeHost_iface.lpVtbl = &CLRHostVtbl;
1606
1607 This->ref = 1;
1608 This->version = runtime_version;
1610 This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RuntimeHost.lock");
1611
1612 *result = This;
1613
1614 return S_OK;
1615}
1616
1618{
1619 IUnknown *unk;
1620 HRESULT hr;
1621
1622 if (IsEqualGUID(clsid, &CLSID_CorRuntimeHost))
1623 {
1624 unk = (IUnknown*)&This->ICorRuntimeHost_iface;
1625 IUnknown_AddRef(unk);
1626 }
1627 else if (IsEqualGUID(clsid, &CLSID_CLRRuntimeHost))
1628 {
1629 unk = (IUnknown*)&This->ICLRRuntimeHost_iface;
1630 IUnknown_AddRef(unk);
1631 }
1632 else if (IsEqualGUID(clsid, &CLSID_CorMetaDataDispenser) ||
1633 IsEqualGUID(clsid, &CLSID_CorMetaDataDispenserRuntime))
1634 {
1636 if (FAILED(hr))
1637 return hr;
1638 }
1639 else if (IsEqualGUID(clsid, &CLSID_CLRDebuggingLegacy))
1640 {
1641 hr = CorDebug_Create(&This->ICLRRuntimeHost_iface, &unk);
1642 if (FAILED(hr))
1643 return hr;
1644 }
1645 else
1646 unk = NULL;
1647
1648 if (unk)
1649 {
1650 hr = IUnknown_QueryInterface(unk, riid, ppv);
1651
1652 IUnknown_Release(unk);
1653
1654 return hr;
1655 }
1656 else
1657 FIXME("not implemented for class %s\n", debugstr_guid(clsid));
1658
1660}
1661
1663{
1664 ACTCTX_SECTION_KEYED_DATA guid_info = { sizeof(ACTCTX_SECTION_KEYED_DATA) };
1665 ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *assembly_info = NULL;
1666 SIZE_T bytes_assembly_info;
1667 struct comclassredirect_data *redirect_data;
1668 struct clrclass_data *class_data;
1669 void *ptr_name;
1670 const WCHAR *ptr_path_start, *ptr_path_end;
1671 WCHAR path[MAX_PATH] = {0};
1672 WCHAR str_dll[] = {'.','d','l','l',0};
1673 BOOL ret = FALSE;
1674
1675 if (!FindActCtxSectionGuid(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, 0, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, clsid, &guid_info))
1676 {
1679 ERR("Failed to find guid: %ld\n", error);
1680 goto end;
1681 }
1682
1683 QueryActCtxW(0, guid_info.hActCtx, &guid_info.ulAssemblyRosterIndex, AssemblyDetailedInformationInActivationContext, NULL, 0, &bytes_assembly_info);
1684 assembly_info = malloc(bytes_assembly_info);
1685 if (!QueryActCtxW(0, guid_info.hActCtx, &guid_info.ulAssemblyRosterIndex,
1686 AssemblyDetailedInformationInActivationContext, assembly_info, bytes_assembly_info, &bytes_assembly_info))
1687 {
1688 ERR("QueryActCtxW failed: %ld!\n", GetLastError());
1689 goto end;
1690 }
1691
1692 redirect_data = guid_info.lpData;
1693 class_data = (void *)((char *)redirect_data + redirect_data->clrdata_offset);
1694
1695 ptr_name = (char *)class_data + class_data->name_offset;
1696 if (lstrlenW(ptr_name) + 1 > classname_size) /* Include null-terminator */
1697 {
1698 ERR("Buffer is too small\n");
1699 goto end;
1700 }
1701 lstrcpyW(classname, ptr_name);
1702
1703 ptr_path_start = assembly_info->lpAssemblyEncodedAssemblyIdentity;
1704 ptr_path_end = wcschr(ptr_path_start, ',');
1705 memcpy(path, ptr_path_start, (char*)ptr_path_end - (char*)ptr_path_start);
1706
1707 GetModuleFileNameW(NULL, filename, filename_size);
1709
1710 if (lstrlenW(filename) + lstrlenW(path) + ARRAY_SIZE(str_dll) + 1 > filename_size) /* Include blackslash */
1711 {
1712 ERR("Buffer is too small\n");
1713 goto end;
1714 }
1715
1717 lstrcatW(filename, str_dll);
1718
1719 ret = TRUE;
1720
1721end:
1722 free(assembly_info);
1723
1724 if (guid_info.hActCtx)
1725 ReleaseActCtx(guid_info.hActCtx);
1726
1727 return ret;
1728}
1729
1730#define CHARS_IN_GUID 39
1731
1733{
1734 static const WCHAR wszFileSlash[] = L"file:///";
1735 static const WCHAR wszCLSIDSlash[] = L"CLSID\\";
1736 static const WCHAR wszInprocServer32[] = L"\\InprocServer32";
1737 WCHAR path[CHARS_IN_GUID + ARRAY_SIZE(wszCLSIDSlash) + ARRAY_SIZE(wszInprocServer32) - 1];
1740 ICLRRuntimeInfo *info = NULL;
1742 HRESULT hr;
1743 HKEY key, subkey;
1744 LONG res;
1745 int offset = 0;
1747 DWORD numKeys, keyLength;
1748 WCHAR codebase[MAX_PATH + 8];
1749 WCHAR classname[350], subkeyName[256];
1751 DWORD dwBufLen;
1752
1753 lstrcpyW(path, wszCLSIDSlash);
1754 StringFromGUID2(clsid, path + lstrlenW(wszCLSIDSlash), CHARS_IN_GUID);
1755 lstrcatW(path, wszInprocServer32);
1756
1757 TRACE("Registry key: %s\n", debugstr_w(path));
1758
1761 {
1762 res = RegOpenKeyExW( key, L"Server", 0, KEY_READ, &subkey );
1763 if (res == ERROR_SUCCESS)
1764 {
1765 /* Not a managed class, just chain through LoadLibraryShim */
1767 HRESULT (WINAPI *pDllGetClassObject)(REFCLSID,REFIID,LPVOID*);
1768 IClassFactory *classfactory;
1769
1770 dwBufLen = sizeof( filename );
1771 res = RegGetValueW( subkey, NULL, NULL, RRF_RT_REG_SZ, NULL, filename, &dwBufLen );
1772
1773 RegCloseKey( subkey );
1774
1775 if (res != ERROR_SUCCESS)
1776 {
1777 WARN("Can't read default value from Server subkey.\n");
1779 goto cleanup;
1780 }
1781
1782 hr = LoadLibraryShim( filename, L"v4.0.30319", NULL, &module);
1783 if (FAILED(hr))
1784 {
1785 WARN("Can't load %s.\n", debugstr_w(filename));
1786 goto cleanup;
1787 }
1788
1789 pDllGetClassObject = (void*)GetProcAddress( module, "DllGetClassObject" );
1790 if (!pDllGetClassObject)
1791 {
1792 WARN("Can't get DllGetClassObject from %s.\n", debugstr_w(filename));
1794 goto cleanup;
1795 }
1796
1797 hr = pDllGetClassObject( clsid, &IID_IClassFactory, (void**)&classfactory );
1798 if (SUCCEEDED(hr))
1799 {
1800 hr = IClassFactory_CreateInstance( classfactory, NULL, &IID_IUnknown, ppObj );
1801
1802 IClassFactory_Release( classfactory );
1803 }
1804
1805 goto cleanup;
1806 }
1807
1808 dwBufLen = sizeof( classname );
1809 res = RegGetValueW( key, NULL, L"Class", RRF_RT_REG_SZ, NULL, classname, &dwBufLen);
1810 if(res != ERROR_SUCCESS)
1811 {
1812 WARN("Class value cannot be found.\n");
1814 goto cleanup;
1815 }
1816
1817 TRACE("classname (%s)\n", debugstr_w(classname));
1818
1819 dwBufLen = sizeof( codebase );
1820 res = RegGetValueW( key, NULL, L"CodeBase", RRF_RT_REG_SZ, NULL, codebase, &dwBufLen);
1821 if(res == ERROR_SUCCESS)
1822 {
1823 /* Strip file:/// */
1824 if(wcsncmp(codebase, wszFileSlash, lstrlenW(wszFileSlash)) == 0)
1825 offset = lstrlenW(wszFileSlash);
1826
1827 lstrcpyW(filename, codebase + offset);
1828
1830 }
1831
1834 else
1835 {
1836 WCHAR assemblyname[MAX_PATH + 8];
1837
1839 WARN("CodeBase value cannot be found, trying Assembly.\n");
1840 /* get the last subkey of InprocServer32 */
1841 res = RegQueryInfoKeyW(key, 0, 0, 0, &numKeys, 0, 0, 0, 0, 0, 0, 0);
1842 if (res != ERROR_SUCCESS)
1843 goto cleanup;
1844 if (numKeys > 0)
1845 {
1846 numKeys--;
1847 keyLength = ARRAY_SIZE(subkeyName);
1848 res = RegEnumKeyExW(key, numKeys, subkeyName, &keyLength, 0, 0, 0, 0);
1849 if (res != ERROR_SUCCESS)
1850 goto cleanup;
1851 res = RegOpenKeyExW(key, subkeyName, 0, KEY_READ, &subkey);
1852 if (res != ERROR_SUCCESS)
1853 goto cleanup;
1854 dwBufLen = sizeof( assemblyname );
1855 res = RegGetValueW(subkey, NULL, L"Assembly", RRF_RT_REG_SZ, NULL, assemblyname, &dwBufLen);
1856 RegCloseKey(subkey);
1857 if (res != ERROR_SUCCESS)
1858 goto cleanup;
1859 }
1860 else
1861 {
1862 dwBufLen = sizeof( assemblyname );
1863 res = RegGetValueW(key, NULL, L"Assembly", RRF_RT_REG_SZ, NULL, assemblyname, &dwBufLen);
1864 if (res != ERROR_SUCCESS)
1865 goto cleanup;
1866 }
1867
1868 hr = get_file_from_strongname(assemblyname, filename, MAX_PATH);
1869 if (FAILED(hr))
1870 {
1871 /*
1872 * The registry doesn't have a CodeBase entry or the file isn't there, and it's not in the GAC.
1873 *
1874 * Use the Assembly Key to retrieve the filename.
1875 * Assembly : REG_SZ : AssemblyName, Version=X.X.X.X, Culture=neutral, PublicKeyToken=null
1876 */
1877 WCHAR *ns;
1878
1879 WARN("Attempt to load from the application directory.\n");
1881 ns = wcsrchr(filename, '\\');
1882 *(ns+1) = '\0';
1883
1884 ns = wcschr(assemblyname, ',');
1885 *(ns) = '\0';
1886 lstrcatW(filename, assemblyname);
1887 *(ns) = '.';
1888 lstrcatW(filename, L".dll");
1889 }
1890 }
1891 }
1892 else
1893 {
1896
1897 TRACE("classname (%s)\n", debugstr_w(classname));
1898 }
1899
1900 TRACE("filename (%s)\n", debugstr_w(filename));
1901
1902 *ppObj = NULL;
1903
1904
1906 if (SUCCEEDED(hr))
1907 {
1909
1910 if (SUCCEEDED(hr))
1912
1913 if (SUCCEEDED(hr))
1914 {
1916 MonoClass *klass;
1918 MonoDomain *prev_domain;
1920 IUnknown *unk = NULL;
1921 char *filenameA, *ns;
1922 char *classA;
1923
1925
1926 prev_domain = domain_attach(domain);
1927
1930 free(filenameA);
1931 if (!assembly)
1932 {
1933 ERR("Cannot open assembly %s, status=%i\n", debugstr_w(filename), status);
1934 domain_restore(prev_domain);
1935 goto cleanup;
1936 }
1937
1939 if (!image)
1940 {
1941 ERR("Couldn't get assembly image\n");
1942 domain_restore(prev_domain);
1943 goto cleanup;
1944 }
1945
1946 classA = WtoA(classname);
1947 ns = strrchr(classA, '.');
1948 *ns = '\0';
1949
1950 klass = mono_class_from_name(image, classA, ns+1);
1951 free(classA);
1952 if (!klass)
1953 {
1954 ERR("Couldn't get class from image\n");
1955 domain_restore(prev_domain);
1956 goto cleanup;
1957 }
1958
1959 /*
1960 * Use the default constructor for the .NET class.
1961 */
1962 result = mono_object_new(domain, klass);
1963 mono_runtime_object_init(result);
1964
1966 if (SUCCEEDED(hr))
1967 {
1968 hr = IUnknown_QueryInterface(unk, &IID_IUnknown, ppObj);
1969
1970 IUnknown_Release(unk);
1971 }
1972 else
1974
1975 domain_restore(prev_domain);
1976 }
1977 else
1979 }
1980 else
1982
1983cleanup:
1984 if(info)
1985 ICLRRuntimeInfo_Release(info);
1986
1988
1989 return hr;
1990}
static DWORD const fdwReason
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static void list_init(struct list_entry *head)
Definition: list.h:51
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define RegCloseKey(hKey)
Definition: registry.h:49
Definition: list.h:37
LPCConfig pConfiguration
Definition: config.cpp:18
HRESULT CorDebug_Create(ICLRRuntimeHost *runtimehost, IUnknown **ppUnk)
Definition: cordebug.c:763
static RuntimeHost * impl_from_ICorRuntimeHost(ICorRuntimeHost *iface)
static ULONG WINAPI corruntimehost_AddRef(ICorRuntimeHost *iface)
static HRESULT WINAPI CLRRuntimeHost_ExecuteInAppDomain(ICLRRuntimeHost *iface, DWORD dwAppDomainId, FExecuteInAppDomainCallback pCallback, void *cookie)
static HRESULT RuntimeHost_GetObjectForIUnknown(RuntimeHost *This, MonoDomain *domain, IUnknown *unk, MonoObject **obj)
static MonoDomain * domain_attach(MonoDomain *domain)
static CRITICAL_SECTION fixup_list_cs
#define CAN_FIXUP_VTABLE
static HRESULT WINAPI corruntimehost_Start(ICorRuntimeHost *iface)
void RuntimeHost_ExitProcess(RuntimeHost *This, INT exitcode)
static BOOL try_create_registration_free_com(REFIID clsid, WCHAR *classname, UINT classname_size, WCHAR *filename, UINT filename_size)
static HRESULT WINAPI CLRRuntimeHost_UnloadAppDomain(ICLRRuntimeHost *iface, DWORD dwAppDomainId, BOOL fWaitUntilDone)
static HRESULT WINAPI corruntimehost_SwitchOutLogicalThreadState(ICorRuntimeHost *iface, DWORD **fiberCookie)
static HRESULT WINAPI corruntimehost_QueryInterface(ICorRuntimeHost *iface, REFIID riid, void **ppvObject)
static HRESULT WINAPI corruntimehost_CurrentDomain(ICorRuntimeHost *iface, IUnknown **appDomain)
HRESULT RuntimeHost_GetInterface(RuntimeHost *This, REFCLSID clsid, REFIID riid, void **ppv)
void runtimehost_uninit(void)
HRESULT create_monodata(REFCLSID clsid, LPVOID *ppObj)
static HRESULT WINAPI CLRRuntimeHost_SetHostControl(ICLRRuntimeHost *iface, IHostControl *pHostControl)
static void FixupVTable(HMODULE hmodule)
static CRITICAL_SECTION_DEBUG fixup_list_cs_debug
static BOOL RuntimeHost_GetMethod(MonoDomain *domain, const char *assemblyname, const char *namespace, const char *typename, const char *methodname, int arg_count, MonoMethod **method)
static HANDLE dll_fixup_heap
static HRESULT RuntimeHost_GetIUnknownForDomain(RuntimeHost *This, MonoDomain *domain, IUnknown **punk)
static HRESULT WINAPI CLRRuntimeHost_Start(ICLRRuntimeHost *iface)
static HRESULT WINAPI corruntimehost_GetConfiguration(ICorRuntimeHost *iface, ICorConfiguration **pConfiguration)
static ULONG WINAPI CLRRuntimeHost_Release(ICLRRuntimeHost *iface)
static ULONG WINAPI CLRRuntimeHost_AddRef(ICLRRuntimeHost *iface)
DWORD WINAPI GetTokenForVTableEntry(HINSTANCE hinst, BYTE **ppVTEntry)
static HRESULT WINAPI corruntimehost_UnloadDomain(ICorRuntimeHost *iface, IUnknown *appDomain)
static HRESULT WINAPI CLRRuntimeHost_ExecuteInDefaultAppDomain(ICLRRuntimeHost *iface, LPCWSTR pwzAssemblyPath, LPCWSTR pwzTypeName, LPCWSTR pwzMethodName, LPCWSTR pwzArgument, DWORD *pReturnValue)
static HRESULT WINAPI corruntimehost_CreateLogicalThreadState(ICorRuntimeHost *iface)
static HRESULT WINAPI CLRRuntimeHost_GetCLRControl(ICLRRuntimeHost *iface, ICLRControl **pCLRControl)
static HRESULT WINAPI corruntimehost_GetDefaultDomain(ICorRuntimeHost *iface, IUnknown **pAppDomain)
static HRESULT RuntimeHost_DoInvoke(RuntimeHost *This, MonoDomain *domain, const char *methodname, MonoMethod *method, MonoObject *obj, void **args, MonoObject **result)
void runtimehost_init(void)
static HRESULT WINAPI corruntimehost_Stop(ICorRuntimeHost *iface)
static HRESULT WINAPI corruntimehost_CreateDomainEx(ICorRuntimeHost *iface, LPCWSTR friendlyName, IUnknown *setup, IUnknown *evidence, IUnknown **appDomain)
static HRESULT WINAPI CLRRuntimeHost_GetCurrentAppDomainId(ICLRRuntimeHost *iface, DWORD *pdwAppDomainId)
static HRESULT WINAPI CLRRuntimeHost_QueryInterface(ICLRRuntimeHost *iface, REFIID riid, void **ppvObject)
static const struct ICorRuntimeHostVtbl corruntimehost_vtbl
static HRESULT WINAPI corruntimehost_SwitchInLogicalThreadState(ICorRuntimeHost *iface, DWORD *fiberCookie)
static struct list dll_fixups
static HRESULT WINAPI corruntimehost_EnumDomains(ICorRuntimeHost *iface, HDOMAINENUM *hEnum)
#define CHARS_IN_GUID
static HRESULT WINAPI corruntimehost_CreateDomain(ICorRuntimeHost *iface, LPCWSTR friendlyName, IUnknown *identityArray, IUnknown **appDomain)
static const struct ICLRRuntimeHostVtbl CLRHostVtbl
static HRESULT WINAPI corruntimehost_MapFile(ICorRuntimeHost *iface, HANDLE hFile, HMODULE *mapAddress)
static HRESULT RuntimeHost_AddDomain(RuntimeHost *This, const WCHAR *name, IUnknown *setup, IUnknown *evidence, MonoDomain **result)
HRESULT RuntimeHost_CreateManagedInstance(RuntimeHost *This, LPCWSTR name, MonoDomain *domain, MonoObject **result)
BOOL WINAPI _CorDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
static HRESULT WINAPI corruntimehost_DeleteLogicalThreadState(ICorRuntimeHost *iface)
static HRESULT WINAPI CLRRuntimeHost_Stop(ICLRRuntimeHost *iface)
static HRESULT WINAPI corruntimehost_CloseEnum(ICorRuntimeHost *iface, HDOMAINENUM hEnum)
static ULONG WINAPI corruntimehost_Release(ICorRuntimeHost *iface)
static HRESULT RuntimeHost_VirtualInvoke(RuntimeHost *This, MonoDomain *domain, const char *assemblyname, const char *namespace, const char *typename, const char *methodname, MonoObject *obj, void **args, int arg_count, MonoObject **result)
static HRESULT WINAPI corruntimehost_CreateDomainSetup(ICorRuntimeHost *iface, IUnknown **appDomainSetup)
static HRESULT WINAPI CLRRuntimeHost_ExecuteApplication(ICLRRuntimeHost *iface, LPCWSTR pwzAppFullName, DWORD dwManifestPaths, LPCWSTR *ppwzManifestPaths, DWORD dwActivationData, LPCWSTR *ppwzActivationData, int *pReturnValue)
static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *config_path, MonoDomain **result)
static void get_utf8_args(int *argc, char ***argv)
HRESULT RuntimeHost_Construct(CLRRuntimeInfo *runtime_version, RuntimeHost **result)
HRESULT RuntimeHost_GetIUnknownForObject(RuntimeHost *This, MonoObject *obj, IUnknown **ppUnk)
static void domain_restore(MonoDomain *prev_domain)
static HRESULT WINAPI corruntimehost_NextDomain(ICorRuntimeHost *iface, HDOMAINENUM hEnum, IUnknown **appDomain)
static RuntimeHost * impl_from_ICLRRuntimeHost(ICLRRuntimeHost *iface)
static void CDECL ReallyFixupVTable(struct dll_fixup *fixup)
static HRESULT RuntimeHost_Invoke(RuntimeHost *This, MonoDomain *domain, const char *assemblyname, const char *namespace, const char *typename, const char *methodname, MonoObject *obj, void **args, int arg_count, MonoObject **result)
static const struct vtable_fixup_thunk thunk_template
WCHAR ** private_path
static HRESULT WINAPI corruntimehost_CreateEvidence(ICorRuntimeHost *iface, IUnknown **evidence)
static void FixupVTable_Assembly(HMODULE hmodule, ASSEMBLY *assembly)
__int32 WINAPI _CorExeMain(void)
static HRESULT WINAPI corruntimehost_LocksHeldByLogicalThread(ICorRuntimeHost *iface, DWORD *pCount)
static void FixupVTableEntry(HMODULE hmodule, VTableFixup *vtable_fixup)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3662
INT WINAPI StringFromGUID2(REFGUID guid, LPOLESTR str, INT cmax)
Definition: combase.c:1525
#define CDECL
Definition: compat.h:29
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define wcsrchr
Definition: compat.h:16
#define OPEN_EXISTING
Definition: compat.h:775
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CreateFileW
Definition: compat.h:741
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define lstrlenW
Definition: compat.h:750
static void cleanup(void)
Definition: main.c:1335
VOID WINAPI ReleaseActCtx(IN HANDLE hActCtx)
Definition: actctx.c:208
BOOL WINAPI QueryActCtxW(IN DWORD dwFlags, IN HANDLE hActCtx, IN PVOID pvSubInstance, IN ULONG ulInfoClass, IN PVOID pvBuffer, IN SIZE_T cbBuffer, IN OUT SIZE_T *pcbWrittenOrRequired OPTIONAL)
Definition: actctx.c:328
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1331
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount, IN DWORD flags)
Definition: sync.c:107
BOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, const GUID *lpSearchGuid, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:265
BOOL WINAPI PathRemoveFileSpecW(WCHAR *path)
Definition: path.c:1145
LPWSTR WINAPI GetCommandLineW(void)
Definition: process.c:1338
HRESULT parse_config_file(LPCWSTR filename, parsed_config_file *result)
Definition: config.c:678
void free_parsed_config_file(parsed_config_file *file)
Definition: config.c:696
HRESULT MetaDataDispenser_CreateInstance(IUnknown **ppUnk)
Definition: metadata.c:189
MonoObject *CDECL * mono_object_new(MonoDomain *domain, MonoClass *klass)
HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file, IStream *config_stream, DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result)
Definition: metahost.c:1904
MonoImage *CDECL * mono_image_open_from_module_handle(HMODULE module_handle, char *fname, UINT has_entry_point, MonoImageOpenStatus *status)
MonoImage *CDECL * mono_get_corlib(void)
MonoImage *CDECL * mono_assembly_get_image(MonoAssembly *assembly)
MonoThread *CDECL * mono_thread_attach(MonoDomain *domain)
MonoDomain *CDECL * mono_object_get_domain(MonoObject *obj)
MonoAssembly int argc
Definition: metahost.c:107
MonoObject *CDECL * mono_runtime_invoke(MonoMethod *method, void *obj, void **params, MonoObject **exc)
HRESULT get_file_from_strongname(WCHAR *stringnameW, WCHAR *assemblies_path, int path_length)
Definition: metahost.c:1687
MonoString *CDECL * mono_string_new(MonoDomain *domain, const char *str)
MonoDomain *CDECL * mono_domain_get_by_id(int id)
MonoAssembly *CDECL * mono_assembly_open(const char *filename, MonoImageOpenStatus *status)
MonoDomain *CDECL * mono_domain_get(void)
MonoMethod *CDECL * mono_object_get_virtual_method(MonoObject *obj, MonoMethod *method)
BOOL is_mono_started
Definition: metahost.c:80
MonoAssembly *CDECL * mono_assembly_load_from(MonoImage *image, const char *fname, MonoImageOpenStatus *status)
const char * base_dir
Definition: metahost.c:101
MonoType *CDECL * mono_reflection_type_from_name(char *name, MonoImage *image)
void *CDECL * mono_object_unbox(MonoObject *obj)
MonoClass *CDECL * mono_class_from_mono_type(MonoType *type)
MonoMethod *CDECL * mono_class_get_method_from_name(MonoClass *klass, const char *name, int param_count)
void *CDECL * mono_marshal_get_vtfixup_ftnptr(MonoImage *image, DWORD token, WORD type)
MonoClass *CDECL * mono_class_from_name(MonoImage *image, const char *name_space, const char *name)
HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result)
Definition: metahost.c:703
MonoDomain * get_root_domain(void)
Definition: metahost.c:366
#define assert(_expr)
Definition: assert.h:32
#define __int32
Definition: corecrt.h:66
_ACRTIMP wchar_t *__cdecl wcstok_s(wchar_t *, const wchar_t *, wchar_t **)
Definition: wcs.c:2031
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
_ACRTIMP wchar_t *__cdecl wcstok(wchar_t *, const wchar_t *)
Definition: wcs.c:2065
_ACRTIMP int __cdecl wcsncmp(const wchar_t *, const wchar_t *, size_t)
Definition: wcs.c:518
_ACRTIMP char *__cdecl strrchr(const char *, int)
Definition: string.c:3298
method
Definition: dragdrop.c:54
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT assembly_release(ASSEMBLY *assembly)
Definition: assembly.c:694
FxPnpStateCallbackInfo * pCallback
GLeglImageOES image
Definition: gl.h:2204
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLuint res
Definition: glext.h:9613
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLuint64EXT * result
Definition: glext.h:11304
GLuint id
Definition: glext.h:5910
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
HANDLE WINAPI HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
Definition: heapmem.c:45
BOOL WINAPI HeapDestroy(HANDLE hHeap)
Definition: heapmem.c:85
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define InterlockedCompareExchangePointer
Definition: interlocked.h:144
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
if(dx< 0)
Definition: linetemp.h:194
static IN DWORD IN LPVOID lpvReserved
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static HINSTANCE hinst
Definition: edit.c:551
static UINT exit_code
Definition: process.c:80
static CHAR filenameA[MAX_PATH]
Definition: storage32.c:35
static void * vtable[]
Definition: typelib.c:1231
static BOOL setup(void)
Definition: enum_files.c:97
static HMODULE hmodule
Definition: rasapi.c:29
#define argv
Definition: mplay32.c:18
HRESULT assembly_get_native_entrypoint(ASSEMBLY *assembly, NativeEntryPointFunc *func)
Definition: assembly.c:303
HRESULT assembly_from_hmodule(ASSEMBLY **out, HMODULE hmodule)
Definition: assembly.c:244
HRESULT assembly_get_vtable_fixups(ASSEMBLY *assembly, VTableFixup **fixups, DWORD *count)
Definition: assembly.c:293
HRESULT(__stdcall * FExecuteInAppDomainCallback)([in] void *cookie)
Definition: mscoree.idl:49
char * WtoA(LPCWSTR wstr)
Definition: mscoree_main.c:63
HRESULT WINAPI LoadLibraryShim(LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE *phModDll)
Definition: mscoree_main.c:464
struct _MonoObject MonoObject
BOOL(WINAPI * NativeEntryPointFunc)(HINSTANCE, DWORD, LPVOID)
struct _MonoString MonoString
struct _MonoMethod MonoMethod
struct _MonoAssembly MonoAssembly
struct _MonoImage MonoImage
struct _MonoType MonoType
MonoImageOpenStatus
struct _MonoDomain MonoDomain
struct _MonoClass MonoClass
const CLSID * clsid
Definition: msctf.cpp:50
_In_ HANDLE hFile
Definition: mswsock.h:90
unsigned int UINT
Definition: ndis.h:50
#define HEAP_CREATE_ENABLE_EXECUTE
Definition: rtltypes.h:135
#define KEY_READ
Definition: nt_native.h:1026
#define PathAppendW
Definition: pathcch.h:310
long LONG
Definition: pedump.c:60
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
Definition: guiddef.h:68
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
_In_opt_ IUnknown * punk
Definition: shlwapi.h:158
WCHAR classname[128]
Definition: startup.c:15
const WCHAR * str
static calc_node_t temp
Definition: rpn_ieee.c:38
#define CP_UTF8
Definition: nls.h:20
wcscat
wcscpy
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
Definition: shell32_main.c:79
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
MonoDomain * domain
struct list entry
Definition: match.c:390
DWORD miscstatuscontent
Definition: combase.c:71
DWORD miscstatusdocprint
Definition: combase.c:74
DWORD miscstatusthumbnail
Definition: combase.c:72
Definition: cookie.c:34
void * thunk_code
VTableFixup * fixup
void * vtable
void * tokens
struct list entry
HMODULE dll
Definition: cookie.c:42
Definition: fci.c:127
Definition: txthost.c:37
Definition: copy.c:22
Definition: name.c:39
Definition: mxnamespace.c:38
Definition: send.c:48
Definition: ps.c:97
struct dll_fixup * fixup
void(CDECL *function)(struct dll_fixup *fixup)
#define DWORD_PTR
Definition: treelist.c:76
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
static const var_t * current_arg
Definition: typegen.c:47
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:3479
#define ERROR_SXS_KEY_NOT_FOUND
Definition: winerror.h:3101
#define E_POINTER
Definition: winerror.h:3480
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:3772
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO
Definition: winnt_old.h:1156
@ COR_VTABLE_32BIT
Definition: winnt_old.h:3520
@ COR_VTABLE_64BIT
Definition: winnt_old.h:3521
#define RRF_RT_REG_SZ
Definition: winreg.h:58
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193