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.

163 lines
5.0 KiB

  1. <?XML version="1.0" ?>
  2. <package>
  3. <job error="false" debug="false" logo="false">
  4. <runtime>
  5. <description>
  6. Known operations:
  7. desktop generates the destop bitmap
  8. cpl adds the remote access property
  9. </description>
  10. <named name="op" helpstring="operation"
  11. required="true" type="string"/>
  12. <named name="step"
  13. helpstring="delay betweek keystroke steps. Default is 1000 ticks"
  14. required="false" type="string"/>
  15. <named name="initial"
  16. helpstring="delay for application to initialize. Defaults to 5000 ms"
  17. required="false" type="string"/>
  18. <named name="debug"
  19. helpstring="debug"
  20. required="false" type="simple"/>
  21. <named name="panel"
  22. helpstring="SKU-dependent panel number for remote property sheet.
  23. Default is 5 (SRV/ADS)"
  24. required="false" type="string"/>
  25. </runtime>
  26. <resource id="known operations">
  27. cpl
  28. desktop
  29. </resource>
  30. <resource id="cpl">
  31. modify the remote property
  32. view the remote properties
  33. </resource>
  34. <resource id="check the remote property">
  35. {TAB},{TAB},{SPACE},~,{TAB},{TAB},{TAB},{TAB},{TAB},~,~
  36. </resource>
  37. <resource id="modify the remote property">
  38. {TAB},{TAB},{SPACE},~,{TAB},{TAB},{TAB},{TAB},{TAB},~,~
  39. </resource>
  40. <resource id="view the remote properties">
  41. {TAB},{TAB},{TAB},{TAB},{TAB},~
  42. </resource>
  43. <script language="VBScript">
  44. <![CDATA[
  45. Dim npStDly, npInDly, asOpSteps, spOne, aspOps, siOp, spPanel
  46. Set opLocSyz = CreateObject("WinNTSystemInfo")
  47. Set opShell = CreateObject("WScript.Shell")
  48. Set opFS = CreateObject("Scripting.FilesystemObject")
  49. npStDly = 1500
  50. npInDly = 5000
  51. If WScript.Arguments.Named.Exists("step") Then
  52. npStDly = cInt(WScript.Arguments.Named("step"))
  53. End If
  54. If WScript.Arguments.Named.Exists("initial") Then
  55. npInDly = cInt(WScript.Arguments.Named("initial"))
  56. End If
  57. _
  58. aspOps = ReadResource("known operations")
  59. Set dpOps = CreateObject("Scripting.Dictionary")
  60. For Each spOne in aspOps
  61. dpOps.add spOne, 1
  62. Next
  63. If Not WScript.Arguments.Named.Exists("op") Then
  64. WSCript.Arguments.ShowUsage
  65. WScript.quit
  66. End If
  67. _
  68. siOp = WScript.Arguments.Named("op")
  69. If Not dpOps.Exists(siOp) Then
  70. WSCript.Arguments.ShowUsage
  71. WScript.quit
  72. End If
  73. If WScript.Arguments.Named.Exists("panel") Then
  74. spPanel = WScript.Arguments.Named("panel")
  75. Else
  76. spPanel = "5"
  77. End If
  78. _
  79. asOpSteps = ReadResource(siOp)
  80. For Each spOne in asOpSteps
  81. Set opShA = WScript.CreateObject("Shell.Application")
  82. opShA.MinimizeAll
  83. If ""<> spOne Then
  84. opShell.Exec(opShell.ExpandEnvironmentStrings( _
  85. "%windir%\system32\control.exe sysdm.cpl,," & spPanel ))
  86. WScript.Sleep npInDly
  87. _
  88. For Each sKyList in Split(GetResource(spOne), VBNEWLINE)
  89. For Each sKy in Split(sKyList, ",")
  90. if sKY="{SPACE}" Then
  91. sKy= "+"
  92. ' this seems to be beter but works 50% reliably
  93. sKy= " "
  94. End If
  95. opShell.SendKeys sKy
  96. WScript.echo sKy
  97. WScript.Sleep npStDly
  98. Next
  99. Next
  100. End If
  101. Next
  102. WSCript.quit
  103. Function ReadResource(sPresId)
  104. _
  105. On Error resume next
  106. Dim WshShell: Set WshShell = CreateObject("WScript.Shell")
  107. Dim sPRes, asRes, uRes, tsRes: sPREs = GetResource(sPresId)
  108. Dim opTrimX
  109. Set opTrimX = New RegExp
  110. With opTrimX
  111. .Pattern = "\s+$"
  112. .Global = True
  113. .IgnoreCase = True
  114. End With
  115. _
  116. If Err.number <> 0 Then
  117. Wscript.echo err.number & " " & err.description
  118. ' The Error description are not informative when failed getresource
  119. IF Err.number = 7 Then
  120. Wscript.echo chr(9) & "Null resource: " & _
  121. sPresId
  122. End If
  123. IF Err.number = 5 Then
  124. Wscript.echo chr(9) & "Undefined resource: " & _
  125. sPresId
  126. End If
  127. Wscript.quit
  128. End If
  129. _
  130. asRes = Split(WshShell.ExpandEnvironmentStrings(sPRes), VBNEWLINE)
  131. Set ures = CreateObject("Scripting.Dictionary")
  132. For Each tsRes in asRes
  133. If 0 <> Len(tsRes) Then
  134. uRes(opTrimX.Replace(tsRes, "")) = 1
  135. uRes(tsRes) = 1
  136. End If
  137. Next
  138. Dim tResource: tResource = uRes.Keys
  139. If uBound(tResource) = 0 Then
  140. ReadResource = tResource(0)
  141. Else
  142. ReadResource = tResource
  143. End If
  144. _
  145. Set WshShell = Nothing
  146. Set uRes = Nothing
  147. _
  148. End Function
  149. ]]>
  150. </script>
  151. </job>
  152. </package>