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.

294 lines
8.6 KiB

  1. <?XML version="1.0" ?>
  2. <package>
  3. <job error="false" debug="false" logo="false">
  4. <runtime>
  5. <named name="n"
  6. helpstring="build number"
  7. required="true" type="string"/>
  8. <named name="d"
  9. helpstring="delay betweek keystroke steps. Default is no delay"
  10. required="false" type="string"/>
  11. <named name="i"
  12. helpstring="delay for application to initialize. Defaults to 5000 ms"
  13. required="false" type="string"/>
  14. <named name="l"
  15. helpstring="language"
  16. required="true" type="string"/>
  17. <named name="r"
  18. helpstring="right to left swith for CS languages"
  19. required="false" type="simple"/>
  20. </runtime>
  21. <resource id="wordpad.exe">HKEY_CLASSES_ROOT\applications\wordpad.exe\shell\open</resource>
  22. <resource id="mspaint.exe">%WINDIR%\SYSTEM32\mspaint.exe</resource>
  23. <resource id="known applications">APPLICATIONS\%APPLICATION%\SHELL\OPEN\COMMAND</resource>
  24. <resource id="blank page">blank.rtf</resource>
  25. <resource id="blank image">66,77,122,0,0,0,0,0,0,0,118,0,0,0,40,0,0,0,1,0,0,0,1,0,0,0,1,0,4,0,0,0,0,0,4,0,0
  26. ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,128,0,0,0,128,128,0,128,0
  27. ,0,0,128,0,128,0,128,128,0,0,128,128,128,0,192,192,192,0,0,0,255,0,0,255,0,0,0,2
  28. 55,255,0,255,0,0,0,255,0,255,0,255,255,0,0,255,255,255,0,240,0,0,0
  29. </resource>
  30. <resource id="wordpad.keys">
  31. %,{HSCROLL},{DOWN},{DOWN},{DOWN},{DOWN},{DOWN},{DOWN},{DOWN},~
  32. %,{HSCROLL},{DOWN},{DOWN},{DOWN},~
  33. %{F4}
  34. </resource>
  35. <resource id="mspaint.keys">
  36. %,{HSCROLL},{DOWN},{DOWN},{DOWN},{DOWN},{DOWN},~
  37. %,{HSCROLL},{HSCROLL},{HSCROLL},{DOWN},{DOWN},{DOWN},~
  38. %,{HSCROLL},{HSCROLL},{HSCROLL},{DOWN},{DOWN},{DOWN},{DOWN},~,100,{TAB},60,{TAB},~
  39. %,{DOWN},{DOWN},{DOWN},~
  40. %,{DOWN},{DOWN},{DOWN},{DOWN},{DOWN},{DOWN},{DOWN},{DOWN},{DOWN},{DOWN},~
  41. %{F4}
  42. </resource>
  43. <comment>
  44. %,{HSCROLL},{HSCROLL},{HSCROLL},{DOWN},{DOWN},{DOWN},{DOWN},100,{TAB},60,{TAB},~
  45. </comment>
  46. <resource id="RTF Template">
  47. <![CDATA[
  48. {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}}
  49. {\colortbl ;\red128\green128\blue128;}
  50. \viewkind4\uc1\pard\cf1\b\f0\fs40 <BLDNUM>\par
  51. <LANG>\par
  52. }
  53. ]]>
  54. </resource>
  55. <script language="VBScript">
  56. <![CDATA[
  57. Option Explicit
  58. Const WshRunning = 0
  59. Const WshFinished = 1
  60. Dim opSh
  61. Dim sKy, sKyList
  62. Dim opTrm, opCD, aspCD, npCD
  63. Dim sBldNum, sBldLng
  64. Dim sBlank, opBts, spDta, opFS, opShA, spBMP
  65. Dim npStDly, npInDly
  66. npStDly = 1: npInDly = 5000
  67. If WScript.Arguments.Named.Exists("d") Then
  68. npStDly = cInt(WScript.Arguments.Named("d"))
  69. End If
  70. If WScript.Arguments.Named.Exists("i") Then
  71. npInDly = cInt(WScript.Arguments.Named("i"))
  72. End If
  73. If WScript.Arguments.Count = 0 then
  74. WScript.Arguments.ShowUsage: WScript.quit
  75. End If
  76. sBldLng=WScript.Arguments.Named("l")
  77. sBldnum=WScript.Arguments.Named("n")
  78. Set opSh = WScript.CreateObject("WScript.Shell")
  79. Set opTrm = New RegExp
  80. With opTrm
  81. .Pattern="[,\s]"
  82. .Global=True
  83. End With
  84. Set opCD = New RegExp
  85. With opCD
  86. .Pattern="{HSCROLL}"
  87. .Global=True
  88. .IgnoreCase=False
  89. End With
  90. aspCD = Array("{RIGHT}", "{LEFT}")
  91. sBlank = mkTemp("rtf")
  92. Set opShA = WScript.CreateObject("Shell.Application")
  93. opShA.MinimizeAll
  94. Const cSpace = " "
  95. Const cForReading = 1, cForWriting = 2, cForAppending = 8
  96. If Not WScript.Arguments.Named.Exists("r") Then
  97. npCD = 0
  98. End If
  99. If WScript.Arguments.Named.Exists("r") Then
  100. npCD = 1
  101. End If
  102. Set opFS = CreateObject("Scripting.FilesystemObject")
  103. Set opBts = opFS.OpenTextFile(sBlank, cForAppending, True ,0)
  104. spDta = Replace(Replace(opTrm.Replace(GetResource("RTF Template"),""), "<LANG>", cSpace & uCase(sBldLng) & cSpace ),"<BLDNUM>", cSpace & uCase(sBldnum) & cSpace )
  105. opBts.Write Join(Split(spDta, VBNEWLINE),""): opBts.Close
  106. WScript.echo opSh.ExpandEnvironmentStrings("Running " & GetAppPath("wordpad.exe") &" " & sBlank)
  107. opSh.Exec(opSh.ExpandEnvironmentStrings( GetAppPath("wordpad.exe")) &" " & sBlank)
  108. WScript.Sleep npInDly
  109. For Each sKyList in Split(GetResource("wordpad.keys"), VBNEWLINE)
  110. For Each sKy in Split(sKyList, ",")
  111. opSh.SendKeys opCD.Replace(opTrm.Replace(sKy, ""), aspCD(npCD))
  112. WScript.Sleep npStDly
  113. Next
  114. Next
  115. spBMP = mkTemp("bmp")
  116. Set opBts = opFS.OpenTextFile(spBMP, cForWriting, True ,0)
  117. spDta = Join(Split(GetResource("blank image"), VBNEWLINE), ",")
  118. For Each sKy in Split(spDta, ",")
  119. sKy = opTrm.Replace(sKy, "")
  120. If "" <> sKy Then
  121. opBts.Write Chr(CInt(sKy))
  122. End If
  123. Next
  124. opBts.Close
  125. opSh.Exec(opSh.ExpandEnvironmentStrings( _
  126. getResource("mspaint.exe")) & " " & _
  127. spBMP)
  128. WScript.Sleep npInDly
  129. For Each sKyList in Split(GetResource("mspaint.keys"), VBNEWLINE)
  130. For Each sKy in Split(sKyList, ",")
  131. opSh.SendKeys opCD.Replace(opTrm.Replace(sKy, ""), aspCD(npCD))
  132. WScript.Sleep npStDly
  133. Next
  134. Next
  135. opFS.DeleteFile(sBlank)
  136. Set opShA = Nothing
  137. Set opFS = Nothing
  138. Set opCD = Nothing
  139. Set opTrm = Nothing
  140. WScript.quit
  141. Function mkTemp(siExtension)
  142. Dim spRndName, snDotPos, opFS, opshell
  143. Dim opLocSyz, opTextFyle
  144. Set opLocSyz = CreateObject("WinNTSystemInfo")
  145. Set opShell = CreateObject("WScript.Shell")
  146. Set opFS = CreateObject("Scripting.FilesystemObject")
  147. Randomize ' Initialize random-number generator
  148. spRndName = Rnd
  149. snDotPos = InstrRev(spRndName, ".") + 1
  150. mkTemp = opFS.BuildPath(opShell.ExpandEnvironmentStrings("%TEMP%"), Mid(spRndName, snDotPos) & _
  151. "." & siExtension)
  152. Set opShell = Nothing
  153. Set opFS = Nothing
  154. End Function
  155. Function GetAppPath(sAppName)
  156. on error resume next
  157. Dim npCnt, asKyz, oReg, soVa, opSh
  158. Dim opfRx, sKy, npKeTy
  159. Dim Ret, Val
  160. _
  161. Set oReg=GetObject("winmgmts:!root/default:StdRegProv")
  162. Const HKCR = &H80000000
  163. Const REG_SZ = &H1
  164. Const REG_EXPAND_SZ = &H2
  165. Const REG_BINARY = &H3
  166. Const REG_DWORD = &H4
  167. Const REG_MULTI_SZ = &H7
  168. Set opfRx = New RegExp
  169. With opfRx
  170. .Pattern = "(^.*\s?\"")(.+)\""\s+.+$"
  171. .global = True
  172. .IgnoreCase=True
  173. End With
  174. sKy = GetResource("known applications")
  175. sKy = Replace(sKy, "%APPLICATION%", sAppName,1,1)
  176. oReg.EnumValues HKCR, sKy, asKyz, npKeTy
  177. If err <> 0 Then
  178. WSCript.echo err.description
  179. End If
  180. If IsNull(asKyz) Then
  181. Set opSh = WScript.CreateObject("WScript.Shell")
  182. GetAppPath = uCase(opfRx._
  183. Replace(Join(WshPopen(opSh._
  184. ExpandEnvironmentStrings("%WINDIR%\SYSTEM32\REG.EXE") & _
  185. " query " & _
  186. "HKEY_CLASSES_ROOT" & _
  187. "\" & _
  188. sKy, "", 0), ""), "$2"))
  189. Set opSh = Nothing
  190. Exit Function
  191. Else
  192. For npCnt = 0 to UBound(asKyz)
  193. If "" = asKyz(npCnt) Then
  194. Select Case npKeTy(npCnt)
  195. Case REG_SZ
  196. oReg.GetStringValue HKCR,sKy, asKyz(npCnt), soVa
  197. Case REG_EXPAND_SZ
  198. oReg.GetExpandedStringValue HKCR,sKy, asKyz(npCnt), soVa
  199. Case REG_BINARY
  200. oReg.GetBinaryValue HKCR,sKy, asKyz(npCnt), soVa
  201. Case rEG_DWORD
  202. oReg.GetDWORDValue HKCR,sKy, asKyz(npCnt), soVa
  203. Case REG_MULTI_SZ
  204. oReg.GetMultiStringValue HKCR,sKy, asKyz(npCnt), soVa
  205. End Select
  206. Val = opfRx.Replace(soVa,"$2")
  207. End If
  208. Next
  209. GetAppPath = uCase(Val)
  210. End If
  211. Set oReg= Nothing
  212. End Function
  213. Function WshPopen(isFullCommandLine, siAnswer, niCnt )
  214. Dim spFullOutput, spOutPut
  215. Dim opShell, opExec
  216. Dim npCnt
  217. npCnt = 0
  218. Set opShell = WScript.CreateObject("WScript.Shell")
  219. Set opExec = opShell.Exec(isFullCommandLine)
  220. spOutput = ""
  221. Do While True
  222. spOutPut = spRead12(opExec)
  223. If isNull(spOutPut) Then
  224. Exit Do
  225. End If
  226. If npCnt = niCnt Then
  227. opExec.StdIn.Write siAnswer & VBNEWLINE
  228. Else
  229. on error resume next
  230. opExec.StdIn.Write VBNEWLINE
  231. on error goto 0
  232. spFullOutput = spFullOutput & VBNEWLINE & spOutPut
  233. End If
  234. WScript.Sleep 1000
  235. npCnt = 1 + npCnt
  236. Loop
  237. Do while opExec.Status = CInt(WshRunning)
  238. WScript.Sleep 100
  239. Loop
  240. WshPopen = Split(spFullOutput, VBNEWLINE)
  241. End Function
  242. Function spRead12(oExec)
  243. If Not oExec.StdOut.AtEndOfStream Then
  244. spRead12 = oExec.StdOut.ReadLine
  245. Exit Function
  246. End If
  247. If Not oExec.StdErr.AtEndOfStream Then
  248. spRead12 = oExec.StdErr.ReadLine
  249. Exit Function
  250. End If
  251. spRead12 = NULL
  252. End Function
  253. ]]>
  254. </script>
  255. </job>
  256. </package>