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.

426 lines
11 KiB

  1. <%
  2. dim szTableName
  3. szTableName=Request("Table")
  4. select case LCase(szTableName)
  5. case "", "bucket"
  6. szTableName = "Bucket"
  7. case "cab"
  8. szTableName = "Cab"
  9. case "bucketsetup"
  10. szTableName = "BucketSetup"
  11. case "datawanted"
  12. szTableName = "DataWanted"
  13. case "pid"
  14. szTableName = "Pid"
  15. case "bucketassert"
  16. szTableName = "BucketAssert"
  17. case "bucketcrash64"
  18. szTableName = "BucketCrash64"
  19. case else
  20. szTableName = LCase(szTableName)
  21. end select
  22. dim fDebugDB, fTestDB, iDatabase, fAlwaysDebug
  23. select case szTableName
  24. case "BucketAssert", "assertfile"
  25. fAlwaysDebug = True
  26. case else
  27. fAlwaysDebug = False
  28. end select
  29. fDebugDB = Request("Debug")
  30. fTestDB = Request("Test")
  31. iDatabase= Request("Database")
  32. if iDatabase = "" then iDatabase = 0
  33. select case iDatabase
  34. case 0
  35. if fAlwaysDebug = True then
  36. fDebugDB = "True"
  37. iDatabase = 2
  38. else
  39. fDebugDB = "False"
  40. end if
  41. fTestDB = "False"
  42. case 1
  43. if fAlwaysDebug = True then
  44. fDebugDB = "True"
  45. iDatabase = 3
  46. else
  47. fDebugDB = "False"
  48. end if
  49. fTestDB = "True"
  50. case 2
  51. fTestDB = "False"
  52. fDebugDB = "True"
  53. case 3
  54. fTestDB = "True"
  55. fDebugDB = "True"
  56. case 4
  57. fTestDB = "False"
  58. fDebugDB = "False"
  59. case else
  60. if fAlwaysDebug = True then
  61. fDebugDB="True"
  62. if fTestDB = "True" then
  63. iDatabase = 3
  64. else
  65. fTestDB="False"
  66. iDatabase = 2
  67. end if
  68. else
  69. if fDebugDB = "True" then
  70. if fTestDB = "True" then
  71. iDatabase = 3
  72. else
  73. fTestDB = "False"
  74. iDatabase = 2
  75. end if
  76. else
  77. fDebugDB="False"
  78. if fTestDB = "True" then
  79. iDatabase = 1
  80. else
  81. fTestDB = "False"
  82. iDatabase = 0
  83. end if
  84. end if
  85. end if
  86. end select
  87. dim rgTitle, szTitle
  88. rgTitle = Array(" (Ship internal)"," (Ship internal test)"," (Debug internal)"," (Debug internal test)", " (Live external)")
  89. szTitle = "DW.NET" & rgTitle(CInt(iDatabase))
  90. dim rgArchive, szArchiveUtil
  91. rgArchive = Array("\\OfficeWatson1\Watson\Ship/","\\OfficeWatson1\Watson\Ship/","\\OfficeWatson1\Watson\Debug/","\\OfficeWatson1\Watson\Debug/","\\CpOffFso03\Watson\Cabs/")
  92. szArchiveUtil = rgArchive(CInt(iDatabase))
  93. %>
  94. <!-- #include file="dbutil.asp"-->
  95. <%
  96. function IGetPid
  97. dim cBytePost
  98. dim objPid
  99. on error resume next
  100. cBytePost = Request.TotalBytes
  101. if (cBytePost = 0) or (cBytePost = 6) then
  102. IGetPid = -1
  103. else
  104. set objPid = Server.CreateObject("DigPid.DigPidInfo")
  105. ErrorCheck "IGetPid: CreateObject"
  106. objPid.ByteArray = Request.BinaryRead(cBytePost)
  107. if (cBytePost <> 164) and (cBytePost <> 256) then
  108. dim szOddSize
  109. szOddSize = "odd size [" & cBytePost & "]"
  110. ErrorLog "IGetPid: " & szOddSize
  111. DumpPid szOddSize, objPid.ByteArray, cBytePost
  112. end if
  113. if objPid.Status <> 0 then
  114. DumpPid "error", objPid.ByteArray, cBytePost
  115. IGetPid = -2
  116. else
  117. PidLog(objPid)
  118. ErrorCheck "IGetPid: PidLog"
  119. dim StaticHWID
  120. StaticHWID = objPid.StaticHWID
  121. if StaticHWID = "" then
  122. DumpPid "empty StaticHWID", objPid.ByteArray, cBytePost
  123. StaticHWID = "00000"
  124. end if
  125. StaticHWID = replace(StaticHWID,"?","9")
  126. dim objCmdPid
  127. set objCmdPid = Server.CreateObject("ADODB.COMMAND")
  128. ErrorCheck "Util: CreateObject Command"
  129. objCmdPid.ActiveConnection = objConn
  130. ErrorCheck "Util: objCmdPid.ActiveConnection"
  131. objCmdPid.CommandType = &H0004
  132. ErrorCheck "Util: objCmdPid.CommandType"
  133. objCmdPid.CommandText = "InsertPid"
  134. objCmdPid.Parameters.Append objCmdPid.CreateParameter ("@ProductID",129,&H0001,23,objPid.ProductID)
  135. objCmdPid.Parameters.Append objCmdPid.CreateParameter ("@ProdKeySeq",3,&H0001,,objPid.ProdKeySeq)
  136. objCmdPid.Parameters.Append objCmdPid.CreateParameter ("@GroupID",3,&H0001,,objPid.GroupID)
  137. objCmdPid.Parameters.Append objCmdPid.CreateParameter ("@InstallTime",3,&H0001,,objPid.InstallTime)
  138. objCmdPid.Parameters.Append objCmdPid.CreateParameter ("@Random",3,&H0001,,objPid.Random)
  139. objCmdPid.Parameters.Append objCmdPid.CreateParameter ("@StaticHWID",3,&H0001,,StaticHWID)
  140. dim objRecPid
  141. set objRecPid = objCmdPid.Execute
  142. ErrorCheck "objCmdPid.Execute InsertPid"
  143. if objRecPid.EOF then
  144. IGetPid = -3
  145. ErrorLog "Failed to insert Pid into database: " & objPid.ProductID & _
  146. "/" & objPid.ProdKeySeq & _
  147. "/" & objPid.GroupID & _
  148. "/" & objPid.InstallTime & _
  149. "/" & objPid.Random & _
  150. "/" & StaticHWID & "/"
  151. else
  152. IGetPid = objRecPid("iPid")
  153. end if
  154. objRecPid.Close
  155. ErrorCheck "objRecPid.Close"
  156. set objRecPid = nothing
  157. set objCmdPid = nothing
  158. end if
  159. set objPid = nothing
  160. end if
  161. end function
  162. sub DumpPid (szPidTitle, objPidDump, cbPid)
  163. end sub
  164. function SzRandomCab()
  165. dim szRandom1,szRandom2
  166. dim cPad1,cPad2
  167. Randomize
  168. szRandom1 = int(rnd()*9999)
  169. cPad1 = 4 - len(szRandom1)
  170. szRandom2 = int(rnd()*9999)
  171. cPad2 = 4 - len(szRandom2)
  172. SzRandomCab = string(cPad1,"0") & szRandom1 & string(cPad2,"0") & szRandom2 & ".cab"
  173. end function
  174. function SzUnderscore(szInput)
  175. SzUnderscore = replace(replace(replace(szInput,".","_"),"\","_"),":","_")
  176. end function
  177. function FStageOneExist (iDatabase, szStageOne)
  178. if iDatabase = 4 then
  179. FStageOneExist = 0
  180. else
  181. FStageOneExist = CreateObject("Scripting.FileSystemObject").FileExists(server.mappath(szStageOne))
  182. end if
  183. end function
  184. sub ErrorCheck (szArg)
  185. on error resume next
  186. if err then
  187. ErrorLog "ErrorCheck: " & szArg & "; " & err.Source & "; " & err.Number & "; " & err.Description
  188. err.Clear
  189. end if
  190. end sub
  191. sub ErrorWrite (szArgWrite)
  192. on error resume next
  193. if err then
  194. response.write "ErrorWrite: " & szArgWrite & "; " & err.Source & "; " & err.Number & "; " & err.Description & "</BR>"
  195. err.Clear
  196. end if
  197. end sub
  198. sub DebugLog (szDump)
  199. dim szTodayDir
  200. dim objTextStream
  201. dim objFileSysDebugLog
  202. Const iTempDir = 2
  203. Const iAppend = 8
  204. on error resume next
  205. szTodayDir = replace(FormatDateTime(date,2),"/","_")
  206. set objFileSysDebugLog = CreateObject("Scripting.FileSystemObject")
  207. objFileSysDebugLog.CreateFolder("\\OfficeWatson1\Watson" & "\WebSite/" & szTodayDir)
  208. set objTextStream = objFileSysDebugLog.OpenTextFile("\\OfficeWatson1\Watson" & "\WebSite/" & szTodayDir & "\dwlog.txt", iAppend, True)
  209. objTextStream.WriteLine now & ":" & szDump
  210. objTextStream.Close
  211. set objTextStream = nothing
  212. set objFileSysDebugLog = nothing
  213. end sub
  214. sub DebugWrite (szDump)
  215. response.write szDump & "</BR>"
  216. end sub
  217. sub ErrorLog (szDump)
  218. dim szTodayDir
  219. dim objTextStream
  220. dim objFileSysErrorLog
  221. Const iTempDir = 2
  222. Const iAppend = 8
  223. on error resume next
  224. szTodayDir = replace(FormatDateTime(date,2),"/","_")
  225. set objFileSysErrorLog = CreateObject("Scripting.FileSystemObject")
  226. objFileSysErrorLog.CreateFolder("\\OfficeWatson1\Watson" & "\WebSite/" & szTodayDir)
  227. set objTextStream = objFileSysErrorLog.OpenTextFile("\\OfficeWatson1\Watson" & "\WebSite/" & szTodayDir & "\dwerror.txt", iAppend, True)
  228. objTextStream.WriteLine now & ":" & szDump
  229. objTextStream.Close
  230. set objTextStream = nothing
  231. set objFileSysErrorLog = nothing
  232. end sub
  233. sub PidLog (objDig)
  234. on error resume next
  235. dim objTextStream
  236. dim objFileSysPidLog
  237. Const iTempDir = 2
  238. Const iAppend = 8
  239. set objFileSysPidLog = CreateObject("Scripting.FileSystemObject")
  240. ErrorCheck "PidLog: CreateFSO"
  241. if objFileSysPidLog.FileExists("\\OfficeWatson1\Watson" & "\WebSite/" & "dwcdkey.txt") then
  242. ErrorCheck "PidLog: FileExists"
  243. set objTextStream = objFileSysPidLog.OpenTextFile("\\OfficeWatson1\Watson" & "\WebSite/" & "dwcdkey.txt", iAppend, True)
  244. ErrorCheck "PidLog: OpenTextFile"
  245. else
  246. ErrorCheck "PidLog: FileExists"
  247. set objTextStream = objFileSysPidLog.OpenTextFile("\\OfficeWatson1\Watson" & "\WebSite/" & "dwcdkey.txt", iAppend, True)
  248. ErrorCheck "PidLog: OpenTextFile"
  249. objTextStream.WriteLine "time" & vbTab _
  250. & "ProductID" & vbTab _
  251. & "ProdKeySeq" & vbTab _
  252. & "ProdKeyIsUpgrade" & vbTab _
  253. & "GroupID" & vbTab _
  254. & "ProductIdSeq" & vbTab _
  255. & "SKU" & vbTab _
  256. & "RPC" & vbTab _
  257. & "CloneStatus" & vbTab _
  258. & "InstallTime" & vbTab _
  259. & "Random" & vbTab _
  260. & "LicenseType" & vbTab _
  261. & "LicenseData1" & vbTab _
  262. & "LicenseData2" & vbTab _
  263. & "OemId" & vbTab _
  264. & "StaticHWID" & vbTab _
  265. & "DynamicHWID"
  266. ErrorCheck "PidLog: WriteLine"
  267. end if
  268. objTextStream.WriteLine now & vbTab _
  269. & objDig.ProductID & vbTab _
  270. & objDig.ProdKeySeq & vbTab _
  271. & objDig.ProdKeyIsUpgrade & vbTab _
  272. & objDig.GroupID & vbTab _
  273. & objDig.ProductIdSeq & vbTab _
  274. & objDig.SKU & vbTab _
  275. & objDig.RPC & vbTab _
  276. & objDig.CloneStatus & vbTab _
  277. & objDig.InstallTime & vbTab _
  278. & objDig.Random & vbTab _
  279. & objDig.LicenseType & vbTab _
  280. & objDig.LicenseData1 & vbTab _
  281. & objDig.LicenseData2 & vbTab _
  282. & objDig.OemId & vbTab _
  283. & objDig.StaticHWID & vbTab _
  284. & objDig.DynamicHWID
  285. ErrorCheck "PidLog: WriteLine"
  286. objTextStream.Close
  287. set objTextStream = nothing
  288. set objFileSysPidLog = nothing
  289. end sub
  290. dim rgBuildMachine
  291. dim rgDebugBuildMachine
  292. dim rgShipBuildMachine
  293. rgDebugBuildMachine = "unknown," & "marsbld,msnbld,msnbuild," & "IEBLDX86,IEX86,CWDBLDX86," & "OFFACS6,OFFACS8," & "OFFDES6,OFFDES8," & "OFFFP6,OFFFP8," & "OFFMSO6,OFFMSO8," & "OFFOUT6,OFFOUT8," & "OFFPHD6,OFFPHD8," & "OFFPPT6,OFFPPT8," & "OFFPUB6,OFFPUB8," & "OFFWORD6,OFFWORD8," & "OFFXL6,OFFXL8," & "OFFZEN4," & "VSBLD104," & "VSBLD204,VSBLD207," & "VSBuildLab," & "VISIOBLD," & "CORPWATSON," & "NDBUILD01,NDBUILD02,NDBUILD03,NDBUILD04," & "P10BUILDS," & "saweblda01," & "UnknownReadOnlyUser," & "HANNAHZ7,HANNAHZ6,"
  294. rgShipBuildMachine = "unknown," & "marsbld,msnbld,msnbuild," & "IEBLDX86,IEX86,CWDBLDX86," & "OFFACS5,OFFACS7," & "OFFDES5,OFFDES7," & "OFFFP5,OFFFP7," & "OFFMSO5,OFFMSO7," & "OFFOUT5,OFFOUT7," & "OFFPHD5,OFFPHD7," & "OFFPPT5,OFFPPT7," & "OFFPUB5,OFFPUB7," & "OFFWORD5,OFFWORD7," & "OFFXL5,OFFXL7," & "OFFZEN3," & "VSBLD41,VSBLD70,VSBLD71,VSBLD72," & "VSBLD80,VSBLD83,VSBLD84,VSBLD87," & "VSBLD100,VSBLD102,VSBLD103,VSBLD104,VSBLD105,VSBLD106," & "VSBLD111,VSBLD200,VSBLD201,VSBLD204,VSBLD205," & "VSBLD,VSBuildLab," & "VISIOBLD," & "CORPWATSON," & "NDBUILD01,NDBUILD02,NDBUILD03,NDBUILD04," & "P10BUILDS," & "saweblda01," & "UnknownReadOnlyUser," & "HANNAHZ7,HANNAHZ6,"
  295. function FBuildMachine(iDatabase, szMachine)
  296. dim fReturn
  297. select case iDatabase
  298. case 0
  299. rgBuildMachine = rgShipBuildMachine
  300. case 1
  301. rgBuildMachine = rgShipBuildMachine
  302. case 2
  303. rgBuildMachine = rgDebugBuildMachine
  304. case 3
  305. rgBuildMachine = rgDebugBuildMachine
  306. case 4
  307. rgBuildMachine = rgShipBuildMachine
  308. end select
  309. fReturn = InStr(rgBuildMachine,szMachine & ",")
  310. FBuildMachine = fReturn
  311. end function
  312. function ValidChar(szStr,fApos)
  313. if not isNull(szStr) then
  314. szStr = Replace(szStr,"&","&amp;")
  315. if fApos then szStr = Replace(szStr,"'","&apos;")
  316. szStr = Replace(szStr,">","&gt;")
  317. szStr = Replace(szStr,"<","&lt;")
  318. szStr = Replace(szStr,Chr(34),"&quot;")
  319. end if
  320. ValidChar = szStr
  321. end function
  322. %>