예제 #1
1
void CNetRadioDlg::OnBnClickedTest()
{
	CString strValue;
	IHTMLDocument2* pDoc = (IHTMLDocument2*)m_Browser.GetHtmlDocument();
	HRESULT hr = S_FALSE;
	IHTMLElementCollection* pAllElem = NULL;
	IHTMLElementCollection* pAllScript = NULL;
	IHTMLElement* pElem = NULL;

	hr = pDoc->get_scripts(&pAllScript);
	if(SUCCEEDED(hr) && pAllScript != NULL)
	{
		IDispatchPtr pElemDisp = NULL;
		_variant_t varID(1);
		_variant_t varIdx(0);
		hr = pAllScript->item(varID, varIdx, &pElemDisp);
		if(SUCCEEDED(hr) && pElemDisp != NULL)
		{
			hr = pElemDisp->QueryInterface(IID_IHTMLElement,(void**)&pElem);
			if(SUCCEEDED(hr) && pElem != NULL)
			{
				BSTR bstrTagName;
				hr = pElem->get_outerHTML(&bstrTagName);
			
				hr = pElem->get_outerHTML(&bstrTagName);
				if(SUCCEEDED(hr))
				{
					CString strTagName(bstrTagName);
					SysFreeString(bstrTagName);
					MessageBox(strTagName);
				}
			}
		}
	}

	hr = pDoc->get_all(&pAllElem);

	if(SUCCEEDED(hr) && pAllElem != NULL)
	{
		IDispatchPtr pElemDisp = NULL;
		_variant_t varID(_T("body"));
		_variant_t varIdx(0);
		hr = pAllElem->item(varID, varIdx, &pElemDisp);
		if(SUCCEEDED(hr) && pElemDisp != NULL)
		{
			MessageBox(_T("OK"));
		}
	}

}
예제 #2
0
bool
TaintAnalysis::magic_tainted(SgNode *node, FiniteVarsExprsProductLattice *prodLat) {
    if (isSgInitializedName(node)) {
        SgInitializedName *iname = isSgInitializedName(node);
        std::string vname = iname->get_name().getString();
        TaintLattice *tlat = dynamic_cast<TaintLattice*>(prodLat->getVarLattice(varID(iname)));
        if (tlat && 0==vname.compare(0, 7, "TAINTED")) {
            bool modified = tlat->set_vertex(TaintLattice::VERTEX_TAINTED);
            if (debug) {
                *debug <<"TaintAnalysis::magic_tainted: lattice is magically " <<tlat->to_string()
                       <<(modified?" (modified)":" (not modified)") <<"\n";
            }
            return modified;
        }
    } else if (isSgVarRefExp(node)) {
        SgVarRefExp *vref = isSgVarRefExp(node);
        std::string vname = vref->get_symbol()->get_name().getString();
        TaintLattice *tlat = dynamic_cast<TaintLattice*>(prodLat->getVarLattice(varID(vref)));
        if (tlat && 0==vname.compare(0, 7, "TAINTED")) {
            bool modified = tlat->set_vertex(TaintLattice::VERTEX_TAINTED);
            if (debug) {
                *debug <<"TaintAnalysis::magic_tainted: lattice is magically " <<tlat->to_string()
                       <<(modified?" (modified)":" (not modified)") <<"\n";
            }
            return modified;
        }
    } else if (isSgVariableDeclaration(node)) {
        SgVariableDeclaration *vdecl = isSgVariableDeclaration(node);
        const SgInitializedNamePtrList &inames = vdecl->get_variables();
        for (size_t i=0; i<inames.size(); ++i) {
            std::string vname = inames[i]->get_name().getString();
            TaintLattice *tlat = dynamic_cast<TaintLattice*>(prodLat->getVarLattice(varID(inames[i])));
            if (tlat && 0==vname.compare(0, 7, "TAINTED")) {
                bool modified = tlat->set_vertex(TaintLattice::VERTEX_TAINTED);
                if (debug) {
                    *debug <<"TaintAnalysis::magic_tainted: lattice is magically " <<tlat->to_string()
                           <<(modified?" (modified)":" (not modified)") <<"\n";
                }
                return modified;
            }
        }
    }

    return false;
}