зеркало из https://github.com/mozilla/pjs.git
fixing bug 158187 - Support for Windows XP SP1 Integration (TRUNK merge). r=ssu,dprice,curt,law sr=jag,dveditz a=drivers
This commit is contained in:
Родитель
abc79acf35
Коммит
5253ed68d1
|
@ -1158,6 +1158,13 @@ static nsresult InitializeProfileService(nsICmdLineService *cmdLineArgs)
|
|||
nsCOMPtr<nsINativeAppSupport> 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<nsIAppShellService> appShellService(do_GetService(kAppShellServiceCID, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1481,9 +1488,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");
|
||||
|
|
|
@ -635,17 +635,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 ) {
|
||||
|
@ -2065,7 +2070,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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** 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 WinXP SP1 Support.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2002
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Bill Law <law@netscape.com>
|
||||
-
|
||||
- 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 LGPL or the GPL. 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 is a dummy window that autocloses. See nsDefaultBrowser.js. -->
|
||||
|
||||
<!DOCTYPE window>
|
||||
|
||||
<window id="dummyWindow" onload="window.close()"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
</window>
|
|
@ -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)
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape 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/NPL/
|
||||
#
|
||||
# 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.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Bill Law <law@netscape.com>
|
||||
|
||||
MODULE=appcomps
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
dom \
|
||||
windowwatcher \
|
||||
intl \
|
||||
appshell \
|
||||
necko \
|
||||
layout \
|
||||
content \
|
||||
widget \
|
||||
imglib2 \
|
||||
gfx \
|
||||
gfx2 \
|
||||
locale \
|
||||
$(NULL)
|
||||
DEPTH=..\..\..
|
||||
|
||||
XPIDL_MODULE=winhooks
|
||||
|
||||
XPIDLSRCS=\
|
||||
.\nsIWindowsHooks.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
LIBRARY_NAME = winhooks_s
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\nsWindowsHooks.obj \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
|
|
@ -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 <law@netscape.com>
|
||||
*
|
||||
* 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;
|
||||
}
|
|
@ -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 <law@netscape.com>
|
||||
* Sean Su <ssu@netscape.com>
|
||||
*
|
||||
* 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;
|
||||
}
|
|
@ -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 <law@netscape.com>
|
||||
* Sean Su <ssu@netscape.com>
|
||||
*
|
||||
* 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;
|
||||
}
|
|
@ -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
|
||||
|
@ -398,6 +399,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
|
||||
|
|
|
@ -43,6 +43,7 @@ function createShortcuts()
|
|||
var fWindows;
|
||||
var fTemp;
|
||||
var fProgram;
|
||||
var fDefShortcuts;
|
||||
var fileExe;
|
||||
var fileReadme;
|
||||
var fileLicense;
|
||||
|
@ -63,6 +64,7 @@ function createShortcuts()
|
|||
winreg = getWinRegistry();
|
||||
fWindows = getFolder("Windows");
|
||||
fProgram = getFolder("Program");
|
||||
fDefShortcuts = getFolder("Program","defaults/shortcuts");
|
||||
fTemp = fProgram + "$MainExeFile$";
|
||||
fileExe = getFolder("file:///", fTemp);
|
||||
fileReadme = getFolder("file:///", fProgram + "readme.txt");
|
||||
|
@ -172,10 +174,13 @@ function createShortcuts()
|
|||
* This is so that the folder creation gets logged for uninstall to remove it. */
|
||||
if(!File.exists(fFolderPath))
|
||||
File.dirCreate(fFolderPath);
|
||||
if(!File.exists(fDefShortcuts))
|
||||
File.dirCreate(fDefShortcuts);
|
||||
|
||||
/* create the shortcuts */
|
||||
File.windowsShortcut(fileExe, fFolderDesktop, scExeDesc, fProgram, "", fileExe, 0);
|
||||
File.windowsShortcut(fileExe, fFolderPath, scExeDesc, fProgram, "", fileExe, 0);
|
||||
File.windowsShortcut(fileExe, fDefShortcuts, scExeDesc, fProgram, "", fileExe, 0);
|
||||
File.windowsShortcut(fileExe, fFolderPath, scProfileDesc, fProgram, scProfileDescParam, fileExe, 0);
|
||||
File.windowsShortcut(fileReadme, fFolderPath, scReadmeDesc, fProgram, "", fileReadme, 0);
|
||||
File.windowsShortcut(fileLicense, fFolderPath, scLicenseDesc, fProgram, "", fileLicense, 0);
|
||||
|
@ -249,6 +254,30 @@ function createShortcuts()
|
|||
logComment("winreg is null");
|
||||
}
|
||||
}
|
||||
function IsWinnt()
|
||||
{
|
||||
/* Determines if the script is running under NT or not.
|
||||
*
|
||||
*/
|
||||
var winreg = getWinRegistry();
|
||||
var subkey;
|
||||
var valname;
|
||||
var szCurrentVersion;
|
||||
|
||||
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
||||
subkey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
|
||||
valname = "CurrentVersion";
|
||||
szCurrentVersion = winreg.getValueString(subkey, valname);
|
||||
logComment("szCurrentVersion: " + szCurrentVersion);
|
||||
if((szCurrentVersion == "") || (szCurrentVersion == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function registerMainKeys(winreg)
|
||||
{
|
||||
|
@ -326,6 +355,48 @@ function registerMainKeys(winreg)
|
|||
valname = "Install Directory";
|
||||
value = fProgram;
|
||||
err = winreg.setValueString(subkey, valname, value);
|
||||
|
||||
// Register as a windows XP internet browser
|
||||
if( IsWinnt() )
|
||||
{
|
||||
subkey = "Software\\Clients\\StartMenuInternet\\$MainExeFile$";
|
||||
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
||||
|
||||
winreg.createKey(subkey, "");
|
||||
winreg.createKey(subkey + "\\DefaultIcon", "");
|
||||
winreg.createKey(subkey + "\\shell", "");
|
||||
winreg.createKey(subkey + "\\shell\\open", "");
|
||||
winreg.createKey(subkey + "\\shell\\open\\command", "");
|
||||
winreg.createKey(subkey + "\\InstallInfo", "");
|
||||
|
||||
valname = "";
|
||||
data = "$ProductNameInternal$";
|
||||
winreg.setValueString(subkey, valname, data);
|
||||
|
||||
valname = "";
|
||||
// path does not need to be quoted per MS doc
|
||||
data = fProgram + "$MainExeFile$,0";
|
||||
winreg.setValueString(subkey + "\\DefaultIcon", valname, data);
|
||||
|
||||
valname = "";
|
||||
data = "\"" + fProgram + "$MainExeFile$\"";
|
||||
winreg.setValueString(subkey + "\\shell\\open\\command", valname, data);
|
||||
|
||||
valname = "HideIconsCommand";
|
||||
data = "\"" + fProgram + "uninstall\\NSUninst.exe\" /ms /ua \"$UserAgent$\" /hs browser";
|
||||
winreg.setValueString(subkey + "\\InstallInfo", valname, data);
|
||||
|
||||
valname = "IconsVisible";
|
||||
winreg.setValueNumber(subkey + "\\InstallInfo", valname, 1);
|
||||
|
||||
valname = "ReinstallCommand";
|
||||
data = "\"" + fProgram + "$MainExeFile$\" -silent -nosplash -setDefaultBrowser ";
|
||||
winreg.setValueString(subkey + "\\InstallInfo", valname, data);
|
||||
|
||||
valname = "ShowIconsCommand";
|
||||
data = "\"" + fProgram + "uninstall\\NSUninst.exe\" /ms /ua \"$UserAgent$\" /ss browser";
|
||||
winreg.setValueString(subkey + "\\InstallInfo", valname, data);
|
||||
}
|
||||
}
|
||||
|
||||
function updateWinReg()
|
||||
|
|
|
@ -517,77 +517,6 @@ $InstallSizeArchive$:browser.xpi
|
|||
Attributes=SELECTED|DISABLED|FORCE_UPGRADE
|
||||
Force Upgrade File0=[SETUP PATH]\$MainExeFile$
|
||||
|
||||
[Component Navigator-Windows Registry0]
|
||||
Root Key=HKEY_LOCAL_MACHINE
|
||||
Key=Software\Clients\StartMenuInternet\$MainExeFile$
|
||||
Name=
|
||||
Name Value=$ProductName$
|
||||
Type=REG_SZ
|
||||
Decrypt Key=FALSE
|
||||
Decrypt Name=FALSE
|
||||
Decrypt Name Value=FALSE
|
||||
Overwrite Key=TRUE
|
||||
Overwrite Name=TRUE
|
||||
Timing=post archive
|
||||
OS=NT51
|
||||
|
||||
[Component Navigator-Windows Registry1]
|
||||
Root Key=HKEY_LOCAL_MACHINE
|
||||
Key=Software\Clients\StartMenuInternet\$MainExeFile$\DefaultIcon
|
||||
Name=
|
||||
Name Value=[SETUP PATH]\$MainExeFile$,0
|
||||
Type=REG_SZ
|
||||
Decrypt Key=FALSE
|
||||
Decrypt Name=FALSE
|
||||
Decrypt Name Value=TRUE
|
||||
Overwrite Key=TRUE
|
||||
Overwrite Name=TRUE
|
||||
Timing=post archive
|
||||
OS=NT51
|
||||
|
||||
[Component Navigator-Windows Registry2]
|
||||
Root Key=HKEY_LOCAL_MACHINE
|
||||
Key=Software\Clients\StartMenuInternet\$MainExeFile$\shell
|
||||
Name=
|
||||
Name Value=
|
||||
Type=REG_SZ
|
||||
Decrypt Key=FALSE
|
||||
Decrypt Name=FALSE
|
||||
Decrypt Name Value=TRUE
|
||||
Overwrite Key=TRUE
|
||||
Overwrite Name=TRUE
|
||||
Timing=post archive
|
||||
OS=NT51
|
||||
|
||||
[Component Navigator-Windows Registry3]
|
||||
Root Key=HKEY_LOCAL_MACHINE
|
||||
Key=Software\Clients\StartMenuInternet\$MainExeFile$\shell\open
|
||||
Name=
|
||||
Name Value=
|
||||
Type=REG_SZ
|
||||
Decrypt Key=FALSE
|
||||
Decrypt Name=FALSE
|
||||
Decrypt Name Value=TRUE
|
||||
Overwrite Key=TRUE
|
||||
Overwrite Name=TRUE
|
||||
Timing=post archive
|
||||
OS=NT51
|
||||
|
||||
[Component Navigator-Windows Registry4]
|
||||
Root Key=HKEY_LOCAL_MACHINE
|
||||
Key=Software\Clients\StartMenuInternet\$MainExeFile$\shell\open\command
|
||||
Name=
|
||||
Name Value="[SETUP PATH]\$MainExeFile$"
|
||||
Type=REG_SZ
|
||||
Decrypt Key=FALSE
|
||||
Decrypt Name=FALSE
|
||||
Decrypt Name Value=TRUE
|
||||
Overwrite Key=TRUE
|
||||
Overwrite Name=TRUE
|
||||
Timing=post archive
|
||||
OS=NT51
|
||||
|
||||
|
||||
|
||||
[Component MailNews]
|
||||
Description Short=Mail & Newsgroups
|
||||
|
@ -600,77 +529,6 @@ $InstallSizeArchive$:mail.xpi
|
|||
Attributes=SELECTED|FORCE_UPGRADE
|
||||
Force Upgrade File0=[SETUP PATH]\msgbsutl.dll
|
||||
|
||||
[Component MailNews-Windows Registry0]
|
||||
Root Key=HKEY_LOCAL_MACHINE
|
||||
Key=Software\Clients\Mail\$ProductName$ Mail
|
||||
Name=
|
||||
Name Value=$ProductName$ Mail
|
||||
Type=REG_SZ
|
||||
Decrypt Key=FALSE
|
||||
Decrypt Name=FALSE
|
||||
Decrypt Name Value=TRUE
|
||||
Overwrite Key=TRUE
|
||||
Overwrite Name=TRUE
|
||||
Timing=post archive
|
||||
OS=NT51
|
||||
|
||||
[Component MailNews-Windows Registry1]
|
||||
Root Key=HKEY_LOCAL_MACHINE
|
||||
Key=Software\Clients\Mail\$ProductName$ Mail\DefaultIcon
|
||||
Name=
|
||||
Name Value=[SETUP PATH]\$MainExeFile$,0
|
||||
Type=REG_SZ
|
||||
Decrypt Key=FALSE
|
||||
Decrypt Name=FALSE
|
||||
Decrypt Name Value=TRUE
|
||||
Overwrite Key=TRUE
|
||||
Overwrite Name=TRUE
|
||||
Timing=post archive
|
||||
OS=NT51
|
||||
|
||||
[Component MailNews-Windows Registry2]
|
||||
Root Key=HKEY_LOCAL_MACHINE
|
||||
Key=Software\Clients\Mail\$ProductName$ Mail\shell
|
||||
Name=
|
||||
Name Value=
|
||||
Type=REG_SZ
|
||||
Decrypt Key=FALSE
|
||||
Decrypt Name=FALSE
|
||||
Decrypt Name Value=TRUE
|
||||
Overwrite Key=TRUE
|
||||
Overwrite Name=TRUE
|
||||
Timing=post archive
|
||||
OS=NT51
|
||||
|
||||
[Component MailNews-Windows Registry3]
|
||||
Root Key=HKEY_LOCAL_MACHINE
|
||||
Key=Software\Clients\Mail\$ProductName$ Mail\shell\open
|
||||
Name=
|
||||
Name Value=
|
||||
Type=REG_SZ
|
||||
Decrypt Key=FALSE
|
||||
Decrypt Name=FALSE
|
||||
Decrypt Name Value=TRUE
|
||||
Overwrite Key=TRUE
|
||||
Overwrite Name=TRUE
|
||||
Timing=post archive
|
||||
OS=NT51
|
||||
|
||||
[Component MailNews-Windows Registry4]
|
||||
Root Key=HKEY_LOCAL_MACHINE
|
||||
Key=Software\Clients\Mail\$ProductName$ Mail\shell\open\command
|
||||
Name=
|
||||
Name Value="[SETUP PATH]\$MainExeFile$" -mail
|
||||
Type=REG_SZ
|
||||
Decrypt Key=FALSE
|
||||
Decrypt Name=FALSE
|
||||
Decrypt Name Value=TRUE
|
||||
Overwrite Key=TRUE
|
||||
Overwrite Name=TRUE
|
||||
Timing=post archive
|
||||
OS=NT51
|
||||
|
||||
|
||||
|
||||
[Component Uninstaller]
|
||||
Description Short=$CompanyName$ Uninstaller
|
||||
|
|
|
@ -1,3 +1,28 @@
|
|||
function IsWinnt()
|
||||
{
|
||||
/* Determines if the script is running under NT or not.
|
||||
*
|
||||
*/
|
||||
var winreg = getWinRegistry();
|
||||
var subkey;
|
||||
var valname;
|
||||
var szCurrentVersion;
|
||||
|
||||
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
||||
subkey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
|
||||
valname = "CurrentVersion";
|
||||
szCurrentVersion = winreg.getValueString(subkey, valname);
|
||||
logComment("szCurrentVersion: " + szCurrentVersion);
|
||||
if((szCurrentVersion == "") || (szCurrentVersion == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function registerProgramFolderKey(winreg, fFolderPath)
|
||||
{
|
||||
var subkey;
|
||||
|
@ -196,6 +221,49 @@ function createShortcuts()
|
|||
|
||||
winreg.setRootKey(winreg.HKEY_CURRENT_USER);
|
||||
registerProgramFolderKey(winreg, fFolderPath);
|
||||
|
||||
// Register as a windows XP mail application
|
||||
if( IsWinnt() )
|
||||
{
|
||||
subkey = "Software\\Clients\\Mail\\$ProductNameNoVersion$";
|
||||
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
||||
|
||||
winreg.createKey(subkey,"");
|
||||
winreg.createKey(subkey + "\\DefaultsIcon", "");
|
||||
winreg.createKey(subkey + "\\shell", "");
|
||||
winreg.createKey(subkey + "\\shell\\open", "");
|
||||
winreg.createKey(subkey + "\\shell\\open\\command", "");
|
||||
winreg.createKey(subkey + "\\InstallInfo","");
|
||||
|
||||
valname = "";
|
||||
data = "$ProductName$ Mail";
|
||||
winreg.setValueString(subkey, valname, data);
|
||||
|
||||
valname = "";
|
||||
// path does not need to be quoted per MS doc
|
||||
data = fProgram + "chrome\\icons\\default\\messengerWindow.ico,0";
|
||||
winreg.setValueString(subkey + "\\DefaultsIcon", valname, data);
|
||||
|
||||
valname = "";
|
||||
data = "\"" + fProgram + "$MainExeFile$\" -mail";
|
||||
winreg.setValueString(subkey + "\\shell\\open\\command", valname, data);
|
||||
|
||||
valname = "HideIconsCommand";
|
||||
data = "\"" + fProgram + "uninstall\\MozillaUninstall.exe\" /ms /ua \"$UserAgent$\" /hs mail";
|
||||
winreg.setValueString(subkey + "\\InstallInfo", valname, data);
|
||||
|
||||
valname = "IconsVisible";
|
||||
// set this value to 0 because we're not creating the mail shortcuts yet.
|
||||
winreg.setValueNumber(subkey + "\\InstallInfo", valname, 0);
|
||||
|
||||
valname = "ReinstallCommand";
|
||||
data = "\"" + fProgram + "$MainExeFile$\" -silent -nosplash -setDefaultMail";
|
||||
winreg.setValueString(subkey + "\\InstallInfo", valname, data);
|
||||
|
||||
valname = "ShowIconsCommand";
|
||||
data = "\"" + fProgram + "uninstall\\MozillaUninstall.exe\" /ms /ua \"$UserAgent$\" /ss mail";
|
||||
winreg.setValueString(subkey + "\\InstallInfo", valname, data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -472,6 +472,16 @@ sub MakeUninstall
|
|||
print "\n Error: copy uninstall.ini $inDistPath\\uninstall\n";
|
||||
return(1);
|
||||
}
|
||||
if(system("copy defaults_info.ini $inDistPath"))
|
||||
{
|
||||
print "\n Error: copy defaults_info.ini $inDistPath\n";
|
||||
return(1);
|
||||
}
|
||||
if(system("copy defaults_info.ini $inDistPath\\uninstall"))
|
||||
{
|
||||
print "\n Error: copy defaults_info.ini $inDistPath\\uninstall\n";
|
||||
return(1);
|
||||
}
|
||||
if(system("copy $inDistPath\\uninstall.exe $inDistPath\\uninstall"))
|
||||
{
|
||||
print "\n Error: copy $inDistPath\\uninstall.exe $inDistPath\\uninstall\n";
|
||||
|
|
|
@ -55,7 +55,7 @@ Key=[Product CurrentVersion]\Uninstall
|
|||
Decrypt Key=TRUE
|
||||
|
||||
Uninstall Filename=$UninstallFile$
|
||||
|
||||
Defaults Info Filename=defaults_info.ini
|
||||
|
||||
[Check Instance0]
|
||||
Class Name=MozillaMessageWindow
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче