其实查看BHO就是枚举本机注册表的过程,http://www.codeproject.com/Articles/5930/Registry-Viewer提供一个简单的枚举注册表的类库utility,接下来就是简单的逻辑处理,代码如下:
void ShowBho()
{
HKEY hKey = HKEY_LOCAL_MACHINE;
vector< string > ListEnumKey;
std::string strFullName = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Browser Helper Objects\\";
EnumRegistryKey(hKey,strFullName,ListEnumKey);
char szValue[MAX_PATH];
DWORD dwLen = MAX_PATH - 1;
std::string strTemp;
if (ListEnumKey.size() > 0)
{
for (DWORD i=0; i<ListEnumKey.size(); i++)
{
cout<<ListEnumKey[i].c_str();
strTemp = "CLSID\\";
strTemp += ListEnumKey[i].c_str();
strTemp += "\\InprocServer32";
if (RegCreateKey(HKEY_CLASSES_ROOT,strTemp.c_str(),&hKey) == ERROR_SUCCESS)
{
if (RegQueryValueEx(hKey,NULL,NULL,NULL,(LPBYTE)szValue,&dwLen) == ERROR_SUCCESS)
{
cout<<" "<<szValue;
}
RegCloseKey(hKey);
}
cout<<endl;
}
}
}