summaryrefslogtreecommitdiff
path: root/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'setup_native/source/win32/customactions/shellextensions/registerextensions.cxx')
-rw-r--r--setup_native/source/win32/customactions/shellextensions/registerextensions.cxx196
1 files changed, 25 insertions, 171 deletions
diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
index 3906d2584fd1..001b99c02fa3 100644
--- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
@@ -319,203 +319,57 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
{
std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") );
std::_tstring sUnoPkgFile = sInstDir + TEXT("program\\unopkg.exe");
- std::_tstring sShareInstallDir = sInstDir + TEXT("share\\extension\\install\\");
- std::_tstring sPattern = sShareInstallDir + TEXT("*.oxt");
std::_tstring mystr;
WIN32_FIND_DATA aFindFileData;
mystr = "unopkg file: " + sUnoPkgFile;
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-
- mystr = "oxt file directory: " + sShareInstallDir;
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
+ MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
// Find unopkg.exe
-
HANDLE hFindUnopkg = FindFirstFile( sUnoPkgFile.c_str(), &aFindFileData );
if ( hFindUnopkg != INVALID_HANDLE_VALUE )
{
// unopkg.exe exists in program directory
- // Finding all oxt files in sShareInstallDir
-
- HANDLE hFindOxt = FindFirstFile( sPattern.c_str(), &aFindFileData );
-
- if ( hFindOxt != INVALID_HANDLE_VALUE )
- {
- bool fNextFile = false;
-
- do
- {
- const std::_tstring sTempFolder(createTempFolder());
- std::_tstring sOxtFile = sShareInstallDir + aFindFileData.cFileName;
- std::_tstring sCommandPart1 = sUnoPkgFile + " add --shared --suppress-license --bundled " + "\"" + sOxtFile + "\"";
- std::_tstring sCommand = sCommandPart1
- + TEXT(" -env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml")
- + TEXT(" -env:UserInstallation=") + sTempFolder;
- mystr = "Command: " + sCommand;
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-
- DWORD exitCode = 0;
- bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
- // unopkg in OOo 2.2.1 and early had a bug that it failed when receiving
- // a bootstrap parameter (-env:...) then it exited with a value != 0.
- if (fSuccess && exitCode != 0)
- {
- std::_tstring sCommand = sCommandPart1;
- mystr = "Command: " + sCommand;
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
- }
- deleteTempFolder(sTempFolder);
-
- // if ( fSuccess )
- // {
- // mystr = "Executed successfully!";
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- // }
- // else
- // {
- // mystr = "An error occured during execution!";
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- // }
-
- fNextFile = FindNextFile( hFindOxt, &aFindFileData );
-
- } while ( fNextFile );
-
- FindClose( hFindOxt );
- }
- }
- // else
- // {
- // mystr = "Error: Did not find " + sUnoPkgFile;
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- // }
-
- return ERROR_SUCCESS;
-}
-
-extern "C" UINT __stdcall DeregisterExtensions(MSIHANDLE handle)
-{
- std::_tstring mystr;
-
- // Finding the product with the help of the propery FINDPRODUCT,
- // that contains a Windows Registry key, that points to the install location.
+ const std::_tstring sTempFolder(createTempFolder());
+ std::_tstring sCommandPart1 = sUnoPkgFile + " sync";
+ std::_tstring sCommand = sCommandPart1
+ + TEXT(" -env:BUNDLED_EXTENSIONS_USER=$OOO_BASE_DIR/presets/bundled")
+ + TEXT(" -env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml")
+ + TEXT(" -env:UserInstallation=") + sTempFolder;
+ mystr = "Command: " + sCommand;
+ MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- TCHAR szValue[8192];
- DWORD nValueSize = sizeof(szValue);
- HKEY hKey;
- std::_tstring sInstDir;
+ DWORD exitCode = 0;
+ bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
- std::_tstring sProductKey = GetMsiProperty( handle, TEXT("FINDPRODUCT") );
- // MessageBox( NULL, sProductKey.c_str(), "Titel", MB_OK );
+ deleteTempFolder(sTempFolder);
- if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) )
- {
- if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) )
+ if ( fSuccess )
{
- sInstDir = szValue;
+ mystr = "Executed successfully!";
+ MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
}
- RegCloseKey( hKey );
- }
- else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) )
- {
- if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) )
+ else
{
- sInstDir = szValue;
+ mystr = "An error occured during execution!";
+ MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
}
- RegCloseKey( hKey );
+
+ FindClose( hFindUnopkg );
}
else
{
- return ERROR_SUCCESS;
+ mystr = "Error: Did not find " + sUnoPkgFile;
+ MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
}
- // MessageBox( NULL, sInstDir.c_str(), "install location", MB_OK );
-
- // Searching for the unopkg.exe
-
- std::_tstring sUnoPkgFile = sInstDir + TEXT("program\\unopkg.exe");
- std::_tstring sShareInstallDir = sInstDir + TEXT("share\\extension\\install\\");
- std::_tstring sPattern = sShareInstallDir + TEXT("*.oxt");
-
- WIN32_FIND_DATA aFindFileData;
-
- // Find unopkg.exe
-
- HANDLE hFindUnopkg = FindFirstFile( sUnoPkgFile.c_str(), &aFindFileData );
-
- if ( hFindUnopkg != INVALID_HANDLE_VALUE )
- {
- // unopkg.exe exists in program directory
-
- // Finding all oxt files in sShareInstallDir
-
- HANDLE hFindOxt = FindFirstFile( sPattern.c_str(), &aFindFileData );
-
- if ( hFindOxt != INVALID_HANDLE_VALUE )
- {
- bool fNextFile = false;
-
- do
- {
- const std::_tstring sTempFolder(createTempFolder());
- // When removing extensions, only the oxt file name is required, without path
- // Therefore no quoting is required
- // std::_tstring sOxtFile = sShareInstallDir + aFindFileData.cFileName;
- std::_tstring sOxtFile = aFindFileData.cFileName;
- std::_tstring sCommandPart1 = sUnoPkgFile + " remove --shared --bundled " + "\""
- + sOxtFile + "\"";
- std::_tstring sCommand = sCommandPart1
- + TEXT(" -env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml")
- + TEXT(" -env:UserInstallation=") + sTempFolder;
-
- mystr = "Command: " + sCommand;
- //MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- DWORD exitCode = 0;
- bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
- // unopkg in OOo 2.2.1 and early had a bug that it failed when receiving
- // a bootstrap parameter (-env:...) then it exited with a value != 0.
- if (fSuccess && exitCode != 0)
- {
- std::_tstring sCommand = sCommandPart1;
- mystr = "Command: " + sCommand;
- //MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
- }
-
- deleteTempFolder(sTempFolder);
-
- if ( fSuccess )
- {
- mystr = "Executed successfully!";
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- }
- else
- {
- mystr = "An error occured during execution!";
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- }
-
- fNextFile = FindNextFile( hFindOxt, &aFindFileData );
-
- } while ( fNextFile );
-
- FindClose( hFindOxt );
- }
- }
- // else
- // {
- // mystr = "Not found: " + sUnoPkgFile;
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- // }
-
return ERROR_SUCCESS;
}
+
extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle)
{
std::_tstring mystr;
@@ -552,9 +406,9 @@ extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle)
return ERROR_SUCCESS;
}
- // Removing complete directory "share\uno_packages\cache"
+ // Removing complete directory "Basis\presets\bundled"
- std::_tstring sCacheDir = sInstDir + TEXT("share\\uno_packages\\cache");
+ std::_tstring sCacheDir = sInstDir + TEXT("Basis\\presets\\bundled");
bool fSuccess = RemoveCompleteDirectory( sCacheDir );