Namestitev zdaj vedno ustvari opravilo. Tudi če je že obstajalo od prej. Lahko je uporabnik aplikacijo opravila namestil zdaj v drugo mapo.

Dodal sem dokument s spiskom še odprtih zadev.
This commit is contained in:
Simon Rozman 2012-12-22 06:51:26 +00:00
parent 2f05e29657
commit 033454b291
7 changed files with 16 additions and 22 deletions

1
.gitattributes vendored
View File

@ -6,6 +6,7 @@ MSICALib/MSITSCA.vcxproj -text svneol=unset#text/xml
MSICALib/MSITSCA.vcxproj.filters -text svneol=unset#text/xml MSICALib/MSITSCA.vcxproj.filters -text svneol=unset#text/xml
MSICALib/MSITSCAOp.cpp -text MSICALib/MSITSCAOp.cpp -text
MSICALib/MSITSCAOp.h -text MSICALib/MSITSCAOp.h -text
MSICALib/Naredi.txt -text
MSICALib/StdAfx.cpp -text MSICALib/StdAfx.cpp -text
MSICALib/StdAfx.h -text MSICALib/StdAfx.h -text
MSICALib/res/MSITSCA.rc -text svneol=unset#unset MSICALib/res/MSITSCA.rc -text svneol=unset#unset

View File

@ -115,7 +115,7 @@ UINT MSITSCA_API EvaluateScheduledTasks(MSIHANDLE hInstall)
if (iAction >= INSTALLSTATE_LOCAL) { if (iAction >= INSTALLSTATE_LOCAL) {
// Installing component. Add the task. // Installing component. Add the task.
PMSIHANDLE hViewTT; PMSIHANDLE hViewTT;
CMSITSCAOpCreateTask *opCreateTask = new CMSITSCAOpCreateTask(sDisplayName, iAction < INSTALLSTATE_LOCAL, MSITSCA_TASK_TICK_SIZE); CMSITSCAOpCreateTask *opCreateTask = new CMSITSCAOpCreateTask(sDisplayName, MSITSCA_TASK_TICK_SIZE);
assert(opCreateTask); assert(opCreateTask);
// Populate the operation with task's data. // Populate the operation with task's data.

View File

@ -273,6 +273,7 @@
<ResourceLocalizator Include="res\MSITSCA.rcx" /> <ResourceLocalizator Include="res\MSITSCA.rcx" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Naredi.txt" />
<None Include="res\en_GB.po" /> <None Include="res\en_GB.po" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -50,5 +50,6 @@
<None Include="res\en_GB.po"> <None Include="res\en_GB.po">
<Filter>Resource Files</Filter> <Filter>Resource Files</Filter>
</None> </None>
<None Include="Naredi.txt" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -140,8 +140,7 @@ HRESULT CMSITSCAOpMoveFile::Execute(CMSITSCASession *pSession)
// CMSITSCAOpCreateTask // CMSITSCAOpCreateTask
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
CMSITSCAOpCreateTask::CMSITSCAOpCreateTask(LPCWSTR pszTaskName, BOOL bForce, int iTicks) : CMSITSCAOpCreateTask::CMSITSCAOpCreateTask(LPCWSTR pszTaskName, int iTicks) :
m_bForce(bForce),
m_dwFlags(0), m_dwFlags(0),
m_dwPriority(NORMAL_PRIORITY_CLASS), m_dwPriority(NORMAL_PRIORITY_CLASS),
m_wIdleMinutes(0), m_wIdleMinutes(0),
@ -173,21 +172,13 @@ HRESULT CMSITSCAOpCreateTask::Execute(CMSITSCASession *pSession)
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);
// Load the task to see if it exists. {
hr = pSession->m_pTaskScheduler->Activate(m_sValue, IID_ITask, (IUnknown**)&pTask); // Delete existing task first.
if (SUCCEEDED(hr)) { // Since task deleting is a complicated job (when rollback/commit support is required), and we do have an operation just for that, we use it.
// The task exists. Release it prematurely before proceeding. // Don't worry, CMSITSCAOpDeleteTask::Execute() returns S_OK if task doesn't exist.
pTask.Detach()->Release(); CMSITSCAOpDeleteTask opDeleteTask(m_sValue);
if (m_bForce) { hr = opDeleteTask.Execute(pSession);
// We're supposed to overwrite it. Delete the existing task first. if (FAILED(hr)) return hr;
// Since task deleting is a complicated job (when rollback/commit support is required), and we do have an operation for just that, we use it.
CMSITSCAOpDeleteTask opDeleteTask(m_sValue);
hr = opDeleteTask.Execute(pSession);
if (FAILED(hr)) return hr;
} else {
// The task exists, and we're happy with that.
return S_OK;
}
} }
// Create the new task. // Create the new task.

View File

@ -128,7 +128,7 @@ public:
class CMSITSCAOpCreateTask : public CMSITSCAOpSingleStringOperation class CMSITSCAOpCreateTask : public CMSITSCAOpSingleStringOperation
{ {
public: public:
CMSITSCAOpCreateTask(LPCWSTR pszTaskName = L"", BOOL bForce = FALSE, int iTicks = 0); CMSITSCAOpCreateTask(LPCWSTR pszTaskName = L"", int iTicks = 0);
virtual ~CMSITSCAOpCreateTask(); virtual ~CMSITSCAOpCreateTask();
virtual HRESULT Execute(CMSITSCASession *pSession); virtual HRESULT Execute(CMSITSCASession *pSession);
@ -139,7 +139,6 @@ public:
friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpCreateTask &op); friend inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpCreateTask &op);
protected: protected:
BOOL m_bForce;
CStringW m_sApplicationName; CStringW m_sApplicationName;
CStringW m_sParameters; CStringW m_sParameters;
CStringW m_sWorkingDirectory; CStringW m_sWorkingDirectory;
@ -351,7 +350,6 @@ inline HRESULT operator <<(CAtlFile &f, const CMSITSCAOpCreateTask &op)
POSITION pos; POSITION pos;
hr = f << (const CMSITSCAOpSingleStringOperation&)op; if (FAILED(hr)) return hr; hr = f << (const CMSITSCAOpSingleStringOperation&)op; if (FAILED(hr)) return hr;
hr = f << (int)op.m_bForce; if (FAILED(hr)) return hr;
hr = f << op.m_sApplicationName; 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_sParameters; if (FAILED(hr)) return hr;
hr = f << op.m_sWorkingDirectory; if (FAILED(hr)) return hr; hr = f << op.m_sWorkingDirectory; if (FAILED(hr)) return hr;
@ -378,7 +376,6 @@ inline HRESULT operator >>(CAtlFile &f, CMSITSCAOpCreateTask &op)
DWORD dwValue; DWORD dwValue;
hr = f >> (CMSITSCAOpSingleStringOperation&)op; if (FAILED(hr)) return hr; hr = f >> (CMSITSCAOpSingleStringOperation&)op; if (FAILED(hr)) return hr;
hr = f >> (int&)dwValue; if (FAILED(hr)) return hr; op.m_bForce = dwValue ? TRUE : FALSE;
hr = f >> op.m_sApplicationName; 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_sParameters; if (FAILED(hr)) return hr;
hr = f >> op.m_sWorkingDirectory; if (FAILED(hr)) return hr; hr = f >> op.m_sWorkingDirectory; if (FAILED(hr)) return hr;

3
MSICALib/Naredi.txt Normal file
View File

@ -0,0 +1,3 @@
- Dodano opravilo se ne vidi med opravili v Task Scheduler-ju.
- Nadgradnja med odstranitvijo prejšnje verzije, izbriše opravilo, ki ga je nova verzija malo prej namestila.
- Tudi akcije deferred/commit/rollback naj pošiljajo obvestila o napakah.