Delo z operacijami/rollback/commit sem preselil v samostojno knjižnjico AMSICA.
Verzijo sem nastavil na 1.1.1.
This commit is contained in:
parent
4db19c83a9
commit
dba8f12586
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -3,8 +3,6 @@ MSICALib/MSITSCA.cpp -text
|
||||
MSICALib/MSITSCA.h -text
|
||||
MSICALib/MSITSCA.vcxproj -text svneol=unset#text/xml
|
||||
MSICALib/MSITSCA.vcxproj.filters -text svneol=unset#text/xml
|
||||
MSICALib/MSITSCAOp.cpp -text
|
||||
MSICALib/MSITSCAOp.h -text
|
||||
MSICALib/StdAfx.cpp -text
|
||||
MSICALib/StdAfx.h -text
|
||||
MSICALib/msm/Makefile -text svneol=unset#text/plain%3B+charset%3DWindows-1250
|
||||
|
@ -46,12 +46,12 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
||||
UINT uiResult;
|
||||
HRESULT hr;
|
||||
BOOL bIsCoInitialized = SUCCEEDED(::CoInitialize(NULL));
|
||||
CMSITSCAOpList olExecute;
|
||||
AMSICA::COpList olExecute;
|
||||
BOOL bRollbackEnabled;
|
||||
PMSIHANDLE
|
||||
hDatabase,
|
||||
hRecordProg = ::MsiCreateRecord(3);
|
||||
CString sValue;
|
||||
ATL::CAtlString sValue;
|
||||
|
||||
assert(hRecordProg);
|
||||
|
||||
@ -60,7 +60,7 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
||||
bRollbackEnabled = uiResult == ERROR_SUCCESS ?
|
||||
_ttoi(sValue) || !sValue.IsEmpty() && _totlower(sValue.GetAt(0)) == _T('y') ? FALSE : TRUE :
|
||||
TRUE;
|
||||
olExecute.AddTail(new CMSITSCAOpRollbackEnable(bRollbackEnabled));
|
||||
olExecute.AddTail(new AMSICA::COpRollbackEnable(bRollbackEnabled));
|
||||
|
||||
// Open MSI database.
|
||||
hDatabase = ::MsiGetActiveDatabase(hInstall);
|
||||
@ -76,8 +76,8 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
||||
// Execute query!
|
||||
uiResult = ::MsiViewExecute(hViewST, NULL);
|
||||
if (uiResult == ERROR_SUCCESS) {
|
||||
//CString sComponent;
|
||||
CStringW sDisplayName;
|
||||
//ATL::CAtlString sComponent;
|
||||
ATL::CAtlStringW sDisplayName;
|
||||
|
||||
for (;;) {
|
||||
PMSIHANDLE hRecord;
|
||||
@ -116,7 +116,7 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
||||
if (iAction >= INSTALLSTATE_LOCAL) {
|
||||
// Component is or should be installed. Create the task.
|
||||
PMSIHANDLE hViewTT;
|
||||
CMSITSCAOpTaskCreate *opCreateTask = new CMSITSCAOpTaskCreate(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.
|
||||
@ -140,7 +140,7 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
||||
olExecute.AddTail(opCreateTask);
|
||||
} else if (iAction >= INSTALLSTATE_REMOVED) {
|
||||
// Component is installed, but should be degraded to advertised/removed. Delete the task.
|
||||
olExecute.AddTail(new CMSITSCAOpTaskDelete(sDisplayName, MSITSCA_TASK_TICK_SIZE));
|
||||
olExecute.AddTail(new AMSICA::COpTaskDelete(sDisplayName, MSITSCA_TASK_TICK_SIZE));
|
||||
}
|
||||
|
||||
// The amount of tick space to add for each task to progress indicator.
|
||||
@ -151,8 +151,8 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
||||
verify(::MsiViewClose(hViewST) == ERROR_SUCCESS);
|
||||
|
||||
if (SUCCEEDED(uiResult)) {
|
||||
CString sSequenceFilename;
|
||||
CAtlFile fSequence;
|
||||
ATL::CAtlString sSequenceFilename;
|
||||
ATL::CAtlFile fSequence;
|
||||
|
||||
// Prepare our own sequence script file.
|
||||
// The InstallScheduledTasks is a deferred custom action, thus all this information will be unavailable to it.
|
||||
@ -171,7 +171,7 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
|
||||
uiResult = ::MsiSetProperty(hInstall, _T("InstallScheduledTasks"), sSequenceFilename);
|
||||
if (uiResult == ERROR_SUCCESS) {
|
||||
LPCTSTR pszExtension = ::PathFindExtension(sSequenceFilename);
|
||||
CString sSequenceFilename2;
|
||||
ATL::CAtlString sSequenceFilename2;
|
||||
|
||||
sSequenceFilename2.Format(_T("%.*ls-rb%ls"), pszExtension - (LPCTSTR)sSequenceFilename, (LPCTSTR)sSequenceFilename, pszExtension);
|
||||
uiResult = ::MsiSetProperty(hInstall, _T("RollbackScheduledTasks"), sSequenceFilename2);
|
||||
@ -235,16 +235,16 @@ UINT MSITSCA_API InstallScheduledTasks(MSIHANDLE hInstall)
|
||||
UINT uiResult;
|
||||
HRESULT hr;
|
||||
BOOL bIsCoInitialized = SUCCEEDED(::CoInitialize(NULL));
|
||||
CString sSequenceFilename;
|
||||
ATL::CAtlString sSequenceFilename;
|
||||
|
||||
uiResult = ::MsiGetProperty(hInstall, _T("CustomActionData"), sSequenceFilename);
|
||||
if (uiResult == ERROR_SUCCESS) {
|
||||
CMSITSCAOpList lstOperations;
|
||||
AMSICA::COpList lstOperations;
|
||||
|
||||
// Load operation sequence.
|
||||
hr = lstOperations.LoadFromFile(sSequenceFilename);
|
||||
if (SUCCEEDED(hr)) {
|
||||
CMSITSCASession session;
|
||||
AMSICA::CSession session;
|
||||
BOOL bIsCleanup = ::MsiGetMode(hInstall, MSIRUNMODE_COMMIT) || ::MsiGetMode(hInstall, MSIRUNMODE_ROLLBACK);
|
||||
|
||||
session.m_hInstall = hInstall;
|
||||
@ -258,24 +258,24 @@ UINT MSITSCA_API InstallScheduledTasks(MSIHANDLE hInstall)
|
||||
if (!bIsCleanup && session.m_bRollbackEnabled) {
|
||||
// Save cleanup scripts.
|
||||
LPCTSTR pszExtension = ::PathFindExtension(sSequenceFilename);
|
||||
CString sSequenceFilenameCM, sSequenceFilenameRB;
|
||||
ATL::CAtlString sSequenceFilenameCM, sSequenceFilenameRB;
|
||||
|
||||
sSequenceFilenameRB.Format(_T("%.*ls-rb%ls"), pszExtension - (LPCTSTR)sSequenceFilename, (LPCTSTR)sSequenceFilename, pszExtension);
|
||||
sSequenceFilenameCM.Format(_T("%.*ls-cm%ls"), pszExtension - (LPCTSTR)sSequenceFilename, (LPCTSTR)sSequenceFilename, pszExtension);
|
||||
|
||||
// After end of commit, delete rollback file too. After end of rollback, delete commit file too.
|
||||
session.m_olCommit.AddTail(new CMSITSCAOpFileDelete(
|
||||
session.m_olCommit.AddTail(new AMSICA::COpFileDelete(
|
||||
#ifdef _UNICODE
|
||||
sSequenceFilenameRB
|
||||
#else
|
||||
CStringW(sSequenceFilenameRB)
|
||||
ATL::CAtlStringW(sSequenceFilenameRB)
|
||||
#endif
|
||||
));
|
||||
session.m_olRollback.AddTail(new CMSITSCAOpFileDelete(
|
||||
session.m_olRollback.AddTail(new AMSICA::COpFileDelete(
|
||||
#ifdef _UNICODE
|
||||
sSequenceFilenameCM
|
||||
#else
|
||||
CStringW(sSequenceFilenameCM)
|
||||
ATL::CAtlStringW(sSequenceFilenameCM)
|
||||
#endif
|
||||
));
|
||||
|
||||
|
@ -6,14 +6,14 @@
|
||||
// Constants
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define MSITSCA_VERSION 0x01010000
|
||||
#define MSITSCA_VERSION 0x01010100
|
||||
|
||||
#define MSITSCA_VERSION_MAJ 1
|
||||
#define MSITSCA_VERSION_MIN 1
|
||||
#define MSITSCA_VERSION_REV 0
|
||||
#define MSITSCA_VERSION_REV 1
|
||||
|
||||
#define MSITSCA_VERSION_STR "1.1"
|
||||
#define MSITSCA_VERSION_INST "1.1.0.0"
|
||||
#define MSITSCA_VERSION_STR "1.1.1"
|
||||
#define MSITSCA_VERSION_INST "1.1.1.0"
|
||||
|
||||
|
||||
#if !defined(RC_INVOKED) && !defined(MIDL_PASS)
|
||||
@ -33,23 +33,6 @@
|
||||
#define MSITSCA_API
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Error codes (last unused 2561L)
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define ERROR_INSTALL_SCHEDULED_TASKS_DATABASE_OPEN 2550L
|
||||
#define ERROR_INSTALL_SCHEDULED_TASKS_OPLIST_CREATE 2551L
|
||||
#define ERROR_INSTALL_SCHEDULED_TASKS_SCRIPT_WRITE 2552L
|
||||
#define ERROR_INSTALL_SCHEDULED_TASKS_SCRIPT_READ 2560L
|
||||
#define ERROR_INSTALL_SCHEDULED_TASKS_PROPERTY_SET 2553L
|
||||
#define ERROR_INSTALL_DELETE_FAILED 2554L
|
||||
#define ERROR_INSTALL_MOVE_FAILED 2555L
|
||||
#define ERROR_INSTALL_TASK_CREATE_FAILED 2556L
|
||||
#define ERROR_INSTALL_TASK_DELETE_FAILED 2557L
|
||||
#define ERROR_INSTALL_TASK_ENABLE_FAILED 2558L
|
||||
#define ERROR_INSTALL_TASK_COPY_FAILED 2559L
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Exported functions
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -65,375 +48,6 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Local includes
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <atlfile.h>
|
||||
#include <atlstr.h>
|
||||
#include <assert.h>
|
||||
#include <msiquery.h>
|
||||
#include <mstask.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Inline Functions
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline UINT MsiGetPropertyA(MSIHANDLE hInstall, LPCSTR szName, CStringA &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the actual string length first.
|
||||
uiResult = ::MsiGetPropertyA(hInstall, szName, "", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to read the string data into and read it.
|
||||
LPSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiGetPropertyA(hInstall, szName, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == ERROR_SUCCESS) {
|
||||
// The string in database is empty.
|
||||
sValue.Empty();
|
||||
return ERROR_SUCCESS;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiGetPropertyW(MSIHANDLE hInstall, LPCWSTR szName, CStringW &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the actual string length first.
|
||||
uiResult = ::MsiGetPropertyW(hInstall, szName, L"", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to read the string data into and read it.
|
||||
LPWSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiGetPropertyW(hInstall, szName, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == ERROR_SUCCESS) {
|
||||
// The string in database is empty.
|
||||
sValue.Empty();
|
||||
return ERROR_SUCCESS;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiRecordGetStringA(MSIHANDLE hRecord, unsigned int iField, CStringA &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the actual string length first.
|
||||
uiResult = ::MsiRecordGetStringA(hRecord, iField, "", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to read the string data into and read it.
|
||||
LPSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiRecordGetStringA(hRecord, iField, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == ERROR_SUCCESS) {
|
||||
// The string in database is empty.
|
||||
sValue.Empty();
|
||||
return ERROR_SUCCESS;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiRecordGetStringW(MSIHANDLE hRecord, unsigned int iField, CStringW &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the actual string length first.
|
||||
uiResult = ::MsiRecordGetStringW(hRecord, iField, L"", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to read the string data into and read it.
|
||||
LPWSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiRecordGetStringW(hRecord, iField, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == ERROR_SUCCESS) {
|
||||
// The string in database is empty.
|
||||
sValue.Empty();
|
||||
return ERROR_SUCCESS;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiFormatRecordA(MSIHANDLE hInstall, MSIHANDLE hRecord, CStringA &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the final string length first.
|
||||
uiResult = ::MsiFormatRecordA(hInstall, hRecord, "", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to format the string data into and read it.
|
||||
LPSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiFormatRecordA(hInstall, hRecord, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == ERROR_SUCCESS) {
|
||||
// The result is empty.
|
||||
sValue.Empty();
|
||||
return ERROR_SUCCESS;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiFormatRecordW(MSIHANDLE hInstall, MSIHANDLE hRecord, CStringW &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the final string length first.
|
||||
uiResult = ::MsiFormatRecordW(hInstall, hRecord, L"", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to format the string data into and read it.
|
||||
LPWSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiFormatRecordW(hInstall, hRecord, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == ERROR_SUCCESS) {
|
||||
// The result is empty.
|
||||
sValue.Empty();
|
||||
return ERROR_SUCCESS;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiRecordFormatStringA(MSIHANDLE hInstall, MSIHANDLE hRecord, unsigned int iField, CStringA &sValue)
|
||||
{
|
||||
UINT uiResult;
|
||||
PMSIHANDLE hRecordEx;
|
||||
|
||||
// Read string to format.
|
||||
uiResult = ::MsiRecordGetStringA(hRecord, iField, sValue);
|
||||
if (uiResult != ERROR_SUCCESS) return uiResult;
|
||||
|
||||
// If the string is empty, there's nothing left to do.
|
||||
if (sValue.IsEmpty()) return ERROR_SUCCESS;
|
||||
|
||||
// Create a record.
|
||||
hRecordEx = ::MsiCreateRecord(1);
|
||||
if (!hRecordEx) return ERROR_INVALID_HANDLE;
|
||||
|
||||
// Populate record with data.
|
||||
uiResult = ::MsiRecordSetStringA(hRecordEx, 0, sValue);
|
||||
if (uiResult != ERROR_SUCCESS) return uiResult;
|
||||
|
||||
// Do the formatting.
|
||||
return ::MsiFormatRecordA(hInstall, hRecordEx, sValue);
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiRecordFormatStringW(MSIHANDLE hInstall, MSIHANDLE hRecord, unsigned int iField, CStringW &sValue)
|
||||
{
|
||||
UINT uiResult;
|
||||
PMSIHANDLE hRecordEx;
|
||||
|
||||
// Read string to format.
|
||||
uiResult = ::MsiRecordGetStringW(hRecord, iField, sValue);
|
||||
if (uiResult != ERROR_SUCCESS) return uiResult;
|
||||
|
||||
// If the string is empty, there's nothing left to do.
|
||||
if (sValue.IsEmpty()) return ERROR_SUCCESS;
|
||||
|
||||
// Create a record.
|
||||
hRecordEx = ::MsiCreateRecord(1);
|
||||
if (!hRecordEx) return ERROR_INVALID_HANDLE;
|
||||
|
||||
// Populate record with data.
|
||||
uiResult = ::MsiRecordSetStringW(hRecordEx, 0, sValue);
|
||||
if (uiResult != ERROR_SUCCESS) return uiResult;
|
||||
|
||||
// Do the formatting.
|
||||
return ::MsiFormatRecordW(hInstall, hRecordEx, sValue);
|
||||
}
|
||||
|
||||
#ifdef UNICODE
|
||||
#define MsiRecordFormatString MsiRecordFormatStringW
|
||||
#else
|
||||
#define MsiRecordFormatString MsiRecordFormatStringA
|
||||
#endif // !UNICODE
|
||||
|
||||
|
||||
inline UINT MsiGetTargetPathA(MSIHANDLE hInstall, LPCSTR szFolder, CStringA &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the final string length first.
|
||||
uiResult = ::MsiGetTargetPathA(hInstall, szFolder, "", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to format the string data into and read it.
|
||||
LPSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiGetTargetPathA(hInstall, szFolder, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == ERROR_SUCCESS) {
|
||||
// The result is empty.
|
||||
sValue.Empty();
|
||||
return ERROR_SUCCESS;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline UINT MsiGetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, CStringW &sValue)
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
UINT uiResult;
|
||||
|
||||
// Query the final string length first.
|
||||
uiResult = ::MsiGetTargetPathW(hInstall, szFolder, L"", &dwSize);
|
||||
if (uiResult == ERROR_MORE_DATA) {
|
||||
// Prepare the buffer to format the string data into and read it.
|
||||
LPWSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||
uiResult = ::MsiGetTargetPathW(hInstall, szFolder, szBuffer, &dwSize);
|
||||
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||
return uiResult;
|
||||
} else if (uiResult == ERROR_SUCCESS) {
|
||||
// The result is empty.
|
||||
sValue.Empty();
|
||||
return ERROR_SUCCESS;
|
||||
} else {
|
||||
// Return error code.
|
||||
return uiResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Inline operators
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline HRESULT operator <<(CAtlFile &f, int i)
|
||||
{
|
||||
return f.Write(&i, sizeof(int));
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator >>(CAtlFile &f, int &i)
|
||||
{
|
||||
return f.Read(&i, sizeof(int));
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator <<(CAtlFile &f, const CStringA &str)
|
||||
{
|
||||
HRESULT hr;
|
||||
int iLength = str.GetLength();
|
||||
|
||||
// Write string length (in characters) as 32-bit integer.
|
||||
hr = f.Write(&iLength, sizeof(int));
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
// Write string data (without terminator).
|
||||
return f.Write((LPCSTR)str, sizeof(CHAR) * iLength);
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator >>(CAtlFile &f, CStringA &str)
|
||||
{
|
||||
HRESULT hr;
|
||||
int iLength;
|
||||
LPSTR buf;
|
||||
|
||||
// Read string length (in characters) as 32-bit integer.
|
||||
hr = f.Read(&iLength, sizeof(int));
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
// Allocate the buffer.
|
||||
buf = str.GetBuffer(iLength);
|
||||
if (!buf) return E_OUTOFMEMORY;
|
||||
|
||||
// Read string data (without terminator).
|
||||
hr = f.Read(buf, sizeof(CHAR) * iLength);
|
||||
str.ReleaseBuffer(SUCCEEDED(hr) ? iLength : 0);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator <<(CAtlFile &f, const CStringW &str)
|
||||
{
|
||||
HRESULT hr;
|
||||
int iLength = str.GetLength();
|
||||
|
||||
// Write string length (in characters) as 32-bit integer.
|
||||
hr = f.Write(&iLength, sizeof(int));
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
// Write string data (without terminator).
|
||||
return f.Write((LPCWSTR)str, sizeof(WCHAR) * iLength);
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator >>(CAtlFile &f, CStringW &str)
|
||||
{
|
||||
HRESULT hr;
|
||||
int iLength;
|
||||
LPWSTR buf;
|
||||
|
||||
// Read string length (in characters) as 32-bit integer.
|
||||
hr = f.Read(&iLength, sizeof(int));
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
// Allocate the buffer.
|
||||
buf = str.GetBuffer(iLength);
|
||||
if (!buf) return E_OUTOFMEMORY;
|
||||
|
||||
// Read string data (without terminator).
|
||||
hr = f.Read(buf, sizeof(WCHAR) * iLength);
|
||||
str.ReleaseBuffer(SUCCEEDED(hr) ? iLength : 0);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator <<(CAtlFile &f, const TASK_TRIGGER &ttData)
|
||||
{
|
||||
return f.Write(&ttData, sizeof(TASK_TRIGGER));
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator >>(CAtlFile &f, TASK_TRIGGER &ttData)
|
||||
{
|
||||
return f.Read(&ttData, sizeof(TASK_TRIGGER));
|
||||
}
|
||||
|
||||
#endif // !defined(RC_INVOKED) && !defined(MIDL_PASS)
|
||||
|
||||
#endif // __MSITSCA_H__
|
||||
|
@ -162,6 +162,9 @@
|
||||
<ResourceLocalizator>
|
||||
<LanguageCatalogs>res\en_GB.po</LanguageCatalogs>
|
||||
</ResourceLocalizator>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\AMSICA\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Link>
|
||||
@ -174,6 +177,9 @@
|
||||
<ResourceLocalizator>
|
||||
<LanguageCatalogs>res\en_GB.po</LanguageCatalogs>
|
||||
</ResourceLocalizator>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\AMSICA\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Link>
|
||||
@ -186,6 +192,9 @@
|
||||
<ResourceLocalizator>
|
||||
<LanguageCatalogs>res\en_GB.po</LanguageCatalogs>
|
||||
</ResourceLocalizator>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\AMSICA\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Link>
|
||||
@ -198,6 +207,9 @@
|
||||
<ResourceLocalizator>
|
||||
<LanguageCatalogs>res\en_GB.po</LanguageCatalogs>
|
||||
</ResourceLocalizator>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\AMSICA\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">
|
||||
<Link>
|
||||
@ -210,6 +222,9 @@
|
||||
<ResourceLocalizator>
|
||||
<LanguageCatalogs>res\en_GB.po</LanguageCatalogs>
|
||||
</ResourceLocalizator>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\AMSICA\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">
|
||||
<Link>
|
||||
@ -222,6 +237,9 @@
|
||||
<ResourceLocalizator>
|
||||
<LanguageCatalogs>res\en_GB.po</LanguageCatalogs>
|
||||
</ResourceLocalizator>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\AMSICA\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">
|
||||
<Link>
|
||||
@ -234,6 +252,9 @@
|
||||
<ResourceLocalizator>
|
||||
<LanguageCatalogs>res\en_GB.po</LanguageCatalogs>
|
||||
</ResourceLocalizator>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\AMSICA\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">
|
||||
<Link>
|
||||
@ -246,10 +267,12 @@
|
||||
<ResourceLocalizator>
|
||||
<LanguageCatalogs>res\en_GB.po</LanguageCatalogs>
|
||||
</ResourceLocalizator>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\AMSICA\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="MSITSCA.cpp" />
|
||||
<ClCompile Include="MSITSCAOp.cpp" />
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
@ -263,7 +286,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="MSITSCA.h" />
|
||||
<ClInclude Include="MSITSCAOp.h" />
|
||||
<ClInclude Include="StdAfx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -275,6 +297,16 @@
|
||||
<ItemGroup>
|
||||
<None Include="res\en_GB.po" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AMSICA\AMSICALib\AMSICALib.vcxproj">
|
||||
<Project>{8552ee55-177e-4f51-b51b-baf7d6462cde}</Project>
|
||||
<Private>true</Private>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\rcxgettext.targets" />
|
||||
|
@ -21,9 +21,6 @@
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MSITSCAOp.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="MSITSCA.h">
|
||||
@ -32,9 +29,6 @@
|
||||
<ClInclude Include="StdAfx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MSITSCAOp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="res\MSITSCA.rc">
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,565 +0,0 @@
|
||||
#ifndef __MSITSCAOP_H__
|
||||
#define __MSITSCAOP_H__
|
||||
|
||||
#include "MSITSCA.h"
|
||||
#include <atlbase.h>
|
||||
#include <atlcoll.h>
|
||||
#include <atlfile.h>
|
||||
#include <atlstr.h>
|
||||
#include <msi.h>
|
||||
#include <mstask.h>
|
||||
#include <windows.h>
|
||||
|
||||
class CMSITSCASession;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CMSITSCAOp
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CMSITSCAOp
|
||||
{
|
||||
public:
|
||||
CMSITSCAOp(int iTicks = 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
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CMSITSCAOpTypeSingleString
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CMSITSCAOpTypeSingleString : public CMSITSCAOp
|
||||
{
|
||||
public:
|
||||
CMSITSCAOpTypeSingleString(LPCWSTR pszValue = L"", int iTicks = 0);
|
||||
|
||||
friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpTypeSingleString &op);
|
||||
friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpTypeSingleString &op);
|
||||
|
||||
protected:
|
||||
CStringW m_sValue;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CMSITSCAOpDoubleStringOperation
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CMSITSCAOpTypeSrcDstString : public CMSITSCAOp
|
||||
{
|
||||
public:
|
||||
CMSITSCAOpTypeSrcDstString(LPCWSTR pszValue1 = L"", LPCWSTR pszValue2 = L"", int iTicks = 0);
|
||||
|
||||
friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpTypeSrcDstString &op);
|
||||
friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpTypeSrcDstString &op);
|
||||
|
||||
protected:
|
||||
CStringW m_sValue1;
|
||||
CStringW m_sValue2;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CMSITSCAOpTypeBoolean
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CMSITSCAOpTypeBoolean : public CMSITSCAOp
|
||||
{
|
||||
public:
|
||||
CMSITSCAOpTypeBoolean(BOOL bValue = TRUE, int iTicks = 0);
|
||||
|
||||
friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpTypeBoolean &op);
|
||||
friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpTypeBoolean &op);
|
||||
|
||||
protected:
|
||||
BOOL m_bValue;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CMSITSCAOpRollbackEnable
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CMSITSCAOpRollbackEnable : public CMSITSCAOpTypeBoolean
|
||||
{
|
||||
public:
|
||||
CMSITSCAOpRollbackEnable(BOOL bEnable = TRUE, int iTicks = 0);
|
||||
virtual HRESULT Execute(CMSITSCASession *pSession);
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CMSITSCAOpFileDelete
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CMSITSCAOpFileDelete : public CMSITSCAOpTypeSingleString
|
||||
{
|
||||
public:
|
||||
CMSITSCAOpFileDelete(LPCWSTR pszFileName = L"", int iTicks = 0);
|
||||
virtual HRESULT Execute(CMSITSCASession *pSession);
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CMSITSCAOpFileMove
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CMSITSCAOpFileMove : public CMSITSCAOpTypeSrcDstString
|
||||
{
|
||||
public:
|
||||
CMSITSCAOpFileMove(LPCWSTR pszFileSrc = L"", LPCWSTR pszFileDst = L"", int iTicks = 0);
|
||||
virtual HRESULT Execute(CMSITSCASession *pSession);
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CMSITSCAOpTaskCreate
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CMSITSCAOpTaskCreate : public CMSITSCAOpTypeSingleString
|
||||
{
|
||||
public:
|
||||
CMSITSCAOpTaskCreate(LPCWSTR pszTaskName = L"", int iTicks = 0);
|
||||
virtual ~CMSITSCAOpTaskCreate();
|
||||
virtual HRESULT Execute(CMSITSCASession *pSession);
|
||||
|
||||
UINT SetFromRecord(MSIHANDLE hInstall, MSIHANDLE hRecord);
|
||||
UINT SetTriggersFromView(MSIHANDLE hView);
|
||||
|
||||
friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpTaskCreate &op);
|
||||
friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpTaskCreate &op);
|
||||
|
||||
protected:
|
||||
CStringW m_sApplicationName;
|
||||
CStringW m_sParameters;
|
||||
CStringW m_sWorkingDirectory;
|
||||
CStringW m_sAuthor;
|
||||
CStringW m_sComment;
|
||||
DWORD m_dwFlags;
|
||||
DWORD m_dwPriority;
|
||||
CStringW m_sAccountName;
|
||||
CStringW m_sPassword;
|
||||
WORD m_wIdleMinutes;
|
||||
WORD m_wDeadlineMinutes;
|
||||
DWORD m_dwMaxRuntimeMS;
|
||||
|
||||
CAtlList<TASK_TRIGGER> m_lTriggers;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CMSITSCAOpTaskDelete
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CMSITSCAOpTaskDelete : public CMSITSCAOpTypeSingleString
|
||||
{
|
||||
public:
|
||||
CMSITSCAOpTaskDelete(LPCWSTR pszTaskName = L"", int iTicks = 0);
|
||||
virtual HRESULT Execute(CMSITSCASession *pSession);
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CMSITSCAOpTaskEnable
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CMSITSCAOpTaskEnable : public CMSITSCAOpTypeSingleString
|
||||
{
|
||||
public:
|
||||
CMSITSCAOpTaskEnable(LPCWSTR pszTaskName = L"", BOOL bEnable = TRUE, int iTicks = 0);
|
||||
virtual HRESULT Execute(CMSITSCASession *pSession);
|
||||
|
||||
friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpTaskEnable &op);
|
||||
friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpTaskEnable &op);
|
||||
|
||||
protected:
|
||||
BOOL m_bEnable;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CMSITSCAOpTaskCopy
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CMSITSCAOpTaskCopy : public CMSITSCAOpTypeSrcDstString
|
||||
{
|
||||
public:
|
||||
CMSITSCAOpTaskCopy(LPCWSTR pszTaskSrc = L"", LPCWSTR pszTaskDst = L"", int iTicks = 0);
|
||||
virtual HRESULT Execute(CMSITSCASession *pSession);
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CMSITSCAOpList
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CMSITSCAOpList : public CMSITSCAOp, public CAtlList<CMSITSCAOp*>
|
||||
{
|
||||
public:
|
||||
CMSITSCAOpList(int iTicks = 0);
|
||||
|
||||
void Free();
|
||||
HRESULT LoadFromFile(LPCTSTR pszFileName);
|
||||
HRESULT SaveToFile(LPCTSTR pszFileName) const;
|
||||
|
||||
virtual HRESULT Execute(CMSITSCASession *pSession);
|
||||
|
||||
friend inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpList &op);
|
||||
friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpList &op);
|
||||
|
||||
protected:
|
||||
enum OPERATION {
|
||||
OPERATION_ENABLE_ROLLBACK = 1,
|
||||
OPERATION_DELETE_FILE,
|
||||
OPERATION_MOVE_FILE,
|
||||
OPERATION_CREATE_TASK,
|
||||
OPERATION_DELETE_TASK,
|
||||
OPERATION_ENABLE_TASK,
|
||||
OPERATION_COPY_TASK,
|
||||
OPERATION_SUBLIST
|
||||
};
|
||||
|
||||
protected:
|
||||
template <class T, int ID> inline static HRESULT Save(CAtlFile &f, const CMSITSCAOp *p);
|
||||
template <class T> inline HRESULT LoadAndAddTail(CAtlFile &f);
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CMSITSCASession
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CMSITSCASession
|
||||
{
|
||||
public:
|
||||
CMSITSCASession();
|
||||
|
||||
MSIHANDLE m_hInstall; // Installer handle
|
||||
BOOL m_bContinueOnError; // Continue execution on operation error?
|
||||
BOOL m_bRollbackEnabled; // Is rollback enabled?
|
||||
CMSITSCAOpList m_olRollback; // Rollback operation list
|
||||
CMSITSCAOpList m_olCommit; // Commit operation list
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// 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 CMSITSCAOpTypeSingleString &op)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = f << (const CMSITSCAOp &)op;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
return f << op.m_sValue;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpTypeSingleString &op)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = f >> (CMSITSCAOp &)op;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
return f >> op.m_sValue;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpTypeSrcDstString &op)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = f << (const CMSITSCAOp &)op;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
hr = f << op.m_sValue1;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
return f << op.m_sValue2;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpTypeSrcDstString &op)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = f >> (CMSITSCAOp &)op;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
hr = f >> op.m_sValue1;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
return f >> op.m_sValue2;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpTypeBoolean &op)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = f << (const CMSITSCAOp &)op;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
return f << (int)op.m_bValue;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpTypeBoolean &op)
|
||||
{
|
||||
int iValue;
|
||||
HRESULT hr;
|
||||
|
||||
hr = f >> (CMSITSCAOp &)op;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
hr = f >> iValue;
|
||||
if (FAILED(hr)) return hr;
|
||||
op.m_bValue = iValue ? TRUE : FALSE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpTaskCreate &op)
|
||||
{
|
||||
HRESULT hr;
|
||||
POSITION pos;
|
||||
|
||||
hr = f << (const CMSITSCAOpTypeSingleString&)op; if (FAILED(hr)) return hr;
|
||||
hr = f << op.m_sApplicationName; if (FAILED(hr)) return hr;
|
||||
hr = f << op.m_sParameters; if (FAILED(hr)) return hr;
|
||||
hr = f << op.m_sWorkingDirectory; if (FAILED(hr)) return hr;
|
||||
hr = f << op.m_sAuthor; if (FAILED(hr)) return hr;
|
||||
hr = f << op.m_sComment; if (FAILED(hr)) return hr;
|
||||
hr = f << (int)op.m_dwFlags; if (FAILED(hr)) return hr;
|
||||
hr = f << (int)op.m_dwPriority; if (FAILED(hr)) return hr;
|
||||
hr = f << op.m_sAccountName; if (FAILED(hr)) return hr;
|
||||
hr = f << op.m_sPassword; if (FAILED(hr)) return hr;
|
||||
hr = f << (int)MAKELONG(op.m_wDeadlineMinutes, op.m_wIdleMinutes); if (FAILED(hr)) return hr;
|
||||
hr = f << (int)op.m_dwMaxRuntimeMS; if (FAILED(hr)) return hr;
|
||||
hr = f << (int)op.m_lTriggers.GetCount(); if (FAILED(hr)) return hr;
|
||||
for (pos = op.m_lTriggers.GetHeadPosition(); pos;) {
|
||||
hr = f << op.m_lTriggers.GetNext(pos);
|
||||
if (FAILED(hr)) return hr;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpTaskCreate &op)
|
||||
{
|
||||
HRESULT hr;
|
||||
DWORD dwValue;
|
||||
|
||||
hr = f >> (CMSITSCAOpTypeSingleString&)op; if (FAILED(hr)) return hr;
|
||||
hr = f >> op.m_sApplicationName; if (FAILED(hr)) return hr;
|
||||
hr = f >> op.m_sParameters; if (FAILED(hr)) return hr;
|
||||
hr = f >> op.m_sWorkingDirectory; if (FAILED(hr)) return hr;
|
||||
hr = f >> op.m_sAuthor; if (FAILED(hr)) return hr;
|
||||
hr = f >> op.m_sComment; if (FAILED(hr)) return hr;
|
||||
hr = f >> (int&)op.m_dwFlags; if (FAILED(hr)) return hr;
|
||||
hr = f >> (int&)op.m_dwPriority; if (FAILED(hr)) return hr;
|
||||
hr = f >> op.m_sAccountName; if (FAILED(hr)) return hr;
|
||||
hr = f >> op.m_sPassword; if (FAILED(hr)) return hr;
|
||||
hr = f >> (int&)dwValue; if (FAILED(hr)) return hr; op.m_wIdleMinutes = HIWORD(dwValue); op.m_wDeadlineMinutes = LOWORD(dwValue);
|
||||
hr = f >> (int&)op.m_dwMaxRuntimeMS; if (FAILED(hr)) return hr;
|
||||
hr = f >> (int&)dwValue; if (FAILED(hr)) return hr;
|
||||
while (dwValue--) {
|
||||
TASK_TRIGGER ttData;
|
||||
hr = f >> ttData;
|
||||
if (FAILED(hr)) return hr;
|
||||
op.m_lTriggers.AddTail(ttData);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpTaskEnable &op)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = f << (const CMSITSCAOpTypeSingleString&)op;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
return f << (int)op.m_bEnable;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpTaskEnable &op)
|
||||
{
|
||||
HRESULT hr;
|
||||
int iTemp;
|
||||
|
||||
hr = f >> (CMSITSCAOpTypeSingleString&)op;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
hr = f >> iTemp;
|
||||
if (FAILED(hr)) return hr;
|
||||
op.m_bEnable = iTemp ? TRUE : FALSE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpList &list)
|
||||
{
|
||||
POSITION pos;
|
||||
HRESULT hr;
|
||||
|
||||
hr = f << (const CMSITSCAOp &)list;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
hr = f << (int)list.GetCount();
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
for (pos = list.GetHeadPosition(); pos;) {
|
||||
const CMSITSCAOp *pOp = list.GetNext(pos);
|
||||
if (dynamic_cast<const CMSITSCAOpRollbackEnable*>(pOp))
|
||||
hr = list.Save<CMSITSCAOpRollbackEnable, CMSITSCAOpList::OPERATION_ENABLE_ROLLBACK>(f, pOp);
|
||||
else if (dynamic_cast<const CMSITSCAOpFileDelete*>(pOp))
|
||||
hr = list.Save<CMSITSCAOpFileDelete, CMSITSCAOpList::OPERATION_DELETE_FILE>(f, pOp);
|
||||
else if (dynamic_cast<const CMSITSCAOpFileMove*>(pOp))
|
||||
hr = list.Save<CMSITSCAOpFileMove, CMSITSCAOpList::OPERATION_MOVE_FILE>(f, pOp);
|
||||
else if (dynamic_cast<const CMSITSCAOpTaskCreate*>(pOp))
|
||||
hr = list.Save<CMSITSCAOpTaskCreate, CMSITSCAOpList::OPERATION_CREATE_TASK>(f, pOp);
|
||||
else if (dynamic_cast<const CMSITSCAOpTaskDelete*>(pOp))
|
||||
hr = list.Save<CMSITSCAOpTaskDelete, CMSITSCAOpList::OPERATION_DELETE_TASK>(f, pOp);
|
||||
else if (dynamic_cast<const CMSITSCAOpTaskEnable*>(pOp))
|
||||
hr = list.Save<CMSITSCAOpTaskEnable, CMSITSCAOpList::OPERATION_ENABLE_TASK>(f, pOp);
|
||||
else if (dynamic_cast<const CMSITSCAOpTaskCopy*>(pOp))
|
||||
hr = list.Save<CMSITSCAOpTaskCopy, CMSITSCAOpList::OPERATION_COPY_TASK>(f, pOp);
|
||||
else if (dynamic_cast<const CMSITSCAOpList*>(pOp))
|
||||
hr = list.Save<CMSITSCAOpList, CMSITSCAOpList::OPERATION_SUBLIST>(f, pOp);
|
||||
else {
|
||||
// Unsupported type of operation.
|
||||
assert(0);
|
||||
hr = E_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (FAILED(hr)) return hr;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpList &list)
|
||||
{
|
||||
HRESULT hr;
|
||||
DWORD dwCount;
|
||||
|
||||
hr = f >> (CMSITSCAOp &)list;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
hr = f >> (int&)dwCount;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
while (dwCount--) {
|
||||
int iTemp;
|
||||
|
||||
hr = f >> iTemp;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
switch ((CMSITSCAOpList::OPERATION)iTemp) {
|
||||
case CMSITSCAOpList::OPERATION_ENABLE_ROLLBACK:
|
||||
hr = list.LoadAndAddTail<CMSITSCAOpRollbackEnable>(f);
|
||||
break;
|
||||
case CMSITSCAOpList::OPERATION_DELETE_FILE:
|
||||
hr = list.LoadAndAddTail<CMSITSCAOpFileDelete>(f);
|
||||
break;
|
||||
case CMSITSCAOpList::OPERATION_MOVE_FILE:
|
||||
hr = list.LoadAndAddTail<CMSITSCAOpFileMove>(f);
|
||||
break;
|
||||
case CMSITSCAOpList::OPERATION_CREATE_TASK:
|
||||
hr = list.LoadAndAddTail<CMSITSCAOpTaskCreate>(f);
|
||||
break;
|
||||
case CMSITSCAOpList::OPERATION_DELETE_TASK:
|
||||
hr = list.LoadAndAddTail<CMSITSCAOpTaskDelete>(f);
|
||||
break;
|
||||
case CMSITSCAOpList::OPERATION_ENABLE_TASK:
|
||||
hr = list.LoadAndAddTail<CMSITSCAOpTaskEnable>(f);
|
||||
break;
|
||||
case CMSITSCAOpList::OPERATION_COPY_TASK:
|
||||
hr = list.LoadAndAddTail<CMSITSCAOpTaskCopy>(f);
|
||||
break;
|
||||
case CMSITSCAOpList::OPERATION_SUBLIST:
|
||||
hr = list.LoadAndAddTail<CMSITSCAOpList>(f);
|
||||
break;
|
||||
default:
|
||||
// Unsupported type of operation.
|
||||
assert(0);
|
||||
hr = E_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (FAILED(hr)) return hr;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Inline methods
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class T, int ID> inline static HRESULT CMSITSCAOpList::Save(CAtlFile &f, const CMSITSCAOp *p)
|
||||
{
|
||||
assert(p);
|
||||
HRESULT hr;
|
||||
const T *pp = dynamic_cast<const T*>(p);
|
||||
if (!pp) return E_UNEXPECTED;
|
||||
|
||||
hr = f << (int)ID;
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
return f << *pp;
|
||||
}
|
||||
|
||||
|
||||
template <class T> inline HRESULT CMSITSCAOpList::LoadAndAddTail(CAtlFile &f)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
// Create element.
|
||||
T *p = new T();
|
||||
if (!p) return E_OUTOFMEMORY;
|
||||
|
||||
// Load element from file.
|
||||
hr = f >> *p;
|
||||
if (FAILED(hr)) {
|
||||
delete p;
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Add element.
|
||||
AddTail(p);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#endif // __MSITSCAOP_H__
|
@ -23,27 +23,20 @@
|
||||
#define MSITSCA_DLL // This is a DLL
|
||||
#endif
|
||||
#define _ATL_APARTMENT_THREADED
|
||||
#define _ATL_NO_AUTOMATIC_NAMESPACE
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // Some CString constructors will be explicit
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <atlfile.h>
|
||||
#include <atlstr.h>
|
||||
|
||||
using namespace ATL;
|
||||
|
||||
#include "BuildNum.h"
|
||||
|
||||
#include "MSITSCA.h"
|
||||
#include "MSITSCAOp.h"
|
||||
|
||||
#include "AMSICA.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <corerror.h>
|
||||
#include <msi.h>
|
||||
#include <msiquery.h>
|
||||
#include <mstask.h>
|
||||
#include <stdlib.h>
|
||||
#include <taskschd.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef NDEBUG
|
||||
|
@ -136,12 +136,6 @@ i2 L0
|
||||
2551 Pri pripravi seznama razvrščenih opravil je prišlo do napake [2]. Obrnite se na svojo tehnično službo.
|
||||
2552 Pri pisanju v datoteko seznama razporejenih opravil »[2]« je prišlo do napake [3]. Obrnite se na svojo tehnično službo.
|
||||
2553 Pri nastavljanju parametra »[2]« je prišlo do napake [3]. Obrnite se na svojo tehnično službo.
|
||||
2554 Pri brisanju datoteke »[2]« je prišlo do napake [3]. Obrnite se na svojo tehnično službo.
|
||||
2555 Pri premikanju datoteke »[2]« v »[3]« je prišlo do napake [4]. Obrnite se na svojo tehnično službo.
|
||||
2556 Pri ustvarjanju razporejenega opravila »[2]« je prišlo do napake [3]. Obrnite se na svojo tehnično službo.
|
||||
2557 Pri brisanju razporejenega opravila »[2]« je prišlo do napake [3]. Obrnite se na svojo tehnično službo.
|
||||
2558 Pri o(ne)mogočanju razporejenega opravila »[2]« je prišlo do napake [3]. Obrnite se na svojo tehnično službo.
|
||||
2559 Pri kopiranju razporejenega opravila »[2]« v »[3]« je prišlo do napake [4]. Obrnite se na svojo tehnično službo.
|
||||
2560 Pri branju iz datoteke seznama razporejenih opravil »[2]« je prišlo do napake [3]. Obrnite se na svojo tehnično službo.
|
||||
<<NOKEEP
|
||||
|
||||
|
@ -2,7 +2,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: MSITSCA\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2013-03-19 15:23+0100\n"
|
||||
"POT-Creation-Date: 2013-04-26 11:07+0100\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
|
||||
"Language-Team: Amebis, d. o. o., Kamnik <simon.rozman@amebis.si>\n"
|
||||
@ -70,8 +70,7 @@ msgstr "SUBLANG_DEFAULT"
|
||||
msgid "Vse pravice pridržane © Amebis, d. o. o., Kamnik, 2012"
|
||||
msgstr "Copyright © Amebis, d. o. o., Kamnik, 2012"
|
||||
|
||||
# !!! Lektorirati !!!
|
||||
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:14 ..\msm/Sl.DebugU.x64.Error-2.idtx:14
|
||||
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:8 ..\msm/Sl.DebugU.x64.Error-2.idtx:8
|
||||
msgid ""
|
||||
"Pri branju iz datoteke seznama razporejenih opravil »[2]« je prišlo do "
|
||||
"napake [3]. Obrnite se na svojo tehnično službo."
|
||||
@ -79,33 +78,6 @@ msgstr ""
|
||||
"Error [3] reading from \"[2]\" scheduled task list file. Please, contact "
|
||||
"your support personnel."
|
||||
|
||||
# !!! Lektorirati !!!
|
||||
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:8 ..\msm/Sl.DebugU.x64.Error-2.idtx:8
|
||||
msgid ""
|
||||
"Pri brisanju datoteke »[2]« je prišlo do napake [3]. Obrnite se na svojo "
|
||||
"tehnično službo."
|
||||
msgstr ""
|
||||
"Error [3] deleting \"[2]\" file. Please, contact your support personnel."
|
||||
|
||||
# !!! Lektorirati !!!
|
||||
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:11 ..\msm/Sl.DebugU.x64.Error-2.idtx:11
|
||||
msgid ""
|
||||
"Pri brisanju razporejenega opravila »[2]« je prišlo do napake [3]. Obrnite "
|
||||
"se na svojo tehnično službo."
|
||||
msgstr ""
|
||||
"Error [3] deleting \"[2]\" scheduled task. Please, contact your support "
|
||||
"personnel."
|
||||
|
||||
# !!! Lektorirati !!!
|
||||
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:13 ..\msm/Sl.DebugU.x64.Error-2.idtx:13
|
||||
msgid ""
|
||||
"Pri kopiranju razporejenega opravila »[2]« v »[3]« je prišlo do napake [4]. "
|
||||
"Obrnite se na svojo tehnično službo."
|
||||
msgstr ""
|
||||
"Error [4] copying \"[2]\" scheduled task to \"[3]\". Please, contact your "
|
||||
"support personnel."
|
||||
|
||||
# !!! Lektorirati !!!
|
||||
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:7 ..\msm/Sl.DebugU.x64.Error-2.idtx:7
|
||||
msgid ""
|
||||
"Pri nastavljanju parametra »[2]« je prišlo do napake [3]. Obrnite se na "
|
||||
@ -113,16 +85,6 @@ msgid ""
|
||||
msgstr ""
|
||||
"Error [3] setting \"[2]\" parameter. Please, contact your support personnel."
|
||||
|
||||
# !!! Lektorirati !!!
|
||||
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:12 ..\msm/Sl.DebugU.x64.Error-2.idtx:12
|
||||
msgid ""
|
||||
"Pri o(ne)mogočanju razporejenega opravila »[2]« je prišlo do napake [3]. "
|
||||
"Obrnite se na svojo tehnično službo."
|
||||
msgstr ""
|
||||
"Error [3] enabling/disabling \"[2]\" scheduled task. Please, contact your "
|
||||
"support personnel."
|
||||
|
||||
# !!! Lektorirati !!!
|
||||
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:4 ..\msm/Sl.DebugU.x64.Error-2.idtx:4
|
||||
msgid ""
|
||||
"Pri odpiranju namestitvenega paketa je prišlo do napake. Obrnite se na svojo "
|
||||
@ -130,7 +92,6 @@ msgid ""
|
||||
msgstr ""
|
||||
"Error opening installation package. Please, contact your support personnel."
|
||||
|
||||
# !!! Lektorirati !!!
|
||||
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:6 ..\msm/Sl.DebugU.x64.Error-2.idtx:6
|
||||
msgid ""
|
||||
"Pri pisanju v datoteko seznama razporejenih opravil »[2]« je prišlo do "
|
||||
@ -139,16 +100,6 @@ msgstr ""
|
||||
"Error [3] writing to \"[2]\" scheduled task list file. Please, contact your "
|
||||
"support personnel."
|
||||
|
||||
# !!! Lektorirati !!!
|
||||
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:9 ..\msm/Sl.DebugU.x64.Error-2.idtx:9
|
||||
msgid ""
|
||||
"Pri premikanju datoteke »[2]« v »[3]« je prišlo do napake [4]. Obrnite se na "
|
||||
"svojo tehnično službo."
|
||||
msgstr ""
|
||||
"Error [4] moving \"[2]\" file to \"[3]\". Please, contact your support "
|
||||
"personnel."
|
||||
|
||||
# !!! Lektorirati !!!
|
||||
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:5 ..\msm/Sl.DebugU.x64.Error-2.idtx:5
|
||||
msgid ""
|
||||
"Pri pripravi seznama razvrščenih opravil je prišlo do napake [2]. Obrnite se "
|
||||
@ -157,22 +108,11 @@ msgstr ""
|
||||
"Error [2] creating scheduled task list. Please, contact your support "
|
||||
"personnel."
|
||||
|
||||
# !!! Lektorirati !!!
|
||||
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:10 ..\msm/Sl.DebugU.x64.Error-2.idtx:10
|
||||
msgid ""
|
||||
"Pri ustvarjanju razporejenega opravila »[2]« je prišlo do napake [3]. "
|
||||
"Obrnite se na svojo tehnično službo."
|
||||
msgstr ""
|
||||
"Error [3] creating \"[2]\" scheduled task. Please, contact your support "
|
||||
"personnel."
|
||||
|
||||
# !!! Lektorirati !!!
|
||||
#: ..\msm/Sl.DebugU.Win32.ActionText-2.idtx:4
|
||||
#: ..\msm/Sl.DebugU.x64.ActionText-2.idtx:4
|
||||
msgid "Razporejeno opravilo: [1]"
|
||||
msgstr "Scheduled task: [1]"
|
||||
|
||||
# !!! Lektorirati !!!
|
||||
#: ..\msm/Sl.DebugU.Win32.ActionText-2.idtx:4
|
||||
#: ..\msm/Sl.DebugU.x64.ActionText-2.idtx:4
|
||||
msgid "Registracija razporejenih opravil"
|
||||
|
Loading…
x
Reference in New Issue
Block a user