problems with exec("rundll32.exe shell32.dll...")

Andrew.Ferguson@arm.com Andrew.Ferguson@arm.com
Tue May 20 16:49:00 GMT 2003


thanks for links Øyvind :)

>http://savannah.gnu.org/cgi-bin/viewcvs/gcc/gcc/libjava/java/lang/natWin32Process.cc?rev=1.1.46.2&only_with_tag=gcc-3_3-branch&content-type=text/vnd.viewcvs-markup


I think this bit of code is the problem (if the last email diagnosis is
correct)

void
java::lang::ConcreteProcess::startProcess (jstringArray progarray,
                                           jstringArray envp,
                                           java::io::File *dir)
{
  ... snip ...

  jstring *elts = elements (progarray);

  ... snip ...

  for (int i = 0; i < progarray->length; ++i)
    {
      if (i > 0)
        *cmdLineCurPos++ = ' ';
      *cmdLineCurPos++ = '\"';  <--------------------------------- this
line
      jsize s = _Jv_GetStringUTFLength (elts[i]);
      _Jv_GetStringUTFRegion (elts[i], 0, s, cmdLineCurPos);
      cmdLineCurPos += s;
      *cmdLineCurPos++ = '\"'; <--------------------------------- this line
    }
...

I think the two marked lines need to be made conditional on elts[i]
containing whitespace? (whitespace in this case is any of \t, \n, \r, \f -
this is taken from the parameterless constructor of StringTokenizer
http://java.sun.com/j2se/1.4.1/docs/api/java/util/StringTokenizer.html )

I'd try to send a fix for this but don't know C++ :(

asjf






More information about the Java mailing list