improve Java plugin operability for win zip builds by creating the necessary registry key if it doesnt already exist, bug 223238 patch by mcsmurf@gmx.de r/sr=jst a=asa
git-svn-id: svn://10.0.0.236/trunk@154686 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -268,6 +268,7 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, nsIFil
|
||||
// Look for the Java OJI plugin via the JRE install path
|
||||
HKEY baseloc;
|
||||
HKEY keyloc;
|
||||
HKEY entryloc;
|
||||
FILETIME modTime;
|
||||
DWORD type;
|
||||
DWORD index = 0;
|
||||
@@ -275,9 +276,10 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, nsIFil
|
||||
DWORD pathlen;
|
||||
verBlock maxVer;
|
||||
ClearVersion(&maxVer);
|
||||
char curKey[_MAX_PATH] = "Software\\JavaSoft\\Java Plug-in";
|
||||
const char curKey[_MAX_PATH] = "Software\\JavaSoft\\Java Plug-in";
|
||||
char path[_MAX_PATH];
|
||||
char newestPath[_MAX_PATH + 4]; // to prevent buffer overrun when adding \bin
|
||||
const char mozPath[_MAX_PATH] = "Software\\mozilla.org\\Mozilla";
|
||||
|
||||
newestPath[0] = 0;
|
||||
LONG result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ, &baseloc);
|
||||
@@ -289,7 +291,7 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, nsIFil
|
||||
path[0] = 0;
|
||||
numChars = _MAX_PATH;
|
||||
pathlen = sizeof(path);
|
||||
result = ::RegEnumKeyEx(baseloc, index, curKey, &numChars, NULL, NULL, NULL, &modTime);
|
||||
result = ::RegEnumKeyEx(baseloc, index, (char *) curKey, &numChars, NULL, NULL, NULL, &modTime);
|
||||
index++;
|
||||
if (ERROR_SUCCESS == result) {
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, curKey, 0, KEY_QUERY_VALUE, &keyloc)) {
|
||||
@@ -300,6 +302,12 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, nsIFil
|
||||
if (CompareVersion(curVer, maxVer) >= 0 && CompareVersion(curVer, minVer) >= 0) {
|
||||
PL_strcpy(newestPath, path);
|
||||
CopyVersion(&maxVer, &curVer);
|
||||
if (ERROR_SUCCESS == ::RegCreateKeyEx(HKEY_LOCAL_MACHINE, mozPath, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE|KEY_QUERY_VALUE, NULL, &entryloc, NULL)) {
|
||||
if (ERROR_SUCCESS != ::RegQueryValueEx(entryloc, "CurrentVersion", 0, NULL, NULL, NULL)) {
|
||||
::RegSetValueEx(entryloc, "CurrentVersion", 0, REG_SZ, (const BYTE*)MOZILLA_VERSION, sizeof(MOZILLA_VERSION));
|
||||
}
|
||||
}
|
||||
::RegCloseKey(entryloc);
|
||||
}
|
||||
}
|
||||
::RegCloseKey(keyloc);
|
||||
|
||||
Reference in New Issue
Block a user