home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / WindowsServerTrial / server.iso / sources / install.wim / 2 / Windows / System32 / ComplianceExtensions.dll / FILE / 150 next >
Extensible Markup Language  |  2008-01-19  |  10KB  |  175 lines

  1.  ■<?xml version="1.0" encoding="UTF-16"?>
  2. <xsl:stylesheet 
  3.     version="1.0" 
  4.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  5.     xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  6.     xmlns:ssr="http://microsoft.com/sce/ssr"
  7.     >
  8. <msxsl:script xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  9.             language="VBScript"
  10.             implements-prefix="ssr">
  11.     
  12.     Function AttribValue(NodeList, AttriName)
  13.         Set Node = NodeList.nextNode()
  14.         AttribValue = Node.attributes.getNamedItem(AttriName).text
  15.     End Function
  16.     
  17.     Function GetAllSubNodeAttribute(NodeList, SubNodeName, AttribName, DelimiterChar, DelimitFront)
  18.         Set node = NodeList.nextNode()
  19.         Set SubNodeColl = node.selectNodes(SubNodeName)
  20.         
  21.         If (DelimitFront) Then
  22.             GetAllSubNodeAttribute = DelimiterChar
  23.         Else
  24.             GetAllSubNodeAttribute = ""
  25.         End If
  26.         
  27.         For each n in SubNodeColl
  28.             GetAllSubNodeAttribute = GetAllSubNodeAttribute + n.attributes.getNamedItem(AttribName).text + DelimiterChar
  29.         Next
  30.         
  31.         GetAllSubNodeAttribute = UCase(GetAllSubNodeAttribute)
  32.     End Function
  33.     
  34.     Function SecurityDescriptor(Service)
  35.       
  36.       SecurityDescriptor = ""
  37.     End Function
  38.     Function StartupMode (NodeList)
  39.     
  40.         Set Node = NodeList.nextNode()
  41.         
  42.         DIM sm
  43.         sm = "StartupMode"
  44.         
  45.         DIM Attribute
  46.         Attribute = Node.attributes.getNamedItem(sm).text
  47.         
  48.         StartupMode = 5
  49.         
  50.         If (Attribute = "Automatic") Then
  51.             StartupMode = 2
  52.         ElseIf (Attribute = "Manual") Then
  53.             StartupMode = 3
  54.         ElseIf (Attribute = "Disabled") Then
  55.             StartupMode = 4
  56.         ElseIf (Attribute = "Ignored") Then
  57.             StartupMode = 5
  58.         End If
  59.         
  60.     End Function
  61.     
  62.     Function AllServices(Delimiter, DelimitFront)
  63.     
  64.         Set Wbem = CreateObject("wbemscripting.swbemlocator")
  65.         
  66.         Set ns = Wbem.connectserver(".", "root\cimv2")
  67.         
  68.          'GetObject("winmgmts:{impersonationLevel=impersonate}").
  69.          
  70.         Set ServiceSet = ns.InstancesOf("Win32_Service")
  71.         If (DelimitFront) Then
  72.             AllServices = Delimiter
  73.         Else
  74.             AllServices = ""
  75.         End If
  76.         For each Service in ServiceSet
  77.             AllServices = AllServices + Service.Name + Delimiter
  78.         Next
  79.         AllServices = UCase(AllServices)
  80.     End Function
  81. </msxsl:script>
  82. <xsl:output method="text" indent="no"/>
  83. <xsl:template match="Rule/Parameters/Parameter">
  84. [Unicode]
  85. Unicode=yes
  86. [Version]
  87. signature="$CHICAGO$"
  88. Revision=1
  89. [Service General Setting]
  90.     <xsl:variable name="Services"            select="."/>
  91.     <xsl:variable name="ExplicitServices"    select="ssr:GetAllSubNodeAttribute($Services, 'Service', 'Name', ';', 'True')"/>
  92.     <xsl:for-each select="Service">
  93.         <xsl:variable name="Sv"             select="."/>
  94.         <xsl:variable name="WildcardServiceName" select="ssr:AttribValue($Sv, 'Name')"/>
  95.         <xsl:variable name="WildcardStartup" select="ssr:StartupMode($Sv)"/>
  96.         <xsl:if test="$WildcardStartup != '5' ">
  97.             <xsl:if test="$WildcardServiceName = '*' ">
  98.                     <xsl:variable name="AllServices" select="ssr:AllServices(';', 'False')"/>
  99.                     <xsl:call-template name="UnpackList">
  100.                         <xsl:with-param name="MyList"       select="$ExplicitServices"/>
  101.                         <xsl:with-param name="List"         select="$AllServices"/>
  102.                         <xsl:with-param name="Del"          select="';'"/>
  103.                         <xsl:with-param name="Startup"          select="$WildcardStartup"/>
  104.                     </xsl:call-template>
  105.             </xsl:if>
  106.             <xsl:if test="$WildcardServiceName != '*' ">
  107.                 <xsl:variable name="SecurityDescriptor" select="ssr:SecurityDescriptor($Sv)"/>
  108. <xsl:if test="not($SecurityDescriptor = 'Bogus' )">
  109. <xsl:value-of select="ssr:AttribValue($Sv, 'Name')"/>,<xsl:value-of select="ssr:StartupMode($Sv)"/>,"<xsl:value-of select="$SecurityDescriptor"/>"
  110. </xsl:if>
  111.             </xsl:if>
  112.         </xsl:if>
  113.     </xsl:for-each>
  114. </xsl:template>
  115. <xsl:template name="UnpackList">
  116.     <xsl:param name="MyList"/>
  117.     <xsl:param name="List" />
  118.     <xsl:param name="Del"  />
  119.     <xsl:param name="Startup"/>
  120.     
  121.     <xsl:choose>
  122.         <xsl:when test="contains(normalize-space($List), $Del)">
  123.             <xsl:variable name="ThisOne" select="substring-before($List, $Del)" />
  124.             <xsl:variable name="NextList"  select="substring-after($List, $Del)"/>
  125.             
  126.             <!-- the extracted one needs to be delimited to make sure that we are not matching a partial string-->
  127.             <xsl:variable name="DelimitedOne" select="concat($Del, $ThisOne, $Del)"/>
  128.             
  129.             <xsl:choose>
  130.                 <xsl:when test="contains(normalize-space($MyList), $DelimitedOne)">
  131.                 </xsl:when>
  132.                 <xsl:otherwise>
  133.                     <xsl:value-of select="$ThisOne"/>,<xsl:value-of select="$Startup"/>,""
  134.                 </xsl:otherwise>
  135.             </xsl:choose>
  136.             
  137.             <xsl:call-template name="UnpackList">
  138.                 <xsl:with-param name="MyList"        select="$MyList"/>
  139.                 <xsl:with-param name="List"        select="$NextList"/>
  140.                 <xsl:with-param name="Del"        select="$Del"/>
  141.                 <xsl:with-param name="Startup"        select="$Startup"/>
  142.             </xsl:call-template>
  143.         
  144.         </xsl:when>
  145.     </xsl:choose>    
  146. </xsl:template>
  147. </xsl:stylesheet>