[PATCH] Cygwin: pty: Add missing console API hooks.

Takashi Yano takashi.yano@nifty.ne.jp
Thu Jan 23 13:05:00 GMT 2020


On Thu, 23 Jan 2020 13:48:13 +0100
Corinna Vinschen wrote:
> On Jan 23 13:33, Takashi Yano wrote:
> > - Following console APIs are additionally hooked for cygwin programs
> >   which directly call them.
> >   * FillConsoleOutputAttribute()
> >   * FillConsoleOutputCharacterA()
> >   * FillConsoleOutputCharacterW()
> >   * ScrollConsoleScreenBufferA()
> >   * ScrollConsoleScreenBufferW()
> 
> Which Cygwin programs are doing that?  They wouldn't work correctly in
> ptys anyway, isn't it?  Does it really make sense to make them happy
> rather than requesting to change them?

Just a possibility. There is no specific example.
With this patch, the code below can work even if it is compiled as
cygwin binary.

#include <stdio.h>
#include <windows.h>

int main() {
        COORD dest = {0, 0};
        printf("\033[H\033[J\n");
        DWORD n;
        FillConsoleOutputCharacter (GetStdHandle(STD_OUTPUT_HANDLE),
                        'A', 80, dest, &n);
        FillConsoleOutputAttribute (GetStdHandle(STD_OUTPUT_HANDLE),
                        FOREGROUND_RED, 80, dest, &n);
        return 0;
}

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>



More information about the Cygwin-patches mailing list