mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 652445 - Remove WinCE code (incl Faststart & nsSplashScreenWin) from toolkit; r=dtownsend
This commit is contained in:
parent
e1da3047cb
commit
1dc65abc0d
@ -145,7 +145,6 @@ MOZ_TOOLKIT_SEARCH = @MOZ_TOOLKIT_SEARCH@
|
||||
MOZ_PLACES = @MOZ_PLACES@
|
||||
MOZ_STORAGE = @MOZ_STORAGE@
|
||||
MOZ_SAFE_BROWSING = @MOZ_SAFE_BROWSING@
|
||||
MOZ_FASTSTART = @MOZ_FASTSTART@
|
||||
MOZ_URL_CLASSIFIER = @MOZ_URL_CLASSIFIER@
|
||||
MOZ_ZIPWRITER = @MOZ_ZIPWRITER@
|
||||
MOZ_MORK = @MOZ_MORK@
|
||||
|
13
configure.in
13
configure.in
@ -4802,7 +4802,6 @@ MOZ_PSM=1
|
||||
MOZ_RDF=1
|
||||
MOZ_REFLOW_PERF=
|
||||
MOZ_SAFE_BROWSING=
|
||||
MOZ_FASTSTART=
|
||||
MOZ_HELP_VIEWER=
|
||||
MOZ_SPELLCHECK=1
|
||||
MOZ_SPLASHSCREEN=
|
||||
@ -6771,18 +6770,6 @@ if test -n "$MOZ_SAFE_BROWSING"; then
|
||||
fi
|
||||
AC_SUBST(MOZ_SAFE_BROWSING)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable faststart component
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(faststart,
|
||||
[ --enable-faststart Enable the faststart component],
|
||||
MOZ_FASTSTART=1,
|
||||
MOZ_FASTSTART= )
|
||||
if test -n "$MOZ_FASTSTART"; then
|
||||
AC_DEFINE(MOZ_FASTSTART)
|
||||
fi
|
||||
AC_SUBST(MOZ_FASTSTART)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable url-classifier
|
||||
dnl ========================================================
|
||||
|
@ -135,7 +135,6 @@ REDIT_PATH = $(LIBXUL_DIST)/bin
|
||||
endif
|
||||
|
||||
APP_BINARY = $(MOZ_APP_NAME)$(BIN_SUFFIX)
|
||||
APP_BINARY_FASTSTART = $(MOZ_APP_NAME)faststart$(BIN_SUFFIX)
|
||||
|
||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
||||
@ -183,10 +182,6 @@ libs::
|
||||
ifdef LIBXUL_SDK
|
||||
cp $(LIBXUL_DIST)/bin/xulrunner-stub$(BIN_SUFFIX) $(DIST)/bin/$(APP_BINARY)
|
||||
endif
|
||||
ifdef MOZ_FASTSTART
|
||||
ifdef _MSC_VER
|
||||
endif
|
||||
endif
|
||||
ifndef SKIP_COPY_XULRUNNER
|
||||
ifdef LIBXUL_SDK
|
||||
$(NSINSTALL) -D $(DIST)/bin/xulrunner
|
||||
|
@ -63,13 +63,6 @@ PARALLEL_DIRS = \
|
||||
themes \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH),WINCE)
|
||||
ifdef WINCE_WINDOWS_MOBILE
|
||||
DIRS += mozapps/readstrings
|
||||
DIRS += mozapps/installer/wince
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter gtk2 qt,$(MOZ_WIDGET_TOOLKIT)))
|
||||
PARALLEL_DIRS += system/unixproxy
|
||||
endif
|
||||
|
@ -120,10 +120,6 @@ ifdef MOZ_URL_CLASSIFIER
|
||||
PARALLEL_DIRS += url-classifier
|
||||
endif
|
||||
|
||||
ifdef MOZ_FASTSTART
|
||||
PARALLEL_DIRS += faststart
|
||||
endif
|
||||
|
||||
DIRS += \
|
||||
build \
|
||||
$(NULL)
|
||||
|
@ -142,7 +142,6 @@ function onAlertLoad()
|
||||
if (window.innerWidth == contentDim.width + 1)
|
||||
--window.innerWidth;
|
||||
|
||||
#ifndef WINCE
|
||||
// Start with a 1px width/height, because 0 causes trouble with gtk1/2
|
||||
gCurrentSize = 1;
|
||||
|
||||
@ -157,7 +156,6 @@ function onAlertLoad()
|
||||
gFinalSize = window.outerHeight;
|
||||
window.outerHeight = gCurrentSize;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Determine position
|
||||
var x = gOrigin & NS_ALERT_LEFT ? screen.availLeft :
|
||||
@ -173,11 +171,7 @@ function onAlertLoad()
|
||||
|
||||
window.moveTo(x, y);
|
||||
|
||||
#ifndef WINCE
|
||||
setTimeout(animateAlert, gSlideTime);
|
||||
#else
|
||||
setTimeout(closeAlert, gOpenTime);
|
||||
#endif
|
||||
}
|
||||
|
||||
function animate(step)
|
||||
|
@ -69,7 +69,7 @@
|
||||
#include "nsEmbedCID.h"
|
||||
#include "nsToolkitCompsCID.h"
|
||||
|
||||
#if defined(XP_WIN) && !defined(WINCE)
|
||||
#ifdef XP_WIN
|
||||
#include <shlobj.h>
|
||||
#ifdef DOWNLOAD_SCANNER
|
||||
#include "nsDownloadScanner.h"
|
||||
@ -1139,7 +1139,7 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult)
|
||||
NS_GET_IID(nsILocalFile),
|
||||
getter_AddRefs(downloadDir));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
#elif defined(XP_WIN) && !defined(WINCE)
|
||||
#elif defined(XP_WIN)
|
||||
rv = dirService->Get(NS_WIN_DEFAULT_DOWNLOAD_DIR,
|
||||
NS_GET_IID(nsILocalFile),
|
||||
getter_AddRefs(downloadDir));
|
||||
@ -2243,7 +2243,7 @@ nsDownload::SetState(DownloadState aState)
|
||||
}
|
||||
}
|
||||
|
||||
#if (defined(XP_WIN) && !defined(WINCE)) || defined(XP_MACOSX) || defined(ANDROID)
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(ANDROID)
|
||||
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(mTarget);
|
||||
nsCOMPtr<nsIFile> file;
|
||||
nsAutoString path;
|
||||
|
@ -1,210 +0,0 @@
|
||||
/* -*- Mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 FastStartup.js
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Vladimir Vukicevic <vladimir@pobox.com>
|
||||
* Brian Crowder <crowder@fiverocks.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 ***** */
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cr = Components.results;
|
||||
const Cu = Components.utils;
|
||||
|
||||
const Timer = Components.Constructor("@mozilla.org/timer;1", "nsITimer", "initWithCallback");
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
const RESTART_ENV_VAR = "FASTSTART_INITIATED_RESTART";
|
||||
|
||||
function setenv(key, value) {
|
||||
let env = Cc["@mozilla.org/process/environment;1"].
|
||||
getService(Components.interfaces.nsIEnvironment);
|
||||
env.set(key, value);
|
||||
}
|
||||
|
||||
function getenv(key) {
|
||||
let env = Cc["@mozilla.org/process/environment;1"].
|
||||
getService(Components.interfaces.nsIEnvironment);
|
||||
return env.get(key);
|
||||
}
|
||||
|
||||
function nsFastStartupObserver() {
|
||||
let _browserWindowCount = 0;
|
||||
let _memCleanupTimer;
|
||||
let _restartTimer;
|
||||
let _isShuttingDown;
|
||||
|
||||
function stopMemoryCleanup() {
|
||||
if (_memCleanupTimer) {
|
||||
_memCleanupTimer.cancel();
|
||||
_memCleanupTimer = null;
|
||||
}
|
||||
|
||||
if (_restartTimer) {
|
||||
_restartTimer.cancel();
|
||||
_restartTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
function scheduleMemoryCleanup() {
|
||||
if (_isShuttingDown)
|
||||
return;
|
||||
|
||||
stopMemoryCleanup();
|
||||
|
||||
function restart() {
|
||||
setenv(RESTART_ENV_VAR, "1");
|
||||
setenv("NO_SPLASH", "1");
|
||||
let appstartup = Cc["@mozilla.org/toolkit/app-startup;1"].
|
||||
getService(Ci.nsIAppStartup);
|
||||
appstartup.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
|
||||
|
||||
_restartTimer = null;
|
||||
}
|
||||
|
||||
function memoryCleanup() {
|
||||
var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
|
||||
|
||||
// Do this 3 times, because of a comment in TestGtkEmbed that says this
|
||||
// gives the cycle collector the best chance at purging things.
|
||||
os.notifyObservers(null, "memory-pressure", "heap-minimize");
|
||||
os.notifyObservers(null, "memory-pressure", "heap-minimize");
|
||||
os.notifyObservers(null, "memory-pressure", "heap-minimize");
|
||||
|
||||
_memCleanupTimer = null;
|
||||
}
|
||||
|
||||
// wait 30s until firing off the memory cleanup, in case the user
|
||||
// opens another window right away
|
||||
_memCleanupTimer = new Timer(memoryCleanup, 30000, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
|
||||
// Also, begin a countdown to restart the stub in 15 minutes
|
||||
_restartTimer = new Timer(restart, 60000 * 15, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
}
|
||||
|
||||
//
|
||||
// nsIObserver
|
||||
//
|
||||
this.observe = function observe(subject, topic, data) {
|
||||
var win = subject;
|
||||
|
||||
// XXX the window at this point won't actually have its document loaded --
|
||||
// win.document.documentURI will pretty much always be about:blank. We need
|
||||
// to attach a load handler to actually figure out which document gets loaded.
|
||||
if (topic == "domwindowopened") {
|
||||
stopMemoryCleanup();
|
||||
_browserWindowCount++;
|
||||
} else if (topic == "domwindowclosed") {
|
||||
if (_browserWindowCount > 0)
|
||||
_browserWindowCount--;
|
||||
if (_browserWindowCount == 0) {
|
||||
scheduleMemoryCleanup();
|
||||
let prefservice = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService);
|
||||
prefservice.savePrefFile(null);
|
||||
}
|
||||
} else if (topic == "quit-application-granted") {
|
||||
stopMemoryCleanup();
|
||||
_isShuttingDown = true;
|
||||
let appstartup = Cc["@mozilla.org/toolkit/app-startup;1"].
|
||||
getService(Ci.nsIAppStartup);
|
||||
appstartup.exitLastWindowClosingSurvivalArea();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* QueryInterface
|
||||
* We expect the WindowWatcher service to retain a strong reference to us, so supporting
|
||||
* weak references is fine.
|
||||
*/
|
||||
this.QueryInterface = XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]);
|
||||
}
|
||||
|
||||
function nsFastStartupCLH() { }
|
||||
|
||||
nsFastStartupCLH.prototype = {
|
||||
//
|
||||
// nsICommandLineHandler
|
||||
//
|
||||
handle: function fs_handle(cmdLine) {
|
||||
// the rest of this only handles -faststart here
|
||||
|
||||
if (cmdLine.handleFlag("shutdown-faststart", false)) {
|
||||
cmdLine.preventDefault = true;
|
||||
// Shutdown this service
|
||||
let appstartup = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
|
||||
appstartup.quit(Ci.nsIAppStartup.eAttemptQuit);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmdLine.handleFlag("faststart-hidden", false) || (getenv(RESTART_ENV_VAR) == "1"))
|
||||
cmdLine.preventDefault = true;
|
||||
|
||||
try {
|
||||
// did we already initialize faststart? if so,
|
||||
// nothing to do here.
|
||||
if (this.inited)
|
||||
return;
|
||||
|
||||
this.inited = true;
|
||||
|
||||
// Clear this environment variable for subsequent runs
|
||||
setenv(RESTART_ENV_VAR, "0");
|
||||
|
||||
let fsobs = new nsFastStartupObserver();
|
||||
let wwatch = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
getService(Ci.nsIWindowWatcher);
|
||||
wwatch.registerNotification(fsobs);
|
||||
|
||||
let obsService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
|
||||
obsService.addObserver(fsobs, "quit-application-granted", true);
|
||||
|
||||
let appstartup = Cc["@mozilla.org/toolkit/app-startup;1"].
|
||||
getService(Ci.nsIAppStartup);
|
||||
appstartup.enterLastWindowClosingSurvivalArea();
|
||||
} catch (e) {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
},
|
||||
|
||||
helpInfo: " -faststart-hidden Start the FastStart service\n" +
|
||||
" -shutdown-faststart Shutdown the FastStart service\n",
|
||||
|
||||
// QI
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
|
||||
|
||||
// XPCOMUtils factory
|
||||
classID: Components.ID("{580c6c51-f690-4ce1-9ecc-b678e0c031c7}"),
|
||||
};
|
||||
|
||||
var NSGetFactory = XPCOMUtils.generateNSGetFactory([nsFastStartupCLH]);
|
@ -1,3 +0,0 @@
|
||||
component {580c6c51-f690-4ce1-9ecc-b678e0c031c7} FastStartup.js
|
||||
contract @mozilla.org/browser/faststart;1 {580c6c51-f690-4ce1-9ecc-b678e0c031c7}
|
||||
category command-line-handler 00-faststart @mozilla.org/browser/faststart;1
|
@ -1,63 +0,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 the Mozilla Browser code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is the Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2009
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Vladimir Vukicevic <vladimir@pobox.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 *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DEFINES += -DMOZ_NO_MOZALLOC
|
||||
|
||||
EXTRA_PP_COMPONENTS = \
|
||||
FastStartup.js \
|
||||
FastStartup.manifest \
|
||||
$(NULL)
|
||||
|
||||
ifdef _MSC_VER
|
||||
ifdef WINCE
|
||||
CPPSRCS = \
|
||||
faststartstub.cpp \
|
||||
$(NULL)
|
||||
|
||||
SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX)) \
|
||||
|
||||
WIN32_EXE_LDFLAGS += -ENTRY:WinMainCRTStartup
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -1,39 +0,0 @@
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int WINAPI
|
||||
WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPTSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFOW si = { 0 };
|
||||
wchar_t modfilename[MAX_PATH];
|
||||
wchar_t execname[MAX_PATH];
|
||||
wchar_t args[MAX_PATH];
|
||||
wcscpy(args, L"-nosplash -faststart-hidden");
|
||||
|
||||
HMODULE mod = GetModuleHandle(NULL);
|
||||
GetModuleFileNameW(mod, modfilename, sizeof(modfilename)/sizeof(modfilename[0]));
|
||||
wchar_t *chomp = wcsstr(modfilename, L"faststart.exe");
|
||||
if (!chomp) {
|
||||
MessageBoxW(NULL, L"Couldn't figure out how to run the faststart service!", L"Faststart Fail", MB_OK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t len = chomp - modfilename;
|
||||
wcsncpy(execname, modfilename, len);
|
||||
execname[len] = 0;
|
||||
wcscat(execname, L".exe");
|
||||
|
||||
BOOL ok = CreateProcessW(execname, args, NULL, NULL, FALSE, 0,
|
||||
NULL, NULL, &si, &pi);
|
||||
if (!ok) {
|
||||
MessageBoxW(NULL, L"Couldn't figure out how to run the faststart service!", L"Faststart Fail", MB_OK);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -55,7 +55,7 @@ CPPSRCS = \
|
||||
ifeq (os2,$(MOZ_WIDGET_TOOLKIT))
|
||||
CPPSRCS += nsUserInfoOS2.cpp
|
||||
else
|
||||
ifeq (,$(filter-out WINCE WINNT,$(OS_ARCH)))
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
CPPSRCS += nsUserInfoWin.cpp
|
||||
else
|
||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
@ -56,7 +56,6 @@ NS_IMPL_ISUPPORTS1(nsUserInfo,nsIUserInfo)
|
||||
NS_IMETHODIMP
|
||||
nsUserInfo::GetUsername(char **aUsername)
|
||||
{
|
||||
#ifndef WINCE
|
||||
*aUsername = nsnull;
|
||||
|
||||
PRUnichar username[256];
|
||||
@ -66,9 +65,8 @@ nsUserInfo::GetUsername(char **aUsername)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aUsername = ToNewUTF8String(nsDependentString(username));
|
||||
if (*aUsername) return NS_OK;
|
||||
#endif
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return (*aUsername) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -3617,7 +3617,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
<ul>
|
||||
<li>This software is based in part on the work of the Independent
|
||||
JPEG Group.</li>
|
||||
<li>Portions of the OS/2, Windows Mobile and Android versions
|
||||
<li>Portions of the OS/2 and Android versions
|
||||
of this software are copyright ©1996-2010
|
||||
<a href="http://www.freetype.org/">The FreeType Project</a>.
|
||||
All rights reserved.</li>
|
||||
|
@ -70,10 +70,6 @@ ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
|
||||
CPPSRCS += dlldeps-xul.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINCE)
|
||||
CPPSRCS += dlldeps-xul.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
CPPSRCS += dlldeps-xul.cpp
|
||||
endif
|
||||
@ -130,7 +126,7 @@ GARBAGE += \
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter OS2 WINCE WINNT,$(OS_ARCH)))
|
||||
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
|
||||
SDK_LIBRARY = $(IMPORT_LIBRARY)
|
||||
else
|
||||
SDK_LIBRARY = $(SHARED_LIBRARY)
|
||||
@ -227,13 +223,6 @@ ifdef MOZ_CRASHREPORTER
|
||||
OS_LIBS += $(call EXPAND_LIBNAME,wininet)
|
||||
endif
|
||||
endif # WINNT
|
||||
ifeq ($(OS_ARCH),WINCE)
|
||||
OS_LIBS += $(call EXPAND_LIBNAME, aygshell uuid ole32 oleaut32 Ws2 ddraw)
|
||||
OS_LIBS += $(call EXPAND_LIBNAME, ceosutil libcmt comsuppw)
|
||||
ifdef WINCE_WINDOWS_MOBILE
|
||||
OS_LIBS += $(call EXPAND_LIBNAME, cellcore)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef MOZ_JPROF
|
||||
EXTRA_DSO_LDOPTS += -ljprof
|
||||
|
@ -41,7 +41,7 @@ CPPSRCS += \
|
||||
nsStaticXULComponents.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifeq (,$(filter-out WINCE WINNT,$(OS_ARCH)))
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
REQUIRES += widget gfx
|
||||
CPPSRCS += \
|
||||
nsDllMain.cpp \
|
||||
@ -115,13 +115,8 @@ STATIC_LIBS += \
|
||||
xpcom_core \
|
||||
ucvutil_s \
|
||||
chromium_s \
|
||||
$(NULL)
|
||||
|
||||
ifndef WINCE
|
||||
STATIC_LIBS += \
|
||||
mozreg_s \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
# component libraries
|
||||
COMPONENT_LIBS += \
|
||||
|
@ -55,10 +55,8 @@ DEFINES += \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
|
||||
ifneq ($(OS_ARCH),WINCE)
|
||||
OS_LIBS += $(call EXPAND_LIBNAME,usp10 oleaut32)
|
||||
endif
|
||||
endif
|
||||
|
||||
export:: dlldeps.cpp
|
||||
|
||||
|
@ -46,11 +46,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
BOOL APIENTRY DllMain(
|
||||
#ifdef WINCE
|
||||
HANDLE hModule,
|
||||
#else
|
||||
HINSTANCE hModule,
|
||||
#endif
|
||||
DWORD reason,
|
||||
LPVOID lpReserved )
|
||||
{
|
||||
|
@ -155,10 +155,6 @@ endif
|
||||
$(NSINSTALL) -D $(DIST)/l10n-stage/$(PKG_PATH)
|
||||
cd $(DIST)/l10n-stage; \
|
||||
$(MAKE_PACKAGE)
|
||||
ifeq (WINCE,$(OS_ARCH))
|
||||
cd $(DIST)/l10n-stage; \
|
||||
$(MAKE_CAB)
|
||||
endif
|
||||
ifdef MAKE_COMPLETE_MAR
|
||||
$(MAKE) -C $(MOZDEPTH)/tools/update-packaging full-update AB_CD=$(AB_CD) \
|
||||
MOZ_PKG_PRETTYNAMES=$(MOZ_PKG_PRETTYNAMES) \
|
||||
@ -177,9 +173,6 @@ endif
|
||||
$(MAKE) clobber-zip AB_CD=$(AB_CD)
|
||||
$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
|
||||
mv -f "$(DIST)/l10n-stage/$(PACKAGE)" "$(ZIP_OUT)"
|
||||
ifeq (WINCE,$(OS_ARCH))
|
||||
mv -f "$(DIST)/l10n-stage/$(PKG_BASENAME).cab" "$(DIST)/$(PKG_PATH)$(PKG_BASENAME).cab"
|
||||
endif
|
||||
|
||||
repackage-zip-%: $(STAGEDIST)
|
||||
@$(MAKE) repackage-zip AB_CD=$* ZIP_IN="$(ZIP_IN)"
|
||||
|
@ -295,7 +295,6 @@ function openDownload(aDownload)
|
||||
} catch (e) { }
|
||||
|
||||
#ifdef XP_WIN
|
||||
#ifndef WINCE
|
||||
// On Vista and above, we rely on native security prompting for
|
||||
// downloaded content unless it's disabled.
|
||||
try {
|
||||
@ -306,7 +305,6 @@ function openDownload(aDownload)
|
||||
dontAsk = true;
|
||||
}
|
||||
} catch (ex) { }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (!dontAsk) {
|
||||
@ -492,12 +490,10 @@ function Startup()
|
||||
}, false);
|
||||
|
||||
#ifdef XP_WIN
|
||||
#ifndef WINCE
|
||||
let tempScope = {};
|
||||
Cu.import("resource://gre/modules/DownloadTaskbarProgress.jsm", tempScope);
|
||||
tempScope.DownloadTaskbarProgress.onDownloadWindowLoad(window);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
function Shutdown()
|
||||
|
@ -47,7 +47,7 @@ ifndef MOZ_PKG_FORMAT
|
||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
MOZ_PKG_FORMAT = DMG
|
||||
else
|
||||
ifeq (,$(filter-out OS2 WINNT WINCE, $(OS_ARCH)))
|
||||
ifeq (,$(filter-out OS2 WINNT, $(OS_ARCH)))
|
||||
MOZ_PKG_FORMAT = ZIP
|
||||
else
|
||||
ifeq (,$(filter-out SunOS, $(OS_ARCH)))
|
||||
@ -67,7 +67,7 @@ endif
|
||||
endif
|
||||
endif # MOZ_PKG_FORMAT
|
||||
|
||||
ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
INSTALLER_DIR = windows
|
||||
endif
|
||||
|
||||
@ -83,22 +83,8 @@ SDK_SUFFIX = $(PKG_SUFFIX)
|
||||
SDK = $(SDK_PATH)$(PKG_BASENAME).sdk$(SDK_SUFFIX)
|
||||
|
||||
MAKE_PACKAGE = $(error What is a $(MOZ_PKG_FORMAT) package format?);
|
||||
MAKE_CAB = $(error Don't know how to make a CAB!);
|
||||
_ABS_DIST = $(call core_abspath,$(DIST))
|
||||
|
||||
ifdef WINCE
|
||||
ifndef WINCE_WINDOWS_MOBILE
|
||||
CABARGS += -s
|
||||
endif
|
||||
ifdef MOZ_FASTSTART
|
||||
CABARGS += -faststart
|
||||
endif
|
||||
VSINSTALLDIR ?= $(error VSINSTALLDIR not set, must be set to the Visual Studio install directory)
|
||||
MAKE_CAB = $(PYTHON) $(MOZILLA_DIR)/build/package/wince/make_wince_cab.py \
|
||||
$(CABARGS) "$(VSINSTALLDIR)/SmartDevices/SDK/SDKTools/cabwiz.exe" \
|
||||
"$(MOZ_PKG_DIR)" "$(MOZ_APP_DISPLAYNAME)" "$(PKG_PATH)$(PKG_BASENAME).cab"
|
||||
endif
|
||||
|
||||
CREATE_FINAL_TAR = $(TAR) -c --owner=0 --group=0 --numeric-owner \
|
||||
--mode="go-w" -f
|
||||
UNPACK_TAR = tar -xf-
|
||||
@ -127,11 +113,6 @@ INNER_MAKE_PACKAGE = $(ZIP) -r9D $(PACKAGE) $(MOZ_PKG_DIR)
|
||||
INNER_UNMAKE_PACKAGE = $(UNZIP) $(UNPACKAGE)
|
||||
MAKE_SDK = $(ZIP) -r9D $(SDK) $(MOZ_APP_NAME)-sdk
|
||||
endif
|
||||
ifeq ($(MOZ_PKG_FORMAT),CAB)
|
||||
PKG_SUFFIX = .cab
|
||||
INNER_MAKE_PACKAGE = $(MAKE_CAB)
|
||||
INNER_UNMAKE_PACKAGE = $(error Unpacking CAB files is not supported)
|
||||
endif
|
||||
ifeq ($(MOZ_PKG_FORMAT),SFX7Z)
|
||||
PKG_SUFFIX = .exe
|
||||
INNER_MAKE_PACKAGE = rm -f app.7z && \
|
||||
@ -535,7 +516,7 @@ ifeq ($(OS_ARCH),OS2)
|
||||
STRIP = $(MOZILLA_DIR)/toolkit/mozapps/installer/os2/strip.cmd
|
||||
endif
|
||||
|
||||
ifneq (,$(filter WINNT WINCE OS2,$(OS_ARCH)))
|
||||
ifneq (,$(filter WINNT OS2,$(OS_ARCH)))
|
||||
PKGCP_OS = dos
|
||||
else
|
||||
PKGCP_OS = unix
|
||||
@ -698,7 +679,7 @@ make-sourcestamp-file::
|
||||
# dist/sdk/lib -> prefix/lib/appname-devel-version/lib
|
||||
# prefix/lib/appname-devel-version/* symlinks to the above directories
|
||||
install:: stage-package
|
||||
ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
$(error "make install" is not supported on this platform. Use "make package" instead.)
|
||||
endif
|
||||
ifeq (bundle,$(MOZ_FS_LAYOUT))
|
||||
@ -762,9 +743,6 @@ make-sdk:
|
||||
ifeq ($(OS_TARGET), WINNT)
|
||||
INSTALLER_PACKAGE = $(DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
|
||||
endif
|
||||
ifeq ($(OS_TARGET), WINCE)
|
||||
INSTALLER_PACKAGE = $(DIST)/$(PKG_PATH)$(PKG_BASENAME).cab
|
||||
endif
|
||||
|
||||
# These are necessary because some of our packages/installers contain spaces
|
||||
# in their filenames and GNU Make's $(wildcard) function doesn't properly
|
||||
|
@ -1,76 +0,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 Fennec Installer for WinCE.
|
||||
#
|
||||
# The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
#
|
||||
# Portions created by the Initial Developer are Copyright (C) 2009
|
||||
# the Mozilla Foundation <http://www.mozilla.org/>. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
#
|
||||
# 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 *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
export NO_SHUNT = 1
|
||||
USE_STATIC_LIBS = 1
|
||||
|
||||
PROGRAM = xulrunner-stub-installer.sfx
|
||||
|
||||
REQUIRES = lib7z
|
||||
|
||||
CPPSRCS = \
|
||||
nsInstaller.cpp \
|
||||
nsInstallerDlg.cpp \
|
||||
nsArchiveExtractor.cpp \
|
||||
ns7zipExtractor.cpp \
|
||||
nsSetupStrings.cpp \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES += -I$(srcdir)/../../readstrings
|
||||
|
||||
RCINCLUDE = nsInstallerppc.rc
|
||||
|
||||
DEFINES += -D_UNICODE
|
||||
|
||||
LIBS += $(DEPTH)/toolkit/mozapps/readstrings/$(LIB_PREFIX)readstrings.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/7z.lib \
|
||||
$(NULL)
|
||||
|
||||
OS_LIBS += aygshell.lib commctrl.lib note_prj.lib oleaut32.lib ole32.lib libcmt.lib coredll.lib corelibc.lib
|
||||
|
||||
WIN32_EXE_LDFLAGS += -ENTRY:WinMain
|
||||
|
||||
DIRS += uninstall
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -1,84 +0,0 @@
|
||||
/* -*- Mode: C++; c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 Fennec Installer for WinCE.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#include "wtypes.h"
|
||||
#include "nsArchiveExtractor.h"
|
||||
#include "ns7zipExtractor.h"
|
||||
#include "7zLib.h"
|
||||
|
||||
static nsExtractorProgress *g_pProgress = NULL;
|
||||
|
||||
static void ExtractProgressCallback(int nPercentComplete)
|
||||
{
|
||||
if (g_pProgress)
|
||||
{
|
||||
g_pProgress->Progress(nPercentComplete);
|
||||
}
|
||||
}
|
||||
|
||||
static void ShowError()
|
||||
{
|
||||
MessageBoxW(GetForegroundWindow(), GetExtractorError(), L"Extractor", MB_OK|MB_ICONERROR);
|
||||
}
|
||||
|
||||
ns7zipExtractor::ns7zipExtractor(const WCHAR *sArchiveName, DWORD dwSfxStubSize, nsExtractorProgress *pProgress) :
|
||||
nsArchiveExtractor(sArchiveName, dwSfxStubSize, pProgress)
|
||||
{
|
||||
g_pProgress = pProgress;
|
||||
}
|
||||
|
||||
ns7zipExtractor::~ns7zipExtractor()
|
||||
{
|
||||
g_pProgress = NULL;
|
||||
}
|
||||
|
||||
int ns7zipExtractor::Extract(const WCHAR *sDestinationDir)
|
||||
{
|
||||
int res = SzExtractSfx(m_sArchiveName, m_dwSfxStubSize, NULL, sDestinationDir, ExtractProgressCallback);
|
||||
if (res != 0)
|
||||
ShowError();
|
||||
return res;
|
||||
}
|
||||
|
||||
int ns7zipExtractor::ExtractFile(const WCHAR *sFileName, const WCHAR *sDestinationDir)
|
||||
{
|
||||
int res = SzExtractSfx(m_sArchiveName, m_dwSfxStubSize, sFileName, sDestinationDir, NULL);
|
||||
if (res != 0)
|
||||
ShowError();
|
||||
return res;
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/* -*- Mode: C++; c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 Fennec Installer for WinCE.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "nsArchiveExtractor.h"
|
||||
|
||||
class ns7zipExtractor : public nsArchiveExtractor
|
||||
{
|
||||
public:
|
||||
ns7zipExtractor(const WCHAR *sArchiveName, DWORD dwSfxStubSize, nsExtractorProgress *pProgress);
|
||||
virtual ~ns7zipExtractor();
|
||||
|
||||
virtual int Extract(const WCHAR *sDestinationDir);
|
||||
virtual int ExtractFile(const WCHAR *sFileName, const WCHAR *sDestinationDir);
|
||||
};
|
@ -1,62 +0,0 @@
|
||||
/* -*- Mode: C++; c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 Fennec Installer for WinCE.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#include "wtypes.h"
|
||||
#include "nsArchiveExtractor.h"
|
||||
|
||||
nsArchiveExtractor::nsArchiveExtractor(const WCHAR *sArchiveName, DWORD dwSfxStubSize, nsExtractorProgress *pProgress) :
|
||||
m_sArchiveName(NULL), m_pProgress(pProgress), m_dwSfxStubSize(dwSfxStubSize)
|
||||
{
|
||||
if (sArchiveName)
|
||||
m_sArchiveName = wcsdup(sArchiveName);
|
||||
}
|
||||
|
||||
nsArchiveExtractor::~nsArchiveExtractor()
|
||||
{
|
||||
free(m_sArchiveName);
|
||||
}
|
||||
|
||||
int nsArchiveExtractor::Extract(const WCHAR *sDestinationDir)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int nsArchiveExtractor::ExtractFile(const WCHAR *sFileName, const WCHAR *sDestinationDir)
|
||||
{
|
||||
return OK;
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
/* -*- Mode: C++; c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 Fennec Installer for WinCE.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* Class to show the progress
|
||||
*/
|
||||
class nsExtractorProgress
|
||||
{
|
||||
public:
|
||||
nsExtractorProgress() {}
|
||||
virtual void Progress(int nPercentComplete) = 0; /* to be overriden to get progress notifications */
|
||||
};
|
||||
|
||||
/**
|
||||
* Base archive-extractor class.
|
||||
* Used to derive a specific archive format implementation.
|
||||
*/
|
||||
class nsArchiveExtractor
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
OK = 0,
|
||||
ERR_FAIL = -1,
|
||||
ERR_PARAM = -2,
|
||||
ERR_READ = -3,
|
||||
ERR_WRITE = -4,
|
||||
ERR_MEM = -5,
|
||||
ERR_NO_ARCHIVE = -6,
|
||||
ERR_EXTRACTION = -7,
|
||||
};
|
||||
|
||||
nsArchiveExtractor(const WCHAR *sArchiveName, DWORD dwSfxStubSize, nsExtractorProgress *pProgress);
|
||||
virtual ~nsArchiveExtractor();
|
||||
|
||||
virtual int Extract(const WCHAR *sDestinationDir);
|
||||
virtual int ExtractFile(const WCHAR *sFileName, const WCHAR *sDestinationDir);
|
||||
|
||||
protected:
|
||||
WCHAR *m_sArchiveName;
|
||||
nsExtractorProgress *m_pProgress;
|
||||
DWORD m_dwSfxStubSize;
|
||||
};
|
@ -1,238 +0,0 @@
|
||||
/* -*- Mode: C++; c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 Fennec Installer for WinCE.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
/**
|
||||
*
|
||||
* nsInstaller.cpp : Mozilla Fennec Installer
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <DeviceResolutionAware.h>
|
||||
#include "nsSetupStrings.h"
|
||||
#include "nsInstaller.h"
|
||||
#include "ns7zipExtractor.h"
|
||||
#include "nsInstallerDlg.h"
|
||||
|
||||
const WCHAR c_sStringsFile[] = L"setup.ini";
|
||||
|
||||
// Global Variables:
|
||||
nsSetupStrings Strings;
|
||||
|
||||
HINSTANCE g_hInst;
|
||||
WCHAR g_sSourcePath[MAX_PATH];
|
||||
WCHAR g_sExeFullFileName[MAX_PATH];
|
||||
WCHAR g_sExeFileName[MAX_PATH];
|
||||
DWORD g_dwExeSize;
|
||||
|
||||
// Forward declarations of functions included in this code module:
|
||||
BOOL InitInstance(HINSTANCE, int);
|
||||
DWORD GetExeSize();
|
||||
BOOL PostExtract();
|
||||
BOOL LoadStrings();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// WinMain
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int WINAPI WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPTSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
int nResult = -1;
|
||||
|
||||
if (!InitInstance(hInstance, nCmdShow))
|
||||
return nResult;
|
||||
|
||||
nsInstallerDlg::GetInstance()->Init(g_hInst);
|
||||
nResult = nsInstallerDlg::GetInstance()->DoModal();
|
||||
|
||||
return nResult;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// InitInstance
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||
{
|
||||
g_hInst = hInstance;
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
g_sExeFileName[0] = L'\0';
|
||||
if (GetModuleFileName(NULL, g_sExeFullFileName, MAX_PATH) == 0)
|
||||
return FALSE;
|
||||
|
||||
wcscpy(g_sSourcePath, g_sExeFullFileName);
|
||||
WCHAR *sSlash = wcsrchr(g_sSourcePath, L'\\');
|
||||
wcscpy(g_sExeFileName, sSlash + 1);
|
||||
*sSlash = L'\0'; // cut the file name
|
||||
|
||||
g_dwExeSize = GetExeSize();
|
||||
|
||||
return LoadStrings();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GetExeSize
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DWORD AbsoluteSeek(HANDLE, DWORD);
|
||||
void ReadBytes(HANDLE, LPVOID, DWORD);
|
||||
|
||||
DWORD GetExeSize()
|
||||
{
|
||||
DWORD dwSize = 0;
|
||||
HANDLE hImage;
|
||||
|
||||
DWORD dwSectionOffset;
|
||||
DWORD dwCoffHeaderOffset;
|
||||
DWORD moreDosHeader[16];
|
||||
|
||||
ULONG NTSignature;
|
||||
|
||||
IMAGE_DOS_HEADER image_dos_header;
|
||||
IMAGE_FILE_HEADER image_file_header;
|
||||
IMAGE_OPTIONAL_HEADER image_optional_header;
|
||||
IMAGE_SECTION_HEADER image_section_header;
|
||||
|
||||
// Open the EXE file.
|
||||
hImage = CreateFile(g_sExeFullFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (INVALID_HANDLE_VALUE == hImage)
|
||||
{
|
||||
ErrorMsg(L"Could not open the EXE");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Read the MS-DOS image header.
|
||||
ReadBytes(hImage, &image_dos_header, sizeof(image_dos_header));
|
||||
|
||||
if (IMAGE_DOS_SIGNATURE != image_dos_header.e_magic)
|
||||
{
|
||||
ErrorMsg(L"Unknown file format.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Read more MS-DOS header.
|
||||
ReadBytes(hImage, moreDosHeader, sizeof(moreDosHeader));
|
||||
|
||||
// Get actual COFF header.
|
||||
dwCoffHeaderOffset = AbsoluteSeek(hImage, image_dos_header.e_lfanew) + sizeof(ULONG);
|
||||
|
||||
ReadBytes (hImage, &NTSignature, sizeof(NTSignature));
|
||||
|
||||
if (IMAGE_NT_SIGNATURE != NTSignature)
|
||||
{
|
||||
ErrorMsg(L"Missing NT signature. Unknown file type.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
dwSectionOffset = dwCoffHeaderOffset + IMAGE_SIZEOF_FILE_HEADER + IMAGE_SIZEOF_NT_OPTIONAL_HEADER;
|
||||
|
||||
ReadBytes(hImage, &image_file_header, IMAGE_SIZEOF_FILE_HEADER);
|
||||
|
||||
// Read optional header.
|
||||
ReadBytes(hImage, &image_optional_header, IMAGE_SIZEOF_NT_OPTIONAL_HEADER);
|
||||
|
||||
WORD nNumSections = image_file_header.NumberOfSections;
|
||||
|
||||
for (WORD i = 0; i < nNumSections; i++)
|
||||
{
|
||||
ReadBytes(hImage, &image_section_header, sizeof(IMAGE_SECTION_HEADER));
|
||||
|
||||
DWORD dwRawData = image_section_header.PointerToRawData + image_section_header.SizeOfRawData;
|
||||
if (dwRawData > dwSize)
|
||||
dwSize = dwRawData;
|
||||
}
|
||||
|
||||
CloseHandle(hImage);
|
||||
|
||||
return dwSize;
|
||||
}
|
||||
|
||||
DWORD AbsoluteSeek(HANDLE hFile, DWORD offset)
|
||||
{
|
||||
DWORD newOffset;
|
||||
|
||||
if ((newOffset = SetFilePointer(hFile, offset, NULL, FILE_BEGIN)) == 0xFFFFFFFF)
|
||||
ErrorMsg(L"SetFilePointer failed");
|
||||
|
||||
return newOffset;
|
||||
}
|
||||
|
||||
void ReadBytes(HANDLE hFile, LPVOID buffer, DWORD size)
|
||||
{
|
||||
DWORD bytes;
|
||||
|
||||
if (!ReadFile(hFile, buffer, size, &bytes, NULL))
|
||||
ErrorMsg(L"ReadFile failed");
|
||||
else if (size != bytes)
|
||||
ErrorMsg(L"Read the wrong number of bytes");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Read strings resource from the attached archive
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
BOOL LoadStrings()
|
||||
{
|
||||
WCHAR *sExtractPath = L"\\Temp\\";
|
||||
WCHAR sExtractedStringsFile[MAX_PATH];
|
||||
_snwprintf(sExtractedStringsFile, MAX_PATH, L"%s%s", sExtractPath, c_sStringsFile);
|
||||
|
||||
ns7zipExtractor archiveExtractor(g_sExeFullFileName, g_dwExeSize, NULL);
|
||||
|
||||
int nResult = archiveExtractor.ExtractFile(c_sStringsFile, sExtractPath);
|
||||
|
||||
if (nResult != 0)
|
||||
return FALSE;
|
||||
|
||||
BOOL bResult = Strings.LoadStrings(sExtractedStringsFile);
|
||||
DeleteFile(sExtractedStringsFile);
|
||||
|
||||
return bResult;
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/* -*- Mode: C++; c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 Fennec Installer for WinCE.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#pragma once
|
||||
#include "resourceppc.h"
|
||||
|
||||
extern nsSetupStrings Strings;
|
||||
extern const WCHAR c_sStringsFile[];
|
||||
|
||||
extern WCHAR g_sSourcePath[MAX_PATH];
|
||||
extern WCHAR g_sExeFileName[MAX_PATH];
|
||||
extern WCHAR g_sExeFullFileName[MAX_PATH];
|
||||
extern DWORD g_dwExeSize;
|
||||
|
||||
#define ErrorMsg(msg) MessageBoxW(GetForegroundWindow(), msg, L"Setup", MB_OK|MB_ICONERROR)
|
||||
bool ConvertToChar(const WCHAR *wstr, char *str);
|
@ -1,524 +0,0 @@
|
||||
/* -*- Mode: C++; c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 Fennec Installer for WinCE.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
/**
|
||||
*
|
||||
* nsInstallerDlg.cpp : Mozilla Fennec Installer UI.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <projects.h>
|
||||
#include <aygshell.h>
|
||||
|
||||
#include "nsSetupStrings.h"
|
||||
#include "nsInstaller.h"
|
||||
#include "ns7zipExtractor.h"
|
||||
#include "nsInstallerDlg.h"
|
||||
|
||||
#define WM_DIALOGCREATED (WM_USER + 1)
|
||||
|
||||
const WCHAR c_sInstallPathTemplate[] = L"%s\\%s";
|
||||
const WCHAR c_sExtractCardPathTemplate[] = L"\\%s%s\\%s";
|
||||
const WCHAR c_sAppRegKeyTemplate[] = L"Software\\Mozilla\\%s";
|
||||
const WCHAR c_sFastStartTemplate[] = L"%s\\%sfaststart.exe";
|
||||
|
||||
// Message handler for the dialog
|
||||
BOOL CALLBACK DlgMain(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return nsInstallerDlg::GetInstance()->DlgMain(hDlg, message, wParam, lParam);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// nsInstallerDlg dialog
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsInstallerDlg::nsInstallerDlg()
|
||||
{
|
||||
m_hInst = NULL;
|
||||
m_hDlg = NULL;
|
||||
m_bFastStart = FALSE;
|
||||
m_sExtractPath[0] = 0;
|
||||
m_sInstallPath[0] = 0;
|
||||
m_sProgramFiles[0] = 0;
|
||||
m_sErrorMsg[0] = 0;
|
||||
}
|
||||
|
||||
nsInstallerDlg* nsInstallerDlg::GetInstance()
|
||||
{
|
||||
static nsInstallerDlg dlg;
|
||||
return &dlg;
|
||||
}
|
||||
|
||||
void nsInstallerDlg::Init(HINSTANCE hInst)
|
||||
{
|
||||
m_hInst = hInst;
|
||||
}
|
||||
|
||||
int nsInstallerDlg::DoModal()
|
||||
{
|
||||
return (int)DialogBox(m_hInst, (LPCTSTR)IDD_MAIN, 0, ::DlgMain);
|
||||
}
|
||||
|
||||
BOOL CALLBACK nsInstallerDlg::DlgMain(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
return OnInitDialog(hDlg, wParam, lParam);
|
||||
|
||||
case WM_DIALOGCREATED:
|
||||
return OnDialogCreated(hDlg);
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
case IDCANCEL:
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return TRUE;
|
||||
|
||||
case IDC_BTN_INSTALL:
|
||||
if (OnBtnExtract())
|
||||
EndDialog(hDlg, IDOK);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
EndDialog(hDlg, message);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL nsInstallerDlg::OnInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// Create a Done button and size it.
|
||||
SHINITDLGINFO shidi;
|
||||
shidi.dwMask = SHIDIM_FLAGS;
|
||||
shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_EMPTYMENU;
|
||||
shidi.hDlg = hDlg;
|
||||
SHInitDialog(&shidi);
|
||||
|
||||
m_hDlg = hDlg;
|
||||
|
||||
SetWindowText(m_hDlg, Strings.GetString(StrID_WindowCaption));
|
||||
SetControlWindowText(IDC_STATIC_TITLE, Strings.GetString(StrID_WindowCaption));
|
||||
SetControlWindowText(IDC_STATIC_INSTALL, Strings.GetString(StrID_InstallTo));
|
||||
SetControlWindowText(IDC_BTN_INSTALL, Strings.GetString(StrID_Install));
|
||||
SetControlWindowText(IDCANCEL, Strings.GetString(StrID_Cancel));
|
||||
|
||||
if (!SHGetSpecialFolderPath(m_hDlg, m_sProgramFiles, CSIDL_PROGRAM_FILES, FALSE))
|
||||
wcscpy(m_sProgramFiles, L"\\Program Files");
|
||||
|
||||
_snwprintf(m_sInstallPath, MAX_PATH, c_sInstallPathTemplate,
|
||||
m_sProgramFiles, Strings.GetString(StrID_AppShortName));
|
||||
|
||||
SendMessageToControl(IDC_CMB_PATH, CB_ADDSTRING, 0, (LPARAM)(m_sInstallPath));
|
||||
FindMemCards();
|
||||
SendMessageToControl(IDC_CMB_PATH, CB_SETCURSEL, 0, 0);
|
||||
|
||||
EnableWindow(GetDlgItem(m_hDlg, IDC_BTN_INSTALL), FALSE);
|
||||
|
||||
PostMessage(m_hDlg, WM_DIALOGCREATED, 0, 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void nsInstallerDlg::FindMemCards()
|
||||
{
|
||||
WIN32_FIND_DATA fd;
|
||||
HANDLE hFlashCard = FindFirstFlashCard(&fd);
|
||||
if (hFlashCard != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
WCHAR sPath[MAX_PATH];
|
||||
do
|
||||
{
|
||||
if (wcslen(fd.cFileName) > 0)
|
||||
{
|
||||
_snwprintf(sPath, MAX_PATH, c_sExtractCardPathTemplate,
|
||||
fd.cFileName, m_sProgramFiles, Strings.GetString(StrID_AppShortName));
|
||||
SendMessageToControl(IDC_CMB_PATH, CB_ADDSTRING, 0, (LPARAM)(sPath));
|
||||
}
|
||||
} while(FindNextFlashCard(hFlashCard, &fd) && *fd.cFileName);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL nsInstallerDlg::OnDialogCreated(HWND hDlg)
|
||||
{
|
||||
BOOL bUninstallCancelled = FALSE;
|
||||
if (RunUninstall(&bUninstallCancelled) && bUninstallCancelled)
|
||||
{
|
||||
// Cancel installation
|
||||
PostMessage(hDlg, WM_CLOSE, 0, 0);
|
||||
}
|
||||
else
|
||||
EnableWindow(GetDlgItem(m_hDlg, IDC_BTN_INSTALL), TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL nsInstallerDlg::OnBtnExtract()
|
||||
{
|
||||
BOOL bResult = FALSE;
|
||||
|
||||
EnableWindow(GetDlgItem(m_hDlg, IDC_BTN_INSTALL), FALSE);
|
||||
EnableWindow(GetDlgItem(m_hDlg, IDCANCEL), FALSE);
|
||||
|
||||
int nPathIndex = SendMessageToControl(IDC_CMB_PATH, CB_GETCURSEL, 0, 0);
|
||||
if (nPathIndex >= 0)
|
||||
SendMessageToControl(IDC_CMB_PATH, CB_GETLBTEXT, nPathIndex, (LPARAM)(m_sInstallPath));
|
||||
|
||||
wcscpy(m_sExtractPath, m_sInstallPath);
|
||||
|
||||
// Remove the last directory ("Fennec") from the path as it is already in the archive
|
||||
WCHAR *sSlash = wcsrchr(m_sExtractPath, L'\\');
|
||||
if (sSlash)
|
||||
*sSlash = 0;
|
||||
|
||||
ns7zipExtractor archiveExtractor(g_sExeFullFileName, g_dwExeSize, this);
|
||||
|
||||
SendMessageToControl(IDC_PROGRESS, PBM_SETRANGE, 0, (LPARAM) MAKELPARAM (0, 100)); // progress in percents
|
||||
SendMessageToControl(IDC_PROGRESS, PBM_SETPOS, 0, 0);
|
||||
|
||||
int nResult = archiveExtractor.Extract(m_sExtractPath);
|
||||
if (nResult == 0)
|
||||
{
|
||||
Progress(100); // 100%
|
||||
bResult = PostExtract();
|
||||
}
|
||||
|
||||
EnableWindow(GetDlgItem(m_hDlg, IDC_BTN_INSTALL), TRUE);
|
||||
EnableWindow(GetDlgItem(m_hDlg, IDCANCEL), TRUE);
|
||||
|
||||
if (bResult)
|
||||
{
|
||||
MessageBoxW(m_hDlg, Strings.GetString(StrID_InstalledSuccessfully),
|
||||
Strings.GetString(StrID_WindowCaption), MB_OK|MB_ICONINFORMATION);
|
||||
}
|
||||
else
|
||||
{
|
||||
WCHAR sMsg[c_nMaxErrorLen];
|
||||
if (nResult != 0)
|
||||
_snwprintf(sMsg, c_nMaxErrorLen, L"%s %d", Strings.GetString(StrID_ExtractionError), nResult);
|
||||
else
|
||||
_snwprintf(sMsg, c_nMaxErrorLen, L"%s\n%s", Strings.GetString(StrID_ThereWereErrors), m_sErrorMsg);
|
||||
|
||||
MessageBoxW(m_hDlg, sMsg, Strings.GetString(StrID_WindowCaption), MB_OK|MB_ICONERROR);
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
LRESULT nsInstallerDlg::SendMessageToControl(int nCtlID, UINT Msg, WPARAM wParam /*= 0*/, LPARAM lParam /*= 0*/)
|
||||
{
|
||||
return SendMessage(GetDlgItem(m_hDlg, nCtlID), Msg, wParam, lParam);
|
||||
}
|
||||
|
||||
void nsInstallerDlg::SetControlWindowText(int nCtlID, const WCHAR *sText)
|
||||
{
|
||||
SetWindowText(GetDlgItem(m_hDlg, nCtlID), sText);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ZipProgress member override
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void nsInstallerDlg::Progress(int n)
|
||||
{
|
||||
SendMessageToControl(IDC_PROGRESS, PBM_SETPOS, (WPARAM)n, 0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PostExtract - additional step after extraction
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define RUN_AND_CHECK(fn) \
|
||||
if (!fn()) { \
|
||||
bResult = FALSE; \
|
||||
AddErrorMsg(L ## #fn ## L" failed"); \
|
||||
}
|
||||
|
||||
BOOL nsInstallerDlg::PostExtract()
|
||||
{
|
||||
BOOL bResult = TRUE;
|
||||
|
||||
m_bFastStart = FastStartFileExists();
|
||||
|
||||
RUN_AND_CHECK(CreateShortcut)
|
||||
|
||||
RUN_AND_CHECK(StoreInstallPath)
|
||||
|
||||
MoveSetupStrings();
|
||||
|
||||
RUN_AND_CHECK(SilentFirstRun)
|
||||
|
||||
RUN_AND_CHECK(RunSetupCab)
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
BOOL nsInstallerDlg::StoreInstallPath()
|
||||
{
|
||||
HKEY hKey;
|
||||
WCHAR sRegFennecKey[MAX_PATH];
|
||||
_snwprintf(sRegFennecKey, MAX_PATH, c_sAppRegKeyTemplate, Strings.GetString(StrID_AppShortName));
|
||||
|
||||
// Store the installation path - to be used by the uninstaller
|
||||
LONG result = RegCreateKeyEx(HKEY_LOCAL_MACHINE, sRegFennecKey, 0, REG_NONE,
|
||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL);
|
||||
if (result == ERROR_SUCCESS)
|
||||
{
|
||||
result = RegSetValueEx(hKey, L"Path", 0, REG_SZ, (BYTE* const)m_sInstallPath, (wcslen(m_sInstallPath)+1)*sizeof(WCHAR));
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
return (result == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
// Creates shortcuts for Fennec and (optionally) FastStart service.
|
||||
// Note: The shortcut names have to be in sync with DeleteShortcut in Uninstaller.cpp
|
||||
BOOL nsInstallerDlg::CreateShortcut()
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
||||
WCHAR sFennecPath[MAX_PATH];
|
||||
_snwprintf(sFennecPath, MAX_PATH, L"\"%s\\%s.exe\"", m_sInstallPath, Strings.GetString(StrID_AppShortName));
|
||||
|
||||
WCHAR sProgramsPath[MAX_PATH];
|
||||
if (SHGetSpecialFolderPath(m_hDlg, sProgramsPath, CSIDL_PROGRAMS, FALSE))
|
||||
{
|
||||
WCHAR sShortcutPath[MAX_PATH];
|
||||
_snwprintf(sShortcutPath, MAX_PATH, L"%s\\%s.lnk", sProgramsPath, Strings.GetString(StrID_AppShortName));
|
||||
|
||||
// Delete the old shortcut if it exists
|
||||
if(SetFileAttributes(sShortcutPath, FILE_ATTRIBUTE_NORMAL))
|
||||
DeleteFile(sShortcutPath);
|
||||
|
||||
result = SHCreateShortcut(sShortcutPath, sFennecPath);
|
||||
}
|
||||
|
||||
if (m_bFastStart)
|
||||
{
|
||||
WCHAR sFastStartPath[MAX_PATH];
|
||||
_snwprintf(sFastStartPath, MAX_PATH, L"\"%s\\%sfaststart.exe\"", m_sInstallPath, Strings.GetString(StrID_AppShortName));
|
||||
|
||||
WCHAR sStartupPath[MAX_PATH];
|
||||
if (SHGetSpecialFolderPath(m_hDlg, sStartupPath, CSIDL_STARTUP, FALSE))
|
||||
{
|
||||
WCHAR sStartupShortcutPath[MAX_PATH];
|
||||
_snwprintf(sStartupShortcutPath, MAX_PATH, L"%s\\%sFastStart.lnk", sStartupPath, Strings.GetString(StrID_AppShortName));
|
||||
|
||||
if(SetFileAttributes(sStartupShortcutPath, FILE_ATTRIBUTE_NORMAL))
|
||||
DeleteFile(sStartupShortcutPath);
|
||||
|
||||
result = SHCreateShortcut(sStartupShortcutPath, sFastStartPath) && result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL nsInstallerDlg::MoveSetupStrings()
|
||||
{
|
||||
WCHAR sExtractedStringsFile[MAX_PATH];
|
||||
_snwprintf(sExtractedStringsFile, MAX_PATH, L"%s\\%s", m_sExtractPath, c_sStringsFile);
|
||||
|
||||
WCHAR sNewStringsFile[MAX_PATH];
|
||||
_snwprintf(sNewStringsFile, MAX_PATH, L"%s\\%s", m_sInstallPath, c_sStringsFile);
|
||||
|
||||
return MoveFile(sExtractedStringsFile, sNewStringsFile);
|
||||
}
|
||||
|
||||
BOOL nsInstallerDlg::SilentFirstRun()
|
||||
{
|
||||
SetControlWindowText(IDC_STATUS_TEXT, Strings.GetString(StrID_CreatingUserProfile));
|
||||
UpdateWindow(m_hDlg); // make sure the text is drawn
|
||||
|
||||
WCHAR sCmdLine[MAX_PATH];
|
||||
WCHAR *sParams = NULL;
|
||||
if (m_bFastStart)
|
||||
{
|
||||
// Run fast start exe instead - it will create the profile and stay in the background
|
||||
_snwprintf(sCmdLine, MAX_PATH, c_sFastStartTemplate, m_sInstallPath, Strings.GetString(StrID_AppShortName));
|
||||
}
|
||||
else
|
||||
{
|
||||
_snwprintf(sCmdLine, MAX_PATH, L"%s\\%s.exe", m_sInstallPath, Strings.GetString(StrID_AppShortName));
|
||||
sParams = L"-silent -nosplash";
|
||||
}
|
||||
PROCESS_INFORMATION pi;
|
||||
BOOL bResult = CreateProcess(sCmdLine, sParams,
|
||||
NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi);
|
||||
if (bResult)
|
||||
{
|
||||
// Wait for it to finish (since the system is likely to be busy
|
||||
// while it launches anyways). The process may never terminate
|
||||
// if FastStart is enabled, so don't wait longer than 10 seconds.
|
||||
WaitForSingleObject(pi.hProcess, 10000);
|
||||
}
|
||||
|
||||
if (m_bFastStart)
|
||||
{
|
||||
// When the FastStart is enabled, Fennec is being loaded in the background,
|
||||
// user cannot launch it with a shortcut, and the system is busy at the moment,
|
||||
// so we'll just wait here.
|
||||
|
||||
// Class name: appName + "MessageWindow"
|
||||
WCHAR sClassName[MAX_PATH];
|
||||
_snwprintf(sClassName, MAX_PATH, L"%s%s", Strings.GetString(StrID_AppShortName), L"MessageWindow");
|
||||
|
||||
// Wait until the hidden window gets created or for some timeout (~10s seems to be reasonable)
|
||||
HWND handle = NULL;
|
||||
for (int i = 0; i < 20 && !handle; i++)
|
||||
{
|
||||
handle = ::FindWindowW(sClassName, NULL);
|
||||
Sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
SetWindowText(GetDlgItem(m_hDlg, IDC_STATUS_TEXT), L"");
|
||||
return bResult;
|
||||
}
|
||||
|
||||
BOOL nsInstallerDlg::RunSetupCab()
|
||||
{
|
||||
BOOL bResult = FALSE;
|
||||
|
||||
WCHAR sCabPath[MAX_PATH];
|
||||
WCHAR sParams[MAX_PATH + 20];
|
||||
_snwprintf(sCabPath, MAX_PATH, L"%s\\setup.cab", m_sInstallPath);
|
||||
|
||||
// Run "wceload.exe /noui Fennec.cab"
|
||||
_snwprintf(sParams, MAX_PATH, L"/noui \"%s\"", sCabPath);
|
||||
PROCESS_INFORMATION pi;
|
||||
bResult = CreateProcess(L"\\Windows\\wceload.exe",
|
||||
sParams, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi);
|
||||
if (bResult)
|
||||
{
|
||||
// Wait for it to finish
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
void nsInstallerDlg::AddErrorMsg(WCHAR* sErr)
|
||||
{
|
||||
WCHAR sMsg[c_nMaxErrorLen];
|
||||
_snwprintf(sMsg, c_nMaxErrorLen, L"%s. LastError = %d\n", sErr, GetLastError());
|
||||
wcsncat(m_sErrorMsg, sMsg, c_nMaxErrorLen - wcslen(m_sErrorMsg));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Uninstall previous installation
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
BOOL nsInstallerDlg::GetInstallPath(WCHAR *sPath)
|
||||
{
|
||||
HKEY hKey;
|
||||
WCHAR sRegFennecKey[MAX_PATH];
|
||||
_snwprintf(sRegFennecKey, MAX_PATH, c_sAppRegKeyTemplate, Strings.GetString(StrID_AppShortName));
|
||||
|
||||
LONG result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, sRegFennecKey, 0, KEY_ALL_ACCESS, &hKey);
|
||||
if (result == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD dwType = NULL;
|
||||
DWORD dwCount = MAX_PATH * sizeof(WCHAR);
|
||||
result = RegQueryValueEx(hKey, L"Path", NULL, &dwType, (LPBYTE)sPath, &dwCount);
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
return (result == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
BOOL nsInstallerDlg::RunUninstall(BOOL *pbCancelled)
|
||||
{
|
||||
BOOL bResult = FALSE;
|
||||
WCHAR sUninstallPath[MAX_PATH];
|
||||
if (GetInstallPath(sUninstallPath))
|
||||
{
|
||||
if (wcslen(sUninstallPath) > 0 && sUninstallPath[wcslen(sUninstallPath)-1] != '\\')
|
||||
wcscat(sUninstallPath, L"\\");
|
||||
|
||||
WCHAR sParam[MAX_PATH+10];
|
||||
_snwprintf(sParam, MAX_PATH+9, L"[remove] %s", sUninstallPath);
|
||||
|
||||
wcscat(sUninstallPath, L"uninstall.exe");
|
||||
|
||||
PROCESS_INFORMATION pi;
|
||||
bResult = CreateProcess(sUninstallPath, sParam,
|
||||
NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi);
|
||||
if (bResult)
|
||||
{
|
||||
// Wait for it to finish
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
|
||||
if (pbCancelled != NULL)
|
||||
{
|
||||
DWORD dwExitCode = 0;
|
||||
GetExitCodeProcess(pi.hProcess, &dwExitCode);
|
||||
*pbCancelled = (dwExitCode == IDCANCEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Helper functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
BOOL nsInstallerDlg::FastStartFileExists()
|
||||
{
|
||||
WCHAR sFastStartPath[MAX_PATH];
|
||||
_snwprintf(sFastStartPath, MAX_PATH, c_sFastStartTemplate, m_sInstallPath, Strings.GetString(StrID_AppShortName));
|
||||
// Check if file exists
|
||||
return (GetFileAttributes(sFastStartPath) != INVALID_FILE_ATTRIBUTES);
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
/* -*- Mode: C++; c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 Fennec Installer for WinCE.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* nsInstallerDlg dialog
|
||||
*/
|
||||
class nsInstallerDlg : public nsExtractorProgress
|
||||
{
|
||||
public:
|
||||
static nsInstallerDlg* GetInstance();
|
||||
void Init(HINSTANCE hInst);
|
||||
int DoModal();
|
||||
virtual void Progress(int n); // gets progress notifications
|
||||
INT_PTR DlgMain(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
const WCHAR* GetExtractPath() { return m_sInstallPath; }
|
||||
|
||||
private:
|
||||
nsInstallerDlg();
|
||||
BOOL OnInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam);
|
||||
void FindMemCards();
|
||||
BOOL OnDialogCreated(HWND hDlg);
|
||||
BOOL OnBtnExtract();
|
||||
LRESULT SendMessageToControl(int nCtlID, UINT Msg, WPARAM wParam = 0, LPARAM lParam = 0);
|
||||
void SetControlWindowText(int nCtlID, const WCHAR *sText);
|
||||
|
||||
BOOL PostExtract();
|
||||
BOOL StoreInstallPath();
|
||||
BOOL CreateShortcut();
|
||||
BOOL MoveSetupStrings();
|
||||
BOOL SilentFirstRun();
|
||||
BOOL RunSetupCab();
|
||||
|
||||
BOOL GetInstallPath(WCHAR *sPath);
|
||||
BOOL RunUninstall(BOOL *pbCancelled);
|
||||
|
||||
void AddErrorMsg(WCHAR* sErr);
|
||||
BOOL FastStartFileExists();
|
||||
|
||||
static const int c_nMaxErrorLen = 2048;
|
||||
|
||||
HINSTANCE m_hInst;
|
||||
HWND m_hDlg;
|
||||
BOOL m_bFastStart;
|
||||
WCHAR m_sProgramFiles[MAX_PATH];
|
||||
WCHAR m_sExtractPath[MAX_PATH];
|
||||
WCHAR m_sInstallPath[MAX_PATH];
|
||||
WCHAR m_sErrorMsg[c_nMaxErrorLen];
|
||||
};
|
@ -1,162 +0,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 Fennec Installer for WinCE.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resourceppc.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||
#include "resdefce.h"
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_NSINSTALLER ICON "xulrunnerinstaller.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_MAIN DIALOG 0, 0, 156, 129
|
||||
STYLE DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION
|
||||
EXSTYLE 0x80000000L
|
||||
CAPTION "Mozilla Setup"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
ICON IDI_NSINSTALLER,IDC_STATIC,7,3,20,20,SS_REALSIZEIMAGE
|
||||
LTEXT "XULRunner Setup",IDC_STATIC_TITLE,39,8,106,8,SS_NOPREFIX
|
||||
LTEXT "Install XULRunner to",IDC_STATIC_INSTALL,2,26,142,11
|
||||
PUSHBUTTON "Install",IDC_BTN_INSTALL,2,57,70,20
|
||||
PUSHBUTTON "Cancel",IDCANCEL,84,57,70,20
|
||||
CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,2,84,152,9
|
||||
COMBOBOX IDC_CMB_PATH,2,37,152,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "",IDC_STATUS_TEXT,2,98,152,19
|
||||
END
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resourceppc.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"#include ""resdefce.h""\r\n"
|
||||
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
|
||||
"LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r\n"
|
||||
"#pragma code_page(1252)\r\n"
|
||||
"#include ""nsInstallerppc.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
|
||||
"#endif\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_MAIN, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 2
|
||||
RIGHTMARGIN, 154
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#include "nsInstallerppc.rc2" // non-Microsoft Visual C++ edited resources
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
@ -1,17 +0,0 @@
|
||||
//
|
||||
// nsInstallerPPC.rc2 - resources Microsoft Visual C++ does not edit directly
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#error this file is not editable by Microsoft Visual C++
|
||||
#endif //APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Add manually edited resources here...
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
HI_RES_AWARE CEUX {1} // turn off the emulation layer
|
||||
// Remove this resource to enable pixel-
|
||||
// doubling on platforms that support it
|
||||
/////////////////////////////////////////////////////////////////////////////
|
@ -1,107 +0,0 @@
|
||||
/* -*- Mode: C++; c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 Fennec Installer for WinCE.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
/**
|
||||
*
|
||||
* Class to work with localizable string resources
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "nsSetupStrings.h"
|
||||
#include "readstrings.h"
|
||||
#include "errors.h"
|
||||
|
||||
#define STR_KEY(x) #x "\0"
|
||||
const char *kSetupStrKeys =
|
||||
#include "nsSetupStrings.inc"
|
||||
;
|
||||
#undef STR_KEY
|
||||
|
||||
nsSetupStrings::nsSetupStrings()
|
||||
{
|
||||
m_sBuf = NULL;
|
||||
memset(m_arrStrings, 0, sizeof(m_arrStrings));
|
||||
}
|
||||
|
||||
nsSetupStrings::~nsSetupStrings()
|
||||
{
|
||||
delete[] m_sBuf;
|
||||
}
|
||||
|
||||
BOOL nsSetupStrings::LoadStrings(WCHAR *sFileName)
|
||||
{
|
||||
if (!sFileName)
|
||||
return FALSE;
|
||||
|
||||
BOOL bResult = FALSE;
|
||||
char strings[kNumberOfStrings][MAX_TEXT_LEN];
|
||||
if (ReadStrings(sFileName, kSetupStrKeys, kNumberOfStrings, strings) == OK)
|
||||
{
|
||||
int nSize = 0;
|
||||
for (int i = 0; i < kNumberOfStrings; i++)
|
||||
{
|
||||
nSize += strlen(strings[i]) + 1;
|
||||
}
|
||||
|
||||
m_sBuf = new WCHAR[nSize];
|
||||
if (!m_sBuf)
|
||||
return FALSE;
|
||||
|
||||
WCHAR *p = m_sBuf;
|
||||
for (int i = 0; i < kNumberOfStrings; i++)
|
||||
{
|
||||
int len = strlen(strings[i]) + 1;
|
||||
MultiByteToWideChar(CP_UTF8, 0, strings[i], len, p, len);
|
||||
m_arrStrings[i] = p;
|
||||
p += len;
|
||||
}
|
||||
|
||||
bResult = TRUE;
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
const WCHAR* nsSetupStrings::GetString(int nID)
|
||||
{
|
||||
if (nID >= kNumberOfStrings)
|
||||
return L"";
|
||||
else
|
||||
return m_arrStrings[nID];
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 Fennec Installer for WinCE.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
/**
|
||||
*
|
||||
* Class to work with localizable string resources
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define STR_KEY(x) StrID_##x,
|
||||
enum
|
||||
{
|
||||
#include "nsSetupStrings.inc"
|
||||
StrID_NumberOfStrings
|
||||
};
|
||||
#undef STR_KEY
|
||||
|
||||
class nsSetupStrings
|
||||
{
|
||||
public:
|
||||
nsSetupStrings();
|
||||
~nsSetupStrings();
|
||||
|
||||
BOOL LoadStrings(TCHAR *sFileName);
|
||||
const TCHAR* GetString(int nID);
|
||||
|
||||
private:
|
||||
|
||||
static const int kNumberOfStrings = StrID_NumberOfStrings;
|
||||
TCHAR* m_sBuf;
|
||||
TCHAR* m_arrStrings[kNumberOfStrings];
|
||||
};
|
@ -1,15 +0,0 @@
|
||||
STR_KEY(AppShortName)
|
||||
STR_KEY(AppLongName)
|
||||
STR_KEY(WindowCaption)
|
||||
STR_KEY(InstallTo)
|
||||
STR_KEY(Install)
|
||||
STR_KEY(Cancel)
|
||||
STR_KEY(InstalledSuccessfully)
|
||||
STR_KEY(ExtractionError)
|
||||
STR_KEY(ThereWereErrors)
|
||||
STR_KEY(CreatingUserProfile)
|
||||
STR_KEY(UninstallCaption)
|
||||
STR_KEY(FilesWillBeRemoved)
|
||||
STR_KEY(AreYouSure)
|
||||
STR_KEY(InstallationNotFound)
|
||||
STR_KEY(UninstalledSuccessfully)
|
@ -1,13 +0,0 @@
|
||||
FennecInstaller implementation to replace CAB installer.
|
||||
|
||||
This version extracts a 7z file appended to the EXE, i.e. works like a
|
||||
self-extracted archive.
|
||||
|
||||
For example if you want to install fennec-1.0a3pre.en-US.wince-arm.7z, build
|
||||
the program, run the following command:
|
||||
|
||||
cat fennec_installer.exe fennec-1.0a3pre.en-US.wince-arm.7z >fennec-1.0a3pre.en-US.wince-arm.exe
|
||||
|
||||
Then copy fennec-1.0a3pre.en-US.wince-arm.exe to a device and run it.
|
||||
|
||||
Note: Requires lib7z.
|
@ -1,27 +0,0 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by nsInstallerppc.rc
|
||||
//
|
||||
#define IDS_APP_TITLE 1
|
||||
#define IDI_NSINSTALLER 101
|
||||
#define IDR_MENU 102
|
||||
#define IDD_MAIN 103
|
||||
#define IDC_BTN_INSTALL 1000
|
||||
#define IDC_PROGRESS 1001
|
||||
#define IDC_CMB_PATH 1002
|
||||
#define IDC_STATUS_TEXT 1003
|
||||
#define IDC_STATIC_TITLE 1004
|
||||
#define IDC_STATIC_INSTALL 1005
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1006
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
#endif
|
@ -1,66 +0,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 Fennec Installer for WinCE.
|
||||
#
|
||||
# The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
#
|
||||
# Portions created by the Initial Developer are Copyright (C) 2009
|
||||
# the Mozilla Foundation <http://www.mozilla.org/>. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
#
|
||||
# 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 *****
|
||||
|
||||
DEPTH = ../../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
PROGRAM = uninstall$(BIN_SUFFIX)
|
||||
|
||||
CPPSRCS = \
|
||||
Uninstall.cpp \
|
||||
../nsSetupStrings.cpp \
|
||||
$(NULL)
|
||||
|
||||
LIBS += $(DEPTH)/toolkit/mozapps/readstrings/$(LIB_PREFIX)readstrings.$(LIB_SUFFIX)
|
||||
|
||||
OS_LIBS += aygshell.lib commctrl.lib
|
||||
|
||||
LOCAL_INCLUDES += -I$(srcdir)/.. -I$(srcdir)/../../../readstrings
|
||||
|
||||
RCINCLUDE = Uninstall.rc
|
||||
|
||||
# Statically link the CRT when possible
|
||||
USE_STATIC_LIBS = 1
|
||||
|
||||
WIN32_EXE_LDFLAGS += -ENTRY:WinMain
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -1,543 +0,0 @@
|
||||
/* -*- Mode: C++; c-basic-offset: 2; tab-width: 8; indent-tabs-mode: nil; -*- */
|
||||
/* ***** 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 Fennec Installer for WinCE.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
/**
|
||||
*
|
||||
* Uninstall.cpp : Mozilla Fennec Uninstaller
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <aygshell.h>
|
||||
#include <cfgmgrapi.h>
|
||||
|
||||
#include "nsSetupStrings.h"
|
||||
#include "resource.h"
|
||||
|
||||
#define WM_DIALOGCREATED (WM_USER + 1)
|
||||
|
||||
const WCHAR c_sStringsFile[] = L"setup.ini";
|
||||
nsSetupStrings Strings;
|
||||
|
||||
BOOL g_bRunFromSetupDll = FALSE;
|
||||
|
||||
WCHAR g_sInstallPath[MAX_PATH];
|
||||
WCHAR g_sUninstallPath[MAX_PATH];
|
||||
HWND g_hDlg = NULL;
|
||||
|
||||
const WCHAR c_sAppRegKeyTemplate[] = L"Software\\Mozilla\\%s";
|
||||
|
||||
const DWORD c_nTempBufSize = MAX_PATH * 2;
|
||||
const WCHAR c_sRemoveParam[] = L"[remove]";
|
||||
const WCHAR c_sSetupParam[] = L"[setup]"; // means executed by Setup.dll
|
||||
|
||||
// Retry counter for the file/directory deletion
|
||||
int nTotalRetries = 0;
|
||||
const int c_nMaxTotalRetries = 10;
|
||||
const int c_nMaxOneFileRetries = 6;
|
||||
const int c_nRetryDelay = 500; //milliseconds
|
||||
|
||||
int g_nDirsDeleted = 0;
|
||||
const int c_nMaxDirs = 25; // approximate number of dirs just to show some progress
|
||||
|
||||
enum {
|
||||
ErrOK = 0,
|
||||
ErrCancel = IDCANCEL,
|
||||
ErrNoStrings = -1,
|
||||
ErrInstallationNotFound = -2,
|
||||
ErrShutdownFailed = -3,
|
||||
};
|
||||
|
||||
int g_nResult = ErrOK;
|
||||
|
||||
// Forward declarations
|
||||
BOOL GetModulePath(WCHAR *sPath);
|
||||
BOOL LoadStrings();
|
||||
BOOL GetInstallPath(WCHAR *sPath);
|
||||
BOOL DeleteShortcut(HWND hwndParent);
|
||||
BOOL DeleteDirectory(const WCHAR* sPathToDelete);
|
||||
BOOL DeleteRegistryKey();
|
||||
BOOL CopyAndLaunch();
|
||||
BOOL ShutdownFastStartService(const WCHAR *sInstallPath);
|
||||
BOOL RunSystemUninstall();
|
||||
|
||||
BOOL CALLBACK DlgUninstall(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
BOOL OnDialogInit(HWND hDlg);
|
||||
BOOL OnDialogCreated(HWND hDlg);
|
||||
int OnUninstall(HWND hDlg);
|
||||
void UpdateProgress();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Main
|
||||
//
|
||||
int WINAPI WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPTSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
HWND hWnd = GetForegroundWindow();
|
||||
*g_sUninstallPath = 0;
|
||||
|
||||
WCHAR *sCommandLine = GetCommandLine();
|
||||
WCHAR *sRemoveParam = wcsstr(sCommandLine, c_sRemoveParam);
|
||||
WCHAR g_bRunFromSetupDll = (wcsstr(sCommandLine, c_sSetupParam) != NULL);
|
||||
if (sRemoveParam != NULL)
|
||||
{
|
||||
// Launched from a temp directory with parameters "[remove] \Program Files\Fennec\"
|
||||
wcscpy(g_sUninstallPath, sRemoveParam + wcslen(c_sRemoveParam) + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just copy this EXE and launch it from a temp location with a special parameter
|
||||
// to delete itself in the installation directory
|
||||
if (CopyAndLaunch())
|
||||
return ErrOK;
|
||||
}
|
||||
// Perform uninstallation when executed with a special parameter
|
||||
// (or in case when CopyAndLaunch failed - just execute in place)
|
||||
|
||||
if (!LoadStrings())
|
||||
{
|
||||
MessageBoxW(hWnd, L"Cannot find the strings file.", L"Uninstall", MB_OK|MB_ICONWARNING);
|
||||
return ErrNoStrings;
|
||||
}
|
||||
|
||||
if (GetInstallPath(g_sInstallPath))
|
||||
{
|
||||
int nDlgResult = DialogBox(hInstance, (LPCTSTR)IDD_MAIN, NULL, (DLGPROC)DlgUninstall);
|
||||
if (nDlgResult != ErrOK)
|
||||
g_nResult = nDlgResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxW(hWnd, Strings.GetString(StrID_InstallationNotFound),
|
||||
Strings.GetString(StrID_UninstallCaption), MB_OK|MB_ICONINFORMATION);
|
||||
return ErrInstallationNotFound;
|
||||
}
|
||||
|
||||
return g_nResult;
|
||||
}
|
||||
|
||||
int Uninstall(HWND hWnd)
|
||||
{
|
||||
// Remove all installed files
|
||||
DeleteDirectory(g_sInstallPath);
|
||||
DeleteShortcut(hWnd);
|
||||
DeleteRegistryKey();
|
||||
|
||||
if (!g_bRunFromSetupDll)
|
||||
RunSystemUninstall();
|
||||
|
||||
// TODO: May probably handle errors during deletion (such as locked directories)
|
||||
// and notify user. Right now just return OK.
|
||||
return ErrOK;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Dialog
|
||||
//
|
||||
BOOL CALLBACK DlgUninstall(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
return OnDialogInit(hDlg);
|
||||
|
||||
case WM_DIALOGCREATED:
|
||||
return OnDialogCreated(hDlg);
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
EndDialog(hDlg, ErrOK);
|
||||
return TRUE;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hDlg, ErrCancel);
|
||||
return TRUE;
|
||||
|
||||
case IDC_BTN_UNINSTALL:
|
||||
g_nResult = OnUninstall(hDlg);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
EndDialog(hDlg, ErrCancel);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL OnDialogCreated(HWND)
|
||||
{
|
||||
ShutdownFastStartService(g_sInstallPath);
|
||||
// Just continue regardless of the result
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL OnDialogInit(HWND hDlg)
|
||||
{
|
||||
g_hDlg = hDlg;
|
||||
PostMessage(hDlg, WM_DIALOGCREATED, 0, 0);
|
||||
|
||||
SetWindowText(hDlg, Strings.GetString(StrID_UninstallCaption));
|
||||
|
||||
SHINITDLGINFO shidi;
|
||||
shidi.dwMask = SHIDIM_FLAGS;
|
||||
shidi.dwFlags = SHIDIF_SIPDOWN | SHIDIF_EMPTYMENU;
|
||||
shidi.hDlg = hDlg;
|
||||
SHInitDialog(&shidi);
|
||||
|
||||
// Hide the Done button
|
||||
SHDoneButton(hDlg, SHDB_HIDE);
|
||||
|
||||
// Init controls
|
||||
WCHAR sMsg[c_nTempBufSize];
|
||||
_snwprintf(sMsg, c_nTempBufSize, L"%s %s", Strings.GetString(StrID_FilesWillBeRemoved), g_sInstallPath);
|
||||
SetWindowText(GetDlgItem(hDlg, IDC_STATIC_TEXT), sMsg);
|
||||
SetWindowText(GetDlgItem(hDlg, IDC_QUESTION_TEXT), Strings.GetString(StrID_AreYouSure));
|
||||
SetWindowText(GetDlgItem(hDlg, IDC_BTN_UNINSTALL), L"OK"); // TODO: Use localized text "Uninstall"
|
||||
SetWindowText(GetDlgItem(hDlg, IDCANCEL), Strings.GetString(StrID_Cancel));
|
||||
ShowWindow(GetDlgItem(hDlg, IDC_PROGRESS), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hDlg, IDOK), SW_HIDE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int OnUninstall(HWND hDlg)
|
||||
{
|
||||
SetWindowText(GetDlgItem(hDlg, IDC_QUESTION_TEXT), L"");
|
||||
ShowWindow(GetDlgItem(hDlg, IDC_BTN_UNINSTALL), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hDlg, IDCANCEL), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hDlg, IDC_PROGRESS), SW_SHOW);
|
||||
SendMessage(GetDlgItem(hDlg, IDC_PROGRESS), PBM_SETRANGE, 0, (LPARAM) MAKELPARAM (0, c_nMaxDirs));
|
||||
SendMessage(GetDlgItem(hDlg, IDC_PROGRESS), PBM_SETPOS, 0, 0);
|
||||
|
||||
UpdateWindow(hDlg); // make sure the text is drawn
|
||||
|
||||
int ret = Uninstall(hDlg);
|
||||
|
||||
if (ret == ErrOK)
|
||||
{
|
||||
SetWindowText(GetDlgItem(hDlg, IDC_STATIC_TEXT), Strings.GetString(StrID_UninstalledSuccessfully));
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO: Localize this message. It might be shown later when the errors will be handled
|
||||
SetWindowText(GetDlgItem(hDlg, IDC_STATIC_TEXT), L"There were errors during uninstallation.");
|
||||
}
|
||||
|
||||
ShowWindow(GetDlgItem(hDlg, IDC_PROGRESS), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hDlg, IDOK), SW_SHOW);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void UpdateProgress()
|
||||
{
|
||||
SendMessage(GetDlgItem(g_hDlg, IDC_PROGRESS), PBM_SETPOS, (WPARAM)g_nDirsDeleted, 0);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Utility functions
|
||||
//
|
||||
|
||||
BOOL LoadStrings()
|
||||
{
|
||||
// Locate and load the strings file used by installer
|
||||
if (*g_sUninstallPath == 0)
|
||||
GetModulePath(g_sUninstallPath);
|
||||
|
||||
WCHAR sStringsFile[MAX_PATH];
|
||||
_snwprintf(sStringsFile, MAX_PATH, L"%s\\%s", g_sUninstallPath, c_sStringsFile);
|
||||
|
||||
return Strings.LoadStrings(sStringsFile);
|
||||
}
|
||||
|
||||
BOOL GetModulePath(WCHAR *sPath)
|
||||
{
|
||||
if (GetModuleFileName(NULL, sPath, MAX_PATH) == 0)
|
||||
return FALSE;
|
||||
|
||||
WCHAR *sSlash = wcsrchr(sPath, L'\\') + 1;
|
||||
*sSlash = L'\0'; // cut the file name
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL GetInstallPath(WCHAR *sPath)
|
||||
{
|
||||
HKEY hKey;
|
||||
WCHAR sRegFennecKey[MAX_PATH];
|
||||
_snwprintf(sRegFennecKey, MAX_PATH, c_sAppRegKeyTemplate, Strings.GetString(StrID_AppShortName));
|
||||
|
||||
LONG result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, sRegFennecKey, 0, KEY_ALL_ACCESS, &hKey);
|
||||
if (result == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD dwType = NULL;
|
||||
DWORD dwCount = MAX_PATH * sizeof(WCHAR);
|
||||
result = RegQueryValueEx(hKey, L"Path", NULL, &dwType, (LPBYTE)sPath, &dwCount);
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
return (result == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
BOOL DeleteDirectory(const WCHAR* sPathToDelete)
|
||||
{
|
||||
BOOL bResult = TRUE;
|
||||
HANDLE hFile;
|
||||
WCHAR sFilePath[MAX_PATH];
|
||||
WCHAR sPattern[MAX_PATH];
|
||||
WIN32_FIND_DATA findData;
|
||||
|
||||
wcscpy(sPattern, sPathToDelete);
|
||||
wcscat(sPattern, L"\\*.*");
|
||||
hFile = FindFirstFile(sPattern, &findData);
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (findData.cFileName[0] != L'.')
|
||||
{
|
||||
_snwprintf(sFilePath, MAX_PATH, L"%s\\%s", sPathToDelete, findData.cFileName);
|
||||
|
||||
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
// Delete subdirectory
|
||||
if (!DeleteDirectory(sFilePath))
|
||||
bResult = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set file attributes
|
||||
if (SetFileAttributes(sFilePath, FILE_ATTRIBUTE_NORMAL))
|
||||
{
|
||||
// Delete file
|
||||
if (!DeleteFile(sFilePath) && nTotalRetries < c_nMaxTotalRetries)
|
||||
{
|
||||
BOOL bDeleted = FALSE;
|
||||
nTotalRetries++;
|
||||
for (int nRetry = 0; nRetry < c_nMaxOneFileRetries; nRetry++)
|
||||
{
|
||||
Sleep(c_nRetryDelay);
|
||||
if (DeleteFile(sFilePath))
|
||||
{
|
||||
bDeleted = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bDeleted)
|
||||
bResult = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (FindNextFile(hFile, &findData));
|
||||
|
||||
// Close handle
|
||||
FindClose(hFile);
|
||||
}
|
||||
|
||||
// Set directory attributes
|
||||
if (SetFileAttributes(sPathToDelete, FILE_ATTRIBUTE_NORMAL))
|
||||
{
|
||||
g_nDirsDeleted++;
|
||||
UpdateProgress();
|
||||
// Delete directory
|
||||
if (!RemoveDirectory(sPathToDelete) && nTotalRetries < c_nMaxTotalRetries)
|
||||
{
|
||||
BOOL bDeleted = FALSE;
|
||||
nTotalRetries++;
|
||||
for (int nRetry = 0; nRetry < c_nMaxOneFileRetries; nRetry++)
|
||||
{
|
||||
Sleep(c_nRetryDelay);
|
||||
if (RemoveDirectory(sPathToDelete))
|
||||
{
|
||||
bDeleted = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bDeleted)
|
||||
bResult = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
// Deletes shortcuts for Fennec and FastStart service created by the installer.
|
||||
// Note: The shortcut names have to be in sync with CreateShortcut in nsInstallerDlg.cpp
|
||||
BOOL DeleteShortcut(HWND hwndParent)
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
||||
WCHAR sProgramsPath[MAX_PATH];
|
||||
if (SHGetSpecialFolderPath(hwndParent, sProgramsPath, CSIDL_PROGRAMS, FALSE))
|
||||
{
|
||||
WCHAR sShortcutPath[MAX_PATH];
|
||||
_snwprintf(sShortcutPath, MAX_PATH, L"%s\\%s.lnk", sProgramsPath, Strings.GetString(StrID_AppShortName));
|
||||
|
||||
|
||||
if(SetFileAttributes(sShortcutPath, FILE_ATTRIBUTE_NORMAL))
|
||||
result = DeleteFile(sShortcutPath);
|
||||
}
|
||||
|
||||
// Handle faststart shortcut
|
||||
WCHAR sStartupPath[MAX_PATH];
|
||||
if (SHGetSpecialFolderPath(hwndParent, sStartupPath, CSIDL_STARTUP, FALSE))
|
||||
{
|
||||
WCHAR sStartupShortcutPath[MAX_PATH];
|
||||
_snwprintf(sStartupShortcutPath, MAX_PATH, L"%s\\%sFastStart.lnk", sStartupPath, Strings.GetString(StrID_AppShortName));
|
||||
|
||||
// It may not exist - just ignore that
|
||||
if(SetFileAttributes(sStartupShortcutPath, FILE_ATTRIBUTE_NORMAL))
|
||||
DeleteFile(sStartupShortcutPath);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL DeleteRegistryKey()
|
||||
{
|
||||
WCHAR sRegFennecKey[MAX_PATH];
|
||||
_snwprintf(sRegFennecKey, MAX_PATH, c_sAppRegKeyTemplate, Strings.GetString(StrID_AppShortName));
|
||||
|
||||
LONG result = RegDeleteKey(HKEY_LOCAL_MACHINE, sRegFennecKey);
|
||||
return (result == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
// Copy to a temp directory and launch from there
|
||||
BOOL CopyAndLaunch()
|
||||
{
|
||||
WCHAR sNewName[] = L"\\Temp\\uninstall.exe";
|
||||
WCHAR sModule[MAX_PATH];
|
||||
if (GetModuleFileName(NULL, sModule, MAX_PATH) == 0 || !GetModulePath(g_sUninstallPath))
|
||||
return FALSE;
|
||||
if (CopyFile(sModule, sNewName, FALSE))
|
||||
{
|
||||
PROCESS_INFORMATION pi;
|
||||
WCHAR sParam[c_nTempBufSize];
|
||||
if (g_bRunFromSetupDll)
|
||||
_snwprintf(sParam, c_nTempBufSize, L"%s %s %s", c_sSetupParam, c_sRemoveParam, g_sUninstallPath);
|
||||
else
|
||||
_snwprintf(sParam, c_nTempBufSize, L"%s %s", c_sRemoveParam, g_sUninstallPath);
|
||||
|
||||
// Launch "\Temp\uninstall.exe remove \Program Files\Fennec\"
|
||||
return CreateProcess(sNewName, sParam, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi);
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL ConvertToChar(const WCHAR *wstr, char *str, DWORD bufSize)
|
||||
{
|
||||
return 0 != WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, bufSize, NULL, NULL);
|
||||
}
|
||||
|
||||
BOOL ShutdownFastStartService(const WCHAR *wsInstallPath)
|
||||
{
|
||||
BOOL result = TRUE;
|
||||
|
||||
// Class name: appName + "MessageWindow"
|
||||
WCHAR sClassName[c_nTempBufSize];
|
||||
_snwprintf(sClassName, c_nTempBufSize, L"%s%s", Strings.GetString(StrID_AppShortName), L"MessageWindow");
|
||||
|
||||
HWND handle = ::FindWindowW(sClassName, NULL);
|
||||
if (handle)
|
||||
{
|
||||
char sPath[MAX_PATH];
|
||||
ConvertToChar(wsInstallPath, sPath, MAX_PATH);
|
||||
size_t pathLen = strlen(sPath);
|
||||
if (pathLen > 0 && sPath[pathLen-1] != '\\')
|
||||
{
|
||||
strcat(sPath, "\\");
|
||||
pathLen++;
|
||||
}
|
||||
|
||||
char sCopyData[MAX_PATH * 3];
|
||||
_snprintf(sCopyData, MAX_PATH * 2, "\"%s%S.exe\" -shutdown-faststart", sPath, Strings.GetString(StrID_AppShortName));
|
||||
size_t cmdLineLen = strlen(sCopyData);
|
||||
|
||||
char *sRest = sCopyData + cmdLineLen + 1;
|
||||
strcpy(sRest, sPath);
|
||||
|
||||
COPYDATASTRUCT cds = {
|
||||
1,
|
||||
pathLen + 1 + cmdLineLen,
|
||||
(void*) sCopyData
|
||||
};
|
||||
::SendMessage(handle, WM_COPYDATA, 0, (LPARAM)&cds);
|
||||
|
||||
// Wait until it's shut down or for some timeout
|
||||
for (int i = 0; i < 20 && handle; i++)
|
||||
{
|
||||
Sleep(500);
|
||||
handle = ::FindWindowW(sClassName, NULL);
|
||||
}
|
||||
|
||||
// The window must not exist if the service shut down properly
|
||||
result = (handle == NULL);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Remove the part installed from the CAB
|
||||
BOOL RunSystemUninstall()
|
||||
{
|
||||
WCHAR sXML[c_nTempBufSize];
|
||||
LPWSTR sXMLOut = NULL;
|
||||
|
||||
_snwprintf(sXML, c_nTempBufSize,
|
||||
L"<wap-provisioningdoc>"
|
||||
L" <characteristic type=\"UnInstall\">"
|
||||
L" <characteristic type=\"%s\">"
|
||||
L" <parm name=\"uninstall\" value=\"1\" />"
|
||||
L" </characteristic>"
|
||||
L" </characteristic>"
|
||||
L"</wap-provisioningdoc>",
|
||||
Strings.GetString(StrID_AppLongName));
|
||||
|
||||
HRESULT hr = DMProcessConfigXML(sXML, CFGFLAG_PROCESS, &sXMLOut);
|
||||
delete[] sXMLOut;
|
||||
|
||||
return hr == S_OK;
|
||||
}
|
@ -1,69 +0,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 Fennec Installer for WinCE.
|
||||
*
|
||||
* The Initial Developer of the Original Code is The Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Pakhotin <alexp@mozilla.com> (original author)
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
#include "resdefce.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Dialog
|
||||
|
||||
IDD_MAIN DIALOG 0, 0, 120, 77
|
||||
STYLE DS_CENTER | DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION
|
||||
EXSTYLE 0x80000000L
|
||||
CAPTION "Uninstall"
|
||||
FONT 9, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "",IDC_STATIC_TEXT,6,6,108,24,SS_NOPREFIX
|
||||
LTEXT "Uninstall?",IDC_QUESTION_TEXT,6,32,132,11,SS_NOPREFIX
|
||||
PUSHBUTTON "Uninstall",IDC_BTN_UNINSTALL,15,50,40,20
|
||||
PUSHBUTTON "Cancel",IDCANCEL,65,50,40,20
|
||||
PUSHBUTTON "OK",IDOK,35,50,50,20
|
||||
CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,4,52,110,9
|
||||
END
|
||||
|
||||
HI_RES_AWARE CEUX {1} // turn off the emulation layer
|
||||
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
@ -1,23 +0,0 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by nsUninstaller.rc
|
||||
//
|
||||
#define IDD_MAIN 101
|
||||
#define IDC_STATIC_TITLE 1000
|
||||
#define IDC_STATIC_TEXT 1001
|
||||
#define IDC_QUESTION_TEXT 1002
|
||||
#define IDC_BTN_UNINSTALL 1003
|
||||
#define IDC_PROGRESS 1004
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1005
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
#endif
|
Binary file not shown.
Before Width: | Height: | Size: 7.2 KiB |
@ -94,9 +94,7 @@ const KEY_APPDIR = "XCurProcD";
|
||||
const KEY_GRED = "GreD";
|
||||
|
||||
#ifdef XP_WIN
|
||||
#ifndef WINCE
|
||||
#define USE_UPDROOT
|
||||
#endif
|
||||
#elifdef ANDROID
|
||||
#define USE_UPDROOT
|
||||
#endif
|
||||
@ -214,7 +212,6 @@ XPCOMUtils.defineLazyGetter(this, "gCanApplyUpdates", function aus_gCanApplyUpda
|
||||
updateTestFile.create(NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||
updateTestFile.remove(false);
|
||||
#ifdef XP_WIN
|
||||
#ifndef WINCE
|
||||
var sysInfo = Cc["@mozilla.org/system-info;1"].
|
||||
getService(Ci.nsIPropertyBag2);
|
||||
|
||||
@ -285,7 +282,6 @@ XPCOMUtils.defineLazyGetter(this, "gCanApplyUpdates", function aus_gCanApplyUpda
|
||||
appDirTestFile.create(NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
||||
appDirTestFile.remove(false);
|
||||
}
|
||||
#endif //WINCE
|
||||
#endif //XP_WIN
|
||||
}
|
||||
catch (e) {
|
||||
|
@ -47,9 +47,7 @@ const FILE_UPDATE_STATUS = "update.status";
|
||||
const KEY_APPDIR = "XCurProcD";
|
||||
|
||||
#ifdef XP_WIN
|
||||
#ifndef WINCE
|
||||
#define USE_UPDROOT
|
||||
#endif
|
||||
#elifdef ANDROID
|
||||
#define USE_UPDROOT
|
||||
#endif
|
||||
|
@ -51,12 +51,6 @@ const IS_WIN = true;
|
||||
const IS_WIN = false;
|
||||
#endif
|
||||
|
||||
#ifdef WINCE
|
||||
const IS_WINCE = true;
|
||||
#else
|
||||
const IS_WINCE = false;
|
||||
#endif
|
||||
|
||||
#ifdef XP_OS2
|
||||
const IS_OS2 = true;
|
||||
#else
|
||||
@ -561,7 +555,7 @@ function setupUpdaterTest(aMarFile) {
|
||||
writeFile(testFile, aTestFile.originalContents);
|
||||
}
|
||||
|
||||
// Skip these tests on Windows (includes WinCE) and OS/2 since their
|
||||
// Skip these tests on Windows and OS/2 since their
|
||||
// implementaions of chmod doesn't really set permissions.
|
||||
if (!IS_WIN && !IS_OS2 && aTestFile.originalPerms) {
|
||||
testFile.permissions = aTestFile.originalPerms;
|
||||
@ -661,10 +655,6 @@ function cleanupUpdaterTest() {
|
||||
* update log after a successful update.
|
||||
*/
|
||||
function checkUpdateLogContents(aCompareLogFile) {
|
||||
// Skip this test on Windows CE since it doesn't use relative paths.
|
||||
if (IS_WINCE)
|
||||
return;
|
||||
|
||||
let updateLog = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX, true);
|
||||
updateLog.append(FILE_UPDATE_LOG);
|
||||
// Skip the first two lines since they contain absolute paths.
|
||||
@ -678,7 +668,6 @@ function checkUpdateLogContents(aCompareLogFile) {
|
||||
// determistic so the results matching the following need to be ignored.
|
||||
updateLogContents = updateLogContents.replace(/.* a\/b\/7\/7text.*\n/g, "");
|
||||
|
||||
|
||||
let compareLog = do_get_file(aCompareLogFile);
|
||||
let compareLogContents = readFileBytes(compareLog);
|
||||
|
||||
@ -704,7 +693,7 @@ function checkFilesAfterUpdateSuccess() {
|
||||
if (aTestFile.compareFile || aTestFile.compareContents) {
|
||||
do_check_true(testFile.exists());
|
||||
|
||||
// Skip these tests on Windows (includes WinCE) and OS/2 since their
|
||||
// Skip these tests on Windows and OS/2 since their
|
||||
// implementaions of chmod doesn't really set permissions.
|
||||
if (!IS_WIN && !IS_OS2 && aTestFile.comparePerms) {
|
||||
// Check if the permssions as set in the complete mar file are correct.
|
||||
@ -788,7 +777,7 @@ function checkFilesAfterUpdateFailure() {
|
||||
if (aTestFile.compareFile || aTestFile.compareContents) {
|
||||
do_check_true(testFile.exists());
|
||||
|
||||
// Skip these tests on Windows (includes WinCE) and OS/2 since their
|
||||
// Skip these tests on Windows and OS/2 since their
|
||||
// implementaions of chmod doesn't really set permissions.
|
||||
if (!IS_WIN && !IS_OS2 && aTestFile.comparePerms) {
|
||||
// Check the original permssions are retained on the file.
|
||||
|
@ -192,7 +192,7 @@ ADDITIONAL_TEST_DIRS = [
|
||||
}];
|
||||
|
||||
function run_test() {
|
||||
if (!IS_WIN || IS_WINCE) {
|
||||
if (!IS_WIN) {
|
||||
logTestInfo("this test is only applicable to Windows... returning early");
|
||||
return;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ ADDITIONAL_TEST_DIRS = [
|
||||
}];
|
||||
|
||||
function run_test() {
|
||||
if (!IS_WIN || IS_WINCE) {
|
||||
if (!IS_WIN) {
|
||||
logTestInfo("this test is only applicable to Windows... returning early");
|
||||
return;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ ADDITIONAL_TEST_DIRS = [
|
||||
}];
|
||||
|
||||
function run_test() {
|
||||
if (!IS_WIN || IS_WINCE) {
|
||||
if (!IS_WIN) {
|
||||
logTestInfo("this test is only applicable to Windows... returning early");
|
||||
return;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ ADDITIONAL_TEST_DIRS = [
|
||||
}];
|
||||
|
||||
function run_test() {
|
||||
if (!IS_WIN || IS_WINCE) {
|
||||
if (!IS_WIN) {
|
||||
logTestInfo("this test is only applicable to Windows... returning early");
|
||||
return;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ ADDITIONAL_TEST_DIRS = [
|
||||
}];
|
||||
|
||||
function run_test() {
|
||||
if (!IS_WIN || IS_WINCE) {
|
||||
if (!IS_WIN) {
|
||||
logTestInfo("this test is only applicable to Windows... returning early");
|
||||
return;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ ADDITIONAL_TEST_DIRS = [
|
||||
}];
|
||||
|
||||
function run_test() {
|
||||
if (!IS_WIN || IS_WINCE) {
|
||||
if (!IS_WIN) {
|
||||
logTestInfo("this test is only applicable to Windows... returning early");
|
||||
return;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ ADDITIONAL_TEST_DIRS = [
|
||||
}];
|
||||
|
||||
function run_test() {
|
||||
if (!IS_WIN || IS_WINCE) {
|
||||
if (!IS_WIN) {
|
||||
logTestInfo("this test is only applicable to Windows... returning early");
|
||||
return;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ ADDITIONAL_TEST_DIRS = [
|
||||
}];
|
||||
|
||||
function run_test() {
|
||||
if (!IS_WIN || IS_WINCE) {
|
||||
if (!IS_WIN) {
|
||||
logTestInfo("this test is only applicable to Windows... returning early");
|
||||
return;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ ADDITIONAL_TEST_DIRS = [
|
||||
}];
|
||||
|
||||
function run_test() {
|
||||
if (!IS_WIN || IS_WINCE) {
|
||||
if (!IS_WIN) {
|
||||
logTestInfo("this test is only applicable to Windows... returning early");
|
||||
return;
|
||||
}
|
||||
|
@ -112,11 +112,6 @@ function run_test() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (IS_WINCE) {
|
||||
logTestInfo("this test is not applicable to Windows CE... returning early");
|
||||
return;
|
||||
}
|
||||
|
||||
do_test_pending();
|
||||
do_register_cleanup(end_test);
|
||||
|
||||
|
@ -47,10 +47,8 @@
|
||||
toolbox {
|
||||
-moz-appearance: toolbox;
|
||||
background-color: -moz-Dialog;
|
||||
%ifndef WINCE
|
||||
border-top: 2px solid;
|
||||
-moz-border-top-colors: ThreeDShadow ThreeDHighlight;
|
||||
%endif
|
||||
}
|
||||
|
||||
/* ::::: toolbar & menubar ::::: */
|
||||
|
@ -58,11 +58,8 @@ ifndef MOZ_NATIVE_ZLIB
|
||||
tier_platform_dirs += modules/zlib
|
||||
endif
|
||||
|
||||
ifndef WINCE
|
||||
tier_platform_dirs += modules/libreg
|
||||
endif
|
||||
|
||||
tier_platform_dirs += \
|
||||
modules/libreg \
|
||||
modules/libpref \
|
||||
intl \
|
||||
netwerk \
|
||||
@ -95,10 +92,6 @@ endif
|
||||
|
||||
tier_platform_dirs += gfx/qcms
|
||||
|
||||
ifeq ($(OS_ARCH),WINCE)
|
||||
tier_platform_dirs += modules/lib7z
|
||||
endif
|
||||
|
||||
#
|
||||
# "gecko" - core components
|
||||
#
|
||||
|
@ -53,7 +53,7 @@ XPIDLSRCS = \
|
||||
nsINativeAppSupport.idl \
|
||||
$(NULL)
|
||||
|
||||
ifneq (,$(filter WINCE WINNT,$(OS_ARCH)))
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
XPIDLSRCS += nsIWinAppHelper.idl
|
||||
endif
|
||||
|
||||
@ -71,12 +71,8 @@ CPPSRCS += EventTracer.cpp
|
||||
endif
|
||||
|
||||
ifdef MOZ_SPLASHSCREEN
|
||||
ifeq ($(OS_ARCH),WINCE)
|
||||
CPPSRCS += nsSplashScreenWin.cpp
|
||||
else
|
||||
CPPSRCS += nsSplashScreenDummy.cpp
|
||||
endif
|
||||
endif
|
||||
|
||||
DEFINES += -DIMPL_XREAPI -DMOZ_APP_NAME='"$(MOZ_APP_NAME)"'
|
||||
|
||||
|
@ -166,10 +166,8 @@ using mozilla::dom::ContentParent;
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
#ifndef WINCE
|
||||
#include <process.h>
|
||||
#include <shlobj.h>
|
||||
#endif
|
||||
#include "nsThreadUtils.h"
|
||||
#endif
|
||||
|
||||
@ -219,33 +217,6 @@ using mozilla::dom::ContentParent;
|
||||
#include "AndroidBridge.h"
|
||||
#endif
|
||||
|
||||
#ifdef WINCE
|
||||
class WindowsMutex {
|
||||
public:
|
||||
WindowsMutex(const wchar_t *name) {
|
||||
mHandle = CreateMutexW(0, FALSE, name);
|
||||
}
|
||||
|
||||
~WindowsMutex() {
|
||||
Unlock();
|
||||
CloseHandle(mHandle);
|
||||
}
|
||||
|
||||
PRBool Lock(DWORD timeout = INFINITE) {
|
||||
DWORD state = WaitForSingleObject(mHandle, timeout);
|
||||
return state == WAIT_OBJECT_0;
|
||||
}
|
||||
|
||||
void Unlock() {
|
||||
if (mHandle)
|
||||
ReleaseMutex(mHandle);
|
||||
}
|
||||
|
||||
protected:
|
||||
HANDLE mHandle;
|
||||
};
|
||||
#endif
|
||||
|
||||
extern PRUint32 gRestartMode;
|
||||
extern void InstallSignalHandlers(const char *ProgramName);
|
||||
#include "nsX11ErrorHandler.h"
|
||||
@ -846,10 +817,6 @@ typedef enum
|
||||
NS_IMETHODIMP
|
||||
nsXULAppInfo::GetUserCanElevate(PRBool *aUserCanElevate)
|
||||
{
|
||||
#ifdef WINCE
|
||||
*aUserCanElevate = PR_FALSE;
|
||||
return NS_OK;
|
||||
#else
|
||||
HANDLE hToken;
|
||||
|
||||
VISTA_TOKEN_ELEVATION_TYPE elevationType;
|
||||
@ -877,7 +844,6 @@ nsXULAppInfo::GetUserCanElevate(PRBool *aUserCanElevate)
|
||||
CloseHandle(hToken);
|
||||
|
||||
return NS_OK;
|
||||
#endif // WINCE
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2891,55 +2857,11 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
isNoSplash |= (PR_GetEnv("NO_SPLASH") != 0);
|
||||
PRBool isNoRemote = (CheckArg("no-remote", PR_FALSE, NULL, PR_FALSE) == ARG_FOUND);
|
||||
|
||||
#ifdef WINCE
|
||||
// synchronize startup; if it looks like we're going to have to
|
||||
// wait, then open up a splash screen
|
||||
WindowsMutex winStartupMutex(L"FirefoxStartupMutex");
|
||||
|
||||
// try to lock the mutex, but only wait 100ms to do so
|
||||
PRBool needsMutexLock = ! winStartupMutex.Lock(100);
|
||||
|
||||
// If we failed to lock the mutex quickly, then we'll want
|
||||
// a splash screen for sure.
|
||||
//
|
||||
// If we did manage to lock it, then we'll only want one
|
||||
// a splash screen if there is no existing message window;
|
||||
// that is, if we are the first instance of the app.
|
||||
if (!needsMutexLock && !isNoRemote) {
|
||||
// check to see if there's a remote firefox up
|
||||
static PRUnichar classNameBuffer[128];
|
||||
_snwprintf(classNameBuffer, sizeof(classNameBuffer) / sizeof(PRUnichar),
|
||||
L"%S%s",
|
||||
gAppData->name, L"MessageWindow");
|
||||
HANDLE h = FindWindowW(classNameBuffer, 0);
|
||||
if (h) {
|
||||
// Someone else has the window, and we were able to grab the mutex,
|
||||
// meaning the other instance ahs presumably already finished starting
|
||||
// up by now. So no need for a splash screen.
|
||||
wantsSplash = PR_FALSE;
|
||||
CloseHandle(h);
|
||||
} else {
|
||||
// We couldn't find another window, and we were able to lock the mutex;
|
||||
// we're likely the first instance starting up, so make sure a splash
|
||||
// screen gets thrown up.
|
||||
wantsSplash = PR_TRUE;
|
||||
}
|
||||
}
|
||||
#endif //WINCE
|
||||
|
||||
if (wantsSplash && !isNoSplash)
|
||||
splashScreen = nsSplashScreen::GetOrCreate();
|
||||
|
||||
if (splashScreen)
|
||||
splashScreen->Open();
|
||||
|
||||
#ifdef WINCE
|
||||
// Now that the splash screen is open, wait indefinitely
|
||||
// for the startup mutex on this thread if we need to.
|
||||
if (needsMutexLock)
|
||||
winStartupMutex.Lock();
|
||||
#endif //WINCE
|
||||
|
||||
#endif //MOZ_SPLASHSCREEN
|
||||
|
||||
|
||||
@ -3406,11 +3328,6 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
rv = dirProvider.SetProfile(profD, profLD);
|
||||
NS_ENSURE_SUCCESS(rv, 1);
|
||||
|
||||
#if defined(WINCE) && defined(MOZ_SPLASHSCREEN)
|
||||
// give up the mutex, let other app startups happen
|
||||
winStartupMutex.Unlock();
|
||||
#endif
|
||||
|
||||
//////////////////////// NOW WE HAVE A PROFILE ////////////////////////
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
@ -3947,7 +3864,7 @@ SetupErrorHandling(const char* progname)
|
||||
_SetProcessDEPPolicy(PROCESS_DEP_ENABLE);
|
||||
#endif
|
||||
|
||||
#if defined (XP_WIN32) && !defined (WINCE)
|
||||
#ifdef XP_WIN32
|
||||
// Suppress the "DLL Foo could not be found" dialog, such that if dependent
|
||||
// libraries (such as GDI+) are not preset, we gracefully fail to load those
|
||||
// XPCOM components, instead of being ungraceful.
|
||||
@ -3968,10 +3885,8 @@ SetupErrorHandling(const char* progname)
|
||||
InstallSignalHandlers(progname);
|
||||
#endif
|
||||
|
||||
#ifndef WINCE
|
||||
// Unbuffer stdout, needed for tinderbox tests.
|
||||
setbuf(stdout, 0);
|
||||
#endif
|
||||
|
||||
#if defined(FREEBSD)
|
||||
// Disable all SIGFPE's on FreeBSD, as it has non-IEEE-conformant fp
|
||||
|
@ -76,9 +76,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
#ifndef WINCE
|
||||
#include <ddeml.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
@ -107,12 +105,10 @@ activateWindow( nsIDOMWindowInternal *win ) {
|
||||
// Try to get native window handle.
|
||||
HWND hwnd = hwndForDOMWindow( win );
|
||||
if ( hwnd ) {
|
||||
#ifndef WINCE // Can't iconify windows on windows ce
|
||||
// Restore the window if it is minimized.
|
||||
if ( ::IsIconic( hwnd ) ) {
|
||||
::ShowWindow( hwnd, SW_RESTORE );
|
||||
}
|
||||
#endif
|
||||
// Use the OS call, if possible.
|
||||
::SetForegroundWindow( hwnd );
|
||||
} else {
|
||||
@ -313,10 +309,8 @@ public:
|
||||
NS_IMETHOD Stop( PRBool *aResult );
|
||||
NS_IMETHOD Quit();
|
||||
NS_IMETHOD Enable();
|
||||
#ifndef WINCE
|
||||
// The "old" Start method (renamed).
|
||||
NS_IMETHOD StartDDE();
|
||||
#endif
|
||||
// Utility function to handle a Win32-specific command line
|
||||
// option: "-console", which dynamically creates a Windows
|
||||
// console.
|
||||
@ -324,7 +318,6 @@ public:
|
||||
|
||||
private:
|
||||
static void HandleCommandLine(const char* aCmdLineString, nsIFile* aWorkingDir, PRUint32 aState);
|
||||
#ifndef WINCE
|
||||
static HDDEDATA CALLBACK HandleDDENotification( UINT uType,
|
||||
UINT uFmt,
|
||||
HCONV hconv,
|
||||
@ -339,7 +332,6 @@ private:
|
||||
static HDDEDATA CreateDDEData( LPBYTE value, DWORD len );
|
||||
static PRBool InitTopicStrings();
|
||||
static int FindTopic( HSZ topic );
|
||||
#endif
|
||||
static void ActivateLastWindow();
|
||||
static nsresult OpenWindow( const char *urlstr, const char *args );
|
||||
static nsresult OpenBrowserWindow();
|
||||
@ -358,9 +350,7 @@ private:
|
||||
// Note: Insert new values above this line!!!!!
|
||||
topicCount // Count of the number of real topics
|
||||
};
|
||||
#ifndef WINCE
|
||||
static HSZ mApplication, mTopics[ topicCount ];
|
||||
#endif
|
||||
static DWORD mInstance;
|
||||
static PRBool mCanHandleRequests;
|
||||
static PRUnichar mMutexName[];
|
||||
@ -382,7 +372,6 @@ nsNativeAppSupportWin::CheckConsole() {
|
||||
strcmp( "/console", gArgv[i] ) == 0 ) {
|
||||
// Users wants to make sure we have a console.
|
||||
// Try to allocate one.
|
||||
#ifndef WINCE
|
||||
BOOL rc = ::AllocConsole();
|
||||
if ( rc ) {
|
||||
// Console allocated. Fix it up so that output works in
|
||||
@ -429,7 +418,6 @@ nsNativeAppSupportWin::CheckConsole() {
|
||||
// Failed. Probably because there already is one.
|
||||
// There's little we can do, in any case.
|
||||
}
|
||||
#endif
|
||||
// Remove the console argument from the command line.
|
||||
do {
|
||||
gArgv[i] = gArgv[i + 1];
|
||||
@ -481,10 +469,8 @@ const char * const topicNames[] = { "WWW_OpenURL",
|
||||
|
||||
// Static member definitions.
|
||||
int nsNativeAppSupportWin::mConversations = 0;
|
||||
#ifndef WINCE
|
||||
HSZ nsNativeAppSupportWin::mApplication = 0;
|
||||
HSZ nsNativeAppSupportWin::mTopics[nsNativeAppSupportWin::topicCount] = { 0 };
|
||||
#endif
|
||||
DWORD nsNativeAppSupportWin::mInstance = 0;
|
||||
PRBool nsNativeAppSupportWin::mCanHandleRequests = PR_FALSE;
|
||||
|
||||
@ -579,14 +565,7 @@ struct MessageWindow {
|
||||
_wgetcwd(cwd, MAX_PATH);
|
||||
|
||||
// Construct a narrow UTF8 buffer <commandline>\0<workingdir>\0
|
||||
#ifdef WINCE
|
||||
// For WinCE, we're stuck with providing our own argv[0] for the remote
|
||||
// command-line.
|
||||
NS_ConvertUTF16toUTF8 utf8buffer(L"dummy ");
|
||||
AppendUTF16toUTF8(cmd, utf8buffer);
|
||||
#else
|
||||
NS_ConvertUTF16toUTF8 utf8buffer(cmd);
|
||||
#endif
|
||||
utf8buffer.Append('\0');
|
||||
AppendUTF16toUTF8(cwd, utf8buffer);
|
||||
utf8buffer.Append('\0');
|
||||
@ -600,13 +579,7 @@ struct MessageWindow {
|
||||
};
|
||||
// Bring the already running Mozilla process to the foreground.
|
||||
// nsWindow will restore the window (if minimized) and raise it.
|
||||
#ifdef WINCE
|
||||
// for activating the existing window on wince we need "| 0x01"
|
||||
// see http://msdn.microsoft.com/en-us/library/ms940024.aspx for details
|
||||
::SetForegroundWindow( (HWND)(((ULONG) mHandle) | 0x01) );
|
||||
#else
|
||||
::SetForegroundWindow( mHandle );
|
||||
#endif
|
||||
::SendMessage( mHandle, WM_COPYDATA, 0, (LPARAM)&cds );
|
||||
return NS_OK;
|
||||
}
|
||||
@ -702,10 +675,8 @@ nsNativeAppSupportWin::Start( PRBool *aResult ) {
|
||||
// We will be server.
|
||||
rv = msgWindow.Create();
|
||||
if ( NS_SUCCEEDED( rv ) ) {
|
||||
#ifndef WINCE
|
||||
// Start up DDE server.
|
||||
this->StartDDE();
|
||||
#endif
|
||||
// Tell caller to spin message loop.
|
||||
*aResult = PR_TRUE;
|
||||
}
|
||||
@ -715,7 +686,7 @@ nsNativeAppSupportWin::Start( PRBool *aResult ) {
|
||||
|
||||
return rv;
|
||||
}
|
||||
#ifndef WINCE
|
||||
|
||||
PRBool
|
||||
nsNativeAppSupportWin::InitTopicStrings() {
|
||||
for ( int i = 0; i < topicCount; i++ ) {
|
||||
@ -771,7 +742,7 @@ nsNativeAppSupportWin::StartDDE() {
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif /* WINCE */
|
||||
|
||||
// If no DDE conversations are pending, terminate DDE.
|
||||
NS_IMETHODIMP
|
||||
nsNativeAppSupportWin::Stop( PRBool *aResult ) {
|
||||
@ -833,7 +804,6 @@ nsNativeAppSupportWin::Quit() {
|
||||
|
||||
if ( mInstance ) {
|
||||
// Unregister application name.
|
||||
#ifndef WINCE
|
||||
DdeNameService( mInstance, mApplication, 0, DNS_UNREGISTER );
|
||||
// Clean up strings.
|
||||
if ( mApplication ) {
|
||||
@ -847,7 +817,6 @@ nsNativeAppSupportWin::Quit() {
|
||||
}
|
||||
}
|
||||
DdeUninitialize( mInstance );
|
||||
#endif
|
||||
mInstance = 0;
|
||||
#if MOZ_DEBUG_DDE
|
||||
printf( "DDE server stopped\n" );
|
||||
@ -913,7 +882,7 @@ static nsCString hszValue( DWORD instance, HSZ hsz ) {
|
||||
result += "]";
|
||||
return result;
|
||||
}
|
||||
#elif !defined(WINCE)
|
||||
#else
|
||||
// These are purely a safety measure to avoid the infamous "won't
|
||||
// build non-debug" type Tinderbox flames.
|
||||
static nsCString uTypeDesc( UINT ) {
|
||||
@ -944,7 +913,6 @@ static void escapeQuotes( nsAString &aString ) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef WINCE
|
||||
HDDEDATA CALLBACK
|
||||
nsNativeAppSupportWin::HandleDDENotification( UINT uType, // transaction type
|
||||
UINT uFmt, // clipboard data format
|
||||
@ -1195,7 +1163,7 @@ nsNativeAppSupportWin::HandleDDENotification( UINT uType, // transaction t
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
#endif /* WINCE */
|
||||
|
||||
// Utility function to advance to end of quoted string.
|
||||
// p+offset must point to the comma preceding the arg on entry.
|
||||
// On return, p+result points to the closing '"' (or end of the string
|
||||
@ -1217,7 +1185,6 @@ static PRInt32 advanceToEndOfQuotedArg( const WCHAR *p, PRInt32 offset, PRInt32
|
||||
return offset;
|
||||
}
|
||||
|
||||
#ifndef WINCE
|
||||
void nsNativeAppSupportWin::ParseDDEArg( const WCHAR* args, int index, nsString& aString) {
|
||||
if ( args ) {
|
||||
nsDependentString temp(args);
|
||||
@ -1286,7 +1253,6 @@ HDDEDATA nsNativeAppSupportWin::CreateDDEData( LPBYTE value, DWORD len ) {
|
||||
0 );
|
||||
return result;
|
||||
}
|
||||
#endif /* WINCE */
|
||||
|
||||
void nsNativeAppSupportWin::ActivateLastWindow() {
|
||||
nsCOMPtr<nsIDOMWindowInternal> navWin;
|
||||
|
@ -1,317 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** 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 code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* mozilla.org
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Vladimir Vukicevic <vladimir@pobox.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 ***** */
|
||||
|
||||
#include "nsSplashScreen.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
static ATOM gSplashScreenClass = 0;
|
||||
|
||||
class nsSplashScreenWin;
|
||||
|
||||
static nsSplashScreenWin *gSplashScreen = NULL;
|
||||
|
||||
class nsSplashScreenWin :
|
||||
public nsSplashScreen
|
||||
{
|
||||
public:
|
||||
nsSplashScreenWin();
|
||||
|
||||
virtual void Open();
|
||||
virtual void Close();
|
||||
virtual void Update(PRInt32 progress);
|
||||
|
||||
protected:
|
||||
HWND mDialog;
|
||||
HBITMAP mSplashBitmap, mOldBitmap;
|
||||
HDC mSplashBitmapDC;
|
||||
int mWidth, mHeight;
|
||||
|
||||
static DWORD WINAPI ThreadProc(LPVOID splashScreen);
|
||||
|
||||
static LRESULT CALLBACK DialogProc (HWND hWnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
|
||||
void OnPaint(HDC dc, const PAINTSTRUCT *ps);
|
||||
|
||||
PRInt32 mProgress;
|
||||
};
|
||||
|
||||
nsSplashScreen *
|
||||
nsSplashScreen::GetOrCreate()
|
||||
{
|
||||
if (!gSplashScreen)
|
||||
gSplashScreen = new nsSplashScreenWin();
|
||||
|
||||
return gSplashScreen;
|
||||
}
|
||||
|
||||
nsSplashScreen *
|
||||
nsSplashScreen::Get()
|
||||
{
|
||||
return gSplashScreen;
|
||||
}
|
||||
|
||||
nsSplashScreenWin::nsSplashScreenWin()
|
||||
: mDialog(NULL), mSplashBitmap(NULL), mOldBitmap(NULL),
|
||||
mSplashBitmapDC(NULL),
|
||||
mWidth(200), mHeight(100),
|
||||
mProgress(-1)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsSplashScreenWin::Open()
|
||||
{
|
||||
if (mIsOpen || mDialog)
|
||||
return;
|
||||
|
||||
mIsOpen = PR_TRUE;
|
||||
|
||||
if (gSplashScreenClass == 0) {
|
||||
WNDCLASS wc;
|
||||
memset(&wc, 0, sizeof(WNDCLASS));
|
||||
|
||||
wc.style = CS_NOCLOSE;
|
||||
wc.lpfnWndProc = (WNDPROC) DialogProc;
|
||||
wc.hInstance = GetModuleHandle(0);
|
||||
wc.hIcon = NULL;
|
||||
wc.hCursor = NULL;
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = TEXT("MozillaSplashScreen");
|
||||
|
||||
gSplashScreenClass = RegisterClass(&wc);
|
||||
}
|
||||
|
||||
if (mSplashBitmap == NULL) {
|
||||
wchar_t path[_MAX_PATH];
|
||||
if (::GetModuleFileNameW(0, path, _MAX_PATH)) {
|
||||
wchar_t *slash = wcsrchr(path, '\\');
|
||||
if (slash != NULL)
|
||||
slash[1] = 0;
|
||||
|
||||
wcscat(path, L"splash.bmp");
|
||||
|
||||
#ifdef WINCE
|
||||
mSplashBitmap = ::SHLoadDIBitmap(path);
|
||||
#else
|
||||
#warning splashscreen needs some code to load bitmaps on non-WinCE
|
||||
mSplashBitmap = nsnull;
|
||||
#endif
|
||||
|
||||
if (mSplashBitmap) {
|
||||
BITMAP bmo;
|
||||
if (GetObject(mSplashBitmap, sizeof(BITMAP), &bmo) > 0) {
|
||||
mWidth = bmo.bmWidth;
|
||||
mHeight = bmo.bmHeight;
|
||||
|
||||
mSplashBitmapDC = CreateCompatibleDC(NULL);
|
||||
mOldBitmap = (HBITMAP) SelectObject(mSplashBitmapDC, mSplashBitmap);
|
||||
} else {
|
||||
DeleteObject(mSplashBitmap);
|
||||
mSplashBitmap = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DWORD threadID = 0;
|
||||
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)ThreadProc, this, 0, &threadID);
|
||||
}
|
||||
|
||||
DWORD WINAPI
|
||||
nsSplashScreenWin::ThreadProc(LPVOID splashScreen)
|
||||
{
|
||||
nsSplashScreenWin *sp = (nsSplashScreenWin*) splashScreen;
|
||||
|
||||
int screenWidth = GetSystemMetrics(SM_CXSCREEN);
|
||||
int screenHeight = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
LONG horizPad = (screenWidth - sp->mWidth) / 2;
|
||||
LONG vertPad = (screenHeight - sp->mHeight) / 2;
|
||||
RECT r = { horizPad,
|
||||
vertPad,
|
||||
horizPad + sp->mWidth,
|
||||
vertPad + sp->mHeight };
|
||||
|
||||
DWORD winStyle = (WS_POPUP | WS_BORDER);
|
||||
DWORD winStyleEx = WS_EX_NOACTIVATE;
|
||||
|
||||
if(!::AdjustWindowRectEx(&r, winStyle, FALSE, winStyleEx))
|
||||
return 0;
|
||||
|
||||
HWND dlg = CreateWindowEx(
|
||||
winStyleEx,
|
||||
TEXT("MozillaSplashScreen"),
|
||||
TEXT("Starting up..."),
|
||||
winStyle,
|
||||
r.left, r.top,
|
||||
(r.right - r.left), (r.bottom - r.top),
|
||||
HWND_DESKTOP,
|
||||
NULL,
|
||||
GetModuleHandle(0),
|
||||
NULL);
|
||||
|
||||
sp->mDialog = dlg;
|
||||
|
||||
ShowWindow(dlg, SW_SHOW);
|
||||
SetForegroundWindow(dlg);
|
||||
|
||||
MSG msg;
|
||||
while (::GetMessage(&msg, NULL, 0, 0)) {
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
// window was destroyed, nothing to do
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
nsSplashScreenWin::Close()
|
||||
{
|
||||
if (mDialog) {
|
||||
ShowWindow(mDialog, SW_HIDE);
|
||||
PostMessage(mDialog, WM_QUIT, 0, 0);
|
||||
mDialog = NULL;
|
||||
}
|
||||
|
||||
if (mSplashBitmap) {
|
||||
SelectObject(mSplashBitmapDC, mOldBitmap);
|
||||
DeleteObject(mSplashBitmapDC);
|
||||
DeleteObject(mSplashBitmap);
|
||||
mOldBitmap = NULL;
|
||||
mSplashBitmapDC = NULL;
|
||||
mSplashBitmap = NULL;
|
||||
}
|
||||
|
||||
mIsOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsSplashScreenWin::Update(PRInt32 progress)
|
||||
{
|
||||
if (progress >= 0)
|
||||
mProgress = progress > 100 ? 100 : progress;
|
||||
|
||||
InvalidateRect(mDialog, NULL, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
nsSplashScreenWin::OnPaint(HDC dc, const PAINTSTRUCT *ps)
|
||||
{
|
||||
RECT progressBar;
|
||||
|
||||
// Paint the splash screen
|
||||
if (mSplashBitmapDC) {
|
||||
BitBlt(dc,
|
||||
0, 0, gSplashScreen->mWidth, gSplashScreen->mHeight,
|
||||
gSplashScreen->mSplashBitmapDC,
|
||||
0, 0,
|
||||
SRCCOPY);
|
||||
} else {
|
||||
HBRUSH bkgr = CreateSolidBrush(RGB(200,200,200));
|
||||
RECT r = { 0, 0, mWidth, mHeight };
|
||||
FillRect(dc, &r, bkgr);
|
||||
DeleteObject(bkgr);
|
||||
}
|
||||
|
||||
// Size of progress bar area
|
||||
if (mSplashBitmapDC &&
|
||||
gSplashScreen->mWidth == 440 &&
|
||||
gSplashScreen->mHeight == 180) {
|
||||
// For now we're tightly tied to a specific splash.bmp design,
|
||||
// ideally we would determine the region automagically.
|
||||
progressBar.left = 183;
|
||||
progressBar.right = 410;
|
||||
progressBar.top = 148;
|
||||
progressBar.bottom = 153;
|
||||
} else {
|
||||
// The default progress bar will be 2/3 the width of the splash box,
|
||||
// 9 pixels tall, 10 pixels from the bottom.
|
||||
progressBar.left = (mWidth / 6);
|
||||
progressBar.right = mWidth - (mWidth / 6);
|
||||
progressBar.top = mHeight - 19;
|
||||
progressBar.bottom = mHeight - 10;
|
||||
}
|
||||
|
||||
if (mProgress != -1) {
|
||||
HBRUSH fill = CreateSolidBrush(RGB(0x77,0xC7,0x1C));
|
||||
|
||||
int maxWidth = progressBar.right - progressBar.left;
|
||||
progressBar.right = progressBar.left + maxWidth * mProgress / 100;
|
||||
FillRect(dc, &progressBar, fill);
|
||||
|
||||
DeleteObject(fill);
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK
|
||||
nsSplashScreenWin::DialogProc (HWND hWnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
switch (uMsg) {
|
||||
case WM_PAINT: {
|
||||
PAINTSTRUCT ps;
|
||||
HDC dc = BeginPaint(hWnd, &ps);
|
||||
|
||||
if (gSplashScreen)
|
||||
gSplashScreen->OnPaint(dc, &ps);
|
||||
|
||||
EndPaint(hWnd, &ps);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
return TRUE;
|
||||
|
||||
case WM_QUIT:
|
||||
DestroyWindow(hWnd);
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
@ -172,20 +172,6 @@ MakeCommandLine(int argc, PRUnichar **argv)
|
||||
for (i = 0; i < argc; ++i)
|
||||
len += ArgStrLen(argv[i]) + 1;
|
||||
|
||||
#ifdef WINCE
|
||||
wchar_t *env = mozce_GetEnvironmentCL();
|
||||
// XXX There's a buffer overrun here somewhere that causes a heap
|
||||
// check to fail in the final free of the results of this function
|
||||
// in WinLaunchChild. I can't honestly figure out where it is,
|
||||
// because I'm pretty sure with the + 1 above and the wcslen here,
|
||||
// we have enough room for a trailing NULL. But, adding a little
|
||||
// bit more slop (the +10) seems to fix the problem.
|
||||
//
|
||||
// Supposedly CreateProcessW can modify its arguments, so maybe it's
|
||||
// doing some scribbling?
|
||||
len += (wcslen(env)) + 10;
|
||||
#endif
|
||||
|
||||
// Protect against callers that pass 0 arguments
|
||||
if (len == 0)
|
||||
len = 1;
|
||||
@ -205,11 +191,6 @@ MakeCommandLine(int argc, PRUnichar **argv)
|
||||
|
||||
*c = '\0';
|
||||
|
||||
#ifdef WINCE
|
||||
wcscat(s, env);
|
||||
if (env)
|
||||
free(env);
|
||||
#endif
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -277,18 +258,6 @@ WinLaunchChild(const PRUnichar *exePath, int argc, PRUnichar **argv)
|
||||
PRUnichar *cl;
|
||||
BOOL ok;
|
||||
|
||||
#ifdef WINCE
|
||||
// Windows Mobile Issue:
|
||||
// When passing both an image name and a command line to
|
||||
// CreateProcessW, you need to make sure that the image name
|
||||
// identially matches the first argument of the command line. If
|
||||
// they do not match, Windows Mobile will send two "argv[0]" values.
|
||||
// To avoid this problem, we will strip off the argv here, and
|
||||
// depend only on the exePath.
|
||||
argv = argv + 1;
|
||||
argc--;
|
||||
#endif
|
||||
|
||||
cl = MakeCommandLine(argc, argv);
|
||||
if (!cl)
|
||||
return FALSE;
|
||||
|
@ -73,25 +73,6 @@ FreeAllocStrings(int argc, char **argv)
|
||||
delete [] argv;
|
||||
}
|
||||
|
||||
#ifdef WINCE
|
||||
/** argc/argv are in/out parameters */
|
||||
void ExtractEnvironmentFromCL(int &argc, char **&argv)
|
||||
{
|
||||
for (int x = argc - 1; x >= 0; x--) {
|
||||
if (!strncmp(argv[x], "--environ:", 10)) {
|
||||
char* key_val = strdup(argv[x]+10);
|
||||
putenv(key_val);
|
||||
free(key_val);
|
||||
argc -= 1;
|
||||
char *delete_argv = argv[x];
|
||||
if (x < argc) /* if the current argument is not at the tail, shift following arguments. */
|
||||
memcpy(&argv[x], &argv[x+1], (argc - x) * sizeof(char*));
|
||||
delete [] delete_argv;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int wmain(int argc, WCHAR **argv)
|
||||
{
|
||||
#ifndef XRE_DONT_PROTECT_DLL_LOAD
|
||||
@ -112,9 +93,6 @@ int wmain(int argc, WCHAR **argv)
|
||||
return 127;
|
||||
}
|
||||
}
|
||||
#ifdef WINCE
|
||||
ExtractEnvironmentFromCL(argc, argvConverted);
|
||||
#endif
|
||||
argvConverted[argc] = NULL;
|
||||
|
||||
// need to save argvConverted copy for later deletion.
|
||||
|
@ -259,10 +259,10 @@ nsXREDirProvider::GetFile(const char* aProperty, PRBool* aPersistent,
|
||||
rv = GetUserAppDataDirectory((nsILocalFile**)(nsIFile**) getter_AddRefs(file));
|
||||
}
|
||||
else if (!strcmp(aProperty, XRE_UPDATE_ROOT_DIR)) {
|
||||
#if defined(XP_WIN) && !defined(WINCE)
|
||||
#if defined(XP_WIN)
|
||||
rv = GetUpdateRootDir(getter_AddRefs(file));
|
||||
#else
|
||||
// Only supported on Windows other than WINCE, so just immediately fail.
|
||||
// Only supported on Windows, so just immediately fail.
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
@ -824,24 +824,6 @@ GetShellFolderPath(int folder, nsAString& _retval)
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
#if defined(WINCE) && !defined(WINCE_WINDOWS_MOBILE)
|
||||
if (folder == CSIDL_APPDATA || folder == CSIDL_LOCAL_APPDATA)
|
||||
folder = CSIDL_PROFILE;
|
||||
|
||||
BOOL ok = SHGetSpecialFolderPath(NULL, buf, folder, true);
|
||||
if (!ok) {
|
||||
_retval.SetLength(0);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
buf[bufLength - 1] = L'\0';
|
||||
_retval.SetLength(wcslen(buf));
|
||||
|
||||
// sometimes CSIDL_PROFILE shows up without a root slash
|
||||
if (folder == CSIDL_PROFILE && buf[0] != '\\') {
|
||||
_retval.Insert('\\', 0);
|
||||
}
|
||||
#else
|
||||
LPITEMIDLIST pItemIDList = NULL;
|
||||
|
||||
if (SUCCEEDED(SHGetSpecialFolderLocation(NULL, folder, &pItemIDList)) &&
|
||||
@ -856,12 +838,10 @@ GetShellFolderPath(int folder, nsAString& _retval)
|
||||
}
|
||||
|
||||
CoTaskMemFree(pItemIDList);
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifndef WINCE
|
||||
/**
|
||||
* Provides a fallback for getting the path to APPDATA or LOCALAPPDATA by
|
||||
* querying the registry when the call to SHGetSpecialFolderLocation or
|
||||
@ -913,7 +893,6 @@ GetRegWindowsAppDataFolder(PRBool aLocal, nsAString& _retval)
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult)
|
||||
@ -932,9 +911,6 @@ nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult)
|
||||
PRUint32 bufLength = longPath.GetMutableData(&buf, MAXPATHLEN);
|
||||
NS_ENSURE_TRUE(bufLength >= MAXPATHLEN, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
#ifdef WINCE
|
||||
longPath.Assign(appPath);
|
||||
#else
|
||||
DWORD len = GetLongPathNameW(appPath.get(), buf, bufLength);
|
||||
|
||||
// Failing GetLongPathName() is not fatal.
|
||||
@ -942,7 +918,7 @@ nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult)
|
||||
longPath.Assign(appPath);
|
||||
else
|
||||
longPath.SetLength(len);
|
||||
#endif
|
||||
|
||||
// Use <UserLocalDataDir>\updates\<relative path to app dir from
|
||||
// Program Files> if app dir is under Program Files to avoid the
|
||||
// folder virtualization mess on Windows Vista
|
||||
@ -1049,20 +1025,15 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsILocalFile** aFile, PRBool aLocal)
|
||||
nsString path;
|
||||
if (aLocal) {
|
||||
rv = GetShellFolderPath(CSIDL_LOCAL_APPDATA, path);
|
||||
#ifndef WINCE
|
||||
if (NS_FAILED(rv))
|
||||
rv = GetRegWindowsAppDataFolder(aLocal, path);
|
||||
#endif
|
||||
}
|
||||
if (!aLocal || NS_FAILED(rv)) {
|
||||
rv = GetShellFolderPath(CSIDL_APPDATA, path);
|
||||
#ifndef WINCE
|
||||
if (NS_FAILED(rv)) {
|
||||
if (!aLocal)
|
||||
rv = GetRegWindowsAppDataFolder(aLocal, path);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user