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.

190 lines
5.5 KiB

  1. <HTML>
  2. <HEAD>
  3. <TITLE>Dump of the Metabase</TITLE>
  4. </HEAD>
  5. <BODY>
  6. <PRE>
  7. <%
  8. 'Metabase Constants
  9. Const METADATA_NO_ATTRIBUTES = &H0
  10. Const METADATA_INHERIT = &H00000001
  11. Const METADATA_PARTIAL_PATH = &H00000002
  12. Const METADATA_SECURE = &H00000004
  13. Const METADATA_REFERENCE = &H00000008
  14. Const METADATA_VOLATILE = &H00000010
  15. Const METADATA_ISINHERITED = &H00000020
  16. Const METADATA_INSERT_PATH = &H00000040
  17. Const IIS_MD_UT_SERVER = 1
  18. Const IIS_MD_UT_FILE = 2
  19. Const IIS_MD_UT_WAM = 100
  20. Const ASP_MD_UT_APP = 101
  21. Const ALL_METADATA = 0
  22. Const DWORD_METADATA = 1
  23. Const STRING_METADATA = 2
  24. Const BINARY_METADATA = 3
  25. Const EXPANDSZ_METADATA = 4
  26. Const MULTISZ_METADATA = 5
  27. 'Carrage Return + Line Feed pair
  28. Dim CRLF
  29. CRLF = CHR(13) + CHR(10)
  30. Sub DisplayProperty(ByRef objProperty, ByRef strIndent)
  31. Dim strId
  32. Dim strName
  33. Dim strAttr
  34. Dim intAttr
  35. Dim strUserType
  36. Dim intUserType
  37. Dim strDataType
  38. Dim intDataType
  39. Dim strData
  40. Dim i
  41. Dim arData
  42. Dim bstrData
  43. strId = CStr(objProperty.Id)
  44. strName = objProperty.Name
  45. If strName = "" Then
  46. strName = "*Unknown*"
  47. End If
  48. intAttr = objProperty.Attributes
  49. strAttr = " "
  50. If ((intAttr And METADATA_INHERIT) = METADATA_INHERIT) Then
  51. strAttr = strAttr & "inherit "
  52. End If
  53. If ((intAttr And METADATA_PARTIAL_PATH) = METADATA_PARTIAL_PATH) Then
  54. strAttr = strAttr & "partial_path "
  55. End If
  56. If ((intAttr And METADATA_SECURE) = METADATA_SECURE) Then
  57. strAttr = strAttr & "secure "
  58. End If
  59. If ((intAttr And METADATA_REFERENCE) = METADATA_REFERENCE) Then
  60. strAttr = strAttr & "reference "
  61. End If
  62. If ((intAttr And METADATA_VOLATILE) = METADATA_VOLATILE) Then
  63. strAttr = strAttr & "volatile "
  64. End If
  65. If ((intAttr And METADATA_ISINHERITED) = METADATA_ISINHERITED) Then
  66. strAttr = strAttr & "isinherited "
  67. End If
  68. If ((intAttr And METADATA_INSERT_PATH) = METADATA_INSERT_PATH) Then
  69. strAttr = strAttr & "insert_path "
  70. End If
  71. intUserType = objProperty.UserType
  72. If (intUserType = IIS_MD_UT_SERVER) Then
  73. strUserType = "server"
  74. ElseIf (intUserType = IIS_MD_UT_FILE) Then
  75. strUserType = "file"
  76. ElseIf (intUserType = IIS_MD_UT_WAM) Then
  77. strUserType = "wam"
  78. ElseIf (intUserType = ASP_MD_UT_APP) Then
  79. strUserType = "asp_app"
  80. Else
  81. strUserType = "*unknown*"
  82. End If
  83. intDataType = objProperty.DataType
  84. If (intDataType = ALL_METADATA) Then
  85. strDataType = "*all*"
  86. ElseIf (intDataType = DWORD_METADATA) Then
  87. strDataType = "dword"
  88. ElseIf (intDataType = STRING_METADATA) Then
  89. strDataType = "string"
  90. ElseIf (intDataType = BINARY_METADATA) Then
  91. strDataType = "binary"
  92. ElseIf (intDataType = EXPANDSZ_METADATA) Then
  93. strDataType = "expandsz"
  94. ElseIf (intDataType = MULTISZ_METADATA) Then
  95. strDataType = "multisz"
  96. Else
  97. strDataType = "*unknown*"
  98. End If
  99. 'Don't show secure data
  100. If ((intAttr And METADATA_SECURE) = METADATA_SECURE) Then
  101. strData = "*not displayed*"
  102. ElseIf (intDataType = BINARY_METADATA) Then
  103. 'Display as a list of bytes
  104. strData = ""
  105. bstrData = objProperty.Data
  106. For i = 1 To LenB(objProperty.Data)
  107. strData = strData & CInt(AscB(MidB(bstrData, i, 1))) & " "
  108. Next
  109. ElseIf (intDataType = MULTISZ_METADATA) Then
  110. arData = objProperty.Data
  111. 'Display as a an intented list of strings, one on each line
  112. strData = ""
  113. For i = LBound(arData) To UBound(arData)
  114. strData = strData & CRLF & strIndent & " " & arData(i)
  115. Next
  116. Else
  117. strData = CStr(objProperty.Data)
  118. End If
  119. Response.Write(strIndent & strId & " " & strName & " A:" & strAttr & _
  120. "UT: " & strUserType & " DT: " & strDataType & _
  121. " D: " & StrData & CRLF)
  122. End Sub
  123. Sub DumpKey(ByRef objMetaUtil, ByVal strFullKey, ByVal strKey, ByVal strIndent)
  124. 'Display the key
  125. If (strKey = "") then
  126. Response.Write(strIndent & "[METADATA_ROOT]" & CRLF)
  127. Else
  128. Response.Write(strIndent & "[" & strKey & "]" & CRLF)
  129. End if
  130. strIndent = strIndent & " "
  131. 'Display the properties
  132. Dim objProperties
  133. Dim objProperty
  134. Set objProperties = objMetaUtil.EnumProperties(strFullKey)
  135. For Each objProperty In objProperties
  136. DisplayProperty objProperty, strIndent
  137. Next
  138. 'Display the subkeys
  139. Dim objSubKeys
  140. Dim strSubKey
  141. Dim strFullSubKey
  142. Set objSubKeys = objMetaUtil.EnumKeys(strFullKey)
  143. For Each strSubKey In objSubKeys
  144. If strKey = "" Then
  145. strFullSubKey = strSubKey
  146. Else
  147. strFullSubKey = strFullKey & "/" & strSubKey
  148. End If
  149. DumpKey objMetaUtil, strFullSubKey, strSubKey, strIndent
  150. Next
  151. End Sub
  152. Dim objMetaUtil
  153. 'Create the MetaUtil object
  154. Set objMetaUtil = Server.CreateObject("MSWC.MetaUtil.1")
  155. 'Dump the entire metabase
  156. DumpKey objMetaUtil, "", "", ""
  157. 'Clean up the reference to IIS.MetaUtil
  158. Session.Abandon
  159. %>
  160. </PRE>
  161. </BODY>
  162. </HTML>