Bug 510836 - mozce_shunt.dll loaded with updater.exe. r=blassey, r=vlad

This commit is contained in:
Robert Strong 2009-08-20 19:58:47 -07:00
parent 1c7f9aa7cc
commit d17b9ee601
8 changed files with 97 additions and 1 deletions

View File

@ -63,6 +63,7 @@ EXPORTS_mozce_shunt = \
include/fcntl.h \
include/io.h \
include/mbstring.h \
include/environment.h \
include/mozce_shunt.h \
include/process.h \
include/signal.h \

View File

@ -36,7 +36,14 @@
*
* ***** END LICENSE BLOCK ***** */
/* environment.h and environment.cpp are also included by app update */
// WINCE_SKIP_SHUNT_INCLUDE is used by app update to prevent including of
// mozce_shunt.h when it includes environment.cpp
#ifndef WINCE_SKIP_SHUNT_INCLUDE
#include "include/mozce_shunt.h"
#endif
#include "include/environment.h"
#include "time_conversions.h"
#include <stdlib.h>
#include "Windows.h"

View File

@ -0,0 +1,63 @@
/* ***** 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 MOZCE Lib.
*
* The Initial Developer of the Original Code is Doug Turner <dougt@meer.net>.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Robert Strong <robert.bugzilla@gmail.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 ***** */
/* environment.h and environment.cpp are also included by app update */
#ifndef MOZCE_ENVIRONMENT_H
#define MOZCE_ENVIRONMENT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Environment stuff */
char* getenv(const char* inName);
int putenv(const char *a);
char SetEnvironmentVariableW(const unsigned short * name, const unsigned short * value );
char GetEnvironmentVariableW(const unsigned short * lpName, unsigned short* lpBuffer, unsigned long nSize);
unsigned int ExpandEnvironmentStringsW(const unsigned short* lpSrc,
unsigned short* lpDst,
unsigned int nSize);
unsigned short* mozce_GetEnvironmentCL();
#ifdef __cplusplus
};
#endif
#endif //MOZCE_ENVIRONMENT_H

View File

@ -38,6 +38,8 @@
#ifndef MOZCE_SHUNT_H
#define MOZCE_SHUNT_H
#include "environment.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -82,6 +82,7 @@ REQUIRES += string
endif
ifeq ($(OS_ARCH),WINCE)
export NO_SHUNT = 1
USE_STATIC_LIBS = 1
HAVE_PROGRESSUI = 1
CPPSRCS += \
@ -95,9 +96,11 @@ RCINCLUDE = updater_winmo.rc
else
RCINCLUDE = updater_wince.rc
endif
DEFINES += -DUNICODE -D_UNICODE
DEFINES += -DUNICODE -D_UNICODE -DWINCE_SKIP_SHUNT_INCLUDE
RCFLAGS += -I$(srcdir)
REQUIRES += string
LOCAL_INCLUDES += -I$(topsrcdir)/build/wince/shunt/include \
-I$(topsrcdir)/build/wince/shunt
endif
ifneq ($(MOZ_ENABLE_GTK2),)

View File

@ -56,7 +56,9 @@
# define W_OK 02
# define R_OK 04
# define access _access
#ifndef WINCE
# define putenv _putenv
#endif
# define snprintf _snprintf
# define fchmod(a,b)
@ -1244,6 +1246,11 @@ LaunchWinPostProcess(const WCHAR *appExe)
static void
LaunchCallbackApp(const NS_tchar *workingDir, int argc, NS_tchar **argv)
{
// Windows CE uses a mock environment by passing environment variable with
// the command line. It is the responsibility of the application to provide
// the working directory and other environment variables used by the
// application which is then passed back to the application when the updater
// launches it.
putenv(const_cast<char*>("NO_EM_RESTART="));
putenv(const_cast<char*>("MOZ_LAUNCHED_CHILD=1"));
@ -1444,6 +1451,8 @@ int NS_main(int argc, NS_tchar **argv)
gSourcePath = argv[1];
#ifdef WINCE
// This is the working directory to apply the update and is required on WinCE
// since it doesn't have the concept of a working directory.
gDestPath = argv[3];
#endif

View File

@ -37,16 +37,23 @@
#include <windows.h>
#include "updater_wince.h"
#include "environment.cpp"
# define F_OK 00
# define W_OK 02
# define R_OK 04
int errno = 0;
int chmod(const char* path, unsigned int mode)
{
return 0;
}
int _wchdir(const WCHAR* path) {
return SetEnvironmentVariableW(L"CWD", path);
}
int _wchmod(const WCHAR* path, unsigned int mode)
{
return 0;

View File

@ -38,6 +38,8 @@
#ifndef UPDATER_WINCE_H
#define UPDATER_WINCE_H
#include "environment.h"
#define _S_IFDIR 0040000 /* stat, is a directory */
#define _S_IFREG 0100000 /* stat, is a normal file */
#define _S_IREAD 0000400 /* stat, can read */
@ -54,6 +56,7 @@ struct stat {
time_t st_atime;
time_t st_mtime;
};
extern int errno;
int _wchmod(const WCHAR* path, unsigned int mode);
int fstat(FILE* handle, struct stat* buff);
int stat(const char* path, struct stat* buf);
@ -62,5 +65,6 @@ int _wmkdir(const WCHAR* path);
int access(const char* path, int amode);
int _waccess(const WCHAR* path, int amode);
int _wremove(const WCHAR* wpath);
int _wchdir(const unsigned short* path);
#endif