Closed Bug 465874 Opened 12 years ago Closed 12 years ago

WinCE Environment Variables Have To Be Passed On Command Line


(Core :: General, defect)

Windows Mobile 6 Professional
Not set





(Reporter: wolfe, Assigned: blassey)



(Keywords: fixed1.9.1, mobile, Whiteboard: [wm-a1-b+])


(1 file, 3 obsolete files)

Attached patch v1.0 patch (obsolete) — Splinter Review
In WinCE, Environment Variables do not work as they do under LINUX or even Windows Desktop versions.

WinCE has no environment variable support at all.

For WinCE, in order to mimic the functionality provided by environment variables, all environment variables need to be passed from parent executable to child executable via the command line.

This patch takes care of passing all environment variables as another argument on the command line.

NOTE: There may be an upper limit to the amount of environment variables which can be passed in this way - perhaps 32k or maybe even as low as 4k.  We may have to do trial-and-error testing to find out how big the environment variable passing could be.

NOTE ALSO: Version 1.0 patch may not apply cleanly to mozilla-central with the WinMobile patch queue.  I am trying to get a clean pull of mozilla-central and the patch queue to test/update this patch.  As soon as I get a clean pull, I will update the attachment to a version 2.0 patch - the only difference being the application of v1.0 patch into the latest code.
Attachment #349107 - Flags: review?(doug.turner)
Adds several special folders into environment variables, using the same environment variable names as the desktop.  Here are the three currently added:

APPDATA = "\Application Data"
ProgramFiles = "\Program Files"
windir = "\Windows"
Attachment #349107 - Attachment is obsolete: true
Attachment #350911 - Flags: review?(blassey)
Attachment #349107 - Flags: review?(doug.turner)
Duplicate of this bug: 462873
Comment on attachment 350911 [details] [diff] [review]
v2.0 patch - adds some special folders to env vars

Oops - backing out the addition of env variable settings of special folders, which really belongs in bug 463326.
Attachment #350911 - Attachment is obsolete: true
Attachment #350911 - Flags: review?(blassey)
Comment on attachment 349107 [details] [diff] [review]
v1.0 patch

Backing out new attachment - which added code to this patch instead of to attachment for bug 463326
Attachment #349107 - Attachment is obsolete: false
Attachment #349107 - Flags: review?(doug.turner)
bsmedberg, can you think of a better way to do this?  Windows mobile doesn't have a command line.
I think the general approach of using the commandline to schlep pseudo-environment data around is a good idea. In fact, it may be a good idea for the toolkit to use this approach (explicitly passing some kinds of state) instead of the environment.

I think that the particular approach here is a bit messy; suggestions:

* pass each environment variable separately as a name/value pair:
** --environ:NAME=VALUE

* Make the API easier to read at the points where argv goes in/out:

For use in nsWindowsWMain.cpp:

/** argc/argv are in/out parameters */
ExtractEnvironmentFromCL(int &argc, WCHAR **&argv);

For use in nsWindowsRestart.cpp:

/** cl is an in/out parameter allocated with malloc */

AddEnvironementToCL(PRUnichar *&cl);
Flags: wanted1.9.1?
Attached file patch v.3 (obsolete) —
allows for the -env flag to be placed anywhere on the command line.
fixes wince bustage when you pass both a image name and a commandline with a image name.
Attachment #349107 - Attachment is obsolete: true
Attachment #349107 - Flags: review?(doug.turner)
Flags: blocking-fennec1.0+
Whiteboard: [wm-a1-b+]
Attached patch patch v.4Splinter Review
Assignee: nobody → bugmail
Attachment #358920 - Attachment is obsolete: true
Attachment #359983 - Flags: review?(benjamin)
Attachment #359983 - Flags: review?(benjamin) → review+
Closed: 12 years ago
Resolution: --- → FIXED
tracking-fennec: --- → ?
Attachment #359983 - Flags: approval1.9.1?
Comment on attachment 359983 [details] [diff] [review]
patch v.4

Attachment #359983 - Flags: approval1.9.1? → approval1.9.1+
Why hasn't this landed on branch yet?
Depends on: 490274
this landed on 1.9.1, clearing wanted1.9.1
Flags: wanted1.9.1?
tracking-fennec: ? → ---
You need to log in before you can comment on or make changes to this bug.