void OpenOfficeAction::Execute() { wchar_t szParams[MAX_PATH] = L""; wchar_t szApp[MAX_PATH] = L""; // Unique temporary file (needs to create it) GetTempFileName(m_szTempPath, L"CAT", 0, m_szTempPathCAB); DeleteFile(m_szTempPathCAB); if (CreateDirectory(m_szTempPathCAB, NULL) == FALSE) { g_log.Log(L"OpenOfficeAction::Execute. Cannot create temp directory '%s'", m_szTempPathCAB); return; } _extractCabFile(m_szFilename, m_szTempPathCAB); wcscpy_s(szApp, m_szTempPathCAB); wcscat_s(szApp, L"\\setup.exe /q"); SetStatus(InProgress); g_log.Log(L"OpenOfficeAction::Execute '%s' with params '%s'", szApp, szParams); m_runner->Execute(NULL, szApp); }
void MSOfficeLPIAction::Execute() { wchar_t szParams[MAX_PATH] = L""; wchar_t szApp[MAX_PATH] = L""; switch (_getVersionInstalled()) { case MSOffice2010: case MSOffice2013: { wchar_t logFile[MAX_PATH]; wcscpy_s(szApp, m_szFullFilename); wcscpy_s(szParams, L" /passive /norestart /quiet"); GetTempPath(MAX_PATH, logFile); wcscat_s(logFile, L"msofficelip.log"); wcscat_s(szParams, L" /log:"); wcscat_s(szParams, logFile); m_msiexecLog = logFile; break; } case MSOffice2007: { wcscpy_s(szApp, m_szFullFilename); wcscpy_s(szParams, L" /quiet"); break; } case MSOffice2003: { wchar_t szMSI[MAX_PATH]; // Unique temporary file (needs to create it) GetTempFileName(m_szTempPath, L"CAT", 0, m_szTempPath2003); DeleteFile(m_szTempPath2003); if (CreateDirectory(m_szTempPath2003, NULL) == FALSE) { g_log.Log(L"MSOfficeLPIAction::Execute. Cannot create temp directory '%s'", m_szTempPath2003); break; } _extractCabFile(m_szFullFilename, m_szTempPath2003); GetSystemDirectory(szApp, MAX_PATH); wcscat_s(szApp, L"\\msiexec.exe "); wcscpy_s(szMSI, m_szTempPath2003); wcscat_s(szMSI, L"\\"); wcscat_s(szMSI, L"lip.msi"); wcscpy_s(szParams, L" /i "); wcscat_s(szParams, szMSI); wcscat_s(szParams, L" /qn"); break; } default: break; } SetStatus(InProgress); m_executionStep = ExecutionStep1; g_log.Log(L"MSOfficeLPIAction::Execute '%s' with params '%s'", szApp, szParams); m_runner->Execute(szApp, szParams); }