Doug Turner said:
>> Basically what I'm asking is there an elegant way to find which GRE
>> netscape was installed with? If not can I build the directory from the
>> data in mainifest.ini?
>
>Elegant... not sure.  but you can use the windows 
>registry.  Attached is some code that will 
>enumerate all of the GRE's installed.

That's basically my question. Under the GRE key there's a GreHome
value which holds the directory I want. I have no problem enumerating
these keys, the thing I don't know how to do is find which of the GRE
registered is the one that was installed with NS7.

I later noticed the AppList subkey and I now look to see if Netscape
is listed there. Here is my code, is it correct?
I assume that if a subkey begins with "Netscape 7" it's what I'm
looking for and that there aren't several versions of Netscape 7+
installed on the machine.

// Look in the AppList sub key to see if this is 
// the GRE with which Netscape is associated.
bool IsNetscapeGRE(HKEY key)
{
        CRegKey AppList;
        LONG rc = AppList.Open(key, _T("AppList"), KEY_READ);
        if (ERROR_SUCCESS != rc)
                return false;
        
        DWORD count, maxLen;
        rc = RegQueryInfoKey(AppList, NULL, NULL, NULL, &count,
                             &maxLen, NULL, NULL, NULL, NULL, 
                             NULL, NULL);
        if (ERROR_SUCCESS != rc)
                return false;

        // ignore minor versioning (is this right?)  <==== QUESTION
        const CString Netscape = _T("Netscape 7"); 
        CString buffer; // manage memory
        TCHAR* name = buffer.GetBuffer(maxLen + 1);
        for (int i = 0; i < count; ++i) {
                DWORD len = maxLen + 1;
                rc = RegEnumKeyEx(AppList, i, name, &len, NULL, 
                                  NULL, NULL, NULL);
                if (ERROR_SUCCESS != rc)
                        continue;
                // Check if 'name' begins with the Netscape string.
                CString actual(name, Netscape.GetLength());
                if (actual.CompareNoCase(Netscape) == 0)
                        return true;
        }
        return false;
}

_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to