Jump to content

Francesco

Member
  • Posts

    414
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Italy

Posts posted by Francesco

  1. How can change text color from categories, and aplications name?

    I try to edit Win7 themes from Tool Tips, from themeoptions.js, from wpi.css inside of win7 but nothing change. Is a s*** color and I want to change it.

    Tks

    What's wrong with small and unreadable pink text? Nobody ever reads fine prints anyway.

  2. Cause

    The HandleCommandsSelectionMenu function doesn't check whether the command textbox is disabled before inserting the command text.

    Fix

    In configwizard.js below the line containing

    whatfunc="HandleCommandsSelectionMenu()";

    add


    if (document.getElementById("cmd1").disabled)
    Alert("",getText(txtMustAddCommand),"",3,-1,0,0);;

    In lang_en.js below the line containing

    txtDeleteCommandConfirm[lang]	= ['Are you sure you want to delete this command?'];

    add


    txtMustAddCommand[lang] = ['You must add a command entry through the \'Add\' button before being able to perform this operation.'];

    In globals_lang.js below the line containing

    var txtDeleteCommandConfirm=[];

    add


    var txtMustAddCommand=[];

  3. Cause

    This is caused by two different issues:

    1. The function that populates the command textbox searches the array trough Id even though when drag&dropping the Id stop reflecting the current grid position.
    2. When you drag&drop an item the commands array is not updated so fixing the function for populating the textbox is not enough, the array has to be refreshed after each drag&drop as well.

    Fix

    In configwizard.js replace

    CommandsGrid.attachEvent("onRowSelect",FillInCommand);

    with


    CommandsGrid.attachEvent("onRowSelect",function (rowId) {
    FillInCommand(CommandsGrid.getRowIndex(rowId));
    });
    CommandsGrid.attachEvent("onDrop", ExtractCommandsValues);

    Please report if this change breaks anything.

  4. i am stuck can't rember how i did this before a few years back

    i am building a new WPI install for the home office need to achieve 2 goals on one disk

    goal one install small apps from DVD "Check"

    goal 2 install larger apps form mapped network share or UNC path what variable do i change to do this

    You don't need to change any variable, just put the whole UNC file path in the command and it should work. You can also use the toolbar JSCRIPT->Network->MapNetworkDrive() button to map the drive prior to the application install.

  5. Hi,

    how do i configure this in wpi?

    the install consists of a 'loader' which invokes the real install. (and seems to prepare something for the 'real' install). the real install can't be started individually

    i need to run Setup,exe and then wait for other.exe to complete.

    anyone got a clue how to do that ?

    regards

    Have you tried using something like

    {JSCRIPT}=TimedWaitForProgram("Setup.exe",3600)

    ?

  6. Description

    Adds an {OS=...} filter to allow commands being executed only on certain OS versions. Useful to install missing libraries or runtimes on older OSes. You can put any other command type statement ({FILECOPY},{RENAME},{DIRCOPY}...) after the filter statement and the same feature was added to the {X86} and {X64} statements. You can even combine {X86} and {X64} statements with the {OS=...} filter.

    Example

    {OS=Win7,Vista} "%WpiPath%\Install\MyApplication\MyApplicationSetup.exe" will execute the command only on Windows 7 and Vista (no XP, 2000 and previous).

    Current issues

    - I changed almost all the code in the function to improve the statement parsing so this change still needs proper testing

    Fix

    In installer.js replace the handleCommand function with this new one


    function handleCommand(cmd,item,cmdNum)
    {
    position="installer.js";
    whatfunc="handleCommand()";

    var braceEndPosition = cmd.indexOf("}");
    if (cmd.substr(0,1)=="{" && braceEndPosition > 0)
    {
    var statementToken = cmd.substr(1,braceEndPosition-1);
    var splittedStatementToken = statementToken.split("=");
    var statement = splittedStatementToken[0].toUpperCase();
    var statementArguments = splittedStatementToken.length > 1 ? splittedStatementToken[1] : "";

    if (statement == "JSCRIPT")
    return cmd;

    cmd = cmd.substr(braceEndPosition+1, cmd.length).replace(/^\s+/,"");

    switch(statement)
    {
    case 'OS':
    var supportedOSes = statementArguments.split(',');
    var uppercaseCurrentOS = getOSver().toUpperCase();
    for (var supportedOSNum = 0; supportedOSNum < supportedOSes.length; supportedOSNum++)
    if (uppercaseCurrentOS == supportedOSes[supportedOSNum].replace(/^\s+|\s+$/g,"").toUpperCase())
    return handleCommand(cmd,item,cmdNum);
    cmd="SKIP0";
    fsoCmd=false;
    break;

    case 'X86':
    if (getBits()==32)
    return handleCommand(cmd,item,cmdNum);
    cmd="SKIP0";
    fsoCmd=false;
    break;

    case 'X64':
    if (getBits()==64)
    return handleCommand(cmd,item,cmdNum);
    cmd="SKIP0";
    fsoCmd=false;
    break;

    case 'WEB':
    document.getElementById("InstallItem").innerHTML=getText(lblViewing)+" "+cmd;
    cmd='"'+ReplacePath("%programfiles%\\Internet Explorer\\iexplore.exe")+'" '+cmd;
    UpdateInstallList(("div"+item+"_"+cmdNum+"_"+FailNum),getText(txtInstallViewing));
    isIE=true;
    fsoCmd=false;
    break;

    case 'DOWNLOAD':
    cmd=DownloadFile(cmd,item,cmdNum);
    fsoCmd=false;
    break;

    case 'NETSH':
    cmd="CMD /C NETSH " + cmd;
    cmd=ReplacePath(cmd);
    fsoCmd=true;
    break;

    case 'REGDLL':
    cmd="CMD /C REGSVR32 /S " + cmd;
    fsoCmd=true;
    break;

    case 'UNREGDLL':
    cmd="CMD /C REGSVR32 /U /S " + cmd;
    fsoCmd=true;
    break;

    case 'INSTINF':
    cmd="CMD /C RUNDLL32 setupapi.dll,InstallHinfSection DefaultInstall 132 " + cmd;
    fsoCmd=true;
    break;

    case 'LAUNCHINF':
    cmd="CMD /C RUNDLL32 advpack.dll,LaunchINFSection " + cmd;
    fsoCmd=true;
    break;

    case 'REGEDIT':
    if (FileExists(cmd))
    {
    if (cmd.indexOf(" ") != -1 && cmd.substr(0,1) != '"')
    cmd='"'+cmd+'"';
    if (programs[item].bit64=="yes" && OSBits==64)
    cmd='"'+sysPath64+'RegEdt32" /S ' + cmd;
    else
    cmd='"'+sysPath32+'RegEdit" /S ' + cmd;
    fsoCmd=true;
    }
    else
    cmd=getText(txtErrorRegEditFileExists);
    break;

    case 'EXTRACT':
    var src, dst, splits;

    src=dst=cmd;
    if (cmd.indexOf('" "') != -1)
    {
    splits=cmd.split('" "');
    src=splits[0];
    dst=splits[1];
    }
    else
    {
    if (src.substr(0,1)=='"')
    {
    splits=cmd.split('" ');
    src=splits[0];
    dst=splits[1];
    }
    else
    {
    splits=cmd.split(' ');
    src=splits[0];
    dst=splits[1];
    }
    }
    src=src.replace(/\"/g,"");
    dst=dst.replace(/\"/g,"");
    cmd='"'+wpipath+'\\Tools\\7z\\7z.exe" x "'+src+'" -aoa -o"'+dst+'"';
    fsoCmd=true;
    if (src.indexOf("*")==-1)
    {
    if (!FileExists(src))
    cmd=getText(txtErrorExtractFileExists);
    }
    break;

    case 'FILECOPY':
    cmd="CMD /C COPY /Y " + cmd;
    fsoCmd=true;
    break;

    case 'FILEMOVE':
    cmd="CMD /C MOVE /Y " + cmd;
    fsoCmd=true;
    break;

    case 'RENAME':
    cmd="CMD /C REN " + cmd;
    fsoCmd=true;
    break;

    case 'DELETE':
    cmd="CMD /C DEL /F /Q " + cmd;
    fsoCmd=true;
    break;

    case 'MAKEDIR':
    cmd="CMD /C MD " + cmd;
    fsoCmd=true;
    break;

    case 'DIRCOPY':
    cmd="CMD /C XCOPY " + cmd + " /C /I /E /Y /H /R";
    fsoCmd=true;
    break;

    case 'DIRMOVE':
    cmd="{JSCRIPT}=MoveDirectory(\'" + cmd + "\')";
    break;

    case 'DELDIR':
    cmd="CMD /C RD /S /Q " + cmd;
    fsoCmd=true;
    break;

    case 'RUNBG':
    waitForIt=false;
    break;

    case 'TASKKILL':
    cmd="{JSCRIPT}=TerminateProcess(\"" + cmd + "\")";
    break;

    case 'SLEEP':
    cmd="\"" + wpipath + "\\Tools\\Sleep.exe\"" + cmd;
    fsoCmd=true;
    break;

    case 'REBOOT':
    cmd="\"" + sysdir + "\\shutdown.exe\" /r /f /t " + (cmd.length > 0 ? cmd : "0");
    fsoCmd=true;
    break;

    case 'START':
    cmd="CMD /C START " + cmd;
    fsoCmd=true;
    break;
    }
    return cmd;
    }

    if (cmd.indexOf(".cmd") != -1 || cmd.indexOf(".bat") != -1)
    {
    if (cmd.indexOf(" ") != -1 && cmd.substr(0,1) != '"')
    cmd='"'+cmd+'"';
    if (programs[item].bit64=="yes" && OSBits==64)
    cmd='"'+sysPath64+'cmd.exe" /C '+cmd;
    else
    cmd='"'+sysPath32+'cmd.exe" /C '+cmd;

    return cmd;
    }

    // if (cmd.indexOf(" ")==-1 && cmd.substr(0,1) != '"')
    if (cmd.indexOf(" ")==-1 && cmd.substr(0,1) != '"' && cmd.indexOf(">")==-1) // > needed for stdout. "d:\program.exe" "param1" >c:\app.txt
    cmd='"'+cmd+'"';

    return cmd;
    }

    In configwizard.js replace


    CommandsMenuBar.addNewSibling("internet", "cmd_other", getText(lblOther), false);
    CommandsMenuBar.addNewChild("cmd_other", 0, "other_architecture", getText(lblArchitecture), false, "", "");
    CommandsMenuBar.addNewChild("other_architecture", 0, "architecture_x86", "x86", false, "", "");
    CommandsMenuBar.addNewChild("other_architecture", 1, "architecture_x64", "x64", false, "", "");
    CommandsMenuBar.addNewChild("cmd_other", 1, "other_runbg", "Run In Bg", false, "", "");
    CommandsMenuBar.addNewChild("cmd_other", 2, "other_taskkill", "TaskKill", false, "", "");
    CommandsMenuBar.addNewChild("cmd_other", 3, "other_sleep", "Sleep", false, "", "");
    CommandsMenuBar.addNewChild("cmd_other", 4, "other_reboot", "Reboot", false, "", "");

    with


    CommandsMenuBar.addNewSibling("internet", "cmd_cond", getText(lblCondition), false);
    CommandsMenuBar.addNewChild("cmd_cond", 0, "cmd_cond_operatingsystem", getText(lblOperatingSystem), false, "", "");
    CommandsMenuBar.addNewChild("cmd_cond", 1, "cmd_cond_architecture", getText(lblArchitecture), false, "", "");
    CommandsMenuBar.addNewChild("cmd_cond_architecture", 0, "cmd_cond_architecture_x86", "x86", false, "", "");
    CommandsMenuBar.addNewChild("cmd_cond_architecture", 1, "cmd_cond_architecture_x64", "x64", false, "", "");
    CommandsMenuBar.addNewSibling("cmd_cond", "cmd_other", getText(lblOther), false);
    CommandsMenuBar.addNewChild("cmd_other", 1, "other_runbg", "Run In Bg", false, "", "");
    CommandsMenuBar.addNewChild("cmd_other", 2, "other_taskkill", "TaskKill", false, "", "");
    CommandsMenuBar.addNewChild("cmd_other", 3, "other_sleep", "Sleep", false, "", "");
    CommandsMenuBar.addNewChild("cmd_other", 4, "other_reboot", "Reboot", false, "", "");

    and replace


    case 'architecture_x86':
    HandleCommandsSelectionMenu("{x86} ");
    break;

    case 'architecture_x64':
    HandleCommandsSelectionMenu("{x64} ");
    break;

    with


    case 'cmd_cond_operatingsystem':
    HandleCommandsSelectionMenu("{OS=Win7,Vista,XP} ");
    break;

    case 'cmd_cond_architecture_x86':
    HandleCommandsSelectionMenu("{x86} ");
    break;

    case 'cmd_cond_architecture_x64':
    HandleCommandsSelectionMenu("{x64} ");
    break;

  7. Cause

    WPI doesn't remove the category after all its entries are deleted

    Solution

    In configwizard.js replace

    configList.splice(cpos,1);

    with

    	var catname = configList[cpos].cat;
    configList.splice(cpos,1);
    var catcount = 0;
    for (var i=0; i<configList.length && configList[i] != null; i++)
    if (catname == configList[i].cat)
    catcount++;

    if (!catcount)
    {
    for (var i=document.getElementById("cboFilter").options.length-1; i>=1; i--)
    if (document.getElementById("cboFilter").options[i].text == catname)
    document.getElementById("cboFilter").remove(i);

    if (CatFilter == catname)
    {
    CatFilter = "all";
    document.getElementById("cboFilter").value = CatFilter;
    }
    }

  8. Cause

    WPI tries to execute the exit sound even when the main window has not still been completely created.

    Fix

    in timers.js replace

    	StopSound();
    document.getElementById("TimerSound").src=ReplacePath(soundfile).replace(/\"/g,'');

    with

    	var TimerSoundElement = document.getElementById("TimerSound");
    if (TimerSoundElement)
    {
    StopSound();
    TimerSoundElement.src=ReplacePath(soundfile).replace(/\"/g,'');
    }

  9. Cause

    Core.js lacks the proper code to restore the registry keys changed by the launcher

    Solution

    In core.js delete

    	DeleteRegKey("HKEY_CURRENT_USER\\Software\\WPI\\DebuggerRestart");

    In api.js delete

    SetScriptWaitTimeout();

    In core.js delete

    function SetScriptWaitTimeout(timeout) // max is 4294967295
    {
    position="core.js";
    whatfunc="SetScriptWaitTimeout()";

    var val=0;
    var KeyBase="HKCU\\Software\\Microsoft\\Internet Explorer\\Styles\\MaxScriptStatements";

    try
    {
    if (timeout<0)
    {
    DeleteRegKey(KeyBase);

    return;
    }

    try
    {
    val=WshShell.RegRead(KeyBase);
    }
    catch(ex2)
    {
    if (timeout==0 || !timeout)
    timeout=0x7fffffff;
    WshShell.RegWrite(KeyBase,timeout,"REG_DWORD");
    }
    }
    catch(ex)
    { ; }
    }

    replace

    		SetScriptWaitTimeout(-1);
    CheckDebugger(false);

    with

    		RestoreRegistryKeys();

    replace

    function CheckDebugger(startup)
    {
    position="core.js";
    whatfunc="CheckDebugger()";

    var value;

    if (startup)
    {
    }
    else
    {
    if (RegKeyExists("HKEY_CURRENT_USER\\Software\\WPI\\DisableScriptDebuggerIE"))
    {
    value=RegKeyValue("HKEY_CURRENT_USER\\Software\\WPI\\DisableScriptDebuggerIE");
    WriteRegKey("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\DisableScriptDebuggerIE",value,"REG_SZ");
    }
    if (RegKeyExists("HKEY_CURRENT_USER\\Software\\WPI\\Disable Script Debugger"))
    {
    value=RegKeyValue("HKEY_CURRENT_USER\\Software\\WPI\\Disable Script Debugger");
    WriteRegKey("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\Disable Script Debugger",value,"REG_SZ");
    }
    }
    }

    with

    function RestoreRegistryKeys()
    {
    position="core.js";
    whatfunc="RestoreRegistryKeys()";
    var RegistryKeysBackupKey = "HKEY_CURRENT_USER\\Software\\WPI\\DebuggerValuesBackup";
    if (RegKeyExists(RegistryKeysBackupKey))
    {
    var IE_DisableScriptDebugger_Key = "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\Disable Script Debugger",
    IE_DisableScriptDebugger_Key_Backup = RegistryKeysBackupKey + "\\Disable Script Debugger";
    if (RegValueExists(IE_DisableScriptDebugger_Key_Backup))
    {
    var PreviousValue = RegKeyValue(IE_DisableScriptDebugger_Key_Backup);
    if (PreviousValue == "DELETE")
    DeleteRegKey(IE_DisableScriptDebugger_Key);
    else
    WriteRegKey(IE_DisableScriptDebugger_Key, PreviousValue, "REG_SZ");
    }

    var IE_DisableScriptDebuggerIE_Key = "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\DisableScriptDebuggerIE",
    IE_DisableScriptDebuggerIE_Key_Backup = RegistryKeysBackupKey + "\\DisableScriptDebuggerIE";
    if (RegValueExists(IE_DisableScriptDebuggerIE_Key_Backup))
    {
    var PreviousValue = RegKeyValue(IE_DisableScriptDebuggerIE_Key_Backup);
    if (PreviousValue == "DELETE")
    DeleteRegKey(IE_DisableScriptDebuggerIE_Key);
    else
    WriteRegKey(IE_DisableScriptDebuggerIE_Key, PreviousValue, "REG_SZ");
    }

    var IE_ErrorDlgDisplayedOnEveryError_Key = "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\Error Dlg Displayed On Every Error",
    IE_ErrorDlgDisplayedOnEveryError_Key_Backup = RegistryKeysBackupKey + "\\Error Dlg Displayed On Every Error";

    if (RegValueExists(IE_ErrorDlgDisplayedOnEveryError_Key_Backup))
    {
    var PreviousValue = RegKeyValue(IE_ErrorDlgDisplayedOnEveryError_Key_Backup);
    if (PreviousValue == "DELETE")
    DeleteRegKey(IE_ErrorDlgDisplayedOnEveryError_Key);
    else
    WriteRegKey(IE_ErrorDlgDisplayedOnEveryError_Key, PreviousValue, "REG_SZ");
    }

    var IE_MaxScriptStatements_Key = "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Styles\\MaxScriptStatements",
    IE_MaxScriptStatements_Key_Backup = RegistryKeysBackupKey + "\\MaxScriptStatements";

    if (RegValueExists(IE_MaxScriptStatements_Key_Backup))
    {
    var PreviousValue = RegKeyValue(IE_MaxScriptStatements_Key_Backup);
    if (PreviousValue == "DELETE")
    DeleteRegKey(IE_MaxScriptStatements_Key);
    else
    WriteRegKey(IE_MaxScriptStatements_Key, PreviousValue, "REG_DWORD");
    }

    DeleteRegKey(RegistryKeysBackupKey + "\\");
    }
    }

    Use the new attached WPI Launcher.

    Notes

    The solution #2 of this other fix is required for this one to work.

    WPI Launcher v1.06 Binaries.zip

  10. Description

    If a configuration wizard is closed and LoadDesktopBeforeInstall is enabled when starting the install WPI will just close and start after a reboot.

    Cause

    There is a bug in how WPI.hta parses the command line that triggers when the WPI window is refreshed after a wizard has been closed.

    Solution

    In WPI.HTA replace

    	var fullpath, regexpSearch, argLine, WPIcmdArgs;

    fullpath=new String(unescape(document.location));
    fullpath=fullpath.replace("file:///","").replace("file:","").replace(/\//g,"\\\\").replace(/\$/g,"\\$");
    regexpSearch=new RegExp('^"'+fullpath+'"',"i");
    argLine=new String(oWPI.commandLine.replace(regexpSearch,''));

    with

    	var startQuotePos, endQuotePos, regexpSearch, argLine, WPIcmdArgs;
    argLine = oWPI.commandLine;
    if ((startQuotePos = argLine.indexOf('"')) == 0 && (endQuotePos = argLine.indexOf('"',startQuotePos+1)) > -1)
    argLine=argLine.substring(endQuotePos+1);

  11. I belive you got this one wrong I find alot os pausenew bot no pause with the 3600,0 denominator

    I re-downloaded the WPI8.2.2 code and in installer.js there are three instances of that line:

    			if (CheckPendingFileRenameOperations())
    {
    WriteRegKey("HKEY_CURRENT_USER\\Software\\WPI\\CurrentPFRO",i,"REG_DWORD");

    CheckAutoLogonCount();

    cmdLine='"'+sysdir+'\\shutdown.exe" -r -f -t 10 -c "'+getText(ComputerWillRestartPFRO)+'"';
    RunCmd(cmdLine,false,true);
    pause(3600,0); // Give some time for {reboot} to take affect
    }

    			if (programs[i].repeatcommand=="yes")
    {
    var RepeatCommand=RegKeyValue("HKEY_CURRENT_USER\\Software\\WPI\\LastExec");
    WriteRegKey("HKEY_CURRENT_USER\\Software\\WPI\\LastExec",RepeatCommand-1,"REG_DWORD"); //Save current position for reboots

    FailNum++;
    WriteRegKey("HKEY_CURRENT_USER\\Software\\WPI\\FailNum",FailNum,"REG_DWORD");
    }

    cmdLine='"'+sysdir+'\\shutdown.exe" -r -f -t 5 -c "'+getText(ComputerWillRestart)+'"';
    RunCmd(cmdLine,false,true);
    pause(3600,0); // Give some time for {reboot} to take affect

    	if (IsReboot)
    {
    CheckAutoLogonCount();

    box='';
    box+='<table border="0" width="100%" cellpadding="0" cellspacing="0">';
    box+='<tr><td class="InstallText" nowrap>';
    box+='<img src="../Common/imgs/spacer.gif" border="0" width="20" height="1">';
    box+=getText(lblCommand)+' '+cmdNum+'...';
    box+='</td><td width="100%">';
    if (!ShowInstallerImages)
    box+='<div id="div'+item+'_'+cmdNum+'_'+FailNum+'" class="InstallSuccess" style="position:relative; top:0px; left:0px; width:100%;">'+getText(txtInstallSuccess)+'</div>';
    else
    box+='<div id="div'+item+'_'+cmdNum+'_'+FailNum+'" class="InstallSuccess" style="position:relative; top:0px; left:0px; width:100%;"><img src="../Themes/'+Theme+'/Install_Success.png" border="0" width="16" height="16"></div>';
    box+='</td></tr></table>';
    AddHistoryEntry(box+"\n");

    pause(3600,0); // Give some time for {reboot} to take affect
    }

    Maybe the spacing was changed when I posted the message so an exact search of the line doesn't work: try looking only for pause(3600,0);

  12. Cause

    WPI doesn't include the required code for detecting when the window is closed.

    Solution

    In WPI.HTA below

    window.onError=handleErrors; // or null to suppress error message

    add

    window.onbeforeunload=WPIUnloading;

    In Api.js replace

    document.location.reload();

    with

    RefreshWPI();

    and below

    whatfunc="CheckKey()";

    add

    	if (window.event.keyCode==116)
    SetNotExitingFlag();

    In updatewizard.js replace TWICE

    document.location.reload();

    with

    RefreshWPI();

    In tips.js replace

    location.reload();

    with

    RefreshWPI();

    In themewizard.js replace

    document.location.reload();

    with

    RefreshWPI();

    In optionswizard.js replace

    document.location.reload();

    with

    RefreshWPI();

    In networkwizard.js replace

    document.location.reload();

    with

    RefreshWPI();

    In main.js replace

    document.location.reload();

    with

    RefreshWPI();

    In configwizard.js replace TWICE

    document.location.reload();

    with

    RefreshWPI();

    In installer.js replace

    	if (!ResumeInstall)
    document.location="file:///"+strFile.replace(/\\/g, '/');

    with

    	if (!ResumeInstall)
    {
    SetNotExitingFlag();
    document.location="file:///"+strFile.replace(/\\/g, '/');
    }

    In core.js below

    	DeleteRegKey("HKEY_CURRENT_USER\\Software\\WPI\\SndWPIExit");
    }

    add

    var NotExiting = false;

    function SetNotExitingFlag()
    {
    NotExiting = true;
    }

    function RefreshWPI()
    {
    SetNotExitingFlag();
    document.location.reload();
    }

    function WPIUnloading()
    {
    if (!NotExiting)
    ExitWPI();
    }

    and below

    function ExitWPI()
    {

    add

    	SetNotExitingFlag();

    Note

    This fix also forces WPI to clear the keys also when closed with the jumpstart close button on Win7 or the window Close button that is enabled using the updated launcher attached on this forum post.

  13. Cause

    Internet Explorer (especially 9) returns error messages for scripts that run for too long.

    Solution

    Use the attached launcher that disables the IE timeout before starting WPI.

    Notes

    • This launcher also fixes the WPI script javascript error messages not working properly.
    • This launcher restores the Close window button functionality of WPI, do not close WPI trough the window button unless you also applied the fix for the IE debug keys not restored.

    WPI Launcher v1.05 Binaries.zip

  14. You can use AutoIT with WinWait to wait for the window to appear rather than relying on an not always reliable sleep command. You can also use WinClose to send the close message to the window, ControlClick to click the various confirm close buttons the application may show (use the Window Info tool to get the codes for those) and WinWaitClose to have the autoit script wait until the window has actually closed.

  15. Cause

    The applications list TD (the one with opTxt class) has a rowspan of 2, required to fix tooltips flickering issues, that allows it to overflow in the TD of the Exit button.

    Solution

    In WPI.htm replace

    onLoad="WPIReady();

    with

    onLoad="WPIReady(); document.all.layerboxes.style.height = document.all.td_sidepanel.clientHeight + 'px';"

  16. How to reproduce

    Write <IMG> in the name, category, category or in a command, it will be interpreted instead of being escaped. Or try adding & in the name of an application and notice how the name is truncated in the grid.

    Cause

    WPI doesn't do any sort of escaping when adding items to the grids.

    Fix

    In configwizard.js replace

    NavGrid.addRow(i,[configList[i].ordr,configList[i].cat,configList[i].uid,configList[i].prog]);

    with

    NavGrid.addRow(i,[configList[i].ordr,ConvertSpecialCharactersToEntities(configList[i].cat),configList[i].uid,ConvertSpecialCharactersToEntities(configList[i].prog)]);

    replace

    ConfigurationsGrid.addRow(i+3,[(CheckOnLoad==Configurations[i] ? 1 : 0),Configurations[i]]);

    with

    ConfigurationsGrid.addRow(i+3,[(CheckOnLoad==Configurations[i] ? 1 : 0),ConvertSpecialCharactersToEntities(Configurations[i])]);

    replace

    CommandsGrid.addRow(i,Commands[i]);

    with

    CommandsGrid.addRow(i,ConvertSpecialCharactersToEntities(Commands[i]));

    replace TWICE

    NavGrid.addRow(cpos,[configList[cpos].ordr,configList[cpos].cat,configList[cpos].uid,configList[cpos].prog]);

    with

    NavGrid.addRow(cpos,[configList[cpos].ordr,ConvertSpecialCharactersToEntities(configList[cpos].cat.toString()),configList[cpos].uid,ConvertSpecialCharactersToEntities(configList[cpos].prog)]);

    replace

    ConfigurationsGrid.addRow(ConfigurationsGrid.getRowsNum(),[0,document.getElementById("NewConfiguration").value]);

    with

    ConfigurationsGrid.addRow(ConfigurationsGrid.getRowsNum(),[0,ConvertSpecialCharactersToEntities(document.getElementById("NewConfiguration").value)]);

    replace

    SortOrderGrid.addRow(i,cats[i]);

    with

    SortOrderGrid.addRow(i,ConvertSpecialCharactersToEntities(cats[i]));

    replace

    SortOrderGrid.addRow(SortOrderGrid.getRowsNum(),configList[cpos].cat);

    with

    SortOrderGrid.addRow(SortOrderGrid.getRowsNum(),ConvertSpecialCharactersToEntities(configList[cpos].cat));

    replace

    NavGrid.cells(cpos,3).setValue(configList[cpos].prog);

    with

    NavGrid.cells(cpos,3).setValue(ConvertSpecialCharactersToEntities(configList[cpos].prog));

    replace

    NavGrid.cells(cpos,1).setValue(configList[cpos].cat);

    with

    NavGrid.cells(cpos,1).setValue(ConvertSpecialCharactersToEntities(configList[cpos].cat));

    replace

    NavGrid.cells(cpos,1).setValue(configList[cpos].cat);

    with

    NavGrid.cells(cpos,1).setValue(ConvertSpecialCharactersToEntities(configList[cpos].cat));

    replace

    CommandsGrid.cells(CommandsGrid.getSelectedRowId(),0).setValue(document.getElementById("cmd1").value);

    with

    CommandsGrid.cells(CommandsGrid.getSelectedRowId(),0).setValue(ConvertSpecialCharactersToEntities(document.getElementById("cmd1").value));

    replace

    Commands.splice(Commands.length,0,CommandsGrid.cells(CommandsGrid.getRowId(i),0).getValue());

    with

    Commands.splice(Commands.length,0,RestoreSpecialCharactersFromEntities(CommandsGrid.cells(CommandsGrid.getRowId(i),0).getValue()));

    and at the bottom of the file add

    function ConvertSpecialCharactersToEntities(text)
    {
    return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
    }

    function RestoreSpecialCharactersFromEntities(text)
    {
    return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
    }

  17. Cause

    RegRead on which RegKeyExists is based requires a final backslash in the key name or it won't work.

    Solution #1

    Have the RegKeyExists retry a failed check with an additional final backslash:

    In registry_dos.js replace

    function RegKeyExists(KeyBase)
    {
    position="registry_dos.js";
    whatfunc="RegKeyExists()";

    try
    {
    WshShell.RegRead(KeyBase);

    return true;
    }
    catch(ex)
    {
    return false;
    }
    }

    with

    function RegKeyExists(KeyBase)
    {
    position="registry_dos.js";
    whatfunc="RegKeyExists()";

    try
    {
    WshShell.RegRead(KeyBase);

    return true;
    }
    catch(ex)
    {
    try {
    WshShell.RegRead(KeyBase + '\\');
    return true;
    }
    catch(ex)
    {
    return false;
    }
    }
    }

    Problems of Solution #1

    Windows registry allows keys and values with same names so the new function won't allow to check for a specific type of registry entry.

    Solution #2

    Force the RegKeyExists function to check only for keys and implement an additional RegValueExists function to deal with registry values.

    In registry_dos.js replace

    function RegKeyExists(KeyBase)
    {
    position="registry_dos.js";
    whatfunc="RegKeyExists()";

    try
    {
    WshShell.RegRead(KeyBase);

    return true;
    }
    catch(ex)
    {
    return false;
    }
    }

    with

    function RegKeyExists(KeyBase)
    {
    position="registry_dos.js";
    whatfunc="RegKeyExists()";

    try
    {
    WshShell.RegRead(KeyBase + '\\');

    return true;
    }
    catch(ex)
    {
    return false;
    }
    }

    function RegValueExists(ValueBase)
    {
    position="registry_dos.js";
    whatfunc="RegValueExists()";

    try
    {
    WshShell.RegRead(ValueBase);

    return true;
    }
    catch(ex)
    {
    return false;
    }
    }

    In configwizard.js replace

    		ConditionsMenuBar.addNewChild("cond_registry", 0, "registry_RegKeyExists", "RegKeyExists()", false, "", "");
    ConditionsMenuBar.addNewChild("cond_registry", 1, "registry_RegKeyValue", "RegKeyValue()", false, "", "");

    with

    		ConditionsMenuBar.addNewChild("cond_registry", 0, "registry_RegKeyExists", "RegKeyExists()", false, "", "");
    ConditionsMenuBar.addNewChild("cond_registry", 1, "registry_RegValueExists", "RegValueExists()", false, "", "");
    ConditionsMenuBar.addNewChild("cond_registry", 2, "registry_RegKeyValue", "RegKeyValue()", false, "", "");

    then replace

    		GrayedConditionsMenuBar.addNewChild("gcond_registry", 0, "registry_RegKeyExists", "RegKeyExists()", false, "", "");
    GrayedConditionsMenuBar.addNewChild("gcond_registry", 1, "registry_RegKeyValue", "RegKeyValue()", false, "", "");

    with

    		GrayedConditionsMenuBar.addNewChild("gcond_registry", 0, "registry_RegKeyExists", "RegKeyExists()", false, "", "");
    GrayedConditionsMenuBar.addNewChild("gcond_registry", 1, "registry_RegValueExists", "RegValueExists()", false, "", "");
    GrayedConditionsMenuBar.addNewChild("gcond_registry", 2, "registry_RegKeyValue", "RegKeyValue()", false, "", "");

    and replace

    		case 'registry_RegKeyExists':
    HandleConditionsSelectionMenu(!InsertCondValues ? "RegKeyExists()" : 'RegKeyExists("HKEY_CURRENT_USER\\Software\\WPI\\Theme")');
    break;

    with

    		case 'registry_RegKeyExists':
    HandleConditionsSelectionMenu(!InsertCondValues ? "RegKeyExists()" : 'RegKeyExists("HKEY_CURRENT_USER\\Software\\WPI")');
    break;

    case 'registry_RegValueExists':
    HandleConditionsSelectionMenu(!InsertCondValues ? "RegValueExists()" : 'RegValueExists("HKEY_CURRENT_USER\\Software\\WPI\\Theme")');
    break;

    In core.js replace

    if (RegKeyExists("HKEY_CURRENT_USER\\Software\\WPI\\DisableScriptDebuggerIE"))

    with

    if (RegValueExists("HKEY_CURRENT_USER\\Software\\WPI\\DisableScriptDebuggerIE"))

    and

    if (RegKeyExists("HKEY_CURRENT_USER\\Software\\WPI\\Disable Script Debugger"))

    with

    if (RegValueExists("HKEY_CURRENT_USER\\Software\\WPI\\Disable Script Debugger"))

    In informations.js replace

    ConditionsGrid.addRow(gId++,'RegKeyExists("HKEY_CURRENT_USER\\Software\\WPI\\Theme")');

    with

    ConditionsGrid.addRow(gId++,'RegKeyExists("HKEY_CURRENT_USER\\Software\\WPI")');
    ConditionsGrid.addRow(gId++,'RegValueExists("HKEY_CURRENT_USER\\Software\\WPI\\Theme")');

    In wmi.js replace

    return RegKeyExists("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\PendingFileRenameOperations");

    with

    return RegValueExists("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\PendingFileRenameOperations");

    In installer.js replace

    if (RegKeyExists("HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\PendingFileRenameOperations"))

    with

    if (RegValueExists("HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\PendingFileRenameOperations"))

    or alternatively delete the function since a seemingly identical one with the same name is defined in wmi.js

    Problems of Solution #2

    This will break backward compatibility but it's the only proper solution to the problem.

  18. Cause

    A bug in SaveConfig tampers with the variable used to populate the Commands grid for the current application entry, causing any further selection on the grid to populate the wrong command in the command editbox, until a different application is selected.

    Fix

    Replace the following line in the HideWriteRegKey2 function of configwizard.js

    			if (configList[i].cmds.length>0)
    {
    Commands.splice(0,Commands.length);
    Commands=configList[i].cmds.split("','");
    for (var j=0; j<Commands.length; j++)
    {
    Commands[j]=Commands[j].replace(/\\/g,"\\\\").replace(/'/g,"\\'"); // For apostrophes
    Commands[j]=Commands[j].replace(/,/gi,"%comma%");
    }
    tf.WriteLine("cmds[pn]=['" + Commands.join("','") + "'];");
    }

    with

    			if (configList[i].cmds.length>0)
    {
    CurCommands=configList[i].cmds.split("','");
    for (var j=0; j<CurCommands.length; j++)
    {
    CurCommands[j]=CurCommands[j].replace(/\\/g,"\\\\").replace(/'/g,"\\'"); // For apostrophes
    CurCommands[j]=CurCommands[j].replace(/,/gi,"%comma%");
    }
    tf.WriteLine("cmds[pn]=['" + CurCommands.join("','") + "'];");
    }

  19. Cause

    The WriteRegKey expects an array and not a string for REG_MULTI_SZ values.

    Fix

    Replace the following line in the HideWriteRegKey2 function of configwizard_wizards.js

    		txt += ',"'+document.getElementById("ValueData").value.replace(/\r/g," ")+'"';

    with

    		txt += ',new Array("'+document.getElementById("ValueData").value.replace(/\r/g,'", "')+'")';

    or alternatively

    		txt += ',["'+document.getElementById("ValueData").value.replace(/\r/g,'", "')+'"]';

×
×
  • Create New...