Kaydet (Commit) 9ec6a9d7 authored tarafından Andras Timar's avatar Andras Timar

fdo#54087 refactor/fix browser plugin detection on Windows

Former code did not find the Firefox plugin, if it was
registered under HKEY_CURRENT_USER. Therefore the checkbox state was not
preserved in Tools - Options - Internet - Browser Plug-in.

Change-Id: I9ae2a7dae1501500d7ea7cb42517605219450af3
üst 721eb917
...@@ -33,37 +33,18 @@ ...@@ -33,37 +33,18 @@
extern "C" { extern "C" {
int lc_isInstalled(const char* realFilePath) int lc_isInstalled(const char* realFilePath)
{ {
HKEY hKeySoftware; HKEY hLibreOffice;
HKEY hMozillaPlugins;
HKEY hStarOffice;
char sSoPath[SO_PATH_SIZE]; char sSoPath[SO_PATH_SIZE];
char sPluginPath[SO_PATH_SIZE]; char sPluginPath[SO_PATH_SIZE];
LONG ret; LONG ret;
ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ, &hKeySoftware); ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\MozillaPlugins\\@sun.com/npsopluginmi;version=1.0", 0, KEY_READ, &hLibreOffice);
if(ret != ERROR_SUCCESS){ if(ret != ERROR_SUCCESS){
ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE", 0, KEY_READ, &hKeySoftware); ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE\\MozillaPlugins\\@sun.com/npsopluginmi;version=1.0", 0, KEY_READ, &hLibreOffice);
if(ret != ERROR_SUCCESS){ if(ret != ERROR_SUCCESS){
return -1; return -1;
} }
} }
ret = RegOpenKeyEx(hKeySoftware, "MozillaPlugins", 0, KEY_READ, &hMozillaPlugins);
if(ret != ERROR_SUCCESS){
RegCloseKey(hKeySoftware);
if( ret == ERROR_FILE_NOT_FOUND)
return 1;
else
return -1;
}
ret = RegOpenKeyEx(hMozillaPlugins, "@sun.com/npsopluginmi;version=1.0", 0, KEY_READ, &hStarOffice);
if(ret != ERROR_SUCCESS){
RegCloseKey(hKeySoftware);
RegCloseKey(hMozillaPlugins);
if( ret == ERROR_FILE_NOT_FOUND)
return 1;
else
return -1;
}
if((realFilePath == NULL) || (strlen(realFilePath) == 0) || (strlen(realFilePath) >= SO_PATH_SIZE)) if((realFilePath == NULL) || (strlen(realFilePath) == 0) || (strlen(realFilePath) >= SO_PATH_SIZE))
ret = -1; ret = -1;
...@@ -76,7 +57,7 @@ int lc_isInstalled(const char* realFilePath) ...@@ -76,7 +57,7 @@ int lc_isInstalled(const char* realFilePath)
if(ret == 0){ if(ret == 0){
DWORD dType = REG_SZ; DWORD dType = REG_SZ;
DWORD dSize = SO_PATH_SIZE; DWORD dSize = SO_PATH_SIZE;
ret = RegQueryValueEx (hStarOffice, "Path", NULL, &dType , (LPBYTE) sPluginPath, &dSize); ret = RegQueryValueEx (hLibreOffice, "Path", NULL, &dType , (LPBYTE) sPluginPath, &dSize);
if(ret == ERROR_SUCCESS){ if(ret == ERROR_SUCCESS){
if(strcmp(sPluginPath, sSoPath) == 0) if(strcmp(sPluginPath, sSoPath) == 0)
ret = 0; ret = 0;
...@@ -88,9 +69,7 @@ int lc_isInstalled(const char* realFilePath) ...@@ -88,9 +69,7 @@ int lc_isInstalled(const char* realFilePath)
} }
else else
ret = -1; ret = -1;
RegCloseKey(hStarOffice); RegCloseKey(hLibreOffice);
RegCloseKey(hMozillaPlugins);
RegCloseKey(hKeySoftware);
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment