My problem is that I don't know how to determine which directory is the correct one. There's only one GRE installed on my computer (Netscape's) but my understanding is that users might have several.
Your application must pick the one to use. Netscape shipped an official Mozilla GRE (as indicated by where it was installed.)
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.
Also, is the 'f' between the ProductID and the BuildID constant or could it be something else?
f == final. It is basically the released version of the GRE.
Hope this helps,
Doug Turner
static const char* kRegLocation = "Software\\mozilla.org\\GRE\\";
HKEY hRegKey = NULL;
DWORD loop = 0;
char greVersionKey[256];
DWORD greVersionKeyLen =256;
if (::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
kRegLocation,
0,
KEY_READ,
&hRegKey) == ERROR_SUCCESS)
{
while(RegEnumKeyEx(hRegKey,
loop++,
greVersionKey,
&greVersionKeyLen,
NULL, NULL,
NULL, NULL) != ERROR_NO_MORE_ITEMS)
{
// do something interesting...
greVersionKeyLen = 256;
}
::RegCloseKey(hRegKey);
}
