| 62 | |
| 63 | |
| 64 | mscorlib::_AppDomain* getAppDomain(ICorRuntimeHost* icrh, const wchar_t* appDomainName){ |
| 65 | |
| 66 | BOF_LOCAL(msvcrt, wcscmp); |
| 67 | BOF_LOCAL(OLE32, CLSIDFromString); |
| 68 | |
| 69 | GUID CLSID_AppDomain; |
| 70 | HRESULT hr; |
| 71 | HDOMAINENUM hDomainEnum; |
| 72 | IUnknown* iu = nullptr; |
| 73 | mscorlib::_AppDomain* appDomain = nullptr; |
| 74 | bool found = false; |
| 75 | |
| 76 | CLSIDFromString(L"{05F696DC-2B29-3663-AD8B-C4389CF2A713}", &CLSID_AppDomain); |
| 77 | |
| 78 | hr = icrh->EnumDomains(&hDomainEnum); |
| 79 | |
| 80 | while( (hr = icrh->NextDomain(hDomainEnum, &iu)) == S_OK){ |
| 81 | BSTR friendlyName; |
| 82 | hr = iu->QueryInterface(CLSID_AppDomain, (LPVOID*)&appDomain); |
| 83 | hr = appDomain->get_FriendlyName(&friendlyName); |
| 84 | |
| 85 | if(friendlyName && wcscmp(friendlyName, appDomainName) == 0){ |
| 86 | found = true; |
| 87 | iu->Release(); |
| 88 | break; |
| 89 | } |
| 90 | iu->Release(); |
| 91 | } |
| 92 | |
| 93 | iu = nullptr; |
| 94 | hr = icrh->CloseEnum(hDomainEnum); |
| 95 | |
| 96 | if(!found){ |
| 97 | appDomain = initAppDomain(icrh, appDomainName); |
| 98 | } |
| 99 | |
| 100 | return appDomain; |
| 101 | } |
| 102 | |
| 103 | SAFEARRAY* createVariantSafeArray(int numArgs, va_list argp){ |
| 104 |
no test coverage detected