| 304 | } |
| 305 | |
| 306 | mscorlib::_AppDomain* initialiseChildBOFNETAppDomain(const wchar_t* appDomainName, const char* assemblyData, int len){ |
| 307 | |
| 308 | BOF_LOCAL(OleAut32, SysAllocString); |
| 309 | BOF_LOCAL(OleAut32, SafeArrayCreate); |
| 310 | BOF_LOCAL(OleAut32, SafeArrayDestroy); |
| 311 | |
| 312 | mscorlib::_AppDomain* appDomain = getAppDomain(icrh, appDomainName); |
| 313 | mscorlib::_Type* bofnetInitalizerType; |
| 314 | HRESULT hr = S_FALSE; |
| 315 | |
| 316 | if(appDomain != nullptr){ |
| 317 | mscorlib::_Assembly* assembly = loadAssembly(appDomain, assemblyData, len); |
| 318 | if(assembly != nullptr){ |
| 319 | |
| 320 | hr = assembly->GetType_2(SysAllocString(L"BOFNET.Runtime"), &bofnetInitalizerType); |
| 321 | |
| 322 | if(bofnetInitalizerType == nullptr){ |
| 323 | log("Failed to get BOFNET.Runtime type: 0x%x\n", hr); |
| 324 | return nullptr; |
| 325 | } |
| 326 | |
| 327 | VARIANT vBeaconApis = setupBeaconApiPtrs(); |
| 328 | VARIANT vBofName = createVariantString("BOFNET.Bofs.Initializer"); |
| 329 | VARIANT rawData; |
| 330 | SAFEARRAYBOUND sab; |
| 331 | |
| 332 | sab.lLbound = 0; |
| 333 | sab.cElements = len; |
| 334 | rawData.vt = VT_ARRAY | VT_UI1; |
| 335 | rawData.parray = SafeArrayCreate(VT_UI1, 1, &sab); |
| 336 | memcpy(rawData.parray->pvData, assemblyData, sab.cElements); |
| 337 | |
| 338 | invokeStaticMethod(bofnetInitalizerType, SysAllocString(L"InvokeBof"), 3, &vBeaconApis, &vBofName, &rawData); |
| 339 | |
| 340 | SafeArrayDestroy(rawData.parray); |
| 341 | return appDomain; |
| 342 | |
| 343 | }else{ |
| 344 | appDomain->Release(); |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | return nullptr; |
| 349 | } |
| 350 | |
| 351 | |
| 352 | extern "C" void go(char* args , int len) { |
nothing calls this directly
no test coverage detected