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.1.1.
This commit is contained in:
parent
cc4ced2358
commit
3a55262012
@ -5,13 +5,13 @@
|
|||||||
// Version
|
// Version
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define AMSICA_VERSION 0x01010000
|
#define AMSICA_VERSION 0x01010100
|
||||||
|
|
||||||
#define AMSICA_VERSION_MAJ 1
|
#define AMSICA_VERSION_MAJ 1
|
||||||
#define AMSICA_VERSION_MIN 1
|
#define AMSICA_VERSION_MIN 1
|
||||||
#define AMSICA_VERSION_REV 0
|
#define AMSICA_VERSION_REV 1
|
||||||
|
|
||||||
#define AMSICA_VERSION_STR "1.1"
|
#define AMSICA_VERSION_STR "1.1.1"
|
||||||
|
|
||||||
|
|
||||||
#if !defined(RC_INVOKED) && !defined(MIDL_PASS)
|
#if !defined(RC_INVOKED) && !defined(MIDL_PASS)
|
||||||
@ -477,7 +477,6 @@ public:
|
|||||||
|
|
||||||
#include <atlfile.h>
|
#include <atlfile.h>
|
||||||
#include <atlstr.h>
|
#include <atlstr.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <msiquery.h>
|
#include <msiquery.h>
|
||||||
#include <mstask.h>
|
#include <mstask.h>
|
||||||
|
|
||||||
@ -791,8 +790,6 @@ inline HRESULT operator >>(ATL::CAtlFile &f, DWORDLONG &i)
|
|||||||
template <class E>
|
template <class E>
|
||||||
inline HRESULT operator <<(ATL::CAtlFile &f, const ATL::CAtlArray<E> &a)
|
inline HRESULT operator <<(ATL::CAtlFile &f, const ATL::CAtlArray<E> &a)
|
||||||
{
|
{
|
||||||
assert(a.GetCount() <= INT_MAX);
|
|
||||||
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
DWORD dwCount = (DWORD)a.GetCount(), dwWritten;
|
DWORD dwCount = (DWORD)a.GetCount(), dwWritten;
|
||||||
|
|
||||||
@ -1116,7 +1113,7 @@ inline HRESULT operator <<(ATL::CAtlFile &f, const COpRegValueCreate &op)
|
|||||||
case REG_DWORD_BIG_ENDIAN: hr = f << (int)(op.m_dwData); if (FAILED(hr)) return hr; break;
|
case REG_DWORD_BIG_ENDIAN: hr = f << (int)(op.m_dwData); if (FAILED(hr)) return hr; break;
|
||||||
case REG_MULTI_SZ: hr = f << op.m_szData; if (FAILED(hr)) return hr; break;
|
case REG_MULTI_SZ: hr = f << op.m_szData; if (FAILED(hr)) return hr; break;
|
||||||
case REG_QWORD_LITTLE_ENDIAN: hr = f << op.m_qwData; if (FAILED(hr)) return hr; break;
|
case REG_QWORD_LITTLE_ENDIAN: hr = f << op.m_qwData; if (FAILED(hr)) return hr; break;
|
||||||
default: assert(0); return E_UNEXPECTED;
|
default: return E_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -1138,7 +1135,7 @@ inline HRESULT operator >>(ATL::CAtlFile &f, COpRegValueCreate &op)
|
|||||||
case REG_DWORD_BIG_ENDIAN: hr = f >> (int&)(op.m_dwData); if (FAILED(hr)) return hr; break;
|
case REG_DWORD_BIG_ENDIAN: hr = f >> (int&)(op.m_dwData); if (FAILED(hr)) return hr; break;
|
||||||
case REG_MULTI_SZ: hr = f >> op.m_szData; if (FAILED(hr)) return hr; break;
|
case REG_MULTI_SZ: hr = f >> op.m_szData; if (FAILED(hr)) return hr; break;
|
||||||
case REG_QWORD_LITTLE_ENDIAN: hr = f >> op.m_qwData; if (FAILED(hr)) return hr; break;
|
case REG_QWORD_LITTLE_ENDIAN: hr = f >> op.m_qwData; if (FAILED(hr)) return hr; break;
|
||||||
default: assert(0); return E_UNEXPECTED;
|
default: return E_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -1267,7 +1264,6 @@ inline HRESULT operator <<(ATL::CAtlFile &f, const COpList &list)
|
|||||||
hr = list.Save<COpList, COpList::OP_SUBLIST>(f, pOp);
|
hr = list.Save<COpList, COpList::OP_SUBLIST>(f, pOp);
|
||||||
else {
|
else {
|
||||||
// Unsupported type of operation.
|
// Unsupported type of operation.
|
||||||
assert(0);
|
|
||||||
hr = E_UNEXPECTED;
|
hr = E_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1340,7 +1336,6 @@ inline HRESULT operator >>(ATL::CAtlFile &f, COpList &list)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Unsupported type of operation.
|
// Unsupported type of operation.
|
||||||
assert(0);
|
|
||||||
hr = E_UNEXPECTED;
|
hr = E_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1395,7 +1390,6 @@ inline BOOL IsWow64Process()
|
|||||||
|
|
||||||
template <class T, enum COpList::OPERATION ID> inline static HRESULT COpList::Save(ATL::CAtlFile &f, const COperation *p)
|
template <class T, enum COpList::OPERATION ID> inline static HRESULT COpList::Save(ATL::CAtlFile &f, const COperation *p)
|
||||||
{
|
{
|
||||||
assert(p);
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
const T *pp = dynamic_cast<const T*>(p);
|
const T *pp = dynamic_cast<const T*>(p);
|
||||||
if (!pp) return E_UNEXPECTED;
|
if (!pp) return E_UNEXPECTED;
|
||||||
|
@ -38,9 +38,3 @@
|
|||||||
#include <msiquery.h>
|
#include <msiquery.h>
|
||||||
#include <mstask.h>
|
#include <mstask.h>
|
||||||
#include <taskschd.h>
|
#include <taskschd.h>
|
||||||
|
|
||||||
#ifdef NDEBUG
|
|
||||||
#define verify(expr) ((void)(expr))
|
|
||||||
#else
|
|
||||||
#define verify(expr) assert(expr)
|
|
||||||
#endif
|
|
||||||
|
@ -61,8 +61,6 @@ COpRollbackEnable::COpRollbackEnable(BOOL bEnable, int iTicks) :
|
|||||||
|
|
||||||
HRESULT COpRollbackEnable::Execute(CSession *pSession)
|
HRESULT COpRollbackEnable::Execute(CSession *pSession)
|
||||||
{
|
{
|
||||||
assert(pSession);
|
|
||||||
|
|
||||||
pSession->m_bRollbackEnabled = m_bValue;
|
pSession->m_bRollbackEnabled = m_bValue;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -100,7 +98,6 @@ void COpList::Free()
|
|||||||
|
|
||||||
HRESULT COpList::LoadFromFile(LPCTSTR pszFileName)
|
HRESULT COpList::LoadFromFile(LPCTSTR pszFileName)
|
||||||
{
|
{
|
||||||
assert(pszFileName);
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
ATL::CAtlFile fSequence;
|
ATL::CAtlFile fSequence;
|
||||||
|
|
||||||
@ -114,7 +111,6 @@ HRESULT COpList::LoadFromFile(LPCTSTR pszFileName)
|
|||||||
|
|
||||||
HRESULT COpList::SaveToFile(LPCTSTR pszFileName) const
|
HRESULT COpList::SaveToFile(LPCTSTR pszFileName) const
|
||||||
{
|
{
|
||||||
assert(pszFileName);
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
ATL::CAtlFile fSequence;
|
ATL::CAtlFile fSequence;
|
||||||
|
|
||||||
@ -132,24 +128,22 @@ HRESULT COpList::SaveToFile(LPCTSTR pszFileName) const
|
|||||||
|
|
||||||
HRESULT COpList::Execute(CSession *pSession)
|
HRESULT COpList::Execute(CSession *pSession)
|
||||||
{
|
{
|
||||||
assert(pSession);
|
|
||||||
POSITION pos;
|
POSITION pos;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
||||||
|
|
||||||
// Tell the installer to use explicit progress messages.
|
// Tell the installer to use explicit progress messages.
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, 1) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, 1);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 2, 1) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 2, 1);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 3, 0) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 3, 0);
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg);
|
||||||
|
|
||||||
// Prepare hRecordProg for progress messages.
|
// Prepare hRecordProg for progress messages.
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, 2) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, 2);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 3, 0) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 3, 0);
|
||||||
|
|
||||||
for (pos = GetHeadPosition(); pos;) {
|
for (pos = GetHeadPosition(); pos;) {
|
||||||
COperation *pOp = GetNext(pos);
|
COperation *pOp = GetNext(pos);
|
||||||
assert(pOp);
|
|
||||||
|
|
||||||
hr = pOp->Execute(pSession);
|
hr = pOp->Execute(pSession);
|
||||||
if (!pSession->m_bContinueOnError && FAILED(hr)) {
|
if (!pSession->m_bContinueOnError && FAILED(hr)) {
|
||||||
@ -158,12 +152,12 @@ HRESULT COpList::Execute(CSession *pSession)
|
|||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 2, pOp->m_iTicks) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 2, pOp->m_iTicks);
|
||||||
if (::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg) == IDCANCEL)
|
if (::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg) == IDCANCEL)
|
||||||
return AtlHresultFromWin32(ERROR_INSTALL_USEREXIT);
|
return AtlHresultFromWin32(ERROR_INSTALL_USEREXIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 2, m_iTicks) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 2, m_iTicks);
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -15,7 +15,6 @@ COpFileDelete::COpFileDelete(LPCWSTR pszFileName, int iTicks) :
|
|||||||
|
|
||||||
HRESULT COpFileDelete::Execute(CSession *pSession)
|
HRESULT COpFileDelete::Execute(CSession *pSession)
|
||||||
{
|
{
|
||||||
assert(pSession);
|
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
|
||||||
if (pSession->m_bRollbackEnabled) {
|
if (pSession->m_bRollbackEnabled) {
|
||||||
@ -43,9 +42,9 @@ HRESULT COpFileDelete::Execute(CSession *pSession)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
else {
|
else {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_FILE_DELETE_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_FILE_DELETE_FAILED);
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 2, m_sValue ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 2, m_sValue );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 3, dwError ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 3, dwError );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
return AtlHresultFromWin32(dwError);
|
return AtlHresultFromWin32(dwError);
|
||||||
}
|
}
|
||||||
@ -64,7 +63,6 @@ COpFileMove::COpFileMove(LPCWSTR pszFileSrc, LPCWSTR pszFileDst, int iTicks) :
|
|||||||
|
|
||||||
HRESULT COpFileMove::Execute(CSession *pSession)
|
HRESULT COpFileMove::Execute(CSession *pSession)
|
||||||
{
|
{
|
||||||
assert(pSession);
|
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
|
||||||
// Move the file.
|
// Move the file.
|
||||||
@ -78,10 +76,10 @@ HRESULT COpFileMove::Execute(CSession *pSession)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
} else {
|
} else {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(4);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(4);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_FILE_MOVE_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_FILE_MOVE_FAILED);
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 2, m_sValue1 ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 2, m_sValue1 );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 3, m_sValue2 ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 3, m_sValue2 );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 4, dwError ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 4, dwError );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
return AtlHresultFromWin32(dwError);
|
return AtlHresultFromWin32(dwError);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ HRESULT COpTaskCreate::Execute(CSession *pSession)
|
|||||||
POSITION pos;
|
POSITION pos;
|
||||||
|
|
||||||
// Display our custom message in the progress bar.
|
// Display our custom message in the progress bar.
|
||||||
verify(::MsiRecordSetStringW(hRecordMsg, 1, m_sValue) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordMsg, 1, m_sValue);
|
||||||
if (MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ACTIONDATA, hRecordMsg) == IDCANCEL)
|
if (MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ACTIONDATA, hRecordMsg) == IDCANCEL)
|
||||||
return AtlHresultFromWin32(ERROR_INSTALL_USEREXIT);
|
return AtlHresultFromWin32(ERROR_INSTALL_USEREXIT);
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ HRESULT COpTaskCreate::Execute(CSession *pSession)
|
|||||||
stValue.wYear = ttData.wBeginYear;
|
stValue.wYear = ttData.wBeginYear;
|
||||||
stValue.wMonth = ttData.wBeginMonth;
|
stValue.wMonth = ttData.wBeginMonth;
|
||||||
stValue.wDay = ttData.wBeginDay;
|
stValue.wDay = ttData.wBeginDay;
|
||||||
verify(::SystemTimeToFileTime(&stValue, &ftValue));
|
::SystemTimeToFileTime(&stValue, &ftValue);
|
||||||
ullValue = ((ULONGLONG)(ftValue.dwHighDateTime) << 32) | ftValue.dwLowDateTime;
|
ullValue = ((ULONGLONG)(ftValue.dwHighDateTime) << 32) | ftValue.dwLowDateTime;
|
||||||
|
|
||||||
// Wrap days.
|
// Wrap days.
|
||||||
@ -408,7 +408,7 @@ HRESULT COpTaskCreate::Execute(CSession *pSession)
|
|||||||
// Convert numerical date to DMY (ULONGLONG -> FILETIME -> SYSTEMTIME).
|
// Convert numerical date to DMY (ULONGLONG -> FILETIME -> SYSTEMTIME).
|
||||||
ftValue.dwHighDateTime = ullValue >> 32;
|
ftValue.dwHighDateTime = ullValue >> 32;
|
||||||
ftValue.dwLowDateTime = ullValue & 0xffffffff;
|
ftValue.dwLowDateTime = ullValue & 0xffffffff;
|
||||||
verify(::FileTimeToSystemTime(&ftValue, &stValue));
|
::FileTimeToSystemTime(&ftValue, &stValue);
|
||||||
|
|
||||||
// Set new trigger date and time.
|
// Set new trigger date and time.
|
||||||
ttData.wBeginYear = stValue.wYear;
|
ttData.wBeginYear = stValue.wYear;
|
||||||
@ -431,9 +431,9 @@ HRESULT COpTaskCreate::Execute(CSession *pSession)
|
|||||||
finish:
|
finish:
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_TASK_CREATE_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_TASK_CREATE_FAILED);
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 2, m_sValue ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 2, m_sValue );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 3, hr ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 3, hr );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
@ -634,7 +634,6 @@ COpTaskDelete::COpTaskDelete(LPCWSTR pszTaskName, int iTicks) :
|
|||||||
|
|
||||||
HRESULT COpTaskDelete::Execute(CSession *pSession)
|
HRESULT COpTaskDelete::Execute(CSession *pSession)
|
||||||
{
|
{
|
||||||
assert(pSession);
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
CComPtr<ITaskService> pService;
|
CComPtr<ITaskService> pService;
|
||||||
|
|
||||||
@ -802,9 +801,9 @@ HRESULT COpTaskDelete::Execute(CSession *pSession)
|
|||||||
finish:
|
finish:
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_TASK_DELETE_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_TASK_DELETE_FAILED);
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 2, m_sValue ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 2, m_sValue );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 3, hr ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 3, hr );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
@ -824,7 +823,6 @@ COpTaskEnable::COpTaskEnable(LPCWSTR pszTaskName, BOOL bEnable, int iTicks) :
|
|||||||
|
|
||||||
HRESULT COpTaskEnable::Execute(CSession *pSession)
|
HRESULT COpTaskEnable::Execute(CSession *pSession)
|
||||||
{
|
{
|
||||||
assert(pSession);
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
CComPtr<ITaskService> pService;
|
CComPtr<ITaskService> pService;
|
||||||
|
|
||||||
@ -923,9 +921,9 @@ HRESULT COpTaskEnable::Execute(CSession *pSession)
|
|||||||
finish:
|
finish:
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_TASK_ENABLE_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_TASK_ENABLE_FAILED);
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 2, m_sValue ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 2, m_sValue );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 3, hr ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 3, hr );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
@ -944,7 +942,6 @@ COpTaskCopy::COpTaskCopy(LPCWSTR pszTaskSrc, LPCWSTR pszTaskDst, int iTicks) :
|
|||||||
|
|
||||||
HRESULT COpTaskCopy::Execute(CSession *pSession)
|
HRESULT COpTaskCopy::Execute(CSession *pSession)
|
||||||
{
|
{
|
||||||
assert(pSession);
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
CComPtr<ITaskService> pService;
|
CComPtr<ITaskService> pService;
|
||||||
|
|
||||||
@ -1029,10 +1026,10 @@ HRESULT COpTaskCopy::Execute(CSession *pSession)
|
|||||||
finish:
|
finish:
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(4);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(4);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_TASK_COPY_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_TASK_COPY_FAILED);
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 2, m_sValue1 ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 2, m_sValue1 );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 3, m_sValue2 ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 3, m_sValue2 );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 4, hr ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 4, hr );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -37,7 +37,6 @@ COpRegKeyCreate::COpRegKeyCreate(HKEY hKeyRoot, LPCWSTR pszKeyName, int iTicks)
|
|||||||
|
|
||||||
HRESULT COpRegKeyCreate::Execute(CSession *pSession)
|
HRESULT COpRegKeyCreate::Execute(CSession *pSession)
|
||||||
{
|
{
|
||||||
assert(pSession);
|
|
||||||
LONG lResult;
|
LONG lResult;
|
||||||
REGSAM samAdditional = 0;
|
REGSAM samAdditional = 0;
|
||||||
ATL::CAtlStringW sPartialName;
|
ATL::CAtlStringW sPartialName;
|
||||||
@ -72,10 +71,10 @@ HRESULT COpRegKeyCreate::Execute(CSession *pSession)
|
|||||||
// Create the key.
|
// Create the key.
|
||||||
lResult = ::RegCreateKeyExW(m_hKeyRoot, sPartialName, NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_ENUMERATE_SUB_KEYS | samAdditional, NULL, &hKey, NULL);
|
lResult = ::RegCreateKeyExW(m_hKeyRoot, sPartialName, NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_ENUMERATE_SUB_KEYS | samAdditional, NULL, &hKey, NULL);
|
||||||
if (lResult != ERROR_SUCCESS) break;
|
if (lResult != ERROR_SUCCESS) break;
|
||||||
verify(::RegCloseKey(hKey) == ERROR_SUCCESS);
|
::RegCloseKey(hKey);
|
||||||
} else if (lResult == ERROR_SUCCESS) {
|
} else if (lResult == ERROR_SUCCESS) {
|
||||||
// This key already exists. Release its handle and continue.
|
// This key already exists. Release its handle and continue.
|
||||||
verify(::RegCloseKey(hKey) == ERROR_SUCCESS);
|
::RegCloseKey(hKey);
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -87,10 +86,10 @@ HRESULT COpRegKeyCreate::Execute(CSession *pSession)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
else {
|
else {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(4);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(4);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_CREATE_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_CREATE_FAILED);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 3, m_sValue ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 3, m_sValue );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 4, lResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 4, lResult );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
return AtlHresultFromWin32(lResult);
|
return AtlHresultFromWin32(lResult);
|
||||||
}
|
}
|
||||||
@ -108,7 +107,6 @@ COpRegKeyCopy::COpRegKeyCopy(HKEY hKeyRoot, LPCWSTR pszKeyNameSrc, LPCWSTR pszKe
|
|||||||
|
|
||||||
HRESULT COpRegKeyCopy::Execute(CSession *pSession)
|
HRESULT COpRegKeyCopy::Execute(CSession *pSession)
|
||||||
{
|
{
|
||||||
assert(pSession);
|
|
||||||
LONG lResult;
|
LONG lResult;
|
||||||
REGSAM samAdditional = 0;
|
REGSAM samAdditional = 0;
|
||||||
|
|
||||||
@ -139,11 +137,11 @@ HRESULT COpRegKeyCopy::Execute(CSession *pSession)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
else {
|
else {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(5);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(5);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_COPY_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_COPY_FAILED);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 3, m_sValue1 ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 3, m_sValue1 );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 4, m_sValue2 ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 4, m_sValue2 );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 5, lResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 5, lResult );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
return AtlHresultFromWin32(lResult);
|
return AtlHresultFromWin32(lResult);
|
||||||
}
|
}
|
||||||
@ -293,7 +291,6 @@ COpRegKeyDelete::COpRegKeyDelete(HKEY hKey, LPCWSTR pszKeyName, int iTicks) : CO
|
|||||||
|
|
||||||
HRESULT COpRegKeyDelete::Execute(CSession *pSession)
|
HRESULT COpRegKeyDelete::Execute(CSession *pSession)
|
||||||
{
|
{
|
||||||
assert(pSession);
|
|
||||||
LONG lResult;
|
LONG lResult;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
REGSAM samAdditional = 0;
|
REGSAM samAdditional = 0;
|
||||||
@ -308,7 +305,7 @@ HRESULT COpRegKeyDelete::Execute(CSession *pSession)
|
|||||||
// Probe to see if the key exists.
|
// Probe to see if the key exists.
|
||||||
lResult = ::RegOpenKeyExW(m_hKeyRoot, m_sValue, 0, DELETE | samAdditional, &hKey);
|
lResult = ::RegOpenKeyExW(m_hKeyRoot, m_sValue, 0, DELETE | samAdditional, &hKey);
|
||||||
if (lResult == ERROR_SUCCESS) {
|
if (lResult == ERROR_SUCCESS) {
|
||||||
verify(::RegCloseKey(hKey) == ERROR_SUCCESS);
|
::RegCloseKey(hKey);
|
||||||
|
|
||||||
if (pSession->m_bRollbackEnabled) {
|
if (pSession->m_bRollbackEnabled) {
|
||||||
// Make a backup of the key first.
|
// Make a backup of the key first.
|
||||||
@ -324,7 +321,7 @@ HRESULT COpRegKeyDelete::Execute(CSession *pSession)
|
|||||||
sBackupName.Format(L"%.*ls (orig %u)", iLength, (LPCWSTR)m_sValue, ++uiCount);
|
sBackupName.Format(L"%.*ls (orig %u)", iLength, (LPCWSTR)m_sValue, ++uiCount);
|
||||||
lResult = ::RegOpenKeyExW(m_hKeyRoot, sBackupName, 0, KEY_ENUMERATE_SUB_KEYS | samAdditional, &hKey);
|
lResult = ::RegOpenKeyExW(m_hKeyRoot, sBackupName, 0, KEY_ENUMERATE_SUB_KEYS | samAdditional, &hKey);
|
||||||
if (lResult != ERROR_SUCCESS) break;
|
if (lResult != ERROR_SUCCESS) break;
|
||||||
verify(::RegCloseKey(hKey) == ERROR_SUCCESS);
|
::RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
if (lResult == ERROR_FILE_NOT_FOUND) {
|
if (lResult == ERROR_FILE_NOT_FOUND) {
|
||||||
// Since copying registry key is a complicated job (when rollback/commit support is required), and we do have an operation just for that, we use it.
|
// Since copying registry key is a complicated job (when rollback/commit support is required), and we do have an operation just for that, we use it.
|
||||||
@ -339,10 +336,10 @@ HRESULT COpRegKeyDelete::Execute(CSession *pSession)
|
|||||||
pSession->m_olCommit.AddTail(new COpRegKeyDelete(m_hKeyRoot, sBackupName));
|
pSession->m_olCommit.AddTail(new COpRegKeyDelete(m_hKeyRoot, sBackupName));
|
||||||
} else {
|
} else {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(4);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(4);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_PROBING_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_PROBING_FAILED);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 3, sBackupName ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 3, sBackupName );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 4, lResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 4, lResult );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
return AtlHresultFromWin32(lResult);
|
return AtlHresultFromWin32(lResult);
|
||||||
}
|
}
|
||||||
@ -356,10 +353,10 @@ HRESULT COpRegKeyDelete::Execute(CSession *pSession)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
else {
|
else {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(4);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(4);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_DELETE_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_DELETE_FAILED);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 3, m_sValue ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 3, m_sValue );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 4, lResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 4, lResult );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
return AtlHresultFromWin32(lResult);
|
return AtlHresultFromWin32(lResult);
|
||||||
}
|
}
|
||||||
@ -407,7 +404,7 @@ LONG COpRegKeyDelete::DeleteKeyRecursively(HKEY hKeyRoot, LPCWSTR pszKeyName, RE
|
|||||||
lResult = ERROR_OUTOFMEMORY;
|
lResult = ERROR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(::RegCloseKey(hKey) == ERROR_SUCCESS);
|
::RegCloseKey(hKey);
|
||||||
|
|
||||||
// Finally try to delete the key.
|
// Finally try to delete the key.
|
||||||
lResult = ::RegDeleteKeyExW(hKeyRoot, pszKeyName, samAdditional, 0);
|
lResult = ::RegDeleteKeyExW(hKeyRoot, pszKeyName, samAdditional, 0);
|
||||||
@ -466,8 +463,7 @@ COpRegValueCreate::COpRegValueCreate(HKEY hKeyRoot, LPCWSTR pszKeyName, LPCWSTR
|
|||||||
m_dwType(REG_BINARY),
|
m_dwType(REG_BINARY),
|
||||||
COpRegValueSingle(hKeyRoot, pszKeyName, pszValueName, iTicks)
|
COpRegValueSingle(hKeyRoot, pszKeyName, pszValueName, iTicks)
|
||||||
{
|
{
|
||||||
assert(lpData || !nSize);
|
m_binData.SetCount(nSize);
|
||||||
verify(m_binData.SetCount(nSize));
|
|
||||||
memcpy(m_binData.GetData(), lpData, nSize);
|
memcpy(m_binData.GetData(), lpData, nSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,7 +486,6 @@ COpRegValueCreate::COpRegValueCreate(HKEY hKeyRoot, LPCWSTR pszKeyName, LPCWSTR
|
|||||||
|
|
||||||
HRESULT COpRegValueCreate::Execute(CSession *pSession)
|
HRESULT COpRegValueCreate::Execute(CSession *pSession)
|
||||||
{
|
{
|
||||||
assert(pSession);
|
|
||||||
LONG lResult;
|
LONG lResult;
|
||||||
REGSAM sam = KEY_QUERY_VALUE | STANDARD_RIGHTS_WRITE | KEY_SET_VALUE;
|
REGSAM sam = KEY_QUERY_VALUE | STANDARD_RIGHTS_WRITE | KEY_SET_VALUE;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
@ -544,22 +539,21 @@ HRESULT COpRegValueCreate::Execute(CSession *pSession)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert(0);
|
|
||||||
lResult = ERROR_UNSUPPORTED_TYPE;
|
lResult = ERROR_UNSUPPORTED_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(::RegCloseKey(hKey) == ERROR_SUCCESS);
|
::RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lResult == ERROR_SUCCESS)
|
if (lResult == ERROR_SUCCESS)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
else {
|
else {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(5);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(5);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_SETVALUE_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_SETVALUE_FAILED);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 3, m_sValue ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 3, m_sValue );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 4, m_sValueName ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 4, m_sValueName );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 5, lResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 5, lResult );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
return AtlHresultFromWin32(lResult);
|
return AtlHresultFromWin32(lResult);
|
||||||
}
|
}
|
||||||
@ -577,7 +571,6 @@ COpRegValueCopy::COpRegValueCopy(HKEY hKeyRoot, LPCWSTR pszKeyName, LPCWSTR pszV
|
|||||||
|
|
||||||
HRESULT COpRegValueCopy::Execute(CSession *pSession)
|
HRESULT COpRegValueCopy::Execute(CSession *pSession)
|
||||||
{
|
{
|
||||||
assert(pSession);
|
|
||||||
LONG lResult;
|
LONG lResult;
|
||||||
REGSAM sam = KEY_QUERY_VALUE | KEY_SET_VALUE;
|
REGSAM sam = KEY_QUERY_VALUE | KEY_SET_VALUE;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
@ -607,7 +600,6 @@ HRESULT COpRegValueCopy::Execute(CSession *pSession)
|
|||||||
lResult = ::RegQueryValueExW(hKey, m_sValueName1, 0, NULL, NULL, &dwSize);
|
lResult = ::RegQueryValueExW(hKey, m_sValueName1, 0, NULL, NULL, &dwSize);
|
||||||
if (lResult == ERROR_SUCCESS) {
|
if (lResult == ERROR_SUCCESS) {
|
||||||
LPBYTE lpData = new BYTE[dwSize];
|
LPBYTE lpData = new BYTE[dwSize];
|
||||||
assert(lpData);
|
|
||||||
// Read the source registry value.
|
// Read the source registry value.
|
||||||
lResult = ::RegQueryValueExW(hKey, m_sValueName1, 0, &dwType, lpData, &dwSize);
|
lResult = ::RegQueryValueExW(hKey, m_sValueName1, 0, &dwType, lpData, &dwSize);
|
||||||
if (lResult == ERROR_SUCCESS) {
|
if (lResult == ERROR_SUCCESS) {
|
||||||
@ -622,19 +614,19 @@ HRESULT COpRegValueCopy::Execute(CSession *pSession)
|
|||||||
delete [] lpData;
|
delete [] lpData;
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(::RegCloseKey(hKey) == ERROR_SUCCESS);
|
::RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lResult == ERROR_SUCCESS)
|
if (lResult == ERROR_SUCCESS)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
else {
|
else {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(6);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(6);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_COPYVALUE_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_COPYVALUE_FAILED);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 3, m_sValue ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 3, m_sValue );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 4, m_sValueName1 ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 4, m_sValueName1 );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 5, m_sValueName2 ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 5, m_sValueName2 );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 6, lResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 6, lResult );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
return AtlHresultFromWin32(lResult);
|
return AtlHresultFromWin32(lResult);
|
||||||
}
|
}
|
||||||
@ -652,7 +644,6 @@ COpRegValueDelete::COpRegValueDelete(HKEY hKeyRoot, LPCWSTR pszKeyName, LPCWSTR
|
|||||||
|
|
||||||
HRESULT COpRegValueDelete::Execute(CSession *pSession)
|
HRESULT COpRegValueDelete::Execute(CSession *pSession)
|
||||||
{
|
{
|
||||||
assert(pSession);
|
|
||||||
LONG lResult;
|
LONG lResult;
|
||||||
REGSAM sam = KEY_QUERY_VALUE | KEY_SET_VALUE;
|
REGSAM sam = KEY_QUERY_VALUE | KEY_SET_VALUE;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
@ -687,7 +678,7 @@ HRESULT COpRegValueDelete::Execute(CSession *pSession)
|
|||||||
COpRegValueCopy opCopy(m_hKeyRoot, m_sValue, m_sValueName, sBackupName);
|
COpRegValueCopy opCopy(m_hKeyRoot, m_sValue, m_sValueName, sBackupName);
|
||||||
HRESULT hr = opCopy.Execute(pSession);
|
HRESULT hr = opCopy.Execute(pSession);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
verify(::RegCloseKey(hKey) == ERROR_SUCCESS);
|
::RegCloseKey(hKey);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,13 +689,13 @@ HRESULT COpRegValueDelete::Execute(CSession *pSession)
|
|||||||
pSession->m_olCommit.AddTail(new COpRegValueDelete(m_hKeyRoot, m_sValue, sBackupName));
|
pSession->m_olCommit.AddTail(new COpRegValueDelete(m_hKeyRoot, m_sValue, sBackupName));
|
||||||
} else {
|
} else {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(5);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(5);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_PROBINGVAL_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_PROBINGVAL_FAILED);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 3, m_sValue ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 3, m_sValue );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 3, sBackupName ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 3, sBackupName );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 4, lResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 4, lResult );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
verify(::RegCloseKey(hKey) == ERROR_SUCCESS);
|
::RegCloseKey(hKey);
|
||||||
return AtlHresultFromWin32(lResult);
|
return AtlHresultFromWin32(lResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -713,18 +704,18 @@ HRESULT COpRegValueDelete::Execute(CSession *pSession)
|
|||||||
lResult = ::RegDeleteValueW(hKey, m_sValueName);
|
lResult = ::RegDeleteValueW(hKey, m_sValueName);
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(::RegCloseKey(hKey) == ERROR_SUCCESS);
|
::RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lResult == ERROR_SUCCESS || lResult == ERROR_FILE_NOT_FOUND)
|
if (lResult == ERROR_SUCCESS || lResult == ERROR_FILE_NOT_FOUND)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
else {
|
else {
|
||||||
PMSIHANDLE hRecordProg = ::MsiCreateRecord(5);
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(5);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_DELETEVALUE_FAILED) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_REGKEY_DELETEVALUE_FAILED);
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 2, (UINT)m_hKeyRoot & 0x7fffffff );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 3, m_sValue ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 3, m_sValue );
|
||||||
verify(::MsiRecordSetStringW(hRecordProg, 4, m_sValueName ) == ERROR_SUCCESS);
|
::MsiRecordSetStringW(hRecordProg, 4, m_sValueName );
|
||||||
verify(::MsiRecordSetInteger(hRecordProg, 5, lResult ) == ERROR_SUCCESS);
|
::MsiRecordSetInteger(hRecordProg, 5, lResult );
|
||||||
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
return AtlHresultFromWin32(lResult);
|
return AtlHresultFromWin32(lResult);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user