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.cxx52
1 files changed, 26 insertions, 26 deletions
diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
index 9075436e0412..ca43eea65566 100644
--- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.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
@@ -48,9 +48,9 @@
#ifdef UNICODE
#define _UNICODE
-#define _tstring wstring
+#define _tstring wstring
#else
-#define _tstring string
+#define _tstring string
#endif
#include <tchar.h>
#include <string>
@@ -62,7 +62,7 @@
static std::_tstring createTempFolder()
{
BOOL bExist = FALSE;
- TCHAR szTempName[MAX_PATH];
+ TCHAR szTempName[MAX_PATH];
do
{
bExist = FALSE;
@@ -73,19 +73,19 @@ static std::_tstring createTempFolder()
{
//fprintf (stderr, "GetTempPath failed with error %d.\n", GetLastError());
return TEXT("");
- }
+ }
// Create a temporary file.
UINT uRetVal = GetTempFileName(lpPathBuffer, // directory for tmp files
- "upg", // temp file name prefix
- 0, // create unique name
- szTempName); // buffer for name
+ "upg", // temp file name prefix
+ 0, // create unique name
+ szTempName); // buffer for name
if (uRetVal == 0)
{
//fprintf (stderr, "GetTempFileName failed with error %d.\n", GetLastError());
return TEXT("");
}
//Delete the file
- BOOL bDel = DeleteFile(szTempName);
+ BOOL bDel = DeleteFile(szTempName);
if (FALSE == bDel)
{
//fprintf(stderr, "Could not delete temp file. Error %d.\n", GetLastError());
@@ -107,7 +107,7 @@ static std::_tstring createTempFolder()
}
}
} while(bExist);
-
+
std::_tstring cur(szTempName);
//make a file URL from the path
std::_tstring ret(TEXT("file:///"));
@@ -132,7 +132,7 @@ static void deleteTempFolder(const std::_tstring& sTempFolder)
//convert the file URL to a path
const std::_tstring path(sTempFolder.substr(8));
std::_tstring path2;
-// MessageBox(NULL, path.c_str(), "del1", MB_OK);
+// MessageBox(NULL, path.c_str(), "del1", MB_OK);
for (std::_tstring::const_iterator i = path.begin(); i != path.end(); i++)
{
if (*i == '/')
@@ -147,14 +147,14 @@ static void deleteTempFolder(const std::_tstring& sTempFolder)
size_t size = path2.size();
TCHAR * szTemp2 = new TCHAR[size + 2];
ZeroMemory(szTemp2, (size + 2) * sizeof(TCHAR));
- memcpy(szTemp2, szTemp, size * sizeof(TCHAR));
-
+ memcpy(szTemp2, szTemp, size * sizeof(TCHAR));
+
// MessageBox(NULL, szTemp2, "del3", MB_OK);
- SHFILEOPSTRUCT operation =
+ SHFILEOPSTRUCT operation =
{
NULL,
FO_DELETE,
- szTemp2,
+ szTemp2,
NULL,
FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR,
FALSE,
@@ -189,7 +189,7 @@ static std::_tstring GetMsiProperty( MSIHANDLE handle, const std::_tstring& sPro
/* creates a child process which is specified in lpCommand.
out_exitCode is the exit code of the child process
-
+
**/
static BOOL ExecuteCommand( LPCTSTR lpCommand, DWORD * out_exitCode)
@@ -217,10 +217,10 @@ static BOOL ExecuteCommand( LPCTSTR lpCommand, DWORD * out_exitCode)
if ( fSuccess )
{
WaitForSingleObject( pi.hProcess, INFINITE );
-
+
if (!GetExitCodeProcess( pi.hProcess, out_exitCode))
fSuccess = FALSE;
-
+
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
@@ -252,7 +252,7 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
mystr = "Current short file: " + sFileName;
// MessageBox(NULL, mystr.c_str(), "Current Content", MB_OK);
-
+
if (( strcmp(sFileName.c_str(),sCurrentDir.c_str()) != 0 ) &&
( strcmp(sFileName.c_str(),sParentDir.c_str()) != 0 ))
{
@@ -312,7 +312,7 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
bDirectoryRemoved = false;
}
}
-
+
return bDirectoryRemoved;
}
@@ -342,12 +342,12 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
+ 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);
deleteTempFolder(sTempFolder);
-
+
// if ( fSuccess )
// {
// mystr = "Executed successfully!";
@@ -358,7 +358,7 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
// mystr = "An error occured during execution!";
// MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
// }
-
+
FindClose( hFindUnopkg );
}
// else
@@ -382,10 +382,10 @@ extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle)
DWORD nValueSize = sizeof(szValue);
HKEY hKey;
std::_tstring sInstDir;
-
+
std::_tstring sProductKey = GetMsiProperty( handle, TEXT("FINDPRODUCT") );
//MessageBox( NULL, sProductKey.c_str(), "Titel", MB_OK );
-
+
if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) )
{
if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) )
@@ -410,7 +410,7 @@ extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle)
// Removing complete directory "Basis\presets\bundled"
std::_tstring sCacheDir = sInstDir + TEXT("share\\prereg\\bundled");
-
+
bool fSuccess = RemoveCompleteDirectory( sCacheDir );
// if ( fSuccess )