Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#260 closed defect (fixed)

Add global argc and argv pointers

Reported by: dmik Owned by: bird
Priority: highest Milestone:
Component: libc Version: 0.6.4
Severity: blocker Keywords:
Cc:

Description

Since r3645 (AFAIU), spawn() passes some hidden arguments to the started executable if it is a kLIBC-based one. In some cases this makes problems for other applications. One of such examples is Odin-based applications (e.g. OpenJDK). In Odin, KERNEL32.DLL needs to process the command line. Since the DLL can't currently access the main() arguments, it has to access the command line directly using PIB pointers and this makes those hidden arguments (in particular the "kLIBC" signature) visible to the application which it totally does not expect. In particular, java.exe will simply fail with the message like "cannot filnd class kLIBC".

For now I have to add a hack to Odin that cuts out the "kLIBC" signature from the command line. But this hack depends on kLIBC internals and will not work if these internals change.

A proper way will be to provide global argc and argv pointers that will let any DLL access the command line post-processed by kLIBC in a way it needs.

Change History (2)

comment:1 Changed 12 years ago by bird

Resolution: fixed
Status: newclosed
Version: 0.6.4

Global variables has already been done for kLibC 0.7. For kLibC there was already a discussion on the mailing list about this and the workaround is simply to use a different MZ stub. See http://article.gmane.org/gmane.org.netlabs.libc.user/1219 for details.

comment:2 Changed 12 years ago by dmik

Okay. Though for Odin I chose "cut out" way (http://svn.netlabs.org/odin32/changeset/22000) since it's boring to rebuild all Java EXEs and make sure that the right stub is used in the future. I hope you won't change the internal logic in 0.6 (before 0.7 comes out and I change it to using the global argc/argv) so it should be rather safe.

Note: See TracTickets for help on using tickets.