Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
3.0 KiB

  1. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Microsoft Windows, Copyright (C) Microsoft Corporation, 2000 - 2001.
  3. File: SignedCode.h
  4. Content: Declaration of the CSignedCode.
  5. History: 09-07-2001 dsie created
  6. ------------------------------------------------------------------------------*/
  7. #ifndef __SIGNEDCODE_H_
  8. #define __SIGNEDCODE_H_
  9. #include "Resource.h"
  10. #include "Error.h"
  11. #include "Lock.h"
  12. #include "Debug.h"
  13. ////////////////////////////////////////////////////////////////////////////////
  14. //
  15. // CSignedCode
  16. //
  17. class ATL_NO_VTABLE CSignedCode :
  18. public CComObjectRootEx<CComMultiThreadModel>,
  19. public CComCoClass<CSignedCode, &CLSID_SignedCode>,
  20. public ICAPICOMError<CSignedCode, &IID_ISignedCode>,
  21. public IDispatchImpl<ISignedCode, &IID_ISignedCode, &LIBID_CAPICOM,
  22. CAPICOM_MAJOR_VERSION, CAPICOM_MINOR_VERSION>
  23. {
  24. public:
  25. CSignedCode()
  26. {
  27. }
  28. HRESULT FinalConstruct()
  29. {
  30. HRESULT hr;
  31. if (FAILED(hr = m_Lock.Initialized()))
  32. {
  33. DebugTrace("Error [%#x]: Critical section could not be created for SignedCode object.\n", hr);
  34. return hr;
  35. }
  36. m_bHasWTD = FALSE;
  37. ::ZeroMemory(&m_WinTrustData, sizeof(WINTRUST_DATA));
  38. return S_OK;
  39. }
  40. void FinalRelease()
  41. {
  42. if (m_bHasWTD)
  43. {
  44. WVTClose();
  45. }
  46. }
  47. DECLARE_REGISTRY_RESOURCEID(IDR_SIGNEDCODE)
  48. DECLARE_PROTECT_FINAL_CONSTRUCT()
  49. BEGIN_COM_MAP(CSignedCode)
  50. COM_INTERFACE_ENTRY(ISignedCode)
  51. COM_INTERFACE_ENTRY(IDispatch)
  52. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  53. END_COM_MAP()
  54. //
  55. // ISignedCode
  56. //
  57. public:
  58. STDMETHOD(get_FileName)
  59. (/*[out, retval]*/ BSTR * pVal);
  60. STDMETHOD(put_FileName)
  61. (/*[in]*/ BSTR newVal);
  62. STDMETHOD(get_Description)
  63. (/*[out, retval]*/ BSTR * pVal);
  64. STDMETHOD(put_Description)
  65. (/*[in]*/ BSTR newVal);
  66. STDMETHOD(get_DescriptionURL)
  67. (/*[out, retval]*/ BSTR * pVal);
  68. STDMETHOD(put_DescriptionURL)
  69. (/*[in]*/ BSTR newVal);
  70. STDMETHOD(get_Signer)
  71. (/*[out, retval]*/ ISigner2 ** pVal);
  72. STDMETHOD(get_TimeStamper)
  73. (/*[out, retval]*/ ISigner2 ** pVal);
  74. STDMETHOD(get_Certificates)
  75. (/*[out, retval]*/ ICertificates2 ** pVal);
  76. STDMETHOD(Sign)
  77. (/*[in]*/ ISigner2 * pSigner2);
  78. STDMETHOD(Timestamp)
  79. (/*[in]*/ BSTR URL);
  80. STDMETHOD(Verify)
  81. (/*[in, defaultvalue(0)]*/ VARIANT_BOOL bUIAllowed);
  82. private:
  83. CLock m_Lock;
  84. BOOL m_bHasWTD;
  85. WINTRUST_DATA m_WinTrustData;
  86. CComBSTR m_bstrFileName;
  87. CComBSTR m_bstrDescription;
  88. CComBSTR m_bstrDescriptionURL;
  89. STDMETHOD(WVTVerify)
  90. (DWORD dwUIChoice,
  91. DWORD dwProvFlags);
  92. STDMETHOD(WVTOpen)
  93. (PCRYPT_PROVIDER_DATA * ppProvData);
  94. STDMETHOD(WVTClose)
  95. (void);
  96. };
  97. #endif //__SIGNEDCODE_H_