summaryrefslogtreecommitdiff
path: root/desktop/win32/source/setup
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/win32/source/setup')
-rw-r--r--desktop/win32/source/setup/Resource.h88
-rw-r--r--desktop/win32/source/setup/setup.cpp119
-rw-r--r--desktop/win32/source/setup/setup.hxx4
-rw-r--r--desktop/win32/source/setup/setup_a.cxx2
-rw-r--r--desktop/win32/source/setup/setup_help.hxx2
-rw-r--r--desktop/win32/source/setup/setup_main.cxx2
-rw-r--r--desktop/win32/source/setup/setup_main.hxx2
-rw-r--r--desktop/win32/source/setup/setup_w.cxx2
8 files changed, 110 insertions, 111 deletions
diff --git a/desktop/win32/source/setup/Resource.h b/desktop/win32/source/setup/Resource.h
index 600056d0a8ee..2f075004d68c 100644
--- a/desktop/win32/source/setup/Resource.h
+++ b/desktop/win32/source/setup/Resource.h
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -29,51 +29,51 @@
#ifndef _RESOURCE_H
#define _RESOURCE_H
-#define IDS_APP_TITLE 10
-#define IDS_APP_PROD_TITLE 11
-#define IDS_OUTOFMEM 12
-#define IDS_NOMSI 13
-#define IDS_USER_CANCELLED 14
-#define IDS_REQUIRES_ADMIN_PRIV 15
-#define IDS_FILE_NOT_FOUND 16
-#define IDS_INVALID_PARAM 17
-#define IDS_ALLOW_MSI_UPDATE 18
-#define IDS_USAGE 19
-#define IDS_ALREADY_RUNNING 20
-#define IDS_UNKNOWN_ERROR 21
-#define IDS_INVALID_PROFILE 22
-#define IDS_UNKNOWN_LANG 23
+#define IDS_APP_TITLE 10
+#define IDS_APP_PROD_TITLE 11
+#define IDS_OUTOFMEM 12
+#define IDS_NOMSI 13
+#define IDS_USER_CANCELLED 14
+#define IDS_REQUIRES_ADMIN_PRIV 15
+#define IDS_FILE_NOT_FOUND 16
+#define IDS_INVALID_PARAM 17
+#define IDS_ALLOW_MSI_UPDATE 18
+#define IDS_USAGE 19
+#define IDS_ALREADY_RUNNING 20
+#define IDS_UNKNOWN_ERROR 21
+#define IDS_INVALID_PROFILE 22
+#define IDS_UNKNOWN_LANG 23
#define IDS_SETUP_TO_OLD 24
#define IDS_SETUP_NOT_FOUND 25
-#define IDS_LANGUAGE_ENGLISH 50
-#define IDS_LANGUAGE_SPAIN 51
-#define IDS_LANGUAGE_GERMAN 52
-#define IDS_LANGUAGE_ZH_TW 53
-#define IDS_LANGUAGE_CS 54
-#define IDS_LANGUAGE_DA 55
-#define IDS_LANGUAGE_DE_DE 56
-#define IDS_LANGUAGE_EL 57
-#define IDS_LANGUAGE_EN_US 58
-#define IDS_LANGUAGE_ES 59
-#define IDS_LANGUAGE_FI 60
-#define IDS_LANGUAGE_FR_FR 61
-#define IDS_LANGUAGE_HE 62
-#define IDS_LANGUAGE_HU 63
-#define IDS_LANGUAGE_IT_IT 64
-#define IDS_LANGUAGE_JA 65
-#define IDS_LANGUAGE_KO 66
-#define IDS_LANGUAGE_NL_NL 67
-#define IDS_LANGUAGE_NO_NO 68
-#define IDS_LANGUAGE_PL 69
-#define IDS_LANGUAGE_PT_BR 70
-#define IDS_LANGUAGE_RU 71
-#define IDS_LANGUAGE_SK 72
-#define IDS_LANGUAGE_SV_SE 73
-#define IDS_LANGUAGE_TH 74
-#define IDS_LANGUAGE_TR 75
-#define IDS_LANGUAGE_ET 76
-#define IDS_LANGUAGE_ZH_CN 77
-#define IDS_LANGUAGE_PT_PT 78
+#define IDS_LANGUAGE_ENGLISH 50
+#define IDS_LANGUAGE_SPAIN 51
+#define IDS_LANGUAGE_GERMAN 52
+#define IDS_LANGUAGE_ZH_TW 53
+#define IDS_LANGUAGE_CS 54
+#define IDS_LANGUAGE_DA 55
+#define IDS_LANGUAGE_DE_DE 56
+#define IDS_LANGUAGE_EL 57
+#define IDS_LANGUAGE_EN_US 58
+#define IDS_LANGUAGE_ES 59
+#define IDS_LANGUAGE_FI 60
+#define IDS_LANGUAGE_FR_FR 61
+#define IDS_LANGUAGE_HE 62
+#define IDS_LANGUAGE_HU 63
+#define IDS_LANGUAGE_IT_IT 64
+#define IDS_LANGUAGE_JA 65
+#define IDS_LANGUAGE_KO 66
+#define IDS_LANGUAGE_NL_NL 67
+#define IDS_LANGUAGE_NO_NO 68
+#define IDS_LANGUAGE_PL 69
+#define IDS_LANGUAGE_PT_BR 70
+#define IDS_LANGUAGE_RU 71
+#define IDS_LANGUAGE_SK 72
+#define IDS_LANGUAGE_SV_SE 73
+#define IDS_LANGUAGE_TH 74
+#define IDS_LANGUAGE_TR 75
+#define IDS_LANGUAGE_ET 76
+#define IDS_LANGUAGE_ZH_CN 77
+#define IDS_LANGUAGE_PT_PT 78
#define IDI_INSTALLER 99
diff --git a/desktop/win32/source/setup/setup.cpp b/desktop/win32/source/setup/setup.cpp
index 85b457491946..69d09a47f647 100644
--- a/desktop/win32/source/setup/setup.cpp
+++ b/desktop/win32/source/setup/setup.cpp
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -174,7 +174,7 @@ SetupAppX::~SetupAppX()
tm *pTime = localtime( &aTime ); // Convert time to struct tm form
Log( TEXT( "End: %s\n\r\n\r\n" ), _tasctime( pTime ) );
-
+
if ( m_pLogFile ) fclose( m_pLogFile );
if ( m_pTmpName )
@@ -225,16 +225,16 @@ boolean SetupAppX::Initialize( HINSTANCE hInst )
m_hMapFile = CreateFileMapping(
INVALID_HANDLE_VALUE, // use paging file
- NULL, // default security
+ NULL, // default security
PAGE_READWRITE, // read/write access
- 0, // max. object size
- sizeof( int ), // buffer size
+ 0, // max. object size
+ sizeof( int ), // buffer size
sMemMapName );
if ( m_hMapFile )
{
m_pMSIErrorCode = (int*) MapViewOfFile( m_hMapFile, // handle to map object
FILE_MAP_ALL_ACCESS, // read/write permission
- 0,
+ 0,
0,
sizeof( int ) );
if ( m_pMSIErrorCode )
@@ -247,7 +247,7 @@ boolean SetupAppX::Initialize( HINSTANCE hInst )
Log( TEXT("Starting: %s\r\n"), m_pModuleFile );
Log( TEXT(" CommandLine=<%s>\r\n"), m_pCmdLine );
-
+
if ( m_bQuiet )
Log( TEXT(" Using quiet install mode\r\n") );
@@ -265,34 +265,33 @@ boolean SetupAppX::GetProfileSection( LPCTSTR pFileName, LPCTSTR pSection,
{
if ( !rSize || !*pRetBuf )
{
- rSize = 512;
+ rSize = 10000;
*pRetBuf = new TCHAR[ rSize ];
}
DWORD nRet = GetPrivateProfileSection( pSection, *pRetBuf, rSize, pFileName );
- if ( nRet && ( nRet + 2 > rSize ) ) // buffer was too small, retry with bigger one
+ while ( nRet && ( nRet + 2 >= rSize ) ) // buffer was too small, retry until big enough
{
- if ( nRet < 32767 - 2 )
- {
- delete [] (*pRetBuf);
- rSize = nRet + 2;
- *pRetBuf = new TCHAR[ rSize ];
+ if (rSize > 1000000)
+ break;
+ delete [] (*pRetBuf);
+ rSize = rSize * 2;
+ *pRetBuf = new TCHAR[ rSize ];
- nRet = GetPrivateProfileSection( pSection, *pRetBuf, rSize, pFileName );
- }
+ nRet = GetPrivateProfileSection( pSection, *pRetBuf, rSize, pFileName );
}
if ( !nRet )
{
SetError( WIN::GetLastError() );
-
+
TCHAR sBuf[80];
StringCchPrintf( sBuf, 80, TEXT("ERROR: GetPrivateProfileSection(): GetLastError returned %u\r\n"), GetError() );
Log( sBuf );
return false;
}
- else if ( nRet + 2 > rSize )
+ else if ( nRet + 2 >= rSize )
{
SetError( ERROR_OUTOFMEMORY );
Log( TEXT( "ERROR: GetPrivateProfileSection() out of memory\r\n" ) );
@@ -343,7 +342,7 @@ boolean SetupAppX::ReadProfile()
LPTSTR pValue = 0;
pCurLine += GetNameValue( pCurLine, &pName, &pValue );
-
+
if ( lstrcmpi( TEXT( "database" ), pName ) == 0 )
{
m_pDatabase = pValue;
@@ -409,7 +408,7 @@ boolean SetupAppX::ReadProfile()
pCurLine += nNext;
delete [] pValue;
}
-
+
m_ppLanguageList = new LanguageDataX*[ m_nLanguageCount ];
for ( int i=0; i < m_nLanguageCount; i++ )
@@ -419,7 +418,7 @@ boolean SetupAppX::ReadProfile()
m_nLanguageCount = i;
break;
}
-
+
pCurLine += GetNameValue( pCurLine, &pName, &pValue );
m_ppLanguageList[ i ] = new LanguageDataX( pValue );
Log( TEXT( " Language = %s\r\n" ), pValue );
@@ -430,7 +429,7 @@ boolean SetupAppX::ReadProfile()
delete [] pValue;
}
}
-
+
if ( pRetBuf )
delete [] pRetBuf;
}
@@ -478,16 +477,16 @@ boolean SetupAppX::GetPatches()
*pFilePart = '\0';
StringCchCopy( pBaseDir, nPatternLen, pPattern );
StringCchCat( pPattern, nPatternLen, TEXT("*.msp") );
-
+
WIN32_FIND_DATA aFindFileData;
-
+
HANDLE hFindPatches = FindFirstFile( pPattern, &aFindFileData );
-
+
if ( hFindPatches != INVALID_HANDLE_VALUE )
{
if ( ! IsPatchInstalled( pBaseDir, aFindFileData.cFileName ) )
AddFileToPatchList( pBaseDir, aFindFileData.cFileName );
-
+
while ( FindNextFile( hFindPatches, &aFindFileData ) )
{
if ( ! IsPatchInstalled( pBaseDir, aFindFileData.cFileName ) )
@@ -503,7 +502,7 @@ boolean SetupAppX::GetPatches()
delete [] pPattern;
delete [] pBaseDir;
-
+
return bRet;
}
@@ -537,17 +536,17 @@ boolean SetupAppX::GetPathToFile( TCHAR* pFileName, TCHAR** pPath )
// normalize the path
int nReturn = GetFullPathName( pTempPath, nPath, *pPath, &pFilePart );
-
+
if ( nReturn > nPath )
{
// try again, with larger buffer
delete [] (*pPath);
nPath = nReturn;
*pPath = new TCHAR[ nPath ];
-
+
nReturn = GetFullPathName( pTempPath, nPath, *pPath, &pFilePart );
}
-
+
if ( 0 == nReturn )
{
// error -- invalid path
@@ -583,11 +582,11 @@ int SetupAppX::GetNameValue( TCHAR* pLine, TCHAR** pName, TCHAR** pValue )
LPTSTR pChar = pLine;
LPTSTR pLast = NULL;
-
+
// Skip leading spaces.
while (' ' == *pChar || '\t' == *pChar)
pChar = CharNext( pChar );
-
+
*pName = pChar;
// look for the end of the name
@@ -623,7 +622,7 @@ boolean SetupAppX::ChooseLanguage( long& rLanguage )
if ( m_bQuiet )
return true;
-
+
// When there are none or only one language, there is nothing
// to do here
if ( m_nLanguageCount > 1 )
@@ -632,7 +631,7 @@ boolean SetupAppX::ChooseLanguage( long& rLanguage )
LANGID nUserDefLang = GetUserDefaultLangID();
LANGID nSysDefLang = GetSystemDefaultLangID();
-
+
int nUserPrimary = PRIMARYLANGID( nUserDefLang );
int nSysPrimary = PRIMARYLANGID( nSysDefLang );
@@ -707,7 +706,7 @@ HMODULE SetupAppX::LoadMsiLibrary()
{
HMODULE hMsi = NULL;
HKEY hInstKey = NULL;
-
+
// find registered location of Msi.dll
if ( ERROR_SUCCESS == RegOpenKeyEx( HKEY_LOCAL_MACHINE, sInstKey, 0, KEY_READ, &hInstKey ) )
{
@@ -740,7 +739,7 @@ HMODULE SetupAppX::LoadMsiLibrary()
}
}
}
-
+
if ( !hMsi ) // use the default location
{
hMsi = LoadLibrary( sMsiDll );
@@ -756,7 +755,7 @@ LPCTSTR SetupAppX::GetPathToMSI()
HKEY hInstKey = NULL;
TCHAR *sMsiFolder = new TCHAR[ MAX_PATH + 1 ];
DWORD nMsiFolderSize = MAX_PATH + 1;
-
+
sMsiFolder[0] = '\0';
// find registered location of Msi.dll
@@ -779,7 +778,7 @@ LPCTSTR SetupAppX::GetPathToMSI()
if ( ERROR_SUCCESS != nRet || dwType != REG_SZ || nMsiFolderSize == 0 )
sMsiFolder[0] = '\0';
}
-
+
if ( sMsiFolder[0] == '\0' ) // use the default location
{
Log( TEXT( " Could not find path to msiexec.exe in registry" ) );
@@ -824,14 +823,14 @@ LPCTSTR SetupAppX::GetPathToMSI()
boolean SetupAppX::LaunchInstaller( LPCTSTR pParam )
{
LPCTSTR sMsiPath = GetPathToMSI();
-
+
if ( !sMsiPath )
{
Log( TEXT( "ERROR: msiexec not found!" ) );
SetError( ERROR_FILE_NOT_FOUND );
return false;
}
-
+
STARTUPINFO aSUI;
PROCESS_INFORMATION aPI;
@@ -949,9 +948,9 @@ boolean SetupAppX::Install( long nLanguage )
nParLen += lstrlen( PARAM_MINOR_UPGRADE );
else
nParLen += lstrlen( PARAM_PACKAGE );
-
+
nParLen += lstrlen( pDataBasePath ) + 3; // two quotes, one null
-
+
if ( NeedReboot() )
nParLen += lstrlen( PARAM_REBOOT );
@@ -1055,7 +1054,7 @@ void SetupAppX::DisplayError( UINT nErr ) const
break;
case ERROR_OUTOFMEMORY: WIN::LoadString( m_hInst, IDS_OUTOFMEM, sError, MAX_TEXT_LENGTH );
break;
- case ERROR_INSTALL_USEREXIT:
+ case ERROR_INSTALL_USEREXIT:
WIN::LoadString( m_hInst, IDS_USER_CANCELLED, sError, MAX_TEXT_LENGTH );
break;
case ERROR_INSTALL_ALREADY_RUNNING: // 1618
@@ -1170,11 +1169,11 @@ boolean SetupAppX::CheckVersion()
else
{
PFnDllGetVersion pDllGetVersion = (PFnDllGetVersion) GetProcAddress( hMsi, MSIAPI_DllGetVersion );
-
+
if ( pDllGetVersion )
{
DLLVERSIONINFO aInfo;
-
+
aInfo.cbSize = sizeof( DLLVERSIONINFO );
if ( NOERROR == pDllGetVersion( &aInfo ) )
{
@@ -1200,7 +1199,7 @@ boolean SetupAppX::CheckVersion()
Log( TEXT("Warning: Patching not supported! MSI-Version <%s>\r\n"), pMsiVersion );
}
}
-
+
FreeLibrary( hMsi );
}
@@ -1460,16 +1459,16 @@ DWORD SetupAppX::GetNextArgument( LPCTSTR pStr, LPTSTR *pArg, LPTSTR *pNext,
nCount += 1;
}
}
-
+
if ( pArg )
{
*pArg = new TCHAR[ nCount ];
StringCchCopyN ( *pArg, nCount, pFirst, nCount-1 );
}
-
+
if ( pNext )
*pNext = CharNext( pChar );
-
+
return ERROR_SUCCESS;
}
@@ -1559,7 +1558,7 @@ boolean SetupAppX::GetCmdLineParameters( LPTSTR *pCmdLine )
m_pLogFile = _tfopen( pFileName, TEXT( "ab" ) );
else
m_pLogFile = _tfopen( pFileName, TEXT( "wb" ) );
-
+
delete [] pFileName;
}
}
@@ -1653,7 +1652,7 @@ boolean SetupAppX::IsAdmin()
{
PSID aPsidAdmin;
SID_IDENTIFIER_AUTHORITY aAuthority = SECURITY_NT_AUTHORITY;
-
+
if ( !AllocateAndInitializeSid( &aAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0,
&aPsidAdmin ) )
@@ -1661,10 +1660,10 @@ boolean SetupAppX::IsAdmin()
BOOL bIsAdmin = FALSE;
- if ( GetOSVersion() >= 5 )
+ if ( GetOSVersion() >= 5 )
{
HMODULE hAdvapi32 = LoadLibrary( ADVAPI32_DLL );
-
+
if ( !hAdvapi32 )
bIsAdmin = FALSE;
else
@@ -1702,7 +1701,7 @@ boolean SetupAppX::IsAdmin()
}
WIN::CloseHandle( hAccessToken );
-
+
if ( bSuccess )
{
PTOKEN_GROUPS pGroups = (PTOKEN_GROUPS)(UCHAR*) szInfoBuffer;
@@ -1715,11 +1714,11 @@ boolean SetupAppX::IsAdmin()
}
}
}
-
+
delete [] szInfoBuffer;
}
}
-
+
WIN::FreeSid( aPsidAdmin );
return bIsAdmin ? true : false;
@@ -1735,7 +1734,7 @@ LPTSTR SetupAppX::CopyIniFile( LPCTSTR pIniFile )
Log( TEXT( "ERROR: Could not create temp file\n" ) );
return NULL;
}
-
+
FILE *pOut = _tfopen( m_pTmpName, TEXT( "wb" ) );
FILE *pIn = _tfopen( pIniFile, TEXT( "rb" ) );
@@ -1759,7 +1758,7 @@ LPTSTR SetupAppX::CopyIniFile( LPCTSTR pIniFile )
if ( pOut ) fclose( pOut );
if ( pIn ) fclose( pIn );
-
+
return m_pTmpName;
}
@@ -1767,7 +1766,7 @@ LPTSTR SetupAppX::CopyIniFile( LPCTSTR pIniFile )
void SetupAppX::ConvertNewline( LPTSTR pText ) const
{
int i=0;
-
+
while ( pText[i] != 0 )
{
if ( ( pText[i] == '\\' ) && ( pText[i+1] == 'n' ) )
@@ -1788,7 +1787,7 @@ LPTSTR SetupAppX::SetProdToAppTitle( LPCTSTR pProdName )
LPTSTR pAppProdTitle = new TCHAR[ MAX_STR_CAPTION ];
pAppProdTitle[0] = '\0';
-
+
WIN::LoadString( m_hInst, IDS_APP_PROD_TITLE, pAppProdTitle, MAX_STR_CAPTION );
int nAppLen = lstrlen( pAppProdTitle );
diff --git a/desktop/win32/source/setup/setup.hxx b/desktop/win32/source/setup/setup.hxx
index 6eccda100699..c3bb71cb3fc6 100644
--- a/desktop/win32/source/setup/setup.hxx
+++ b/desktop/win32/source/setup/setup.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -140,7 +140,7 @@ public:
virtual UINT GetError() const;
virtual void DisplayError( UINT nErr ) const;
-
+
void Log( LPCTSTR pMessage, LPCTSTR pText = NULL ) const;
long GetLanguageCount() const { return m_nLanguageCount; }
diff --git a/desktop/win32/source/setup/setup_a.cxx b/desktop/win32/source/setup/setup_a.cxx
index a680673e1729..b3cb31bea40a 100644
--- a/desktop/win32/source/setup/setup_a.cxx
+++ b/desktop/win32/source/setup/setup_a.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/desktop/win32/source/setup/setup_help.hxx b/desktop/win32/source/setup/setup_help.hxx
index 1330fa70f191..f37daa5be37e 100644
--- a/desktop/win32/source/setup/setup_help.hxx
+++ b/desktop/win32/source/setup/setup_help.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/desktop/win32/source/setup/setup_main.cxx b/desktop/win32/source/setup/setup_main.cxx
index 5bfc8b6d155b..effd3de52ed8 100644
--- a/desktop/win32/source/setup/setup_main.cxx
+++ b/desktop/win32/source/setup/setup_main.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/desktop/win32/source/setup/setup_main.hxx b/desktop/win32/source/setup/setup_main.hxx
index dfcb201e3cd3..f966e6ae0348 100644
--- a/desktop/win32/source/setup/setup_main.hxx
+++ b/desktop/win32/source/setup/setup_main.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/desktop/win32/source/setup/setup_w.cxx b/desktop/win32/source/setup/setup_w.cxx
index 9de15b2e535d..d123eeb350e6 100644
--- a/desktop/win32/source/setup/setup_w.cxx
+++ b/desktop/win32/source/setup/setup_w.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite