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.cxx208
1 files changed, 100 insertions, 108 deletions
diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
index 9eaad6959a63..9a748e9f2008 100644
--- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
@@ -58,112 +58,112 @@
The returned string is a file URL.
*/
-static std::_tstring createTempFolder()
-{
- BOOL bExist = FALSE;
- TCHAR szTempName[MAX_PATH];
- do
- {
- bExist = FALSE;
- // Get the temp path.
- TCHAR lpPathBuffer[MAX_PATH];
- DWORD dwRetVal = GetTempPath(MAX_PATH, lpPathBuffer);
- if (dwRetVal > MAX_PATH || (dwRetVal == 0))
- {
- //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
- if (uRetVal == 0)
- {
- //fprintf (stderr, "GetTempFileName failed with error %d.\n", GetLastError());
- return TEXT("");
- }
- //Delete the file
- BOOL bDel = DeleteFile(szTempName);
- if (FALSE == bDel)
- {
- //fprintf(stderr, "Could not delete temp file. Error %d.\n", GetLastError());
- return TEXT("");
- }
- // Create the directory
- BOOL bDir = CreateDirectory(szTempName, NULL);
- if (FALSE == bDir)
- {
- DWORD error =GetLastError();
- if (ERROR_ALREADY_EXISTS == error)
- {
- bExist = TRUE;
- }
- else
- {
- //fprintf(stderr, "CreateDirectory failed with error %d.\n", error);
- return TEXT("");
- }
- }
- } while(bExist);
+// static std::_tstring createTempFolder()
+// {
+// BOOL bExist = FALSE;
+// TCHAR szTempName[MAX_PATH];
+// do
+// {
+// bExist = FALSE;
+// // Get the temp path.
+// TCHAR lpPathBuffer[MAX_PATH];
+// DWORD dwRetVal = GetTempPath(MAX_PATH, lpPathBuffer);
+// if (dwRetVal > MAX_PATH || (dwRetVal == 0))
+// {
+// //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
+// if (uRetVal == 0)
+// {
+// //fprintf (stderr, "GetTempFileName failed with error %d.\n", GetLastError());
+// return TEXT("");
+// }
+// //Delete the file
+// BOOL bDel = DeleteFile(szTempName);
+// if (FALSE == bDel)
+// {
+// //fprintf(stderr, "Could not delete temp file. Error %d.\n", GetLastError());
+// return TEXT("");
+// }
+// // Create the directory
+// BOOL bDir = CreateDirectory(szTempName, NULL);
+// if (FALSE == bDir)
+// {
+// DWORD error =GetLastError();
+// if (ERROR_ALREADY_EXISTS == error)
+// {
+// bExist = TRUE;
+// }
+// else
+// {
+// //fprintf(stderr, "CreateDirectory failed with error %d.\n", error);
+// return TEXT("");
+// }
+// }
+// } while(bExist);
- std::_tstring cur(szTempName);
- //make a file URL from the path
- std::_tstring ret(TEXT("file:///"));
- for (std::_tstring::iterator i = cur.begin(); i != cur.end(); i++)
- {
- if (*i == '\\')
- ret.append(TEXT("/"));
- else
- ret.push_back(*i);
- }
-// MessageBox(NULL, ret.c_str(), "createTempFolder", MB_OK);
- return ret.c_str();
-}
+// std::_tstring cur(szTempName);
+// //make a file URL from the path
+// std::_tstring ret(TEXT("file:///"));
+// for (std::_tstring::iterator i = cur.begin(); i != cur.end(); i++)
+// {
+// if (*i == '\\')
+// ret.append(TEXT("/"));
+// else
+// ret.push_back(*i);
+// }
+// // MessageBox(NULL, ret.c_str(), "createTempFolder", MB_OK);
+// return ret.c_str();
+// }
/** deletes the temporary folder.
The argument must be a file URL.
*/
-static void deleteTempFolder(const std::_tstring& sTempFolder)
-{
- if (sTempFolder.size() == 0)
- return;
- //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);
- for (std::_tstring::const_iterator i = path.begin(); i != path.end(); i++)
- {
- if (*i == '/')
- path2.append(TEXT("\\"));
- else
- path2.push_back(*i);
- }
+// static void deleteTempFolder(const std::_tstring& sTempFolder)
+// {
+// if (sTempFolder.size() == 0)
+// return;
+// //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);
+// for (std::_tstring::const_iterator i = path.begin(); i != path.end(); i++)
+// {
+// if (*i == '/')
+// path2.append(TEXT("\\"));
+// else
+// path2.push_back(*i);
+// }
- //We need a null terminated string with two nulls in the end
- //for the SHFILEOPSTRUCT
- const TCHAR * szTemp = path2.c_str();
- size_t size = path2.size();
- TCHAR * szTemp2 = new TCHAR[size + 2];
- ZeroMemory(szTemp2, (size + 2) * sizeof(TCHAR));
- memcpy(szTemp2, szTemp, size * sizeof(TCHAR));
+// //We need a null terminated string with two nulls in the end
+// //for the SHFILEOPSTRUCT
+// const TCHAR * szTemp = path2.c_str();
+// size_t size = path2.size();
+// TCHAR * szTemp2 = new TCHAR[size + 2];
+// ZeroMemory(szTemp2, (size + 2) * sizeof(TCHAR));
+// memcpy(szTemp2, szTemp, size * sizeof(TCHAR));
-// MessageBox(NULL, szTemp2, "del3", MB_OK);
- SHFILEOPSTRUCT operation =
- {
- NULL,
- FO_DELETE,
- szTemp2,
- NULL,
- FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR,
- FALSE,
- NULL,
- NULL
- };
-
- SHFileOperation( &operation);
- delete [] szTemp2;
-}
+// // MessageBox(NULL, szTemp2, "del3", MB_OK);
+// SHFILEOPSTRUCT operation =
+// {
+// NULL,
+// FO_DELETE,
+// szTemp2,
+// NULL,
+// FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR,
+// FALSE,
+// NULL,
+// NULL
+// };
+
+// SHFileOperation( &operation);
+// delete [] szTemp2;
+// }
@@ -332,21 +332,13 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
if ( hFindUnopkg != INVALID_HANDLE_VALUE )
{
// unopkg.exe exists in program directory
-
- const std::_tstring sTempFolder(createTempFolder());
- std::_tstring sCommandPart1 = sUnoPkgFile + " sync";
- std::_tstring sCommand = sCommandPart1
- + TEXT(" -env:BUNDLED_EXTENSIONS_USER=$BRAND_BASE_DIR/share/prereg/bundled")
- + TEXT(" -env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml")
- + TEXT(" -env:UserInstallation=") + sTempFolder;
+ std::_tstring sCommand = sUnoPkgFile + " sync";
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!";