[PATCH] Cygwin: pty: Add missing console API hooks.
Takashi Yano
takashi.yano@nifty.ne.jp
Sat Jan 25 10:19:00 GMT 2020
Hi Corinna,
On Fri, 24 Jan 2020 11:26:27 +0100
Corinna Vinschen wrote:
> On Jan 23 22:05, Takashi Yano wrote:
> > 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.
>
> In that case I'd prefer not to apply this patch. Using native Windows
> console functions in a Cygwin application just doesn't make sense, and
> we shouldn't support that beyond what's necessary for older, existing
> applications.
I searched in /bin and found that many of cygwin programs calls win32 api
directly. However, the only cygwin programs which calls console APIs are
cygrunsrv.exe, gdb.exe and w3m.exe in my installation.
cygrunsrv calls:
DLL Name: ADVAPI32.dll
vma: Hint/Ord Member-Name Bound-To
264ec 87 CloseServiceHandle
26502 92 ControlService
26514 128 CreateServiceA
26526 218 DeleteService
26536 255 EnumServicesStatusA
2654c 511 OpenSCManagerA
2655e 513 OpenServiceA
2656e 554 QueryServiceConfigA
26584 559 QueryServiceStatus
2659a 568 RegCloseKey
265a8 569 RegConnectRegistryA
265be 576 RegCreateKeyExA
265d0 601 RegEnumValueA
265e0 603 RegFlushKey
265ee 616 RegOpenKeyExA
265fe 629 RegQueryValueExA
26612 645 RegSetValueExA
26624 654 RegisterServiceCtrlHandlerExA
26644 712 SetServiceStatus
26658 718 StartServiceA
26668 719 StartServiceCtrlDispatcherA
DLL Name: KERNEL32.dll
vma: Hint/Ord Member-Name Bound-To
26686 16 AllocConsole <==============
26696 83 CloseHandle
266a4 239 EnterCriticalSection
266bc 351 FormatMessageA
266ce 353 FreeConsole <==============
266dc 356 FreeLibrary
266ea 482 GetExitCodeProcess
26700 515 GetLastError
26710 531 GetModuleFileNameA
26726 533 GetModuleHandleA
2673a 581 GetProcAddress
2674c 663 GetTickCount
2675c 677 GetVersion
2676a 747 InitializeCriticalSection
26786 806 LeaveCriticalSection
2679e 809 LoadLibraryA
267ae 879 OpenProcess
267bc 1035 SetConsoleTitleA <==============
267d0 1078 SetLastError
267e0 1140 Sleep
267e8 1218 WaitForSingleObject
DLL Name: USER32.dll
vma: Hint/Ord Member-Name Bound-To
267fe 13 BringWindowToTop
26812 260 GetForegroundWindow
26828 335 GetTopWindow
26838 538 SetForegroundWindow
gdb calls:
DLL Name: KERNEL32.dll
vma: Hint/Ord Member-Name Bound-To
60a5bc 84 CloseHandle
60a5ca 106 ContinueDebugEvent
60a5e0 140 CreateFileA
60a5ee 172 CreateProcessW
60a600 201 DebugActiveProcess
60a616 348 FlushInstructionCache
60a62e 358 FreeLibrary
60a63c 364 GenerateConsoleCtrlEvent <==============
60a658 440 GetConsoleScreenBufferInfo <==============
60a676 454 GetCurrentProcess
60a68a 485 GetExitCodeThread
60a69e 517 GetLastError
60a6ae 535 GetModuleHandleA
60a6c2 538 GetModuleHandleW
60a6d6 583 GetProcAddress
60a6e8 628 GetSystemDirectoryW
60a6fe 651 GetThreadContext
60a712 661 GetThreadSelectorEntry
60a72c 811 LoadLibraryA
60a73c 882 OpenProcess
60a74a 950 ReadProcessMemory
60a75e 988 ResumeThread
60a76e 1015 SetConsoleCtrlHandler <==============
60a786 1057 SetEnvironmentVariableW
60a7a0 1059 SetEvent
60a7ac 1115 SetThreadContext
60a7c0 1154 SuspendThread
60a7d0 1160 TerminateProcess
60a7e4 1221 WaitForDebugEvent
60a7f8 1224 WaitForSingleObject
60a80e 1278 WriteProcessMemory
w3m calls:
DLL Name: KERNEL32.dll
vma: Hint/Ord Member-Name Bound-To
1384c0 83 CloseHandle
1384ce 139 CreateFileA
1384dc 356 FreeLibrary
1384ea 441 GetConsoleTitleA <==============
1384fe 453 GetCurrentProcessId
138514 533 GetModuleHandleA
138528 581 GetProcAddress
13853a 663 GetTickCount
13854a 678 GetVersionExA
13855a 809 LoadLibraryA
13856a 888 PeekConsoleInputA <==============
13857e 929 ReadConsoleA <==============
13858e 930 ReadConsoleInputA <==============
1385a2 1035 SetConsoleTitleA <==============
1385b6 1140 Sleep
DLL Name: USER32.dll
vma: Hint/Ord Member-Name Bound-To
1385be 211 FindWindowA
1385cc 401 IsWindowVisible
1385de 644 wsprintfA
None of them calls:
FillConsoleOutputAttribute()
FillConsoleOutputCharacterA()
FillConsoleOutputCharacterW()
ScrollConsoleScreenBufferA()
ScrollConsoleScreenBufferW()
So, I would like to withdraw this patch for now. Thanks.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
More information about the Cygwin-patches
mailing list