Odstranil sem vse klice funkcij assert() in verify(), ker sicer tvegamo, da se namestitev v ozadju zatakne v dialogu Prekini/Ponovi/Opusti. Pri namestitvah ob zagonu računalnika (Group Policy) je to še posebej nadležno in kritično.
Verzijo sem nastavil na 1.2.1.
This commit is contained in:
parent
fa5fedfcd4
commit
7ef206882a
@ -50,8 +50,6 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
|||||||
hRecordProg = ::MsiCreateRecord(3);
|
hRecordProg = ::MsiCreateRecord(3);
|
||||||
ATL::CAtlString sValue;
|
ATL::CAtlString sValue;
|
||||||
|
|
||||||
assert(hRecordProg);
|
|
||||||
|
|
||||||
// Check and add the rollback enabled state.
|
// Check and add the rollback enabled state.
|
||||||
uiResult = ::MsiGetProperty(hInstall, _T("RollbackDisabled"), sValue);
|
uiResult = ::MsiGetProperty(hInstall, _T("RollbackDisabled"), sValue);
|
||||||
bRollbackEnabled = uiResult == ERROR_SUCCESS ?
|
bRollbackEnabled = uiResult == ERROR_SUCCESS ?
|
||||||
@ -114,7 +112,6 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
|||||||
// Component is or should be installed. Create the task.
|
// Component is or should be installed. Create the task.
|
||||||
PMSIHANDLE hViewTT;
|
PMSIHANDLE hViewTT;
|
||||||
AMSICA::COpTaskCreate *opCreateTask = new AMSICA::COpTaskCreate(sDisplayName, MSITSCA_TASK_TICK_SIZE);
|
AMSICA::COpTaskCreate *opCreateTask = new AMSICA::COpTaskCreate(sDisplayName, MSITSCA_TASK_TICK_SIZE);
|
||||||
assert(opCreateTask);
|
|
||||||
|
|
||||||
// Populate the operation with task's data.
|
// Populate the operation with task's data.
|
||||||
uiResult = opCreateTask->SetFromRecord(hInstall, hRecord);
|
uiResult = opCreateTask->SetFromRecord(hInstall, hRecord);
|
||||||
@ -129,7 +126,7 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
|||||||
if (uiResult == ERROR_SUCCESS) {
|
if (uiResult == ERROR_SUCCESS) {
|
||||||
// Populate trigger list.
|
// Populate trigger list.
|
||||||
uiResult = opCreateTask->SetTriggersFromView(hViewTT);
|
uiResult = opCreateTask->SetTriggersFromView(hViewTT);
|
||||||
verify(::MsiViewClose(hViewTT) == ERROR_SUCCESS);
|
::MsiViewClose(hViewTT);
|
||||||
if (uiResult != ERROR_SUCCESS) break;
|
if (uiResult != ERROR_SUCCESS) break;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
@ -141,11 +138,11 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, 3 ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, 3 );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 2, MSITSCA_TASK_TICK_SIZE) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 2, MSITSCA_TASK_TICK_SIZE);
|
||||||
if (::MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg) == IDCANCEL) { uiResult = ERROR_INSTALL_USEREXIT; break; }
|
if (::MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg) == IDCANCEL) { uiResult = ERROR_INSTALL_USEREXIT; break; }
|
||||||
}
|
}
|
||||||
verify(::MsiViewClose(hViewST) == ERROR_SUCCESS);
|
::MsiViewClose(hViewST);
|
||||||
|
|
||||||
if (SUCCEEDED(uiResult)) {
|
if (SUCCEEDED(uiResult)) {
|
||||||
ATL::CAtlString sSequenceFilename;
|
ATL::CAtlString sSequenceFilename;
|
||||||
@ -156,7 +153,6 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
|||||||
// Therefore save all required info to file now.
|
// Therefore save all required info to file now.
|
||||||
{
|
{
|
||||||
LPTSTR szBuffer = sSequenceFilename.GetBuffer(MAX_PATH);
|
LPTSTR szBuffer = sSequenceFilename.GetBuffer(MAX_PATH);
|
||||||
assert(szBuffer);
|
|
||||||
::GetTempPath(MAX_PATH, szBuffer);
|
::GetTempPath(MAX_PATH, szBuffer);
|
||||||
::GetTempFileName(szBuffer, _T("TS"), 0, szBuffer);
|
::GetTempFileName(szBuffer, _T("TS"), 0, szBuffer);
|
||||||
sSequenceFilename.ReleaseBuffer();
|
sSequenceFilename.ReleaseBuffer();
|
||||||
@ -176,48 +172,48 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
|||||||
sSequenceFilename2.Format(_T("%.*ls-cm%ls"), pszExtension - (LPCTSTR)sSequenceFilename, (LPCTSTR)sSequenceFilename, pszExtension);
|
sSequenceFilename2.Format(_T("%.*ls-cm%ls"), pszExtension - (LPCTSTR)sSequenceFilename, (LPCTSTR)sSequenceFilename, pszExtension);
|
||||||
uiResult = ::MsiSetProperty(hInstall, _T("CommitScheduledTasks"), sSequenceFilename2);
|
uiResult = ::MsiSetProperty(hInstall, _T("CommitScheduledTasks"), sSequenceFilename2);
|
||||||
if (uiResult != ERROR_SUCCESS) {
|
if (uiResult != ERROR_SUCCESS) {
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_PROPERTY_SET) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_PROPERTY_SET);
|
||||||
verify(::MsiRecordSetString (hRecordProg, 2, _T("CommitScheduledTasks")) == ERROR_SUCCESS);
|
::MsiRecordSetString (hRecordProg, 2, _T("CommitScheduledTasks"));
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 3, uiResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 3, uiResult );
|
||||||
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_PROPERTY_SET ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_PROPERTY_SET );
|
||||||
verify(::MsiRecordSetString (hRecordProg, 2, _T("RollbackScheduledTasks")) == ERROR_SUCCESS);
|
::MsiRecordSetString (hRecordProg, 2, _T("RollbackScheduledTasks"));
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 3, uiResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 3, uiResult );
|
||||||
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_PROPERTY_SET ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_PROPERTY_SET );
|
||||||
verify(::MsiRecordSetString (hRecordProg, 2, _T("InstallScheduledTasks")) == ERROR_SUCCESS);
|
::MsiRecordSetString (hRecordProg, 2, _T("InstallScheduledTasks"));
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 3, uiResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 3, uiResult );
|
||||||
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
}
|
}
|
||||||
if (uiResult != ERROR_SUCCESS) ::DeleteFile(sSequenceFilename);
|
if (uiResult != ERROR_SUCCESS) ::DeleteFile(sSequenceFilename);
|
||||||
} else {
|
} else {
|
||||||
uiResult = ERROR_INSTALL_SCRIPT_WRITE;
|
uiResult = ERROR_INSTALL_SCRIPT_WRITE;
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, uiResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, uiResult );
|
||||||
verify(::MsiRecordSetString (hRecordProg, 2, sSequenceFilename) == ERROR_SUCCESS);
|
::MsiRecordSetString (hRecordProg, 2, sSequenceFilename);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 3, hr ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 3, hr );
|
||||||
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
}
|
}
|
||||||
} else if (uiResult != ERROR_INSTALL_USEREXIT) {
|
} else if (uiResult != ERROR_INSTALL_USEREXIT) {
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_SCHEDULED_TASKS_OPLIST_CREATE) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_SCHEDULED_TASKS_OPLIST_CREATE);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 2, uiResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 2, uiResult );
|
||||||
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, uiResult) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, uiResult);
|
||||||
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, uiResult) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, uiResult);
|
||||||
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uiResult = ERROR_INSTALL_DATABASE_OPEN;
|
uiResult = ERROR_INSTALL_DATABASE_OPEN;
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, uiResult) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, uiResult);
|
||||||
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,16 +301,15 @@ UINT MSITSCA_API InstallScheduledTasks(MSIHANDLE hInstall)
|
|||||||
// And even if it was, the rollback action might not get invoked at all (if scheduled in InstallExecuteSequence later than this action).
|
// 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)));
|
session.m_olRollback.Execute(&session);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Sequence loading failed. Probably, LOCAL SYSTEM doesn't have read access to user's temp directory.
|
// Sequence loading failed. Probably, LOCAL SYSTEM doesn't have read access to user's temp directory.
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
||||||
assert(hRecordProg);
|
|
||||||
uiResult = ERROR_INSTALL_SCRIPT_READ;
|
uiResult = ERROR_INSTALL_SCRIPT_READ;
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, uiResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, uiResult );
|
||||||
verify(::MsiRecordSetString (hRecordProg, 2, sSequenceFilename) == ERROR_SUCCESS);
|
::MsiRecordSetString (hRecordProg, 2, sSequenceFilename);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 3, hr ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 3, hr );
|
||||||
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
// Constants
|
// Constants
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define MSITSCA_VERSION 0x01020000
|
#define MSITSCA_VERSION 0x01020100
|
||||||
|
|
||||||
#define MSITSCA_VERSION_MAJ 1
|
#define MSITSCA_VERSION_MAJ 1
|
||||||
#define MSITSCA_VERSION_MIN 2
|
#define MSITSCA_VERSION_MIN 2
|
||||||
#define MSITSCA_VERSION_REV 0
|
#define MSITSCA_VERSION_REV 1
|
||||||
|
|
||||||
#define MSITSCA_VERSION_STR "1.2"
|
#define MSITSCA_VERSION_STR "1.2.1"
|
||||||
#define MSITSCA_VERSION_INST "1.2.0.0"
|
#define MSITSCA_VERSION_INST "1.2.1.0"
|
||||||
|
|
||||||
|
|
||||||
#if !defined(RC_INVOKED) && !defined(MIDL_PASS)
|
#if !defined(RC_INVOKED) && !defined(MIDL_PASS)
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
#include "AMSICA.h"
|
#include "AMSICA.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <corerror.h>
|
#include <corerror.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user