Dodal sem zametke nameščanja certifikatov.

FileOp.cpp => OpFile.cpp, RegOp.cpp => OpReg.cpp ...
MSITSCA => MSICATS

Verzijo sem nastavil na 1.0-pre1.
This commit is contained in:
Simon Rozman 2014-03-13 08:48:49 +00:00
parent fda910d652
commit 31daec26f0
7 changed files with 155 additions and 11 deletions

View File

@ -7,6 +7,7 @@
#include <atlstr.h> #include <atlstr.h>
#include <msi.h> #include <msi.h>
#include <mstask.h> #include <mstask.h>
#include <wincrypt.h>
#include <windows.h> #include <windows.h>
@ -395,6 +396,53 @@ public:
}; };
////////////////////////////////////////////////////////////////////////////
// COpCertStore
////////////////////////////////////////////////////////////////////////////
class COpCertStore : public COpTypeSingleString
{
public:
COpCertStore(LPCWSTR pszStore = L"", DWORD dwEncodingType = 0, DWORD dwFlags = 0, int iTicks = 0);
friend inline HRESULT operator <<(ATL::CAtlFile &f, const COpCertStore &op);
friend inline HRESULT operator >>(ATL::CAtlFile &f, COpCertStore &op);
protected:
DWORD m_dwEncodingType;
DWORD m_dwFlags;
};
////////////////////////////////////////////////////////////////////////////
// COpCert
////////////////////////////////////////////////////////////////////////////
class COpCert : public COpCertStore
{
public:
COpCert(LPCVOID lpCert = NULL, SIZE_T nSize = 0, LPCWSTR pszStore = L"", DWORD dwEncodingType = 0, DWORD dwFlags = 0, int iTicks = 0);
friend inline HRESULT operator <<(ATL::CAtlFile &f, const COpCert &op);
friend inline HRESULT operator >>(ATL::CAtlFile &f, COpCert &op);
protected:
ATL::CAtlArray<BYTE> m_binCert;
};
////////////////////////////////////////////////////////////////////////////
// COpCertInstall
////////////////////////////////////////////////////////////////////////////
class COpCertInstall : public COpCert
{
public:
COpCertInstall(LPCVOID lpCert = NULL, SIZE_T nSize = 0, LPCWSTR pszStore = L"", DWORD dwEncodingType = 0, DWORD dwFlags = 0, int iTicks = 0);
virtual HRESULT Execute(CSession *pSession);
};
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// COpList // COpList
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
@ -410,8 +458,8 @@ public:
virtual HRESULT Execute(CSession *pSession); virtual HRESULT Execute(CSession *pSession);
friend inline HRESULT operator <<(ATL::CAtlFile &f, const COpList &op); friend inline HRESULT operator <<(ATL::CAtlFile &f, const COpList &list);
friend inline HRESULT operator >>(ATL::CAtlFile &f, COpList &op); friend inline HRESULT operator >>(ATL::CAtlFile &f, COpList &list);
protected: protected:
enum OPERATION { enum OPERATION {
@ -1166,12 +1214,12 @@ inline HRESULT operator >>(ATL::CAtlFile &f, COpTaskCreate &op)
hr = f >> op.m_sWorkingDirectory; 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_sAuthor; if (FAILED(hr)) return hr;
hr = f >> op.m_sComment; 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_dwFlags); if (FAILED(hr)) return hr;
hr = f >> (int&)op.m_dwPriority; 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_sAccountName; if (FAILED(hr)) return hr;
hr = f >> op.m_sPassword; 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&)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&)(op.m_dwMaxRuntimeMS); if (FAILED(hr)) return hr;
hr = f >> (int&)dwValue; if (FAILED(hr)) return hr; hr = f >> (int&)dwValue; if (FAILED(hr)) return hr;
while (dwValue--) { while (dwValue--) {
TASK_TRIGGER ttData; TASK_TRIGGER ttData;
@ -1207,6 +1255,52 @@ inline HRESULT operator >>(ATL::CAtlFile &f, COpTaskEnable &op)
} }
inline HRESULT operator <<(ATL::CAtlFile &f, const COpCertStore &op)
{
HRESULT hr;
hr = f << (const COpTypeSingleString&)op; if (FAILED(hr)) return hr;
hr = f << (int)(op.m_dwEncodingType); if (FAILED(hr)) return hr;
hr = f << (int)(op.m_dwFlags); if (FAILED(hr)) return hr;
return S_OK;
}
inline HRESULT operator >>(ATL::CAtlFile &f, COpCertStore &op)
{
HRESULT hr;
hr = f >> (COpTypeSingleString&)op; if (FAILED(hr)) return hr;
hr = f >> (int&)(op.m_dwEncodingType); if (FAILED(hr)) return hr;
hr = f >> (int&)(op.m_dwFlags); if (FAILED(hr)) return hr;
return S_OK;
}
inline HRESULT operator <<(ATL::CAtlFile &f, const COpCert &op)
{
HRESULT hr;
hr = f << (const COpCertStore&)op; if (FAILED(hr)) return hr;
hr = f << op.m_binCert; if (FAILED(hr)) return hr;
return S_OK;
}
inline HRESULT operator >>(ATL::CAtlFile &f, COpCert &op)
{
HRESULT hr;
hr = f >> (COpCertStore&)op; if (FAILED(hr)) return hr;
hr = f >> op.m_binCert; if (FAILED(hr)) return hr;
return S_OK;
}
inline HRESULT operator <<(ATL::CAtlFile &f, const COpList &list) inline HRESULT operator <<(ATL::CAtlFile &f, const COpList &list)
{ {
POSITION pos; POSITION pos;

View File

@ -19,10 +19,11 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="OpCert.cpp" />
<ClCompile Include="MSICALib.cpp" /> <ClCompile Include="MSICALib.cpp" />
<ClCompile Include="FileOp.cpp" /> <ClCompile Include="OpFile.cpp" />
<ClCompile Include="TSOp.cpp" /> <ClCompile Include="OpTS.cpp" />
<ClCompile Include="RegOp.cpp" /> <ClCompile Include="OpReg.cpp" />
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>

View File

@ -18,16 +18,19 @@
<ClCompile Include="MSICALib.cpp"> <ClCompile Include="MSICALib.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FileOp.cpp"> <ClCompile Include="OpFile.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TSOp.cpp"> <ClCompile Include="OpTS.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="RegOp.cpp"> <ClCompile Include="OpReg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="OpCert.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>

46
OpCert.cpp Normal file
View File

@ -0,0 +1,46 @@
#include "stdafx.h"
#pragma comment(lib, "crypt32.lib")
namespace MSICA {
////////////////////////////////////////////////////////////////////////////
// COpCertStore
////////////////////////////////////////////////////////////////////////////
COpCertStore::COpCertStore(LPCWSTR pszStore, DWORD dwEncodingType, DWORD dwFlags, int iTicks) :
COpTypeSingleString(pszStore, iTicks),
m_dwEncodingType(dwEncodingType),
m_dwFlags(dwFlags)
{
}
////////////////////////////////////////////////////////////////////////////
// COpCert
////////////////////////////////////////////////////////////////////////////
COpCert::COpCert(LPCVOID lpCert, SIZE_T nSize, LPCWSTR pszStore, DWORD dwEncodingType, DWORD dwFlags, int iTicks) :
COpCertStore(pszStore, dwEncodingType, dwFlags, iTicks)
{
m_binCert.SetCount(nSize);
memcpy(m_binCert.GetData(), lpCert, nSize);
}
////////////////////////////////////////////////////////////////////////////
// COpCertInstall
////////////////////////////////////////////////////////////////////////////
COpCertInstall::COpCertInstall(LPCVOID lpCert, SIZE_T nSize, LPCWSTR pszStore, DWORD dwEncodingType, DWORD dwFlags, int iTicks) : COpCert(lpCert, nSize, pszStore, dwEncodingType, dwFlags, iTicks)
{
}
HRESULT COpCertInstall::Execute(CSession *pSession)
{
return E_NOTIMPL;
}
} // namespace MSICA

View File