/**
 * Handles the osdetect sub-command.
 *
 * @returns Suitable exit code.
 * @param   a                   The handler arguments.
 * @param   pDebugger           Pointer to the debugger interface.
 */
static RTEXITCODE handleDebugVM_OSDetect(HandlerArg *a, IMachineDebugger *pDebugger)
{
    if (a->argc != 2)
        return errorTooManyParameters(&a->argv[1]);

    com::Bstr bstrIgnore;
    com::Bstr bstrAll("all");
    CHECK_ERROR2I_RET(pDebugger, LoadPlugIn(bstrAll.raw(), bstrIgnore.asOutParam()), RTEXITCODE_FAILURE);

    com::Bstr bstrName;
    CHECK_ERROR2I_RET(pDebugger, DetectOS(bstrName.asOutParam()), RTEXITCODE_FAILURE);
    RTPrintf("Detected: %ls\n", bstrName.raw());
    return RTEXITCODE_SUCCESS;
}
CPlugInManager::PlugInHandle CPlugInManager::LoadPlugIn(tint32 iCompanyID, tint32 iProductID, tint32 iChannel, tint32 iInsertIndex)
{
	CAutoLock Lock(gpApplication->GetMeterMutex());
	
	tint32 iIndex = 0;
	std::list<SPlugInInfo*>::const_iterator it = mPlugIns.begin();
	for (; it != mPlugIns.end(); it++, iIndex++) {
		SPlugInInfo* pInfo = *it;
		
		if (pInfo->uiCompanyID == iCompanyID &&
			pInfo->uiProductID == iProductID) {
			return LoadPlugIn(iIndex, iChannel, iInsertIndex);
		}
	}
	
	return mInvalidHandleValue;
}
Beispiel #3
0
bool PlugInManager::LoadAllPlugIns(wxString &plugin_dir)
{
      m_plugin_location = plugin_dir;
      wxDir pi_dir(m_plugin_location);

      wxString msg(_("PlugInManager searching for PlugIns in location "));
      msg += m_plugin_location;
      wxLogMessage(msg);

#ifdef __WXMSW__
      wxString pispec = _T("*_pi.dll");
#else
#ifdef __WXOSX__
      wxString pispec = _T("*_pi.dylib");
#else
      wxString pispec = _T("*_pi.so");
#endif
#endif

      if(pi_dir.IsOpened())
      {
            wxString plugin_file;
            bool b_more =pi_dir.GetFirst(&plugin_file, pispec);
            while(b_more)
            {
                  wxString file_name = m_plugin_location + _T("/") + plugin_file;

                  PlugInContainer *pic = LoadPlugIn(file_name);
                  if(pic)
                  {
    //    Verify the PlugIn API Version

                        int api_major = pic->m_pplugin->GetAPIVersionMajor();
                        int api_minor = pic->m_pplugin->GetAPIVersionMinor();
                        int ver = (api_major * 100) + api_minor;
                        bool bver_ok = false;
                        switch(ver)
                        {
                              // TODO add more valid API versions to last case as necessary
                              case 102:
                              case 103:
                              case 104:
                                    break;      // incompatible

                              case 105:   // New PlugIn class definition in Version 2.4 Beta,
                                    bver_ok = true;
                                    break;
                              default:
                                    break;
                        }

                        if(bver_ok)
                        {
                              plugin_array.Add(pic);

                              pic->m_api_version = ver;                 // record the PlugIn's API version

                              //    The common name is available without initialization and startup of the PlugIn
                              pic->m_common_name = pic->m_pplugin->GetCommonName();

                              //    Check the config file to see if this PlugIn is user-enabled
                              wxString config_section = ( _T ( "/PlugIns/" ) );
                              config_section += pic->m_common_name;
                              pConfig->SetPath ( config_section );
                              pConfig->Read ( _T ( "bEnabled" ), &pic->m_bEnabled );

                              if(pic->m_bEnabled)
                              {
                                    pic->m_cap_flag = pic->m_pplugin->Init();
                                    pic->m_bInitState = true;
                              }

                              pic->m_short_description = pic->m_pplugin->GetShortDescription();
                              pic->m_long_description = pic->m_pplugin->GetLongDescription();
                              pic->m_version_major = pic->m_pplugin->GetPlugInVersionMajor();
                              pic->m_version_minor = pic->m_pplugin->GetPlugInVersionMinor();
                              pic->m_bitmap = pic->m_pplugin->GetPlugInBitmap();

                        }
                        else
                        {
                              wxString msg;
                              msg.Printf(_("PlugInManager: Unloading PlugIn with invalid API version %d.%d: "), api_major, api_minor );
                              msg += pic->m_plugin_file;
                              wxLogMessage(msg);

                              pic->m_destroy_fn(pic->m_pplugin);

                              delete pic->m_plibrary;            // This will unload the PlugIn
                              delete pic;
                        }
                  }

                  b_more =pi_dir.GetNext(&plugin_file);
            }
            return true;
      }
      else
            return false;
}