Saturday, December 02, 2006

Ad-Watch Setting Can Kill .LNK and .EXE File Extensions

Since Lavasoft's Ad-Aware SE was released in August, 2004, licensed users of the Plus and Professional software have had a problem when using the Automatic setting with the election to "Lock executable file associations" in Ad-Watch. With that setting, Ad-Watch automatically blocks registry changes to the file associations when new software is installed or updated. The unfortunate result is the loss of the use of, at minimum, the .lnk and .exe file extensions. (The LNK/.lnk extension is for shortcuts.) This can also occur with the "Lock executable file associations" setting and the user allows Ad-Watch to block the changes.

Having provided help with this problem several times recently, I have decided to address the problem and solution here.
To start, realize that Ad-Watch is doing precisely as the user settings are designated. With that understanding, comes knowledge of the correct steps in the future.

From the Ad-Aware SE Help file:
"You can lock the startup sections of your registry, block possible and actual browser hijack attempts, block suspicious processes, lock executable file associations, Block malicious cookies, block Pop-ups, and uses the all new CSI technology to protect you from unknown variants as well. Even if Ad-Watch is turned off and something DOES install onto your system, it will recognize it and will kill the process as soon as it has seen it when turned back on." {Emphasis added.}
The above-described automatic action will occur only if you have Ad-Watch set to Automatic. When the Automatic setting is turned off, Ad-Watch will prompt you to accept or block the change. Although it may seem "painful" responding to numerous prompts when you are installing or updating software, it is important to realize that we are each ultimately responsible for our computer, not Lavasoft, Microsoft, Zone Alarm, McAfee, Norton, or any other software program, whether it be licensed or freeware. As a result, turning off "Automatic" will not only keep this from happening again, it will also make you aware of changes being made to your computer's registry while you are installing software.
Note: If you are NOT installing software and Ad-Watch pops up with a warning, check it out carefully because in that situation you may not want to allow the change!
In the event you have lost use of the .exe, .lnk and other file associations, there is a solution that combines the Windows XP File Associations created by Doug Knox with a script created by "Appetiser", a co-member of the former Team Lavasoft at the original Lavasoft Support Forums. This script has been used countless times with complete success.


IMPORTANT NOTE
The following instructions are provided "AS IS"
with no warranties and confer no rights.


To make things easy to navigate I would suggest creating a new folder called C:\regfixes. Then browse to Doug Knox web site and download all the file association fixes from for file types you are having problems with to the C:\regfixes folder. The following are the most common files needed. Select any others from the website that you need.
COM File Association Fix
EXE File Association Fix
LNK (Shortcut) File Association Fix
REG File Association Fix
You may also want to review the following additional references:
Instructions:

First, make sure "Automatic" is turned off. Right mouse click the Ad-Watch icon in the system tray and select "Restore Ad-Watch". At the bottom of the Ad-Watch window make sure automatic is not checked; i.e., it is a red X.




Next, you will need to restore the .exe file association.
  • In Notepad create a new file and copy/paste all the text below:
' VBScript to restore .exe file association with Windows XP
Option Explicit

Dim strComputer
Dim objRegistry,objDictionary

strComputer = "."
Set objRegistry=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

Set objDictionary = CreateObject("Scripting.Dictionary")
objDictionary.Add "HKCR",&h80000000

Call RegAddString( "HKCR", ".exe", "", "exefile")
Call RegAddString( "HKCR", ".exe", "Content Type",_
"application/x-msdownload" )
Call RegAddString( "HKCR", ".exe\PersistentHandler", "",_
"{098f2470-bae0-11cd-b579-08002b30bfeb}" )
Call RegAddString( "HKCR", "exefile", "", "Application" )
Call RegAddBinary( "HKCR", "exefile", "EditFlags", "38,07,00,00" )
Call RegAddString( "HKCR", "exefile", "TileInfo",_
"prop:FileDescription;Company;FileVersion" )
Call RegAddString( "HKCR", "exefile", "InfoTip",_
"prop:FileDescription;Company;FileVersion;Create;Size" )
Call RegAddString( "HKCR", "exefile\DefaultIcon", "", "%1" )
Call RegAddString( "HKCR", "exefile\shell", "", "" )
Call RegAddString( "HKCR", "exefile\shell\open", "", "" )
Call RegAddBinary( "HKCR", "exefile\shell\open",_
"EditFlags", "00,00,00,00" )
Call RegAddString( "HKCR", "exefile\shell\open\command", "",_
Chr(34) & "%1" & Chr(34) & Space(1) & "%*" )
Call RegAddString( "HKCR", "exefile\shell\runas", "", "" )
Call RegAddString( "HKCR", "exefile\shell\runas\command", "",_
Chr(34) & "%1" & Chr(34) & Space(1) & "%*" )
Call RegAddString( "HKCR", "exefile\shellex", "", "" )
Call RegAddString( "HKCR", "exefile\shellex\DropHandler",_
"", "{86C86720-42A0-1069-A2E8-08002B30309D}" )
Call RegAddString( "HKCR", "exefile\shellex\PropertySheetHandlers", "", "" )
Call RegAddString( "HKCR", "exefile\shellex\PropertySheetHandlers\PifProps",_
"", "{86F19A00-42A0-1069-A2E9-08002B30309D}" )
Call RegAddString( "HKCR", "exefile\shellex\PropertySheetHandlers\ShimLayer Property Page",_
"", "{513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}" )

Function RegKeyExists(rootkey, keypath)
Dim arrValueNames, arrValueTypes
If objRegistry.EnumValues(objDictionary(rootkey), keypath, arrValueNames, arrValueTypes) = 0 Then
RegKeyExists = True
Else
RegKeyExists = False
End If
End Function

Sub RegAddKey(rootkey, keypath)
objRegistry.CreateKey objDictionary(rootkey),keypath
End Sub

Sub RegAddString(rootkey, keypath, valuename, valuedata)
If Not RegKeyExists(rootkey, keypath) Then
Call RegAddKey( rootkey, keypath )
End If
objRegistry.SetStringValue objDictionary(rootkey),keypath,valuename,valuedata
End Sub

Sub RegAddBinary(rootkey, keypath, valuename, valuearray)
Dim arrValue(),arrHexValue,i,HexVal

arrHexValue = Split(Trim(valuearray),",")
i=0
For Each HexVal in arrHexValue
Redim Preserve arrValue(i)
arrValue(i) = "&h" & HexVal
i=i + 1
Next
objRegistry.SetBinaryValue objDictionary(rootKey),keypath,valuename,arrValue
Redim arrValue(0)
End Sub
  • In Notepad, select file, select save.
  • Under "Save In" use the pull-down menu and select C:\regfixes
  • Name the file xp_exe_fix.vbs
  • Under "Save as type" use the pull-down menu and select "All files"
Run the script and restore the registry keys associated with the exe file type.
  • Navigate to c:\regfixes and right mouse click on xp_exe_fix.vbs and select Open.

    Note:
    If you are running Ad-Watch, you must accept changes while this script is running in order to update to the registry.
Now the .exe file association is restored you will be able to run regedit.exe. Work through the file association fixes that you downloaded above from Doug Knox's site.
  • Press start, select run and enter the text: cmd
  • Click OK, this will open a command window
  • At the prompt in the command window enter the text in bold (please note the spaces in the command text)

    regedit /s c:\regfixes\xp_com_fix.reg

    Note: adjust the path as appropriate to where you unzipped the reg files
  • repeat the regedit command for the other reg files you may have:

    xp_regfile.reg
    linkfile_fix.reg
    etc.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Reminder:

With Ad-Watch it is vital you accept any changes that may be alerted by Ad-Watch when merging these files.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Note:

If your EXE file associations are corrupted, it can be difficult to open REGEDIT, or to even import REG files. To work around this, do the following:
  • Press CTRL-ALT-DEL to open Task Manager
  • Click File, then hold down the CTRL key and click New Task (Run).
This will open a Command Prompt window. Enter REGEDIT.EXE and press Enter.
(
Thanks to Nigel Andrews for this tip.)


7 comments:

Anonymous said...

THANK YOU!!

Anonymous said...

Thank you! You're a life saver!

Anonymous said...

excellent work! thanks!

Anonymous said...

Thank you very much. Great work. I stumbled upon your page after 3 hours of search on the internet. I want to add keywords "unable to run any exe file vbscript associate file extensions".

I am only adding those words in my comment so that the next person don't need to miss this solution.

Thank you once again.

Anonymous said...

OMG I LOVE YOU!!! I had this issue on and couldn't use any of my programs except Internet Explorer. I spent an hour on the phone with Dell, tried several system restores, and went thru dozens of websites. Everything is all fixed and I uninstalled "Ad-Watch" as soon as it was fixed. THANK YOU!

Anonymous said...

thank you guys.. this is very much appreciated!

Unknown said...

Just fixed a pc of some friends. It worked just fine. THANKS!!!!