Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
nsDispatchSupport.cpp File Reference

Contains the implementation for the nsDispatchSupport class this is an XPCOM service. More...

#include "XPCPrivate.h"
#include "nsIActiveXSecurityPolicy.h"

Go to the source code of this file.


static PRBool ClassIsListed (HKEY hkeyRoot, const TCHAR *szKey, const CLSID &clsid, PRBool &listIsEmpty)
static PRBool ClassExists (const CLSID &clsid)
static PRBool ClassImplementsCategory (const CLSID &clsid, const CATID &catid, PRBool &bClassExists)


static const PRUint32 kDefaultHostingFlags

Detailed Description

Contains the implementation for the nsDispatchSupport class this is an XPCOM service.

Definition in file nsDispatchSupport.cpp.

Function Documentation

static PRBool ClassExists ( const CLSID &  clsid) [static]

Definition at line 91 of file nsDispatchSupport.cpp.

    // Test if there is a CLSID entry. If there isn't then obviously
    // the object doesn't exist.
    CRegKey key;
        return PR_FALSE; // Must fail if we can't even open this!
    if(FAILED(StringFromCLSID(clsid, &szCLSID)))
        return PR_FALSE; // Can't allocate string from CLSID

    CRegKey keyCLSID;
    LONG lResult = keyCLSID.Open(key, W2CT(szCLSID), KEY_READ);
    if(lResult != ERROR_SUCCESS)
        return PR_FALSE; // Class doesn't exist

    return PR_TRUE;

Here is the caller graph for this function:

static PRBool ClassImplementsCategory ( const CLSID &  clsid,
const CATID &  catid,
PRBool bClassExists 
) [static]

Definition at line 114 of file nsDispatchSupport.cpp.

    bClassExists = ClassExists(clsid);
    // Non existent classes won't implement any category...
        return PR_FALSE;

    // CLSID exists, so try checking what categories it implements
    bClassExists = PR_TRUE;
    CComPtr<ICatInformation> catInfo;
    HRESULT hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL,
        CLSCTX_INPROC_SERVER, __uuidof(ICatInformation), (LPVOID*) &catInfo);
    if(catInfo == NULL)
        return PR_FALSE; // Must fail if we can't open the category manager
    // See what categories the class implements
    CComPtr<IEnumCATID> enumCATID;
    if(FAILED(catInfo->EnumImplCategoriesOfClass(clsid, &enumCATID)))
        return PR_FALSE; // Can't enumerate classes in category so fail

    // Search for matching categories
    BOOL bFound = FALSE;
    CATID catidNext = GUID_NULL;
    while(enumCATID->Next(1, &catidNext, NULL) == S_OK)
        if(::IsEqualCATID(catid, catidNext))
            return PR_TRUE; // Match
    return PR_FALSE;

Here is the call graph for this function:

static PRBool ClassIsListed ( HKEY  hkeyRoot,
const TCHAR szKey,
const CLSID &  clsid,
PRBool listIsEmpty 
) [static]

Definition at line 49 of file nsDispatchSupport.cpp.

    // Test if the specified CLSID is found in the specified registry key

    listIsEmpty = PR_TRUE;

    CRegKey keyList;
    if(keyList.Open(hkeyRoot, szKey, KEY_READ) != ERROR_SUCCESS)
        // Class is not listed, because there is no key to read!
        return PR_FALSE;

    // Enumerate CLSIDs looking for this one
    int i = 0;
    do {
        TCHAR szCLSID[64];
        const DWORD kBufLength = sizeof(szCLSID) / sizeof(szCLSID[0]);
        memset(szCLSID, 0, sizeof(szCLSID));
        if(::RegEnumKey(keyList, i, szCLSID, kBufLength) != ERROR_SUCCESS)
            // End of list
        listIsEmpty = PR_FALSE;
        szCLSID[kBufLength - 1] = TCHAR('\0');
        CLSID clsidToCompare = GUID_NULL;
        if(SUCCEEDED(::CLSIDFromString(T2OLE(szCLSID), &clsidToCompare)) &&
            ::IsEqualCLSID(clsid, clsidToCompare))
            // Class is listed
            return PR_TRUE;
    } while(1);

    // Class not found
    return PR_FALSE;

Here is the call graph for this function:

Variable Documentation