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.

135 lines
3.3 KiB

  1. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Microsoft Windows
  3. Copyright (C) Microsoft Corporation, 1995 - 1999.
  4. File: OID.h
  5. Content: Declaration of COID.
  6. History: 06-15-2001 dsie created
  7. ------------------------------------------------------------------------------*/
  8. #ifndef __OID_H_
  9. #define __OID_H_
  10. #include "Resource.h"
  11. #include "Error.h"
  12. #include "Lock.h"
  13. #include "Debug.h"
  14. ////////////////////////////////////////////////////////////////////////////////
  15. //
  16. // Exported functions.
  17. //
  18. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  19. Function : CreateOIDObject
  20. Synopsis : Create and initialize an COID object.
  21. Parameter: LPTSTR * pszOID - Pointer to OID string.
  22. BOOL bReadOnly - TRUE for Read only, else FALSE.
  23. IOID ** ppIOID - Pointer to pointer IOID object.
  24. Remark :
  25. ------------------------------------------------------------------------------*/
  26. HRESULT CreateOIDObject (LPSTR pszOID, BOOL bReadOnly, IOID ** ppIOID);
  27. ////////////////////////////////////////////////////////////////////////////////
  28. //
  29. // COID
  30. //
  31. class ATL_NO_VTABLE COID :
  32. public CComObjectRootEx<CComMultiThreadModel>,
  33. public CComCoClass<COID, &CLSID_OID>,
  34. public ICAPICOMError<COID, &IID_IOID>,
  35. public IDispatchImpl<IOID, &IID_IOID, &LIBID_CAPICOM,
  36. CAPICOM_MAJOR_VERSION, CAPICOM_MINOR_VERSION>,
  37. public IObjectSafetyImpl<COID, INTERFACESAFE_FOR_UNTRUSTED_CALLER |
  38. INTERFACESAFE_FOR_UNTRUSTED_DATA>
  39. {
  40. public:
  41. COID()
  42. {
  43. }
  44. DECLARE_REGISTRY_RESOURCEID(IDR_OID)
  45. DECLARE_PROTECT_FINAL_CONSTRUCT()
  46. BEGIN_COM_MAP(COID)
  47. COM_INTERFACE_ENTRY(IOID)
  48. COM_INTERFACE_ENTRY(IDispatch)
  49. COM_INTERFACE_ENTRY(IObjectSafety)
  50. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  51. END_COM_MAP()
  52. BEGIN_CATEGORY_MAP(COID)
  53. IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
  54. IMPLEMENTED_CATEGORY(CATID_SafeForInitializing)
  55. END_CATEGORY_MAP()
  56. HRESULT FinalConstruct()
  57. {
  58. HRESULT hr;
  59. if (FAILED(hr = m_Lock.Initialized()))
  60. {
  61. DebugTrace("Error [%#x]: Critical section could not be created for OID object.\n", hr);
  62. return hr;
  63. }
  64. m_Name = CAPICOM_OID_OTHER;
  65. m_bReadOnly = FALSE;
  66. m_bstrFriendlyName.Empty();
  67. m_bstrOID.Empty();
  68. return S_OK;
  69. }
  70. //
  71. // IOID
  72. //
  73. public:
  74. STDMETHOD(get_Name)
  75. (/*[out, retval]*/ CAPICOM_OID * pVal);
  76. STDMETHOD(put_Name)
  77. (/*[out, retval]*/ CAPICOM_OID newVal);
  78. STDMETHOD(get_FriendlyName)
  79. (/*[out, retval]*/ BSTR * pVal);
  80. STDMETHOD(put_FriendlyName)
  81. (/*[out, retval]*/ BSTR newVal);
  82. STDMETHOD(get_Value)
  83. (/*[out, retval]*/ BSTR * pVal);
  84. STDMETHOD(put_Value)
  85. (/*[out, retval]*/ BSTR newVal);
  86. //
  87. // C++ member function needed to initialize the object.
  88. //
  89. STDMETHOD(Init)
  90. (LPSTR pszOID, BOOL bReadOnly);
  91. private:
  92. CLock m_Lock;
  93. BOOL m_bReadOnly;
  94. CAPICOM_OID m_Name;
  95. CComBSTR m_bstrFriendlyName;
  96. CComBSTR m_bstrOID;
  97. };
  98. #endif //__OID_H_