windows-nt/Source/XPSP1/NT/base/ntsetup/oobe/html/dskshell.htx

1752 lines
45 KiB
Plaintext
Raw Normal View History

2020-09-26 03:20:57 -05:00
<HTML>
<HEAD>
<TITLE>Microsoft Out-of-Box Experience</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language=jscript src="oobeutil.js"></script>
<script language=jscript>
// This is intended to hold all the script needed
// in the default & offline OOBE HTML pages.
//
// We want to separate the layout (HTML) from the script.
// At the same time, it's helpful to have all the code
// in one place to make it easier to understand the flow
// from page to page.
// Status location constants
var STATUS_MSN = 0;
var STATUS_OEM = 1;
var STATUS_NONE = 2;
var STATUS_OFF = 3;
var STATUS_MAX = 4;
var SNDX_WELCOME = 0;
var SNDX_MSN_ISP = 1;
var SNDX_MSN_REG = 2;
var SNDX_MSN_FINISH = 3;
var SNDX_OEM_REG = 1;
var SNDX_OEM_ISP = 2;
var SNDX_OEM_FINISH = 3;
var SNDX_NONE_REG = 1;
var SNDX_NONE_FINISH = 2;
function CheckPoint(strURL, i1, i2, i3, i4)
{
this.strURL = strURL;
this.rgindex = new Array(STATUS_MAX);
this.rgindex[STATUS_MSN] = i1;
this.rgindex[STATUS_OEM] = i2;
this.rgindex[STATUS_NONE] = i3;
this.rgindex[STATUS_OFF] = i4;
}
// Checkpoint constants
var CKPT_START = 1;
var CKPT_TAPI = 2;
var CKPT_CONNECT = 3;
var CKPT_MODEMCANCEL = 4;
var CKPT_DIALTONE = 5;
var CKPT_NOTAVAIL = 6;
var CKPT_SRVERROR = 7;
var CKPT_TOOBUSY = 8;
var CKPT_CONNECTERROR = 9;
var CKPT_NOANSWER = 10;
var CKPT_HANDSHAKE = 11;
var CKPT_INSERROR = 12;
var CKPT_ISPTOOBUSY = 13;
var CKPT_ISPNOCONNECT = 14;
var CKPT_ISPRESET = 15;
var CKPT_MAX = 16; // ALWAYS set this to be the biggest value!
var dnCKPT = new Array(CKPT_MAX);
// Checkpoint breadcrumbs
var g_CurrentCKPT = null;
var g_DialCKPT = null;
var HKEY_LOCAL_MACHINE = 0x80000002;
var OOBE_MAIN_REG_KEY = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OOBE";
var CKPT_REG_KEY = "\\CKPT";
var TOS_REG_VALUE = "TOS";
// CheckDialReady errors
var ERR_COMM_NO_ERROR = 0;
var ERR_COMM_OOBE_COMP_MISSING = 1;
var ERR_COMM_UNKNOWN = 2; // Unknow error, check input parameters
var ERR_COMM_NOMODEM = 3; // There is no modem installed
var ERR_COMM_RAS_TCP_NOTINSTALL = 4;
// Dialing errors. Look at raserror.h for details
var DERR_DIALTONE = 680;
var DERR_BUSY = 676;
var DERR_VOICEANSWER = 677;
var DERR_NOANSWER = 678;
var DERR_NO_CARRIER = 679;
var DERR_HARDWARE_FAILURE = 630; // modem turned off
var DERR_PORT_ALREADY_OPEN = 602; // procomm/hypertrm/RAS has COM port
var DERR_PORT_OR_DEVICE = 692; // got this when hypertrm had the device open -- jmazner
var DERR_PPP_TIMEOUT = 718;
// Finish errors
var FINISH_OK = 0x00000000;
var FINISH_REBOOT = 0x00000001;
// Language reboot return codes
var LANGUAGE_REBOOT_NEVER = 0;
var LANGUAGE_REBOOT_NOW = 1;
var LANGUAGE_REBOOT_END = 2;
// on-the-fly button hiding
var HIDE_BACK = 0x0001;
var HIDE_NEXT = 0x0002;
var HIDE_CANCEL = 0x0004;
var HIDE_RESTORE = 0x0008;
// BUGBUG temp GUIDs
var NOLAUNCHISPSIGNUP = "{C37D92A5-CA34-11d2-B71C-00C04F794977}";
var MSNCOMPLETED = "{1C0A22F2-CB6B-11d2-B544-00A0C949DA70}";
// window.external object caches
var TapiObj = null;
var InfoObj = null;
var StatusObj = null;
var DirObj = null;
var ApiObj = null;
// general globals and status
var g_strISPFile = "";
var g_bStartup;
var g_LastButtonText = null;
var g_FirstFocusElement = null;
var g = null;
var g_SpecialChars = ".'-` ";
var g_OOBEDir = "file://" + window.external.API.get_SystemDirectory() + "\\oobe\\";
var g_bRedial = false;
var g_LineProblem = 0;
var g_bFirstServerError = true;
var g_status = STATUS_OFF;
var g_ServerErrorCount = 0;
var g_DialingAvailableInCountry = true;
var g_ModalDialogUp = false;
// preload image caches
var g_ImgClick = new Image();
var g_ImgDisabled = new Image();
var g_ImgHover = new Image();
var g_ImgDefault = new Image();
var g_ImgLeftClickSingle = new Image();
var g_ImgLeftDefaultSingle = new Image();
var g_ImgLeftDisabledSingle = new Image();
var g_ImgLeftHoverSingle = new Image();
var g_ImgRightClickSingle = new Image();
var g_ImgRightDefaultSingle = new Image();
var g_ImgRightDisabledSingle = new Image();
var g_ImgRightHoverSingle = new Image();
var g_ImgLeftClick = new Image();
var g_ImgLeftDefault = new Image();
var g_ImgLeftDisabled = new Image();
var g_ImgLeftHover = new Image();
var g_ImgRightClick = new Image();
var g_ImgRightDefault = new Image();
var g_ImgRightDisabled = new Image();
var g_ImgRightHover = new Image();
var g_ImgLeftClickWide = new Image();
var g_ImgLeftDefaultWide = new Image();
var g_ImgLeftDisabledWide = new Image();
var g_ImgLeftHoverWide = new Image();
var g_ImgRightClickWide = new Image();
var g_ImgRightDefaultWide = new Image();
var g_ImgRightDisabledWide = new Image();
var g_ImgRightHoverWide = new Image();
var ImgDialingAni = new Image();
var ImgNegotiatingAni = new Image();
var ImgConnectedAni = new Image();
var ImgLastConnectImage = new Image();
ImgDialingAni.src = g_OOBEDir + "images/dial_ani.gif";
ImgNegotiatingAni.src = g_OOBEDir + "images/neg_ani.gif";
ImgConnectedAni.src = g_OOBEDir + "images/con_ani.gif";
var g_ImagesAtStage = new Array(4);
var g_ImgConfetti = new Image();
var g_ImgFlagAni = new Image();
g_ImgFlagAni.src = g_OOBEDir + "images/flagani.gif"
g_ImgClick.src = g_OOBEDir + "images/click.gif";
g_ImgDisabled.src = g_OOBEDir + "images/disabled.gif";
g_ImgHover.src = g_OOBEDir + "images/hover.gif";
g_ImgDefault.src = g_OOBEDir + "images/default.gif";
g_ImgLeftClickSingle.src = g_OOBEDir + "images/clickl.gif";
g_ImgLeftDefaultSingle.src = g_OOBEDir + "images/defaultl.gif";
g_ImgLeftDisabledSingle.src = g_OOBEDir + "images/disabldl.gif";
g_ImgLeftHoverSingle.src = g_OOBEDir + "images/hoverl.gif";
g_ImgRightClickSingle.src = g_OOBEDir + "images/clickr.gif";
g_ImgRightDefaultSingle.src = g_OOBEDir + "images/defaultr.gif";
g_ImgRightDisabledSingle.src = g_OOBEDir + "images/disabldr.gif";
g_ImgRightHoverSingle.src = g_OOBEDir + "images/hoverr.gif";
g_ImgLeftClick.src = g_OOBEDir + "images/lftclk.gif";
g_ImgLeftDefault.src = g_OOBEDir + "images/lftdef.gif";
g_ImgLeftDisabled.src = g_OOBEDir + "images/lftdsld.gif";
g_ImgLeftHover.src = g_OOBEDir + "images/lfthvr.gif";
g_ImgRightClick.src = g_OOBEDir + "images/rhtclk.gif";
g_ImgRightDefault.src = g_OOBEDir + "images/rhtdef.gif";
g_ImgRightDisabled.src = g_OOBEDir + "images/rhtdsld.gif";
g_ImgRightHover.src = g_OOBEDir + "images/rhthvr.gif";
g_ImgLeftClickWide.src = g_OOBEDir + "images/lftclkw.gif";
g_ImgLeftDefaultWide.src = g_OOBEDir + "images/lftdefw.gif";
g_ImgLeftDisabledWide.src = g_OOBEDir + "images/lftdsldw.gif";
g_ImgLeftHoverWide.src = g_OOBEDir + "images/lfthvrw.gif";
g_ImgRightClickWide.src = g_OOBEDir + "images/rhtclkw.gif";
g_ImgRightDefaultWide.src = g_OOBEDir + "images/rhtdefw.gif";
g_ImgRightDisabledWide.src = g_OOBEDir + "images/rhtdsldw.gif";
g_ImgRightHoverWide.src = g_OOBEDir + "images/rhthvrw.gif";
// Mandatory Initialization Code
if (null == ApiObj)
{
ApiObj = new Object;
ApiObj = window.external.API;
}
if (null == StatusObj)
{
StatusObj = new Object;
StatusObj = window.external.Status;
}
if (null == DirObj)
{
DirObj = new Object;
DirObj = window.external.Directions;
}
if (null == InfoObj)
{
InfoObj = new Object;
InfoObj = window.external.UserInfo;
}
// END Initialization Code
//////////////////////////////////////////////////////////////////////////////////////
// tapi.htm
//////////////////////////////////////////////////////////////////////////////////////
function TapiLoadMe()
{
InitFrameRef();
ResetDialing();
g_FirstFocusElement = g.selCountry;
if (null == TapiObj)
{
TapiObj = new Object;
TapiObj = window.external.Tapi;
}
RetrieveTapi();
Tapi_CountryChange();
g_FirstFocusElement.focus();
}
function Tapi_AreaCodeChange()
{
try
{
if (g.event == null)
return;
}
catch(e)
{
return;
}
if (window.external.Tapi.IsAreaCodeRequired(g.selCountry.selectedIndex) &&
window.external.CheckPhoneBook("msobe.isp") &&
g.edtAreaCode.value.length == 0)
g.btnNext.disabled = true;
else
g.btnNext.disabled = false;
InitButtons();
}
function Tapi_CountryChange()
{
try
{
if (g.event == null)
return;
}
catch(e)
{
return;
}
TapiObj.set_CountryIndex = g.selCountry.selectedIndex;
if (window.external.CheckPhoneBook("msobe.isp"))
{
g.div_MSNNotAvailable.style.visibility = "hidden";
g.spn_AdditionalSettings.style.visibility = "visible";
g_DialingAvailableInCountry = true;
}
else
{
g.div_MSNNotAvailable.style.visibility = "visible";
g.spn_AdditionalSettings.style.visibility = "hidden";
g_DialingAvailableInCountry = false;
}
tapi_OutsideLineClicked();
Tapi_AreaCodeChange();
}
function StoreTapi()
{
TapiObj.set_CountryIndex = g.selCountry.selectedIndex;
TapiObj.set_AreaCode = g.edtAreaCode.value;
if(g.radioTouchToneYes.checked)
TapiObj.set_PhoneSystem = 1; //touch tone
else
TapiObj.set_PhoneSystem = 0; //rotary
TapiObj.set_DialOut = g.edtOutsideLine.value;
}
function RetrieveTapi()
{
var fTapi = TapiObj.IsTAPIConfigured;
g.selCountry.selectedIndex = TapiObj.get_CountryIndex;
g.edtAreaCode.value = TapiObj.get_AreaCode;
if(1 == TapiObj.get_PhoneSystem)
g.radioTouchToneYes.checked = true; //touch tone
else
g.radioTouchToneNo.checked = true; //rotary
g.edtOutsideLine.value = TapiObj.get_DialOut;
if(g.edtOutsideLine.value != "")
g.radioOutSideLineYes.checked = true; //use a number to dial out
else
g.radioOutSideLineNo.checked = true; //don't use a number to dial out
}
function tapi_OutsideLineClicked()
{
var L_OutSideLine_Text = "9"; //global variable number used to dial outside line
try
{
if (g.event == null)
return;
}
catch(e)
{
return;
}
if (g.radioOutSideLineYes.checked == true &&
g.spn_AdditionalSettings.style.visibility == "visible")
{
g.spanOutsideLine.style.visibility = "visible";
g.edtOutsideLine.style.visibility = "visible";
g.edtOutsideLine.value = TapiObj.get_DialOut;
if (g.edtOutsideLine.value.length == 0)
g.edtOutsideLine.value = L_OutSideLine_Text;
}
else
{
g.spanOutsideLine.style.visibility = "hidden";
g.edtOutsideLine.style.visibility = "hidden";
g.spanOutsideLine.style.visibility = "hidden";
g.edtOutsideLine.value = ""; //nuke out any outside line value
}
}
// END tapi.htm
//////////////////////////////////////////////////////////////////////////////////////
// connect.htm
//////////////////////////////////////////////////////////////////////////////////////
function connect_LoadMe()
{
InitFrameRef();
g_FirstFocusElement = g.btnCancelText;
if (g != null)
{
if (g.btnBack != null)
{
g.btnBack.disabled = true;
}
}
InitButtons();
setTimeout("DoDialExternal()" , 40); //BUGBUG #define this at the top, and why do we have to wait 40 milliseconds anyway?
g_FirstFocusElement.focus();
}
function ResetDialing()
{
g_bRedial = false;
g_LineProblem = 0;
g_bFirstServerError = true;
g_strISPFile = "";
window.external.Hangup();
}
function SetDialing(strISPFile)
{
g_strISPFile = strISPFile;
g_DialCKPT = g_CurrentCKPT;
g_ModalDialogUp = false;
}
function DoDialExternal()
{
SetDialing("msobe.isp");
DoDial();
}
function DoDial()
{
if (g != null)
{
if (g.spnDialing != null)
g.spnDialing.style.color = 0x990000;
if (g.imgDialing != null)
{
ImgLastConnectImage.src = g.imgDialing.src;
g.imgDialing.src = ImgDialingAni.src;
}
}
if (g_bRedial)
{
window.external.ReDial(g_strISPFile);
}
else
{
window.external.Dial(g_strISPFile);
}
}
function Redial()
{
if (g != null && g.Connect_REDIALINFO != null)
{
g.Connect_REDIALINFO.style.visibility = "visible";
}
if (g != null && g.btnBack != null)
{
g.btnBack.disabled = true;
}
DoDial();
}
<!--REQUIRED FUNCTION NAME:: DO NOT OVERLOAD OR ALTER-->
function OnDialingEx()
{
g_bRedial = true;
if (g != null && g.spnDialing != null)
g.spnDialing.innerText = window.external.get_DialNumber;
if (g != null)
{
if (g.btnBack != null)
{
g.btnBack.disabled = false;
}
InitPairedButton(g.spanBack, g.btnBack, g.btnBackText, g_ImgLeftDefault, g_ImgLeftDisabled,
g_ImgLeftDefaultSingle, g_ImgLeftDisabledSingle,
g.spanNext, "backButton", "backButtonText");
}
}
<!--REQUIRED FUNCTION NAME:: DO NOT OVERLOAD OR ALTER-->
function OnConnectingEx()
{
//alert("Connecting");
if (g != null)
{
if (g.spnDialing != null)
g.spnDialing.style.color = 0x999999;
if (g.imgDialing != null)
g.imgDialing.src = "../images/dial_off.gif";
if (g.imgNegotiating != null)
{
ImgLastConnectImage.src = g.imgNegotiating.src;
g.imgNegotiating.src = ImgNegotiatingAni.src;
}
}
}
<!--REQUIRED FUNCTION NAME:: DO NOT OVERLOAD OR ALTER-->
function OnDownloadingEx()
{
//alert("Downloading");
if (g != null)
{
if (g.spnDialing != null)
g.spnDialing.style.color = 0x999999;
if (g.imgNegotiating != null)
g.imgNegotiating.src = "../images/neg_off.gif";
if (g.imgConnected != null)
g.imgConnected.src = ImgConnectedAni.src;
}
}
<!--REQUIRED FUNCTION NAME:: DO NOT OVERLOAD OR ALTER-->
function OnDisconnectEx()
{
//alert("Disconnected");
}
<!--REQUIRED FUNCTION NAME:: DO NOT OVERLOAD OR ALTER-->
function OnDialingErrorEx(derr)
{
if (g_ModalDialogUp)
{
g_ModalDialogUp = false;
return;
}
window.external.Hangup();
g_LineProblem++;
if (g_CurrentCKPT == g_DialCKPT)
{
switch (derr)
{
case DERR_PORT_OR_DEVICE:
case DERR_PORT_ALREADY_OPEN:
case DERR_HARDWARE_FAILURE:
case DERR_DIALTONE:
GoNavigate(CKPT_DIALTONE);
break;
case DERR_BUSY:
if (g_LineProblem < 3)
{
window.setTimeout("Redial()", 1000);
}
else
GoNavigate(CKPT_TOOBUSY);
break;
case DERR_VOICEANSWER:
case DERR_PPP_TIMEOUT:
GoNavigate(CKPT_HANDSHAKE);
break;
case DERR_NO_CARRIER:
GoNavigate(CKPT_CONNECTERROR);
break;
case DERR_NOANSWER:
if (g_LineProblem < 3)
{
window.setTimeout("Redial()", 1000);
}
else
{
GoNavigate(CKPT_HANDSHAKE);
}
break;
default:
GoNavigate(CKPT_SRVERROR);
break;
}
}
}
<!--REQUIRED FUNCTION NAME:: DO NOT OVERLOAD OR ALTER-->
function OnServerErrorEx(derr)
{
if (g_CurrentCKPT == g_DialCKPT)
{
if (g_bFirstServerError)
{
var url = window.external.GetReconnectURL
if (url != null && url.length !=0)
ifrmMainFrame.window.navigate(url);
g_bFirstServerError = false;
}
else
{
GoNavigate(CKPT_SRVERROR);
}
}
}
// END connect.htm
//////////////////////////////////////////////////////////////////////////////////////
// General Default LoadMe function
//////////////////////////////////////////////////////////////////////////////////////
function _Default_LoadMe()
{
InitFrameRef();
if (g.btnCancelText != null)
g_FirstFocusElement = g.btnCancelText;
else if (g.btnRestoreText != null)
g_FirstFocusElement = g.btnRestoreText;
else if (g.btnBackText != null)
g_FirstFocusElement = g.btnBackText;
else if (g.btnNextText != null)
g_FirstFocusElement = g.btnNextText;
InitButtons();
if (g_FirstFocusElement != null)
g_FirstFocusElement.focus();
else
g.document.body.focus();
}
//////////////////////////////////////////////////////////////////////////////////////
// usemodem.htm
//////////////////////////////////////////////////////////////////////////////////////
function usemodem_LoadMe()
{
InitFrameRef();
ResetDialing();
g_FirstFocusElement = g.UseModem_Yes;
InitButtons();
g_FirstFocusElement.focus();
}
//////////////////////////////////////////////////////////////////////////////////////
// hndshake.htm
//////////////////////////////////////////////////////////////////////////////////////
function hndshake_OnKeyPress()
{
try
{
if (g.event == null)
return;
}
catch(e)
{
return;
}
// Treat the enter key like the next button
// since the user hasn't gone through the mouse tutorial yet.
if ((g.event.keyCode == 13) &&
(g.btnNext.disabled == false))
{
GoNext();
}
else
{
KeyPressIsValid();
}
}
function hndshake_CheckEdits()
{
try
{
if (g.event == null)
return;
}
catch(e)
{
return;
}
if (g.event.srcElement != g.edtMSNPhoneNumber)
{
hndshake_CheckEnableNextButton();
}
}
function hndshake_CheckEnableNextButton()
{
try
{
if (g.event == null)
return;
}
catch(e)
{
return;
}
if (g.edtMSNPhoneNumber.value.length)
{
g.btnNext.disabled = false;
}
else
{
g.btnNext.disabled = true;
}
InitButtons();
}
function hndshake_LoadMe()
{
InitFrameRef();
g_FirstFocusElement = g.edtMSNPhoneNumber;
hndshake_CheckEnableNextButton();
g_FirstFocusElement.focus();
}
//////////////////////////////////////////////////////////////////////////////////////
// MISC Functions
//////////////////////////////////////////////////////////////////////////////////////
// Page Navigation
// InitCKPT, PushCKPT, PopCKPT, CKPTFromVal are meant to handle the behavior for GoBack.
// We only go back to certain pages (i.e., Mouse Tutorial, Sound Check).
// And on some of the pages, we only go back if they haven't been
// completed (i.e., EULA, PID).
//
// So, we push checkpoints if we intend to all coming back to that page.
// We pop checkpoints if we no longer want to come back (e.g., we've
// completed that page.
function InitCKPT()
{
dnCKPT[CKPT_START] = new CheckPoint("msnsetup\\mstart.htm", SNDX_WELCOME, SNDX_WELCOME, SNDX_WELCOME, SNDX_WELCOME);
dnCKPT[CKPT_TAPI] = new CheckPoint("msnsetup\\mtapi.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
dnCKPT[CKPT_CONNECT ] = new CheckPoint("msnsetup\\mconnect.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
dnCKPT[CKPT_MODEMCANCEL] = new CheckPoint("msnsetup\\musemode.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
dnCKPT[CKPT_DIALTONE] = new CheckPoint("msnerror\\mdialton.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
dnCKPT[CKPT_NOTAVAIL] = new CheckPoint("msnerror\\mnotavai.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
dnCKPT[CKPT_SRVERROR] = new CheckPoint("msnerror\\msrverro.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
dnCKPT[CKPT_TOOBUSY] = new CheckPoint("msnerror\\mtoobusy.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
dnCKPT[CKPT_CONNECTERROR] = new CheckPoint("msnerror\\mcnncter.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
dnCKPT[CKPT_NOANSWER] = new CheckPoint("msnerror\\mnoanswe.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
dnCKPT[CKPT_HANDSHAKE] = new CheckPoint("msnerror\\mhndshak.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
dnCKPT[CKPT_INSERROR] = new CheckPoint("msnerror\\minserro.htm", SNDX_MSN_ISP, SNDX_OEM_REG, SNDX_NONE_REG, 0);
dnCKPT[CKPT_ISPTOOBUSY] = new CheckPoint("msnerror\\misp2bus.htm", 0, SNDX_OEM_ISP, 0, 0);
dnCKPT[CKPT_ISPNOCONNECT] = new CheckPoint("msnerror\\mispcnnc.htm", 0, SNDX_OEM_ISP, 0, 0);
dnCKPT[CKPT_ISPRESET] = new CheckPoint("msnerror\\misprese.htm", 0, SNDX_OEM_ISP, 0, 0);
PopCKPT();
}
function PushCKPT(ckpt)
{
if (ckpt > 0 && ckpt < CKPT_MAX)
{
var tos = 0;
try
{
tos = ApiObj.get_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE);
}
catch (e) {}
ApiObj.set_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, tos.toString(), ckpt);
ApiObj.set_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE, ++tos);
g_CurrentCKPT = ckpt;
}
}
function PopCKPT(ckptCheck)
{
var ckpt = 0;
try
{
var tos = ApiObj.get_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE);
if (tos > 0)
{
ckpt = ApiObj.get_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, (tos - 1).toString());
if (null == ckptCheck || ckpt == ckptCheck)
{
ApiObj.set_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, TOS_REG_VALUE, --tos);
ApiObj.DeleteRegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + CKPT_REG_KEY, tos.toString());
}
}
}
catch (e) {}
if (ckpt > 0 && ckpt < CKPT_MAX)
{
g_CurrentCKPT = ckpt;
}
else
g_CurrentCKPT = null;
}
function URLFromCKPT(ckpt)
{
var str = "";
if (ckpt > 0 && ckpt < CKPT_MAX)
{
str = dnCKPT[ckpt].strURL;
}
return str;
}
function IndexFromCKPT(ckpt, status)
{
var index = 0;
if (ckpt > 0 && ckpt < CKPT_MAX)
{
var checkpoint = dnCKPT[ckpt];
index = checkpoint.rgindex[status];
}
return index;
}
function SetButtonImageToClick()
{
try
{
if (g.event != null)
{
switch(g.event.srcElement.parentElement.id)
{
case "spanCancel":
if (g.spanRestore != null && true != g.spanRestore.Hide)
{
g.btnCancel.src = g_ImgLeftClickWide.src;
}
else
{
g.btnCancel.src = g_ImgClick.src;
}
break;
case "spanRestore":
if (g.spanCancel != null && true != g.spanCancel.Hide)
{
g.btnRestore.src = g_ImgRightClickWide.src;
}
else
{
g.btnRestore.src = g_ImgClick.src;
}
break;
case "spanBack":
if (g.spanNext != null && true != g.spanNext.Hide)
{
g.btnBack.src = g_ImgLeftClick.src;
}
else
{
g.btnBack.src = g_ImgLeftClickSingle.src;
}
break;
case "spanNext":
if (g.spanBack != null && true != g.spanBack.Hide)
{
g.btnNext.src = g_ImgRightClick.src;
}
else
{
g.btnNext.src = g_ImgRightClickSingle.src;
}
break;
}
}
}
catch(e)
{
return;
}
}
function IsLocalFile()
{
try
{
return (-1 != g.location.protocol.indexOf("file"));
}
catch (e)
{
return false;
}
}
//////////////////////////////////////////////////////////////////////////////////////
// public navigation APIs
//////////////////////////////////////////////////////////////////////////////////////
//Some server page is calling this function that used to set g_OEMAddBackURL.
function SetBack(strURL)
{
}
function GoCancel(ckpt)
{
try
{
if (IsLocalFile() && g.event == null)
return;
}
catch(e)
{
return;
}
SetButtonImageToClick();
switch (g_CurrentCKPT)
{
case CKPT_CONNECT:
ResetDialing();
// fall through...
case CKPT_TAPI:
GoNavigate(CKPT_MODEMCANCEL);
break;
}
}
function GoBack(ckpt)
{
var ckptPrevious = g_CurrentCKPT;
try
{
if (IsLocalFile() && g.event == null)
return;
}
catch(e)
{
return;
}
SetButtonImageToClick();
if (g_CurrentCKPT == g_DialCKPT)
ResetDialing();
PopCKPT();
if (ckptPrevious == g_CurrentCKPT)
{
// This handles the case where the current page pushed itself on the stack.
PopCKPT();
}
if (g_CurrentCKPT > 0 && g_CurrentCKPT < CKPT_MAX)
{
GoNavigate(g_CurrentCKPT);
}
}
function StatusNavigate()
{
var iMove = IndexFromCKPT(g_CurrentCKPT, g_status) - window.external.get_StatusIndex;
while (iMove > 0)
{
window.external.MoveNext();
--iMove;
}
while (iMove < 0)
{
window.external.MovePrevious();
++iMove;
}
}
////////////////////////////////////////////////////////////////////
// DON'T MUCK WITH THE POSITIONING OF THE CASES IN THE SWITCHS BELOW
////////////////////////////////////////////////////////////////////
function GoNavigate(ckptGoHere)
{
try
{
if (g_bStartup == false)
{
if (IsLocalFile())
{
if (g.event != null)
{
g.event.returnValue = false;
g.event.cancelBubble = true;
}
}
}
else
g_bStartup = false;
}
catch(e)
{
return;
}
SetButtonImageToClick();
switch (ckptGoHere)
{
case CKPT_START:
PushCKPT(CKPT_START); //BUGBUG do we want to do this?
g.navigate(g_OOBEDir + URLFromCKPT(g_CurrentCKPT));
break;
case CKPT_TAPI:
PushCKPT(CKPT_TAPI);
g.navigate(g_OOBEDir + URLFromCKPT(g_CurrentCKPT));
break;
case CKPT_CONNECT:
g_CurrentCKPT = CKPT_CONNECT;
g.navigate(g_OOBEDir + URLFromCKPT(CKPT_CONNECT));
break;
case CKPT_NOTAVAIL:
g_CurrentCKPT = CKPT_NOTAVAIL;
g.navigate(g_OOBEDir + URLFromCKPT(CKPT_NOTAVAIL));
break;
case CKPT_DIALTONE:
g_CurrentCKPT = CKPT_DIALTONE;
g.navigate(g_OOBEDir + URLFromCKPT(CKPT_DIALTONE));
break;
case CKPT_TOOBUSY:
g_CurrentCKPT = CKPT_TOOBUSY;
g.navigate(g_OOBEDir + URLFromCKPT(CKPT_TOOBUSY));
break;
case CKPT_SRVERROR:
g_CurrentCKPT = CKPT_SRVERROR;
g.navigate(g_OOBEDir + URLFromCKPT(CKPT_SRVERROR));
break;
case CKPT_MODEMCANCEL:
g_CurrentCKPT = CKPT_MODEMCANCEL;
g.navigate(g_OOBEDir + URLFromCKPT(CKPT_MODEMCANCEL));
break;
case CKPT_INSERROR:
g_CurrentCKPT = CKPT_INSERROR;
g.navigate(g_OOBEDir + URLFromCKPT(CKPT_INSERROR));
break;
case CKPT_HANDSHAKE:
g_CurrentCKPT = CKPT_HANDSHAKE;
g.navigate(g_OOBEDir + URLFromCKPT(CKPT_HANDSHAKE));
break;
case CKPT_CONNECTERROR:
g_CurrentCKPT = CKPT_CONNECTERROR;
g.navigate(g_OOBEDir + URLFromCKPT(g_CurrentCKPT));
break;
case CKPT_ISPTOOBUSY:
g_CurrentCKPT = CKPT_ISPTOOBUSY;
g.navigate(g_OOBEDir + URLFromCKPT(g_CurrentCKPT));
break;
case CKPT_ISPRESET:
g_CurrentCKPT = CKPT_ISPRESET;
g.navigate(g_OOBEDir + URLFromCKPT(g_CurrentCKPT));
break;
}
StatusNavigate();
}
function GoNext()
{
try
{
if (IsLocalFile() && g.event == null)
return;
}
catch(e)
{
return;
}
SetButtonImageToClick();
switch (g_CurrentCKPT)
{
case CKPT_HANDSHAKE:
window.external.set_DialNumber(g.edtMSNPhoneNumber.value);
case CKPT_SRVERROR:
case CKPT_ISPRESET:
case CKPT_CONNECTERROR:
case CKPT_DIALTONE:
case CKPT_TOOBUSY:
GoNavigate(g_DialCKPT);
break;
case CKPT_START:
GoNavigate(CKPT_TAPI);
break;
case CKPT_TAPI:
StoreTapi();
if ( dnCKPT[CKPT_CONNECT].strURL.toUpperCase() == "MSNSETUP\\MLAN.HTM" || window.external.CheckPhoneBook("msobe.isp") )
{
GoNavigate(CKPT_CONNECT);
}
break;
default:
// BUGBUG should we remove the default altogether?
break;
}
}
// BUGBUG temporary until MSN changes code
function GoOffline()
{
GoNext();
}
// Button Event Handlers and Initialization
function SetLastButtonText()
{
if (g.btnNext != null)
g_LastButtonText = g.btnNextText;
else if (g.btnBack != null)
g_LastButtonText = g.btnBackText;
else if (g.btnRestore != null)
g_LastButtonText = g.btnRestoreText;
else if (g.btnCancel != null)
g_LastButtonText = g.btnCancelText;
}
// Function: InitFrameRef
// Description: Sets up globals to point to buttons
// Since the buttons exist on the child frame,
// we want to have quick access to them without
// going through the collections.
// WARNING: Call this function at the top of XXX_LoadMe()
//
function InitFrameRef()
{
g_LastButtonText = null;
g_FirstFocusElement = null;
g_LastKeyDown = null;
g = document.frames("msoobeMain");
try
{
if (g.StageImage != null && g.StageImage.readyState == "complete")
{
g.StageImage.style.display = "none";
}
g.document.body.onkeydown = OnKeyDown;
SetLastButtonText();
}
catch(e){}
}
function HideButtons(buttons)
{
if (null != g.spanBack && (buttons & HIDE_BACK))
{
g.spanBack.Hide = true;
g.btnBack.Hide = true;
}
if (null != g.spanNext && (buttons & HIDE_NEXT))
{
g.spanNext.Hide = true;
g.btnNext.Hide = true;
}
if (null != g.spanCancel && (buttons & HIDE_CANCEL))
{
g.spanCancel.Hide = true;
g.btnCancel.Hide = true;
}
if (null != g.spanRestore && (buttons & HIDE_RESTORE))
{
g.spanRestore.Hide = true;
g.btnRestore.Hide = true;
}
}
function InitButtons()
{
if (g.btnNextText && (g.btnBackText && (g.btnBack.Hide == null || g.btnBack.Hide == false)))
g.btnNextText.style.textAlign="left";
else if (g.btnNextText)
g.btnNextText.style.textAlign="center";
if (g.btnBackText && (g.btnNextText && (g.btnNext.Hide == null || g.btnNext.Hide == false)))
g.btnBackText.style.textAlign="right";
else if (g.btnBackText)
g.btnBackText.style.textAlign="center";
if (g.btnRestoreText && (g.btnCancelText && (g.btnCancel.Hide == null || g.btnCancel.Hide == false)))
g.btnRestoreText.style.textAlign="left";
else if (g.btnRestoreText)
g.btnRestoreText.style.textAlign="center";
if (g.btnCancelText && (g.btnRestoreText && (g.btnRestore.Hide == null || g.btnRestore.Hide == false)))
g.btnCancelText.style.textAlign="right";
else if(g.btnCancelText)
g.btnCancelText.style.textAlign="center";
InitPairedButton(g.spanNext, g.btnNext, g.btnNextText, g_ImgRightDefault, g_ImgRightDisabled,
g_ImgRightDefaultSingle, g_ImgRightDisabledSingle,
g.spanBack, "backButton", "backButtonText");
InitPairedButton(g.spanBack, g.btnBack, g.btnBackText, g_ImgLeftDefault, g_ImgLeftDisabled,
g_ImgLeftDefaultSingle, g_ImgLeftDisabledSingle,
g.spanNext, "backButton", "backButtonText");
InitPairedButton(g.spanRestore, g.btnRestore, g.btnRestoreText, g_ImgRightDefaultWide, g_ImgRightDisabledWide,
g_ImgDefault, g_ImgDisabled,
g.spanCancel, "cancelButton", "cancelButtonText");
InitPairedButton(g.spanCancel, g.btnCancel, g.btnCancelText, g_ImgLeftDefaultWide, g_ImgLeftDisabledWide,
g_ImgDefault, g_ImgDisabled,
g.spanRestore, "cancelButton", "cancelButtonText");
}
function InitPairedButton(span, btn, btnText, img, imgDisabled,
imgSingle, imgSingleDisabled,
span2, btnClass, btnTextClass)
{
if (span != null)
{
if (span2 == null || true == span2.Hide)
{
btn.className = btnClass;
btnText.className = btnTextClass;
btnText.style.textAlign="center";
}
if (btn.disabled == null || !btn.disabled)
{
if (span2 == null || true == span2.Hide)
{
btn.src = imgSingle.src;
}
else
{
btn.src = img.src;
}
btnText.style.color= "black";
}
else
{
if (span2 == null || true == span2.Hide)
{
btn.src = imgSingleDisabled.src;
}
else
{
btn.src = imgDisabled.src;
}
btnText.style.color= "gray";
}
span.onmouseover = HoverOnButton;
span.onmouseout = HoverOffButton;
btnText.onblur = BlurBtnText;
btnText.onkeydown = KeyDownBtnText;
btnText.onfocus = FocusBtnText;
// set sibling associations.
btn.sibling = btnText;
btnText.sibling = btn;
if (null == btn.Hide || false == btn.Hide)
{
btn.style.visibility = "visible";
btnText.style.visibility = "visible";
switch (btnText.style.textAlign.toUpperCase())
{
case "CENTER":
btnText.style.posLeft = btn.offsetLeft + (btn.width / 2 - btnText.offsetWidth / 2);
break;
case "RIGHT":
btnText.style.posLeft = btn.offsetLeft + btn.width - ( btnText.offsetWidth + 10);
break;
}
}
}
}
///////////////////////////////////////////////////////////
// Function: HoverOnButton
// Description: This function is attached to a onmouseover
// event for a button span. We use the event source to
// determine which button it occured on and change that
// button to it's higlighted or hover state.
//
function HoverOnButton()
{
try
{
if (IsLocalFile() && g.event == null)
return;
}
catch(e)
{
return;
}
switch (g.event.srcElement.parentElement)
{
case g.spanCancel:
case g.btnCancelText:
HoverOnPairedButton(g.btnCancel, g.btnCancelText, g_ImgLeftHoverWide, g_ImgHover, g.btnRestore);
break;
case g.spanRestore:
case g.btnRestoreText:
HoverOnPairedButton(g.btnRestore, g.btnRestoreText, g_ImgRightHoverWide, g_ImgHover, g.btnCancel);
break;
case g.spanBack:
case g.btnBackText:
HoverOnPairedButton(g.btnBack, g.btnBackText, g_ImgLeftHover, g_ImgLeftHoverSingle, g.btnNext);
break;
case g.spanNext:
case g.btnNextText:
HoverOnPairedButton(g.btnNext, g.btnNextText, g_ImgRightHover, g_ImgRightHoverSingle, g.btnBack);
break;
}
}
function HoverOnPairedButton(btn, btnText, img, imgSingle, btn2)
{
if (btn.disabled == null || !btn.disabled)
{
if (!btn.parentElement.contains(g.event.fromElement))
{
if (btn2 == null || true == btn2.Hide)
{
btn.src = imgSingle.src;
}
else
{
btn.src = img.src;
}
btnText.style.fontWeight = "bold";
switch (btnText.style.textAlign.toUpperCase())
{
case "CENTER":
btnText.style.posLeft = btn.offsetLeft + (btn.offsetWidth / 2 - btnText.offsetWidth / 2);
break;
case "RIGHT":
btnText.style.posLeft = btn.offsetLeft + btn.offsetWidth - ( btnText.offsetWidth + 10);
break;
}
}
}
}
var g_LastKeyDown = null;
function OnKeyDown()
{
try
{
if (IsLocalFile() && g.event == null)
return;
}
catch(e)
{
return;
}
if (g.event.altKey)
{
g_LastKeyDown = String.fromCharCode(g.event.keyCode);
if (g_LastKeyDown != null)
g_LastKeyDown = g_LastKeyDown.toUpperCase();
}
else
g_LastKeyDown = null;
}
function FocusBtnText()
{
try
{
if (IsLocalFile() && g.event == null)
return;
}
catch(e)
{
return;
}
if (g.event.srcElement.sibling == null ||
g.event.srcElement.sibling.disabled == null ||
g.event.srcElement.sibling.disabled == false)
{
var accessKey = g.event.srcElement.accessKey;
if(g.event.altKey &&
!g.event.button &&
accessKey != null &&
g_LastKeyDown == accessKey.toUpperCase())
g.event.srcElement.parentElement.click();
}
else
g.event.srcElement.blur();
g.event.returnValue = false;
g.event.cancelBubble = true;
}
function KeyDownBtnText()
{
try
{
if (IsLocalFile() && g.event == null)
return;
}
catch(e)
{
return;
}
var keyPressed = String.fromCharCode(g.event.keyCode);
if (g.event.keyCode == 13 || (g.event.altKey && keyPressed.toUpperCase() == g.event.srcElement.accessKey.toUpperCase()))
{
g.event.keyCode = 0;
g.event.returnValue = false;
g.event.cancelBubble = true;
g.event.srcElement.parentElement.click();
}
if (g_LastButtonText != null && g.event.srcElement == g_LastButtonText &&
g.event.keyCode == 9 && null != g_FirstFocusElement && g_FirstFocusElement.isTextEdit &&
!g.event.altKey)
{
g_FirstFocusElement.focus();
g_FirstFocusElement.select();
g.event.returnValue = false; // BUGBUG should we keyCode 0 here?
g.event.keyCode = 0;
}
}
function BlurBtnText()
{
// need this stinking thing here for the
// case when we have an onblur happen and the page is not valid
// so we are in a transition. this way we don't get a mesagebox
// about an error
try
{
if (g.event.type == "blur")
{
if (!g.event.altKey &&
g_LastButtonText != null &&
g_FirstFocusElement != null &&
g.event.srcElement == g_LastButtonText)
{
g_FirstFocusElement.focus();
}
}
}
catch(e)
{
return;
}
}
///////////////////////////////////////////////////////////
// Function: HoverOffButton
// Description: This function is attached to a onmouseout
// event for a button span. We use the event source to
// determine which button it occured on and change that
// button back to it's normal state.
//
function HoverOffButton()
{
// need this stinking thing here for the
// case when we have an onblur happen and the page is not valid
// so we are in a transition. this way we don't get a mesagebox
// about an error
try
{
if (IsLocalFile() && g.event == null)
return;
}
catch(e)
{
return;
}
switch (g.event.srcElement.parentElement)
{
case g.spanCancel:
case g.btnCancelText:
HoverOffPairedButton(g.btnCancel, g.btnCancelText, g_ImgLeftDefaultWide, g_ImgDefault, g.btnRestore);
break;
case g.spanRestore:
case g.btnRestoreText:
HoverOffPairedButton(g.btnRestore, g.btnRestoreText, g_ImgRightDefaultWide, g_ImgDefault, g.btnCancel);
break;
case g.spanBack:
case g.btnBackText:
HoverOffPairedButton(g.btnBack, g.btnBackText, g_ImgLeftDefault, g_ImgLeftDefaultSingle, g.btnNext);
break;
case g.spanNext:
case g.btnNextText:
HoverOffPairedButton(g.btnNext, g.btnNextText, g_ImgRightDefault, g_ImgRightDefaultSingle, g.btnBack);
break;
}
// BlurText();
}
function HoverOffPairedButton(btn, btnText, img, imgSingle, btn2)
{
if (btn.disabled == null || !btn.disabled)
{
if (!btn.parentElement.contains(g.event.toElement))
{
if (btn2 == null || true == btn2.Hide)
{
btn.src = imgSingle.src;
}
else
{
btn.src = img.src;
}
btnText.style.fontWeight = "normal";
btnText.style.color = "black";
switch (btnText.style.textAlign.toUpperCase())
{
case "CENTER":
btnText.style.posLeft = btn.offsetLeft + (btn.offsetWidth / 2 - btnText.offsetWidth / 2);
break;
case "RIGHT":
btnText.style.posLeft = btn.offsetLeft + btn.offsetWidth - ( btnText.offsetWidth + 10);
break;
}
}
}
}
// END Button Event Handlers and Initialization
// VALIDATION ROUTINES
function KeyPressIsNumeric()
{
try
{
if (IsLocalFile() && g.event == null)
return;
}
catch(e)
{
return;
}
if (!IsNumeric(g.event.keyCode))
{
g.event.keyCode = 0;
g.event.returnValue = false;
}
}
function IsNumeric(keyCode)
{
if ((keyCode >= 48/*0*/) && (keyCode <= 57/*9*/))
return true;
else
return false;
}
function IsSpecial(keyCode)
{
// BUGBUG DISABLED FOR BETA
/*
var bFound = false;
var iPosition = 0;
for (;iPosition < g_SpecialChars.length; iPosition++)
{
if (g_SpecialChars.charCodeAt(iPosition) == keyCode)
{
bFound = true;
break;
}
}
return bFound;
*/
return false;
}
function KeyPressIsValid()
{
try
{
if (IsLocalFile() && g.event == null)
return;
}
catch(e)
{
return;
}
if (!IsAlpha(g.event.keyCode) &&
!IsSpecial(g.event.keyCode) &&
!IsNumeric(g.event.keyCode))
{
g.event.keyCode = 0;
g.event.returnValue = false;
}
}
function KeyPressIsAlpha()
{
try
{
if (IsLocalFile() && g.event == null)
return;
}
catch(e)
{
return;
}
if (!IsAlpha(g.event.keyCode))
{
g.event.keyCode = 0;
g.event.returnValue = false;
}
}
function IsAlpha(keyCode)
{
// BUGBUG DISABLED FOR BETA
/*
var strKeyCode = String.fromCharCode(keyCode);
var re1 = new RegExp("\w");
var re2 = new RegExp("\D");
strKeyCode.match(re1);
strKeyCode.match(re2);
//return ((strKeyCode.match(re1) != null) && (strKeyCode.match(re2) != null));
*/
// if ((keyCode >= 97/*a*/ && keyCode <= 122/*z*/) ||
// (keyCode >= 65/*A*/ && keyCode <= 90 /*Z*/))
return true;
// else
// return false;
}
function NumberOfSpaces(strValue)
{
/*
var NASexp = RegExp("\s");
var result = strValue.match(NASexp);
return ((result == null) || (result.length != strValue.length));
*/
var iSpaceCount = 0;
for (iPosition = 0; iPosition < strValue.length; iPosition ++)
{
if (strValue.charAt(iPosition) == ' ')
{
iSpaceCount++;
}
}
return iSpaceCount;
}
function KeyCodeToUpper()
{
var strKeyCode = String.fromCharCode(g.event.keyCode);
strKeyCode = strKeyCode.toUpperCase();
g.event.keyCode = strKeyCode.charCodeAt(0);
}
// END VALIDATION ROUTINES
function SetupPageLayout()
{
document.all.ifrmMainFrame.style.height = document.body.clientHeight;
}
window.onresize = SetupPageLayout;
function ReCheckModem()
{
if ( 1 == DirObj.get_Offline() || window.external.CheckDialReady() != ERR_COMM_NO_ERROR)
{
g_status = STATUS_OFF;
StatusObj.set_Status(NOLAUNCHISPSIGNUP, true);
}
else
{
g_status = STATUS_MSN;
}
}
function InitApplication()
{
SetupPageLayout();
g_bStartup = true;
InitFrameRef();
if ( 1 == DirObj.get_Offline() || window.external.CheckDialReady() != ERR_COMM_NO_ERROR)
{
g_status = STATUS_OFF;
StatusObj.set_Status(NOLAUNCHISPSIGNUP, true);
}
else
{
g_status = STATUS_MSN;
}
InitCKPT();
do
{
PopCKPT();
}
while (null != g_CurrentCKPT);
GoNavigate(CKPT_START);
spnPage.style.visibility = "visible";
}
</script>
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 onload=InitApplication(); scroll=no tabIndex=-1 topMargin=0>
<SPAN id=spnPage style="VISIBILITY: hidden" tabIndex=-1>
<SPAN id=spnMainFrame style="LEFT: 0px; POSITION: absolute; TOP: 0px" tabIndex=-1>
<IFRAME frameBorder=no height="100%" id=ifrmMainFrame name=msoobeMain src="about:blank" tabIndex=-1 width="100%"></IFRAME>
</SPAN>
</SPAN>
</BODY>
</HTML>