| 34 | __attribute__((section(".data"))) ICorRuntimeHost* icrh = nullptr; |
| 35 | |
| 36 | mscorlib::_AppDomain* initAppDomain(ICorRuntimeHost* icrh, const wchar_t* appDomainName){ |
| 37 | |
| 38 | BOF_LOCAL(OLE32, CLSIDFromString); |
| 39 | |
| 40 | GUID CLSID_AppDomain; |
| 41 | HRESULT hr; |
| 42 | IUnknown* iu = nullptr; |
| 43 | mscorlib::_AppDomain* appDomain = nullptr; |
| 44 | CLSIDFromString(L"{05F696DC-2B29-3663-AD8B-C4389CF2A713}", &CLSID_AppDomain); |
| 45 | |
| 46 | hr = icrh->CreateDomain(appDomainName, nullptr, &iu); |
| 47 | |
| 48 | if(iu == nullptr){ |
| 49 | log("[!] Failed to create AppDomain: 0x%x", hr); |
| 50 | return nullptr; |
| 51 | } |
| 52 | |
| 53 | hr = iu->QueryInterface(CLSID_AppDomain, (LPVOID*)&appDomain); |
| 54 | |
| 55 | if(appDomain == nullptr){ |
| 56 | log("[!] Failed to query AppDomain interface: 0x%x", hr); |
| 57 | } |
| 58 | iu->Release(); |
| 59 | |
| 60 | return appDomain; |
| 61 | } |
| 62 | |
| 63 | |
| 64 | mscorlib::_AppDomain* getAppDomain(ICorRuntimeHost* icrh, const wchar_t* appDomainName){ |