cmd:batch: Check for a context is added

Ann & Jason Edmeades us at edmeades.me.uk
Tue Jul 24 17:31:58 CDT 2007


>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






More information about the wine-devel mailing list