Skip to content

Instantly share code, notes, and snippets.

Created November 2, 2012 17:52
Show Gist options
  • Save anonymous/04876315636b09f2254a to your computer and use it in GitHub Desktop.
Save anonymous/04876315636b09f2254a to your computer and use it in GitHub Desktop.
long CPluginMgr::m_LoadProtocolPlugins()
{
char szFriendlyName[128];
char szClassName[128];
char szTypeFullName[128];
char szID[128];
short nID;
int cIDs = 1;
CATID IDs[1];
CLSID clsid;
CComPtr<ICatInformation> pInfo;
if (FAILED(CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_ALL, IID_ICatInformation, (void**)&pInfo)))
return -1;
IDs[0] = CATID_PROTOCOL;
CComPtr<IEnumCLSID> pEnumCLSID = NULL;
if (FAILED(pInfo->EnumClassesOfCategories(cIDs, IDs, 0, NULL, &pEnumCLSID)))
return -1;
m_ProtocolPlugins.RemoveAll();
while (pEnumCLSID->Next(1, &clsid, NULL) == S_OK)
{
if ( ReadRegString(clsid, "",NULL,szFriendlyName, sizeof(szFriendlyName)) &&
ReadRegString(clsid, "VersionIndependentProgID", NULL, szClassName, sizeof(szClassName)) &&
ReadRegString(clsid, "4ID", NULL, szID, sizeof(szID)) &&
ReadRegString(clsid, "TypeFullName", NULL, szTypeFullName, sizeof(szTypeFullName)))
{
nID = atoi(szID);
m_ProtocolPlugins.Add(szClassName,szFriendlyName,nID,clsid, szTypeFullName);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment