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
4.8 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998 Active Voice Corporation. All Rights Reserved.
  4. //
  5. // Active Agent(r) and Unified Communications(tm) are trademarks of Active Voice Corporation.
  6. //
  7. // Other brand and29 product names used herein are trademarks of their respective owners.
  8. //
  9. // The entire program and user interface including the structure, sequence, selection,
  10. // and arrangement of the dialog, the exclusively "yes" and "no" choices represented
  11. // by "1" and "2," and each dialog message are protected by copyrights registered in
  12. // the United States and by international treaties.
  13. //
  14. // Protected by one or more of the following United States patents: 5,070,526, 5,488,650,
  15. // 5,434,906, 5,581,604, 5,533,102, 5,568,540, 5,625,676, 5,651,054.
  16. //
  17. // Active Voice Corporation
  18. // Seattle, Washington
  19. // USA
  20. //
  21. /////////////////////////////////////////////////////////////////////////////////////////
  22. #ifndef _OBJSEC_H_
  23. #define _OBJSEC_H_
  24. #include "aclui.h"
  25. #include "confprop.h"
  26. #include "objsel.h"
  27. /////////////////////////////////////////////////////////////////////////////////////////
  28. /////////////////////////////////////////////////////////////////////////////////////////
  29. //Class CObjSecurity
  30. /////////////////////////////////////////////////////////////////////////////////////////
  31. /////////////////////////////////////////////////////////////////////////////////////////
  32. class CObjSecurity : public ISecurityInformation, IDsObjectPicker
  33. {
  34. public:
  35. CObjSecurity();
  36. virtual ~CObjSecurity();
  37. protected:
  38. ULONG m_cRef;
  39. DWORD m_dwSIFlags;
  40. CONFPROP *m_pConfProp;
  41. BSTR m_bstrObject;
  42. BSTR m_bstrPage;
  43. IDsObjectPicker *m_pObjectPicker;
  44. // Interface methods
  45. public:
  46. STDMETHOD(InternalInitialize)(CONFPROP* pConfProp);
  47. // IUnknown methods
  48. STDMETHOD(QueryInterface)(REFIID, LPVOID *);
  49. STDMETHOD_(ULONG, AddRef)();
  50. STDMETHOD_(ULONG, Release)();
  51. // ISecurityInformation methods
  52. STDMETHOD(GetObjectInformation)(PSI_OBJECT_INFO pObjectInfo);
  53. STDMETHOD(GetSecurity)(SECURITY_INFORMATION si,
  54. PSECURITY_DESCRIPTOR *ppSD,
  55. BOOL fDefault);
  56. STDMETHOD(SetSecurity)(SECURITY_INFORMATION si,
  57. PSECURITY_DESCRIPTOR pSD);
  58. STDMETHOD(GetAccessRights)(const GUID* pguidObjectType,
  59. DWORD dwFlags,
  60. PSI_ACCESS *ppAccess,
  61. ULONG *pcAccesses,
  62. ULONG *piDefaultAccess);
  63. STDMETHOD(MapGeneric)(const GUID *pguidObjectType,
  64. UCHAR *pAceFlags,
  65. ACCESS_MASK *pmask);
  66. STDMETHOD(GetInheritTypes)(PSI_INHERIT_TYPE *ppInheritTypes,
  67. ULONG *pcInheritTypes);
  68. STDMETHOD(PropertySheetPageCallback)(HWND hwnd,
  69. UINT uMsg,
  70. SI_PAGE_TYPE uPage);
  71. // IDsObjectPicker
  72. STDMETHOD(Initialize)(PDSOP_INIT_INFO pInitInfo);
  73. STDMETHOD(InvokeDialog)(HWND hwndParent, IDataObject **ppdoSelection);
  74. };
  75. /////////////////////////////////////////////////////////////////////////////////////////
  76. /////////////////////////////////////////////////////////////////////////////////////////
  77. //Defines
  78. /////////////////////////////////////////////////////////////////////////////////////////
  79. /////////////////////////////////////////////////////////////////////////////////////////
  80. #define BAIL_ON_FAILURE(hr) \
  81. if (FAILED(hr)) { goto failed; }
  82. #define BAIL_ON_BOOLFAIL(_FN_) \
  83. if ( !_FN_ ) \
  84. { \
  85. hr = HRESULT_FROM_WIN32(GetLastError()); \
  86. goto failed; \
  87. }
  88. #define INC_ACCESS_ACL_SIZE(_SIZE_, _SID_) \
  89. _SIZE_ += (sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD) + GetLengthSid(_SID_));
  90. extern HINSTANCE g_hInstLib;
  91. #define INHERIT_FULL (CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE)
  92. //
  93. // DESCRIPTION OF ACCESS FLAG AFFECTS
  94. //
  95. // SI_ACCESS_GENERAL shows up on general properties page
  96. // SI_ACCESS_SPECIFIC shows up on advanced page
  97. // SI_ACCESS_CONTAINER shows on general page IF object is a container
  98. //
  99. // The following array defines the permission names for my objects.
  100. //
  101. // Access rights for our private objects
  102. /*
  103. #define ACCESS_READ 0x10
  104. #define ACCESS_MODIFY 0x20
  105. #define ACCESS_DELETE (DELETE | WRITE_DAC | 0xf)
  106. */
  107. #define ACCESS_READ 0x10
  108. #define ACCESS_WRITE 0x20
  109. #define ACCESS_MODIFY (ACCESS_WRITE | WRITE_DAC)
  110. #define ACCESS_DELETE DELETE
  111. #define ACCESS_ALL (ACCESS_READ | ACCESS_MODIFY | ACCESS_DELETE)
  112. #endif //_OBJSEC_H_