| 427 | } |
| 428 | |
| 429 | APLRes CPlugin::AskPluginLoad() |
| 430 | { |
| 431 | assert(m_status == Plugin_Created); |
| 432 | m_status = Plugin_Loaded; |
| 433 | |
| 434 | bool haveNewAPL = true; |
| 435 | IPluginFunction *pFunction = m_pRuntime->GetFunctionByName("AskPluginLoad2"); |
| 436 | if (!pFunction) { |
| 437 | pFunction = m_pRuntime->GetFunctionByName("AskPluginLoad"); |
| 438 | if (!pFunction) |
| 439 | return APLRes_Success; |
| 440 | haveNewAPL = false; |
| 441 | } |
| 442 | |
| 443 | int err; |
| 444 | cell_t result; |
| 445 | pFunction->PushCell(m_handle); |
| 446 | pFunction->PushCell(g_PluginSys.IsLateLoadTime() ? 1 : 0); |
| 447 | pFunction->PushStringEx(m_errormsg, sizeof(m_errormsg), 0, SM_PARAM_COPYBACK); |
| 448 | pFunction->PushCell(sizeof(m_errormsg)); |
| 449 | if ((err = pFunction->Execute(&result)) != SP_ERROR_NONE) { |
| 450 | EvictWithError(Plugin_Failed, "unexpected error %d in AskPluginLoad callback", err); |
| 451 | return APLRes_Failure; |
| 452 | } |
| 453 | |
| 454 | APLRes res = haveNewAPL |
| 455 | ? (APLRes)result |
| 456 | : (result ? APLRes_Success : APLRes_Failure); |
| 457 | if (res != APLRes_Success) { |
| 458 | m_status = Plugin_Failed; |
| 459 | if (res == APLRes_SilentFailure) |
| 460 | m_SilentFailure = true; |
| 461 | } |
| 462 | return res; |
| 463 | } |
| 464 | |
| 465 | void CPlugin::Call_OnLibraryAdded(const char *lib) |
| 466 | { |
no test coverage detected