WINE deals incorrectly with process's names. This prevents some
programs from working. I think that the bug is here:
scheduler/process.c:
static void PROCESS_Start( HMODULE main_module, LPSTR filename )
{
if (!filename)
{
/* if no explicit filename, use argv[0] */
if (!(filename = malloc( MAX_PATH ))) ExitProcess(1);
if (!GetLongPathNameA( full_argv0, filename, MAX_PATH ))
^^^^^^^^^^it is just
"/usr/local/bin/wine", why it is here?
lstrcpynA( filename, full_argv0, MAX_PATH );
}
And the function GetModuleFileName16 always returns
"/usr/local/bin/wine" because when WINE creates 16-bit process, it
calls PROCESS_Start like this:
SYSLEVEL_EnterWin16Lock();
PROCESS_Start( main_module, NULL );
^^^^This causes the problem, why not
main_exe_name here?
And when creating 32-bit process, it does
if (main_module) PROCESS_Start( main_module, main_exe_name );
^^^No problems here.
My fix was to replace this NULL with main_exe_name for 16-bit processes
too. It works for me. Can anyone fix it properly or just explain the
situation? Is this replacement correct?