Re: Carry flag state after a system function call

Robert Ayrapetyan <[email protected]>
Newsgroups gmane.comp.emulators.wine.devel
Message-ID <CAAboi9uXctzkJUyF5sq5uUKOwmLC=Zq49b2u7bPfPYZkQwvtBA@mail.gmail.com>
It was a 32-bit executable of the Polish version of the Galador game
(The Prince and The Coward).
It contains wrappers around calls to kernel32 functions (e.g. _llseek).
The very last instruction in most of the wrappers is clc, but not in
all of them. One of them, wrapping _llseek, contained no clc
instruction, causing random behaviour, when different versions of wine
behaved differently depending on how the Carry flag was set based on a
side effect of a stack frame cleanup code.
At least in Windows XP it didn't work because it uses instructions
which always set the Carry flag to true in the epilog of the
SetFilePointer function.
I don't think this is something we can fix in wine, if the application
relies on the state of the Carry flag and doesn't explicitly clear it
in case of success - it's a bug of that app,
which may accidentally work in some specific Windows versions.
I can provide a patch for this particular game which NOPs JB call
after _llseek, but I don't think it's appropriate for winehq..





On Wed, Sep 25, 2024 at 10:16 AM Fabian Maurer <[email protected]> wrote:
>
> What app is it, is it a 16bit program?
>
> Also, what exactly does system function call mean? Is it one affected function
> or multiple?
>
> Does it work reliably on windows?
>
> IMHO it wouldn't hurt to open a bug report, be it just for others who have the
> same issue. You could try to come up with a patch, either as workaround or
> possibly as upstream-able change.
>
> Regards,
> Fabian Maurer
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.