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.

255 lines
5.0 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. handle.hxx
  5. Abstract:
  6. Handle Class for IIS MetaBase.
  7. Author:
  8. Michael W. Thomas 18-Jun-96
  9. Revision History:
  10. --*/
  11. #ifndef _metahandle_
  12. #define _metahandle_
  13. typedef struct _CHANGE_ENTRY {
  14. CMDBaseObject *pboChanged;
  15. DWORD dwChangeType;
  16. DWORD dwNumDataIDs;
  17. BUFFER *pbufDataIDs;
  18. STRAU *pStrOrigName;
  19. _CHANGE_ENTRY *NextPtr;
  20. } CHANGE_ENTRY, *PCHANGE_ENTRY;
  21. class CMDHandle
  22. {
  23. public:
  24. CMDHandle(
  25. CMDBaseObject *pboMDAssociated,
  26. DWORD dwMDPermissions,
  27. DWORD dwMDSystemChangeNumber,
  28. METADATA_HANDLE mhMDHandleIdentifier,
  29. BOOLEAN bSchemaKey)
  30. :
  31. m_mhMDHandleIdentifier (mhMDHandleIdentifier),
  32. m_dwMDPermissions (dwMDPermissions),
  33. m_dwMDSystemChangeNumber (dwMDSystemChangeNumber),
  34. m_pboMDAssociated (pboMDAssociated),
  35. m_pceChangeList (NULL),
  36. m_SchemaHandle (bSchemaKey)
  37. /*++
  38. Routine Description:
  39. Constructor for a handle.
  40. Arguments:
  41. MDAssociated - The meta object this handles is associated with.
  42. MDPermissions - The handle permissions.
  43. METADATA_PERMISSION_READ
  44. METADATA_PERMISSION_WRITE
  45. MDHandleIdentifier - The handle id.
  46. Return Value:
  47. --*/
  48. {};
  49. CMDHandle(CMDHandle *phoOriginal)
  50. :
  51. m_mhMDHandleIdentifier (phoOriginal->m_mhMDHandleIdentifier),
  52. m_dwMDPermissions (phoOriginal->m_dwMDPermissions),
  53. m_dwMDSystemChangeNumber (phoOriginal->m_dwMDSystemChangeNumber),
  54. m_pboMDAssociated (phoOriginal->m_pboMDAssociated),
  55. m_pceChangeList (phoOriginal->m_pceChangeList),
  56. m_SchemaHandle (phoOriginal->m_SchemaHandle)
  57. {
  58. };
  59. ~CMDHandle();
  60. VOID SetNextPtr(CMDHandle *NextPtr)
  61. /*++
  62. Routine Description:
  63. Sets the pointer to the next handle object.
  64. Arguments:
  65. NextPtr - The next handle object, or NULL.
  66. Return Value:
  67. --*/
  68. {
  69. m_NextPtr = NextPtr;
  70. };
  71. CMDHandle *GetNextPtr()
  72. /*++
  73. Routine Description:
  74. Gets the pointer to the next data object.
  75. Arguments:
  76. Return Value:
  77. CMDHandle * - The next handle object, or NULL.
  78. --*/
  79. {
  80. return m_NextPtr;
  81. };
  82. BOOLEAN IsSchemaHandle()
  83. {
  84. return m_SchemaHandle;
  85. }
  86. METADATA_HANDLE GetHandleIdentifier()
  87. /*++
  88. Routine Description:
  89. Gets the handle identifier, or meta handle.
  90. Arguments:
  91. Return Value:
  92. DWORD - The handle identifier.
  93. --*/
  94. {
  95. return m_mhMDHandleIdentifier;
  96. };
  97. VOID SetPermissions(
  98. DWORD dwMDPermissions)
  99. /*++
  100. Routine Description:
  101. Sets the handle permissions.
  102. Arguments:
  103. MDPermissions - The new permissions.
  104. METADATA_PERMISSION_READ
  105. METADATA_PERMISSION_WRITE
  106. Return Value:
  107. --*/
  108. {
  109. m_dwMDPermissions = dwMDPermissions;
  110. };
  111. BOOL IsWriteAllowed()
  112. /*++
  113. Routine Description:
  114. Determines if write permission is set.
  115. Arguments:
  116. Return Value:
  117. BOOL - TRUE if write permission is set.
  118. --*/
  119. {
  120. return (((m_dwMDPermissions & METADATA_PERMISSION_WRITE) != 0) ? TRUE : FALSE);
  121. };
  122. BOOL IsReadAllowed()
  123. /*++
  124. Routine Description:
  125. Determines if read permission is set.
  126. Arguments:
  127. Return Value:
  128. BOOL - TRUE if read permission is set.
  129. --*/
  130. {
  131. return (((m_dwMDPermissions & METADATA_PERMISSION_READ) != 0) ? TRUE : FALSE);
  132. };
  133. CMDBaseObject *GetObject()
  134. /*++
  135. Routine Description:
  136. Gets the associated meta object.
  137. Arguments:
  138. Return Value:
  139. CMDBaseObejct * - The associated meta object.
  140. --*/
  141. {
  142. return (m_pboMDAssociated);
  143. };
  144. VOID GetHandleInfo(PMETADATA_HANDLE_INFO pmdhiInfo)
  145. {
  146. pmdhiInfo->dwMDPermissions = m_dwMDPermissions;
  147. pmdhiInfo->dwMDSystemChangeNumber = m_dwMDSystemChangeNumber;
  148. };
  149. DWORD
  150. SetChangeData(CMDBaseObject *pboChanged,
  151. DWORD dwChangeType,
  152. DWORD dwDataID,
  153. LPWSTR pszOldName = NULL);
  154. PCHANGE_ENTRY
  155. EnumChangeEntries(DWORD dwIndex);
  156. DWORD
  157. CMDHandle::GetNumChangeEntries();
  158. VOID
  159. RemoveNotifications();
  160. VOID
  161. ZeroChangeList()
  162. {
  163. m_pceChangeList = NULL;
  164. };
  165. private:
  166. METADATA_HANDLE m_mhMDHandleIdentifier;
  167. DWORD m_dwMDPermissions;
  168. DWORD m_dwMDSystemChangeNumber;
  169. CMDBaseObject *m_pboMDAssociated;
  170. CMDHandle *m_NextPtr;
  171. PCHANGE_ENTRY m_pceChangeList;
  172. BOOLEAN m_SchemaHandle;
  173. };
  174. #endif