Page faults and instruction emulation

Ove Kaaven ovehk at
Thu Oct 18 20:34:58 CDT 2001

On 18 Oct 2001, Alexandre Julliard wrote:

> Ove Kaaven <ovehk at> writes:
> > I know of two Wine architecture issues that must be resolved before the
> > anti-debugger check can succeed in win95 mode.
> > 
> > 1. it checks that teb->debug_context (TEB offset 0x20) is zero. In Wine,
> > it isn't (the NT pid is stored there), so this check fails.
> > 
> > Is it possible to change Wine's TEB structure to fix this?
> It would probably break some of the NT native dlls.

Well, perhaps it could depend on the windows version somehow...

> > But to emulate an instruction from Wine's pre-exception page fault handler
> > (VIRTUAL_HandleFault()), the current context must be passed along to it,
> > so VIRTUAL_HandleFault and all Wine handlers that can be registered with
> > VIRTUAL_SetFaultHandler must get an extra parameter. Is this too
> > objectionable to do?
> The extra parameter is not that bad, but having to do full emulation
> of all instructions accessing memory, plus the complete IDT handling,
> is going to lead to major ugliness.

Well, I already have some code that basically does this and works, so it
can't be that bad (though it's kinda proof-of-concept-quality)

> Wouldn't it be possible to somehow emulate the kernel driver to make
> the NT version work?  That would be much cleaner.

Maybe... I was just concerned whether you'd like Wine to be subject to
lawsuits or something (reverse engineering, trade secrets, DMCA,
whatever... not that the kernel driver is really complex, though).
Also, I was afraid some games might refuse to work with --winver nt40

More information about the wine-devel mailing list