From 31daec26f0abff181d74c8dd4e75b2cc5193a2d0 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 13 Mar 2014 08:48:49 +0000 Subject: [PATCH] =?UTF-8?q?Dodal=20sem=20zametke=20name=C5=A1=C4=8Danja=20?= =?UTF-8?q?certifikatov.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FileOp.cpp => OpFile.cpp, RegOp.cpp => OpReg.cpp ... MSITSCA => MSICATS Verzijo sem nastavil na 1.0-pre1. --- MSICALib.h | 104 +++++++++++++++++++++++++++++++++++++-- MSICALib.vcxproj | 7 +-- MSICALib.vcxproj.filters | 9 ++-- OpCert.cpp | 46 +++++++++++++++++ FileOp.cpp => OpFile.cpp | 0 RegOp.cpp => OpReg.cpp | 0 TSOp.cpp => OpTS.cpp | 0 7 files changed, 155 insertions(+), 11 deletions(-) create mode 100644 OpCert.cpp rename FileOp.cpp => OpFile.cpp (100%) rename RegOp.cpp => OpReg.cpp (100%) rename TSOp.cpp => OpTS.cpp (100%) diff --git a/MSICALib.h b/MSICALib.h index 3d24e30..691251a 100644 --- a/MSICALib.h +++ b/MSICALib.h @@ -7,6 +7,7 @@ #include #include #include +#include #include @@ -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 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 //////////////////////////////////////////////////////////////////////////// @@ -410,8 +458,8 @@ public: virtual HRESULT Execute(CSession *pSession); - friend inline HRESULT operator <<(ATL::CAtlFile &f, const COpList &op); - friend inline HRESULT operator >>(ATL::CAtlFile &f, COpList &op); + friend inline HRESULT operator <<(ATL::CAtlFile &f, const COpList &list); + friend inline HRESULT operator >>(ATL::CAtlFile &f, COpList &list); protected: 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_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 >> (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&)(op.m_dwMaxRuntimeMS); if (FAILED(hr)) return hr; hr = f >> (int&)dwValue; if (FAILED(hr)) return hr; while (dwValue--) { 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) { POSITION pos; diff --git a/MSICALib.vcxproj b/MSICALib.vcxproj index b7b730a..1ae9067 100644 --- a/MSICALib.vcxproj +++ b/MSICALib.vcxproj @@ -19,10 +19,11 @@ + - - - + + + Create Create diff --git a/MSICALib.vcxproj.filters b/MSICALib.vcxproj.filters index ffdd07b..24b8750 100644 --- a/MSICALib.vcxproj.filters +++ b/MSICALib.vcxproj.filters @@ -18,16 +18,19 @@ Source Files - + Source Files - + Source Files Source Files - + + Source Files + + Source Files diff --git a/OpCert.cpp b/OpCert.cpp new file mode 100644 index 0000000..a5109ee --- /dev/null +++ b/OpCert.cpp @@ -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 diff --git a/FileOp.cpp b/OpFile.cpp similarity index 100% rename from FileOp.cpp rename to OpFile.cpp diff --git a/RegOp.cpp b/OpReg.cpp similarity index 100% rename from RegOp.cpp rename to OpReg.cpp diff --git a/TSOp.cpp b/OpTS.cpp similarity index 100% rename from TSOp.cpp rename to OpTS.cpp