Bug 370571 - Ability to install as a standard user on Vista is not available. r=sspitzer a=beltzner (blocking-firefox3)

This commit is contained in:
rob_strong@exchangecode.com 2007-09-29 02:48:32 -07:00
parent 82397d312b
commit 28e2665ea2
11 changed files with 1074 additions and 610 deletions

View File

@ -23,7 +23,7 @@
* Joe Hewitt <hewitt@netscape.com> (Set Background)
* Blake Ross <blake@cs.stanford.edu> (Desktop Color, DDE support)
* Jungshik Shin <jshin@mailaps.org> (I18N)
* Robert Strong <robert.bugzilla@gmail.com> (Long paths, DDE)
* Robert Strong <robert.bugzilla@gmail.com>
* Asaf Romano <mano@mozilla.com>
* Ryan Jones <sciguyryan@gmail.com>
*
@ -60,6 +60,7 @@
#include "nsBrowserCompsCID.h"
#include "nsDirectoryServiceUtils.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIWindowsRegKey.h"
#include "nsUnicharUtils.h"
@ -82,63 +83,18 @@
NS_IMPL_ISUPPORTS2(nsWindowsShellService, nsIWindowsShellService, nsIShellService)
static nsresult
OpenUserKeyForReading(HKEY aStartKey, const nsAString& aKeyName, HKEY* aKey)
OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey)
{
const nsString &flatName = PromiseFlatString(aKeyName);
DWORD res = ::RegOpenKeyExW(aStartKey, flatName.get(), 0, KEY_READ, aKey);
DWORD res = ::RegOpenKeyExW(aKeyRoot, flatName.get(), 0, KEY_READ, aKey);
switch (res) {
case ERROR_SUCCESS:
break;
case ERROR_ACCESS_DENIED:
return NS_ERROR_FILE_ACCESS_DENIED;
case ERROR_FILE_NOT_FOUND:
if (aStartKey == HKEY_LOCAL_MACHINE) {
// prevent infinite recursion on the second pass through here if
// ::RegOpenKeyEx fails in the all-users case.
return NS_ERROR_NOT_AVAILABLE;
}
return OpenUserKeyForReading(HKEY_LOCAL_MACHINE, aKeyName, aKey);
}
return NS_OK;
}
// Sets the default browser registry keys for Windows versions prior to Vista.
// Try to open / create the key in HKLM and if that fails try to do the same
// in HKCU. Though this is not strictly the behavior I would expect it is the
// same behavior that IE has when setting the default browser previous to Vista.
static nsresult
OpenKeyForWriting(HKEY aStartKey, const nsAString& aKeyName, HKEY* aKey,
PRBool aHKLMOnly)
{
const nsString &flatName = PromiseFlatString(aKeyName);
DWORD dwDisp = 0;
DWORD res = ::RegCreateKeyExW(aStartKey, flatName.get(), 0, NULL,
0, KEY_READ | KEY_WRITE, NULL, aKey,
&dwDisp);
switch (res) {
case ERROR_SUCCESS:
break;
case ERROR_ACCESS_DENIED:
if (aHKLMOnly || aStartKey == HKEY_CURRENT_USER)
return NS_ERROR_FILE_ACCESS_DENIED;
// fallback to HKCU immediately on access denied since we won't be able
// to create the key.
return OpenKeyForWriting(HKEY_CURRENT_USER, aKeyName, aKey, aHKLMOnly);
case ERROR_FILE_NOT_FOUND:
res = ::RegCreateKeyExW(aStartKey, flatName.get(), 0, NULL,
0, KEY_READ | KEY_WRITE, NULL, aKey,
NULL);
if (res != ERROR_SUCCESS) {
if (aHKLMOnly || aStartKey == HKEY_CURRENT_USER) {
// prevent infinite recursion on the second pass through here if
// ::RegCreateKey fails in the current user case.
return NS_ERROR_FILE_ACCESS_DENIED;
}
return OpenKeyForWriting(HKEY_CURRENT_USER, aKeyName, aKey, aHKLMOnly);
}
return NS_ERROR_NOT_AVAILABLE;
}
return NS_OK;
@ -147,6 +103,9 @@ OpenKeyForWriting(HKEY aStartKey, const nsAString& aKeyName, HKEY* aKey,
///////////////////////////////////////////////////////////////////////////////
// Default Browser Registry Settings
//
// The setting of these values are made by an external binary since writing
// these values may require elevation.
//
// - File Extension Mappings
// -----------------------
// The following file extensions:
@ -214,9 +173,6 @@ typedef enum {
NO_SUBSTITUTION = 0x00,
APP_PATH_SUBSTITUTION = 0x01,
EXE_NAME_SUBSTITUTION = 0x02,
UNINST_PATH_SUBSTITUTION = 0x04,
HKLM_ONLY = 0x08,
NON_ESSENTIAL = 0x10
} SettingFlags;
typedef struct {
@ -228,17 +184,8 @@ typedef struct {
} SETTING;
#define APP_REG_NAME L"Firefox"
#define SMI "SOFTWARE\\Clients\\StartMenuInternet\\"
#define CLS "SOFTWARE\\Classes\\"
#define DI "\\DefaultIcon"
#define II "\\InstallInfo"
#define SOP "\\shell\\open\\command"
#define DDE "\\shell\\open\\ddeexec\\"
#define DDE_NAME "Firefox" // This must be kept in sync with ID_DDE_APPLICATION_NAME as defined in splash.rc
#define DDE_COMMAND "\"%1\",,0,0,,,,"
// For the InstallInfo HideIconsCommand, ShowIconsCommand, and ReinstallCommand
// registry keys. This must be kept in sync with the uninstaller.
#define UNINSTALL_EXE "\\uninstall\\helper.exe"
#define CLS_HTML "FirefoxHTML"
#define CLS_URL "FirefoxURL"
@ -248,93 +195,24 @@ typedef struct {
#define MAKE_KEY_NAME1(PREFIX, MID) \
PREFIX MID
#define MAKE_KEY_NAME2(PREFIX, MID, SUFFIX) \
PREFIX MID SUFFIX
#define MAKE_KEY_NAME3(PREFIX, MID, MID2, SUFFIX) \
PREFIX MID MID2 SUFFIX
// The DefaultIcon registry key value should never be used (e.g. NON_ESSENTIAL)
// when checking if Firefox is the default browser since other applications
// (e.g. MS Office) may modify the DefaultIcon registry key value to add Icon
// Handlers.
// The DefaultIcon registry key value should never be used when checking if
// Firefox is the default browser since other applications (e.g. MS Office) may
// modify the DefaultIcon registry key value to add Icon Handlers.
// see http://msdn2.microsoft.com/en-us/library/aa969357.aspx for more info.
static SETTING gSettings[] = {
// File Extension Aliases
{ MAKE_KEY_NAME1(CLS, ".htm"), "", CLS_HTML, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME1(CLS, ".html"), "", CLS_HTML, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME1(CLS, ".shtml"), "", CLS_HTML, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME1(CLS, ".xht"), "", CLS_HTML, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME1(CLS, ".xhtml"), "", CLS_HTML, NO_SUBSTITUTION | NON_ESSENTIAL },
// File Extension Class - as of 1.8.1.2 the value for VAL_OPEN is also checked
// for CLS_HTML since Firefox should also own opeing local files when set as
// the default browser.
{ MAKE_KEY_NAME2(CLS, CLS_HTML, DI), "", VAL_FILE_ICON, APP_PATH_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME2(CLS, CLS_HTML, SOP), "", VAL_OPEN, APP_PATH_SUBSTITUTION },
{ MAKE_KEY_NAME1(CLS_HTML, SOP), "", VAL_OPEN, APP_PATH_SUBSTITUTION },
// Protocol Handler Class - for Vista and above
{ MAKE_KEY_NAME2(CLS, CLS_URL, DI), "", VAL_FILE_ICON, APP_PATH_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME2(CLS, CLS_URL, SOP), "", VAL_OPEN, APP_PATH_SUBSTITUTION },
{ MAKE_KEY_NAME1(CLS_URL, SOP), "", VAL_OPEN, APP_PATH_SUBSTITUTION },
// Protocol Handlers
{ MAKE_KEY_NAME2(CLS, "HTTP", DI), "", VAL_FILE_ICON, APP_PATH_SUBSTITUTION },
{ MAKE_KEY_NAME2(CLS, "HTTP", SOP), "", VAL_OPEN, APP_PATH_SUBSTITUTION },
{ MAKE_KEY_NAME2(CLS, "HTTPS", DI), "", VAL_FILE_ICON, APP_PATH_SUBSTITUTION },
{ MAKE_KEY_NAME2(CLS, "HTTPS", SOP), "", VAL_OPEN, APP_PATH_SUBSTITUTION },
{ MAKE_KEY_NAME2(CLS, "FTP", DI), "", VAL_FILE_ICON, APP_PATH_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME2(CLS, "FTP", SOP), "", VAL_OPEN, APP_PATH_SUBSTITUTION | NON_ESSENTIAL },
// DDE settings
{ MAKE_KEY_NAME2(CLS, CLS_HTML, DDE), "", DDE_COMMAND, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME3(CLS, CLS_HTML, DDE, "Application"), "", DDE_NAME, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME3(CLS, CLS_HTML, DDE, "Topic"), "", "WWW_OpenURL", NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME2(CLS, CLS_URL, DDE), "", DDE_COMMAND, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME3(CLS, CLS_URL, DDE, "Application"), "", DDE_NAME, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME3(CLS, CLS_URL, DDE, "Topic"), "", "WWW_OpenURL", NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME2(CLS, "HTTP", DDE), "", DDE_COMMAND, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME3(CLS, "HTTP", DDE, "Application"), "", DDE_NAME, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME3(CLS, "HTTP", DDE, "Topic"), "", "WWW_OpenURL", NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME2(CLS, "HTTPS", DDE), "", DDE_COMMAND, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME3(CLS, "HTTPS", DDE, "Application"), "", DDE_NAME, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME3(CLS, "HTTPS", DDE, "Topic"), "", "WWW_OpenURL", NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME2(CLS, "FTP", DDE), "", DDE_COMMAND, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME3(CLS, "FTP", DDE, "Application"), "", DDE_NAME, NO_SUBSTITUTION | NON_ESSENTIAL },
{ MAKE_KEY_NAME3(CLS, "FTP", DDE, "Topic"), "", "WWW_OpenURL", NO_SUBSTITUTION | NON_ESSENTIAL },
// Windows XP Start Menu
{ MAKE_KEY_NAME2(SMI, "%APPEXE%", DI),
"",
"%APPPATH%,0",
APP_PATH_SUBSTITUTION | EXE_NAME_SUBSTITUTION | HKLM_ONLY | NON_ESSENTIAL },
{ MAKE_KEY_NAME2(SMI, "%APPEXE%", II),
"HideIconsCommand",
"\"%UNINSTPATH%\" /HideShortcuts",
UNINST_PATH_SUBSTITUTION | EXE_NAME_SUBSTITUTION | HKLM_ONLY | NON_ESSENTIAL },
{ MAKE_KEY_NAME2(SMI, "%APPEXE%", II),
"ReinstallCommand",
"\"%UNINSTPATH%\" /SetAsDefaultAppGlobal",
UNINST_PATH_SUBSTITUTION | EXE_NAME_SUBSTITUTION | HKLM_ONLY | NON_ESSENTIAL },
{ MAKE_KEY_NAME2(SMI, "%APPEXE%", II),
"ShowIconsCommand",
"\"%UNINSTPATH%\" /ShowShortcuts",
UNINST_PATH_SUBSTITUTION | EXE_NAME_SUBSTITUTION | HKLM_ONLY | NON_ESSENTIAL },
{ MAKE_KEY_NAME2(SMI, "%APPEXE%", SOP),
"",
"%APPPATH%",
APP_PATH_SUBSTITUTION | EXE_NAME_SUBSTITUTION | HKLM_ONLY | NON_ESSENTIAL },
{ MAKE_KEY_NAME1(SMI, "%APPEXE%\\shell\\properties\\command"),
"",
"\"%APPPATH%\" -preferences",
APP_PATH_SUBSTITUTION | EXE_NAME_SUBSTITUTION | HKLM_ONLY | NON_ESSENTIAL },
{ MAKE_KEY_NAME1(SMI, "%APPEXE%\\shell\\safemode\\command"),
"",
"\"%APPPATH%\" -safe-mode",
APP_PATH_SUBSTITUTION | EXE_NAME_SUBSTITUTION | HKLM_ONLY | NON_ESSENTIAL }
// These values must be set by hand, since they contain localized strings.
// firefox.exe\shell\properties (default) REG_SZ Firefox &Options
// firefox.exe\shell\safemode (default) REG_SZ Firefox &Safe Mode
{ MAKE_KEY_NAME1("HTTP", DI), "", VAL_FILE_ICON, APP_PATH_SUBSTITUTION },
{ MAKE_KEY_NAME1("HTTP", SOP), "", VAL_OPEN, APP_PATH_SUBSTITUTION },
{ MAKE_KEY_NAME1("HTTPS", DI), "", VAL_FILE_ICON, APP_PATH_SUBSTITUTION },
{ MAKE_KEY_NAME1("HTTPS", SOP), "", VAL_OPEN, APP_PATH_SUBSTITUTION }
};
@ -411,39 +289,15 @@ nsWindowsShellService::IsDefaultBrowserVista(PRBool aStartupCheck, PRBool* aIsDe
return PR_FALSE;
}
PRBool
nsWindowsShellService::SetDefaultBrowserVista()
{
IApplicationAssociationRegistration* pAAR;
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationReg,
NULL,
CLSCTX_INPROC,
IID_IApplicationAssociationReg,
(void**)&pAAR);
if (SUCCEEDED(hr)) {
hr = pAAR->SetAppAsDefaultAll(APP_REG_NAME);
pAAR->Release();
return PR_TRUE;
}
return PR_FALSE;
}
NS_IMETHODIMP
nsWindowsShellService::IsDefaultBrowser(PRBool aStartupCheck,
PRBool* aIsDefaultBrowser)
{
// To support side by side installs on Vista we also need to check if the
// FirefoxHTML and FirefoxURL registry keys in HKLM / HKCU point to our
// install location. If the HKLM keys point to this install location we have
// to verify that the keys don't exist in HKCU and remove them if the app is
// then set as default. If the HKLM keys don't point to this install location
// then we have to add these keys in HKCU to over-ride the HKLM keys.
if (IsDefaultBrowserVista(aStartupCheck, aIsDefaultBrowser))
return NS_OK;
// If this is the first browser window, maintain internal state that we've
// checked this session (so that subsequent window opens don't show the
// default browser dialog).
if (aStartupCheck)
mCheckedThisSession = PR_TRUE;
SETTING* settings;
SETTING* end = gSettings + sizeof(gSettings)/sizeof(SETTING);
@ -478,9 +332,6 @@ nsWindowsShellService::IsDefaultBrowser(PRBool aStartupCheck,
PRUnichar currValue[MAX_BUF];
for (settings = gSettings; settings < end; ++settings) {
if (settings->flags & NON_ESSENTIAL)
continue; // This is not a registry key that determines whether
// or not we consider Firefox the "Default Browser."
NS_ConvertUTF8toUTF16 dataLongPath(settings->valueData);
NS_ConvertUTF8toUTF16 dataShortPath(settings->valueData);
NS_ConvertUTF8toUTF16 key(settings->keyName);
@ -502,7 +353,7 @@ nsWindowsShellService::IsDefaultBrowser(PRBool aStartupCheck,
::ZeroMemory(currValue, sizeof(currValue));
HKEY theKey;
rv = OpenUserKeyForReading(HKEY_CURRENT_USER, key, &theKey);
rv = OpenKeyForReading(HKEY_CLASSES_ROOT, key, &theKey);
if (NS_SUCCEEDED(rv)) {
DWORD len = sizeof currValue;
DWORD res = ::RegQueryValueExW(theKey, PromiseFlatString(value).get(),
@ -514,252 +365,62 @@ nsWindowsShellService::IsDefaultBrowser(PRBool aStartupCheck,
!dataShortPath.Equals(currValue, CaseInsensitiveCompare)) {
// Key wasn't set, or was set to something else (something else became the default browser)
*aIsDefaultBrowser = PR_FALSE;
break;
return NS_OK;
}
}
}
// If this is the first browser window, maintain internal state that we've
// checked this session (so that subsequent window opens don't show the
// default browser dialog).
if (aStartupCheck)
mCheckedThisSession = PR_TRUE;
// Only check if Firefox is the default browser on Vista if the previous
// checks show that Firefox is the default browser.
if (aIsDefaultBrowser)
IsDefaultBrowserVista(aStartupCheck, aIsDefaultBrowser);
return NS_OK;
}
DWORD
nsWindowsShellService::DeleteRegKeyDefaultValue(HKEY baseKey,
const nsString& keyName)
{
HKEY key;
DWORD res = ::RegOpenKeyExW(baseKey, keyName.get(),
0, KEY_WRITE, &key);
if (res == ERROR_SUCCESS) {
res = ::RegDeleteValueW(key, EmptyString().get());
::RegCloseKey(key);
}
return res;
}
NS_IMETHODIMP
nsWindowsShellService::SetDefaultBrowser(PRBool aClaimAllTypes, PRBool aForAllUsers)
{
// Delete the protocol and file handlers under HKCU if they exist. This way
// the HKCU registry is cleaned up when HKLM is writeable or if it isn't
// the values will then be added under HKCU.
(void)DeleteRegKey(HKEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Classes\\http\\shell\\open"));
(void)DeleteRegKey(HKEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Classes\\http\\DefaultIcon"));
(void)DeleteRegKey(HKEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Classes\\https\\shell\\open"));
(void)DeleteRegKey(HKEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Classes\\https\\DefaultIcon"));
(void)DeleteRegKey(HKEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Classes\\ftp\\shell\\open"));
(void)DeleteRegKey(HKEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Classes\\ftp\\DefaultIcon"));
(void)DeleteRegKey(HKEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Classes\\FirefoxURL"));
(void)DeleteRegKey(HKEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Classes\\FirefoxHTML"));
nsresult rv;
nsCOMPtr<nsIProperties> directoryService =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
(void)DeleteRegKeyDefaultValue(HKEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Classes\\.htm"));
(void)DeleteRegKeyDefaultValue(HKEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Classes\\.html"));
(void)DeleteRegKeyDefaultValue(HKEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Classes\\.shtml"));
(void)DeleteRegKeyDefaultValue(HKEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Classes\\.xht"));
(void)DeleteRegKeyDefaultValue(HKEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Classes\\.xhtml"));
nsCOMPtr<nsILocalFile> appHelper;
rv = directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(appHelper));
NS_ENSURE_SUCCESS(rv, rv);
if (!aForAllUsers && SetDefaultBrowserVista())
return NS_OK;
rv = appHelper->AppendNative(NS_LITERAL_CSTRING("uninstall"));
NS_ENSURE_SUCCESS(rv, rv);
SETTING* settings;
SETTING* end = gSettings + sizeof(gSettings)/sizeof(SETTING);
rv = appHelper->AppendNative(NS_LITERAL_CSTRING("helper.exe"));
NS_ENSURE_SUCCESS(rv, rv);
PRUnichar exePath[MAX_BUF];
if (!::GetModuleFileNameW(0, exePath, MAX_BUF))
return NS_ERROR_FAILURE;
nsCAutoString appHelperPath;
rv = appHelper->GetNativePath(appHelperPath);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString appLongPath(exePath);
nsCOMPtr<nsILocalFile> lf;
nsresult rv = NS_NewLocalFile(nsDependentString(exePath), PR_TRUE,
getter_AddRefs(lf));
if (NS_FAILED(rv))
return rv;
nsAutoString exeName;
rv = lf->GetLeafName(exeName);
if (NS_FAILED(rv))
return rv;
ToUpperCase(exeName);
nsCOMPtr<nsIFile> appDir;
rv = lf->GetParent(getter_AddRefs(appDir));
if (NS_FAILED(rv))
return rv;
nsAutoString uninstLongPath;
appDir->GetPath(uninstLongPath);
uninstLongPath.AppendLiteral(UNINSTALL_EXE);
for (settings = gSettings; settings < end; ++settings) {
NS_ConvertUTF8toUTF16 dataLongPath(settings->valueData);
NS_ConvertUTF8toUTF16 key(settings->keyName);
NS_ConvertUTF8toUTF16 value(settings->valueName);
if (settings->flags & APP_PATH_SUBSTITUTION) {
PRInt32 offset = dataLongPath.Find("%APPPATH%");
dataLongPath.Replace(offset, 9, appLongPath);
}
if (settings->flags & UNINST_PATH_SUBSTITUTION) {
PRInt32 offset = dataLongPath.Find("%UNINSTPATH%");
dataLongPath.Replace(offset, 12, uninstLongPath);
}
if (settings->flags & EXE_NAME_SUBSTITUTION) {
PRInt32 offset = key.Find("%APPEXE%");
key.Replace(offset, 8, exeName);
}
SetRegKey(key, value, dataLongPath,
(settings->flags & HKLM_ONLY));
if (aForAllUsers) {
appHelperPath.AppendLiteral(" /SetAsDefaultAppGlobal");
} else {
appHelperPath.AppendLiteral(" /SetAsDefaultAppUser");
}
// Select the Default Browser for the Windows XP Start Menu
SetRegKey(NS_LITERAL_STRING(SMI), EmptyString(), exeName, PR_TRUE);
STARTUPINFO si = {sizeof(si), 0};
PROCESS_INFORMATION pi = {0};
nsCOMPtr<nsIStringBundleService>
bundleService(do_GetService("@mozilla.org/intl/stringbundle;1"));
if (!bundleService)
BOOL ok = CreateProcess(NULL, (LPSTR)appHelperPath.get(), NULL, NULL,
FALSE, 0, NULL, NULL, &si, &pi);
if (!ok)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIStringBundle> bundle, brandBundle;
rv = bundleService->CreateBundle(SHELLSERVICE_PROPERTIES, getter_AddRefs(bundle));
NS_ENSURE_SUCCESS(rv, rv);
rv = bundleService->CreateBundle(BRAND_PROPERTIES, getter_AddRefs(brandBundle));
NS_ENSURE_SUCCESS(rv, rv);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
// Create the Start Menu item if it doesn't exist
nsString brandFullName;
brandBundle->GetStringFromName(NS_LITERAL_STRING("brandFullName").get(),
getter_Copies(brandFullName));
nsAutoString key1(NS_LITERAL_STRING(SMI));
key1.Append(exeName);
key1.AppendLiteral("\\");
SetRegKey(key1, EmptyString(), brandFullName, PR_TRUE);
// Set the Options and Safe Mode start menu context menu item labels
nsAutoString optionsKey(NS_LITERAL_STRING(SMI));
optionsKey.Append(exeName);
optionsKey.AppendLiteral("\\shell\\properties");
nsAutoString safeModeKey(NS_LITERAL_STRING(SMI));
safeModeKey.Append(exeName);
safeModeKey.AppendLiteral("\\shell\\safemode");
nsString brandShortName;
brandBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
getter_Copies(brandShortName));
const PRUnichar* brandNameStrings[] = { brandShortName.get() };
// Set the Options menu item
nsString optionsTitle;
bundle->FormatStringFromName(NS_LITERAL_STRING("optionsLabel").get(),
brandNameStrings, 1,
getter_Copies(optionsTitle));
// Set the Safe Mode menu item
nsString safeModeTitle;
bundle->FormatStringFromName(NS_LITERAL_STRING("safeModeLabel").get(),
brandNameStrings, 1,
getter_Copies(safeModeTitle));
// Set the registry keys
SetRegKey(optionsKey, EmptyString(), optionsTitle, PR_TRUE);
SetRegKey(safeModeKey, EmptyString(), safeModeTitle, PR_TRUE);
// Refresh the Shell
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
return NS_OK;
}
// Utility function to delete a registry subkey.
DWORD
nsWindowsShellService::DeleteRegKey(HKEY baseKey, const nsString& keyName)
{
// Make sure input subkey isn't null.
if (keyName.IsEmpty())
return ERROR_BADKEY;
const nsString &flatName = PromiseFlatString(keyName);
// Open subkey.
HKEY key;
DWORD res = ::RegOpenKeyExW(baseKey, flatName.get(), 0,
KEY_ENUMERATE_SUB_KEYS | DELETE, &key);
// Continue till we get an error or are done.
while (res == ERROR_SUCCESS) {
PRUnichar subkeyName[MAX_PATH];
DWORD len = sizeof subkeyName;
// Get first subkey name. Note that we always get the
// first one, then delete it. So we need to get
// the first one next time, also.
res = ::RegEnumKeyExW(key, 0, subkeyName, &len, NULL, NULL,
NULL, NULL);
if (res == ERROR_NO_MORE_ITEMS) {
// No more subkeys. Delete the main one.
res = ::RegDeleteKeyW(baseKey, flatName.get());
break;
}
// If we find another subkey, delete it, recursively.
if (res == ERROR_SUCCESS)
res = DeleteRegKey(key, nsDependentString(subkeyName));
}
// Close the key we opened.
::RegCloseKey(key);
return res;
}
void
nsWindowsShellService::SetRegKey(const nsString& aKeyName,
const nsString& aValueName,
const nsString& aValue, PRBool aHKLMOnly)
{
PRUnichar buf[MAX_BUF];
DWORD len = sizeof buf;
HKEY theKey;
nsresult rv = OpenKeyForWriting(HKEY_LOCAL_MACHINE, aKeyName, &theKey,
aHKLMOnly);
if (NS_FAILED(rv))
return;
// Get the old value
DWORD res = ::RegQueryValueExW(theKey, PromiseFlatString(aValueName).get(),
NULL, NULL, (LPBYTE)buf, &len);
// Set the new value
nsAutoString current(buf);
if (REG_FAILED(res) || !current.Equals(aValue)) {
const nsString &flatValue = PromiseFlatString(aValue);
::RegSetValueExW(theKey, PromiseFlatString(aValueName).get(),
0, REG_SZ, (const BYTE *)flatValue.get(),
(flatValue.Length() + 1) * sizeof(PRUnichar));
}
// Close the key we opened.
::RegCloseKey(theKey);
}
NS_IMETHODIMP
nsWindowsShellService::GetShouldCheckDefaultBrowser(PRBool* aResult)
{
@ -1007,13 +668,10 @@ nsWindowsShellService::OpenApplication(PRInt32 aApplication)
// \Client Subkey Name\shell\open\command\
// \Client Subkey Name\shell\open\command\(default) = path to exe
//
nsAutoString clientKey;
clientKey.AssignLiteral("SOFTWARE\\Clients\\");
clientKey.Append(application);
// Find the default application for this class.
HKEY theKey;
nsresult rv = OpenUserKeyForReading(HKEY_CURRENT_USER, clientKey, &theKey);
nsresult rv = OpenKeyForReading(HKEY_CLASSES_ROOT, application, &theKey);
if (NS_FAILED(rv))
return rv;
@ -1029,11 +687,11 @@ nsWindowsShellService::OpenApplication(PRInt32 aApplication)
::RegCloseKey(theKey);
// Find the "open" command
clientKey.AppendLiteral("\\");
clientKey.Append(buf);
clientKey.AppendLiteral("\\shell\\open\\command");
application.AppendLiteral("\\");
application.Append(buf);
application.AppendLiteral("\\shell\\open\\command");
rv = OpenUserKeyForReading(HKEY_CURRENT_USER, clientKey, &theKey);
rv = OpenKeyForReading(HKEY_CLASSES_ROOT, application, &theKey);
if (NS_FAILED(rv))
return rv;

View File

@ -35,7 +35,9 @@
# ***** END LICENSE BLOCK *****
# Required Plugins:
# ShellLink http://nsis.sourceforge.net/ShellLink_plug-in
# SetVistaDefaultApp http://nsis.sourceforge.net/SetVistaDefaultApp_plug-in
# ShellLink http://nsis.sourceforge.net/ShellLink_plug-in
# UAC http://nsis.sourceforge.net/UAC_plug-in
; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs
!verbose 3
@ -54,6 +56,9 @@ CRCCheck on
!system 'echo ; > shortcuts.ini'
!system 'echo ; > summary.ini'
; USE_UAC_PLUGIN is temporary until Thunderbird has been updated to use the UAC plugin
!define USE_UAC_PLUGIN
Var TmpVal
Var StartMenuDir
Var InstallType
@ -75,16 +80,17 @@ Var AddDesktopSC
; available.
!include /NONFATAL WinVer.nsh
!ifdef ___WINVER__NSH___
RequestExecutionLevel admin
RequestExecutionLevel user
!else
!warning "Installer will be created without Vista compatibility.$\n \
Upgrade your NSIS installation to at least version 2.22 to resolve."
!endif
!insertmacro StrFilter
!insertmacro WordFind
!insertmacro WordReplace
!insertmacro GetOptions
!insertmacro GetParameters
!insertmacro GetSize
!insertmacro StrFilter
!insertmacro WordReplace
; NSIS provided macros that we have overridden
!include overrides.nsh
@ -103,10 +109,13 @@ VIAddVersionKey "FileDescription" "${BrandShortName} Installer"
; Must be inserted before other macros that use logging
!insertmacro _LoggingCommon
!insertmacro AddHandlerValues
!insertmacro AddDDEHandlerValues
!insertmacro CloseApp
!insertmacro CreateRegKey
!insertmacro GetPathFromString
!insertmacro IsHandlerForInstallDir
!insertmacro ManualCloseAppPrompt
!insertmacro RegCleanAppHandler
!insertmacro RegCleanMain
!insertmacro RegCleanUninstall
!insertmacro WriteRegStr2
@ -365,29 +374,25 @@ Section "-Application" APP_IDX
StrCpy $AddDesktopSC "1"
${EndIf}
; Remove registry entries for non-existent apps and for apps that point to our
; install location in the Software\Mozilla key and uninstall registry entries
; that point to our install location for both HKCU and HKLM.
${LogHeader} "Adding Registry Entries"
SetShellVarContext current ; Set SHCTX to HKCU
${RegCleanMain} "Software\Mozilla"
${RegCleanUninstall}
SetShellVarContext all ; Set SHCTX to HKLM
${RegCleanMain} "Software\Mozilla"
${RegCleanUninstall}
${LogHeader} "Adding Registry Entries"
ClearErrors
WriteRegStr HKLM "Software\Mozilla\InstallerTest" "InstallerTest" "Test"
${If} ${Errors}
SetShellVarContext current ; Set SHCTX to HKCU
StrCpy $TmpVal "HKCU" ; used primarily for logging
${Else}
SetShellVarContext all ; Set SHCTX to HKLM
DeleteRegKey HKLM "Software\Mozilla\InstallerTest"
StrCpy $TmpVal "HKLM" ; used primarily for logging
${RegCleanMain} "Software\Mozilla"
${RegCleanUninstall}
${EndIf}
${RemoveDeprecatedKeys}
; The previous installer adds several regsitry values to both HKLM and HKCU.
; We now try to add to HKLM and if that fails to HKCU
@ -404,6 +409,18 @@ Section "-Application" APP_IDX
${WriteRegDWORD2} $TmpVal "$0" "Create Start Menu Shortcut" $AddStartMenuSC 0
${FixClassKeys}
${UpdateProtocolHandlers}
; On install always add the FirefoxHTML and FirefoxURL keys.
; An empty string is used for the 5th param because FirefoxHTML is not a
; protocol handler.
${AddDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" "${AppRegName} Document" "" \
"${DDEApplication}" "$3" "WWW_OpenURL"
${AddDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" "true" \
"${DDEApplication}" "$3" "WWW_OpenURL"
${FixShellIconHandler}
; The following keys should only be set if we can write to HKLM
${If} $TmpVal == "HKLM"
@ -415,10 +432,10 @@ Section "-Application" APP_IDX
; If we are writing to HKLM and create the quick launch and the desktop
; shortcuts set IconsVisible to 1 otherwise to 0.
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo"
${If} $AddQuickLaunchSC == 1
${OrIf} $AddDesktopSC == 1
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo"
WriteRegDWORD HKLM "$0" "IconsVisible" 1
${Else}
WriteRegDWORD HKLM "$0" "IconsVisible" 0
@ -595,10 +612,32 @@ Function CopyFile
FunctionEnd
Function LaunchApp
${GetParameters} $0
${If} $0 != ""
ClearErrors
${GetOptions} "$0" "/UAC:" $1
${Unless} ${Errors}
GetFunctionAddress $0 LaunchAppFromElevatedProcess
UAC::ExecCodeSegment $0
Quit
${EndUnless}
${EndIf}
${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_LAUNCH)"
Exec "$INSTDIR\${FileMainEXE}"
FunctionEnd
Function LaunchAppFromElevatedProcess
${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_LAUNCH)"
; Find the installation directory when launching using GetFunctionAddress
; from an elevated installer since $INSTDIR will not be set in this installer
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" ""
${GetPathFromString} "$0" $0
Exec "$0"
FunctionEnd
################################################################################
# Language
@ -746,3 +785,11 @@ Function .onInit
SectionSetText ${DOMI_IDX} ""
${EndIf}
FunctionEnd
Function .OnInstFailed
UAC::Unload
FunctionEnd
Function .OnInstSuccess
UAC::Unload
FunctionEnd

View File

@ -35,26 +35,34 @@
# ***** END LICENSE BLOCK *****
!macro PostUpdate
SetShellVarContext all
${SetStartMenuInternet}
; Remove registry entries for non-existent apps and for apps that point to our
; install location in the Software\Mozilla key and uninstall registry entries
; that point to our install location for both HKCU and HKLM.
SetShellVarContext current ; Set SHCTX to HKCU
SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU)
${RegCleanMain} "Software\Mozilla"
${RegCleanUninstall}
SetShellVarContext all ; Set SHCTX to HKLM
${RegCleanMain} "Software\Mozilla"
${RegCleanUninstall}
ClearErrors
WriteRegStr HKLM "Software\Mozilla\InstallerTest" "InstallerTest" "Test"
${If} ${Errors}
StrCpy $TmpVal "HKCU" ; used primarily for logging
${Else}
SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM)
DeleteRegKey HKLM "Software\Mozilla\InstallerTest"
StrCpy $TmpVal "HKLM" ; used primarily for logging
${RegCleanMain} "Software\Mozilla"
${RegCleanUninstall}
${SetStartMenuInternet}
${FixShellIconHandler}
${SetUninstallKeys}
${EndIf}
${RemoveDeprecatedKeys}
; Add Software\Mozilla\ registry entries
${SetAppKeys}
${SetUninstallKeys}
${FixClassKeys}
${UpdateProtocolHandlers}
; Remove files that may be left behind by the application in the
; VirtualStore directory.
@ -68,24 +76,74 @@
!define PostUpdate "!insertmacro PostUpdate"
!macro SetAsDefaultAppUser
SetShellVarContext current
; It is only possible to set this installation of the application as the
; StartMenuInternet handler if it was added to the HKLM StartMenuInternet
; registry keys.
; http://support.microsoft.com/kb/297878
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
ClearErrors
ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" ""
IfErrors updateclientkeys +1
${GetPathFromString} "$0" $0
${GetParent} "$0" $0
IfFileExists "$0" +1 updateclientkeys
${GetLongPath} "$0" $0
StrCmp "$0" "$INSTDIR" setdefaultuser +1
updateclientkeys:
; Calls after ElevateUAC won't be made if the user can elevate. They
; will be made in the new elevated process if the user allows elevation.
${ElevateUAC}
${SetStartMenuInternet}
setdefaultuser:
SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM)
${FixShellIconHandler}
WriteRegStr HKCU "Software\Clients\StartMenuInternet" "" "$R9"
!ifdef ___WINVER__NSH___
${If} ${AtLeastWinVista}
ClearErrors
ReadRegStr $0 HKLM "Software\RegisteredApplications" "${AppRegName}"
; Only register as the handler on Vista if the app registry name exists
; under the RegisteredApplications registry key.
${Unless} ${Errors}
SetVistaDefaultApp::SetAsDefault "${AppRegName}"
${EndUnless}
${EndIf}
!endif
${RemoveDeprecatedKeys}
SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU)
${SetHandlers}
!macroend
!define SetAsDefaultAppUser "!insertmacro SetAsDefaultAppUser"
!macro SetAsDefaultAppGlobal
SetShellVarContext all
${RemoveDeprecatedKeys}
SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM)
${SetHandlers}
${SetStartMenuInternet}
WriteRegStr HKLM "Software\Clients\StartMenuInternet" "" "$R9"
${FixShellIconHandler}
${ShowShortcuts}
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
WriteRegStr HKLM "Software\Clients\StartMenuInternet" "" "$R9"
!macroend
!define SetAsDefaultAppGlobal "!insertmacro SetAsDefaultAppGlobal"
!macro FixReg
${SetAsDefaultAppUser}
!macroend
!define FixReg "!insertmacro FixReg"
!macro HideShortcuts
${StrFilter} "${FileMainEXE}" "+" "" "" $0
StrCpy $R1 "Software\Clients\StartMenuInternet\$0\InstallInfo"
WriteRegDWORD HKLM $R1 "IconsVisible" 0
WriteRegDWORD HKLM "$R1" "IconsVisible" 0
SetShellVarContext all ; Set $DESKTOP to All Users
${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
SetShellVarContext current ; Set $DESKTOP to the current user's desktop
@ -122,7 +180,7 @@
!macro ShowShortcuts
${StrFilter} "${FileMainEXE}" "+" "" "" $0
StrCpy $R1 "Software\Clients\StartMenuInternet\$0\InstallInfo"
WriteRegDWORD HKLM $R1 "IconsVisible" 1
WriteRegDWORD HKLM "$R1" "IconsVisible" 1
SetShellVarContext all ; Set $DESKTOP to All Users
${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\${FileMainEXE}" 0
@ -143,38 +201,70 @@
!define ShowShortcuts "!insertmacro ShowShortcuts"
!macro SetHandlers
GetFullPathName $8 "$INSTDIR\${FileMainEXE}"
${GetLongPath} "$INSTDIR\${FileMainEXE}" $8
StrCpy $0 "SOFTWARE\Classes"
StrCpy $2 "$\"$8$\" -requestPending -osint -url $\"%1$\""
; Associate the file handlers with FirefoxHTML
WriteRegStr SHCTX "$0\.htm" "" "FirefoxHTML"
WriteRegStr SHCTX "$0\.html" "" "FirefoxHTML"
WriteRegStr SHCTX "$0\.shtml" "" "FirefoxHTML"
WriteRegStr SHCTX "$0\.xht" "" "FirefoxHTML"
WriteRegStr SHCTX "$0\.xhtml" "" "FirefoxHTML"
ReadRegStr $6 HKCR ".htm" ""
${If} "$6" != "FirefoxHTML"
WriteRegStr SHCTX "$0\.htm" "" "FirefoxHTML"
${EndIf}
ReadRegStr $6 HKCR ".html" ""
${If} "$6" != "FirefoxHTML"
WriteRegStr SHCTX "$0\.html" "" "FirefoxHTML"
${EndIf}
ReadRegStr $6 HKCR ".shtml" ""
${If} "$6" != "FirefoxHTML"
WriteRegStr SHCTX "$0\.shtml" "" "FirefoxHTML"
${EndIf}
ReadRegStr $6 HKCR ".hht" ""
${If} "$6" != "FirefoxHTML"
WriteRegStr SHCTX "$0\.xht" "" "FirefoxHTML"
${EndIf}
ReadRegStr $6 HKCR ".xhtml" ""
${If} "$6" != "FirefoxHTML"
WriteRegStr SHCTX "$0\.xhtml" "" "FirefoxHTML"
${EndIf}
StrCpy $3 "$\"%1$\",,0,0,,,,"
; An empty string is used for the 5th param because FirefoxHTML is not a
; protocol handler
${AddHandlerValues} "$0\FirefoxHTML" "$2" "$8,1" "${AppRegName} Document" "" "true"
${AddDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" "${AppRegName} Document" "" \
"${DDEApplication}" "$3" "WWW_OpenURL"
${AddHandlerValues} "$0\FirefoxURL" "$2" "$8,1" "${AppRegName} URL" "true" "true"
${AddDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" "true" \
"${DDEApplication}" "$3" "WWW_OpenURL"
; An empty string is used for the 4th & 5th params because the following
; protocol handlers already have a display name and additional keys required
; for a protocol handler.
${AddHandlerValues} "$0\ftp" "$2" "$8,1" "" "" "true"
${AddHandlerValues} "$0\http" "$2" "$8,1" "" "" "true"
${AddHandlerValues} "$0\https" "$2" "$8,1" "" "" "true"
; protocol handlers already have a display name and the additional keys
; required for a protocol handler.
${AddDDEHandlerValues} "ftp" "$2" "$8,1" "" "" \
"${DDEApplication}" "$3" "WWW_OpenURL"
${AddDDEHandlerValues} "http" "$2" "$8,1" "" "" \
"${DDEApplication}" "$3" "WWW_OpenURL"
${AddDDEHandlerValues} "https" "$2" "$8,1" "" "" \
"${DDEApplication}" "$3" "WWW_OpenURL"
!macroend
!define SetHandlers "!insertmacro SetHandlers"
; XXXrstrong - there are several values that will be overwritten by and
; overwrite other installs of the same application.
; The values for StartMenuInternet are only valid under HKLM and there can only
; be one installation registerred under StartMenuInternet per application since
; the key name is derived from the main application executable.
; http://support.microsoft.com/kb/297878
;
; Note: we might be able to get away with using the full path to the
; application executable for the key name in order to support multiple
; installations.
!macro SetStartMenuInternet
GetFullPathName $8 "$INSTDIR\${FileMainEXE}"
GetFullPathName $7 "$INSTDIR\uninstall\helper.exe"
${GetLongPath} "$INSTDIR\${FileMainEXE}" $8
${GetLongPath} "$INSTDIR\uninstall\helper.exe" $7
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
@ -190,6 +280,18 @@
WriteRegStr HKLM "$0\InstallInfo" "ShowIconsCommand" "$\"$7$\" /ShowShortcuts"
WriteRegStr HKLM "$0\InstallInfo" "ReinstallCommand" "$\"$7$\" /SetAsDefaultAppGlobal"
ClearErrors
ReadRegDWORD $1 HKLM "$0\InstallInfo" "IconsVisible"
; If the IconsVisible name vale pair doesn't exist add it otherwise the
; application won't be displayed in Set Program Access and Defaults.
${If} ${Errors}
${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk"
WriteRegDWORD HKLM "$0\InstallInfo" "IconsVisible" 1
${Else}
WriteRegDWORD HKLM "$0\InstallInfo" "IconsVisible" 0
${EndIf}
${EndIf}
WriteRegStr HKLM "$0\shell\open\command" "" "$8"
WriteRegStr HKLM "$0\shell\properties" "" "$(CONTEXT_OPTIONS)"
@ -215,28 +317,19 @@
WriteRegStr HKLM "$0\Capabilities\URLAssociations" "http" "FirefoxURL"
WriteRegStr HKLM "$0\Capabilities\URLAssociations" "https" "FirefoxURL"
; Delete gopher from Capabilities\URLAssociations if it is present.
ClearErrors
ReadRegStr $2 HKLM "$0\Capabilities\URLAssociations" "gopher"
${Unless} ${Errors}
DeleteRegValue HKLM "$0\Capabilities\URLAssociations" "gopher"
${EndUnless}
; Delete gopher from the user's UrlAssociations if it points to FirefoxURL.
ReadRegStr $2 HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\gopher\UserChoice" "Progid"
${If} $2 == "FirefoxURL"
DeleteRegKey HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\gopher"
${EndIf}
; Vista Registered Application
WriteRegStr HKLM "Software\RegisteredApplications" "${AppRegName}" "$0\Capabilities"
!macroend
!define SetStartMenuInternet "!insertmacro SetStartMenuInternet"
!macro FixShellIconHandler
; The IconHandler reference for FirefoxHTML can end up in an inconsistent
; state due to changes not being detected by the IconHandler for side by side
; installs. The symptoms can be either an incorrect icon or no icon being
; displayed for files associated with Firefox. By setting it here it will
; always reference the install referenced in the
; HKLM\Software\Classes\FirefoxHTML registry key.
${GetLongPath} "$INSTDIR\${FileMainEXE}" $8
ClearErrors
ReadRegStr $2 HKLM "Software\Classes\FirefoxHTML\ShellEx\IconHandler" ""
${Unless} ${Errors}
@ -247,12 +340,13 @@
${EndUnless}
${EndUnless}
!macroend
!define SetStartMenuInternet "!insertmacro SetStartMenuInternet"
!define FixShellIconHandler "!insertmacro FixShellIconHandler"
!macro SetAppKeys
${GetLongPath} "$INSTDIR" $8
StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})\Main"
${WriteRegStr2} $TmpVal "$0" "Install Directory" "$INSTDIR" 0
${WriteRegStr2} $TmpVal "$0" "PathToExe" "$INSTDIR\${FileMainEXE}" 0
${WriteRegStr2} $TmpVal "$0" "Install Directory" "$8" 0
${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0
${WriteRegStr2} $TmpVal "$0" "Program Folder Path" "$SMPROGRAMS\$StartMenuDir" 0
SetShellVarContext all ; Set $DESKTOP to All Users
@ -266,8 +360,8 @@
${If} $1 == ""
ShellLink::GetShortCutTarget "$DESKTOP\${BrandFullName}.lnk"
Pop $1
; Needs to handle short paths
${If} $1 == "$INSTDIR\${FileMainEXE}"
${GetLongPath} "$1" $1
${If} "$1" == "$8\${FileMainEXE}"
${WriteRegDWORD2} $TmpVal "$0" "Create Desktop Shortcut" 1 0
${Else}
${WriteRegDWORD2} $TmpVal "$0" "Create Desktop Shortcut" 0 0
@ -278,9 +372,9 @@
; XXXrstrong - need a cleaner way to prevent unsetting SHCTX from HKLM when
; trying to find the desktop shortcut.
${If} $TmpVal == "HKCU"
SetShellVarContext current
SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU)
${Else}
SetShellVarContext all
SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM)
${EndIf}
${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk"
@ -289,8 +383,8 @@
${If} $1 == ""
ShellLink::GetShortCutTarget "$QUICKLAUNCH\${BrandFullName}.lnk"
Pop $1
; Needs to handle short paths
${If} $1 == "$INSTDIR\${FileMainEXE}"
${GetLongPath} "$1" $1
${If} $1 == "$8\${FileMainEXE}"
${WriteRegDWORD2} $TmpVal "$0" "Create Quick Launch Shortcut" 1 0
${Else}
${WriteRegDWORD2} $TmpVal "$0" "Create Quick Launch Shortcut" 0 0
@ -301,18 +395,18 @@
; set in the installer and should also be set here for software update.
StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})\Uninstall"
${WriteRegStr2} $TmpVal "$0" "Uninstall Log Folder" "$INSTDIR\uninstall" 0
${WriteRegStr2} $TmpVal "$0" "Uninstall Log Folder" "$8\uninstall" 0
${WriteRegStr2} $TmpVal "$0" "Description" "${BrandFullNameInternal} (${AppVersion})" 0
StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})"
${WriteRegStr2} $TmpVal "$0" "" "${AppVersion} (${AB_CD})" 0
StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}\bin"
${WriteRegStr2} $TmpVal "$0" "PathToExe" "$INSTDIR\${FileMainEXE}" 0
${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0
StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}\extensions"
${WriteRegStr2} $TmpVal "$0" "Components" "$INSTDIR\components" 0
${WriteRegStr2} $TmpVal "$0" "Plugins" "$INSTDIR\plugins" 0
${WriteRegStr2} $TmpVal "$0" "Components" "$8\components" 0
${WriteRegStr2} $TmpVal "$0" "Plugins" "$8\plugins" 0
StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}"
${WriteRegStr2} $TmpVal "$0" "GeckoVer" "${GREVersion}" 0
@ -324,18 +418,17 @@
!define SetAppKeys "!insertmacro SetAppKeys"
!macro SetUninstallKeys
; Write the uninstall registry keys
StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${AppVersion})"
GetFullPathName $8 "$INSTDIR\${FileMainEXE}"
GetFullPathName $7 "$INSTDIR\uninstall\helper.exe"
${GetLongPath} "$INSTDIR" $8
; Write the uninstall registry keys
${WriteRegStr2} $TmpVal "$0" "Comments" "${BrandFullNameInternal}" 0
${WriteRegStr2} $TmpVal "$0" "DisplayIcon" "$8,0" 0
${WriteRegStr2} $TmpVal "$0" "DisplayIcon" "$8\${FileMainEXE},0" 0
${WriteRegStr2} $TmpVal "$0" "DisplayName" "${BrandFullNameInternal} (${AppVersion})" 0
${WriteRegStr2} $TmpVal "$0" "DisplayVersion" "${AppVersion} (${AB_CD})" 0
${WriteRegStr2} $TmpVal "$0" "InstallLocation" "$INSTDIR" 0
${WriteRegStr2} $TmpVal "$0" "InstallLocation" "$8" 0
${WriteRegStr2} $TmpVal "$0" "Publisher" "Mozilla" 0
${WriteRegStr2} $TmpVal "$0" "UninstallString" "$7" 0
${WriteRegStr2} $TmpVal "$0" "UninstallString" "$8\uninstall\helper.exe" 0
${WriteRegStr2} $TmpVal "$0" "URLInfoAbout" "${URLInfoAbout}" 0
${WriteRegStr2} $TmpVal "$0" "URLUpdateInfo" "${URLUpdateInfo}" 0
${WriteRegDWORD2} $TmpVal "$0" "NoModify" 1 0
@ -344,96 +437,110 @@
!define SetUninstallKeys "!insertmacro SetUninstallKeys"
!macro FixClassKeys
StrCpy $0 "SOFTWARE\Classes"
StrCpy $1 "SOFTWARE\Classes"
; File handler keys and name value pairs that may need to be created during
; install or upgrade.
ReadRegStr $2 SHCTX "$0\.shtml" "Content Type"
${If} $2 == ""
StrCpy $2 "$0\.shtml"
${WriteRegStr2} $TmpVal "$0\.shtml" "" "shtmlfile" 0
${WriteRegStr2} $TmpVal "$0\.shtml" "Content Type" "text/html" 0
${WriteRegStr2} $TmpVal "$0\.shtml" "PerceivedType" "text" 0
ReadRegStr $0 HKCR ".shtml" "Content Type"
${If} "$0" == ""
StrCpy $0 "$1\.shtml"
${WriteRegStr2} $TmpVal "$1\.shtml" "" "shtmlfile" 0
${WriteRegStr2} $TmpVal "$1\.shtml" "Content Type" "text/html" 0
${WriteRegStr2} $TmpVal "$1\.shtml" "PerceivedType" "text" 0
${EndIf}
ReadRegStr $2 SHCTX "$0\.xht" "Content Type"
${If} $2 == ""
${WriteRegStr2} $TmpVal "$0\.xht" "" "xhtfile" 0
${WriteRegStr2} $TmpVal "$0\.xht" "Content Type" "application/xhtml+xml" 0
ReadRegStr $0 HKCR ".xht" "Content Type"
${If} "$0" == ""
${WriteRegStr2} $TmpVal "$1\.xht" "" "xhtfile" 0
${WriteRegStr2} $TmpVal "$1\.xht" "Content Type" "application/xhtml+xml" 0
${EndIf}
ReadRegStr $2 SHCTX "$0\.xhtml" "Content Type"
${If} $2 == ""
${WriteRegStr2} $TmpVal "$0\.xhtml" "" "xhtmlfile" 0
${WriteRegStr2} $TmpVal "$0\.xhtml" "Content Type" "application/xhtml+xml" 0
ReadRegStr $0 HKCR ".xhtml" "Content Type"
${If} "$0" == ""
${WriteRegStr2} $TmpVal "$1\.xhtml" "" "xhtmlfile" 0
${WriteRegStr2} $TmpVal "$1\.xhtml" "Content Type" "application/xhtml+xml" 0
${EndIf}
!macroend
!define FixClassKeys "!insertmacro FixClassKeys"
; Updates protocol handlers if their registry open command value is for this
; install location
!macro UpdateProtocolHandlers
; Store the command to open the app with an url in a register for easy access.
${GetLongPath} "$INSTDIR\${FileMainEXE}" $8
StrCpy $2 "$\"$8$\" -requestPending -osint -url $\"%1$\""
StrCpy $3 "$\"%1$\",,0,0,,,,"
; Only set the file and protocol handlers if the existing one under HKCR is
; for this install location.
${IsHandlerForInstallDir} "FirefoxHTML" $R9
${If} "$R9" == "true"
; An empty string is used for the 5th param because FirefoxHTML is not a
; protocol handler.
${AddDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" "${AppRegName} Document" "" \
"${DDEApplication}" "$3" "WWW_OpenURL"
${EndIf}
; Protocol handler keys and name value pairs that may need to be updated during
; install or upgrade.
${IsHandlerForInstallDir} "FirefoxURL" $R9
${If} "$R9" == "true"
${AddDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" "true" \
"${DDEApplication}" "$3" "WWW_OpenURL"
${EndIf}
; Bug 301073 Comment #9 makes it so Firefox no longer supports launching
; chrome urls from the shell so remove it during install or update if the
; DefaultIcon is from firefox.exe.
ReadRegStr $2 SHCTX "$0\chrome\DefaultIcon" ""
${IsHandlerForInstallDir} "ftp" $R9
${If} "$R9" == "true"
${AddDDEHandlerValues} "ftp" "$2" "$8,1" "" "" \
"${DDEApplication}" "$3" "WWW_OpenURL"
${EndIf}
ClearErrors
${WordFind} "$2" "${FileMainEXE}" "E+1{" $R1
${IsHandlerForInstallDir} "http" $R9
${If} "$R9" == "true"
${AddDDEHandlerValues} "http" "$2" "$8,1" "" "" \
"${DDEApplication}" "$3" "WWW_OpenURL"
${EndIf}
${Unless} ${Errors}
DeleteRegKey SHCTX "$0\chrome"
${EndUnless}
${IsHandlerForInstallDir} "https" $R9
${If} "$R9" == "true"
${AddDDEHandlerValues} "https" "$2" "$8,1" "" "" \
"${DDEApplication}" "$3" "WWW_OpenURL"
${EndIf}
!macroend
!define UpdateProtocolHandlers "!insertmacro UpdateProtocolHandlers"
!macro RemoveDeprecatedKeys
StrCpy $0 "SOFTWARE\Classes"
; Remove support for launching gopher urls from the shell during install or
; update if the DefaultIcon is from firefox.exe.
ReadRegStr $2 SHCTX "$0\gopher\DefaultIcon" ""
ClearErrors
${WordFind} "$2" "${FileMainEXE}" "E+1{" $R1
${Unless} ${Errors}
DeleteRegKey SHCTX "$0\gopher"
${EndUnless}
${RegCleanAppHandler} "gopher"
; Store the command to open the app with an url in a register for easy access.
GetFullPathName $8 "$INSTDIR\${FileMainEXE}"
StrCpy $1 "$\"$8$\" -requestPending -osint -url $\"%1$\""
; Always set the file and protocol handlers since they may specify a
; different path and the path is used by Vista when setting associations.
${AddHandlerValues} "$0\FirefoxURL" "$1" "$8,1" "${AppRegName} URL" "true" "true"
; An empty string is used for the 5th param because FirefoxHTML is not a
; protocol handler
${AddHandlerValues} "$0\FirefoxHTML" "$1" "$8,1" "${AppRegName} Document" "" "true"
ReadRegStr $2 SHCTX "$0\http\shell\open\command" ""
ClearErrors
${WordFind} "$2" "${FileMainEXE}" "E+1{" $R1
${Unless} ${Errors}
${AddHandlerValues} "$0\http" "$1" "$8,1" "" "" "true"
${EndUnless}
ReadRegStr $2 SHCTX "$0\https\shell\open\command" ""
ClearErrors
${WordFind} "$2" "${FileMainEXE}" "E+1{" $R1
${Unless} ${Errors}
${AddHandlerValues} "$0\https" "$1" "$8,1" "" "" "true"
${EndUnless}
ReadRegStr $2 SHCTX "$0\ftp\shell\open\command" ""
ClearErrors
${WordFind} "$2" "${FileMainEXE}" "E+1{" $R1
${Unless} ${Errors}
${AddHandlerValues} "$0\ftp" "$1" "$8,1" "" "" "true"
${EndUnless}
; Remove the gopher key if the DefaultIcon is from firefox.exe.
ReadRegStr $2 SHCTX "$0\gopher\DefaultIcon" ""
ClearErrors
${WordFind} "$2" "${FileMainEXE}" "E+1{" $R1
${Unless} ${Errors}
DeleteRegKey SHCTX "$0\gopher"
${EndUnless}
; Remove support for launching chrome urls from the shell during install or
; update if the DefaultIcon is from firefox.exe (Bug 301073).
${RegCleanAppHandler} "chrome"
; Remove protocol handler registry keys added by the MS shim
DeleteRegKey HKLM "Software\Classes\Firefox.URL"
DeleteRegKey HKCU "Software\Classes\Firefox.URL"
; Remove the app compatibility registry key
StrCpy $0 "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
DeleteRegValue HKLM "$0" "$INSTDIR\${FileMainEXE}"
DeleteRegValue HKCU "$0" "$INSTDIR\${FileMainEXE}"
; Delete gopher from Capabilities\URLAssociations if it is present.
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
StrCpy $0 "Software\Clients\StartMenuInternet\$R9"
ClearErrors
ReadRegStr $2 HKLM "$0\Capabilities\URLAssociations" "gopher"
${Unless} ${Errors}
DeleteRegValue HKLM "$0\Capabilities\URLAssociations" "gopher"
${EndUnless}
; Delete gopher from the user's UrlAssociations if it points to FirefoxURL.
StrCpy $0 "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\gopher"
ReadRegStr $2 HKCU "$0\UserChoice" "Progid"
${If} $2 == "FirefoxURL"
DeleteRegKey HKCU "$0"
${EndIf}
!macroend
!define FixClassKeys "!insertmacro FixClassKeys"
!define RemoveDeprecatedKeys "!insertmacro RemoveDeprecatedKeys"

View File

@ -35,7 +35,9 @@
# ***** END LICENSE BLOCK *****
# Required Plugins:
# ShellLink plugin http://nsis.sourceforge.net/ShellLink_plug-in
# SetVistaDefaultApp http://nsis.sourceforge.net/SetVistaDefaultApp_plug-in
# ShellLink http://nsis.sourceforge.net/ShellLink_plug-in
# UAC http://nsis.sourceforge.net/UAC_plug-in
; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs
!verbose 3
@ -48,6 +50,9 @@ CRCCheck on
!addplugindir ./
; USE_UAC_PLUGIN is temporary until Thunderbird has been updated to use the UAC plugin
!define USE_UAC_PLUGIN
; prevents compiling of the reg write logging.
!define NO_LOG
@ -67,14 +72,13 @@ Var TmpVal
; available.
!include /NONFATAL WinVer.nsh
!ifdef ___WINVER__NSH___
RequestExecutionLevel admin
RequestExecutionLevel user
!else
!warning "Uninstaller will be created without Vista compatibility.$\n \
Upgrade your NSIS installation to at least version 2.22 to resolve."
!endif
!insertmacro StrFilter
!insertmacro WordFind
!insertmacro WordReplace
!insertmacro un.GetParent
@ -92,9 +96,12 @@ Var TmpVal
; post update cleanup.
VIAddVersionKey "FileDescription" "${BrandShortName} Helper"
!insertmacro AddHandlerValues
!insertmacro AddDDEHandlerValues
!insertmacro CleanVirtualStore
!insertmacro GetLongPath
!insertmacro GetPathFromString
!insertmacro IsHandlerForInstallDir
!insertmacro RegCleanAppHandler
!insertmacro RegCleanMain
!insertmacro RegCleanUninstall
!insertmacro WriteRegDWORD2
@ -105,8 +112,11 @@ VIAddVersionKey "FileDescription" "${BrandShortName} Helper"
!insertmacro un.GetSecondInstallPath
!insertmacro un.ManualCloseAppPrompt
!insertmacro un.ParseUninstallLog
!insertmacro un.RegCleanAppHandler
!insertmacro un.RegCleanFileHandler
!insertmacro un.RegCleanMain
!insertmacro un.RegCleanUninstall
!insertmacro un.RegCleanProtocolHandler
!insertmacro un.RemoveQuotesFromPath
!include shared.nsh
@ -152,13 +162,13 @@ ShowUnInstDetails nevershow
!insertmacro MUI_UNPAGE_INSTFILES
; Finish Page
; Don't setup the survey controls, functions, etc. when the application has
; defined NO_UNINSTALL_SURVEY
!ifndef NO_UNINSTALL_SURVEY
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.preFinish
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME ""
; Setup the survey controls, functions, etc. except when the application has
; defined NO_UNINSTALL_SURVEY
!ifndef NO_UNINSTALL_SURVEY
!define MUI_FINISHPAGE_SHOWREADME_TEXT $(SURVEY_TEXT)
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION un.Survey
!endif
@ -191,16 +201,39 @@ Section "Uninstall"
ClearErrors
${EndIf}
; Remove registry entries for non-existent apps and for apps that point to our
; install location in the Software\Mozilla key and uninstall registry entries
; that point to our install location for both HKCU and HKLM.
SetShellVarContext current ; Sets SHCTX to HKCU
SetShellVarContext current ; Set SHCTX to HKCU
${un.RegCleanMain} "Software\Mozilla"
${un.RegCleanUninstall}
SetShellVarContext all ; Sets SHCTX to HKLM
${un.RegCleanMain} "Software\Mozilla"
${un.RegCleanUninstall}
ClearErrors
WriteRegStr HKLM "Software\Mozilla\InstallerTest" "InstallerTest" "Test"
${If} ${Errors}
StrCpy $TmpVal "HKCU" ; used primarily for logging
${Else}
SetShellVarContext all ; Set SHCTX to HKLM
DeleteRegKey HKLM "Software\Mozilla\InstallerTest"
StrCpy $TmpVal "HKLM" ; used primarily for logging
${un.RegCleanMain} "Software\Mozilla"
${un.RegCleanUninstall}
${EndIf}
${un.RegCleanAppHandler} "FirefoxURL"
${un.RegCleanAppHandler} "FirefoxHTML"
${un.RegCleanProtocolHandler} "ftp"
${un.RegCleanProtocolHandler} "http"
${un.RegCleanProtocolHandler} "https"
ClearErrors
ReadRegStr $R9 HKCR "FirefoxHTML" ""
; Don't clean up the file handlers if the FirefoxHTML key still exists since
; there should be a second installation that may be the default file handler
${If} ${Errors}
${un.RegCleanFileHandler} ".htm" "FirefoxHTML"
${un.RegCleanFileHandler} ".html" "FirefoxHTML"
${un.RegCleanFileHandler} ".shtml" "FirefoxHTML"
${un.RegCleanFileHandler} ".xht" "FirefoxHTML"
${un.RegCleanFileHandler} ".xhtml" "FirefoxHTML"
${EndIf}
SetShellVarContext all ; Set SHCTX to HKLM
${un.GetSecondInstallPath} "Software\Mozilla" $R9
@ -222,9 +255,6 @@ Section "Uninstall"
; default browser. Now the key is always updated on install but it is only
; removed if it refers to this install location.
${If} "$INSTDIR" == "$R1"
; XXXrstrong - if there is another installation of the same app ideally we
; would just modify these values. The GetSecondInstallPath macro could be
; made to provide enough information to do this.
DeleteRegKey HKLM "Software\Clients\StartMenuInternet\${FileMainEXE}"
DeleteRegValue HKLM "Software\RegisteredApplications" "${AppRegName}"
${EndIf}
@ -236,8 +266,9 @@ Section "Uninstall"
StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\${FileMainEXE}"
DeleteRegKey HKLM "$0"
DeleteRegKey HKCU "$0"
StrCpy $0 "MIME\Database\Content Type\application/x-xpinstall;app=firefox"
DeleteRegKey HKCR "$0"
StrCpy $0 "Software\Classes\MIME\Database\Content Type\application/x-xpinstall;app=firefox"
DeleteRegKey HKLM "$0"
DeleteRegKey HKCU "$0"
${Else}
ReadRegStr $R1 HKLM "$0" ""
${un.RemoveQuotesFromPath} "$R1" $R1
@ -300,7 +331,7 @@ SectionEnd
################################################################################
# Helper Functions
; Setup the survey controls, functions, etc. except when the application has
; Don't setup the survey controls, functions, etc. when the application has
; defined NO_UNINSTALL_SURVEY
!ifndef NO_UNINSTALL_SURVEY
Function un.Survey
@ -340,12 +371,10 @@ Function un.leaveConfirm
${EndIf}
FunctionEnd
!ifndef NO_UNINSTALL_SURVEY
Function un.preFinish
; Do not modify the finish page if there is a reboot pending
${Unless} ${RebootFlag}
!ifdef NO_UNINSTALL_SURVEY
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3"
!else
; Setup the survey controls, functions, etc.
StrCpy $TmpVal "SOFTWARE\Microsoft\IE Setup\Setup"
ClearErrors
@ -369,12 +398,13 @@ Function un.preFinish
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0"
${EndIf}
${EndIf}
!endif
${EndUnless}
FunctionEnd
!endif
################################################################################
# Initialization Functions
Function .onInit
${UninstallOnInitCommon}
FunctionEnd

Binary file not shown.

View File

@ -1260,6 +1260,7 @@
/**
* Writes common registry values for a handler using SHCTX.
*
* @param _KEY
* The subkey in relation to the key root.
* @param _VALOPEN
@ -1397,6 +1398,162 @@
!endif
!macroend
/**
* Writes common registry values for a handler that uses DDE using SHCTX.
*
* @param _KEY
* The key name in relation to the HKCR root. SOFTWARE\Classes is
* prefixed to this value when using SHCTX.
* @param _VALOPEN
* The path and args to launch the application.
* @param _VALICON
* The path to an exe that contains an icon and the icon resource id.
* @param _DISPNAME
* The display name for the handler. If emtpy no value will be set.
* @param _ISPROTOCOL
* Sets protocol handler specific registry values when "true".
* @param _DDE_APPNAME
* Sets DDE specific registry values when not an empty string.
*
* $R0 = storage for SOFTWARE\Classes
* $R1 = string value of the current registry key path.
* $R2 = _KEY
* $R3 = _VALOPEN
* $R4 = _VALICON
* $R5 = _DISPNAME
* $R6 = _ISPROTOCOL
* $R7 = _DDE_APPNAME
* $R8 = _DDE_DEFAULT
* $R9 = _DDE_TOPIC
*/
!macro AddDDEHandlerValues
!ifndef ${_MOZFUNC_UN}AddDDEHandlerValues
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!define ${_MOZFUNC_UN}AddDDEHandlerValues "!insertmacro ${_MOZFUNC_UN}AddDDEHandlerValuesCall"
Function ${_MOZFUNC_UN}AddDDEHandlerValues
Exch $R9
Exch 1
Exch $R8
Exch 2
Exch $R7
Exch 3
Exch $R6
Exch 4
Exch $R5
Exch 5
Exch $R4
Exch 6
Exch $R3
Exch 7
Exch $R2
Push $R1
Push $R0
StrCpy $R0 "SOFTWARE\Classes"
StrCmp "$R5" "" +6 +1
ReadRegStr $R1 SHCTX "$R2" "FriendlyTypeName"
StrCmp "$R1" "" +1 +3
WriteRegStr SHCTX "$R0\$R2" "" "$R5"
WriteRegStr SHCTX "$R0\$R2" "FriendlyTypeName" "$R5"
StrCmp "$R6" "true" +1 +8
WriteRegStr SHCTX "$R0\$R2" "URL Protocol" ""
StrCpy $R1 ""
ClearErrors
ReadRegDWord $R1 SHCTX "$R0\$R2" "EditFlags"
StrCmp $R1 "" +1 +3 ; Only add EditFlags if a value doesn't exist
DeleteRegValue SHCTX "$R0\$R2" "EditFlags"
WriteRegDWord SHCTX "$R0\$R2" "EditFlags" 0x00000002
StrCmp "$R4" "" +2 +1
WriteRegStr SHCTX "$R0\$R2\DefaultIcon" "" "$R4"
WriteRegStr SHCTX "$R0\$R2\shell\open\command" "" "$R3"
WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec" "" "$R8"
WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec" "NoActivateHandler" ""
WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec\Application" "" "$R7"
WriteRegStr SHCTX "$R0\$R2\shell\open\ddeexec\Topic" "" "$R9"
; The ifexec key may have been added by another application so try to
; delete it to prevent it from breaking this app's shell integration.
; Also, IE 6 and below doesn't remove this key when it sets itself as the
; default handler and if this key exists IE's shell integration breaks.
DeleteRegKey HKLM "$R0\$R2\shell\open\ddeexec\ifexec"
DeleteRegKey HKCU "$R0\$R2\shell\open\ddeexec\ifexec"
ClearErrors
Pop $R0
Pop $R1
Exch $R2
Exch 7
Exch $R3
Exch 6
Exch $R4
Exch 5
Exch $R5
Exch 4
Exch $R6
Exch 3
Exch $R7
Exch 2
Exch $R8
Exch 1
Exch $R9
FunctionEnd
!verbose pop
!endif
!macroend
!macro AddDDEHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL _DDE_APPNAME _DDE_DEFAULT _DDE_TOPIC
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Push "${_KEY}"
Push "${_VALOPEN}"
Push "${_VALICON}"
Push "${_DISPNAME}"
Push "${_ISPROTOCOL}"
Push "${_DDE_APPNAME}"
Push "${_DDE_DEFAULT}"
Push "${_DDE_TOPIC}"
Call AddDDEHandlerValues
!verbose pop
!macroend
!macro un.AddDDEHandlerValuesCall _KEY _VALOPEN _VALICON _DISPNAME _ISPROTOCOL _DDE_APPNAME _DDE_DEFAULT _DDE_TOPIC
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Push "${_KEY}"
Push "${_VALOPEN}"
Push "${_VALICON}"
Push "${_DISPNAME}"
Push "${_ISPROTOCOL}"
Push "${_DDE_APPNAME}"
Push "${_DDE_DEFAULT}"
Push "${_DDE_TOPIC}"
Call un.AddDDEHandlerValues
!verbose pop
!macroend
!macro un.AddDDEHandlerValues
!ifndef un.AddDDEHandlerValues
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!undef _MOZFUNC_UN
!define _MOZFUNC_UN "un."
!insertmacro AddDDEHandlerValues
!undef _MOZFUNC_UN
!define _MOZFUNC_UN
!verbose pop
!endif
!macroend
################################################################################
# Macros for retrieving existing install paths
@ -2446,6 +2603,356 @@
!endif
!macroend
/**
* Removes an application specific handler registry key under Software\Classes
* for both HKCU and HKLM when its open command refers to this install
* location or the install location doesn't exist.
*
* @param _HANDLER_NAME
* The registry name for the handler.
*
* $R7 = stores the long path to the $INSTDIR
* $R8 = stores the path to the open command's parent directory
* $R9 = _HANDLER_NAME
*/
!macro RegCleanAppHandler
!ifndef ${_MOZFUNC_UN}RegCleanAppHandler
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
!insertmacro ${_MOZFUNC_UN_TMP}GetParent
!insertmacro ${_MOZFUNC_UN_TMP}GetPathFromString
!undef _MOZFUNC_UN
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
!undef _MOZFUNC_UN_TMP
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!define ${_MOZFUNC_UN}RegCleanAppHandler "!insertmacro ${_MOZFUNC_UN}RegCleanAppHandlerCall"
Function ${_MOZFUNC_UN}RegCleanAppHandler
Exch $R9
Push $R8
Push $R7
ClearErrors
ReadRegStr $R8 HKCU "Software\Classes\$R9\shell\open\command" ""
IfErrors next +1
${${_MOZFUNC_UN}GetPathFromString} "$R8" $R8
${${_MOZFUNC_UN}GetParent} "$R8" $R8
IfFileExists "$R8" +3 +1
DeleteRegKey HKCU "Software\Classes\$R9"
GoTo next
${${_MOZFUNC_UN}GetLongPath} "$R8" $R8
${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R7
StrCmp "$R7" "$R8" +1 next
DeleteRegKey HKCU "Software\Classes\$R9"
next:
ReadRegStr $R8 HKLM "Software\Classes\$R9\shell\open\command" ""
IfErrors end
${${_MOZFUNC_UN}GetPathFromString} "$R8" $R8
${${_MOZFUNC_UN}GetParent} "$R8" $R8
IfFileExists "$R8" +3 +1
DeleteRegKey HKLM "Software\Classes\$R9"
GoTo end
${${_MOZFUNC_UN}GetLongPath} "$R8" $R8
${${_MOZFUNC_UN}GetLongPath} "$INSTDIR" $R7
StrCmp "$R7" "$R8" +1 end
DeleteRegKey HKLM "Software\Classes\$R9"
end:
Pop $R7
Pop $R8
Exch $R9
FunctionEnd
!verbose pop
!endif
!macroend
!macro RegCleanAppHandlerCall _HANDLER_NAME
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Push "${_HANDLER_NAME}"
Call RegCleanAppHandler
!verbose pop
!macroend
!macro un.RegCleanAppHandlerCall _HANDLER_NAME
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Push "${_HANDLER_NAME}"
Call un.RegCleanAppHandler
!verbose pop
!macroend
!macro un.RegCleanAppHandler
!ifndef un.RegCleanAppHandler
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!undef _MOZFUNC_UN
!define _MOZFUNC_UN "un."
!insertmacro RegCleanAppHandler
!undef _MOZFUNC_UN
!define _MOZFUNC_UN
!verbose pop
!endif
!macroend
/**
* Cleans up the registry for a protocol handler when its open command
* refers to this install location. For HKCU the registry key is deleted
* and for HKLM the values set by the application are deleted.
*
* @param _HANDLER_NAME
* The registry name for the handler.
*
* $R7 = stores the long path to $INSTDIR
* $R8 = stores the the long path to the open command's parent directory
* $R9 = _HANDLER_NAME
*/
!macro un.RegCleanProtocolHandler
!ifndef un.RegCleanProtocolHandler
!insertmacro un.GetLongPath
!insertmacro un.GetParent
!insertmacro un.GetPathFromString
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!define un.RegCleanProtocolHandler "!insertmacro un.RegCleanProtocolHandlerCall"
Function un.RegCleanProtocolHandler
Exch $R9
Push $R8
Push $R7
ReadRegStr $R8 HKCU "Software\Classes\$R9\shell\open\command" ""
${un.GetLongPath} "$INSTDIR" $R7
StrCmp "$R8" "" next +1
${un.GetPathFromString} "$R8" $R8
${un.GetParent} "$R8" $R8
${un.GetLongPath} "$R8" $R8
StrCmp "$R7" "$R8" +1 next
DeleteRegKey HKCU "Software\Classes\$R9"
next:
ReadRegStr $R8 HKLM "Software\Classes\$R9\shell\open\command" ""
StrCmp "$R8" "" end +1
${un.GetLongPath} "$INSTDIR" $R7
${un.GetPathFromString} "$R8" $R8
${un.GetParent} "$R8" $R8
${un.GetLongPath} "$R8" $R8
StrCmp "$R7" "$R8" +1 end
DeleteRegValue HKLM "Software\Classes\$R9\DefaultIcon" ""
DeleteRegValue HKLM "Software\Classes\$R9\shell\open" ""
DeleteRegValue HKLM "Software\Classes\$R9\shell\ddeexec" ""
DeleteRegValue HKLM "Software\Classes\$R9\shell\ddeexec\Application" ""
DeleteRegValue HKLM "Software\Classes\$R9\shell\ddeexec\Topic" ""
end:
Pop $R7
Pop $R8
Exch $R9
FunctionEnd
!verbose pop
!endif
!macroend
!macro un.RegCleanProtocolHandlerCall _HANDLER_NAME
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Push "${_HANDLER_NAME}"
Call un.RegCleanProtocolHandler
!verbose pop
!macroend
/**
* Cleans up the registry for a file handler when the passed in value equals
* the default value for the file handler. For HKCU the registry key is deleted
* and for HKLM the default value is deleted.
*
* @param _HANDLER_NAME
* The registry name for the handler.
* @param _DEFAULT_VALUE
* The value to check for against the handler's default value.
*
* $R6 = stores the long path to $INSTDIR
* $R7 = _DEFAULT_VALUE
* $R9 = _HANDLER_NAME
*/
!macro RegCleanFileHandler
!ifndef ${_MOZFUNC_UN}RegCleanFileHandler
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
!insertmacro ${_MOZFUNC_UN_TMP}GetParent
!insertmacro ${_MOZFUNC_UN_TMP}GetPathFromString
!undef _MOZFUNC_UN
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
!undef _MOZFUNC_UN_TMP
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!define ${_MOZFUNC_UN}RegCleanFileHandler "!insertmacro ${_MOZFUNC_UN}RegCleanFileHandlerCall"
Function ${_MOZFUNC_UN}RegCleanFileHandler
Exch $R9
Exch 1
Exch $R8
Push $R7
ReadRegStr $R7 HKCU "Software\Classes\$R9" ""
StrCmp "$R7" "$R8" +1 +2
DeleteRegKey HKCU "Software\Classes\$R9"
ReadRegStr $R7 HKLM "Software\Classes\$R9" ""
StrCmp "$R7" "$R8" +1 +2
DeleteRegValue HKLM "Software\Classes\$R9" ""
ClearErrors
Pop $R7
Exch $R8
Exch 1
Exch $R9
FunctionEnd
!verbose pop
!endif
!macroend
!macro RegCleanFileHandlerCall _HANDLER_NAME _DEFAULT_VALUE
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Push "${_DEFAULT_VALUE}"
Push "${_HANDLER_NAME}"
Call RegCleanFileHandler
!verbose pop
!macroend
!macro un.RegCleanFileHandlerCall _HANDLER_NAME _DEFAULT_VALUE
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Push "${_DEFAULT_VALUE}"
Push "${_HANDLER_NAME}"
Call un.RegCleanFileHandler
!verbose pop
!macroend
!macro un.RegCleanFileHandler
!ifndef un.RegCleanFileHandler
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!undef _MOZFUNC_UN
!define _MOZFUNC_UN "un."
!insertmacro RegCleanFileHandler
!undef _MOZFUNC_UN
!define _MOZFUNC_UN
!verbose pop
!endif
!macroend
/**
* Checks if a handler's open command points to this installation directory.
*
* @param _HANDLER_NAME
* The registry name for the handler.
* @param _RESULT
* true if it is the handler's open command points to this
* installation directory and false if it does not.
*
* $R7 = stores the value of the open command and the path macros return values
* $R8 = stores the handler's registry key name
* $R9 = _DEFAULT_VALUE and _RESULT
*/
!macro IsHandlerForInstallDir
!ifndef ${_MOZFUNC_UN}IsHandlerForInstallDir
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
!insertmacro ${_MOZFUNC_UN_TMP}GetParent
!insertmacro ${_MOZFUNC_UN_TMP}GetPathFromString
!undef _MOZFUNC_UN
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
!undef _MOZFUNC_UN_TMP
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!define ${_MOZFUNC_UN}IsHandlerForInstallDir "!insertmacro ${_MOZFUNC_UN}IsHandlerForInstallDirCall"
Function ${_MOZFUNC_UN}IsHandlerForInstallDir
Exch $R9
Push $R8
Push $R7
StrCpy $R8 "$R9"
StrCpy $R9 "false"
ReadRegStr $R7 HKCR "$R8\shell\open\command" ""
StrCmp "$R7" "" end
${GetPathFromString} "$R7" $R7
${GetParent} "$R7" $R7
${GetLongPath} "$R7" $R7
StrCmp "$R7" "$INSTDIR" +1 end
StrCpy $R9 "true"
end:
ClearErrors
Pop $R7
Pop $R8
Exch $R9
FunctionEnd
!verbose pop
!endif
!macroend
!macro IsHandlerForInstallDirCall _HANDLER_NAME _RESULT
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Push "${_HANDLER_NAME}"
Call IsHandlerForInstallDir
Pop "${_RESULT}"
!verbose pop
!macroend
!macro un.IsHandlerForInstallDirCall _HANDLER_NAME _RESULT
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Push "${_HANDLER_NAME}"
Call un.IsHandlerForInstallDir
Pop "${_RESULT}"
!verbose pop
!macroend
!macro un.IsHandlerForInstallDir
!ifndef un.IsHandlerForInstallDir
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!undef _MOZFUNC_UN
!define _MOZFUNC_UN "un."
!insertmacro IsHandlerForInstallDir
!undef _MOZFUNC_UN
!define _MOZFUNC_UN
!verbose pop
!endif
!macroend
/**
* If present removes the VirtualStore directory for this installation. Uses the
* program files directory path and the current install location to determine
@ -2858,6 +3365,7 @@
Push $R2
Push $R1
Push $R0
Push $TmpVal
IfFileExists "$INSTDIR\uninstall\uninstall.log" +1 end
@ -2879,6 +3387,7 @@
end:
Pop $TmpVal
Pop $R0
Pop $R1
Pop $R2
@ -3063,6 +3572,7 @@
!insertmacro GetOptions
!insertmacro GetParameters
!insertmacro GetSize
!insertmacro ElevateUAC
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
@ -3083,6 +3593,10 @@
!endif
${GetParameters} $R8
; Require elevation if the user can elevate
${ElevateUAC}
${If} $R8 != ""
ClearErrors
${GetOptions} "$R8" "-ms" $R7
@ -3230,6 +3744,7 @@
!insertmacro GetOptions
!insertmacro GetParameters
!insertmacro UpdateUninstallLog
!insertmacro ElevateUAC
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
@ -3246,42 +3761,60 @@
StrCmp "$R0" "" continue +1
StrCmp "$R0" "/HideShortcuts" +1 showshortcuts
; Require elevation if the user can elevate
ClearErrors
${GetOptions} "$R0" "/HideShortcuts" $R2
IfErrors showshortcuts +1
${ElevateUAC}
${HideShortcuts}
StrCpy $R1 "true"
StrCmp "$R1" "true" continue
; Require elevation if the user can elevate
showshortcuts:
StrCmp "$R0" "/ShowShortcuts" +1 defaultappuser
ClearErrors
${GetOptions} "$R0" "/ShowShortcuts" $R2
IfErrors defaultappuser +1
${ElevateUAC}
${ShowShortcuts}
StrCpy $R1 "true"
GoTo continue
; Require elevation if the the StartMenuInternet registry keys require
; updating and the user can elevate
defaultappuser:
StrCmp "$R0" "/SetAsDefaultAppUser" +1 defaultappglobal
ClearErrors
${GetOptions} "$R0" "/SetAsDefaultAppUser" $R2
IfErrors defaultappglobal +1
${SetAsDefaultAppUser}
StrCpy $R1 "true"
GoTo continue
; Require elevation if the user can elevate
defaultappglobal:
StrCmp "$R0" "/SetAsDefaultAppGlobal" +1 postupdate
ClearErrors
${GetOptions} "$R0" "/SetAsDefaultAppGlobal" $R2
IfErrors postupdate +1
${ElevateUAC}
${SetAsDefaultAppGlobal}
StrCpy $R1 "true"
GoTo continue
; Do not attempt to elevate. The application launching this executable is
; responsible for elevation if it is required.
postupdate:
${WordReplace} "$R0" "$\"" "" "+" $R0
ClearErrors
${GetOptions} "$R0" "/PostUpdate" $R2
StrCpy $R1 "true"
IfErrors continue +1
; If the uninstall.log does not exist don't perform post update
; operations. This prevents updating the registry for zip builds.
IfFileExists "$EXEDIR\uninstall.log" +1 continue
${PostUpdate}
ClearErrors
${GetOptions} "$R0" "/UninstallLog=" $R2
IfErrors +1 +4
${UpdateUninstallLog}
StrCpy $R1 "true"
GoTo continue
IfErrors updateuninstalllog +1
StrCmp "$R2" "" continue +1
GetFullPathName $R3 "$R2"
IfFileExists "$R3" +1 continue
@ -3291,14 +3824,27 @@
${GetParent} "$R3" $R4
Delete "$R3"
RmDir "$R4"
GoTo continue
; Do not attempt to elevate. The application launching this executable is
; responsible for elevation if it is required.
updateuninstalllog:
${UpdateUninstallLog}
StrCpy $R1 "true"
continue:
StrCmp $R1 "true" +1 +3
System::Call "shell32::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)"
Quit
; If the uninstall.log does not exist don't perform uninstall
; operations. This prevents running the uninstaller for zip builds.
IfFileExists "$EXEDIR\uninstall.log" +2 +1
Quit
; Require elevation if the user can elevate
${ElevateUAC}
; If we made it this far then this installer is being used as an uninstaller.
WriteUninstaller "$EXEDIR\uninstaller.exe"
@ -3506,7 +4052,6 @@
; Remove the files and directories in the removed-files.log
${ParseRemovedFilesLog}
FunctionEnd
!verbose pop
@ -3554,6 +4099,98 @@
!macroend
################################################################################
# UAC Related Macros
/**
* Provides UAC elevation support for Vista and above (requires the UAC plugin).
*
* $0 = return values from calls to the UAC plugin (always uses $0)
* $R9 = return values from GetParameters and GetOptions macros
*/
!macro ElevateUAC
!ifndef ${_MOZFUNC_UN}ElevateUAC
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!define ${_MOZFUNC_UN}ElevateUAC "!insertmacro ${_MOZFUNC_UN}ElevateUACCall"
Function ${_MOZFUNC_UN}ElevateUAC
Push $R9
Push $0
; USE_UAC_PLUGIN is temporary until Thunderbird has been updated to use the UAC plugin
!ifdef USE_UAC_PLUGIN
!ifdef ___WINVER__NSH___
${If} ${AtLeastWinVista}
UAC::IsAdmin
; If the user is not an admin already
${If} "$0" != "1"
UAC::SupportsUAC
; If the system supports UAC
${If} "$0" == "1"
UAC::GetElevationType
; If the user account has a split token
${If} "$0" == "3"
UAC::RunElevated
Quit
${EndIf}
${EndIf}
${Else}
${GetParameters} $R9
${If} $R9 != ""
ClearErrors
${GetOptions} "$R9" "/UAC:" $0
; If the command line contains /UAC then we need to initialize
; the UAC plugin to use UAC::ExecCodeSegment to execute code in
; the non-elevated context.
${Unless} ${Errors}
UAC::RunElevated
${EndUnless}
${EndIf}
${EndIf}
${EndIf}
!endif
!endif
Pop $0
Pop $R9
FunctionEnd
!verbose pop
!endif
!macroend
!macro ElevateUACCall
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Call ElevateUAC
!verbose pop
!macroend
!macro un.ElevateUACCall
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Call un.ElevateUAC
!verbose pop
!macroend
!macro un.ElevateUAC
!ifndef un.ElevateUAC
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!undef _MOZFUNC_UN
!define _MOZFUNC_UN "un."
!insertmacro ElevateUAC
!undef _MOZFUNC_UN
!define _MOZFUNC_UN
!verbose pop
!endif
!macroend
################################################################################
# Macros for logging
#

View File

@ -49,7 +49,9 @@ TOOLKIT_NSIS_FILES = \
locales.nsi \
nsProcess.dll \
overrides.nsh \
SetVistaDefaultApp.dll \
ShellLink.dll \
UAC.dll \
version.nsh \
$(NULL)

View File

@ -700,22 +700,6 @@ nsXULAppInfo::LaunchAppHelperWithArgs(int aArgc, char **aArgv)
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::FixReg()
{
int resetRegArgc = 2;
char **resetRegArgv = (char**) malloc(sizeof(char*) * (resetRegArgc + 1));
if (!resetRegArgv)
return NS_ERROR_OUT_OF_MEMORY;
resetRegArgv[0] = "argv0ignoredbywinlaunchchild";
resetRegArgv[1] = "/fixreg";
resetRegArgv[2] = nsnull;
nsresult rv = LaunchAppHelperWithArgs(resetRegArgc, resetRegArgv);
free(resetRegArgv);
return rv;
}
NS_IMETHODIMP
nsXULAppInfo::PostUpdate(nsILocalFile *aLogFile)
{

View File

@ -46,10 +46,9 @@
interface nsILocalFile;
[scriptable, uuid(b0fb682a-8287-4b0f-b628-65bb206c073f)]
[scriptable, uuid(2bd9ec66-05eb-4f63-8825-a83ccf00fc7f)]
interface nsIWinAppHelper : nsISupports
{
void postUpdate(in nsILocalFile logFile);
void fixReg();
readonly attribute boolean userCanElevate;
};