<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<!--
******************************************************************
  Copyright (c) 1999 Microsoft Corporation

  Module Name:
    Bug Reporting Page

  File:
    bugrep.htm

  Abstract:
    Bug reporting channel for Millennium beta

  Internal Version : 1.000

  1999-09-10 : Cleaned up formatting of HTML and made syntax clean
  1999-09-20 : Cleaning up code
  1999-09-21 : Bugs P1  99969, 102646, 102645, 102740, 102196 (102811?)
  1999-09-22 : Cleaned up formatting, added removing from a list and
               made localization easier
  1999-09-23 : Made printing easier with expanding text areas
  1999-09-27 : Removed leading spaces from filenames in AddFile
               BetaID field accepts only 0-9 values
               Error message if XML files are missing (broken install)
  1999-09-28 : Fixed alignment of text areas to top
               Fixed focus related bug in text areas
               Fixed to be more localization friendly (Bug 103361)
               Removed config.sys and autoexec.bat from collected file list
  1999-09-29 : Added user.dat, system.dat and classes.dat to default file list
  1999-09-30 : Added DirectX data collection
               Added system drive path instead of \..\ convention
               Added option to handle data collection failures
  1999-10-01 : Added ActiveX object to collect build and language info
               Register ActiveX object on script load (brp_sysinfo.dll)
               Added tracking number after data upload
               Moved thankyou into a SPAN to display tracking after upload
  1999-10-05 : Adding IEINFO5.MOF to cab and using MOFCOMP to compile this
               Collecting IE info along with machine data
               Forced extension of saved file to be CAB (bug 102973)
  1999-10-06 : Changed directx diag running mode to 1
               Disabled DirectX data collection
  1999-10-11 : Changed max sizes of text-areas to 2000
               Changed to use bugrep.css
  1999-10-12 : Added xml files to list of collected files
  1999-10-13 : Fixed IE realted break
  1999-10-13 : Added min space image
  1999-10-16 : When no info checked direct CAB creating skipping DC
               Registry files collected only for Area = Setup
               CollecOk related bugs fixed
               Restructed flow to have Save and Submit check boxes
               Report bytes transmitted in upload
               Changed CAB file name to preserve all .'s in filename
               Behaviour changed to hide all input field when saving
                 or submitting bug so that no fields can be changed
               After finishing all fields are restored
               Upload bug reporting page version in incident XML
               Changed cursor to busy when uploading/saving bug
               Disabled controls during submit
               Added record of incidents using SAF framework for
                 saved and submitted incidents in a \incidents
                 directory
  1999-10-18 : Set focus to beta id on page load
               Set focus to missing entry when validating form
               Removed .'s from BetaID
               Declared all objects locally/globally
               Order of error checking consistent with screen order
               Fix for MOF command not returning after finishing
  1999-10-19 : Changed Confirm to have title
               Added link to winbeta site
               Added bug page version
               If failure then do not get streams
               Changed Run commands to use short path name for IEINFO
               Changed Run commands to use short path name for SYSINFO
  1999-10-23 : Changed checking of stream to JS code to work around VB problem
  1999-10-24 : Added collecting hcupdate.log
               Added collecting WMI logs
               Added dc_onComplete function
  1999-10-25 : Find build number and do proper RecordIncident
  1999-10-26 : Changed occured to occurred
               Added width for space.gif image for localization
  1999-10-27 : Updated xml files to handle changes to dataspec.xml
  1999-10-28 : Text boxes on incident view have scroll bars but no edit/cut/paste
               Fixed . in file name to be at end
               Changed Done to Submit
  1999-10-28 : Fixed to initialize only once (brp_init.ini)
               Save incident data in csv files
               Added resume.txt
               Fixed build break
  1999-10-30 : Added presisting betaid and other options
               Added DrWatson log collection
               Added display for cabbit and directX
               Extensive validation of filenames
               Auto filling of filename from title
               Set default folder to millennium bugs

  Requires following files

    ErrCodes.vbs
    bugrep.css
    bug_upload_collect.xml
    bug_upload_collect_2408.xml
    bug_upload_nocollect.xml
    dataspec.xml

******************************************************************
-->
<HEAD><TITLE>File a bug report</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<LINK ID=Stylesheet_Ref href="bugrep.css" rel=STYLESHEET type=text/css>
<META content=/scripts/PostInfo.asp name=postinfo>
<OBJECT ID=pchealth classid=CLSID:FC7D9E02-3F9E-11d3-93C0-00C04F72DAF7></OBJECT>

<SCRIPT ID="ErrCodesList" LANGUAGE=VBScript SRC="ErrCodes.vbs"></SCRIPT>
<SCRIPT LANGUAGE=VBScript>
    '
    ' Make sure all variables are declared explicitly and to make typos easier
    ' to find (in in the current code)
    '
    'option explicit

    '
    ' ProductName (should be equal to product name field in SAF1.XML)
    '
    const L_BRP_Version      = "4.90.00."
    const L_BRPBuild_Version = "2415"

    '
    ' ProductName (should be equal to product name field in SAF1.XML)
    '
    const L_ProductName_Version = "Microsoft Millennium Beta"

    '
    ' Vendor directory under which all files are stored on the client
    '
    const L_VendorChannel_Address  = "CN=Microsoft Corporation,L=Redmond,S=Washington,C=US"
    '
    ' Title for all dialog message boxes
    '
    const L_MsgBoxTitle_Message    = "Bug Reporting"

    '
    ' Server name for uploading bugs
    '
    const L_ServerName_Address     = "http://beta.mspchealth.com/pchealth_esc/UpLoadServer.dll"
    'const L_ServerNameTest_Address = "http://pchts1/pchealth_esc/UpLoadServer.dll"
    const L_ServerNameTest_Address = "http://spoofweb/pchealth_esc/UpLoadServer.dll"

    '
    ' Testing flag, set to 0 for release code, 1 for testing code and using the
    ' test server
    '
    const BRP_DebugFlag   = 0


    '
    ' Main code, only localization changes to be made after this section
    '
    const UL_HISTORY_LOG = 1
    const UL_HISTORY_LOG_AND_DATA = 2
    const UL_HISTORY_NONE = 0

    const UL_BACKGROUND   = 0
    const UL_FOREGROUND   = 1

    const UL_ABORTED      = 4
    const UL_ACTIVE       = 1
    const UL_COMPLETED    = 6
    const UL_DELETED      = 7
    const UL_FAILED       = 5
    const UL_NOTACTIVE    = 0
    const UL_SUSPENDED    = 2
    const UL_TRANSMITTING = 3

    const DC_NOTACTIVE    = 0
    const DC_COLLECTING   = 1
    const DC_FAILED       = 2
    const DC_COMPLETED    = 3

    '
    ' g_oDc   Data collection object
    ' g_oUpl  Upload object
    ' g_oCab  Cab creation object
    '
    Dim   g_oDc, g_oUpl, g_oCab, g_nInProgress, g_bSaveIncident, g_bSubmitIncident
    Dim   g_bFormValid
    Dim   g_nCurrentBuild

    Dim   g_SettingsBetaId
    Dim   g_SettingsLastPath
    Dim   g_SettingsShareInfo
    Dim   g_SettingsSubmitNow
    Dim   g_SettingsSaveToDisk
    Dim   g_CrashDumpFile
    Dim   g_KernelCrash
    Dim   g_CrashApp
    Dim   g_DeleteCrashDump    

    Set g_oDc        = Nothing
    Set g_oUpl       = Nothing
    Set g_oCab       = Nothing

    g_nCurrentBuild  = 0
    g_nInProgress    = 0
    g_bSaveIncident  = False
    g_bSubmitIncident= False
    g_bFormValid     = False

'------------------------------------------------------------------------------
'
' Validate form before submitting report
'
'------------------------------------------------------------------------------
    sub ValidateForm()

        const L_MissingField_ErrorMessage            = "Missing required field: "
        const L_FormField_FIELDNAME_BetaID_TEXT      = "Beta ID"
        const L_FormField_FIELDNAME_Title_TEXT       = "Problem title"
        const L_FormField_FIELDNAME_Description_TEXT = "Describe the problem"
        const L_FormField_FIELDNAME_Expected_TEXT    = "What did you expect to happen"
        const L_FormField_FIELDNAME_Repro_TEXT       = "Enter the steps required to reproduce the problem"
        const L_FormField_FIELDNAME_Severity_TEXT    = "Problem type"
        const L_FormField_FIELDNAME_Area_TEXT        = "Area"
        const L_BetaIDBadRange_ErrorMessage          = "Your Beta ID must be a number between 0 and 2147483647."

        Dim misc_fields, colon, bang, field, description, BetaIDValue

        ' Override the default behavior so we can control where we go.
        window.event.cancelBubble = true
        window.event.returnValue = false

        '
        'Format of misc-fields is a colon-separated list.  Each entry
        'consists of the field name to check, optionally followed by a
        'bang and a human-readable description of that field.
        '
        misc_fields = "BetaID!" & L_FormField_FIELDNAME_BetaID_TEXT & _
                      ":Title!" & L_FormField_FIELDNAME_Title_TEXT

        while misc_fields <> ""
            colon = instr(misc_fields, ":")
            if colon <> 0 then
                field = left(misc_fields, colon-1)
                misc_fields = right(misc_fields, len(misc_fields) - colon)
            else
                field = misc_fields
                misc_fields = ""
            end if
            bang = instr(field, "!")
            if bang <> 0 then
                description = right(field, len(field) - bang)
                field = left(field, bang-1)
            else
                description = field
            end if
            if IsNull(document.all(field)) or len(document.all(field).value) = 0 then
                Call BRP_MessageBox(L_MissingField_ErrorMessage & description)
                g_bFormValid = False
                '
                ' Set focus to missing field
                '
                document.all(field).focus
                exit sub
            end if
        wend

        if document.all.Severity.value = "N" then
            Call BRP_MessageBox(L_MissingField_ErrorMessage & L_FormField_FIELDNAME_Severity_TEXT)
            g_bFormValid = False
            document.all.Severity.focus
            exit sub
        end if

        if document.all.Area.value = "NA" then
            Call BRP_MessageBox(L_MissingField_ErrorMessage & L_FormField_FIELDNAME_Area_TEXT)
            g_bFormValid = False
            document.all.Area.focus
            exit sub
        end if

        '
        'Format of misc-fields is a colon-separated list.  Each entry
        'consists of the field name to check, optionally followed by a
        'bang and a human-readable description of that field.
        '
        misc_fields = "Description!" & L_FormField_FIELDNAME_Description_TEXT & _
                      ":ExpectedBehavior!" & L_FormField_FIELDNAME_Expected_TEXT & _
                      ":StepsToRepro!" & L_FormField_FIELDNAME_Repro_TEXT

        while misc_fields <> ""
            colon = instr(misc_fields, ":")
            if colon <> 0 then
                field = left(misc_fields, colon-1)
                misc_fields = right(misc_fields, len(misc_fields) - colon)
            else
                field = misc_fields
                misc_fields = ""
            end if
            bang = instr(field, "!")
            if bang <> 0 then
                description = right(field, len(field) - bang)
                field = left(field, bang-1)
            else
                description = field
            end if
            if IsNull(document.all(field)) or len(document.all(field).value) = 0 then
                Call BRP_MessageBox(L_MissingField_ErrorMessage & description)
                g_bFormValid = False
                '
                ' Set focus to missing field
                '
                document.all(field).focus
                exit sub
            end if
        wend

        on error resume next
        BetaIDvalue = CLng(document.all.BetaID.value)
        if BetaIDvalue < 0 OR BetaIDvalue > 2147483647 OR Err.number <> 0 then
            Call BRP_MessageBox(L_BetaIDBadRange_ErrorMessage)
            g_bFormValid = False
            document.all.BetaID.focus
            exit sub
        end if

        '
        ' Return validity flag in a global variable
        '
        g_bFormValid = True

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub ValidateTextLength(limit)
        const L_TooLong1_ErrorMessage = "This text field is too long.  It is limited to "
        const L_TooLong2_ErrorMessage = " characters.  The entry has been truncated."

        if len(window.event.srcElement.value) > limit then
            BRP_MessageBox L_TooLong1_ErrorMessage & CStr(limit) & L_TooLong2_ErrorMessage
            window.event.srcElement.value = left(window.event.srcElement.value, limit)
            window.event.srcElement.focus
        end if
    end sub

'------------------------------------------------------------------------------
'
' Message box with OK and special title
'
'------------------------------------------------------------------------------
    sub BRP_MessageBox(msg)

        Call MsgBox(msg,vbOKOnly,L_MsgBoxTitle_Message)

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    function BRP_Confirm(msg)

        BRP_Confirm = MsgBox(msg,vbYesNo,L_MsgBoxTitle_Message)

    end function

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub BRP_TraceMessage(msg)

        if BRP_DebugFlag >= 2 then
            Call MsgBox(msg,vbOKOnly,L_MsgBoxTitle_Message)
        end if

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    function GetVendorPath()

        Dim oChannel

        Set oChannel= pchealth.CreateObject_Channel(L_VendorChannel_Address, L_ProductName_Version)
        GetVendorPath = oChannel.VendorDirectory

    end function

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    function GetWinPath()

        Dim oFS

        Set oFS = CreateObject("Scripting.FileSystemObject")
        GetWinPath = oFS.GetSpecialFolder(0)

    end function

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    function GetWinSystemPath()

        Dim oFS

        Set oFS = CreateObject("Scripting.FileSystemObject")
        GetWinSystemPath = oFS.GetSpecialFolder(1)

    end function

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    function GetTempPath()

        Dim oFS

        Set oFS = CreateObject("Scripting.FileSystemObject")
        GetTempPath = oFS.GetSpecialFolder(2)

    end function


'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    function GetSystemDrivePath()

        Dim oWshShell, szWinBootDir
        Dim slash

        Set oWshShell      = CreateObject("WScript.Shell")
        szWinBootDir       = oWshShell.ExpandEnvironmentStrings("%WINBOOTDIR%")
        slash = instr(szWinBootDir,"\")
        if slash <> 0 then
            GetSystemDrivePath = left(szWinBootDir,slash-1)
        else
            GetSystemDrivePath = "C:"
        end if

    end function

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    function RunExternalApplicationDxDiag()

        Dim oFS
        Dim oWshShell

        Set oWshShell      = CreateObject("WScript.Shell")
        Set oFS = CreateObject("Scripting.FileSystemObject")

        szAppName = GetWinSystemPath & "\dxdiag.exe " & GetTempPath & "\dxdiag.txt"

        Call BRP_TraceMessage(szAppName)

        '
        ' Activate the window and display in minimum size
        '
    RunExternalApplicationDxDiag = oWshShell.Run(szAppName, 1, True)

    end function

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    function RegisterBrpSysInfo()

        Dim oFS
        Dim oFile
        Dim oWshShell

        Set oWshShell      = CreateObject("WScript.Shell")
        Set oFS = CreateObject("Scripting.FileSystemObject")

        szFileName = GetVendorPath & "\brp_sysinfo.dll"

        if oFS.FileExists( szFileName ) then

            Set oFile  = oFS.GetFile(szFileName)
            szAppName  = GetWinSystemPath & "\regsvr32.exe /s " & oFile.ShortPath

            Call BRP_TraceMessage(szAppName)

            '
            ' Activate the window and display in minimum size
            '
        RegisterBrpSysInfo = oWshShell.Run(szAppName, 2, True)
        else
            RegisterBrpSysInfo = True
        end if

    end function

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    function RegisterIEInfoMOF()

        Dim oFS
        Dim oFile
        Dim oWshShell

        Set oWshShell      = CreateObject("WScript.Shell")
        Set oFS = CreateObject("Scripting.FileSystemObject")

        szFileName = GetVendorPath & "\ieinfo5.mof"

        if oFS.FileExists( szFileName ) then

            Set oFile  = oFS.GetFile(szFileName)

            szAppName = "command /c " & GetWinSystemPath & "\wbem\mofcomp " & oFile.ShortPath

            Call BRP_TraceMessage(szAppName)
            '
            ' Activate the window and display in minimum size
            '
        RegisterIEInfoMOF = oWshShell.Run(szAppName, 2, True)
        else
            RegisterIEInfoMOF = True
        end if

    end function

'------------------------------------------------------------------------------
'
' Get build number from string of type X.XX.XXXX xxxx, assumes 4 digit build
' number and sets g_nCurrentBuild
'
'------------------------------------------------------------------------------
    sub BRP_SetOSBuild(szVer)

        Dim period, szVer1, szVer2, szVer3

        period = instr(szVer,".")
        if period <> 0 then
            szVer1 = right(szVer,len(szVer)-period)
            period = instr(szVer1,".")
            if period <> 0 then
                szVer2 = right(szVer1,len(szVer1)-period)
                szVer3 = left(szVer2,4)
                nVer   = CInt(szVer3)
                g_nCurrentBuild = nVer
            end if
        end if
    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub BRP_SetStatusMessage(msg)

        document.all.Status.innerHTML = msg

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub BRP_SetProgressMessage(msg)

        document.all.Status.innerHTML = msg

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub BRP_AppendProgressMessage(msg)

        document.all.Status.innerHTML = document.all.Status.innerHTML & msg

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub SetProgress(percent)

        L_PctDone_Message = "% done"

        Call BRP_SetProgressMessage(percent & L_PctDone_Message)

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub dc_onProgress(DataCollectionPtr, done, total)
        Dim PercentDone

        if total = 0 then
            ' Avoid divide-by-zero errors.
            total = 100
        end if
        PercentDone = Round(done / total * 90)
        Call SetProgress(PercentDone)
    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub dc_onStatusChange(DataCollectionPtr, status)

        const L_DataCollection_STATUS_Collecting_Message  = "Collecting data"

        Dim szDCStatus

        select case status
            case DC_COLLECTING szDCStatus=L_DataCollection_STATUS_Collecting_Message
        end select

        Call BRP_SetStatusMessage(szDCStatus)

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub dc_onComplete(DataCollectionPtr, hresult)

        const L_DataCollection_STATUS_NotActive_Message   = "Not active"
        const L_DataCollection_STATUS_Failed_ErrorMessage = "Failed data collection"
        const L_DataCollection_STATUS_Completed_Message   = "Creating CAB file"
        const L_CollectError_ErrorMessage                 = "The following error occurred during data collection: "
        const L_CollectErrorNoErrNum_ErrorMessage         = "There was an error collecting data about your machine. "
        const L_UploadOnlyFiles_Message                   = "Do you want to continue by submitting system files from your machine"
        const L_SaveOnlyFiles_Message                     = "Do you want to continue by saving system files from your machine"

        Dim status
        Dim szDCStatus, szErrorMessage

        status = g_oDc.status
        status = CInt(status)

        select case status
            case DC_NOTACTIVE  szDCStatus=L_DataCollection_STATUS_NotActive_Message
            case DC_FAILED     szDCStatus=L_DataCollection_STATUS_Failed_ErrorMessage
            case DC_COMPLETED  szDCStatus=L_DataCollection_STATUS_Completed_Message
        end select

        Call BRP_SetStatusMessage(szDCStatus)

        if status = DC_FAILED or status = DC_COMPLETED then
            UnregisterDCHandlers
            if status = DC_COMPLETED then
                CreateCab(False)
            else
                if Err.number <> 0 then
                    szErrorMessage = L_CollectError_ErrorMessage & Err.description & " (" & Err.number & "). "
                else
                    szErrorMessage = L_CollectErrorNoErrNum_ErrorMessage
                end if
                if g_bSubmitIncident = True then
                    if BRP_Confirm( szErrorMessage & vbCrLf & L_UploadOnlyFiles_Message ) = vbYes then
                        CreateCab(True)
                    else
                        Call BRP_CleanupAfterCancelUpload
                    end if
                else
                    if g_bSaveIncident = True then
                        if BRP_Confirm( szErrorMessage & vbCrLf & L_SaveOnlyFiles_Message ) = vbYes then
                            CreateCab(True)
                        else
                            Call BRP_CleanupAfterCancelUpload
                        end if
                    end if
                end if
            end if
        end if

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub cab_onComplete(g_oCab, hr)
        const L_CabError_ErrorMessage       = "Couldn't create cab file due to error #"
        const L_CabErrorStatus_ErrorMessage = "Error creating cab file"

        if g_oCab.Status <> 2 then
            Call BRP_MessageBox(L_CabError_ErrorMessage & Hex(hr))
            Call BRP_SetStatusMessage(L_CabErrorStatus_ErrorMessage)
            exit sub
        End if

        Call SetProgress(100)

        '
        ' Save incident if required
        '
        Call ContinueSaveIncident()

        '
        ' Upload incident if required
        '
        Call ContinueUploadIncident()

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub CollectData()

        const L_DCFailed_ErrorMessage      = "Data collection cannot be carried as the parameter files are missing"
        const L_CabStartStatus_Message     = "Creating CAB file"

        Dim oFS
        Dim iSpecNotFound
        Dim szUploadXMLFileName

        on error resume next
        Set g_oDc = pchealth.CreateObject_DataCollection

        Set oFS = CreateObject("Scripting.FileSystemObject")

        iSpecNotFound = FALSE

        if document.all.CollectOk.checked then
            if g_nCurrentBuild < 2408 then
                szUploadXMLFileName = "\bug_upload_collect_2408.XML"
            else
                szUploadXMLFileName = "\bug_upload_collect.XML"
            end if
            if oFS.FileExists( GetVendorPath & szUploadXMLFileName ) then
                g_oDc.MachineData_Dataspec = GetVendorPath & szUploadXMLFileName
                '
                ' If history file exists then use this else just upload regular files
                '
                if oFS.FileExists( GetWinPath & "\PCHealth\HelpCtr\Config\DataSpec.XML" ) then
                    g_oDc.History_Dataspec     = GetWinPath & "\PCHealth\HelpCtr\Config\DataSpec.XML"
                    g_oDc.History_MaxDeltas    = 5
                else
                    iSpecNotFound = TRUE
                end if

            else
                iSpecNotFound = TRUE
            end if
        else
            '
            ' if a user unchecks data collection, we will not touch any data collection portion,
            ' and pretend a data collection failure; server side should check CollectOk flag
            ' before read into DCStatus
            '
            Call BRP_SetStatusMessage(L_CabStartStatus_Message)
            Call CreateCab(TRUE)
            exit sub
        end if

        if ( iSpecNotFound ) then
            BRP_MessageBox L_DCFailed_ErrorMessage
            Call BRP_CleanupAfterCancelUpload
        else
            RegisterDCHandlers
            g_oDc.ExecuteASync
        end if

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    function CreateIncident(oInc, iDCFailed)
'
'   oInc       Incident object
'   iDCFailed  False if data collection was OK
'              True  if data collection failed
'
        const L_GetDataFailedSS_ErrorMessage              = "Failed to get collected machine snapshot data"
        const L_GetDataFailedHS_ErrorMessage              = "Failed to get collected machine history data"
        const L_IncCollectError_ErrorMessage              = "The following error occurred during data collection: "

        Dim oTmpStream, oDict, oSysInfo
        Dim misc_fields, field, colon
        Dim fDataValid, fHistoryValid

        ' Colon-separated list of fields to be stored in the data dictionary
        misc_fields = "BetaID:Title:Severity:Area:Reproducibility:ExpectedBehavior:StepsToRepro"

        Set oInc = pchealth.CreateObject_Incident()

        oInc.UserName           = document.all.BetaID.value
        oInc.ProductID          = "Millennium Beta Bug"
        oInc.ProductName        = "Millennium"
        oInc.ProblemDescription = document.all.Description.value

        '
        ' Get data stream if data collection did not fail
        '
        on error resume next
        if iDCFailed = False then
            '
            ' If incident stream exists then get MachineSnapshot else do not
            ' and just continue as data collection has already failed and we
            ' have to just continue
            '
            fDataValid    = IsMachineDataValid(g_oDc)
            fHistoryValid = IsHistoryDataValid(g_oDc)

            if fDataValid then
                oInc.MachineSnapshot = g_oDc.MachineData_GetStream
                if document.all.CollectOk.checked then
                    if fHistoryValid then
                        oInc.MachineHistory = g_oDc.History_GetStream
                    else
                        Call BRP_SetStatusMessage(L_GetDataFailedHS_ErrorMessage)
                        iDCFailed = True
                    end if
                 end if
            else
                Call BRP_SetStatusMessage(L_GetDataFailedSS_ErrorMessage)
                iDCFailed = True
            end if
        end if

        oInc.UploadType = 0

        Set oDict = oInc.Misc
        while misc_fields <> ""
            colon = instr(misc_fields, ":")
            if (colon <> 0) then
                field = left(misc_fields, colon-1)
                misc_fields = right(misc_fields, len(misc_fields) - colon)
            else
                field = misc_fields
                misc_fields = ""
            end if
            if len(field) > 0 then
                oDict.add field, document.all(field).value
            end if
        wend

        '
        ' Change for CollectOk flag
        '
        if document.all.CollectOk.checked then
            oDict.add "CollectOK", "on"
        else
            oDict.add "CollectOK", "off"
        end if

        oDict.add "AdditionalFiles_Number", document.all.AdditionalFiles_List.length
        oDict.add "MachineID", g_oUpl.Sig
        
        if document.all.CollectOk.checked then
            oDict.add "DCStatus", iDCFailed
        else
            oDict.add "DCStatus", "0"
        end if

        Set oSysInfo = CreateObject("PCHealth.BugRepSysInfo")
        if Err.number <> 0 then
            oDict.add "OSBuildNumber", "Unknown"
            oDict.add "OSLanguage", "0"
        else
            oDict.add "OSBuildNumber", oSysInfo.GetOSVersionString
            oDict.add "OSLanguage", oSysInfo.GetLanguageID
        end if

        '
        ' Add bug reporting page version
        '
        oDict.add "BRP_Version", L_BRP_Version & L_BRPBuild_Version

        CreateIncident = true

    end function

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub upl_onProgressChange(UploadJobPtr, currentSize, totalSize)

        const L_BytesSent1_Text = " ( "
        const L_BytesSent2_Text = " bytes of "
        const L_BytesSent3_Text = " bytes sent )"

        if totalSize = 0 then
            ' Avoid divide-by-zero errors.
            totalSize = 100
        end if

        Call SetProgress(Round(currentSize / totalSize * 100))

        Call BRP_AppendProgressMessage(L_BytesSent1_Text & currentSize & _
                                       L_BytesSent2_Text & totalSize & _
                                       L_BytesSent3_Text)

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub upl_onStatusChange(UploadJobPtr, status)

        Dim stat_str, szTrackingNo, szTrackingTime

        const L_Upload_STATUS_NotActive_Message    = "Not active"
        const L_Upload_STATUS_Active_Message       = "Active"
        const L_Upload_STATUS_Suspended_Message    = "Suspended"
        const L_Upload_STATUS_Transmitting_Message = "Transmitting"
        const L_Upload_STATUS_Aborted_ErrorMessage = "Retrying upload"
        const L_Upload_STATUS_Failed_ErrorMessage  = "Failed due to server error"
        const L_Upload_STATUS_Completed_Message    = "Completed upload"
        const L_Upload_STATUS_Deleted_Message      = "Deleted"
        const L_UploadError_ErrorMessage           = "The following error occurred during upload: "
        const L_UploadErrorCode_ErrorMessage       = "Error : "
        const L_UploadErrorNoErrNum_ErrorMessage   = "There was an error uploading your bug report."
        const L_SubmitToRety_ErrorMessage          = "Click submit to retry."

        select case status
            case UL_NOTACTIVE    stat_str=L_Upload_STATUS_NotActive_Message
            case UL_ACTIVE       stat_str=L_Upload_STATUS_Active_Message
            case UL_SUSPENDED    stat_str=L_Upload_STATUS_Suspended_Message
            case UL_TRANSMITTING stat_str=L_Upload_STATUS_Transmitting_Message
            case UL_ABORTED      stat_str=L_Upload_STATUS_Aborted_ErrorMessage
            case UL_FAILED       stat_str=L_Upload_STATUS_Failed_ErrorMessage
            case UL_COMPLETED    stat_str=L_Upload_STATUS_Completed_Message
            case UL_DELETED      stat_str=L_Upload_STATUS_Deleted_Message
        end select

        Call BRP_SetStatusMessage(stat_str)

        if status = UL_FAILED or status = UL_COMPLETED then
            Call UnregisterUPLHandlers()
            if status = UL_COMPLETED then
                '
                ' No cleanup requird here as a seperate thankyou DIV is being
                ' displayed and users cannot navigate back to the page, a
                ' cleanup here adds some flicker before the thankyou page
                '
                szTrackingNo   = g_oUpl.Sig & "_" & g_oUpl.JobID
                szTrackingTime = g_oUpl.CompleteTime
                Call BRP_TraceMessage(szTrackingTime)
                Call BRP_TraceMessage(szTrackingNo)

                '
                ' Make a record of the incident
                '
                Call RecordIncident(szTrackingTime,szTrackingNo)

                '
                ' Store valid options
                '
                Call BRP_WriteIniFile()

                document.all.BRP_IncidentTime.innerHTML = szTrackingTime
                document.all.BRP_TrackingNo.innerHTML   = szTrackingNo

                Call BRP_CleanCrashDump()

            end if
            '
            ' Cleanup
            '
            Call BRP_CleanupAfterCancelUpload

            '
            ' Delete the upload object
            '
            g_oUpl.Delete

            '
            ' Move to thank you page, must remove the InProgess before this
            ' or the unload handlers will kick in so above code order is
            ' important
            '
            if status = UL_COMPLETED then
                document.all.spanEnterBug.style.display = "none"
                document.all.spanThankYou.style.display = ""
                exit sub
            end if
            '
            ' Changed to print error code string
            '
            if g_oUpl.ErrorCode <> 0 then
                lErrCode = CLng(g_oUpl.Errorcode)
                szError  = ERR_GetJobErrorCodeString(lErrCode)
                BRP_MessageBox L_UploadError_ErrorMessage & vbCrLf & _
                               L_UploadErrorCode_ErrorMessage & _
                               szError & _
                               vbCrLf & _
                               L_SubmitToRety_ErrorMessage
            else
                BRP_MessageBox L_UploadErrorNoErrNum_ErrorMessage & _
                               L_SubmitToRety_ErrorMessage
            end if
        end if
    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub ResetUpload()
        On Error Resume Next
        g_oUpl.Delete
        Set g_oUpl = Nothing
        g_oDc.Abort
        Set g_oDc = Nothing
'        if g_nCurrentBuild > 2408 then
'            g_oCab.Abort
'            Set g_oCab = Nothing
'        end if
        Call BRP_CleanupAfterCancelUpload()
    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub CancelUpload()

        const L_UserCancel_Message = "Cancelled by user"

        if g_nInProgress then
            Call UnregisterDCHandlers()
            Call UnregisterUPLHandlers()
            Call UnregisterCabHandler()
            Call BRP_SetStatusMessage(L_UserCancel_Message)
            Call ResetUpload()
            Call SetProgress(0)
        end if

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub CreateCab(iDCFailed)

        const L_UploadObjectMissing_ErrorMessage  = "An error occurred when trying to create the upload data object"
        const L_FailedIncident_ErrorMessage       = "Failed generating incident"
        const L_CantGenerateIncident_ErrorMessage = "There was an error trying to save the incident information."
        const L_CabCompression_ErrorMessage       = "An error occurred when trying to compress the CAB file before upload"
        const L_CompressingCab_Message            = "Compressing CAB file"

        Dim   oInc, oTmpObj, oFS, oFileSelected, oFolder, oFiles, oFile, oLastLogFile
        Dim   FileList(), FileListIndex, AddFilesIndex
        Dim   iFileCount, AddFilesCount
        Dim   iStart
        Dim   nCount, dCurDate, dMaxDate, fIsLog
        Dim   iMaxWinFiles, szWinFileName()
        Dim   iMaxSysDriveFiles, szSysDriveFileName()
        ReDim FileList(500)
        ReDim szWinFileName(20)
        ReDim szSysDriveFileName(20)

        AddFilesCount = 0

        Call BRP_TraceMessage("CreateCAB")

        on error resume next
        Set oTmpObj = CreateObject("UploadManager.MPCUpload")
        '
        ' Error handler for bad MPCUpload object (missing config.xml)
        '
        if Err.number <> 0 then
            Call BRP_MessageBox(L_UploadObjectMissing_ErrorMessage)
            Call BRP_CleanupAfterCancelUpload()
            exit sub
        end if

        Set g_oUpl = oTmpObj.CreateJob
        g_oUpl.Sig = ""

        if NOT CreateIncident(oInc, iDCFailed) then
            g_oUpl.Delete
            exit sub
        end if

        oInc.GetXML GetTempPath & "\Incident.XML"
        if Err.number <> 0 then
            Call BRP_SetStatusMessage(L_FailedIncident_ErrorMessage)
            Call BRP_MessageBox(L_CantGenerateIncident_ErrorMessage)
            Call BRP_CleanupAfterCancelUpload()
        end if

        Set oFS = CreateObject("Scripting.FileSystemObject")

        iFileCount = 0
        if oFS.FileExists( GetTempPath & "\Incident.XML" ) then
            FileList(iFileCount) = GetTempPath & "\Incident.XML"
            iFileCount = iFileCount + 1
        end if
        '
        ' Collect hcupdate.log
        '
        if oFS.FileExists( GetTempPath & "\hcupdate.log" ) then
            FileList(iFileCount) = GetTempPath & "\hcupdate.log"
            iFileCount = iFileCount + 1
        end if
        '
        ' Add XML files to upload
        '
        if oFS.FileExists( GetVendorPath & "\bug_upload_collect.XML" ) then
            FileList(iFileCount) = GetVendorPath & "\bug_upload_collect.XML"
            iFileCount = iFileCount + 1
        end if
        if oFS.FileExists( GetVendorPath & "\bug_upload_collect_2408.XML" ) then
            FileList(iFileCount) = GetVendorPath & "\bug_upload_collect_2408.XML"
            iFileCount = iFileCount + 1
        end if
        if oFS.FileExists( GetVendorPath & "\bug_upload_nocollect.XML" ) then
            FileList(iFileCount) = GetVendorPath & "\bug_upload_nocollect.XML"
            iFileCount = iFileCount + 1
        end if


        '
        ' Get files from the WINDIR directory
        '
        szWinFileName(00) = "\classes.dat"
        szWinFileName(01) = "\system.dat"
        szWinFileName(02) = "\user.dat"
        szWinFileName(03) = "\ios.log"
        szWinFileName(04) = "\ppplog.txt"
        szWinFileName(05) = "\susfail.txt"
        szWinFileName(06) = "\system.ini"
        szWinFileName(07) = "\win.ini"
        szWinFileName(08) = "\wulog.txt"
        szWinFileName(09) = "\emi\errlog.dat"
        szWinFileName(10) = "\PCHealth\HelpCtr\Config\DataSpec.XML"
        szWinFileName(11) = "\system\sfp\sfplog.txt"
        szWinFileName(12) = "\resume.txt"
        iMaxWinFiles = 13

        '
        ' only setup needs three registry files
        '
        iStart = 3
        if document.all.Area.value = "Setup" then
            iStart = 0
        end if

        for iCount = iStart to iMaxWinFiles-1
            if oFS.FileExists( GetWinPath & szWinFileName(iCount) ) then
                FileList(iFileCount) = GetWinPath & szWinFileName(iCount)
                iFileCount = iFileCount + 1
            end if
        next

        '
        ' Get files from the SYSTEMDRIVE directory
        '
        szSysDriveFileName(00) = "\asd.log"
        szSysDriveFileName(01) = "\bootlog.prv"
        szSysDriveFileName(02) = "\bootlog.txt"
        szSysDriveFileName(03) = "\detlog.txt"
        szSysDriveFileName(04) = "\netlog.txt"
        szSysDriveFileName(05) = "\setuplog.old"
        szSysDriveFileName(06) = "\setuplog.txt"

        iMaxSysDriveFiles = 7

        for iCount = 0 to iMaxSysDriveFiles-1
            if oFS.FileExists( GetSystemDrivePath & szSysDriveFileName(iCount) ) then
                FileList(iFileCount) = GetSystemDrivePath & szSysDriveFileName(iCount)
                iFileCount = iFileCount + 1
            end if
        next

        '
        ' Get files from the WMI LOG directory log files
        '
        if oFS.FolderExists(GetWinSystemPath & "\wbem\logs") then
            Set oFolder = oFS.GetFolder(GetWinSystemPath & "\wbem\logs")
            Set oFiles  = oFolder.Files
            for Each oFile in oFiles
                fIsLog = instrrev(lcase(oFile.name), ".log")
                if fIsLog <> 0 then
                    if oFS.FileExists( oFile.Path ) then
                        FileList(iFileCount) = oFile.Path
                        iFileCount = iFileCount + 1
                    end if
                end if
            next
        end if

        '
        ' Get last log file from the DrWatson LOG directory log files (if crash or hang)
        '
        if document.all.Severity.value = 1 then
            if oFS.FolderExists(GetWinPath & "\drwatson") then
                Set oFolder = oFS.GetFolder(GetWinPath & "\drwatson")
                Set oFiles  = oFolder.Files
                nCount = 0
                for Each oFile in oFiles
                    fIsLog = instrrev(lcase(oFile.name), ".wlg")
                    if fIsLog <> 0 then
                        dCurDate = oFile.DateLastModified
                        if dCurDate > dMaxDate OR nCount = 0 then
                            Set oLastLogFile = oFile
                            dMaxDate     = dCurDate
                        end if
                        nCount = nCount + 1
                    end if
                next
                if nCount > 0 then
                    if oFS.FileExists( oLastLogFile.Path ) then
                        FileList(iFileCount) = oLastLogFile.Path
                        iFileCount = iFileCount + 1
                    end if
                end if
            end if
        end if

        '
        ' Run DirectX diagnostic utility and collect this information
        '
        'Call RunExternalApplicationDxDiag()
        'if oFS.FileExists( GetTempPath & "\dxdiag.txt" ) then
        '    FileList(iFileCount) = GetTempPath & "\dxdiag.txt"
        '    iFileCount = iFileCount + 1
        'end if

        FileListIndex = iFileCount

        '
        ' Find number of selected files and add them to the list
        ' they exist at the time of selection so not re-checking them
        '
        Set oFileSelected = document.all.AdditionalFiles_List

        AddFilesCount = oFileSelected.length

        ReDim Preserve FileList(FileListIndex + AddFilesCount - 1)
        for AddFilesIndex = 0 to (AddFilesCount - 1)
            FileList(FileListIndex) = oFileSelected.Options(AddFilesIndex).text
            FileListIndex = FileListIndex + 1
        next

        Set g_oCab = pchealth.CreateObject_Cabinet
        for AddFilesIndex = 0 to (FileListIndex-1)
            g_oCab.AddFile FileList(AddFilesIndex)
            document.all.ProgressText.innerHTML = "Collecting " & FileList(AddFilesIndex)
        next
        document.all.ProgressText.innerHTML = "&nbsp;"

        '
        ' Register cab completion call back
        '
        RegisterCabHandler

        Call BRP_TraceMessage("Compressing cab")

        Call BRP_SetStatusMessage(L_CompressingCab_Message)

        g_oCab.Compress GetTempPath & "\Upload.CAB"

        '
        ' Error trapping for problems during compression
        '
        if Err.number <> 0 then
            Call UnregisterCabHandler()
            Call BRP_MessageBox(L_CabCompression_ErrorMessage)
            Call BRP_CleanupAfterCancelUpload()
            exit sub
        end if

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub ContinueSaveIncident()

        const L_SavingIncident_Message    = "Saving incident to "
        const L_IncidentSaved_Message     = "Incident saved to "
        const L_SaveFailed_ErrorMessage   = "Couldn't save incident to "
        const L_CantSaveFile_ErrorMessage = "Can't save incident.  Make sure the path is valid and there is free space on the drive."
        const L_SavingFinished_Message    = " - File saved"

        Dim oTmpObj, oFS
        Dim szCabFileName

        Call BRP_TraceMessage("ContinueSaveIncident")

        if g_bSaveIncident = False then
            exit sub
        end if

        if g_bSubmitIncident = False then
            g_oUpl.Delete
        end if

        Call BRP_SetStatusMessage(L_SavingIncident_Message & document.all.IncidentFilename.value)

        if g_bSubmitIncident = False then
            Call SetProgress(0)
        end if

        Set oFS = CreateObject("Scripting.FileSystemObject")
        on error resume next

        szCabFileName = document.all.IncidentFilename.value

        oFS.CopyFile GetTempPath & "\Upload.CAB", szCabFileName
        if err.number <> 0 then
            Call BRP_SetStatusMessage(L_SaveFailed_ErrorMessage & document.all.IncidentFilename.value)
            Call BRP_MessageBox(L_CantSaveFile_ErrorMessage)
            '
            ' If submitting is not going to happen after this, clean up the buttons
            '
            if g_bSubmitIncident = False then
                Call BRP_CleanupAfterCancelUpload()
            end if
            exit sub
        end if

        Call BRP_SetStatusMessage(L_IncidentSaved_Message & document.all.IncidentFilename.value)

        '
        ' If submitting is not going to happen after this, clean up the buttons
        '
        if g_bSubmitIncident = False then

            Call SetProgress(100)
            Call BRP_AppendProgressMessage(L_SavingFinished_Message)

            Call BRP_CleanCrashDump()

            '
            ' Make a record of the incident
            '
            Call RecordIncident(Now(),"-")

            '
            ' Store valid options
            '
            Call BRP_WriteIniFile()

            Call BRP_CleanupAfterCancelUpload()

        end if



    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub ContinueUploadIncident()

        const L_UploadCab_ErrorMessage        = "An error occurred when trying to use the upload CAB file"
        const L_UploadStart_ErrorMessage      = "An error occurred when trying to start upload"

        Dim oTmpObj, oInc, oFS

        '
        ' Alway trap all errors in the code
        '
        on error resume next

        Call BRP_TraceMessage("ContinueUploadIncident")

        if g_bSubmitIncident = False then
            exit sub
        end if

        if BRP_DebugFlag >= 1 then
            g_oUpl.Server    = L_ServerNameTest_Address
        else
            g_oUpl.Server    = L_ServerName_Address
        end if

        g_oUpl.ProviderID    = "ESC"
        g_oUpl.Mode          = UL_FOREGROUND
        g_oUpl.PersistToDisk = False

        '
        ' CAB file is already in a compressed state so further compression
        ' is not required (Fixes Bug 102646)
        '
        g_oUpl.Compressed    = False
        g_oUpl.History       = UL_HISTORY_NONE
        '
        ' We need to zero out the progress indicator, since the Upload object
        ' doesn't always do this (for example, if it aborts immediatly).
        '
        upl_onProgressChange g_oUpl, 0, 100

        Call RegisterUPLHandlers()

        Call BRP_TraceMessage("Get Data from Upload.CAB file")

        g_oUpl.GetDataFromFile GetTempPath & "\Upload.CAB"
        '
        ' Error trapping for invalid parameters has to be carried out here
        ' with proper error code message
        '
        if Err.number <> 0 then
            Call BRP_MessageBox(L_UploadCab_ErrorMessage )
            Call BRP_CleanupAfterCancelUpload()
            exit sub
        end if

        Call BRP_TraceMessage("Start uploading")

        g_oUpl.ActivateASync
        '
        ' Error trapping for invalid parameters has to be carried out here
        ' with proper error code message
        '
        if Err.number <> 0 then
            Call BRP_MessageBox(L_UploadStart_ErrorMessage)
            Call BRP_CleanupAfterCancelUpload()
            exit sub
        end if
    end sub

    Function ReadAllTextFile(szFileName)
        Const ForReading = 1, ForWriting = 2
        Dim oFS, oFile
        Set oFS   = CreateObject("Scripting.FileSystemObject")
        Set oFile = oFS.OpenTextFile(szFileName, ForReading)
        ReadAllTextFile =  oFile.ReadAll
        oFile.Close
    End Function

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub RecordIncident(szTrackingTime,szTrackingNo)

        const L_IncidentDir_FileName          = "\incidents"
        const L_IncHead_FileName              = "\inc_head.htm"
        const L_IncTail_FileName              = "\inc_tail.htm"
        const L_Saved_Message                 = "Saved"
        const L_Submitted_Message             = "Submitted"
        const L_BugReport_Message             = "Bug Report"
        const L_ActionsTaken_Message          = "Actions taken"
        const L_AddFiles_Message              = "Additional Files"
        const L_SubmitTime_Message            = "Submit Time"
        const L_TrackingNumber_Message        = "Tracking Number"
        const L_SavedFile_Message             = "Saved File"
        const L_CSVFileName_Message           = "CSV File"
        const L_RecordIncident_ErrorMessage   = "An error occurred when recording the incident on the computer"

        Dim oFS, oChannel, oDataFile
        Dim bFileOK
        Dim nAddFiles

        on error resume next

        Err.number = 0

        bFileOK   = True

        Set oFS = CreateObject("Scripting.FileSystemObject")
        if Err.number <> 0 then
            Call BRP_MessageBox(L_RecordIncident_ErrorMessage)
            exit sub
        end if

        '
        ' Create an incidents folder
        '
        if ( oFS.FolderExists( GetVendorPath & L_IncidentDir_FileName )) then

        else
            oFS.CreateFolder( GetVendorPath & L_IncidentDir_FileName )
        end if

        '
        ' Find a unique file name based on number for the HTML file
        '
        nCount  = 1
        NewFile = False
        Do
          szFile         = nCount & ".htm"
          szFileName     = GetVendorPath & L_IncidentDir_FileName & "\" & szFile
          szCSV_File     = nCount & ".csv"
          szCSV_FileName = GetVendorPath & L_IncidentDir_FileName & "\" & szCSV_File
          if oFS.FileExists(szFileName) OR oFS.FileExists(szCSV_FileName) then
              nCount = nCount + 1
          else
              NewFile = True
          end if
        Loop While NewFile = False

        if Err.number <> 0 then
            Call BRP_MessageBox(L_RecordIncident_ErrorMessage)
            exit sub
        end if

        szIncidentAction = " "
        if g_bSaveIncident = True then
            szIncidentAction = szIncidentAction  & L_Saved_Message
        end if
        if g_bSubmitIncident = True then
            szIncidentAction = szIncidentAction  & L_Submitted_Message
        end if

        '
        ' Create CSV data file
        '
        Set oDataFile = oFS.CreateTextFile(szCSV_FileName, False)

        if Err.number <> 0 then
            Call BRP_MessageBox(L_RecordIncident_ErrorMessage)
            exit sub
        end if

        szEscaped = replaceQuotes(Cstr(szTrackingTime))
        oDataFile.Write chr(34) & szEscaped & chr(34) & ","

        szEscaped = replaceQuotes(szTrackingNo)
        oDataFile.Write chr(34) & szEscaped & chr(34) & ","

        if g_bSaveIncident = True then
            szEscaped = replaceQuotes(document.all.IncidentFilename.value)
            oDataFile.Write chr(34) & szEscaped & chr(34) & ","
        end if

        szEscaped = replaceQuotes(szCSV_FileName)
        oDataFile.Write chr(34) & szEscaped & chr(34) & ","

        szEscaped = replaceQuotes(szIncidentAction)
        oDataFile.Write chr(34) & szEscaped & chr(34) & ","

        misc_fields = "BetaID:Title:Severity:Area:Reproducibility:Description:ExpectedBehavior:StepsToRepro"

        while misc_fields <> ""
            colon = instr(misc_fields, ":")
            if (colon <> 0) then
                field = left(misc_fields, colon-1)
                misc_fields = right(misc_fields, len(misc_fields) - colon)
            else
                field = misc_fields
                misc_fields = ""
            end if
            if len(field) > 0 then
                szEscaped = replaceQuotes(document.all(field).value)
                oDataFile.Write chr(34) & szEscaped & chr(34) & ","
            end if
        wend

        nAddFiles = document.all.AdditionalFiles_List.length
        szEscaped = replaceQuotes(Cstr(nAddFiles))
        oDataFile.Write chr(34) & szEscaped & chr(34)

        oDataFile.Close

        if Err.number <> 0 then
            Call BRP_MessageBox(L_RecordIncident_ErrorMessage)
            exit sub
        end if

        '
        ' Create HTML data file
        '
        Set oDataFile = oFS.CreateTextFile(szFileName, False)

        if Err.number <> 0 then
            Call BRP_MessageBox(L_RecordIncident_ErrorMessage)
            exit sub
        end if

        if ( oFS.FileExists( GetVendorPath & L_IncHead_FileName )) then
            szHeadString = ReadAllTextFile( GetVendorPath & L_IncHead_FileName )
            oDataFile.Write szHeadString
        end if

        oDataFile.Write "<TR>"
        oDataFile.Write "<TD>"
        oDataFile.Write "<TABLE border=0>"
        oDataFile.Write "<TBODY>"
        oDataFile.Write "    <TR>"
        oDataFile.Write "      <TD valign=top><B>" & L_SubmitTime_Message & "</B></TD>"
        oDataFile.Write "      <TD>" & szTrackingTime & "</TD>"
        oDataFile.Write "    </TR>"
        oDataFile.Write "    <TR>"
        oDataFile.Write "      <TD valign=top><B>" & L_TrackingNumber_Message & "</B></TD>"
        oDataFile.Write "      <TD>" & szTrackingNo & "</TD>"
        oDataFile.Write "    </TR>"

        if g_bSaveIncident = True then
            oDataFile.Write "    <TR>"
            oDataFile.Write "      <TD valign=top><B>" & L_SavedFile_Message & "</B></TD>"
            oDataFile.Write "      <TD>" & document.all.IncidentFilename.value & "</TD>"
            oDataFile.Write "    </TR>"
        end if

        oDataFile.Write "    <TR>"
        oDataFile.Write "      <TD valign=top><B>" & L_CSVFileName_Message & "</B></TD>"
        oDataFile.Write "      <TD>" & szCSV_FileName & "</TD>"
        oDataFile.Write "    </TR>"

        szIncidentAction = " "
        if g_bSaveIncident = True then
            szIncidentAction = szIncidentAction  & "&nbsp;" & L_Saved_Message & "&nbsp;"
        end if
        if g_bSubmitIncident = True then
            szIncidentAction = szIncidentAction  & "&nbsp;" & L_Submitted_Message & "&nbsp;"
        end if

        oDataFile.Write "    <TR>"
        oDataFile.Write "      <TD valign=top><B>" & L_ActionsTaken_Message & "</B></TD>"
        oDataFile.Write "      <TD>" & szIncidentAction & "</TD>"
        oDataFile.Write "    </TR>"

        misc_fields = "BetaID:Title:Severity:Area:Reproducibility"

        while misc_fields <> ""
            colon = instr(misc_fields, ":")
            if (colon <> 0) then
                field = left(misc_fields, colon-1)
                misc_fields = right(misc_fields, len(misc_fields) - colon)
            else
                field = misc_fields
                misc_fields = ""
            end if
            if len(field) > 0 then
                oDataFile.Write "    <TR>"
                oDataFile.Write "      <TD valign=top><B>" & field & "</B></TD>"
                oDataFile.Write "      <TD>" & document.all(field).value & "</TD>"
                oDataFile.Write "    </TR>"
            end if
        wend

        misc_fields = "Description:ExpectedBehavior:StepsToRepro"

        while misc_fields <> ""
            colon = instr(misc_fields, ":")
            if (colon <> 0) then
                field = left(misc_fields, colon-1)
                misc_fields = right(misc_fields, len(misc_fields) - colon)
            else
                field = misc_fields
                misc_fields = ""
            end if
            if len(field) > 0 then
                oDataFile.Write "    <TR>"
                oDataFile.Write "      <TD valign=top><B>" & field & "</B></TD>"
                oDataFile.Write "      <TD><TEXTAREA cols=60 wrap=virtual rows=6 " & _
                                " ONKEYPRESS=" & chr(34) & "event.returnValue=false;" & chr(34) & _
                                " ONCUT=" & chr(34) & "event.returnValue=false;" & chr(34) & _
                                " ONPASTE=" & chr(34) & "event.returnValue=false;" & chr(34) & _
                                " >" & document.all(field).value & "</TEXTAREA></TD>"
                oDataFile.Write "    </TR>"
            end if
        wend

        '
        ' Find number of selected files and add them to the list
        ' they exist at the time of selection so not re-checking them
        '
        nAddFiles = document.all.AdditionalFiles_List.length

        if nAddFiles > 0 then
            szFileList = " "
            for nCount = 0 to (nAddFiles - 1)
                szFileList = szFileList &  document.all.AdditionalFiles_List.Options(nCount).text & "<BR>"
            next

            oDataFile.Write "    <TR>"
            oDataFile.Write "      <TD valign=top><B>" & L_AddFiles_Message & "</B></TD>"
            oDataFile.Write "      <TD>" & szFileList & "</TD>"
            oDataFile.Write "    </TR>"

        end if

        oDataFile.Write "  </TBODY>"
        oDataFile.Write"      </TABLE>"
        oDataFile.Write"    </TD>"
        oDataFile.Write"  </TR>"
        oDataFile.Write"  </TBODY>"
        oDataFile.Write"</TABLE>"

        if ( oFS.FileExists( GetVendorPath & L_IncTail_FileName )) then
            szHeadString = ReadAllTextFile( GetVendorPath & L_IncTail_FileName )
            oDataFile.Write szHeadString
        end if

        oDataFile.Close

        if Err.number <> 0 then
            Call BRP_MessageBox(L_RecordIncident_ErrorMessage)
            exit sub
        end if

        if bFileOK = True then
            Err.number   = 0
            Set oChannel = pchealth.CreateObject_Channel(L_VendorChannel_Address, L_ProductName_Version)
            szIncidentPath = "hcp://" & L_VendorChannel_Address & L_IncidentDir_FileName & "\" & szFile
            if err.number <> 0 then
                Call BRP_MessageBox(L_RecordIncident_ErrorMessage)
            else
                if g_bSubmitIncident = True then
                    szIName = "&nbsp;" & L_BugReport_Message & "&nbsp;" & ":&nbsp;" & document.all.Title.value & "&nbsp;(" & L_Submitted_Message & ")"
                else
                    szIName = "&nbsp;" & L_BugReport_Message & "&nbsp;" & ":&nbsp;" & document.all.Title.value & "&nbsp;(" & L_Saved_Message & ")"
                end if
                '
                ' Number of parameters changed in new RecordIncident
                '
                if g_nCurrentBuild < 2399 then
                    oChannel.RecordIncident szIName, szIncidentPath
                else
                    oChannel.RecordIncident szIName, szIncidentPath, "", ""
                end if
            end if
         end if

    end sub

    const L_NeedFilename_ErrorMessage = "You must specify a filename."

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub StartProcessing()

        const L_OverwriteFile_TEXT          = "The file already exists.  Do you want to replace the existing file?"
        const L_SingleSubmit_ErrorMessage   = "Only one bug may be submitted at a time."
        const L_NeedAction_ErrorMessage     = "Select the option to Submit and/or Save the bug report"
        const L_NoFolder1_ErrorMessage      = "The folder "
        const L_NoFolder2_ErrorMessage      = " does not exist. Do you want to create it ?"
        const L_NoCreateFolder_ErrorMessage = "Could not create the folder. Please select a different folder for the bug report"


        Dim oFS                 ' File System Object
        Dim szCabFileName, szTemp
        Dim slash

        g_bSaveIncident   = False
        g_bSubmitIncident = False
        g_bFormValid      = False

        on error resume next

        if document.all.SaveIncidentNow.checked = False AND document.all.SubmitIncidentNow.checked = False then
            BRP_MessageBox L_NeedAction_ErrorMessage
            exit sub
        end if

        Call ValidateForm()

        '
        ' Form invalid then exit
        '
        if g_bFormValid = False then
            exit sub
        end if

        '
        ' If we have to save the form do checking for valid file now
        '
        if document.all.SaveIncidentNow.checked then

            if document.all.IncidentFilename.value = "" Then
                BRP_MessageBox L_NeedFilename_ErrorMessage
                document.all.IncidentFilename.focus
                exit sub
            end if
            Set oFS = CreateObject("Scripting.FileSystemObject")

            '
            ' Check if the folder exists else create it
            '
            szTemp = document.all.IncidentFilename.value
            slash  = instrrev(szTemp,"\")
            if slash <> 0 then
                szTemp = left(szTemp,slash-1)
                if NOT oFS.FolderExists( szTemp ) then
                    if BRP_Confirm(L_NoFolder1_ErrorMessage & szTemp & L_NoFolder2_ErrorMessage) = vbNo then
                        exit sub
                    end if
                    oFS.CreateFolder( szTemp )
                    if Err.number <> 0 then
                        BRP_MessageBox L_NoCreateFolder_ErrorMessage
                        exit sub
                    end if
                end if
            end if

            szCabFileName = document.all.IncidentFilename.value
            if oFS.FileExists(szCabFileName) then
                if BRP_Confirm(L_OverwriteFile_TEXT) = vbNo then
                    exit sub
                end if
            end if
            g_bSaveIncident = True
        end if

        if document.all.SubmitIncidentNow.checked then
            g_bSubmitIncident = True
        end if

        '
        ' Form is validated, so call UploadIncident
        '
        if g_nInProgress then
            BRP_MessageBox L_SingleSubmit_ErrorMessage
            exit sub
        else
            g_nInProgress = 1
            document.all.Submit.disabled       = 1
            document.all.Cancel.disabled       = 0
        end if

        '
        ' Disable all fields so they cannot be changed
        '
        document.all.BugReportingInputFieldsTable.style.display = "none"
        document.all.BugReportingHeadingTable.style.cursor      = "wait"
        document.all.BugReportingSubmittingTable.style.cursor   = "wait"
        document.all.IncidentFilename.disabled  = True
        document.all.SubmitIncidentNow.disabled = True
        document.all.SaveIncidentNow.disabled   = True


        '
        ' Start data collection
        '
        Call CollectData()

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub BRP_CleanupAfterCancelUpload()

        g_nInProgress = 0
        document.all.Submit.disabled       = 0
        document.all.Cancel.disabled       = 1

        '
        ' Enable all fields so they cannot be changed
        '
        document.all.BugReportingInputFieldsTable.style.display = ""
        document.all.BugReportingHeadingTable.style.cursor      = "auto"
        document.all.BugReportingSubmittingTable.style.cursor   = "auto"

        document.all.IncidentFilename.disabled  = False
        document.all.SubmitIncidentNow.disabled = False
        document.all.SaveIncidentNow.disabled   = False

        document.all.Submit.focus

    end sub
'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    function BRP_Working()

        if g_nInProgress then
            BRP_Working = True
        else
            BRP_Working = False
        end if

    end function

'------------------------------------------------------------------------------
'
' Add a file to the list
'
'------------------------------------------------------------------------------
    sub BRP_ListAddFileForUpload()

        Dim oFS                 ' File System Object
        Dim szFileName
        Dim AddFilesIndex

        const L_FileDoesntExist_ErrorMessage = "That file does not exist."

        '
        ' If a file is selected add this to the list
        '
        if document.all.AdditionalFile.value = "" Then
            BRP_MessageBox L_NeedFilename_ErrorMessage
            document.all.AdditionalFile.focus
            exit sub
        end if

        '
        ' Remove leading/trailing spaces
        '
        szFileName = removeLeadingSpace(document.all.AdditionalFile.value)

        Set oFS = CreateObject("Scripting.FileSystemObject")

        If NOT oFS.FileExists(szFileName) Then
            BRP_MessageBox L_FileDoesntExist_ErrorMessage & _
                           "(" & szFileName & ")"
            document.all.AdditionalFile.focus
            exit sub
        end if

    Call addListElement(document.all.AdditionalFiles_List, _
                            szFileName , _
                            szFileName )

        document.all.AdditionalFile.focus

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub BRP_ListRemoveFileForUpload()

        const L_RemoveSelectFile_ErrorMessage = "Please select a file to be removed"
        const L_NoFilesToRemove_ErrorMessage  = "There are no files that can be removed"

        if document.all.AdditionalFiles_List.options.length = 0 then
            Call BRP_MessageBox(L_NoFilesToRemove_ErrorMessage)
            exit sub
        end if

        Call delListElement(document.all.AdditionalFiles_List.options,L_RemoveSelectFile_ErrorMessage)

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub CorrectBetaID()

        Dim szName, period
        '
        ' Remove anything after a .
        '
        period = instr(window.event.srcElement.value,".")
        if period <> 0 then
            szName = left(window.event.srcElement.value, period-1)
            window.event.srcElement.value = left(window.event.srcElement.value, period-1)
        end if
    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    function CreateNameCABInternal(szName)

        Dim szName1, szName2

        '
        ' Clean title
        '
        szName = removeLeadingSpace(szName)
        szName = removeTrailingSpace(szName)
        szName = validateFilename(szName,"_")

        szName  = g_SettingsLastPath & "\" & szName & ".cab"

        document.all.IncidentFilename.value = szName

        CreateNameCABInternal = TRUE

    end function

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub CreateNameCAB()

        CreateNameCABInternal(window.event.srcElement.value)

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub CorrectNameCAB()

        Dim szName, szFileName, period, slash

        '
        ' Remove leading/trailing spaces
        '
        szFileName = window.event.srcElement.value

        szFileName  = removeLeadingSpace(window.event.srcElement.value)
        szFileName  = removeTrailingSpace(szFileName)

        '
        ' Add the .cab extension and only use the last period
        '
        period = instrrev(szFileName,".")
        if period <> 0 then
            szName  = left(szFileName, period-1)
            szNameR = right(szFileName, len(szFileName)-period)
            if szName = "" then
                window.event.srcElement.value = "bugdata.cab"
            else
                if szNameR = "cab" then
                    '
                    ' Its OK for now
                    '
                else
                    szFileName = szFileName & ".cab"
                end if
            end if
        else
            if szFileName = "" then
                szFileName = "bugdata" & ".cab"
            else
                slash = instrrev(szFileName,"\")
                if slash <> 0 then
                    szNameR    = right(szFileName, len(szFileName)-slash)
                    if szNameR = "" then
                        szFileName = szFileName & "bugdata.cab"
                    else
                        szFileName = szFileName & ".cab"
                    end if
                else
                    szFileName = szFileName & ".cab"
                end if
            end if
        end if

        '
        ' validate filename and append validated file name
        '
        slash = instrrev(szFileName,"\")
        if slash <> 0 then
            szNameR    = right(szFileName, len(szFileName)-slash)
            szNameR    = validateFileName(szNameR,"_")
            szFileName = left(szFileName,slash-1)
            szFileName = szFileName & "\" & szNameR
        else
            szFileName = validateFileName(szFileName,"_")
        end if

        window.event.srcElement.value = szFileName

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub BRP_InitializeAll()

        Const ForReading = 1, ForWriting = 2

        const L_InitializeAll_ErrorMessage   = "An error occurred when initializing bug reporting on your computer"
        const L_InitFile_FileName            = "brp_init.ini"

        Dim oFS, oDataFile
        Dim fInitialize

        fInitialize = True

        on error resume next

        Set oFS = CreateObject("Scripting.FileSystemObject")
        if Err.number <> 0 then
            Call BRP_MessageBox(L_InitializeAll_ErrorMessage)
            exit sub
        end if

        if ( oFS.FileExists( GetVendorPath & "\" & L_InitFile_FileName )) then

            '
            ' Read current version from ini file and if older then do init
            '
            Set oDataFile = oFS.OpenTextFile((GetVendorPath & "\" & L_InitFile_FileName), ForReading)
            szIniVersion  = oDataFile.ReadLine
            oDataFile.Close

            nBrpVer = CInt(L_BRPBuild_Version)
            nIniVer = CInt(szIniVersion)

            '
            ' If bug reporting and ini file have same version then its OK
            ' else just initialize
            '
            if nBrpVer = nIniVer then
                fInitialize = False
            else
                fInitialize = True
            end if

        end if

        if fInitialize = True then

            '
            ' Register dll for collecting system information
            '
            RetVal1 = RegisterBrpSysInfo()

            '
            ' Register ieinfo5.mof by running this through the MOF comp
            '
            RetVal2 = RegisterIEInfoMOF()

            '
            ' If codes returned by any of the provides are not fully success,
            ' delete initializing file
            '
            if RetVal1 <> 0 OR RetVal2 <> 0 then
                if ( oFS.FileExists( GetVendorPath & "\" & L_InitFile_FileName )) then
                    oFS.DeleteFile((GetVendorPath & "\" & L_InitFile_FileName))
                end if
            else
                '
                ' Write current version to bug reporting ini file
                '
                Set oDataFile = oFS.CreateTextFile((GetVendorPath & "\" & L_InitFile_FileName), True)
                oDataFile.Write L_BRPBuild_Version
                oDataFile.Close
            end if

        end if

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub BRP_SetInterfaceBasedOnDefaults()

        Dim oFS                 ' File System Object

        const L_DataFile_FileName            = "\bugdata.cab"
        const L_Kernel_Message               = "Kernel"
        const L_SomeApp_Message              = "Some Application"
        const L_Crashed_Message              = " Crashed"
        const L_Description_Message          = " crashed."
        const L_Expected_Message             = " should not crash."
        const L_CrashDumpFileMissing_ErrorMessage = "CrashDumpFile is missing"

        on error resume next

        '
        ' Set defaults which are stored
        '
        document.all.BetaID.value              = g_SettingsBetaId
        document.all.IncidentFilename.value    = g_SettingsLastPath & L_DataFile_FileName
        document.all.CollectOk.checked         = g_SettingsShareInfo
        document.all.SubmitIncidentNow.checked = g_SettingsSubmitNow
        document.all.SaveIncidentNow.checked   = g_SettingsSaveToDisk

        if Len(g_CrashDumpFile) > 0 then
            '
            ' we are invoked by a fault handler
            '
            document.all.Severity.value         = "1" 'we need to add one more type for BSOD

            if Len(g_CrashApp) <= 0 then
                '
                ' in case g_CrashApp is blank
                '
                if g_KernelCrash then
                    g_CrashApp = L_Kernel_Message
                else
                    g_CrashApp = L_SomeApp_Message
                end if
            end if
            document.all.Title.value               = g_CrashApp & L_Crashed_Message
            Call CreateNameCABInternal(document.all.Title.value)

            document.all.Description.value         = g_CrashApp & L_Description_Message
            document.all.ExpectedBehavior.value    = g_CrashApp & L_Expected_Message

            '
            ' add file to the attachment list
            '
            Set oFS = CreateObject("Scripting.FileSystemObject")
            if Err.number <> 0 then
                Call BRP_MessageBox(L_InitializeAll_ErrorMessage)
                exit sub
            end if
            if oFS.FileExists( g_CrashDumpFile ) then
                Call addListElement(document.all.AdditionalFiles_List, _
                                g_CrashDumpFile, _
                                g_CrashDumpFile)
            else
                '
                ' for debugging only. Will take it out once fault handler is code complete
                '
                Call BRP_MessageBox(L_CrashDumpFileMissing_ErrorMessage & ": " & g_CrashDumpFile)
            end if
            '
            'for debugging only
            '
            'Call BRP_MessageBox("crashdump: " & g_CrashDumpFile & " crashapp: " & g_Crashapp & " bsod:" & cint(g_kernelcrash) & " deldump: " & cint(g_deletecrashdump))
            '
        end if

    end sub
'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub BRP_WriteIniFile()

        Const ForReading = 1, ForWriting = 2

        const L_InitializeIni_ErrorMessage   = "An error occurred when initializing bug reporting on your computer"
        const L_WIniFile_FileName            = "brp_settings.ini"

        Dim oFS, oDataFile
        Dim szTemp, nTemp, slash

        on error resume next

        Set oFS = CreateObject("Scripting.FileSystemObject")
        if Err.number <> 0 then
            exit sub
        end if

        '
        ' Create ini file
        '
        Set oDataFile = oFS.CreateTextFile((GetVendorPath & "\" & L_WIniFile_FileName), True)

        oDataFile.Write document.all.BetaID.value & vbCrLf
        szTemp = document.all.IncidentFilename.value
        slash = instrrev(szTemp,"\")
        if slash <> 0 then
            szTemp = left(szTemp,slash-1)
            oDataFile.Write szTemp & vbCrLf
        else
            oDataFile.Write GetSystemDrivePath() & vbCrLf
        end if

        nTemp = 0
        if document.all.CollectOk.checked then
            nTemp = 1
        end if
        oDataFile.Write nTemp & vbCrLf

        nTemp = 0
        if document.all.SubmitIncidentNow.checked then
            nTemp = 1
        end if
        oDataFile.Write nTemp & vbCrLf

        nTemp = 0
        if document.all.SaveIncidentNow.checked then
            nTemp = 1
        end if
        oDataFile.Write nTemp & vbCrLf

        '
        ' Close file
        '
        oDataFile.Close

    end sub
'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub BRP_CleanCrashDump()
        Dim oFS

        On Error Resume Next

	    if Len(g_CrashDumpFile) > 0 AND g_DeleteCrashDump then
            Set oFS = CreateObject("Scripting.FileSystemObject")
            if Err.number <> 0 then
                Call BRP_MessageBox(L_InitializeAll_ErrorMessage)
                exit sub
            end if

            call oFS.DeleteFile(g_CrashDumpFile, TRUE)
            '
            ' end of bug filing, reset the global variable
            '
        end if
        g_DeleteCrashDump = FALSE
        g_CrashDumpFile   = ""
        g_CrashApp        = ""
        g_KernelCrash     = FALSE

    end sub
'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub BRP_ReadIniFile()

        Const ForReading = 1, ForWriting = 2

        const L_IniFile_FileName             = "brp_settings.ini"
        const L_BugReport_FileName           = "millennium_bugs"

        Dim oFS, oDataFile
        Dim szTemp, nTemp
        Dim szHRef
        Dim nQueryStr, nQueryStart
        Dim QueryStrings

        on error resume next

        Set oFS = CreateObject("Scripting.FileSystemObject")
        if Err.number <> 0 then
            exit sub
        end if

        g_SettingsBetaId     = ""
        g_SettingsLastPath   = GetSystemDrivePath() & "\" & L_BugReport_FileName
        g_SettingsShareInfo  = True
        g_SettingsSubmitNow  = False
        g_SettingsSaveToDisk = True

        Call BRP_SetInterfaceBasedOnDefaults()

        if ( oFS.FileExists( GetVendorPath & "\" & L_IniFile_FileName )) then

            '
            ' Read current version from ini file and if older then do init
            '
            Set oDataFile = oFS.OpenTextFile((GetVendorPath & "\" & L_IniFile_FileName), ForReading)
            if Err.number <> 0 then
                exit sub
            end if
            '
            ' Read beta id
            '
            szTemp = oDataFile.ReadLine
            if Err.number <> 0 then
                oDataFile.close
                Call BRP_SetInterfaceBasedOnDefaults()
                exit sub
            end if
            g_SettingsBetaId = CDbl(szTemp)
            if g_SettingsBetaId < 0 OR g_SettingsBetaId > 2147483647 then
                g_SettingsBetaId = ""
            end if
            '
            ' Read last path
            '
            szTemp = oDataFile.ReadLine
            if Err.number <> 0 then
                oDataFile.close
                Call BRP_SetInterfaceBasedOnDefaults()
                exit sub
            end if
            if oFS.FolderExists( szTemp ) then
                g_SettingsLastPath = szTemp
            end if
            '
            ' Read share info
            '
            szTemp = oDataFile.ReadLine
            if Err.number <> 0 then
                oDataFile.close
                Call BRP_SetInterfaceBasedOnDefaults()
                exit sub
            end if
            g_SettingsShareInfo = CBool(szTemp)
            '
            ' Read submit now
            '
            szTemp = oDataFile.ReadLine
            if Err.number <> 0 then
                oDataFile.close
                Call BRP_SetInterfaceBasedOnDefaults()
                exit sub
            end if
            g_SettingsSubmitNow = CBool(szTemp)
            '
            ' Read save to disk
            '
            szTemp = oDataFile.ReadLine
            if Err.number <> 0 then
                oDataFile.close
                Call BRP_SetInterfaceBasedOnDefaults()
                exit sub
            end if
            g_SettingsSaveToDisk = CBool(szTemp)

            '
            ' Close file
            '
            oDataFile.Close

        end if

        g_CrashApp           = ""
        g_KernelCrash     = FALSE
        g_CrashDumpFile      = ""
        g_DeleteCrashDump    = FALSE

        '
        ' when the bug reporting page is invoked as:
        ' hcp://CN=Microsoft Corporation,L=Redmond,S=Washington,C=US/bugrep.htm?_
        '    CrashApp=Microsoft Word&DumpFile=d:\temp\common files\t.dmp&bsod=1&deldump=1
        ' href contains:
        ' hcp://CN=Microsoft%20Corporation,L=Redmond,S=Washington,C=US/bugrep.htm?_
        '    CrashApp=Microsoft%20Word&DumpFile=d:\temp\common%20files\t.dmp&bsod=1&deldump=1
        '
        szHRef = LCase(window.location.href)
        nQueryStart = InStr(1, szHRef, "?", 1)
        if (nQueryStart > 1) then
            szHRef = Mid(szHRef, nQueryStart + 1)
            QueryStrings = Split(szHRef, "&", -1, 1)
            '
            ' check the query strings
            '
            for each QueryStr in QueryStrings
                nQueryStr = InStr(1, QueryStr, "dumpfile=", 1)
                if (nQueryStr >= 1) then
                    '
                    ' found DumpFile
                    '
                    nQueryStr = nQueryStr + len("dumpfile=")
                    g_CrashDumpFile = createUnEscapedString(Mid(QueryStr, nQueryStr))
                else
                    nQueryStr = InStr(1, QueryStr, "crashapp=", 1)
                    if (nQueryStr >= 1) then
                        '
                        ' found CrashApp
                        '
                        nQueryStr = nQueryStr + len("crashapp=")
                        g_CrashApp = createUnEscapedString(Mid(QueryStr, nQueryStr))
                    else
                        nQueryStr = InStr(1, QueryStr, "bsod=", 1)
                        if (nQueryStr >= 1) then
                            '
                            ' found BSOD
                            '
                            nQueryStr = nQueryStr + len("bsod=")
                            if ("1" = Mid(QueryStr, nQueryStr)) then
                                g_KernelCrash = TRUE
                            else
                                g_kernelCrash = FALSE
                            end if
                        else
                            nQueryStr = InStr(1, QueryStr, "deldump=", 1)
                            if (nQueryStr >= 1) then
                                '
                                ' found deldump
                                '
                                nQueryStr = nQueryStr + len("deldump=")
                                if ("1" = Mid(QueryStr, nQueryStr)) then
                                    g_DeleteCrashDump = TRUE
                                else
                                    g_DeleteCrashDump = FALSE
                                end if
                            end if
                        end if
                    end if
                end if
            next
        end if

        Call BRP_SetInterfaceBasedOnDefaults()

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub BRP_OnProblemTypeChange()

    Dim szArea

    on error resume next

    szArea = Cstr(document.all.Severity.value)

    Select Case szArea
        case "1"
             document.all.DrWatsonInfo.style.display = ""
        case Else
             document.all.DrWatsonInfo.style.display = "none"
    end select

    end sub

'------------------------------------------------------------------------------
'
'
'
'------------------------------------------------------------------------------
    sub BRP_OnAreaChange()

    Dim szArea

    on error resume next

    szArea = document.all.Area.value

    Select Case szArea
        case "App Compat", "Display", "PNP", "Multimedia"
             document.all.DirectXInfo.style.display = ""
        case Else
             document.all.DirectXInfo.style.display = "none"
    end select

    Select Case szArea
        case "PC Health"
             document.all.SystemRestoreInfo.style.display = ""
        case Else
             document.all.SystemRestoreInfo.style.display = "none"
    end select

    end sub

</script>

<SCRIPT LANGUAGE="VBScript" FOR=window EVENT=onload>

    on error resume next
    '
    ' Set page version
    '
    document.all.BRP_VersionText.innerHTML = "Bug Reporting Page Version " & L_BRP_Version & L_BRPBuild_Version

    '
    ' Initialize all
    '
    Call BRP_InitializeAll()

    Set oSysInfo = CreateObject("PCHealth.BugRepSysInfo")
    if Err.number = 0 then
        document.all.OS_Name.innerHTML     = "Windows Millennium"
        document.all.OS_Version.innerHTML  = oSysInfo.GetOSVersionString
        document.all.OS_Language.innerHTML = oSysInfo.GetLanguageID

        Call BRP_SetOSBuild(oSysInfo.GetOSVersionString)

    end if

    '
    ' Read initialization file
    '
    Call BRP_ReadIniFile()

    '
    ' Set focus to betaid after page load
    '
    document.all.BetaID.focus

</SCRIPT>

<script language=JavaScript>

    //
    // UPL - Upload handler
    // DC  - Data collection handler
    // CAB - Cab file creation handler
    //

    var DCHandlerEnabled  = 0;
    var UPLHandlerEnabled = 0;
    var CabHandlerEnabled = 0;

    //
    // Check if machine data stream is not NULL given a data collection object
    //
    function IsMachineDataValid(ptrDc)
    {

        var stream = ptrDc.MachineData_GetStream() ;

        if ( stream != null ) {
            return true ;
        }
        else
            return false ;
    }

    //
    // Check if machine history data stream is not NULL given a data collection object
    //
    function IsHistoryDataValid(ptrDc)
    {

        var stream = ptrDc.History_GetStream() ;

        if ( stream != null ) {
            return true ;
        }
        else
            return false ;
    }

    //
    // Create escaped string
    //
    function createEscapedString(str)
    {

        return escape(str);

    }

    //
    // Create unescaped string
    //
    function createUnEscapedString(str)
    {

        return unescape(str);

    }

    function dc_onStatusChangeJS(DataCollectionPtr, status)
    {
        if (DCHandlerEnabled == 1) {
            dc_onStatusChange(DataCollectionPtr, status);
        }
    }

    function dc_onProgressJS(DataCollectionPtr, done, total)
    {
        if (DCHandlerEnabled == 1) {
            dc_onProgress(DataCollectionPtr, done, total);
        }
    }

    function dc_onCompleteJS(DataCollectionPtr, hresult)
    {
        if (DCHandlerEnabled == 1) {
            dc_onComplete(DataCollectionPtr, hresult);
        }
    }

    function RegisterDCHandlers()
    {
        DCHandlerEnabled   = 1;
        g_oDc.onStatusChange = dc_onStatusChangeJS;
        g_oDc.onProgress     = dc_onProgressJS;
        g_oDc.onComplete     = dc_onCompleteJS;
    }

    function UnregisterDCHandlers()
    {
        DCHandlerEnabled = 0;
    }


    function upl_onStatusChangeJS(UploadJobPtr, status)
    {
        if (UPLHandlerEnabled == 1) {
            upl_onStatusChange(UploadJobPtr, status);
        }
    }

    function upl_onProgressChangeJS(UploadJobPtr, currentSize, totalSize)
    {
        if (UPLHandlerEnabled == 1) {
            upl_onProgressChange(UploadJobPtr, currentSize, totalSize);
        }
    }

    function RegisterUPLHandlers()
    {
        UPLHandlerEnabled     = 1;
        g_oUpl.onStatusChange   = upl_onStatusChangeJS;
        g_oUpl.onProgressChange = upl_onProgressChangeJS;
    }

    function UnregisterUPLHandlers()
    {
        UPLHandlerEnabled = 0;
    }


    function cab_onCompleteJS(CabPtr, hresult)
    {
        if (CabHandlerEnabled == 1) {
            cab_onComplete(CabPtr, hresult)
        }
    }

    function RegisterCabHandler()
    {
        CabHandlerEnabled = 1;
        g_oCab.onComplete = cab_onCompleteJS;
    }

    function UnregisterCabHandler()
    {
        CabHandlerEnabled = 0;
    }

    function UnloadHandler()
    {
       CancelUpload();
    }

    function UnloadHandlerMsg()
    {

        var L_CancelUpload1_Message = "Currently collecing and uploading bug report information.\n";
        var L_CancelUpload2_Message = "Navigating away will cancel the current collection/upload.";
        if ( BRP_Working() ) {
           return ( L_CancelUpload1_Message + L_CancelUpload2_Message) ;
        }
        else
           return ;
    }

</script>

<!--

  New stuff in bug reporting page

-->

<STYLE TYPE="text/css">
.styleExpandable
{
    COLOR: blue;
    CURSOR: hand ;
    FONT: bold 10pt Trebuchet MS, Tahoma, arial
}
.styleExpanded
{
    COLOR:black;
    FONT: bold 8pt Trebuchet MS, Tahoma, arial
}
.styleCollapsed
{
    DISPLAY: none
}
</STYLE>

<SCRIPT LANGUAGE="JavaScript">

    //
    // Generic display code for collapsing outlines
    //
    function outliner() {
       // Get Child element.
       var child =
          document.all[event.srcElement.getAttribute("child",
             false)];
       // If the child element exists, expand or collapse it.
       if (null != child)
          child.className = child.className == "styleCollapsed" ?
             "styleExpanded" : "styleCollapsed";
    }

    //
    // Add an element to the list box with origin being the
    // starting select element in the DOM
    //
    function addListElement(origin,text,value)
    {

        var el = document.createElement("OPTION");
        el.text  = text
        el.value = value
        origin.options.add(el);

    }

    //
    // Delete an element from a single select list and if no
    // element found then show the error message, if multiple
    // items are selected the code exists after the first instance
    //
    function delListElement(origin,errmsg)
    {

        var iRemove = 0 ;
        var iFound  = false ;

        if ( origin.length == 0 ) {
            return ;
        }

        for ( var iLoop = 0 ; iLoop < origin.length ; iLoop++ ) {
            if ( origin[iLoop].selected ) {
                iRemove = iLoop ;
                iFound  = true ;
                break ;
            }
        }

        if ( iFound ) {
            origin.remove(iRemove);
        }
        else {
            BRP_MessageBox(errmsg);
        }
    }

    //
    // Generic display code for expanding text area sizes
    //
    function increaseRows() {
       // Get Child element.
       var expand_child =
          document.all[event.srcElement.getAttribute("expand_child",
             false)];
       // If the expand_child element exists, expand or collapse it.
       if (null != expand_child) {
          expand_child.rows = Math.min(expand_child.rows_max,
                                       (expand_child.rows + 3 ));
       }

    }

    //
    // Generic display code for expanding text area sizes
    //
    function decreaseRows() {
       // Get Child element.
       var expand_child =
          document.all[event.srcElement.getAttribute("expand_child",
             false)];
       // If the expand_child element exists, expand or collapse it.
       if (null != expand_child) {
          expand_child.rows = Math.max(expand_child.rows_min,
                                       (expand_child.rows - 3 ));
       }

    }

    //
    // strip leading spaces
    //
    function removeLeadingSpace(str)
    {

        var text = str.replace(/^\s*/,"");
        return text;

    }


    //
    // strip leading spaces
    //
    function removeTrailingSpace(str)
    {

        var text = str.replace(/\s*$/,"");
        return text;
    }


    //
    // change quotations to single quotes (LocStudio has problems with this)
    //
    function replaceQuotes(str)
    {

        var text = str.replace(/\"/gi,"'");   // "
        return text;
    }

    //
    // return valid filename
    //
    function validateFilename(str,rep)
    {

       var st1 = str.replace(/:|>|<|\||\?|\*|\\|\/|\"/g,rep);         // : < > | ? * \ / "

       return st1;
    }

</SCRIPT>

</HEAD>

<!--

  Body of the document for bug reporting page

-->
<BODY aLink="#000080"  bgColor="#ffffff" leftMargin=0 link="#000080" topMargin=0 vLink="#000080"
      MARGINHEIGHT="0" MARGINWIDTH="0"
      LANGUAGE="JavaScript" OnClick="outliner();" OnUnload="UnloadHandler();" OnBeforeUnload="return UnloadHandlerMsg();" >

<!--

  Bug reporting span of the page

-->
<DIV id="spanEnterBug">

<FORM action=probrep.asp method=post id=form1 name=form1>

<TABLE border=0 borderColor=#ff0000 cellPadding=0 cellSpacing=0 width=600>
  <TBODY>

  <TR>
    <TD id="Millennium_Logo_Cell" align=left valign=center>
      <IMG id="IMG_Millennium_Logo" src="banner_sm64.jpg" alt="Millennium logo">
    </TD>
  </TR>

  <TR>
    <TD id="Heading_Data_Cell" align=left vAlign=top>

      <TABLE id="BugReportingHeadingTable" border=0>
        <TBODY>
          <TR>
           <TD>

             <P id="Page_Heading_Paragraph1" align="left">
               <DIV id="Page_Heading_Text" class="PageHeading">
                 Report a bug to the Windows Millennium Beta team.
               </DIV>
               <BR>
               <DIV id="Welcome_Instructions_Text" class="Instructions">
                 Welcome to the Millennium Bug Report page. Submitting good bug reports is
                 a vital part of testing Windows Millennium. Good bug reports are clear,
                 concise, and descriptive. Be sure to read the Beta Guide for full
                 instructions on how to create a bug report.
                 <br><br>
               </DIV>
               <DIV id="Welcome_BRP_Updates">
                 To download updates for the bug reporting application visit
                 <a href="http://winbeta.microsoft.com/bugrep">winbeta.microsoft.com/bugrep</a>.
                 <br>
                 <br>
               </DIV>
             </P>
             <P id="Page_Heading_Paragraph2" align="left">
               <div id="Welcome_ThankYou_Text" class="Instructions">
                 Thanks for your feedback!
               </div>
             </P>
             <p>
               <div id="Welcome_Closing_Text" class="Instructions">
                 &nbsp;- The Windows Millennium Beta Team
               </div>
             </p><p id="BetaID_Paragraph" valign=center align=right>

            </TD>
          </TR>
        </TBODY>
      </TABLE>

      <TABLE id="BugReportingInputFieldsTable" border=0>
        <TBODY>

<!--

  Section I

-->
        <TR>
          <TD id="Space_Cell" align=left valign=center>
            <IMG id="SpaceImage" src="space.gif" alt="Space" border=0 width=150>
          </TD>
          <TD>&nbsp;</TD>
       </TR>

        <TR>
          <TD colSpan=2>
          <HR>
          <TABLE border=0>
              <TBODY>
                <TR>
                    <TD><IMG id="IMG_Star_Bullet1" alt="Star graphic" border=0 src="star.gif"></TD>
                    <TD id="Section1_Heading" class="StepHeading">Section I: Contact Information</TD>
                </TR>
              </TBODY>
          </TABLE>
          <BR>
        </TR>

        <TR>
          <td id="BetaID_Cell" valign=center align=right>
            <div id="BetaID_Label" class="ItemHeadingSmall">Beta ID :</div>
          </td>
          <TD>
            <INPUT maxLength=250 name=BetaID id=BetaID_Input size=40 class="PlainTextSmall"
             LANGUAGE="JavaScript" ONKEYPRESS="if ((event.keyCode < 48 || event.keyCode > 57)) event.returnValue=false;"
             ONBLUR="CorrectBetaID()" >
          </TD>
        </TR>

<!--

  Section II

-->
        <TR>
          <TD colSpan=2 >
          <HR>
          <TABLE border=0>
              <TBODY>
                <TR>
                    <TD><IMG id="IMG_Star_Bullet2" alt="Star graphic" border=0 src="star.gif"></TD>
                    <TD id="Section2_Heading" class="StepHeading">Section II: Issue Information</TD>
                </TR>
              </TBODY>
          </TABLE>
          <BR>
        </TR>

        <TR>
          <TD id="Title_Paragraph" align=right ><div id="Title_Label" class="ItemHeadingSmall">Problem Title:</div></TD>
          <TD><INPUT maxLength=255 name=Title id=Title_Input size=60 class="PlainTextSmall" ONBLUR="CreateNameCAB()"></TD>
        </TR>

        <TR>
          <TD id="Title_Example_Spacer" align=right ></TD>
          <TD  bgcolor="#ffffd0"><div id="Title_Example" class="PlainTextSmall"><ID id="fooExample1"><B>Example:</B></ID>
            <ID id="fooExampleString1">"Script error instead of printer properties"</ID></div>
          </TD>
        </TR>

        <TR>
          <TD id="Severity_Cell" align=right ><div id="Severity_Label" class="ItemHeadingSmall">Problem Type:</div></TD>
          <TD><SELECT name=Severity class="PlainTextSmall" ONCHANGE="BRP_OnProblemTypeChange()">
              <OPTION id="Severity_SelectOne" selected value=N>=== Select One ===</OPTION>
              <OPTION id="Severity_CrashHang" value=1>Crash or Hang</OPTION>
              <OPTION id="Severity_FuncImpaired" value=2>Functionality Impaired</OPTION>
              <OPTION id="Severity_Cosmetic" value=3>Minor / Cosmetic</OPTION>
              <OPTION id="Severity_Trivial" value=4>Trivial</OPTION>
              </SELECT>
           </TD>
        </TR>

        <TR>
          <TD id="Area_Cell" align=right ><div id="Area_Label" class="ItemHeadingSmall">Area:</div></TD>
          <TD>
              <SELECT name=Area type="ListBox" class="PlainTextSmall" ONCHANGE="BRP_OnAreaChange()">
              <OPTION id="Area_SelectOne" selected value=NA>=== Select One ===</OPTION>
              <option id="Area_Applets" value="APPLETS">Applets/Disk Tools</option>
              <option id="Area_AppCompat" value="App Compat">Application Compatibility</option>
              <option id="Area_BPC" value="BPC">Broadcast Architecture</option>
              <option id="Area_Comm" value="Comm">Communications/ISDN/Fax/Infrared</option>
              <option id="Area_Display" value="Display">Display/Multi-Monitor</option>
              <option id="Area_PNP" value="PNP">Hardware/Drivers/Plug &amp; Play/USB/Device Bay</option>
              <option id="Area_InternetApps" value="Internet Apps">Internet Explorer/Netmeeting/Internet Connection</option>
              <option id="Area_InternetSharing" value="Internet Sharing">Internet Connection Sharing</option>
              <option id="Area_Messagine" value="Messaging">Messaging/Outlook Express/Mail/Exchange</option>
              <option id="Area_Multimedia" value="Multimedia">Multimedia/DirectX/DVD/Still Image</option>
              <option id="Area_NetClient" value="Net Client">Networking</option>
              <option id="Area_PowerManagement" value="Power Management">Power Management/ACPI</option>
              <option id="Area_Printing" value="Printing">Printing</option>
              <option id="Area_Setup" value="Setup">Setup</option>
              <option id="Area_Shell" value="Shell">Shell</option>
              <option id="Area_PSSTools" value="PSS Tools">Support Tools/Registry</option>
              <option id="Area_PCHealth" value="PC Health">System Restore/System File Protection</option>
              <option id="Area_PCHealth2" value="PC Health">Bug Reporting Tools</option>
              <option id="Area_Other" value="Other">Other</option>
              </SELECT>
          </TD>
        </TR>

        <TR>
          <TD id="Reproducibility_Cell" align=right >
            <div id="Reproducibility_Label" class="ItemHeadingSmall">This Problem: </div>
          </TD>
          <TD><SELECT name=Reproducibility type="ListBox" class="PlainTextSmall">
              <OPTION id="Reproducibility_Always" selected value=Always>Always Happens</OPTION>
              <OPTION id="Reproducibility_Sometimes" value=Sometimes>Sometimes Happens</OPTION>
              <OPTION id="Reproducibility_Once" value=Once>Happened Once</OPTION></SELECT>
          </TD>
        </TR>

        <TR>
          <TD id="Description_Cell" align=right valign=top >
            <div id="Description_Label" class="ItemHeadingSmall">Describe the problem:</div>
          </TD>
          <TD valign=top>
            <TABLE><TBODY>
            <TR>
            <TD valign=top>
            <TEXTAREA cols=60 id="Description_TextArea" name=Description rows=6
             class="PlainTextSmall" wrap=virtual onblur="ValidateTextLength(2000)" rows_min=6 rows_max=500></TEXTAREA>
            </TD>
            <TD valign=top>
            <TABLE><TBODY>
              <TR>
                <TD>
                  <IMG id="Description_ContractButton" alt="Size down" border=0 OnClick="decreaseRows()"
                    expand_child="Description_TextArea"  src="size_down.gif">
                </TD>
             </TR>
             <TR>
                <TD>
                  <IMG id="Description_ExpandButton" alt="Size up" border=0 OnClick="increaseRows()"
                    expand_child="Description_TextArea" src="size_up.gif">
                </TD>
             </TR>
             </TBODY></TABLE>
             </TD>
            </TD>
            </TBODY></TABLE>
          </TD>
        </TR>

        <TR>
          <TD id="Filler_Cell1" >&nbsp;</TD>
          <TD bgColor=#ffffd0 ><div id="Description_Example" class="PlainTextSmall"><ID id="fooExample2"><B>Example:</B></ID>
            <ID id="fooExampleString2">"I tried to right-click a printer in the Printers folder and got a script error."</ID>
            </div>
          </TD>
        </TR>

        <tr>
          <TD id="ExpectedBehavior_Cell" align=right valign=top >
            <div id="ExpectedBehavior_Label" class="ItemHeadingSmall">What did you expect to
            happen:</div>
          </TD>
          <TD valign=top>
            <TABLE><TBODY>
            <TR>
            <TD valign=top>
            <TEXTAREA cols=60 id="ExpectedBehavior_TextArea" name=ExpectedBehavior rows=6
            class="PlainTextSmall" wrap=virtual onblur="ValidateTextLength(2000)" rows_min=6 rows_max=500></TEXTAREA>
            </TD>
            <TD valign=top>
            <TABLE><TBODY>
              <TR>
                <TD>
                  <IMG id="ExpectedBehavior_ContractButton" alt="Size down" border=0 OnClick="decreaseRows()"
                    expand_child="ExpectedBehavior_TextArea"  src="size_down.gif">
                </TD>
             </TR>
             <TR>
                <TD>
                  <IMG id="ExpectedBehavior_ExpandButton" alt="Size up" border=0 OnClick="increaseRows()"
                    expand_child="ExpectedBehavior_TextArea" src="size_up.gif">
                </TD>
             </TR>
             </TBODY></TABLE>
             </TD>
            </TD>
            </TBODY></TABLE>
          </TD>
        </TR>

        <tr>
          <TD id="Filler_Cell2" >&nbsp;</TD>
          <TD bgColor=#ffffd0 ><div id="ExpectedBehavior_Example" class="PlainTextSmall"><ID id="fooExample3"><B>Example:</B></ID>
            <ID id="fooExampleString3">"The context menu should have been displayed."</ID></div>
          </TD>
        </tr>

        <TR>
          <TD id="StepsToRepro_Cell" align=right valign=top >
            <div id="StepsToRepro_Label" class="ItemHeadingSmall">Enter the steps required to reproduce the problem: </div>
          </TD>
          <TD valign=top>
            <TABLE><TBODY>
            <TR>
            <TD valign=top>
            <TEXTAREA id="StepsToRepro_TextArea" cols=60 name=StepsToRepro rows=6
             class="PlainTextSmall" wrap=virtual onblur="ValidateTextLength(2000)" rows_min=6 rows_max=500></TEXTAREA>
            </TD>
            <TD valign=top>
            <TABLE><TBODY>
              <TR>
                <TD>
                  <IMG id="StepsToRepro_ContractButton" alt="Size down" border=0 OnClick="decreaseRows()"
                    expand_child="StepsToRepro_TextArea"  src="size_down.gif">
                </TD>
             </TR>
             <TR>
                <TD>
                  <IMG id="StepsToRepro_ExpandButton" alt="Size up" border=0 OnClick="increaseRows()"
                    expand_child="StepsToRepro_TextArea" src="size_up.gif">
                </TD>
             </TR>
             </TBODY></TABLE>
             </TD>
            </TD>
            </TBODY></TABLE>
          </TD>
        </TR>

        <TR>
          <TD id="Filler_Cell3" >&nbsp;</TD>
          <TD bgColor=#ffffd0 ><div id="StepsToRepro_Example" class="PlainTextSmall"><ID id="fooExample4"><B>Example:</B></ID>
            <ID id="fooExampleString4">"1: From Start menu, choose Settings 2: Choose Printers folder, 3: Right-click on a printer"</ID>
            </div>
          </TD>
        </TR>
<!--

  Section III

-->
        <TR>
          <TD colSpan=2 >
          <HR>
          <TABLE border=0>
              <TBODY>
                <TR>
                    <TD><IMG id="IMG_Star_Bullet3" alt="Star graphic" border=0 src="star.gif"></TD>
                    <TD id="Section3_Heading" class="StepHeading">Section III: System Information</TD>
                </TR>
              </TBODY>
          </TABLE>

          <BR>
          <TABLE border=0>
              <TBODY>
                <TR>
                    <TD id="OS_NameText" class="PlainTextSmall" >OS Name</TD>
                    <TD id="OS_Name" class="PlainTextSmall" >&nbsp;</TD>
                </TR>
                <TR>
                    <TD id="OS_VersionText" class="PlainTextSmall" >OS Version</TD>
                    <TD id="OS_Version" class="PlainTextSmall" >&nbsp;</TD>
                </TR>
                <TR>
                    <TD id="OS_LanguageText" class="PlainTextSmall" >OS Language Code</TD>
                    <TD id="OS_Language" class="PlainTextSmall" >&nbsp;</TD>
                </TR>
              </TBODY>
          </TABLE>

          <BR>
          <div id="CollectOk_Text" class="Instructions">
            When you click <b>Submit</b>, detailed information about your system will be collected
            to help us reproduce your problem.
          </div>
          <br>
          <!--

          Data for list of files shown as an expandable link

          -->
          <div id="CollectedFiles_ExpandLink" class="styleExpandable" child="CollectedFiles_List">List of files collected</div>
          <div id="CollectedFiles_List" class="styleCollapsed" STYLE="margin-left:30pt" >
          asd.log<br>
          bootlog.prv<br>
          bootlog.txt<br>
          detlog.txt<br>
          netlog.txt<br>
          setuplog.old<br>
          setuplog.txt<br>
          %windir%\classes.dat<br>
          %windir%\ios.log<br>
          %windir%\ppplog.txt<br>
          %windir%\resume.txt<br>
          %windir%\susfail.txt<br>
          %windir%\system.dat<br>
          %windir%\system.ini<br>
          %windir%\user.dat<br>
          %windir%\win.ini<br>
          %windir%\wulog.txt<br>
          %windir%\emi\errlog.dat<br>
          %windir%\PCHealth\HelpCtr\Config\DataSpec.XML<br>
          %windir%\system\sfp\sfplog.txt<br>
          bug_upload_collect.XML<br>
          bug_upload_collect_2408.XML<br>
          bug_upload_nocollect.XML<br>
          %temp%\hcupdate.log<br>
          WMI Logs<br>
          </div>
          <br>
          <div id="CollectOk_Input" class="Instructions">
            <TABLE><TBODY>
            <TR>
              <TD valign=top><input type=checkbox id=CollectOk name=CollectOk checked></TD>
              <TD><LABEL STYLE="CURSOR : Hand" id="CollectOk_Label" FOR="CollectOk">Share this information with Microsoft.</LABEL>
                  <DIV id="MS_Privacy">
                  (See Microsoft's <a href="http://www.microsoft.com/info/privacy.htm">privacy policy</a>.)
                  </DIV>
              </TD>
             </TR>
             </TBODY></TABLE>
          </div>
          <br>
          <div id="NoCollect_FileList">
          If the above box is unchecked system information is not collected but a few files are uploaded with
          the bug incident.
          </div>
          <br>
          <div id="NoCollectedFiles_ExpandLink" class="styleExpandable" child="NoCollectedFiles_List">
             List of files collected if system information is not collected
          </div>
          <div id="NoCollectedFiles_List" class="styleCollapsed" STYLE="margin-left:30pt">
          asd.log<br>
          bootlog.prv<br>
          bootlog.txt<br>
          detlog.txt<br>
          netlog.txt<br>
          setuplog.old<br>
          setuplog.txt<br>
          %windir%\classes.dat<br>
          %windir%\ios.log<br>
          %windir%\ppplog.txt<br>
          %windir%\resume.txt<br>
          %windir%\susfail.txt<br>
          %windir%\system.dat<br>
          %windir%\system.ini<br>
          %windir%\user.dat<br>
          %windir%\win.ini<br>
          %windir%\wulog.txt<br>
          %windir%\emi\errlog.dat<br>
          %windir%\PCHealth\HelpCtr\Config\DataSpec.XML<br>
          %windir%\system\sfp\sfplog.txt<br>
          bug_upload_collect.XML<br>
          bug_upload_collect_2408.XML<br>
          bug_upload_nocollect.XML<br>
          %temp%\hcupdate.log<br>
          WMI Logs<br>
          </div>
          <br>
          <TABLE id="ExtraFiles_Cell" border=0 cellpadding=10 width="600px" align=center><TBODY><TR><TD bgcolor="#d0d0d0">
<!--

  DrWatson section

-->
          <div id="DrWatsonInfo" class="Instructions" STYLE="display:none;margin-left:15px">
          <div id="dwTitle"><b><id id="dwfoo">DrWatson Information</id></b></div>
          <br>
          <div id="DrWatsonInfoP1" class="Instructions" STYLE="margin-left:30px">
              Crash data is collected via the Dr. Watson tool.  This tool is not loaded by default in order to improve
              boot time performance, and it must be loaded prior to a crash in order to collect useful data. In order
              to provide more data for easier resolution of bugs please add the DrWatson.exe application in the Windows
              directory to your startup menu.
          </div>
          <br>
          </div>
<!--

  DirectX team section

-->
          <div id="DirectXInfo" class="Instructions" STYLE="display:none;margin-left:15px">
          <div id="dxTitle"><b><id id="dxfoo">DirectX Diagnostics</id></b></div>
          <br>
          <div id="DirectXInfoP1" class="Instructions" STYLE="margin-left:30px">
              In order to help identify and resolve the problem we need to collect some additional information using
              the DirectX Diagnostics tool.
          </div>
          <br>
          <div id="DirectXInfoP2" class="Instructions" STYLE="margin-left:30px">
              To execute this tool please choose "Run" from the start menu and type "DXDiag".  Once the DirectX Diagnostic
              Tool is running, choose "Save All Information".  Save the file to a filename <b>dxdiag.log</b> in a location that
              you can find.
          </div>
          <br>
          <div id="DirectXInfoP3" class="Instructions" STYLE="margin-left:30px">
              Then in the <b>Additional files to collect</b> area of the bug report, please browse to that directory and
              select this file to add.  This file will now be uploaded along with the bug report.
          </div>
          <br>
          <div id="DirectXInfoP4" class="Instructions" STYLE="margin-left:30px">
              Thanks - The DirectX Team
          </div>
          <br>
          </div>
          </div>
<!--

  System Restore team section

-->
          <div id="SystemRestoreInfo" class="Instructions" STYLE="display:none;margin-left:15px">
          <div id="srTitle"><b><id id="srfoo">System Restore Diagnostics</id></b></div>
          <br>
          <div id="srInfoP1" class="Instructions" STYLE="margin-left:30px">
              In order to get more information to help identify and resolve the problem please go to the %windir%/system/restore
              directory (%windir% is your windows directory) and execute the Cabbit tool with the following syntax:
          </div>
          <pre id="cabbitCommand" STYLE="margin-left:30px">cabbit  srdata.cab</pre>
          <div id="srInfoP2" class="Instructions" STYLE="margin-left:30px">
              cabbit.exe will generate a cabfile containing system restore log files and name it srdata.cab
          </div>
          <br>
          <div id="srInfoP3" class="Instructions" STYLE="margin-left:30px">
              Then in the <b>Additional files to collect</b> area of the bug report, please browse to the %windir%/system/restore
              directory and select this file to add.  This file will now be uploaded along with the bug report.
          </div>
          <br>
          <div id="srInfoP4" class="Instructions" STYLE="margin-left:30px">
              Thanks - The PC Health Team
          </div>
          </div>

          </TD></TR></TBODY></TABLE>
          <br>
          <div id="AdditionalFilesInfo" class="Instructions">
          Additional files to be submitted with the bug report can be selected using the <B>Browse</B> button and added
          to the list of files submitted using the <B>Add File</B> button.
          </div>
          <br>
          </TD>
        </TR>
<!--

  Additional files to collect

-->
        <TR>
          <TD id="AdditionalFiles_Cell3" valign=top align=right >
            <div id="AdditionalFiles_Text" class="ItemHeadingSmall">Additional files to collect:</div>
          </TD>
          <TD>
            <INPUT STYLE="width:300pt" TYPE=file name="AdditionalFile" id="AdditionalFile" class="PlainTextSmall" size=50>
            <br>
            <SELECT STYLE="width:300pt" id="AdditionalFiles_List" class="PlainTextSmall" SIZE=5>
            </SELECT>
            <br>
            <BUTTON name=AddFile id=AddFile onclick="BRP_ListAddFileForUpload()" accesskey="A"><U>A</U>dd File</BUTTON>
            <BUTTON name=RemoveFile id=RemoveFile onclick="BRP_ListRemoveFileForUpload()" accesskey="R"><U>R</U>emove File</BUTTON><br>
          </TD>
        </TR>
      </TBODY>
    </TABLE>

<!--

  Section IV

-->
      <TABLE id="BugReportingSubmittingTable" border=0>
        <TBODY>

        <TR>
          <TD colSpan=2 >
            <HR><BR>
            <TABLE border=0>
                <TBODY>
                  <TR>
                      <TD><IMG id="IMG_Star_Bullet5" alt="Star graphic" border=0 src="star.gif"></TD>
                      <TD id="Section5_Heading" class="StepHeading">Section IV: Submitting Bug Report</TD>
                  </TR>
                </TBODY>
            </TABLE>
            <BR>
            <div id="SubmitInstructions_Text" class="Instructions">
              When you click <b>Submit</b> and <B>Submit to Microsoft now</B> is checked, the bug information will be
              uploaded to Microsoft's servers. To cancel the bug report click <b>Cancel</b> anytime during the submission
              process. To keep a local copy of the files on your disk select the
              option to <B>Save copy to disk</B> and specify a filename.<br>
              <br>
              Please make sure you are connected to the internet before submitting
              a bug report to Microsoft.<br>
              <br>
            </div>
            <TABLE border=0>
                <TBODY>
                  <TR>
                      <TD><IMG id="IMG_Star_Bullet4" alt="Star graphic" border=0 src="star.gif"></TD>
                      <TD id="Section4_Heading" class="ItemHeadingSmall">Current Status:</TD>
                  </TR>
                  <TR>
                      <TD>&nbsp</TD>
                      <TD>
                        <DIV name="Status" id=Status class="ItemHeadingSmall">&nbsp;</DIV>
                      </TD>
                  </TR>
                </TBODY>
            </TABLE>

            <TABLE WIDTH="100%" BORDER=0>
              <TBODY>
                <TR>
                  <TD WIDTH="20%" name="Progress" id=Progress class="ItemHeadingSmall">
                    &nbsp;
                  </TD>
                  <TD name="ProgressText" id=ProgressText class="ItemHeadingSmall">
                    &nbsp;
                  </TD>
                </TR>
              </TBODY>
            </TABLE>
            <TABLE border=0 cellpadding=10>
              <TBODY>
                <TR>
                  <TD id="SubmitButton_Cell" valign=top>
                    <BUTTON name=Submit id=Submit class="stlButtonBig" onclick="StartProcessing()" accesskey="S"><U>S</U>ubmit</BUTTON>
                    <BUTTON name=Cancel id=Cancel class="stlButtonBig" onclick="CancelUpload()" accesskey="C" disabled><U>C</U>ancel</BUTTON>
                  </TD>
                  <TD valign=top>
                    <input type=checkbox id=SubmitIncidentNow name=SubmitIncidentNow checked>
                    <LABEL STYLE="CURSOR : Hand" id="SubmitNow_Label" FOR="SubmitIncidentNow">Submit to Microsoft now</LABEL>
                    <BR>
                    <input type=checkbox id=SaveIncidentNow name=SaveIncidentNow>
                    <LABEL STYLE="CURSOR : Hand" id="SaveNow_Label" FOR="SaveIncidentNow">Save copy to disk</LABEL>
                    <BR><BR>
                    <TABLE id="SaveToDiskTable"><TBODY>
                     <TR>
                       <TD id="FileNameLocal_Cell" valign=top align=right>
                         <DIV id="Section5_SaveInfoText" class="ItemHeadingSmall">
                           Filename :
                         </DIV>
                       </TD>
                       <TD id="FileNameLocalName_Cell" valign=top>
                        <DIV id="Section5_SaveInfoFile" class="ItemHeadingSmall">
                        <INPUT type=text size=50 name=IncidentFilename id=IncidentFilename class="PlainTextSmall"
                          ONBLUR="CorrectNameCAB()">
                        </DIV>
                       </TD>
                     </TR>
                    </TBODY></TABLE>
                  </TD>
                </TR>
              </TBODY>
            </TABLE>
          </TD>
        </TR>

      </TBODY>
    </TABLE>

    </TR>
   </TBODY>
</TABLE>
</FORM>
</DIV>

<!--

  The thank you part of the bug reporting page after a bug has been reported

-->

<DIV id="spanThankYou" STYLE="DISPLAY: none">
<TABLE border=0 borderColor=#ff0000 cellPadding=0 cellSpacing=0 width="600">

  <TBODY>

  <TR>
    <TD id="ThankYou_Millennium_Logo_Cell" align=left valign=center>
      <IMG id="ThankYou_IMG_Millennium_Logo" src="banner_sm64.jpg" alt="Millennium logo">
    </TD>
  </TR>

  <TR>
    <TD>
      <BR>
      <p id="ThankYou_Paragraph" class="PlainText">
       Thank you for submitting a bug report. For future reference to this bug please
       store the tracking number listed below.</p>
      <BR>
      <TABLE border=0>
          <TBODY>
            <TR>
                <TD id="BRP_IncidentTimeText" class="PlainTextSmall" >Submit Time</TD>
                <TD id="BRP_IncidentTime" class="PlainTextSmall" >&nbsp;</TD>
            </TR>
            <TR>
                <TD id="BRP_TrackingNoText" class="PlainTextSmall" >Tracking Number</TD>
                <TD id="BRP_TrackingNo" class="PlainTextSmall" >&nbsp;</TD>
            </TR>
          </TBODY>
      </TABLE>
      <BR>
<!--
      <p id="Helpcenter_Return_Link"><a href="hcp://system/Mars_Contents.htm">
        Return to the main helpcenter page</a></p>
-->
    </TD>
  </TR>
  </TBODY>
</TABLE>
</DIV>

<!--

  Footer

-->

<BR><BR>

<TABLE>
  <TBODY>
    <TR>
      <TD>
        <div id="BRP_VersionText" class="PlainTextSmall">
        </div>
      </TD>
    </TR>
    <TR>
      <TD>
        <BR>
        <div id="Copyright_Notice" class="PlainTextSmall">&copy;
        <a href="http://www.microsoft.com/misc/cpyright.htm">
        1999 Microsoft Corporation. All rights reserved. Terms of use.
        </a>
        </div>
      </TD>
    </TR>
   </TBODY>
</TABLE>

<BR><BR><BR>

<!--

  End of document

-->

</BODY>
</HTML>