argv[0] needs to be an absolute path

Uwe Bonnes bon at
Sat Jan 4 07:36:54 CST 2003

>>>>> "Dan" == Dan Kegel <dank at> writes:

    Dan> Uwe Bonnes wrote:
    >>>>>>> "Dan" == Dan Kegel <dank at> 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
    Dan> lurking). ..
    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.

    Dan> Not quite sure how to check.  Can you suggest a way?

Run with relay and snoop on builtin and native msvcrt. Eventually instrument
the builtin msvcrt with more debugging output.

    >> Fiddling with CreateProcess needs good throught.

    Dan> I have not as yet fiddled with CreateProcess, only with the code
    Dan> that starts off the initial process when you run Wine, I think.

There has been discussion on that subject before. Did you check that your
problems is unrelated? 
But don't take my arguments to serious;-)

Uwe Bonnes                bon at

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

More information about the wine-devel mailing list