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.

224 lines
5.0 KiB

  1. Option Explicit
  2. const SKU_SRV = 4
  3. const SKU_ADS = 8
  4. const SKU_DTC = 16
  5. const SKU_ADS64 = 64
  6. const SKU_DTC64 = 128
  7. const SERVER_MDB = "d:\temp\Server.mdb"
  8. const DESKTOP_MDB = "c:\temp\Desktop.mdb"
  9. const WINME_MDB = "c:\temp\WinMe.mdb"
  10. Dim clsAuthDatabase
  11. Set clsAuthDatabase = CreateObject("AuthDatabase.Main")
  12. TestImportHHK
  13. Sub TestKeywordifyTitles
  14. Dim clsTaxonomy
  15. clsAuthDatabase.SetDatabase SERVER_MDB
  16. Set clsTaxonomy = clsAuthDatabase.Taxonomy
  17. clsTaxonomy.KeywordifyTitles 1
  18. End Sub
  19. Sub TestImportHHK
  20. Dim clsImporter
  21. Dim FSO
  22. Dim Folder
  23. Dim File
  24. clsAuthDatabase.SetDatabase SERVER_MDB
  25. Set clsImporter = clsAuthDatabase.Importer
  26. Set FSO = CreateObject("Scripting.FileSystemObject")
  27. Set Folder = FSO.GetFolder("\\srvua\Latest\HelpDirs\SRV\Help\HHK")
  28. For Each File in Folder.Files
  29. clsImporter.ImportHHK File.Path, _
  30. "\\srvua\Latest\HelpDirs\SRV\Help", SKU_SRV, 0, "", 2
  31. Next
  32. End Sub
  33. Sub TestImportHHC
  34. Dim clsImporter
  35. clsAuthDatabase.SetDatabase SERVER_MDB
  36. Set clsImporter = clsAuthDatabase.Importer
  37. clsImporter.ImportHHC "\\srvua\Latest\HelpDirs\SRV\Help\HHC\windows.hhc", _
  38. "\\srvua\Latest\HelpDirs\SRV\Help", SKU_SRV, 0, ""
  39. End Sub
  40. Sub TestImportHHT
  41. Dim clsHHT
  42. clsAuthDatabase.SetDatabase DESKTOP_MDB
  43. Set clsHHT = clsAuthDatabase.HHT
  44. clsHHT.ImportHHT "c:\temp\foo.xml", 1234
  45. End Sub
  46. Sub UpdateChqAndHhk
  47. Dim clsChqsAndHhks
  48. clsAuthDatabase.SetDatabase SERVER_MDB
  49. Set clsChqsAndHhks = clsAuthDatabase.ChqsAndHhks
  50. clsChqsAndHhks.UpdateTable 4, "\\pietrino\HSCExpChms\Srv\winnt", _
  51. "\\pietrino\HlpImages\Srv\winnt"
  52. End Sub
  53. Sub TestChqAndHhk
  54. Dim clsChqsAndHhks
  55. Dim dictFilesAdded
  56. Dim dictFilesRemoved
  57. Dim dtmT0
  58. Dim dtmT1
  59. Dim vnt
  60. clsAuthDatabase.SetDatabase SERVER_MDB
  61. Set clsChqsAndHhks = clsAuthDatabase.ChqsAndHhks
  62. clsChqsAndHhks.UpdateTable 4, "c:\temp\CHQ\1"
  63. Sleep 2000
  64. clsChqsAndHhks.UpdateTable 8, "c:\temp\CHQ\1"
  65. dtmT0 = Now
  66. Sleep 5000
  67. clsChqsAndHhks.UpdateTable 4, "c:\temp\CHQ\2"
  68. Sleep 2000
  69. clsChqsAndHhks.UpdateTable 8, "c:\temp\CHQ\2"
  70. Sleep 5000
  71. clsChqsAndHhks.UpdateTable 4, "c:\temp\CHQ\3"
  72. dtmT1 = Now
  73. Set dictFilesAdded = CreateObject("Scripting.Dictionary")
  74. Set dictFilesRemoved = CreateObject("Scripting.Dictionary")
  75. clsChqsAndHhks.GetFileListDelta 4, dtmT0, dtmT1, dictFilesAdded, dictFilesRemoved
  76. WScript.Echo "Files added for SRV:"
  77. For Each vnt in dictFilesAdded.Keys
  78. WScript.Echo vnt
  79. Next
  80. WScript.Echo "Files removed for SRV:"
  81. For Each vnt in dictFilesRemoved.Keys
  82. WScript.Echo vnt
  83. Next
  84. dictFilesAdded.RemoveAll
  85. dictFilesRemoved.RemoveAll
  86. clsChqsAndHhks.GetFileListDelta 8, dtmT0, dtmT1, dictFilesAdded, dictFilesRemoved
  87. WScript.Echo "Files added for ADV:"
  88. For Each vnt in dictFilesAdded.Keys
  89. WScript.Echo vnt
  90. Next
  91. WScript.Echo "Files removed for ADV:"
  92. For Each vnt in dictFilesRemoved.Keys
  93. WScript.Echo vnt
  94. Next
  95. End Sub
  96. Sub TestDatabaseBackup
  97. clsAuthDatabase.CopyAndCompactDatabase SERVER_MDB, "c:\temp\ServerBack.mdb"
  98. clsAuthDatabase.CopyAndCompactDatabase DESKTOP_MDB, "c:\temp\DesktopBack.mdb"
  99. End Sub
  100. Sub TestServerCAB
  101. Dim clsHHT
  102. clsAuthDatabase.SetDatabase SERVER_MDB
  103. Set clsHHT = clsAuthDatabase.HHT
  104. clsHHT.GenerateCAB "c:\temp\SRV.cab", 4
  105. rem clsHHT.GenerateCAB "c:\temp\ADV.cab", 8
  106. rem clsHHT.GenerateCAB "c:\temp\DAT.cab", 16
  107. rem clsHHT.GenerateCAB "c:\temp\ADV64.cab", 64
  108. rem clsHHT.GenerateCAB "c:\temp\DAT64.cab", 128
  109. End Sub
  110. Sub TestDesktopCAB
  111. Dim clsHHT
  112. clsAuthDatabase.SetDatabase DESKTOP_MDB
  113. Set clsHHT = clsAuthDatabase.HHT
  114. clsHHT.GenerateCAB "c:\temp\STD.cab", 1
  115. clsHHT.GenerateCAB "c:\temp\PRO.cab", 2
  116. clsHHT.GenerateCAB "c:\temp\PRO64.cab", 32
  117. End Sub
  118. Sub TestWinMeCAB
  119. Dim clsHHT
  120. clsAuthDatabase.SetDatabase WINME_MDB
  121. Set clsHHT = clsAuthDatabase.HHT
  122. clsHHT.GenerateHHT "c:\temp\WINME.cab", 256, "Windows Me Update", False
  123. End Sub
  124. Sub TestSynonymSets()
  125. Dim clsSynonymSets
  126. Dim arrKeywords(3)
  127. Dim v
  128. clsAuthDatabase.SetDatabase WINME_MDB
  129. Set clsSynonymSets = clsAuthDatabase.SynonymSets
  130. arrKeywords(0) = 0
  131. arrKeywords(1) = 1
  132. arrKeywords(2) = 2
  133. arrKeywords(3) = 3
  134. v = arrKeywords
  135. clsSynonymSets.Create ".aaaaaaaaaahhhhhhh", v, 0, 0, "Test"
  136. End Sub
  137. Sub TestParameters()
  138. Dim clsParameters
  139. clsAuthDatabase.SetDatabase WINME_MDB
  140. Set clsParameters = clsAuthDatabase.Parameters
  141. clsParameters.Value("Foo") = 134
  142. Wscript.Echo clsParameters.Value("Foo") * 2
  143. End Sub
  144. Sub Sleep(intMilliSeconds)
  145. Dim WshShell
  146. Set WshShell = WScript.CreateObject("WScript.Shell")
  147. WScript.Sleep intMilliSeconds
  148. End Sub