We need to check context before than refer to context -> skip_rest .
But we have just referred to it higher up, and I didn't think it was valid to get into this routine without a context.
Whats the problem you are trying to fix?
Jason
Ann & Jason Edmeades wrote:
We need to check context before than refer to context -> skip_rest .
But we have just referred to it higher up, and I didn't think it was valid to get into this routine without a context.
Whats the problem you are trying to fix?
I run a program which uses a *.bat files via "wine wineconsole --backend=user start program.bat" and this program runs well but after exit it program fails with:
Backtrace: =>1 0x7ed518e5 WCMD_batch+0x105(file=0x346e1c, command=0x16d038, called=0x0, startLabel=0x0, pgmHandle=0xffffffff) [/srv/vostok/Projects/wi 2 0x7ed5e14c WCMD_run_program+0x85c(command=0x16d038, called=0x0) [/srv/vostok/Projects/wine/programs/cmd/wcmdmain.c:1056] in cmd (0x0034 3 0x7ed5e63e WCMD_process_command+0x28e(command=0x167580, cmdList=0x34f5e0) [/srv/vostok/Projects/wine/programs/cmd/wcmdmain.c:813] in cm 4 0x7ed53f26 WCMD_execute+0x1b6(orig_cmd=<register EDI not in topmost frame>, param=0x0, subst=0x0, cmdList=0x34f5e0) [/srv/vostok/Projec 5 0x7ed5bcc0 WCMD_process_commands+0x90(thisCmd=0x167568, oneBracket=0x0, var=<register EDI not in topmost frame>, val=0x0) [/srv/vostok/ 6 0x7ed5d6f3 wmain+0xa83(argc=0x3, argvW=0x110338) [/srv/vostok/Projects/wine/programs/cmd/wcmdmain.c:328] in cmd (0x0034fee8) 7 0x7ed5fd5e __wine_spec_exe_wentry+0x4e(peb=0x7ffdf000) [/srv/vostok/Projects/wine/dlls/winecrt0/exe_wentry.c:36] in cmd (0x0034ff08) 8 0x7ee53e60 start_process+0xc0(arg=0x0) [/srv/vostok/Projects/wine/dlls/kernel32/process.c:834] in kernel32 (0x0034ffe8) 9 0xb7e5a917 wine_switch_to_stack+0x17() in libwine.so.1 (0x00000000) 0x7ed518e5 WCMD_batch+0x105 [/srv/vostok/Projects/wine/programs/cmd/batch.c:108] in cmd: movl 0x34(%eax),%eax Unable to open file '/srv/vostok/Projects/wine/programs/cmd/batch.c' Modules: Module Address Debug info Name (58 modules) ELF 4792e000-4830f000 Deferred libglcore.so.1 ELF 4946e000-4955c000 Deferred libx11.so.6 ELF 4955e000-4956c000 Deferred libxext.so.6 ELF 4956e000-49576000 Deferred libxrender.so.1 ELF 49578000-4957b000 Deferred libxinerama.so.1 ELF 4957d000-49583000 Deferred libxrandr.so.2 ELF 49585000-4958e000 Deferred libxcursor.so.1 ELF 49590000-49595000 Deferred libxfixes.so.3 ELF 4a0fd000-4a102000 Deferred libxxf86vm.so.1 ELF 4a4b1000-4a550000 Deferred libgl.so.1 ELF 4acaa000-4acc3000 Deferred ld-linux.so.2 ELF 4acc5000-4acc7000 Deferred libnvidia-tls.so.1 ELF 4b6ac000-4b7d2000 Deferred libc.so.6 ELF 4b7d4000-4b7d8000 Deferred libdl.so.2 ELF 4b7da000-4b800000 Deferred libm.so.6 ELF 4b802000-4b818000 Deferred libpthread.so.0 ELF 4b81a000-4b82e000 Deferred libz.so.1 ELF 4b830000-4b835000 Deferred libxdmcp.so.6 ELF 4b837000-4b83a000 Deferred libxau.so.6 ELF 4b93c000-4b95c000 Deferred libexpat.so.1 ELF 4e4a4000-4e51e000 Deferred libfreetype.so.6 ELF 4e520000-4e528000 Deferred libsm.so.6 ELF 4e560000-4e590000 Deferred libfontconfig.so.1 ELF 4e592000-4e5a9000 Deferred libice.so.6
In loop
while ( context -> skip_rest == FALSE ) {
CMD_LIST *toExecute = NULL; /* Commands left to be executed */
if (WCMD_ReadAndParseLine(NULL, &toExecute, h) == NULL)
break;
WCMD_process_commands(toExecute, FALSE, NULL, NULL);
WCMD_free_commands(toExecute);
toExecute = NULL;
}
the context may be damaged and I have tried to correct it addition of check.
I run a program which uses a *.bat files via "wine wineconsole --backend=user start program.bat" and this program runs well but after exit it program fails
The context should be valid as it was allocated a few lines higher up. To be fair, there's no checking the LocalAlloc worked, but you would have trapped higher up if it didn't, and from what you say the command worked fine, its on exit its failed.
Given the fact your fix worked, it would appear someone is setting the context to null.
Ah
I see the problem...
Batch pgm a runs (not calls) batch pgm b
When B ends it shouldn't go back to A, but to a's caller. Therefore it frees the parents caller and shifts up the heirachy. I think that is wrong behaviour, and a simpler solution is to set skip_rest in the prev_context, ie change (sorry its not in diff) Line 126 (ish) of batch.c
if ((prev_context != NULL) && (!called)) { prev_context -> skip_rest = TRUE; /* added */ /* remove: CloseHandle (prev_context -> h); context = prev_context -> prev_context; LocalFree ((HANDLE)prev_context);*/ }
I did a simple test here and it works, although I would like to test 2 scnarios:
a calls b which runs c a runs b runs c
Can you let me know if it works for you Jason