argv[0] needs to be an absolute path

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Thu Jan 2 07:58:54 CST 2003


>>>>> "Dan" == Dan Kegel <dank at kegel.com> writes:

    Dan> The C program main(int argc, char **argv) { puts(argv[0]); }

    Dan> outputs an absolute path on Windows, but sometimes outputs a
    Dan> relative path on Wine.  This causes the commandline $ wine d:setup
    Dan> to fail to find its files properly if it uses the basename of
    Dan> argv[0].  One example of this is msvc4.0 (although it only tries
    Dan> this if an earlier method fails, so there's another bug lurking).

    Dan> I am about to submit a one-line patch to fix this to wine-patches.
    Dan> (If I weren't a wimp, I'd figure out a way to submit a regression
    Dan> test, too, although it'd be a strange one; most of our tests don't
    Dan> need to invoke Wine itself from the Unix commandline!)

    Dan> The same problem exists for programs launched from other wine
    Dan> programs, e.g. from inside wcmd.  That's another code path, and I
    Dan> couldn't find a one-line fix for that one.  - Dan

Did you check that it is CreateProcess that adds the absolute path? I would
guess the MS C Library will do it. Fiddling with CreateProcess needs good
throught.

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------



More information about the wine-devel mailing list