Francesco Posted September 11, 2011 Share Posted September 11, 2011 (edited) CauseRegRead on which RegKeyExists is based requires a final backslash in the key name or it won't work.Solution #1Have 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 #1Windows 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 #2Force 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.jsProblems of Solution #2This will break backward compatibility but it's the only proper solution to the problem. Edited September 11, 2011 by Francesco Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted September 12, 2011 Share Posted September 12, 2011 done Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now