summaryrefslogtreecommitdiff
path: root/setup_native
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@suse.com>2011-09-12 13:09:29 +0300
committerTor Lillqvist <tlillqvist@suse.com>2011-09-12 13:32:41 +0300
commitfa93288479b435b013e7517dd4dc1516f0bc5d1c (patch)
tree69fe5a7bb4219cf65e0f5d52202c226ee1349138 /setup_native
parent76983359e6b02ce7efe28fc6690cf0a8fa79c3ee (diff)
Drop Win9x code
Diffstat (limited to 'setup_native')
-rw-r--r--setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx72
-rw-r--r--setup_native/source/win32/customactions/patch/swappatchfiles.cxx84
-rw-r--r--setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx72
3 files changed, 12 insertions, 216 deletions
diff --git a/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx b/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
index 1bebed752e18..2b7dc2556c5e 100644
--- a/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
+++ b/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
@@ -109,74 +109,6 @@ static inline void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProper
MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
}
-static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
-{
- BOOL fSuccess = FALSE; // assume failure
-
- // Windows 9x has a special mechanism to move files after reboot
-
- if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT )
- {
- CHAR szExistingFileNameA[MAX_PATH];
- CHAR szNewFileNameA[MAX_PATH] = "NUL";
-
- // Path names in WININIT.INI must be in short path name form
-
- if (
- GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) &&
- (!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH ))
- )
- {
- CHAR szBuffer[32767]; // The buffer size must not exceed 32K
- DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, SAL_N_ELEMENTS(szBuffer), WININIT_FILENAME );
-
- CHAR szRename[MAX_PATH]; // This is enough for at most to times 67 chracters
- strcpy( szRename, szNewFileNameA );
- strcat( szRename, "=" );
- strcat( szRename, szExistingFileNameA );
- size_t lnRename = strlen(szRename);
-
- if ( dwBufLen + lnRename + 2 <= SAL_N_ELEMENTS(szBuffer) )
- {
- CopyMemory( &szBuffer[dwBufLen], szRename, lnRename );
- szBuffer[dwBufLen + lnRename ] = 0;
- szBuffer[dwBufLen + lnRename + 1 ] = 0;
-
- fSuccess = WritePrivateProfileSectionA( RENAME_SECTION, szBuffer, WININIT_FILENAME );
- }
- else
- SetLastError( ERROR_BUFFER_OVERFLOW );
- }
- }
- else
- {
-
- fSuccess = MoveFileA( lpExistingFileNameA, lpNewFileNameA );
-
- if ( !fSuccess && GetLastError() != ERROR_ACCESS_DENIED &&
- 0 != (dwFlags & (MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) )
- {
- BOOL bFailIfExist = 0 == (dwFlags & MOVEFILE_REPLACE_EXISTING);
-
- fSuccess = CopyFileA( lpExistingFileNameA, lpNewFileNameA, bFailIfExist );
-
- if ( fSuccess )
- fSuccess = DeleteFileA( lpExistingFileNameA );
- }
-
- }
-
- return fSuccess;
-}
-
-static BOOL MoveFileExImpl( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
-{
- if ( 0 > ((LONG)GetVersion())) // High order bit indicates Win 9x
- return MoveFileEx9x( lpExistingFileNameA, lpNewFileNameA, dwFlags );
- else
- return MoveFileExA( lpExistingFileNameA, lpNewFileNameA, dwFlags );
-}
-
extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle )
{
std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") );
@@ -196,10 +128,10 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle )
std::_tstring sResourceFile = sResourceDir + aFindFileData.cFileName;
std::_tstring sIntermediate = sResourceFile + TEXT(".tmp");
- fRenameSucceeded = MoveFileExImpl( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING );
+ fRenameSucceeded = MoveFileExA( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING );
if ( fRenameSucceeded )
{
- MoveFileExImpl( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
+ MoveFileExA( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
fSuccess = FindNextFile( hFind, &aFindFileData );
}
} while ( fSuccess && fRenameSucceeded );
diff --git a/setup_native/source/win32/customactions/patch/swappatchfiles.cxx b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx
index 5028a5fda502..07e9bc28bf20 100644
--- a/setup_native/source/win32/customactions/patch/swappatchfiles.cxx
+++ b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx
@@ -178,74 +178,6 @@ static inline void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProper
MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
}
-static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
-{
- BOOL fSuccess = FALSE; // assume failure
-
- // Windows 9x has a special mechanism to move files after reboot
-
- if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT )
- {
- CHAR szExistingFileNameA[MAX_PATH];
- CHAR szNewFileNameA[MAX_PATH] = "NUL";
-
- // Path names in WININIT.INI must be in short path name form
-
- if (
- GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) &&
- (!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH ))
- )
- {
- CHAR szBuffer[32767]; // The buffer size must not exceed 32K
- DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, SAL_N_ELEMENTS(szBuffer), WININIT_FILENAME );
-
- CHAR szRename[MAX_PATH]; // This is enough for at most to times 67 chracters
- strcpy( szRename, szNewFileNameA );
- strcat( szRename, "=" );
- strcat( szRename, szExistingFileNameA );
- size_t lnRename = strlen(szRename);
-
- if ( dwBufLen + lnRename + 2 <= SAL_N_ELEMENTS(szBuffer) )
- {
- CopyMemory( &szBuffer[dwBufLen], szRename, lnRename );
- szBuffer[dwBufLen + lnRename ] = 0;
- szBuffer[dwBufLen + lnRename + 1 ] = 0;
-
- fSuccess = WritePrivateProfileSectionA( RENAME_SECTION, szBuffer, WININIT_FILENAME );
- }
- else
- SetLastError( ERROR_BUFFER_OVERFLOW );
- }
- }
- else
- {
-
- fSuccess = MoveFileA( lpExistingFileNameA, lpNewFileNameA );
-
- if ( !fSuccess && GetLastError() != ERROR_ACCESS_DENIED &&
- 0 != (dwFlags & (MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) )
- {
- BOOL bFailIfExist = 0 == (dwFlags & MOVEFILE_REPLACE_EXISTING);
-
- fSuccess = CopyFileA( lpExistingFileNameA, lpNewFileNameA, bFailIfExist );
-
- if ( fSuccess )
- fSuccess = DeleteFileA( lpExistingFileNameA );
- }
-
- }
-
- return fSuccess;
-}
-
-static BOOL MoveFileExImpl( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
-{
- if ( 0 > ((LONG)GetVersion())) // High order bit indicates Win 9x
- return MoveFileEx9x( lpExistingFileNameA, lpNewFileNameA, dwFlags );
- else
- return MoveFileExA( lpExistingFileNameA, lpNewFileNameA, dwFlags );
-}
-
static bool SwapFiles( const std::_tstring& sFileName1, const std::_tstring& sFileName2 )
{
std::_tstring sTempFileName = sFileName1 + TEXT(".tmp");
@@ -253,26 +185,26 @@ static bool SwapFiles( const std::_tstring& sFileName1, const std::_tstring& sFi
bool fSuccess = true;
//Try to move the original file to a temp file
- fSuccess = MoveFileExImpl( sFileName1.c_str(), sTempFileName.c_str(), MOVEFILE_REPLACE_EXISTING);
+ fSuccess = MoveFileExA( sFileName1.c_str(), sTempFileName.c_str(), MOVEFILE_REPLACE_EXISTING);
std::_tstring mystr;
if ( fSuccess )
{
- fSuccess = MoveFileExImpl( sFileName2.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING );
+ fSuccess = MoveFileExA( sFileName2.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING );
if ( fSuccess )
{
- fSuccess = MoveFileExImpl( sTempFileName.c_str(), sFileName2.c_str(),
+ fSuccess = MoveFileExA( sTempFileName.c_str(), sFileName2.c_str(),
MOVEFILE_REPLACE_EXISTING );
if ( !fSuccess )
{
- MoveFileExImpl( sFileName1.c_str(), sFileName2.c_str(), MOVEFILE_REPLACE_EXISTING );
+ MoveFileExA( sFileName1.c_str(), sFileName2.c_str(), MOVEFILE_REPLACE_EXISTING );
}
}
else
{
- MoveFileExImpl( sTempFileName.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING );
+ MoveFileExA( sTempFileName.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING );
}
}
else
@@ -284,7 +216,7 @@ static bool SwapFiles( const std::_tstring& sFileName1, const std::_tstring& sFi
HANDLE hdl = FindFirstFile(sFileName1.c_str(), &data);
if (hdl == INVALID_HANDLE_VALUE)
{
- fSuccess = MoveFileExImpl( sFileName2.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING );
+ fSuccess = MoveFileExA( sFileName2.c_str(), sFileName1.c_str(), MOVEFILE_REPLACE_EXISTING );
}
else
{
@@ -668,10 +600,10 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle )
std::_tstring sResourceFile = sResourceDir + aFindFileData.cFileName;
std::_tstring sIntermediate = sResourceFile + TEXT(".tmp");
- fRenameSucceeded = MoveFileExImpl( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING );
+ fRenameSucceeded = MoveFileExA( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING );
if ( fRenameSucceeded )
{
- MoveFileExImpl( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
+ MoveFileExA( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
fSuccess = FindNextFile( hFind, &aFindFileData );
}
} while ( fSuccess && fRenameSucceeded );
diff --git a/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx b/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx
index f50c795c5c8a..76f6b6e94a4f 100644
--- a/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx
@@ -109,74 +109,6 @@ static inline void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProper
MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
}
-static BOOL MoveFileEx9x( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
-{
- BOOL fSuccess = FALSE; // assume failure
-
- // Windows 9x has a special mechanism to move files after reboot
-
- if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT )
- {
- CHAR szExistingFileNameA[MAX_PATH];
- CHAR szNewFileNameA[MAX_PATH] = "NUL";
-
- // Path names in WININIT.INI must be in short path name form
-
- if (
- GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) &&
- (!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH ))
- )
- {
- CHAR szBuffer[32767]; // The buffer size must not exceed 32K
- DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, SAL_N_ELEMENTS(szBuffer), WININIT_FILENAME );
-
- CHAR szRename[MAX_PATH]; // This is enough for at most to times 67 chracters
- strcpy( szRename, szNewFileNameA );
- strcat( szRename, "=" );
- strcat( szRename, szExistingFileNameA );
- size_t lnRename = strlen(szRename);
-
- if ( dwBufLen + lnRename + 2 <= SAL_N_ELEMENTS(szBuffer) )
- {
- CopyMemory( &szBuffer[dwBufLen], szRename, lnRename );
- szBuffer[dwBufLen + lnRename ] = 0;
- szBuffer[dwBufLen + lnRename + 1 ] = 0;
-
- fSuccess = WritePrivateProfileSectionA( RENAME_SECTION, szBuffer, WININIT_FILENAME );
- }
- else
- SetLastError( ERROR_BUFFER_OVERFLOW );
- }
- }
- else
- {
-
- fSuccess = MoveFileA( lpExistingFileNameA, lpNewFileNameA );
-
- if ( !fSuccess && GetLastError() != ERROR_ACCESS_DENIED &&
- 0 != (dwFlags & (MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) )
- {
- BOOL bFailIfExist = 0 == (dwFlags & MOVEFILE_REPLACE_EXISTING);
-
- fSuccess = CopyFileA( lpExistingFileNameA, lpNewFileNameA, bFailIfExist );
-
- if ( fSuccess )
- fSuccess = DeleteFileA( lpExistingFileNameA );
- }
-
- }
-
- return fSuccess;
-}
-
-static BOOL MoveFileExImpl( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
-{
- if ( 0 > ((LONG)GetVersion())) // High order bit indicates Win 9x
- return MoveFileEx9x( lpExistingFileNameA, lpNewFileNameA, dwFlags );
- else
- return MoveFileExA( lpExistingFileNameA, lpNewFileNameA, dwFlags );
-}
-
extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle )
{
OSVERSIONINFO osverinfo;
@@ -211,10 +143,10 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle )
std::_tstring sResourceFile = sResourceDir + aFindFileData.cFileName;
std::_tstring sIntermediate = sResourceFile + TEXT(".tmp");
- fRenameSucceeded = MoveFileExImpl( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING );
+ fRenameSucceeded = MoveFileExA( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING );
if ( fRenameSucceeded )
{
- MoveFileExImpl( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
+ MoveFileExA( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
fSuccess = FindNextFile( hFind, &aFindFileData );
}
} while ( fSuccess && fRenameSucceeded );