Usposobil sem upravljanje napredka in izpis sporočil med namestitvijo.

Nadgradnja zdaj ne povozi opravila, če že obstaja.

Brisanje datotek/opravil zdaj v primeru, da datoteka/opravilo ne obstaja, vseeno vrne stanje OK. Saj je želen efekt opravila že dosežen.

Estetski popravki
This commit is contained in:
Simon Rozman 2012-12-21 22:40:52 +00:00
parent 59e983d8fc
commit 2f05e29657
5 changed files with 198 additions and 69 deletions

View File

@ -1,6 +1,6 @@
!INCLUDE "..\..\include\MSINast.mak" !INCLUDE "..\..\include\MSINast.mak"
#MSM_IMA_LOKALIZACIJO=1 MSM_IMA_LOKALIZACIJO=1
!IF "$(CFG)" == "ReleaseU" !IF "$(CFG)" == "ReleaseU"
CFG_VC=Unicode Release CFG_VC=Unicode Release
!ELSEIF "$(CFG)" == "DebugU" !ELSEIF "$(CFG)" == "DebugU"
@ -66,7 +66,7 @@ Vse :: "$(JEZIK).$(CFG).$(PLAT).ActionText-2.idt"
Action Description Template Action Description Template
s$(MSI_TIP_ID) L0 L0 s$(MSI_TIP_ID) L0 L0
1250 ActionText Action 1250 ActionText Action
InstallScheduledTasks Registracija razporejenih opravil Opravilo: [1] InstallScheduledTasks Registracija razporejenih opravil Razporejeno opravilo: [1]
<<NOKEEP <<NOKEEP
"De.$(CFG).$(PLAT).ActionText-2.idt" : "Sl.$(CFG).$(PLAT).ActionText-2.idtx" "..\res\de_DE.po" "De.$(CFG).$(PLAT).ActionText-2.idt" : "Sl.$(CFG).$(PLAT).ActionText-2.idtx" "..\res\de_DE.po"

View File

@ -8,7 +8,7 @@
// Local constants // Local constants
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
#define MSITSCA_TASK_TICK_SIZE (10*1024*1024) #define MSITSCA_TASK_TICK_SIZE (16*1024)
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
@ -115,7 +115,7 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
if (iAction >= INSTALLSTATE_LOCAL) { if (iAction >= INSTALLSTATE_LOCAL) {
// Installing component. Add the task. // Installing component. Add the task.
PMSIHANDLE hViewTT; PMSIHANDLE hViewTT;
CMSITSCAOpCreateTask *opCreateTask = new CMSITSCAOpCreateTask(sDisplayName); CMSITSCAOpCreateTask *opCreateTask = new CMSITSCAOpCreateTask(sDisplayName, iAction < INSTALLSTATE_LOCAL, MSITSCA_TASK_TICK_SIZE);
assert(opCreateTask); assert(opCreateTask);
// Populate the operation with task's data. // Populate the operation with task's data.
@ -138,7 +138,7 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
olExecute.AddTail(opCreateTask); olExecute.AddTail(opCreateTask);
} else { } else {
// Removing component. Remove the task. // Removing component. Remove the task.
olExecute.AddTail(new CMSITSCAOpDeleteTask(sDisplayName)); olExecute.AddTail(new CMSITSCAOpDeleteTask(sDisplayName, MSITSCA_TASK_TICK_SIZE));
} }
// The amount of tick space to add for each task to progress indicator. // The amount of tick space to add for each task to progress indicator.
@ -247,6 +247,8 @@ UINT MSITSCA_API InstallScheduledTasks(MSIHANDLE hInstall)
CMSITSCASession session; CMSITSCASession session;
BOOL bIsCleanup = ::MsiGetMode(hInstall, MSIRUNMODE_COMMIT) || ::MsiGetMode(hInstall, MSIRUNMODE_ROLLBACK); BOOL bIsCleanup = ::MsiGetMode(hInstall, MSIRUNMODE_COMMIT) || ::MsiGetMode(hInstall, MSIRUNMODE_ROLLBACK);
session.m_hInstall = hInstall;
// In case of commit/rollback, continue sequence on error, to do as much cleanup as possible. // In case of commit/rollback, continue sequence on error, to do as much cleanup as possible.
session.m_bContinueOnError = bIsCleanup; session.m_bContinueOnError = bIsCleanup;
@ -283,15 +285,18 @@ UINT MSITSCA_API InstallScheduledTasks(MSIHANDLE hInstall)
// Saving commit file failed. // Saving commit file failed.
uiResult = HRESULT_CODE(hr); uiResult = HRESULT_CODE(hr);
} }
} else } else {
// No cleanup support required.
uiResult = ERROR_SUCCESS; uiResult = ERROR_SUCCESS;
}
} else { } else {
// Execution failed. // Execution failed.
uiResult = HRESULT_CODE(hr); uiResult = HRESULT_CODE(hr);
} }
if (uiResult != ERROR_SUCCESS && !bIsCleanup) { if (uiResult != ERROR_SUCCESS) {
// Perform the cleanup now, since rollback action might not get called at all (if scheduled later than this action). // Perform the cleanup now. The rollback script might not have been written to file yet.
// And even if it was, the rollback action might not get invoked at all (if scheduled in InstallExecuteSequence later than this action).
session.m_bContinueOnError = TRUE; session.m_bContinueOnError = TRUE;
session.m_bRollbackEnabled = FALSE; session.m_bRollbackEnabled = FALSE;
verify(SUCCEEDED(session.m_olRollback.Execute(&session))); verify(SUCCEEDED(session.m_olRollback.Execute(&session)));

View File

@ -5,7 +5,8 @@
// CMSITSCAOp // CMSITSCAOp
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
CMSITSCAOp::CMSITSCAOp() CMSITSCAOp::CMSITSCAOp(int iTicks) :
m_iTicks(iTicks)
{ {
} }
@ -14,9 +15,9 @@ CMSITSCAOp::CMSITSCAOp()
// CMSITSCAOpSingleStringOperation // CMSITSCAOpSingleStringOperation
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
CMSITSCAOpSingleStringOperation::CMSITSCAOpSingleStringOperation(LPCWSTR pszValue) : CMSITSCAOpSingleStringOperation::CMSITSCAOpSingleStringOperation(LPCWSTR pszValue, int iTicks) :
m_sValue(pszValue), m_sValue(pszValue),
CMSITSCAOp() CMSITSCAOp(iTicks)
{ {
} }
@ -25,10 +26,10 @@ CMSITSCAOpSingleStringOperation::CMSITSCAOpSingleStringOperation(LPCWSTR pszValu
// CMSITSCAOpDoubleStringOperation // CMSITSCAOpDoubleStringOperation
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
CMSITSCAOpSrcDstStringOperation::CMSITSCAOpSrcDstStringOperation(LPCWSTR pszValue1, LPCWSTR pszValue2) : CMSITSCAOpSrcDstStringOperation::CMSITSCAOpSrcDstStringOperation(LPCWSTR pszValue1, LPCWSTR pszValue2, int iTicks) :
m_sValue1(pszValue1), m_sValue1(pszValue1),
m_sValue2(pszValue2), m_sValue2(pszValue2),
CMSITSCAOp() CMSITSCAOp(iTicks)
{ {
} }
@ -37,8 +38,9 @@ CMSITSCAOpSrcDstStringOperation::CMSITSCAOpSrcDstStringOperation(LPCWSTR pszValu
// CMSITSCAOpBooleanOperation // CMSITSCAOpBooleanOperation
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
CMSITSCAOpBooleanOperation::CMSITSCAOpBooleanOperation(BOOL bValue) : CMSITSCAOpBooleanOperation::CMSITSCAOpBooleanOperation(BOOL bValue, int iTicks) :
m_bValue(bValue) m_bValue(bValue),
CMSITSCAOp(iTicks)
{ {
} }
@ -47,8 +49,8 @@ CMSITSCAOpBooleanOperation::CMSITSCAOpBooleanOperation(BOOL bValue) :
// CMSITSCAOpEnableRollback // CMSITSCAOpEnableRollback
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
CMSITSCAOpEnableRollback::CMSITSCAOpEnableRollback(BOOL bEnable) : CMSITSCAOpEnableRollback::CMSITSCAOpEnableRollback(BOOL bEnable, int iTicks) :
CMSITSCAOpBooleanOperation(bEnable) CMSITSCAOpBooleanOperation(bEnable, iTicks)
{ {
} }
@ -66,8 +68,8 @@ HRESULT CMSITSCAOpEnableRollback::Execute(CMSITSCASession *pSession)
// CMSITSCAOpDeleteFile // CMSITSCAOpDeleteFile
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
CMSITSCAOpDeleteFile::CMSITSCAOpDeleteFile(LPCWSTR pszFileName) : CMSITSCAOpDeleteFile::CMSITSCAOpDeleteFile(LPCWSTR pszFileName, int iTicks) :
CMSITSCAOpSingleStringOperation(pszFileName) CMSITSCAOpSingleStringOperation(pszFileName, iTicks)
{ {
} }
@ -75,17 +77,18 @@ CMSITSCAOpDeleteFile::CMSITSCAOpDeleteFile(LPCWSTR pszFileName) :
HRESULT CMSITSCAOpDeleteFile::Execute(CMSITSCASession *pSession) HRESULT CMSITSCAOpDeleteFile::Execute(CMSITSCASession *pSession)
{ {
assert(pSession); assert(pSession);
DWORD dwError;
if (pSession->m_bRollbackEnabled) { if (pSession->m_bRollbackEnabled) {
CStringW sBackupName; CStringW sBackupName;
UINT uiCount = 0; UINT uiCount = 0;
DWORD dwError;
do { do {
// Rename the file to make a backup. // Rename the file to make a backup.
sBackupName.Format(L"%ls (orig %u)", (LPCWSTR)m_sValue, ++uiCount); sBackupName.Format(L"%ls (orig %u)", (LPCWSTR)m_sValue, ++uiCount);
dwError = ::MoveFileW(m_sValue, sBackupName) ? ERROR_SUCCESS : ::GetLastError(); dwError = ::MoveFileW(m_sValue, sBackupName) ? ERROR_SUCCESS : ::GetLastError();
} while (dwError == ERROR_FILE_EXISTS); } while (dwError == ERROR_ALREADY_EXISTS);
if (dwError == ERROR_FILE_NOT_FOUND) return S_OK;
if (dwError != ERROR_SUCCESS) return AtlHresultFromWin32(dwError); if (dwError != ERROR_SUCCESS) return AtlHresultFromWin32(dwError);
// Order rollback action to restore from backup copy. // Order rollback action to restore from backup copy.
@ -97,7 +100,9 @@ HRESULT CMSITSCAOpDeleteFile::Execute(CMSITSCASession *pSession)
return S_OK; return S_OK;
} else { } else {
// Delete the file. // Delete the file.
return ::DeleteFileW(m_sValue) ? S_OK : AtlHresultFromLastError(); if (::DeleteFileW(m_sValue)) return S_OK;
dwError = ::GetLastError();
return dwError == ERROR_FILE_NOT_FOUND ? S_OK : AtlHresultFromWin32(dwError);
} }
} }
@ -106,8 +111,8 @@ HRESULT CMSITSCAOpDeleteFile::Execute(CMSITSCASession *pSession)
// CMSITSCAOpMoveFile // CMSITSCAOpMoveFile
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
CMSITSCAOpMoveFile::CMSITSCAOpMoveFile(LPCWSTR pszFileSrc, LPCWSTR pszFileDst) : CMSITSCAOpMoveFile::CMSITSCAOpMoveFile(LPCWSTR pszFileSrc, LPCWSTR pszFileDst, int iTicks) :
CMSITSCAOpSrcDstStringOperation(pszFileSrc, pszFileDst) CMSITSCAOpSrcDstStringOperation(pszFileSrc, pszFileDst, iTicks)
{ {
} }
@ -135,14 +140,14 @@ HRESULT CMSITSCAOpMoveFile::Execute(CMSITSCASession *pSession)
// CMSITSCAOpCreateTask // CMSITSCAOpCreateTask
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
CMSITSCAOpCreateTask::CMSITSCAOpCreateTask(LPCWSTR pszTaskName) : CMSITSCAOpCreateTask::CMSITSCAOpCreateTask(LPCWSTR pszTaskName, BOOL bForce, int iTicks) :
m_bForce(FALSE), m_bForce(bForce),
m_dwFlags(0), m_dwFlags(0),
m_dwPriority(NORMAL_PRIORITY_CLASS), m_dwPriority(NORMAL_PRIORITY_CLASS),
m_wIdleMinutes(0), m_wIdleMinutes(0),
m_wDeadlineMinutes(0), m_wDeadlineMinutes(0),
m_dwMaxRuntimeMS(INFINITE), m_dwMaxRuntimeMS(INFINITE),
CMSITSCAOpSingleStringOperation(pszTaskName) CMSITSCAOpSingleStringOperation(pszTaskName, iTicks)
{ {
} }
@ -161,6 +166,12 @@ HRESULT CMSITSCAOpCreateTask::Execute(CMSITSCASession *pSession)
HRESULT hr; HRESULT hr;
CComPtr<ITask> pTask; CComPtr<ITask> pTask;
POSITION pos; POSITION pos;
PMSIHANDLE hRecordMsg = ::MsiCreateRecord(1);
// Display our custom message in the progress bar.
verify(::MsiRecordSetStringW(hRecordMsg, 1, m_sValue) == ERROR_SUCCESS);
if (MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ACTIONDATA, hRecordMsg) == IDCANCEL)
return AtlHresultFromWin32(ERROR_INSTALL_USEREXIT);
// Load the task to see if it exists. // Load the task to see if it exists.
hr = pSession->m_pTaskScheduler->Activate(m_sValue, IID_ITask, (IUnknown**)&pTask); hr = pSession->m_pTaskScheduler->Activate(m_sValue, IID_ITask, (IUnknown**)&pTask);
@ -406,8 +417,8 @@ UINT CMSITSCAOpCreateTask::SetTriggersFromView(MSIHANDLE hView)
// CMSITSCAOpDeleteTask // CMSITSCAOpDeleteTask
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
CMSITSCAOpDeleteTask::CMSITSCAOpDeleteTask(LPCWSTR pszTaskName) : CMSITSCAOpDeleteTask::CMSITSCAOpDeleteTask(LPCWSTR pszTaskName, int iTicks) :
CMSITSCAOpSingleStringOperation(pszTaskName) CMSITSCAOpSingleStringOperation(pszTaskName, iTicks)
{ {
} }
@ -415,9 +426,9 @@ CMSITSCAOpDeleteTask::CMSITSCAOpDeleteTask(LPCWSTR pszTaskName) :
HRESULT CMSITSCAOpDeleteTask::Execute(CMSITSCASession *pSession) HRESULT CMSITSCAOpDeleteTask::Execute(CMSITSCASession *pSession)
{ {
assert(pSession); assert(pSession);
HRESULT hr;
if (pSession->m_bRollbackEnabled) { if (pSession->m_bRollbackEnabled) {
HRESULT hr;
CComPtr<ITask> pTask; CComPtr<ITask> pTask;
DWORD dwFlags; DWORD dwFlags;
CString sDisplayNameOrig; CString sDisplayNameOrig;
@ -425,7 +436,8 @@ HRESULT CMSITSCAOpDeleteTask::Execute(CMSITSCASession *pSession)
// Load the task. // Load the task.
hr = pSession->m_pTaskScheduler->Activate(m_sValue, IID_ITask, (IUnknown**)&pTask); hr = pSession->m_pTaskScheduler->Activate(m_sValue, IID_ITask, (IUnknown**)&pTask);
if (FAILED(hr)) return hr; if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) return S_OK;
else if (FAILED(hr)) return hr;
// Disable the task. // Disable the task.
hr = pTask->GetFlags(&dwFlags); hr = pTask->GetFlags(&dwFlags);
@ -469,7 +481,9 @@ HRESULT CMSITSCAOpDeleteTask::Execute(CMSITSCASession *pSession)
return S_OK; return S_OK;
} else { } else {
// Delete the task. // Delete the task.
return pSession->m_pTaskScheduler->Delete(m_sValue); hr = pSession->m_pTaskScheduler->Delete(m_sValue);
if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) return S_OK;
else return hr;
} }
} }
@ -478,9 +492,9 @@ HRESULT CMSITSCAOpDeleteTask::Execute(CMSITSCASession *pSession)
// CMSITSCAOpEnableTask // CMSITSCAOpEnableTask
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
CMSITSCAOpEnableTask::CMSITSCAOpEnableTask(LPCWSTR pszTaskName, BOOL bEnable) : CMSITSCAOpEnableTask::CMSITSCAOpEnableTask(LPCWSTR pszTaskName, BOOL bEnable, int iTicks) :
m_bEnable(bEnable), m_bEnable(bEnable),
CMSITSCAOpSingleStringOperation(pszTaskName) CMSITSCAOpSingleStringOperation(pszTaskName, iTicks)
{ {
} }
@ -535,8 +549,8 @@ HRESULT CMSITSCAOpEnableTask::Execute(CMSITSCASession *pSession)
// CMSITSCAOpCopyTask // CMSITSCAOpCopyTask
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
CMSITSCAOpCopyTask::CMSITSCAOpCopyTask(LPCWSTR pszTaskSrc, LPCWSTR pszTaskDst) : CMSITSCAOpCopyTask::CMSITSCAOpCopyTask(LPCWSTR pszTaskSrc, LPCWSTR pszTaskDst, int iTicks) :
CMSITSCAOpSrcDstStringOperation(pszTaskSrc, pszTaskDst) CMSITSCAOpSrcDstStringOperation(pszTaskSrc, pszTaskDst, iTicks)
{ {
} }
@ -572,7 +586,8 @@ HRESULT CMSITSCAOpCopyTask::Execute(CMSITSCASession *pSession)
// CMSITSCAOpList // CMSITSCAOpList
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
CMSITSCAOpList::CMSITSCAOpList() : CMSITSCAOpList::CMSITSCAOpList(int iTicks) :
CMSITSCAOp(iTicks),
CAtlList<CMSITSCAOp*>(sizeof(CMSITSCAOp*)) CAtlList<CMSITSCAOp*>(sizeof(CMSITSCAOp*))
{ {
} }
@ -634,12 +649,33 @@ HRESULT CMSITSCAOpList::Execute(CMSITSCASession *pSession)
assert(pSession); assert(pSession);
POSITION pos; POSITION pos;
HRESULT hr; HRESULT hr;
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
// Tell the installer to use explicit progress messages.
verify(::MsiRecordSetInteger(hRecordProg, 1, 1) == ERROR_SUCCESS);
verify(::MsiRecordSetInteger(hRecordProg, 2, 1) == ERROR_SUCCESS);
verify(::MsiRecordSetInteger(hRecordProg, 3, 0) == ERROR_SUCCESS);
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg);
// Prepare hRecordProg for progress messages.
verify(::MsiRecordSetInteger(hRecordProg, 1, 2) == ERROR_SUCCESS);
verify(::MsiRecordSetInteger(hRecordProg, 3, 0) == ERROR_SUCCESS);
for (pos = GetHeadPosition(); pos;) { for (pos = GetHeadPosition(); pos;) {
hr = GetNext(pos)->Execute(pSession); CMSITSCAOp *pOp = GetNext(pos);
assert(pOp);
hr = pOp->Execute(pSession);
if (!pSession->m_bContinueOnError && FAILED(hr)) return hr; if (!pSession->m_bContinueOnError && FAILED(hr)) return hr;
verify(::MsiRecordSetInteger(hRecordProg, 2, pOp->m_iTicks) == ERROR_SUCCESS);
if (::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg) == IDCANCEL)
return AtlHresultFromWin32(ERROR_INSTALL_USEREXIT);
} }
verify(::MsiRecordSetInteger(hRecordProg, 2, m_iTicks) == ERROR_SUCCESS);
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg);
return S_OK; return S_OK;
} }
@ -653,16 +689,3 @@ CMSITSCASession::CMSITSCASession() :
m_bRollbackEnabled(FALSE) m_bRollbackEnabled(FALSE)
{ {
} }
CMSITSCASession::~CMSITSCASession()
{
}
HRESULT CMSITSCASession::Initialize()
{
return m_pTaskScheduler.CoCreateInstance(CLSID_CTaskScheduler, NULL, CLSCTX_ALL);
}

View File

@ -6,6 +6,7 @@
#include <atlcoll.h> #include <atlcoll.h>
#include <atlfile.h> #include <atlfile.h>
#include <atlstr.h> #include <atlstr.h>
#include <msi.h>
#include <mstask.h> #include <mstask.h>
#include <windows.h> #include <windows.h>
@ -19,9 +20,16 @@ class CMSITSCASession;
class CMSITSCAOp class CMSITSCAOp
{ {
public: public:
CMSITSCAOp(); CMSITSCAOp(int iTicks = 0);
virtual HRESULT Execute(CMSITSCASession *pSession) = 0; virtual HRESULT Execute(CMSITSCASession *pSession) = 0;
friend class CMSITSCAOpList;
friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOp &op);
friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOp &op);
protected:
int m_iTicks; // Number of ticks on a progress bar required for this action execution
}; };
@ -32,7 +40,7 @@ public:
class CMSITSCAOpSingleStringOperation : public CMSITSCAOp class CMSITSCAOpSingleStringOperation : public CMSITSCAOp
{ {
public: public:
CMSITSCAOpSingleStringOperation(LPCWSTR pszValue = L""); CMSITSCAOpSingleStringOperation(LPCWSTR pszValue = L"", int iTicks = 0);
friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpSingleStringOperation &op); friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpSingleStringOperation &op);
friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpSingleStringOperation &op); friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpSingleStringOperation &op);
@ -49,7 +57,7 @@ protected:
class CMSITSCAOpSrcDstStringOperation : public CMSITSCAOp class CMSITSCAOpSrcDstStringOperation : public CMSITSCAOp
{ {
public: public:
CMSITSCAOpSrcDstStringOperation(LPCWSTR pszValue1 = L"", LPCWSTR pszValue2 = L""); CMSITSCAOpSrcDstStringOperation(LPCWSTR pszValue1 = L"", LPCWSTR pszValue2 = L"", int iTicks = 0);
friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpSrcDstStringOperation &op); friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpSrcDstStringOperation &op);
friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpSrcDstStringOperation &op); friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpSrcDstStringOperation &op);
@ -67,7 +75,7 @@ protected:
class CMSITSCAOpBooleanOperation : public CMSITSCAOp class CMSITSCAOpBooleanOperation : public CMSITSCAOp
{ {
public: public:
CMSITSCAOpBooleanOperation(BOOL bValue = TRUE); CMSITSCAOpBooleanOperation(BOOL bValue = TRUE, int iTicks = 0);
friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpBooleanOperation &op); friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpBooleanOperation &op);
friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpBooleanOperation &op); friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpBooleanOperation &op);
@ -84,7 +92,7 @@ protected:
class CMSITSCAOpEnableRollback : public CMSITSCAOpBooleanOperation class CMSITSCAOpEnableRollback : public CMSITSCAOpBooleanOperation
{ {
public: public:
CMSITSCAOpEnableRollback(BOOL bEnable = TRUE); CMSITSCAOpEnableRollback(BOOL bEnable = TRUE, int iTicks = 0);
virtual HRESULT Execute(CMSITSCASession *pSession); virtual HRESULT Execute(CMSITSCASession *pSession);
}; };
@ -96,7 +104,7 @@ public:
class CMSITSCAOpDeleteFile : public CMSITSCAOpSingleStringOperation class CMSITSCAOpDeleteFile : public CMSITSCAOpSingleStringOperation
{ {
public: public:
CMSITSCAOpDeleteFile(LPCWSTR pszFileName = L""); CMSITSCAOpDeleteFile(LPCWSTR pszFileName = L"", int iTicks = 0);
virtual HRESULT Execute(CMSITSCASession *pSession); virtual HRESULT Execute(CMSITSCASession *pSession);
}; };
@ -108,7 +116,7 @@ public:
class CMSITSCAOpMoveFile : public CMSITSCAOpSrcDstStringOperation class CMSITSCAOpMoveFile : public CMSITSCAOpSrcDstStringOperation
{ {
public: public:
CMSITSCAOpMoveFile(LPCWSTR pszFileSrc = L"", LPCWSTR pszFileDst = L""); CMSITSCAOpMoveFile(LPCWSTR pszFileSrc = L"", LPCWSTR pszFileDst = L"", int iTicks = 0);
virtual HRESULT Execute(CMSITSCASession *pSession); virtual HRESULT Execute(CMSITSCASession *pSession);
}; };
@ -120,9 +128,8 @@ public:
class CMSITSCAOpCreateTask : public CMSITSCAOpSingleStringOperation class CMSITSCAOpCreateTask : public CMSITSCAOpSingleStringOperation
{ {
public: public:
CMSITSCAOpCreateTask(LPCWSTR pszTaskName = L""); CMSITSCAOpCreateTask(LPCWSTR pszTaskName = L"", BOOL bForce = FALSE, int iTicks = 0);
virtual ~CMSITSCAOpCreateTask(); virtual ~CMSITSCAOpCreateTask();
virtual HRESULT Execute(CMSITSCASession *pSession); virtual HRESULT Execute(CMSITSCASession *pSession);
UINT SetFromRecord(MSIHANDLE hInstall, MSIHANDLE hRecord); UINT SetFromRecord(MSIHANDLE hInstall, MSIHANDLE hRecord);
@ -156,7 +163,7 @@ protected:
class CMSITSCAOpDeleteTask : public CMSITSCAOpSingleStringOperation class CMSITSCAOpDeleteTask : public CMSITSCAOpSingleStringOperation
{ {
public: public:
CMSITSCAOpDeleteTask(LPCWSTR pszTaskName = L""); CMSITSCAOpDeleteTask(LPCWSTR pszTaskName = L"", int iTicks = 0);
virtual HRESULT Execute(CMSITSCASession *pSession); virtual HRESULT Execute(CMSITSCASession *pSession);
}; };
@ -168,7 +175,7 @@ public:
class CMSITSCAOpEnableTask : public CMSITSCAOpSingleStringOperation class CMSITSCAOpEnableTask : public CMSITSCAOpSingleStringOperation
{ {
public: public:
CMSITSCAOpEnableTask(LPCWSTR pszTaskName = L"", BOOL bEnable = TRUE); CMSITSCAOpEnableTask(LPCWSTR pszTaskName = L"", BOOL bEnable = TRUE, int iTicks = 0);
virtual HRESULT Execute(CMSITSCASession *pSession); virtual HRESULT Execute(CMSITSCASession *pSession);
friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpEnableTask &op); friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpEnableTask &op);
@ -186,7 +193,7 @@ protected:
class CMSITSCAOpCopyTask : public CMSITSCAOpSrcDstStringOperation class CMSITSCAOpCopyTask : public CMSITSCAOpSrcDstStringOperation
{ {
public: public:
CMSITSCAOpCopyTask(LPCWSTR pszTaskSrc = L"", LPCWSTR pszTaskDst = L""); CMSITSCAOpCopyTask(LPCWSTR pszTaskSrc = L"", LPCWSTR pszTaskDst = L"", int iTicks = 0);
virtual HRESULT Execute(CMSITSCASession *pSession); virtual HRESULT Execute(CMSITSCASession *pSession);
}; };
@ -198,7 +205,7 @@ public:
class CMSITSCAOpList : public CMSITSCAOp, public CAtlList<CMSITSCAOp*> class CMSITSCAOpList : public CMSITSCAOp, public CAtlList<CMSITSCAOp*>
{ {
public: public:
CMSITSCAOpList(); CMSITSCAOpList(int iTicks = 0);
void Free(); void Free();
HRESULT LoadFromFile(LPCTSTR pszFileName); HRESULT LoadFromFile(LPCTSTR pszFileName);
@ -235,10 +242,8 @@ class CMSITSCASession
{ {
public: public:
CMSITSCASession(); CMSITSCASession();
virtual ~CMSITSCASession();
HRESULT Initialize();
MSIHANDLE m_hInstall; // Installer handle
CComPtr<ITaskScheduler> m_pTaskScheduler; // Task scheduler interface CComPtr<ITaskScheduler> m_pTaskScheduler; // Task scheduler interface
BOOL m_bContinueOnError; // Continue execution on operation error? BOOL m_bContinueOnError; // Continue execution on operation error?
BOOL m_bRollbackEnabled; // Is rollback enabled? BOOL m_bRollbackEnabled; // Is rollback enabled?
@ -251,14 +256,36 @@ public:
// Inline operators // Inline operators
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOp &op)
{
return f << op.m_iTicks;
}
inline HRESULT operator >>(CAtlFile &f, CMSITSCAOp &op)
{
return f >> op.m_iTicks;
}
inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpSingleStringOperation &op) inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpSingleStringOperation &op)
{ {
HRESULT hr;
hr = f << (const CMSITSCAOp &)op;
if (FAILED(hr)) return hr;
return f << op.m_sValue; return f << op.m_sValue;
} }
inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpSingleStringOperation &op) inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpSingleStringOperation &op)
{ {
HRESULT hr;
hr = f >> (CMSITSCAOp &)op;
if (FAILED(hr)) return hr;
return f >> op.m_sValue; return f >> op.m_sValue;
} }
@ -267,6 +294,9 @@ inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpSrcDstStringOperation &o
{ {
HRESULT hr; HRESULT hr;
hr = f << (const CMSITSCAOp &)op;
if (FAILED(hr)) return hr;
hr = f << op.m_sValue1; hr = f << op.m_sValue1;
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
@ -278,6 +308,9 @@ inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpSrcDstStringOperation &op)
{ {
HRESULT hr; HRESULT hr;
hr = f >> (CMSITSCAOp &)op;
if (FAILED(hr)) return hr;
hr = f >> op.m_sValue1; hr = f >> op.m_sValue1;
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
@ -287,6 +320,11 @@ inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpSrcDstStringOperation &op)
inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpBooleanOperation &op) inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpBooleanOperation &op)
{ {
HRESULT hr;
hr = f << (const CMSITSCAOp &)op;
if (FAILED(hr)) return hr;
return f << (int)op.m_bValue; return f << (int)op.m_bValue;
} }
@ -296,6 +334,9 @@ inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpBooleanOperation &op)
int iValue; int iValue;
HRESULT hr; HRESULT hr;
hr = f >> (CMSITSCAOp &)op;
if (FAILED(hr)) return hr;
hr = f >> iValue; hr = f >> iValue;
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
op.m_bValue = iValue ? TRUE : FALSE; op.m_bValue = iValue ? TRUE : FALSE;
@ -392,6 +433,9 @@ inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpList &list)
POSITION pos; POSITION pos;
HRESULT hr; HRESULT hr;
hr = f << (const CMSITSCAOp &)list;
if (FAILED(hr)) return hr;
hr = f << (int)list.GetCount(); hr = f << (int)list.GetCount();
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
@ -431,6 +475,9 @@ inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpList &list)
HRESULT hr; HRESULT hr;
DWORD dwCount; DWORD dwCount;
hr = f >> (CMSITSCAOp &)list;
if (FAILED(hr)) return hr;
hr = f >> (int&)dwCount; hr = f >> (int&)dwCount;
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;

View File

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: MSITSCA\n" "Project-Id-Version: MSITSCA\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-29 10:54+0100\n" "POT-Creation-Date: 2012-12-21 22:56+0100\n"
"PO-Revision-Date: \n" "PO-Revision-Date: \n"
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n" "Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
"Language-Team: Amebis, d. o. o., Kamnik <simon.rozman@amebis.si>\n" "Language-Team: Amebis, d. o. o., Kamnik <simon.rozman@amebis.si>\n"
@ -15,6 +15,7 @@ msgstr ""
"X-Poedit-Basepath: .\n" "X-Poedit-Basepath: .\n"
"X-Generator: Poedit 1.5.4\n" "X-Generator: Poedit 1.5.4\n"
"X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPath-1: ..\\MSI\n"
# Koda jezika in privzeta kodna stran ANSI za ta jezik (šesnajstiško) # Koda jezika in privzeta kodna stran ANSI za ta jezik (šesnajstiško)
# Če ne prevajamo ločeno vsake lokalne različice jezika, uporabimo kodo privzetega podjezika. # Če ne prevajamo ločeno vsake lokalne različice jezika, uporabimo kodo privzetega podjezika.
@ -31,7 +32,14 @@ msgid "0x424"
msgstr "0x409" msgstr "0x409"
# Privzeta kodna stran ANSI za ta jezik (desetiško) # Privzeta kodna stran ANSI za ta jezik (desetiško)
#: MSITSCA.rcx:64 #: MSITSCA.rcx:64 ..\MSI/Sl.DebugU.Win32.ActionText-2.idtx:3
#: ..\MSI/Sl.DebugU.Win32.Error-2.idtx:3
#: ..\MSI/Sl.DebugU.x64.ActionText-2.idtx:3
#: ..\MSI/Sl.DebugU.x64.Error-2.idtx:3
#: ..\MSI/Sl.ReleaseU.Win32.ActionText-2.idtx:3
#: ..\MSI/Sl.ReleaseU.Win32.Error-2.idtx:3
#: ..\MSI/Sl.ReleaseU.x64.ActionText-2.idtx:3
#: ..\MSI/Sl.ReleaseU.x64.Error-2.idtx:3
msgid "1250" msgid "1250"
msgstr "1252" msgstr "1252"
@ -65,3 +73,49 @@ msgstr "SUBLANG_DEFAULT"
#: MSITSCA.rcx:52 #: MSITSCA.rcx:52
msgid "Vse pravice pridržane © Amebis, d. o. o., Kamnik, 2012" msgid "Vse pravice pridržane © Amebis, d. o. o., Kamnik, 2012"
msgstr "Copyright © Amebis, d. o. o., Kamnik, 2012" msgstr "Copyright © Amebis, d. o. o., Kamnik, 2012"
# !!! Lektorirati !!!
#: ..\MSI/Sl.DebugU.Win32.Error-2.idtx:7 ..\MSI/Sl.DebugU.x64.Error-2.idtx:7
#: ..\MSI/Sl.ReleaseU.Win32.Error-2.idtx:7
#: ..\MSI/Sl.ReleaseU.x64.Error-2.idtx:7
msgid "Pri nastavljanju parametra »[2]« je prišlo do napake [3]."
msgstr "Error [3] setting \"[2]\" parameter."
# !!! Lektorirati !!!
#: ..\MSI/Sl.DebugU.Win32.Error-2.idtx:4 ..\MSI/Sl.DebugU.x64.Error-2.idtx:4
#: ..\MSI/Sl.ReleaseU.Win32.Error-2.idtx:4
#: ..\MSI/Sl.ReleaseU.x64.Error-2.idtx:4
msgid "Pri odpiranju namestitvenega paketa je prišlo do napake."
msgstr "Error opening installation package."
# !!! Lektorirati !!!
#: ..\MSI/Sl.DebugU.Win32.Error-2.idtx:6 ..\MSI/Sl.DebugU.x64.Error-2.idtx:6
#: ..\MSI/Sl.ReleaseU.Win32.Error-2.idtx:6
#: ..\MSI/Sl.ReleaseU.x64.Error-2.idtx:6
msgid ""
"Pri pisanju v datoteko seznama razporejenih opravil »[2]« je prišlo do "
"napake [3]."
msgstr "Error [3] writing to \"[2]\" scheduled task list file."
# !!! Lektorirati !!!
#: ..\MSI/Sl.DebugU.Win32.Error-2.idtx:5 ..\MSI/Sl.DebugU.x64.Error-2.idtx:5
#: ..\MSI/Sl.ReleaseU.Win32.Error-2.idtx:5
#: ..\MSI/Sl.ReleaseU.x64.Error-2.idtx:5
msgid "Pri pripravi seznama razvrščenih opravil je prišlo do napake [2]."
msgstr "Error [2] creating scheduled task list."
# !!! Lektorirati !!!
#: ..\MSI/Sl.DebugU.Win32.ActionText-2.idtx:4
#: ..\MSI/Sl.DebugU.x64.ActionText-2.idtx:4
#: ..\MSI/Sl.ReleaseU.Win32.ActionText-2.idtx:4
#: ..\MSI/Sl.ReleaseU.x64.ActionText-2.idtx:4
msgid "Razporejeno opravilo: [1]"
msgstr "Scheduled task: [1]"
# !!! Lektorirati !!!
#: ..\MSI/Sl.DebugU.Win32.ActionText-2.idtx:4
#: ..\MSI/Sl.DebugU.x64.ActionText-2.idtx:4
#: ..\MSI/Sl.ReleaseU.Win32.ActionText-2.idtx:4
#: ..\MSI/Sl.ReleaseU.x64.ActionText-2.idtx:4
msgid "Registracija razporejenih opravil"
msgstr "Registering scheduled tasks"