Gerard Patel wrote:

>      /* Initialize the INSTANCEDATA structure */
>      pinstance = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN(CURRENT_DS, 0);
>      pinstance->stackmin    = OFFSETOF( pTask->teb->cur_stack );
> -    pinstance->stackbottom = pinstance->stackmin; /* yup, that's right. Confused me 
>too. */
> +    pinstance->stackbottom = pinstance->stackmin + 100; /* yup, that's right. 
>Confused me too. */
>      pinstance->stacktop    = ( pinstance->stackmin > BX_reg(context)?
>                                 pinstance->stackmin - BX_reg(context) : 0 ) + 150;   
> 
> 
> Is this a valid fix ?


Ah!  I think I see the problem: the pTask->teb->cur_stack points to the
16-bit stack *after* the complete 16->32 thunking stack frame was pushed.
The stackmin/stackbottom fields, however, are supposed to contain the
stack pointer at the point of *call* to InitTask ...

Could you try with:

  pinstance->stackmin = OFFSETOF(pTask->teb->cur_stack) + sizeof(STACK16FRAME);
  pinstance->stackbottom = pinstance->stackmin;

  (alternatively:  SP_reg(context) + 4, but this should always be the
   same value ... )

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  [EMAIL PROTECTED]

Reply via email to