deliver full path by argv[0] and GetCommandLine for win9x
Frank Schruefer
frank.schruefer at t-online.de
Sat Feb 7 13:29:27 CST 2004
Hy,
Was this patch forgotten/rejected?
--
Thanks,
Frank
Frank Schruefer wrote:
> Hy,
>
> There was a discussion about this problem in wine-devel under the topic
> 'Need help debugging ...' (Jan 04) in case somebody is interested.
>
> Changelog:
> Immitate win9x behaviour and set argv[0] to full exe pathname if wine
> behaviour is set to win9x.
> Frank Schruefer (frank.schruefer at man-made.de)
>
>
>
> Index: dlls/kernel/environ.c
> ===================================================================
> RCS file: /home/wine/wine/dlls/kernel/environ.c,v
> retrieving revision 1.1
> diff -u -r1.1 environ.c
> --- dlls/kernel/environ.c 13 Nov 2003 20:58:56 -0000 1.1
> +++ dlls/kernel/environ.c 23 Jan 2004 03:19:44 -0000
> @@ -52,11 +52,9 @@
> /***********************************************************************
> * GetCommandLineA (KERNEL32.@)
> *
> - * WARNING: there's a Windows incompatibility lurking here !
> * Win32s always includes the full path of the program file,
> * whereas Windows NT only returns the full file path plus arguments
> * in case the program has been started with a full path.
> - * Win9x seems to have inherited NT behaviour.
> *
> * Note that both Start Menu Execute and Explorer start programs with
> * fully specified quoted app file paths, which is why probably the
> only case
> Index: dlls/kernel/process.c
> ===================================================================
> RCS file: /home/wine/wine/dlls/kernel/process.c,v
> retrieving revision 1.42
> diff -u -r1.42 process.c
> --- dlls/kernel/process.c 20 Jan 2004 21:51:27 -0000 1.42
> +++ dlls/kernel/process.c 23 Jan 2004 03:19:45 -0000
> @@ -811,6 +811,16 @@
> MODULE_InitLoadPath();
> VERSION_Init( main_exe_name );
>
> + if((GetVersion() & 0x80000000)) {
> + /* Win9x always delivers full path in argv[0] and
> GetCommandLine. At least Dungeon Keeper is relying on this behaviour. */
> + int need, have, done;
> + have = strlen(__wine_main_argv[0]) + 1;
> + need = WideCharToMultiByte(CP_UNIXCP, 0,
> peb->ProcessParameters->ImagePathName.Buffer, -1, NULL, 0, NULL, NULL);
> + if(need > have) __wine_main_argv[0] = malloc(have = (need *
> sizeof(CHAR)));
> + done = WideCharToMultiByte(CP_UNIXCP, 0,
> peb->ProcessParameters->ImagePathName.Buffer, -1, __wine_main_argv[0],
> have, NULL, NULL);
> + if(need != done) { ERR("Miscalculated string size: %i != %i.
> Memory corruption possible!\n", done, need); }
> + TRACE("ensuring argv[0] contains full path on win9x. argv[0] is
> now: %s\n", debugstr_a(__wine_main_argv[0])); }
> +
> if (!main_exe_file) /* no file handle -> Winelib app */
> {
> TRACE( "starting Winelib app %s\n", debugstr_w(main_exe_name) );
>
>
>
More information about the wine-patches
mailing list