Jump to content

[BUG+FIX] WPI doesn't properly restore IE debug keys


Recommended Posts

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

Edited by Francesco
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...