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.

386 lines
11 KiB

  1. <?XML version="1.0" ?>
  2. <package>
  3. <job error="false" debug="false" logo="false">
  4. <reference guid="{565783C6-CB41-11D1-8B02-00600806D9B6}" version="1.1"/>
  5. <resource id="file mask"><![CDATA[slide*.bmp]]></resource>
  6. <resource id="application available">SELECT * from win32_product WHERE NAME LIKE "Microsoft Office XP%" AND InstallState = 5</resource>
  7. <runtime>
  8. <description>
  9. Creates the desktop wallpaper for the build name and language
  10. </description>
  11. <named name="label" required="true" type="simple"
  12. helpstring="part of the wallpaper to generate
  13. (default &lt;BLDNUM&gt; FRE/CHK)">
  14. </named>
  15. <named name="computer" required="true" type="simple"
  16. helpstring="part of the wallpaper to generate
  17. (default %COMPUTERNAME%)"/>
  18. <named name="dest" required="false" type="simple"
  19. helpstring="desired box to set the wallpaper
  20. (default %COMPUTERNAME%)">
  21. </named>
  22. </runtime>
  23. <comment>
  24. Win32_UserDesktop
  25. </comment>
  26. vba.set.wallpaper.wsf /computer:i32bt0011 /label:TEST /scheme:flesh
  27. vba.set.wallpaper.wsf /computer:i32bt0011 /label:SAFE /scheme:fen
  28. <comment>
  29. <comment>
  30. Flesh colorscheme:
  31. 164,179,255 # background
  32. 224,125,225 # big letters
  33. 74,25,65 # computer name
  34. Fen colorscheme:
  35. 0,64,48 # background
  36. 128,128,0 # big letters
  37. 255,128,0 # computer name
  38. </comment>
  39. The following break occurs at user level.
  40. To reproduce:
  41. 1. create an .bmp image name it
  42. 2. set this image a wallpapaer by browsing for image from desk.cpl
  43. 3. overwrite the image with siomething different.
  44. 4. set this image a wallpapaer by browsing for image from desk.cpl
  45. The desktop wallpaper will not change,
  46. To verify that the image is changed, change the desktop wallpaper into some different image, then back to the browser dile.
  47. Now you see the image is changed to what you supplied as the second file.
  48. </comment>
  49. <comment>
  50. ppLayoutBlank
  51. ppLayoutChart
  52. ppLayoutChartAndText
  53. ppLayoutClipartAndText
  54. ppLayoutClipArtAndVerticalText
  55. ppLayoutFourObjects
  56. ppLayoutLargeObject
  57. LayoutMediaClipAndText
  58. LayoutObject
  59. LayoutObjectAndText
  60. LayoutObjectOverText
  61. LayoutOrgchart
  62. LayoutTable
  63. LayoutText
  64. LayoutTextAndChart
  65. LayoutTextAndClipart
  66. LayoutTextAndMediaClip
  67. LayoutTextAndObject
  68. LayoutTextAndTwoObjects
  69. LayoutTextOverObject
  70. defined in ?
  71. \Program Files\Microsoft Office\Office10\MSPPT.OLB
  72. </comment>
  73. <reference guid="{565783C6-CB41-11D1-8B02-00600806D9B6}" version="1.1"/>
  74. <resource id="fontsize">60</resource>
  75. <resource id="width">174</resource>
  76. <resource id="height">60</resource>
  77. <resource id="index">Name</resource>
  78. <resource id="search">NTDEV\sergueik</resource>
  79. <resource id="field">WallPaper</resource>
  80. <resource id="targetclass">Win32_Desktop</resource>
  81. <resource id="regpath">HKEY_CURRENT_USER\Control Panel\Desktop\WallPaper</resource>
  82. <script language="VBScript">
  83. <![CDATA[
  84. Option Explicit
  85. Dim Debug
  86. Const QQUOT = """"
  87. '' on error resume next
  88. err.CLEAR
  89. if err.number then
  90. WScript.echo err.Source, err.Number, err.Description
  91. WScript.quit
  92. end if
  93. Dim opPowerPoint, opPresentation, opSlide, opshape, opLabel
  94. Dim npHeight, npwidth
  95. Dim spOutput, spFolderName, opshell
  96. Dim spComputerName, opNetwork
  97. Dim sLabel
  98. Set opshell = CreateObject("WScript.Shell")
  99. If NOT WScript.Arguments.Named.Exists("computer") Then
  100. Set opNetwork = CreateObject("WScript.Network")
  101. With opNetwork
  102. spComputerName = .ComputerName
  103. End With
  104. Set opNetwork = Nothing
  105. WScript.Arguments.ShowUsage
  106. Else
  107. spComputerName = WScript.Arguments.Named("computer")
  108. End If
  109. _
  110. If NOT WScript.Arguments.Named.Exists("label") Then
  111. sLabel = spComputerName
  112. WScript.Arguments.ShowUsage
  113. Else
  114. sLabel = WScript.Arguments.Named("label")
  115. End If
  116. spFolderName = "WALLPAPER"
  117. If 1 > nxDataSetCnt("application available") Then
  118. Call opShell.PopUp("Microsoft Office XP" & _
  119. VBNEWLINE & _
  120. "not found on this machine." & _
  121. VBNEWLINE & _
  122. "Please install.", _
  123. 60, _
  124. WScript.Application.FullName, _
  125. 0 + 16)
  126. WSCript.quit
  127. End If
  128. With opShell
  129. spOutput = .ExpandEnvironmentStrings("%TEMP%") & "\" & spFolderName
  130. '' %TEMP%\wallpaper\Slide1.BMP
  131. End With
  132. set opshell = nothing
  133. Dim opFilesys
  134. Set opFilesys = CreateObject("Scripting.FilesystemObject")
  135. Dim opBrow
  136. Set opBrow = WScript.CreateObject("Shell.Application")
  137. Set opPowerPoint = CreateObject("PowerPoint.Application")
  138. With opPowerPoint
  139. Set opPresentation = .Presentations.Add(False)
  140. With opPresentation
  141. With .PageSetup
  142. .SlideHeight = cInt(GetResource("height"))
  143. .SlideWidth = cInt(GetResource("width"))
  144. npHeight = .SlideHeight
  145. npWidth = .SlideWidth
  146. End With
  147. Set opSlide = .Slides.Add(.Slides.Count + 1, 12)
  148. With opSlide
  149. .ColorScheme = opPresentation.ColorSchemes(1)
  150. Set opShape = opSlide.Shapes.AddShape(1, 0, 0, npWidth, npHeight)
  151. opShape.Line.ForeColor.RGB = RGB(0,64,48)
  152. opShape.Fill.ForeColor.RGB = RGB(0,64,48)
  153. opShape.Line.ForeColor.RGB = RGB(94,157,102)
  154. opShape.Fill.ForeColor.RGB = RGB(94,157,102)
  155. Set opLabel = opSlide.Shapes.AddLabel(1, _
  156. 0, 0, 0, 0) '' most argument are ignored anyway
  157. opLabel.TextFrame.TextRange = Ucase(sLabel)
  158. with opLabel.TextFrame.TextRange
  159. With .Font
  160. .color.RGB = RGB(128, 64, 0)
  161. .color.RGB = RGB(149, 113, 45)
  162. .Bold = True
  163. .Name = "Arial Black"
  164. .Size = cInt(GetResource("fontsize"))
  165. End With
  166. End with
  167. Dim opLabel2
  168. Set opLabel2 = opSlide.Shapes.AddLabel(1, _
  169. 15, 15, 0, 0) '' most argument are ignored anyway
  170. opLabel2.TextFrame.TextRange = Ucase(spComputerName)
  171. with opLabel2.TextFrame.TextRange
  172. With .Font
  173. .color.RGB = RGB(255,255,255 )
  174. .Bold = True
  175. .iTALIC = True
  176. .Name = "Arial"
  177. .Size = cInt(GetResource("fontsize")) /2
  178. End With
  179. End with
  180. End With
  181. Set opSlide = Nothing
  182. End With
  183. call opPresentation.SaveAs(spOutput, 19, 0) '' ppSaveAsXXX constants need type library...
  184. Set opPresentation = Nothing
  185. End With
  186. Set opPowerPoint = Nothing
  187. Debug = True
  188. ''WSCript.echo spFindF(spOutPut, "slide*.bmp")
  189. WSCript.echo spFindF(spOutPut, GetResource("file mask"))
  190. WScript.quit
  191. _
  192. Dim opWbemLoc, opService
  193. Set opWbemLoc = CreateObject("WbemScripting.SWbemLocator")
  194. _
  195. opWbemLoc.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate
  196. opWbemLoc.Security_.Privileges.AddAsString("SeSystemEnvironmentPrivilege")
  197. _
  198. opWbemLoc.Security_.Privileges.AddAsString("SeAssignPrimaryTokenPrivilege")
  199. opWbemLoc.Security_.Privileges.AddAsString("SeIncreaseQuotaPrivilege")
  200. opWbemLoc.Security_.Privileges.AddAsString("SeCreatePermanentPrivilege")
  201. opWbemLoc.Security_.Privileges.AddAsString("SeTakeOwnershipPrivilege")
  202. _
  203. set opService = opWbemLoc.connectserver
  204. _
  205. Dim aopMemberSet
  206. Set aopMemberSet = opService.InstancesOf(GetResource("targetclass"))
  207. _
  208. Dim opProc, opProp
  209. Dim bpUpdateThisMember
  210. _
  211. For Each opProc in aopMemberSet
  212. bpUpdateThisMember = False
  213. For Each opProp In opProc.Properties_
  214. If Ucase(opProp.Name) = UCase(GetResource("index")) _
  215. and _
  216. Ucase(opProp.Value) = UCase(GetResource("search")) _
  217. Then
  218. bpUpdateThisMember = True
  219. End If
  220. Next
  221. If bpUpdateThisMember Then
  222. _
  223. WScript.echo opProc.Properties_(GetResource("field")).value
  224. opProc.Properties_(GetResource("field")).value = "d:\ntt.temp.x86fe\WALLPAPER\Slide1.BMP"
  225. opProc.Wallpaper = "d:\ntt.temp.x86fe\WALLPAPER\Slide1.BMP"
  226. '' on error resume next
  227. '' opProc.Put_()
  228. '' on error goto 0
  229. '' ... fail here
  230. _
  231. End If
  232. Next
  233. _
  234. Dim WSshell
  235. Dim spRegPath
  236. spRegPath = CSTR(GetResource("regpath"))
  237. Set WSshell = CreateObject("WScript.Shell")
  238. _
  239. With WSshell
  240. WSCript.echo spRegPath, _
  241. .RegRead(spRegPath)
  242. End With
  243. Set WSshell = Nothing
  244. WScript.quit
  245. _
  246. Function spFindF(siFolderName, siFnameMask)
  247. Dim opBrw, spResult, opNZs, opEx, opEy, opEz
  248. Set opBrw = WScript.CreateObject("Shell.Application")
  249. spResult = ""
  250. Set opEx = opBrw.NameSpace(spOutput)
  251. Set opNZs = CreateObject("VBscript.RegExp")
  252. With opNZs
  253. .Global = True
  254. .Pattern = spQthisE(siFnameMask)
  255. .IgnoreCase = True
  256. End With
  257. If Debug Then
  258. WSCript.echo TypeName(opEx) , opEx.Title
  259. end if
  260. Set opEy = opEx.items
  261. If Debug Then
  262. WSCript.echo TypeName(opEy) , opEy.count
  263. end if
  264. '' sorting!
  265. '' opEy.sort("[ModifyDate]")
  266. For Each opEz in opEy
  267. If InStr(1,opEz.Type,"File Folder") = 0 Then
  268. If opNZs.Test(opEz.name) Then
  269. If Debug Then
  270. WSCript.echo TypeName(opEz) , opEz.name
  271. If True = opNZs.Test(opEz.Name) then
  272. WSCript.echo TypeName(opEz) , opEz.name, opEz.ModifyDate, opEz.type
  273. End If
  274. End If
  275. ' full name?
  276. spResult = spResult & VBNEWLINE & ucase(spOutput & "\" & opEz.name)
  277. End If
  278. End If
  279. Next
  280. Set opBrw = Nothing
  281. Set opEx = Nothing
  282. Set opEy = Nothing
  283. Set opNZs = Nothing
  284. spFindF = Mid(spResult,3)
  285. End Function
  286. Function spQthisE(siBarE)
  287. Dim opRxS, opRxX, opRxA, opRxB, opRxC
  288. Set opRxS = CreateObject("Scripting.Dictionary")
  289. Set opRxX = CreateObject("VBscript.RegExp")
  290. opRxS.add ".", "\."
  291. opRxS.add " ", "\s"
  292. opRxS.add "*", "[^.].*"
  293. With opRxX
  294. .Global = True
  295. .IgnoreCase = True
  296. .Pattern = ""
  297. End With
  298. opRxB = siBarE
  299. For Each opRxA in opRxS.Keys
  300. opRxB = Replace(opRxB, opRxA, opRxS(opRxA))
  301. Next
  302. If Debug Then
  303. If opRxX.Test(opRxB) then
  304. WSCript.echo "Replaced:", _
  305. QQUOT & siBarE & QQUOT, _
  306. QQUOT & opRxB & QQUOT
  307. End If
  308. End If
  309. Set opRxS = Nothing
  310. Set opRxX = Nothing
  311. spQthisE = opRxB
  312. End Function
  313. Function nxDataSetCnt(siQuery)
  314. '' e.g.
  315. '' nxDataSetCnt("application available")
  316. Dim opWbemLoc, opService, aopDataSet
  317. Set opWbemLoc = CreateObject("WbemScripting.SWbemLocator")
  318. opWbemLoc.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate
  319. opWbemLoc.Security_.Privileges.AddAsString("SeSystemEnvironmentPrivilege")
  320. Set opService = opWbemLoc.connectserver
  321. Set aopDataSet = opService.ExecQuery(GetResource(siQuery))
  322. nxDataSetCnt = aopDataSet.Count
  323. End Function
  324. ]]>
  325. </script>
  326. </job>
  327. <comment>
  328. This approach does not work.
  329. Objects\Shell\MinimizeAll.htm
  330. ...change wallpaper...
  331. Objects\Shell\UndoMinimizeALL.htm</comment>
  332. <comment>
  333. </comment>
  334. </package>