if (wcscmp((BSTR) (*i).szName, szName.c_str()) == 0)
if (wcscmp((BSTR) (*i).szName, paramName.get()) == 0)
NPError NewControl(const char *pluginType,                    PluginInstanceData *pData,                    uint16 mode,                    int16 argc,                    char *argn[],                    char *argv[]){    // Read the parameters    CLSID clsid = CLSID_NULL;    tstring szName;    tstring szCodebase;    PropertyList pl;    if (strcmp(pluginType, MIME_OLEOBJECT1) != 0 &&        strcmp(pluginType, MIME_OLEOBJECT2) != 0)    {        clsid = xpc_GetCLSIDForType(pluginType);    }    for (int16 i = 0; i < argc; i++)    {        if (stricmp(argn[i], "CLSID") == 0 ||            stricmp(argn[i], "CLASSID") == 0)        {            // Accept CLSIDs specified in various ways            // e.g:            //   "CLSID:C16DF970-D1BA-11d2-A252-000000000000"            //   "C16DF970-D1BA-11d2-A252-000000000000"            //   "{C16DF970-D1BA-11d2-A252-000000000000}"            //            // The first example is the proper way            char szCLSID[256];            if (strlen(argv[i]) < sizeof(szCLSID))            {                if (strnicmp(argv[i], "CLSID:", 6) == 0)                {                    sprintf(szCLSID, "{%s}", argv[i]+6);                }                else if(argv[i][0] != '{')                {                    sprintf(szCLSID, "{%s}", argv[i]);                }                else                {                    strncpy(szCLSID, argv[i], sizeof(szCLSID));                }                USES_CONVERSION;                CLSIDFromString(A2OLE(szCLSID), &clsid);            }        }        else if (stricmp(argn[i], "NAME") == 0)        {            USES_CONVERSION;            szName = tstring(A2T(argv[i]));        }        else if (stricmp(argn[i], "CODEBASE") == 0)        {            szCodebase = tstring(A2T(argv[i]));        }        else         {            USES_CONVERSION;            std::wstring szName;            if (strnicmp(argn[i], "PARAM_", 6) == 0)            {                szName = A2W(argn[i]+6);            }            else if (stricmp(argn[i], "PARAM") == 0)            {                // The next argn and argv values after this symbol                // will be <param> tag names and values                continue;            }            else            {                szName = A2W(argn[i]);            }            // Empty parameters are ignored            if (szName.empty())            {                continue;            }            std::wstring szParam(A2W(argv[i]));            // Check for existing params with the same name            BOOL bFound = FALSE;            for (PropertyList::const_iterator i = pl.begin(); i != pl.end(); i++)            {                if (wcscmp((BSTR) (*i).szName, szName.c_str()) == 0)                {                    bFound = TRUE;                    break;                }            }            // If the parameter already exists, don't add it to the            // list again.            if (bFound)            {                continue;            }            CComVariant vsValue(szParam.c_str());            CComVariant vIValue; // Value converted to int            CComVariant vRValue; // Value converted to real            CComVariant vBValue; // Value converted to bool            CComVariant &vValue = vsValue;            // See if the variant can be converted to a number or boolean            if (VariantChangeType(&vIValue, &vsValue, 0, VT_I4) == S_OK)            {                vValue = vIValue;            }            else if (VariantChangeType(&vRValue, &vsValue, 0, VT_R8) == S_OK)            {                vValue = vRValue;            }            else if (VariantChangeType(&vBValue, &vsValue, 0, VT_BOOL) == S_OK)            {                vValue = vBValue;            }            // Add named parameter to list            Property p;            p.szName = szName.c_str();            p.vValue = vValue;            pl.push_back(p);        }    }    // Make sure we got a CLSID we can handle    if (!WillHandleCLSID(clsid))    {        return NPERR_GENERIC_ERROR;    }    pData->clsid = clsid;    // Create the control site    CControlSiteInstance *pSite = NULL;    CControlSiteInstance::CreateInstance(&pSite);    if (pSite == NULL)    {        return NPERR_GENERIC_ERROR;    }    pSite->m_bSupportWindowlessActivation = FALSE;    pSite->AddRef();#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT    CComPtr<IServiceProvider> sp;    xpc_GetServiceProvider(pData, &sp);    if (sp)        pSite->SetServiceProvider(sp);#endif    // TODO check the object is installed and at least as recent as    //      that specified in szCodebase    // Create the object    if (FAILED(pSite->Create(clsid, pl, szName)))    {        USES_CONVERSION;        LPOLESTR szClsid;        StringFromCLSID(clsid, &szClsid);        TCHAR szBuffer[256];        _stprintf(szBuffer, _T("Could not create the control %s. Check that it has been installed on your computer and that this page correctly references it."), OLE2T(szClsid));        MessageBox(NULL, szBuffer, _T("ActiveX Error"), MB_OK | MB_ICONWARNING);        CoTaskMemFree(szClsid);        pSite->Release();        return NPERR_GENERIC_ERROR;    }    nsEventSinkInstance *pSink = NULL;    nsEventSinkInstance::CreateInstance(&pSink);    if (pSink)    {        pSink->AddRef();        pSink->mPlugin = pData;        CComPtr<IUnknown> control;        pSite->GetControlUnknown(&control);        pSink->SubscribeToEvents(control);    }    pData->nType = itControl;    pData->pControlSite = pSite;    pData->pControlEventSink = pSink;    return NPERR_NO_ERROR;}