Kaydet (Commit) 1bb48c93 authored tarafından Jürgen Schmidt's avatar Jürgen Schmidt

#122869# fix problem to find office installation

üst 473a118a
......@@ -56,9 +56,6 @@ namespace cli_ure {
// in main\scp2\source\ooo\registryitem_ooo.scp
#define INSTALL_PATH L"Software\\OpenOffice\\UNO\\InstallPath"
#define INSTALL_PATH_64 L"Software\\Wow6432Node\\OpenOffice\\UNO\\InstallPath"
#define BASIS_LINK L"\\basis-link"
#define URE_LINK L"\\ure-link"
#define URE_BIN L"\\bin"
#define UNO_PATH L"UNO_PATH"
namespace
......@@ -110,23 +107,6 @@ WCHAR* getPathFromRegistryKey( HKEY hroot, LPCWSTR subKeyName )
return data;
}
/* If the path does not end with '\' the las segment will be removed.
path: C:\a\b
-> C:\a
@param io_path
in/out parameter. The string is not reallocated. Simply a '\0'
will be inserted to shorten the string.
*/
void oneDirUp(LPTSTR io_path)
{
WCHAR * pEnd = io_path + lstrlen(io_path) - 1;
while (pEnd > io_path //prevent crashing if provided string does not contain a backslash
&& *pEnd != L'\\')
pEnd --;
*pEnd = L'\0';
}
/* Returns the path to the program folder of the brand layer,
for example c:/openoffice.org 3/program
This path is either obtained from the environment variable UNO_PATH
......@@ -142,8 +122,8 @@ WCHAR * getInstallPath()
DWORD cChars = GetEnvironmentVariable(UNO_PATH, NULL, 0);
if (cChars > 0)
{
szInstallPath = new WCHAR[cChars];
cChars = GetEnvironmentVariable(UNO_PATH, szInstallPath, cChars);
szInstallPath = new WCHAR[cChars+1];
cChars = GetEnvironmentVariable(UNO_PATH, szInstallPath, cChars+1);
//If PATH is not set then it is no error
if (cChars == 0)
{
......@@ -158,14 +138,14 @@ WCHAR * getInstallPath()
if ( szInstallPath == NULL )
{
/* read the key's default value from HKEY_LOCAL_USER */
szInstallPath = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, INSTALL_PATH_64 );
szInstallPath = getPathFromRegistryKey( HKEY_CURRENT_USER, INSTALL_PATH_64 );
}
else if ( szInstallPath == NULL )
if ( szInstallPath == NULL )
{
/* read the key's default value from HKEY_LOCAL_MACHINE */
szInstallPath = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, INSTALL_PATH );
}
else if ( szInstallPath == NULL )
if ( szInstallPath == NULL )
{
/* read the key's default value from HKEY_LOCAL_MACHINE */
szInstallPath = getPathFromRegistryKey( HKEY_LOCAL_MACHINE, INSTALL_PATH_64 );
......@@ -174,67 +154,6 @@ WCHAR * getInstallPath()
return szInstallPath;
}
/* Returns the path to the URE/bin path, where cppuhelper lib resides.
The returned string must be freed with delete[]
*/
WCHAR* getUnoPath()
{
WCHAR * szLinkPath = NULL;
WCHAR * szUrePath = NULL;
WCHAR * szUreBin = NULL; //the return value
WCHAR * szInstallPath = getInstallPath();
if (szInstallPath)
{
//build the path tho the basis-link file
oneDirUp(szInstallPath);
int sizeLinkPath = lstrlen(szInstallPath) + lstrlen(INSTALL_PATH) + 1;
if (sizeLinkPath < MAX_PATH)
sizeLinkPath = MAX_PATH;
szLinkPath = new WCHAR[sizeLinkPath];
szLinkPath[0] = L'\0';
lstrcat(szLinkPath, szInstallPath);
lstrcat(szLinkPath, BASIS_LINK);
//get the path to the actual Basis folder
if (cli_ure::resolveLink(szLinkPath))
{
//build the path to the ure-link file
int sizeUrePath = lstrlen(szLinkPath) + lstrlen(URE_LINK) + 1;
if (sizeUrePath < MAX_PATH)
sizeUrePath = MAX_PATH;
szUrePath = new WCHAR[sizeUrePath];
szUrePath[0] = L'\0';
lstrcat(szUrePath, szLinkPath);
lstrcat(szUrePath, URE_LINK);
//get the path to the actual Ure folder
if (cli_ure::resolveLink(szUrePath))
{
//build the path to the URE/bin directory
szUreBin = new WCHAR[lstrlen(szUrePath) + lstrlen(URE_BIN) + 1];
szUreBin[0] = L'\0';
lstrcat(szUreBin, szUrePath);
lstrcat(szUreBin, URE_BIN);
}
}
}
#if OSL_DEBUG_LEVEL >=2
if (szUreBin)
{
fwprintf(stdout,L"[cli_cppuhelper]: Path to URE libraries:\n %s \n", szUreBin);
}
else
{
fwprintf(stdout,L"[cli_cppuhelper]: Failed to determine location of URE.\n");
}
#endif
delete[] szInstallPath;
delete[] szLinkPath;
delete[] szUrePath;
return szUreBin;
}
/*We extend the path to contain the Ure/bin folder,
so that components can use osl_loadModule with arguments, such as
......@@ -280,7 +199,6 @@ HMODULE loadFromPath(LPCWSTR sLibName)
if (sLibName == NULL)
return NULL;
// WCHAR * szUreBinPath = getUnoPath();
WCHAR * szUreBinPath = getInstallPath();
if (!szUreBinPath)
return NULL;
......@@ -344,10 +262,10 @@ namespace util
Bootstrapping requires the existence of many libraries which are contained
in an URE installation. To find and load these libraries the Windows
registry keys HKEY_CURRENT_USER\Software\OpenOffice\Layer\URE\1
and HKEY_LOCAL_MACHINE\Software\OpenOffice\Layer\URE\1 are examined.
These contain a named value UREINSTALLLOCATION which holds a path to the URE
installation folder.
registry keys HKEY_CURRENT_USER\Software\OpenOffice\UNO\InstallPath
and HKEY_LOCAL_MACHINE\Software\OpenOffice\UNO\InstallPath are examined.
The default value contain the path to the office prgoram dir. No seaparate URE
anymore.
*/
public __sealed __gc class Bootstrap
{
......
......@@ -19,23 +19,23 @@
#
#**************************************************************
CLI_URETYPES_NEW_VERSION=1.0.8.0
CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.7.0
CLI_URETYPES_POLICY_VERSION=8.0.0.0
CLI_URETYPES_NEW_VERSION=1.0.9.0
CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.8.0
CLI_URETYPES_POLICY_VERSION=9.0.0.0
CLI_URETYPES_POLICY_ASSEMBLY=policy.1.0.cli_uretypes
CLI_BASETYPES_NEW_VERSION=1.0.19.0
CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.18.0
CLI_BASETYPES_POLICY_VERSION=19.0.0.0
CLI_BASETYPES_NEW_VERSION=1.0.20.0
CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.19.0
CLI_BASETYPES_POLICY_VERSION=20.0.0.0
CLI_BASETYPES_POLICY_ASSEMBLY=policy.1.0.cli_basetypes
CLI_URE_NEW_VERSION=1.0.22.0
CLI_URE_OLD_VERSION=1.0.0.0-1.0.21.0
CLI_URE_POLICY_VERSION=22.0.0.0
CLI_URE_NEW_VERSION=1.0.23.0
CLI_URE_OLD_VERSION=1.0.0.0-1.0.22.0
CLI_URE_POLICY_VERSION=23.0.0.0
CLI_URE_POLICY_ASSEMBLY=policy.1.0.cli_ure
CLI_CPPUHELPER_NEW_VERSION=1.0.22.0
CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.21.0
CLI_CPPUHELPER_POLICY_VERSION=22.0.0.0
CLI_CPPUHELPER_NEW_VERSION=1.0.23.0
CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.22.0
CLI_CPPUHELPER_POLICY_VERSION=23.0.0.0
CLI_CPPUHELPER_POLICY_ASSEMBLY=policy.1.0.cli_cppuhelper
......@@ -52,7 +52,7 @@ include $(SETTINGS)/stdtarget.mk
# build executables
#csc -lib:"d:\StarOffice 8" does not work. csc does not understand the quotes.
#csc -lib:"d:\OpenOffice 4" does not work. csc does not understand the quotes.
#but they are needed if the path contains a space. Therefore we use full path
#with the -reference switch
$(SPREADSHEET_OUT)/%.exe : %.cs SpreadsheetDocHelper.cs
......@@ -75,7 +75,7 @@ ViewSample : $(SPREADSHEET_OUT)/ViewSample.exe
.PHONY : Info
ifeq "$(OS)" "WIN"
Info : SpreadsheetSample GenerateTableSample ViewSample
Info : SpreadsheetSample GeneralTableSample ViewSample
@echo -------------------------------------------------------------------------------
@echo Please use one of the following commands to execute the examples!
@echo -
......
......@@ -19,8 +19,8 @@
#
#**************************************************************
CLI_OOOTYPES_NEW_VERSION=1.0.8.0
CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.7.0
CLI_OOOTYPES_POLICY_VERSION=8.0.0.0
CLI_OOOTYPES_NEW_VERSION=1.0.9.0
CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.8.0
CLI_OOOTYPES_POLICY_VERSION=9.0.0.0
CLI_OOOTYPES_POLICY_ASSEMBLY=policy.1.0.cli_oootypes
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