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.
|
|
<HTML> <OBJECT width=0 height=0 ID=pchealth classid=CLSID:FC7D9E02-3F9E-11d3-93C0-00C04F72DAF7></OBJECT> <SCRIPT language=VBScript>
Set fsoObject = CreateObject("Scripting.FileSystemObject") Set shellObject = CreateObject("Wscript.Shell")
Dim strOpenedTime Dim strClosedTime Dim incidentItemObject Dim channelObject Dim incidentObject
Const pchAllIncidents = 1 Const pchOpenIncidents = 2 Const pchClosedIncidents = 3 Const pchIncidentOpen = 1 Const pchIncidentClosed = 2 Const WindowsFolder = 0 Const SystemFolder = 1 Const TemporaryFolder = 2
strVendorID = "CN=Microsoft Corporation,L=Redmond,S=Washington,C=US" strProductID = "Microsoft Millennium Beta" strWindowsFolder = fsoObject.GetSpecialFolder(WindowsFolder) strSystemFolder = fsoObject.GetSpecialFolder(SystemFolder) strTemporaryFolder = fsoObject.GetSpecialFolder(TemporaryFolder) intUniqueNumber = getUniqueNumber() strNewIncidentURL = "http://" & intUniqueNumber strNewIncidentDisplay = "This is an IDW Test incident " & strURL strSetFirstNewDisplayString = "New First IDW Display String " & intUniqueNumber strSetFirstNewURL = "http://IDW_FIRST_URL_CHANGE_TEST/" & intUniqueNumber strSetSecondNewDisplayString = "New Second IDW Display String " & intUniqueNumber strSetSecondNewURL = "http://IDW_SECOND_URL_CHANGE_TEST/" & intUniqueNumber intIncidentIndexNumber = 0 strIncidentObjectUserName = "Incident Object User Name" strIncidentObjectProductID = "Incident Object Product ID #1234567890" strIncidentObjectProductName = "Incident Object Product Name" strIncidentObjectProblemDescription = "Incident Object Problem Description, 1234567890" strIncidentObjectFileName = strTemporaryFolder & "\incidentObjectTestFile.txt"
Set channelObject = pchealth.CreateObject_channel(strVendorID, strProductID) Set incidentObject = pchealth.CreateObject_Incident()
CloseAllIncidents() GetVendorID() GetProductID() GetVendorName() GetProductName() document.write "Inital Incident Count: <BR>" document.write "No Result Is Expected <BR>" intOriginalGetAllIncidentsCount = GetAllIncidentsCount() intOriginalGetOpenIncidentsCount = GetOpenIncidentsCount() intOriginalGetClosedIncidentsCount = GetClosedIncidentsCount() document.write "<HR>" 'Record a new incident here strReturnedNewIncidentURL = RecordNewIncident(strNewIncidentURL, strNewIncidentDisplay) sortAllIncidents() CheckIncidentStatus(pchIncidentOpen) SetNewDisplayString(strSetFirstNewDisplayString) SetNewURL(strSetFirstNewURL) CloseNewIncident(strReturnedNewIncidentURL) CheckIncidentStatus(pchIncidentClosed) SetNewDisplayString(strSetSecondNewDisplayString) SetNewURL(strSetSecondNewURL) CheckCreationTime(strOpenedTime) CheckClosedTime(strClosedTime) incidentObjectBinFileSave() incidentObjectBinFileLoad()
Public Sub incidentObjectBinFileLoad()
incidentObject.Load strIncidentObjectFileName
strReturnedIncidentObjectUserName = incidentObject.UserName strReturnedIncidentObjectProductID = incidentObject.ProductID strReturnedIncidentObjectProductName = incidentObject.ProductName strReturnedIncidentObjectProblemDescription = incidentObject.ProblemDescription
document.write "Load Incident Object Information From Bin File<BR>" document.write "Returned User Name: " & strReturnedIncidentObjectUserName & "<BR>" document.write "Returned Product ID: " & strReturnedIncidentObjectProductID & "<BR>" document.write "Returned Product Name: " & strReturnedIncidentObjectProductName & "<BR>" document.write "Returned Problem Description: " & strReturnedIncidentObjectProblemDescription & "<BR>"
If strReturnedIncidentObjectUserName = strIncidentObjectUserName Then strReturnedIncidentObjectUserNameResult = "<li>User Name Match Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strReturnedIncidentObjectUserNameResult = "<li>User Name Match Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
If strReturnedIncidentObjectProductID = strIncidentObjectProductID Then strReturnedIncidentObjectProductIDResult = "<li>Product ID Match Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strReturnedIncidentObjectProductIDResult = "<li>Product ID Match Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
If strReturnedIncidentObjectProductName = strIncidentObjectProductName Then strReturnedIncidentObjectProductNameResult = "<li>Product Name Match Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strReturnedIncidentObjectProductNameResult = "<li>Product Name Match Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
If strReturnedIncidentObjectProblemDescription = strIncidentObjectProblemDescription Then strReturnedIncidentObjectProblemDescriptionResult = "<li>Problem Description Match Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strReturnedIncidentObjectProblemDescriptionResult = "<li>Problem Description Match Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
document.write strReturnedIncidentObjectUserNameResult document.write strReturnedIncidentObjectProductIDResult document.write strReturnedIncidentObjectProductNameResult document.write strReturnedIncidentObjectProblemDescriptionResult
document.write "<HR>"
End Sub
Public Sub incidentObjectBinFileSave()
document.write "Save Incident Object Information to Bin File<BR>" document.write "User Name: " & strIncidentObjectUserName & "<BR>" document.write "Product ID: " & strIncidentObjectProductID & "<BR>" document.write "Product Name: " & strIncidentObjectProductName & "<BR>" document.write "Problem Description: " & strIncidentObjectProblemDescription & "<BR>"
If fsoObject.FileExists(strIncidentObjectFileName) Then fsoObject.DeleteFile(strIncidentObjectFileName) End If
incidentObject.UserName = strIncidentObjectUserName incidentObject.ProductID = strIncidentObjectProductID incidentObject.ProductName = strIncidentObjectProductName incidentObject.ProblemDescription = strIncidentObjectProblemDescription
incidentObject.Save strIncidentObjectFileName
document.write "File Name: " & strIncidentObjectFileName & "<BR>"
End Sub
Public Sub CheckIncidentStatus(intStatusShouldBe)
Err.Clear
On Error Resume Next
intReturnedStatus = incidentItemObject.Status
document.write "Current Status Test<BR>" document.write "Status Should Be: " & intStatusShouldBe & "<BR>" document.write "Returned status: " & intReturnedStatus & "<BR>"
If intReturnedStatus = intStatusShouldBe Then strStatusTestResult = "<li>Status Returned Match Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strStatusTestResult = "<li>Status Returned Match Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
document.write strStatusTestResult If Err.number <> 0 Then document.write Err.number & " : " & Err.description & "<BR>" End If document.write "<HR>"
Err.Clear
End Sub
Public Sub CheckClosedTime(strClosedTime)
Err.Clear
On Error Resume Next
strReturnedClosedTime = incidentItemObject.ClosedTime
document.write "Closed Time Test<BR>" document.write "Closed Time: " & strClosedTime & "<BR>" document.write "Returned Closed Time: " & strReturnedClosedTime & "<BR>"
If strReturnedClosedTime = strOpenedTime Then strClosedTimeTestResult = "<li>ClosedTime Returned Match Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strClosedTimeTestResult = "<li>ClosedTime Returned Match Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
document.write strClosedTimeTestResult document.write Err.number & " : " & Err.description & "<BR>" document.write "<HR>"
Err.Clear
End Sub
Public Sub CheckCreationTime(strOpenedTime)
strReturnedCreationTime = incidentItemObject.CreationTime
document.write "Creation Time Test<BR>" document.write "Opened Time: " & strOpenedTime & "<BR>" document.write "Returned Creation Time: " & strReturnedCreationTime & "<BR>"
If strReturnedCreationTime = strOpenedTime Then strCreationTimeTestResult = "<li>Creation Time Returned Match Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strCreationTimeTestResult = "<li>Creation Time Returned Match Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
document.write strCreationTimeTestResult document.write "<HR>"
End Sub
Public Function getUniqueNumber()
strUniqueNumber = Second(Now) & Minute(Now) & Hour(Now) & Int((Second(Now) & Minute(Now) & Hour(Now)) * Rnd) getUniqueNumber = strUniqueNumber
End Function
Public Sub SetNewURL(strSetNewURL)
document.write "Set New URL Test<BR>"
strOriginalURL = incidentItemObject.URL incidentItemObject.URL = strSetNewURL strNewReturnedURL = incidentItemObject.URL
document.write "Original Returned String: " & strOriginalURL & "<BR>" document.write "New String: " & strNewReturnedURL & "<BR>"
checkURLChangeResults strOriginalURL, strNewReturnedURL, strSetNewURL
document.write "<HR>"
End Sub
Public Sub CheckURLChangeResults(strOriginalURL, strNewReturnedURL, strSetNewURL)
strMethodToVerify = "URL"
If strOriginalURL = strNewReturnedURL Then strURLDifferentResult = "<li>URL Returned Different Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" Else strURLDifferentResult = "<li>URL Returned Different Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" End If
If strNewReturnedURL = strSetNewURL Then strURLMatchResult = "<li>URL Returned Match Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strURLMatchResult = "<li>URL Returned Match Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
If strNewReturnedURL = VerifyChangeWithOtherObject(strMethodToVerify) Then strOtherObjectURLMatchResult = "<li>URL Other Object Check Match Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strOtherObjectURLMatchResult = "<li>URL Other Object Check Match Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
document.write strURLDifferentResult document.write strURLMatchResult document.write strOtherObjectURLMatchResult
End Sub
Public Sub CloseAllIncidents()
Err.Clear
set channelIncidents = channelObject.Incidents(pchOpenIncidents)
If Err.Number = 0 Then If channelIncidents.Count > 0 Then i = 0 For Each oItem in channelIncidents Set incidentItemObject = channelIncidents.Item(i) strURL = incidentItemObject.URL document.write "<BR>" document.write strURL & "<BR>" channelObject.CloseIncident strURL strClosedURL = incidentItemObject.URL document.write strClosedURL i = i + 1 Next End If End If
Err.Clear
End Sub
Public Function VerifyChangeWithOtherObject(strMethodToVerify)
Set tempChannelObject = pchealth.CreateObject_channel(strVendorID, strProductID) set tempChannelIncidents = tempChannelObject.Incidents(pchAllIncidents)
Err.Clear
If Err.Number = 0 Then If tempChannelIncidents.Count > 0 Then
' This is where we start to sort Dim arrayCount Dim sortTemp ReDim sortTemp(tempChannelIncidents.Count) arrayCount = 0 For Each oItem in tempChannelIncidents set sortTemp(arrayCount) = oItem arrayCount = arrayCount + 1 Next
'Sort Here For arrayCount = o to tempChannelIncidents.Count - 2 For arraySortCount = arrayCount + 1 to tempChannelIncidents.Count - 1 If sortTemp(arrayCount).CreationTime < sortTemp(arraySortCount).CreationTime Then Dim additionalSortTemp Set additionalSortTemp = sortTemp(arrayCount) Set sortTemp(arrayCount) = sortTemp(arraySortCount) Set sortTemp(arraySortCount) = additionalSortTemp End If Next Next End If End If
Err.Clear
Set tempIncidentItemObject = tempChannelIncidents.Item(intIncidentIndexNumber)
If strMethodToVerify = "DisplayString" Then strResult = tempIncidentItemObject.DisplayString document.write "Other Object Return Check: " & strResult & "<BR>" VerifyChangeWithOtherObject = strResult ElseIf strMethodToVerify = "URL" Then strResult = tempIncidentItemObject.URL document.write "Other Object Return Check: " & strResult & "<BR>" VerifyChangeWithOtherObject = strResult ElseIf strMethodToVerify = "Status" Then strResult = tempIncidentItemObject.Status document.write "Other Object Return Check: " & strResult & "<BR>" VerifyChangeWithOtherObject = strResult Else document.write "<FONT color=red><STRONG>Error checking other object</STRONG></FONT> <BR>" End If
End Function
Public Sub SetNewDisplayString(strSetNewDisplayString)
document.write "Set New Display String Test<BR>"
strOriginalDisplayString = incidentItemObject.DisplayString incidentItemObject.DisplayString = strSetNewDisplayString strNewReturnedDisplayString = incidentItemObject.DisplayString
document.write "Original Returned String: " & strOriginalDisplayString & "<BR>" document.write "New String: " & strNewReturnedDisplayString & "<BR>"
CheckDisplayStringResults strOriginalDisplayString, strNewReturnedDisplayString, strSetNewDisplayString
document.write "<HR>"
End Sub
Public Sub CheckDisplayStringResults(strOriginalDisplayString, strNewReturnedDisplayString, strSetNewDisplayString)
strMethodToVerify = "DisplayString"
If strOriginalDisplayString = strNewReturnedDisplayString Then strDisplayStringDifferentResult = "<li>Display Returned String Different Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" Else strDisplayStringDifferentResult = "<li>Display Returned String Different Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" End If
If strNewReturnedDisplayString = strSetNewDisplayString Then strDisplayStringMatchResult = "<li>Display Returned String Match Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strDisplayStringMatchResult = "<li>Display Returned String Match Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
If strNewReturnedDisplayString = VerifyChangeWithOtherObject(strMethodToVerify) Then strOtherObjectDisplayStringMatchResult = "<li>Display Other Object Check String Match Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strOtherObjectDisplayStringMatchResult = "<li>Display Other Object Check String Match Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
document.write strDisplayStringDifferentResult document.write strDisplayStringMatchResult document.write strOtherObjectDisplayStringMatchResult
End Sub
Public Sub sortAllIncidents()
Err.Clear
set channelIncidents = channelObject.Incidents(pchAllIncidents)
If Err.Number = 0 Then If channelIncidents.Count > 0 Then
' This is where we start to sort Dim arrayCount Dim sortTemp ReDim sortTemp(channelIncidents.Count) arrayCount = 0 For Each oItem in channelIncidents set sortTemp(arrayCount) = oItem arrayCount = arrayCount + 1 Next
'Sort Here For arrayCount = o to channelIncidents.Count - 2 For arraySortCount = arrayCount + 1 to channelIncidents.Count - 1 If sortTemp(arrayCount).CreationTime < sortTemp(arraySortCount).CreationTime Then Dim additionalSortTemp Set additionalSortTemp = sortTemp(arrayCount) Set sortTemp(arrayCount) = sortTemp(arraySortCount) Set sortTemp(arraySortCount) = additionalSortTemp End If Next Next End If End If
Err.Clear
Set incidentItemObject = channelIncidents.Item(intIncidentIndexNumber)
End Sub
Public Sub CloseNewIncident(strReturnedNewIncidentURL)
document.write "Close New Incident Test<BR>"
channelObject.CloseIncident strReturnedNewIncidentURL
strClosedTime = Now
intNewOpenIncidentCount = GetOpenIncidentsCount() intNewClosedIncidentCount = GetClosedIncidentsCount() intNewAllIncidentCount = GetAllIncidentsCount()
If intNewOpenIncidentCount = (intOriginalGetOpenIncidentsCount) Then strOpenIncidentCountResult = "<li>New Open Incident Count Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strOpenIncidentCountResult = "<li>New Open Incident Count Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If document.write strOpenIncidentCountResult
If intNewClosedIncidentCount = (intOriginalGetClosedIncidentsCount + 1) Then strClosedIncidentCountResult = "<li>New Closed Incident Count Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strClosedIncidentCountResult = "<li>New Closed Incident Count Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
document.write strClosedIncidentCountResult
If intNewAllIncidentCount = (intNewClosedIncidentCount + intNewOpenIncidentCount) Then strAllIncidentCountResult = "<li>New All Incident Count Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strAllIncidentCountResult = "<li>New All Incident Count Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
document.write strAllIncidentCountResult document.write "<HR>"
End Sub
Public Function RecordNewIncident(strNewIncidentURL, strNewIncidentDisplay)
document.write "Record New Incident Test<BR>"
channelObject.RecordIncident strNewIncidentDisplay, strNewIncidentURL
strOpenedTime = Now
intNewOpenIncidentCount = GetOpenIncidentsCount() intNewClosedIncidentCount = GetClosedIncidentsCount() intNewAllIncidentCount = GetAllIncidentsCount()
If intNewOpenIncidentCount = (intOriginalGetOpenIncidentsCount + 1) Then strOpenIncidentCountResult = "<li>New Open Incident Count Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strOpenIncidentCountResult = "<li>New Open Incident Count Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
document.write strOpenIncidentCountResult
If intNewClosedIncidentCount = (intOriginalGetClosedIncidentsCount + 1) Then strClosedIncidentCountResult = "<li>New Closed Incident Count Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" Else strClosedIncidentCountResult = "<li>New Closed Incident Count Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" End If
document.write strClosedIncidentCountResult
If intNewAllIncidentCount = (intOriginalGetAllIncidentsCount + 1) Then strAllIncidentCountResult = "<li>New All Incident Count Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strAllIncidentCountResult = "<li>New All Incident Count Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
document.write strAllIncidentCountResult
RecordNewIncident = strNewIncidentURL document.write "<HR>"
End Function
Public Function GetClosedIncidentsCount()
set channelIncidents = channelObject.Incidents(pchClosedIncidents)
intClosedIncidentsCount = channelIncidents.Count
document.write "Closed Incidents Count: " & intClosedIncidentsCount & "<BR>"
GetClosedIncidentsCount = intClosedIncidentsCount
End Function
Public Function GetOpenIncidentsCount()
set channelIncidents = channelObject.Incidents(pchOpenIncidents)
intOpenIncidentsCount = channelIncidents.Count
document.write "Open Incidents Count: " & intOpenIncidentsCount & "<BR>"
GetOpenIncidentsCount = intOpenIncidentsCount
End Function
Public Function GetAllIncidentsCount()
set channelIncidents = channelObject.Incidents(pchAllIncidents)
intAllIncidentsCount = channelIncidents.Count
document.write "All Incidents Count: " & intAllIncidentsCount & "<BR>"
GetAllIncidentsCount = intAllIncidentsCount
End Function
Public Sub GetProductName()
document.write "Get Product Name Test <BR>"
strProductNameOut = channelObject.ProductName strRegProductName = shellObject.RegRead("HKLM\Software\Microsoft\PCHealth\HelpCenter\SAF\Channel\" & strVendorID & "\" & strProductID & "\Description")
document.write "From Channel.ProductName: " & strProductNameOut & "<BR>" document.write "From Registry: " & strRegProductName & "<BR>"
If strProductNameOut = strRegProductName Then strGetProductNameResult = "<li>GetProductName Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strGetProductNameResult = "<li>GetProductName Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
document.write strGetProductNameResult document.write "<HR>"
End Sub
Public Sub GetVendorName()
document.write "Get Vendor Name Test <BR>"
strVendorNameOut = channelObject.VendorName strRegVendorName = shellObject.RegRead("HKLM\Software\Microsoft\PCHealth\HelpCenter\SAF\Channel\" & strVendorID & "\CompanyName")
document.write "From Channel.VendorName: " & strVendorNameOut & "<BR>" document.write "From Registry: " & strRegVendorName & "<BR>"
If strVendorNameOut = strRegVendorName Then strGetVendorNameResult = "<li>GetVendorName Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strGetVendorNameResult = "<li>GetVendorName Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
document.write strGetVendorNameResult document.write "<HR>"
End Sub
Public Sub GetProductID()
document.write "Get Product ID Test <BR>"
strProductIDOut = channelObject.ProductID
Document.Write "From Channel.ProductID: " & strProductIDOut & "<BR>" Document.Write "From Registry: " & strProductID & "<BR>"
If strProductIDOut = strProductID Then strGetProductIDResult = "<li>GetProductID Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strGetProductIDResult = "<li>GetProductID Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
document.write strGetProductIDResult document.write "<HR>"
End Sub
Public Sub GetVendorID()
document.write "Get Vendor ID Test <BR>"
strVendorIdOut = channelObject.VendorID
Document.Write "From Channel.VendorID: " & strVendorIdOut & "<BR>" Document.Write "Vendor ID: " & strVendorID & "<BR>"
If strVendorIdOut = strVendorID Then strGetVendorIDResult = "<li>VendorID Test Result: <FONT color=green><STRONG>Pass</STRONG></FONT> <BR>" Else strGetVendorIDResult = "<li>VendorID Test Result: <FONT color=red><STRONG>Fail</STRONG></FONT> <BR>" End If
Document.write strGetVendorIDResult document.write "<HR>"
End Sub
</Script> </HTML>
|