diff --git a/mozilla/xpfe/bootstrap/nsAppRunner.cpp b/mozilla/xpfe/bootstrap/nsAppRunner.cpp index 7e5d816acf6..9e2d02ae0a0 100644 --- a/mozilla/xpfe/bootstrap/nsAppRunner.cpp +++ b/mozilla/xpfe/bootstrap/nsAppRunner.cpp @@ -1107,6 +1107,13 @@ static nsresult InitializeProfileService(nsICmdLineService *cmdLineArgs) nsCOMPtr nativeApp; if (NS_SUCCEEDED(GetNativeAppSupport(getter_AddRefs(nativeApp)))) nativeApp->GetShouldShowUI(&shouldShowUI); + // If we were launched with -silent, we cannot show UI, either. + if (shouldShowUI) { + nsXPIDLCString arg; + if (NS_SUCCEEDED(cmdLineArgs->GetCmdLineValue("-silent", getter_Copies(arg))) && (const char*)arg) { + shouldShowUI = PR_FALSE; + } + } nsresult rv; nsCOMPtr appShellService(do_GetService(kAppShellServiceCID, &rv)); if (NS_FAILED(rv)) return rv; @@ -1430,9 +1437,11 @@ static nsresult main1(int argc, char* argv[], nsISupports *nativeApp ) #else rv = DoCommandLines( cmdLineArgs, (argc == 1), &windowOpened ); #endif /* XP_MAC */ - NS_ASSERTION(NS_SUCCEEDED(rv), "failed to process command line"); if ( NS_FAILED(rv) ) + { + NS_WARNING("failed to process command line"); return rv; + } // Make sure there exists at least 1 window. NS_TIMELINE_ENTER("Ensure1Window"); diff --git a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp index 8ed741f8e52..23c0ef4d0f2 100644 --- a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp +++ b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp @@ -634,17 +634,22 @@ nsNativeAppSupportWin::CheckConsole() { } } + PRBool checkTurbo = PR_TRUE; for ( int j = 1; j < __argc; j++ ) { if (strcmp("-killAll", __argv[j]) == 0 || strcmp("/killAll", __argv[j]) == 0 || strcmp("-kill", __argv[j]) == 0 || strcmp("/kill", __argv[j]) == 0) { gAbortServer = PR_TRUE; break; } + + if ( strcmp( "-silent", __argv[j] ) == 0 || strcmp( "/silent", __argv[j] ) == 0 ) { + checkTurbo = PR_FALSE; + } } // check if this is a restart of the browser after quiting from // the servermoded browser instance. - if (!mServerMode ) { + if ( checkTurbo && !mServerMode ) { HKEY key; LONG result = ::RegOpenKeyEx( HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_QUERY_VALUE, &key ); if ( result == ERROR_SUCCESS ) { @@ -2060,7 +2065,13 @@ printf( "Setting ddexec subkey entries\n" ); rv = profileMgr->GetIsStartingUp(&doingProfileStartup); if (NS_FAILED(rv) || doingProfileStartup) return NS_ERROR_FAILURE; - rv = appShell->DoProfileStartup(args, PR_TRUE); + // See if profile manager is being suppressed via -silent flag. + PRBool canInteract = PR_TRUE; + nsXPIDLCString arg; + if (NS_SUCCEEDED(args->GetCmdLineValue("-silent", getter_Copies(arg))) && (const char*)arg) { + canInteract = PR_FALSE; + } + rv = appShell->DoProfileStartup(args, canInteract); mForceProfileStartup = PR_FALSE; diff --git a/mozilla/xpfe/components/winhooks/Makefile.in b/mozilla/xpfe/components/winhooks/Makefile.in index e873b5440c4..2ec0e774212 100644 --- a/mozilla/xpfe/components/winhooks/Makefile.in +++ b/mozilla/xpfe/components/winhooks/Makefile.in @@ -55,3 +55,18 @@ FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk +JS_SET_BROWSER_COMPONENT = nsSetDefaultBrowser.js +JS_SET_MAIL_COMPONENT = nsSetDefaultMail.js +JS_UNSET_MAIL_COMPONENT = nsUnSetDefaultMail.js + +libs:: + $(MAKE_INSTALL) $(JS_SET_BROWSER_COMPONENT) $(DIST)\bin\components + $(MAKE_INSTALL) $(JS_SET_MAIL_COMPONENT) $(DIST)\bin\components + $(MAKE_INSTALL) $(JS_UNSET_MAIL_COMPONENT) $(DIST)\bin\components + +clobber:: + rm -f $(DIST)\lib\$(LIBRARY_NAME).lib + rm -f $(DIST)\bin\components\$(JS_SET_BROWSER_COMPONENT) + rm -f $(DIST)\bin\components\$(JS_SET_MAIL_COMPONENT) + rm -f $(DIST)\bin\components\$(JS_UNSET_MAIL_COMPONENT) + diff --git a/mozilla/xpfe/components/winhooks/dummyWindow.xul b/mozilla/xpfe/components/winhooks/dummyWindow.xul new file mode 100644 index 00000000000..dc32e749ffc --- /dev/null +++ b/mozilla/xpfe/components/winhooks/dummyWindow.xul @@ -0,0 +1,46 @@ + + + + + + + + + + diff --git a/mozilla/xpfe/components/winhooks/jar.mn b/mozilla/xpfe/components/winhooks/jar.mn index caa33f8b5d0..4c4e4066a21 100644 --- a/mozilla/xpfe/components/winhooks/jar.mn +++ b/mozilla/xpfe/components/winhooks/jar.mn @@ -1,2 +1,5 @@ en-win.jar: locale/en-US/global-platform/nsWindowsHooks.properties (locale/en-US/nsWindowsHooks.properties) + +toolkit.jar: + content/global/dummyWindow.xul (dummyWindow.xul) diff --git a/mozilla/xpfe/components/winhooks/makefile.win b/mozilla/xpfe/components/winhooks/makefile.win index 7e0a32775f2..177312f0846 100644 --- a/mozilla/xpfe/components/winhooks/makefile.win +++ b/mozilla/xpfe/components/winhooks/makefile.win @@ -57,6 +57,18 @@ include <$(DEPTH)\config\rules.mak> libs:: $(LIBRARY) $(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib +JS_SET_BROWSER_COMPONENT = nsSetDefaultBrowser.js +JS_SET_MAIL_COMPONENT = nsSetDefaultMail.js +JS_UNSET_MAIL_COMPONENT = nsUnSetDefaultMail.js + +libs:: + $(MAKE_INSTALL) $(JS_SET_BROWSER_COMPONENT) $(DIST)\bin\components + $(MAKE_INSTALL) $(JS_SET_MAIL_COMPONENT) $(DIST)\bin\components + $(MAKE_INSTALL) $(JS_UNSET_MAIL_COMPONENT) $(DIST)\bin\components + clobber:: rm -f $(DIST)\lib\$(LIBRARY_NAME).lib + rm -f $(DIST)\bin\components\$(JS_SET_BROWSER_COMPONENT) + rm -f $(DIST)\bin\components\$(JS_SET_MAIL_COMPONENT) + rm -f $(DIST)\bin\components\$(JS_UNSET_MAIL_COMPONENT) diff --git a/mozilla/xpfe/components/winhooks/nsSetDefaultBrowser.js b/mozilla/xpfe/components/winhooks/nsSetDefaultBrowser.js new file mode 100644 index 00000000000..b264b2fbb5b --- /dev/null +++ b/mozilla/xpfe/components/winhooks/nsSetDefaultBrowser.js @@ -0,0 +1,184 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Default Browser. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corp. + * Portions created by the Initial Developer are Copyright (C) 2002 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bill Law + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* This file implements the nsICmdLineHandler interface. See nsICmdLineHandler.idl + * at http://lxr.mozilla.org/seamonkey/source/xpfe/appshell/public/nsICmdLineHandler.idl. + * + * This component handles the startup command line argument of the form: + * -setDefaultBrowser + * by making the current executable the "default browser." It accomplishes + * that via use of the nsIWindowsHooks interface (see implementation below). + * + * The module is registered under the contractid + * "@mozilla.org/commandlinehandler/general-startup;1?type=setDefaultBrowser" + * + * The implementation consists of a JavaScript "class" named nsKillAll, + * comprised of: + * - a JS constructor function + * - a prototype providing all the interface methods and implementation stuff + * + * In addition, this file implements an nsIModule object that registers the + * nsSetDefaultBrowser component. + */ + +/* ctor + */ +function nsSetDefaultBrowser() { +} + +nsSetDefaultBrowser.prototype = { + + // nsICmdLineHandler interface + get commandLineArgument() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + get prefNameForStartup() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + + get chromeUrlForTask() { + // First, get winhooks service. + var winHooks = Components.classes[ "@mozilla.org/winhooks;1" ] + .getService( Components.interfaces.nsIWindowsHooks ); + + // Next, extract current settings (these are what the user + // had previously checked on the Advanced/System pref panel). + var settings = winHooks.settings; + + // Now, turn on all "default browser" settings. + settings.isHandlingHTTP = true; + settings.isHandlingHTTPS = true; + settings.isHandlingFTP = true; + settings.isHandlingHTML = true; + settings.isHandlingXHTML = true; + settings.isHandlingXML = true; + + // Finally, apply the (new) settings. + winHooks.settings = settings; + + // Now, get the cmd line service. + var cmdLineService = Components.classes[ "@mozilla.org/appshell/commandLineService;1" ] + .getService( Components.interfaces.nsICmdLineService ); + + // See if "-setDefaultBrowser" was specified. The value will be "1" if + // -setDefaultBrowser is in the service's list of cmd line arguments, and + // null otherwise. -setDefaultBrowser will only be in the service's + // arg list if the application was not already running. That's because + // if it was already running, then the service reflects the arguments + // that were specified when *that* process was started, *not* the ones + // passed via IPC from the second instance. + var option = cmdLineService.getCmdLineValue( "-setDefaultBrowser" ); + if (!option) { + // Already running, so we don't have to worry about opening + // another window, etc. + throw Components.results.NS_ERROR_NOT_AVAILABLE; + } + + // Return URL for dummy window that will auto-close. We do this rather + // than throw NS_ERROR_NOT_AVAILABLE, which *should* work, because it + // seems that if we don't open a window, we get a crash when trying to + // release this (or some other) JS component during XPCOM shutdown. + return "chrome://global/content/dummyWindow.xul"; + }, + + get helpText() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + get handlesArgs() { return false; }, + get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + + // nsISupports interface + + // This "class" supports nsICmdLineHandler and nsISupports. + QueryInterface: function (iid) { + if (!iid.equals(Components.interfaces.nsICmdLineHandler) && + !iid.equals(Components.interfaces.nsISupports)) { + throw Components.results.NS_ERROR_NO_INTERFACE; + } + return this; + }, + + // This Component's module implementation. All the code below is used to get this + // component registered and accessible via XPCOM. + module: { + // registerSelf: Register this component. + registerSelf: function (compMgr, fileSpec, location, type) { + compMgr = compMgr.QueryInterface( Components.interfaces.nsIComponentManagerObsolete ); + compMgr.registerComponentWithType( this.cid, + "Default Browser Component", + this.contractId, + fileSpec, + location, + true, + true, + type ); + }, + + // getClassObject: Return this component's factory object. + getClassObject: function (compMgr, cid, iid) { + if (!cid.equals(this.cid)) + throw Components.results.NS_ERROR_NO_INTERFACE; + + if (!iid.equals(Components.interfaces.nsIFactory)) + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + + return this.factory; + }, + + /* CID for this class */ + cid: Components.ID("{C66E05DC-509C-4972-A1F2-EE5AC34B9800}"), + + /* Contract ID for this class */ + contractId: "@mozilla.org/commandlinehandler/general-startup;1?type=setDefaultBrowser", + + /* factory object */ + factory: { + // createInstance: Return a new nsSetDefaultBrowser object. + createInstance: function (outer, iid) { + if (outer != null) + throw Components.results.NS_ERROR_NO_AGGREGATION; + + return (new nsSetDefaultBrowser()).QueryInterface(iid); + } + }, + + // canUnload: n/a (returns true) + canUnload: function(compMgr) { + return true; + } + } +} + +// NSGetModule: Return the nsIModule object. +function NSGetModule(compMgr, fileSpec) { + return nsSetDefaultBrowser.prototype.module; +} diff --git a/mozilla/xpfe/components/winhooks/nsSetDefaultMail.js b/mozilla/xpfe/components/winhooks/nsSetDefaultMail.js new file mode 100644 index 00000000000..4fdcfaa8723 --- /dev/null +++ b/mozilla/xpfe/components/winhooks/nsSetDefaultMail.js @@ -0,0 +1,185 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Set Default Mail. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corp. + * Portions created by the Initial Developer are Copyright (C) 2002 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bill Law + * Sean Su + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* This file implements the nsICmdLineHandler interface. See nsICmdLineHandler.idl + * at http://lxr.mozilla.org/seamonkey/source/xpfe/appshell/public/nsICmdLineHandler.idl. + * + * This component handles the startup command line argument of the form: + * -setDefaultMail + * by making the current executable the "default mail client." + * + * The module is registered under the contractid + * "@mozilla.org/commandlinehandler/general-startup;1?type=setDefaultMail" + * + * The implementation consists of a JavaScript "class" named nsSetDefaultMail, + * comprised of: + * - a JS constructor function + * - a prototype providing all the interface methods and implementation stuff + * + * In addition, this file implements an nsIModule object that registers the + * nsSetDefaultMail component. + */ + +/* ctor + */ +function nsSetDefaultMail() { +} + +nsSetDefaultMail.prototype = { + + // nsICmdLineHandler interface + get commandLineArgument() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + get prefNameForStartup() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + + get chromeUrlForTask() { + + var mapiRegistry; + try { + var mapiRegistryProgID = "@mozilla.org/mapiregistry;1" + // make sure mail is installed + if (mapiRegistryProgID in Components.classes) { + mapiRegistry = Components.classes[mapiRegistryProgID].getService(Components.interfaces.nsIMapiRegistry); + } + else { + mapiRegistry = null; + } + } + catch (ex) { + mapiRegistry = null; + } + + // Set mailnews as the default mail handler here + if(mapiRegistry) + mapiRegistry.isDefaultMailClient = true; + + // Now, get the cmd line service. + var cmdLineService = Components.classes[ "@mozilla.org/appshell/commandLineService;1" ] + .getService( Components.interfaces.nsICmdLineService ); + + // See if "-setDefaultMail" was specified. The value will be "1" if + // -setDefaultMail is in the service's list of cmd line arguments, and + // null otherwise. -setDefaultMail will only be in the service's + // arg list if the application was not already running. That's because + // if it was already running, then the service reflects the arguments + // that were specified when *that* process was started, *not* the ones + // passed via IPC from the second instance. + var option = cmdLineService.getCmdLineValue( "-setDefaultMail" ); + if (!option) { + // Already running, so we don't have to worry about opening + // another window, etc. + throw Components.results.NS_ERROR_NOT_AVAILABLE; + } + + // Return URL for dummy window that will auto-close. We do this rather + // than throw NS_ERROR_NOT_AVAILABLE, which *should* work, because it + // seems that if we don't open a window, we get a crash when trying to + // release this (or some other) JS component during XPCOM shutdown. + return "chrome://global/content/dummyWindow.xul"; + }, + + get helpText() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + get handlesArgs() { return false; }, + get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + + // nsISupports interface + + // This "class" supports nsICmdLineHandler and nsISupports. + QueryInterface: function (iid) { + if (!iid.equals(Components.interfaces.nsICmdLineHandler) && + !iid.equals(Components.interfaces.nsISupports)) { + throw Components.results.NS_ERROR_NO_INTERFACE; + } + return this; + }, + + // This Component's module implementation. All the code below is used to get this + // component registered and accessible via XPCOM. + module: { + // registerSelf: Register this component. + registerSelf: function (compMgr, fileSpec, location, type) { + compMgr = compMgr.QueryInterface( Components.interfaces.nsIComponentManagerObsolete ); + compMgr.registerComponentWithType( this.cid, + "Set Mailnews as Default mail handler", + this.contractId, + fileSpec, + location, + true, + true, + type ); + }, + + // getClassObject: Return this component's factory object. + getClassObject: function (compMgr, cid, iid) { + if (!cid.equals(this.cid)) + throw Components.results.NS_ERROR_NO_INTERFACE; + + if (!iid.equals(Components.interfaces.nsIFactory)) + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + + return this.factory; + }, + + /* CID for this class */ + cid: Components.ID("{8b26281d-c3b2-4b57-9653-419fc705a02d}"), + + /* Contract ID for this class */ + contractId: "@mozilla.org/commandlinehandler/general-startup;1?type=setDefaultMail", + + /* factory object */ + factory: { + // createInstance: Return a new nsSetDefaultMail object. + createInstance: function (outer, iid) { + if (outer != null) + throw Components.results.NS_ERROR_NO_AGGREGATION; + + return (new nsSetDefaultMail()).QueryInterface(iid); + } + }, + + // canUnload: n/a (returns true) + canUnload: function(compMgr) { + return true; + } + } +} + +// NSGetModule: Return the nsIModule object. +function NSGetModule(compMgr, fileSpec) { + return nsSetDefaultMail.prototype.module; +} diff --git a/mozilla/xpfe/components/winhooks/nsUnsetDefaultMail.js b/mozilla/xpfe/components/winhooks/nsUnsetDefaultMail.js new file mode 100644 index 00000000000..8fe69c35d8f --- /dev/null +++ b/mozilla/xpfe/components/winhooks/nsUnsetDefaultMail.js @@ -0,0 +1,185 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Unset Default Mail. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corp. + * Portions created by the Initial Developer are Copyright (C) 2002 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Bill Law + * Sean Su + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* This file implements the nsICmdLineHandler interface. See nsICmdLineHandler.idl + * at http://lxr.mozilla.org/seamonkey/source/xpfe/appshell/public/nsICmdLineHandler.idl. + * + * This component handles the startup command line argument of the form: + * -unsetDefaultMail + * by making the current executable the "default mail client." + * + * The module is registered under the contractid + * "@mozilla.org/commandlinehandler/general-startup;1?type=unsetDefaultMail" + * + * The implementation consists of a JavaScript "class" named nsUnsetDefaultMail, + * comprised of: + * - a JS constructor function + * - a prototype providing all the interface methods and implementation stuff + * + * In addition, this file implements an nsIModule object that registers the + * nsUnsetDefaultMail component. + */ + +/* ctor + */ +function nsUnsetDefaultMail() { +} + +nsUnsetDefaultMail.prototype = { + + // nsICmdLineHandler interface + get commandLineArgument() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + get prefNameForStartup() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + + get chromeUrlForTask() { + + var mapiRegistry; + try { + var mapiRegistryProgID = "@mozilla.org/mapiregistry;1" + // make sure mail is installed + if (mapiRegistryProgID in Components.classes) { + mapiRegistry = Components.classes[mapiRegistryProgID].getService(Components.interfaces.nsIMapiRegistry); + } + else { + mapiRegistry = null; + } + } + catch (ex) { + mapiRegistry = null; + } + + // Restore the previous app that was the default mail handler + if(mapiRegistry) + mapiRegistry.isDefaultMailClient = false; + + // Now, get the cmd line service. + var cmdLineService = Components.classes[ "@mozilla.org/appshell/commandLineService;1" ] + .getService( Components.interfaces.nsICmdLineService ); + + // See if "-unsetDefaultMail" was specified. The value will be "1" if + // -unsetDefaultMail is in the service's list of cmd line arguments, and + // null otherwise. -unsetDefaultMail will only be in the service's + // arg list if the application was not already running. That's because + // if it was already running, then the service reflects the arguments + // that were specified when *that* process was started, *not* the ones + // passed via IPC from the second instance. + var option = cmdLineService.getCmdLineValue( "-unsetDefaultMail" ); + if (!option) { + // Already running, so we don't have to worry about opening + // another window, etc. + throw Components.results.NS_ERROR_NOT_AVAILABLE; + } + + // Return URL for dummy window that will auto-close. We do this rather + // than throw NS_ERROR_NOT_AVAILABLE, which *should* work, because it + // seems that if we don't open a window, we get a crash when trying to + // release this (or some other) JS component during XPCOM shutdown. + return "chrome://global/content/dummyWindow.xul"; + }, + + get helpText() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + get handlesArgs() { return false; }, + get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }, + + // nsISupports interface + + // This "class" supports nsICmdLineHandler and nsISupports. + QueryInterface: function (iid) { + if (!iid.equals(Components.interfaces.nsICmdLineHandler) && + !iid.equals(Components.interfaces.nsISupports)) { + throw Components.results.NS_ERROR_NO_INTERFACE; + } + return this; + }, + + // This Component's module implementation. All the code below is used to get this + // component registered and accessible via XPCOM. + module: { + // registerSelf: Register this component. + registerSelf: function (compMgr, fileSpec, location, type) { + compMgr = compMgr.QueryInterface( Components.interfaces.nsIComponentManagerObsolete ); + compMgr.registerComponentWithType( this.cid, + "Unset Mailnews as Default mail handler", + this.contractId, + fileSpec, + location, + true, + true, + type ); + }, + + // getClassObject: Return this component's factory object. + getClassObject: function (compMgr, cid, iid) { + if (!cid.equals(this.cid)) + throw Components.results.NS_ERROR_NO_INTERFACE; + + if (!iid.equals(Components.interfaces.nsIFactory)) + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + + return this.factory; + }, + + /* CID for this class */ + cid: Components.ID("{ae9c026a-3bb4-485f-bab8-d7142f336ec1}"), + + /* Contract ID for this class */ + contractId: "@mozilla.org/commandlinehandler/general-startup;1?type=unsetDefaultMail", + + /* factory object */ + factory: { + // createInstance: Return a new nsUnsetDefaultMail object. + createInstance: function (outer, iid) { + if (outer != null) + throw Components.results.NS_ERROR_NO_AGGREGATION; + + return (new nsUnsetDefaultMail()).QueryInterface(iid); + } + }, + + // canUnload: n/a (returns true) + canUnload: function(compMgr) { + return true; + } + } +} + +// NSGetModule: Return the nsIModule object. +function NSGetModule(compMgr, fileSpec) { + return nsUnsetDefaultMail.prototype.module; +} diff --git a/mozilla/xpinstall/packager/packages-win b/mozilla/xpinstall/packager/packages-win index 15e2438596d..9e5eb4fd570 100644 --- a/mozilla/xpinstall/packager/packages-win +++ b/mozilla/xpinstall/packager/packages-win @@ -264,6 +264,7 @@ bin\components\transformiix.xpt bin\components\transformiix.dll bin\ISimpleDOMNodeMarshal.dll bin\ISimpleDOMDocumentMarshal.dll +bin\components\nsSetDefaultBrowser.js ; LDAP components need to be in the browser for AutoConfig bin\components\mozldap.dll @@ -385,6 +386,8 @@ bin\components\mapihook.xpt bin\components\msgmdn.dll bin\components\msgmdn.xpt bin\components\mdn-service.js +bin\components\nsSetDefaultMail.js +bin\components\nsUnsetDefaultMail.js [chatzilla] bin\components\chatzilla-service.js diff --git a/mozilla/xpinstall/wizard/windows/uninstall/dialogs.c b/mozilla/xpinstall/wizard/windows/uninstall/dialogs.c index 9d5e119c410..07dc8a1a0dd 100644 --- a/mozilla/xpinstall/wizard/windows/uninstall/dialogs.c +++ b/mozilla/xpinstall/wizard/windows/uninstall/dialogs.c @@ -29,6 +29,179 @@ #include "parser.h" #include "rdi.h" +void SetDefault() +{ + char szBuf[MAX_BUF]; + char szRegKey[MAX_BUF]; + + GetPrivateProfileString(ugUninstall.szDefaultComponent, "ClientTypeName", "", szBuf, MAX_BUF, szFileIniDefaultsInfo); + wsprintf(szRegKey, "SOFTWARE\\Clients\\%s", szBuf); + GetPrivateProfileString(ugUninstall.szDefaultComponent, "ClientProductKey", "", szBuf, MAX_BUF, szFileIniDefaultsInfo); + + SetWinReg(HKEY_LOCAL_MACHINE, szRegKey, "", REG_SZ, szBuf, lstrlen(szBuf)); +} + +void ParseDefaultsInfo() +{ + char szBuf[MAX_BUF]; + char szIniKey[MAX_BUF]; + char szStorageDir[MAX_BUF]; + char szShortcutPath[MAX_BUF]; + char szStoredShortcutPath[MAX_BUF]; + char szRegKey[MAX_BUF]; + char szClientTypeName[MAX_BUF]; + char szClientProductKey[MAX_BUF]; + int iIndex; + DWORD dwIconsVisible; + + // If szAppPath is a null sting, i.e. we cannot find where the app has been installed: + // - HIDEICONS will still remove the shortcuts but + // - SHOWICONS will do nothing because we won't be able to find the shortcuts to display. + ParsePath(ugUninstall.szAppPath, szStorageDir, MAX_BUF, PP_PATH_ONLY); + lstrcat(szStorageDir, "defaults\\shortcuts\\"); + + // CLEANUP ISSUE: For all of the SHOWICON and HIDEICONS blocks below, there is a lot of + // redundancy: + // - Right now I'm just trying to create icons and, if I can't, trying under the PERSONAL + // key instead. I would be cleaner to check for restricted access once, and then just + // create the appropriate key each time. + // - Creating a ShowIcon() and a HideIcon() function would rid us much of the redundency. + + + // Deal with Desktop Icons + iIndex = 0; + wsprintf(szIniKey, "DesktopShortcut%d", iIndex); + GetPrivateProfileString(ugUninstall.szDefaultComponent, szIniKey, "", szBuf, MAX_BUF, szFileIniDefaultsInfo); + while(szBuf[0] != '\0') + { + strcpy(szShortcutPath, "COMMON_DESKTOP"); + DecryptVariable(szShortcutPath, MAX_BUF); + + if((ugUninstall.dwMode == SHOWICONS) && (szStorageDir[0] != '\0')) + { + wsprintf(szStoredShortcutPath, "%s%s", szStorageDir, szBuf); + FileCopy(szStoredShortcutPath, szShortcutPath, 0); + if( (!FileExists(szShortcutPath)) && (!(ulOSType & OS_WIN9x)) ) + { + strcpy(szShortcutPath, "PERSONAL_DESKTOP"); + DecryptVariable(szShortcutPath, MAX_BUF); + FileCopy(szStoredShortcutPath, szShortcutPath, 0); + } + } + + if (ugUninstall.dwMode == HIDEICONS) + { + AppendBackSlash(szShortcutPath, MAX_BUF); + lstrcat(szShortcutPath, szBuf); + if( (!FileExists(szShortcutPath)) && (!(ulOSType & OS_WIN9x)) ) + { + strcpy(szShortcutPath, "PERSONAL_DESKTOP"); + DecryptVariable(szShortcutPath, MAX_BUF); + AppendBackSlash(szShortcutPath, MAX_BUF); + lstrcat(szShortcutPath, szBuf); + } + + FileDelete(szShortcutPath); + } + + iIndex++; + wsprintf(szIniKey, "DesktopShortcut%d", iIndex); + GetPrivateProfileString(ugUninstall.szDefaultComponent, szIniKey, "", szBuf, MAX_BUF, szFileIniDefaultsInfo); + } + + // Deal with StartMenu Icons + iIndex = 0; + wsprintf(szIniKey, "StartMenuShortcut%d", iIndex); + GetPrivateProfileString(ugUninstall.szDefaultComponent, szIniKey, "", szBuf, MAX_BUF, szFileIniDefaultsInfo); + while(szBuf[0] != '\0') + { + strcpy(szShortcutPath, "COMMON_STARTMENU"); + DecryptVariable(szShortcutPath, MAX_BUF); + + if((ugUninstall.dwMode == SHOWICONS) && (szStorageDir[0] != '\0')) + { + lstrcpy(szStoredShortcutPath, szStorageDir); + lstrcat(szStoredShortcutPath, szBuf); + FileCopy(szStoredShortcutPath, szShortcutPath, 0); + if( (!FileExists(szShortcutPath)) && (!(ulOSType & OS_WIN9x)) ) + { + strcpy(szShortcutPath, "PERSONAL_STARTMENU"); + DecryptVariable(szShortcutPath, MAX_BUF); + FileCopy(szStoredShortcutPath, szShortcutPath, 0); + } + } + + if (ugUninstall.dwMode == HIDEICONS) + { + AppendBackSlash(szShortcutPath, MAX_BUF); + lstrcat(szShortcutPath, szBuf); + if( (!FileExists(szShortcutPath)) && (!(ulOSType & OS_WIN9x)) ) + { + strcpy(szShortcutPath, "PERSONAL_STARTMENU"); + DecryptVariable(szShortcutPath, MAX_BUF); + AppendBackSlash(szShortcutPath, MAX_BUF); + lstrcat(szShortcutPath, szBuf); + } + + FileDelete(szShortcutPath); + } + + iIndex++; + wsprintf(szIniKey, "StartMenuShortcut%d", iIndex); + GetPrivateProfileString(ugUninstall.szDefaultComponent, szIniKey, "", szBuf, MAX_BUF, szFileIniDefaultsInfo); + } + + // Deal with QuickLaunch Bar Icons + iIndex = 0; + wsprintf(szIniKey, "QuickLaunchBarShortcut%d", iIndex); + GetPrivateProfileString(ugUninstall.szDefaultComponent, szIniKey, "", szBuf, MAX_BUF, szFileIniDefaultsInfo); + while(szBuf[0] != '\0') + { + GetWinReg(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "AppData", szShortcutPath, MAX_BUF); + lstrcat(szShortcutPath, "\\Microsoft\\Internet Explorer\\Quick Launch"); + + if((ugUninstall.dwMode == SHOWICONS) && (szStorageDir[0] != '\0')) + { + wsprintf(szStoredShortcutPath, "%s%s", szStorageDir, szBuf); + FileCopy(szStoredShortcutPath, szShortcutPath, 0); + if( (!FileExists(szShortcutPath)) && (!(ulOSType & OS_WIN9x)) ) + { + GetWinReg(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\GrpConv\\MapGroups", "Quick Launch", szShortcutPath, MAX_BUF); + FileCopy(szStoredShortcutPath, szShortcutPath, 0); + } + } + + if (ugUninstall.dwMode == HIDEICONS) + { + AppendBackSlash(szShortcutPath, MAX_BUF); + lstrcat(szShortcutPath, szBuf); + if( (!FileExists(szShortcutPath)) && (!(ulOSType & OS_WIN9x)) ) + { + GetWinReg(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\GrpConv\\MapGroups", "Quick Launch", szShortcutPath, MAX_BUF); + AppendBackSlash(szShortcutPath, MAX_BUF); + lstrcat(szShortcutPath, szBuf); + } + + FileDelete(szShortcutPath); + } + + ++iIndex; + wsprintf(szIniKey, "QuickLaunchBarShortcut%d", iIndex); + GetPrivateProfileString(ugUninstall.szDefaultComponent, szIniKey, "", szBuf, MAX_BUF, szFileIniDefaultsInfo); + } + + GetPrivateProfileString(ugUninstall.szDefaultComponent, "ClientTypeName", "", szClientTypeName, MAX_BUF, szFileIniDefaultsInfo); + GetPrivateProfileString(ugUninstall.szDefaultComponent, "ClientProductKey", "", szClientProductKey, MAX_BUF, szFileIniDefaultsInfo); + wsprintf(szRegKey, "SOFTWARE\\Clients\\%s\\%s\\InstallInfo", szClientTypeName, szClientProductKey); + + if (ugUninstall.dwMode == SHOWICONS) + dwIconsVisible = 1; + else + dwIconsVisible = 0; + + SetWinRegNumValue(HKEY_LOCAL_MACHINE, szRegKey, "IconsVisible", dwIconsVisible); +} + void ParseAllUninstallLogs() { char szFileInstallLog[MAX_BUF]; diff --git a/mozilla/xpinstall/wizard/windows/uninstall/dialogs.h b/mozilla/xpinstall/wizard/windows/uninstall/dialogs.h index 731dabcd400..aeae91e4ba5 100644 --- a/mozilla/xpinstall/wizard/windows/uninstall/dialogs.h +++ b/mozilla/xpinstall/wizard/windows/uninstall/dialogs.h @@ -30,6 +30,8 @@ LRESULT CALLBACK DlgProcWhatToDo(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara LRESULT CALLBACK DlgProcMessage(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); void ParseAllUninstallLogs(); +void ParseDefaultsInfo(); +void SetDefault(); HWND InstantiateDialog(HWND hParent, DWORD dwDlgID, LPSTR szTitle, WNDPROC wpDlgProc); void ShowMessage(LPSTR szMessage, BOOL bShow); void ProcessWindowsMessages(void); diff --git a/mozilla/xpinstall/wizard/windows/uninstall/extern.h b/mozilla/xpinstall/wizard/windows/uninstall/extern.h index 86782edebe1..73fd443debc 100644 --- a/mozilla/xpinstall/wizard/windows/uninstall/extern.h +++ b/mozilla/xpinstall/wizard/windows/uninstall/extern.h @@ -46,6 +46,7 @@ extern LPSTR szUninstallDir; extern LPSTR szTempDir; extern LPSTR szOSTempDir; extern LPSTR szFileIniUninstall; +extern LPSTR szFileIniDefaultsInfo; extern LPSTR gszSharedFilename; extern ULONG ulOSType; diff --git a/mozilla/xpinstall/wizard/windows/uninstall/extra.c b/mozilla/xpinstall/wizard/windows/uninstall/extra.c index a29d5d984e5..a173de3aff2 100644 --- a/mozilla/xpinstall/wizard/windows/uninstall/extra.c +++ b/mozilla/xpinstall/wizard/windows/uninstall/extra.c @@ -206,6 +206,14 @@ HRESULT Initialize(HINSTANCE hInstance) AppendBackSlash(szFileIniUninstall, MAX_BUF); lstrcat(szFileIniUninstall, FILE_INI_UNINSTALL); + if((szFileIniDefaultsInfo = NS_GlobalAlloc(MAX_BUF)) == NULL) + return(1); + + lstrcpy(szFileIniDefaultsInfo, szUninstallDir); + AppendBackSlash(szFileIniDefaultsInfo, MAX_BUF); + GetPrivateProfileString("General", "Defaults Info Filename", "", szBuf, MAX_BUF, szFileIniUninstall); + lstrcat(szFileIniDefaultsInfo, szBuf); + // determine the system's TEMP path if(GetTempPath(MAX_BUF, szTempDir) == 0) { @@ -428,6 +436,12 @@ void SetUninstallRunMode(LPSTR szMode) ugUninstall.dwMode = AUTO; if(lstrcmpi(szMode, "SILENT") == 0) ugUninstall.dwMode = SILENT; + if(lstrcmpi(szMode, "SHOWICONS") == 0) + ugUninstall.dwMode = SHOWICONS; + if(lstrcmpi(szMode, "HIDEICONS") == 0) + ugUninstall.dwMode = HIDEICONS; + if(lstrcmpi(szMode, "SETDEFAULT") == 0) + ugUninstall.dwMode = SETDEFAULT; } void RemoveBackSlash(LPSTR szInput) @@ -717,6 +731,8 @@ HRESULT InitUninstallGeneral() { ugUninstall.dwMode = NORMAL; + if((ugUninstall.szAppPath = NS_GlobalAlloc(MAX_BUF)) == NULL) + return(1); if((ugUninstall.szLogPath = NS_GlobalAlloc(MAX_BUF)) == NULL) return(1); if((ugUninstall.szLogFilename = NS_GlobalAlloc(MAX_BUF)) == NULL) @@ -729,6 +745,8 @@ HRESULT InitUninstallGeneral() return(1); if((ugUninstall.szUserAgent = NS_GlobalAlloc(MAX_BUF)) == NULL) return(1); + if((ugUninstall.szDefaultComponent = NS_GlobalAlloc(MAX_BUF)) == NULL) + return(1); if((ugUninstall.szWrMainKey = NS_GlobalAlloc(MAX_BUF)) == NULL) return(1); if((ugUninstall.szDescription = NS_GlobalAlloc(MAX_BUF)) == NULL) @@ -743,12 +761,14 @@ HRESULT InitUninstallGeneral() void DeInitUninstallGeneral() { + FreeMemory(&(ugUninstall.szAppPath)); FreeMemory(&(ugUninstall.szLogPath)); FreeMemory(&(ugUninstall.szLogFilename)); FreeMemory(&(ugUninstall.szDescription)); FreeMemory(&(ugUninstall.szUninstallKeyDescription)); FreeMemory(&(ugUninstall.szUninstallFilename)); FreeMemory(&(ugUninstall.szUserAgent)); + FreeMemory(&(ugUninstall.szDefaultComponent)); FreeMemory(&(ugUninstall.szWrKey)); FreeMemory(&(ugUninstall.szCompanyName)); FreeMemory(&(ugUninstall.szProductName)); @@ -848,6 +868,27 @@ void ParseCommandLine(LPSTR lpszCmdLine) if((i + 1) < iArgC) GetArgV(lpszCmdLine, ++i, ugUninstall.szUserAgent, MAX_BUF); } + else if((lstrcmpi(szArgVBuf, "-ss") == 0) || (lstrcmpi(szArgVBuf, "/ss") == 0)) + // Show Shortcuts + { + SetUninstallRunMode("SHOWICONS"); + if((i + 1) < iArgC) + GetArgV(lpszCmdLine, ++i, ugUninstall.szDefaultComponent, MAX_BUF); + } + else if((lstrcmpi(szArgVBuf, "-hs") == 0) || (lstrcmpi(szArgVBuf, "/hs") == 0)) + // Hide Shortcuts + { + SetUninstallRunMode("HIDEICONS"); + if((i + 1) < iArgC) + GetArgV(lpszCmdLine, ++i, ugUninstall.szDefaultComponent, MAX_BUF); + } + else if((lstrcmpi(szArgVBuf, "-sd") == 0) || (lstrcmpi(szArgVBuf, "/sd") == 0)) + // SetDefault + { + SetUninstallRunMode("SETDEFAULT"); + if((i + 1) < iArgC) + GetArgV(lpszCmdLine, ++i, ugUninstall.szDefaultComponent, MAX_BUF); + } ++i; } @@ -1231,6 +1272,38 @@ BOOL CheckLegacy(HWND hDlg) return(FALSE); } +HRESULT GetAppPath() +{ + char szTmpAppPath[MAX_BUF]; + char szKey[MAX_BUF]; + BOOL bRestrictedAccess; + HKEY hkRoot; + + if(*ugUninstall.szUserAgent != '\0') + { + hkRoot = ugUninstall.hWrMainRoot; + wsprintf(szKey, "%s\\%s\\Main", ugUninstall.szWrMainKey, ugUninstall.szUserAgent); + } + else + { + hkRoot = ugUninstall.hWrRoot; + strcpy(szKey, ugUninstall.szWrKey); + } + + bRestrictedAccess = VerifyRestrictedAccess(); + if(bRestrictedAccess) + hkRoot = HKEY_CURRENT_USER; + + GetWinReg(hkRoot, szKey, "PathToExe", szTmpAppPath, sizeof(szTmpAppPath)); + + if(FileExists(szTmpAppPath)) + { + lstrcpy(ugUninstall.szAppPath, szTmpAppPath); + } + + return(0); +} + HRESULT GetUninstallLogPath() { char szBuf[MAX_BUF]; @@ -1318,13 +1391,9 @@ HRESULT ParseUninstallIni(LPSTR lpszCmdLine) char fontSize[MAX_BUF]; char charSet[MAX_BUF]; - if(CheckInstances()) - return(1); if(InitUninstallGeneral()) return(1); - if(InitDlgUninstall(&diUninstall)) - return(1); - + lstrcpy(ugUninstall.szLogFilename, FILE_LOG_INSTALL); /* get install Mode information */ @@ -1332,6 +1401,12 @@ HRESULT ParseUninstallIni(LPSTR lpszCmdLine) SetUninstallRunMode(szBuf); ParseCommandLine(lpszCmdLine); + if((ugUninstall.dwMode != SHOWICONS) && (ugUninstall.dwMode != HIDEICONS) && (ugUninstall.dwMode != SETDEFAULT)) + if(CheckInstances()) + return(1); + if(InitDlgUninstall(&diUninstall)) + return(1); + /* get product name description */ GetPrivateProfileString("General", "Company Name", "", ugUninstall.szCompanyName, MAX_BUF, szFileIniUninstall); GetPrivateProfileString("General", "Product Name", "", ugUninstall.szProductName, MAX_BUF, szFileIniUninstall); @@ -1377,6 +1452,9 @@ HRESULT ParseUninstallIni(LPSTR lpszCmdLine) { case AUTO: case SILENT: + case SHOWICONS: + case HIDEICONS: + case SETDEFAULT: gdwWhatToDo = WTD_NO_TO_ALL; diUninstall.bShowDialog = FALSE; break; @@ -1392,6 +1470,7 @@ HRESULT ParseUninstallIni(LPSTR lpszCmdLine) lf.lfCharSet = atoi(charSet); ugUninstall.definedFont = CreateFontIndirect( &lf ); + GetAppPath(); return(GetUninstallLogPath()); } @@ -1440,6 +1519,29 @@ void SetWinReg(HKEY hkRootKey, LPSTR szKey, LPSTR szName, DWORD dwType, LPSTR sz } } +void SetWinRegNumValue(HKEY hkRootKey, LPSTR szKey, LPSTR szName, DWORD dwData) +{ + HKEY hkResult; + DWORD dwErr; + DWORD dwDisp; + DWORD dwVal; + DWORD dwValSize; + + dwVal = dwData; + dwValSize = sizeof(DWORD); + + dwErr = RegOpenKeyEx(hkRootKey, szKey, 0, KEY_WRITE, &hkResult); + if(dwErr != ERROR_SUCCESS) + dwErr = RegCreateKeyEx(hkRootKey, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkResult, &dwDisp); + + if(dwErr == ERROR_SUCCESS) + { + dwErr = RegSetValueEx(hkResult, szName, 0, REG_DWORD, (LPBYTE)&dwVal, dwValSize); + + RegCloseKey(hkResult); + } +} + HRESULT DecryptVariable(LPSTR szVariable, DWORD dwVariableSize) { char szBuf[MAX_BUF]; @@ -1797,7 +1899,7 @@ HRESULT DecryptString(LPSTR szOutputStr, LPSTR szInputStr) bDecrypted = DecryptVariable(szVariable, MAX_BUF); if(!bDecrypted) { - /* Variable was not able to be dcripted. */ + /* Variable was not able to be decrypted. */ /* Leave the variable as it was read in by adding the '[' and ']' */ /* characters back to the variable. */ lstrcpy(szBuf, "["); @@ -1848,5 +1950,7 @@ void DeInitialize() FreeMemory(&szEDllLoad); FreeMemory(&szEStringLoad); FreeMemory(&szEStringNull); + FreeMemory(&szFileIniUninstall); + FreeMemory(&szFileIniDefaultsInfo); } diff --git a/mozilla/xpinstall/wizard/windows/uninstall/extra.h b/mozilla/xpinstall/wizard/windows/uninstall/extra.h index 313657ae765..a216f145e81 100644 --- a/mozilla/xpinstall/wizard/windows/uninstall/extra.h +++ b/mozilla/xpinstall/wizard/windows/uninstall/extra.h @@ -58,6 +58,7 @@ HRESULT DecryptString(LPSTR szOutputStr, LPSTR szInputStr); HRESULT DecryptVariable(LPSTR szVariable, DWORD dwVariableSize); void GetWinReg(HKEY hkRootKey, LPSTR szKey, LPSTR szName, LPSTR szReturnValue, DWORD dwSize); void SetWinReg(HKEY hkRootKey, LPSTR szKey, LPSTR szName, DWORD dwType, LPSTR szData, DWORD dwSize); +void SetWinRegNumValue(HKEY hkRootKey, LPSTR szKey, LPSTR szName, DWORD dwData); HRESULT InitUninstallGeneral(void); HRESULT InitDlgUninstall(diU *diDialog); sil *CreateSilNode(); @@ -87,6 +88,7 @@ LPSTR GetArgV(LPSTR lpszCommandLine, int iIndex, LPSTR lpszDest, int void ParseCommandLine(LPSTR lpszCmdLine); void SetUninstallRunMode(LPSTR szMode); void Delay(DWORD dwSeconds); +HRESULT GetAppPath(); HRESULT GetUninstallLogPath(); #endif diff --git a/mozilla/xpinstall/wizard/windows/uninstall/uninstall.c b/mozilla/xpinstall/wizard/windows/uninstall/uninstall.c index d95bb43969d..369bfaa3d84 100644 --- a/mozilla/xpinstall/wizard/windows/uninstall/uninstall.c +++ b/mozilla/xpinstall/wizard/windows/uninstall/uninstall.c @@ -47,6 +47,7 @@ LPSTR szUninstallDir; LPSTR szTempDir; LPSTR szOSTempDir; LPSTR szFileIniUninstall; +LPSTR szFileIniDefaultsInfo; LPSTR gszSharedFilename; ULONG ulOSType; @@ -96,6 +97,11 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmd { if(diUninstall.bShowDialog == TRUE) hDlgUninstall = InstantiateDialog(hWndMain, DLG_UNINSTALL, diUninstall.szTitle, DlgProcUninstall); + // Assumes that SHOWICONS, HIDEICONS, and SETDEFAULT never show dialogs + else if((ugUninstall.dwMode == SHOWICONS) || (ugUninstall.dwMode == HIDEICONS)) + ParseDefaultsInfo(); + else if(ugUninstall.dwMode == SETDEFAULT) + SetDefault(); else ParseAllUninstallLogs(); } diff --git a/mozilla/xpinstall/wizard/windows/uninstall/uninstall.h b/mozilla/xpinstall/wizard/windows/uninstall/uninstall.h index 1b871f05234..cf655a493d3 100644 --- a/mozilla/xpinstall/wizard/windows/uninstall/uninstall.h +++ b/mozilla/xpinstall/wizard/windows/uninstall/uninstall.h @@ -93,6 +93,9 @@ typedef int PRInt32; #define NORMAL 0 #define SILENT 1 #define AUTO 2 +#define SHOWICONS 3 +#define HIDEICONS 4 +#define SETDEFAULT 5 /* OS: Operating System */ #define OS_WIN9x 0x00000001 @@ -116,6 +119,7 @@ typedef struct dlgUninstall typedef struct uninstallStruct { DWORD dwMode; + LPSTR szAppPath; LPSTR szLogPath; LPSTR szLogFilename; LPSTR szCompanyName; @@ -128,6 +132,7 @@ typedef struct uninstallStruct HKEY hWrRoot; LPSTR szWrKey; LPSTR szUserAgent; + LPSTR szDefaultComponent; HFONT definedFont; } uninstallGen;