• R/O
  • HTTP
  • SSH
  • HTTPS

mingw-org-wsl: 提交

The MinGW.org Windows System Libraries


Commit MetaInfo

修訂603c0173c00f5e9890e3928e14eee9e44e34e515 (tree)
時間2021-06-14 05:31:31
作者Keith Marshall <keith@user...>
CommiterKeith Marshall

Log Message

Implement pseudo-console legacy platform support.

Change Summary

差異

--- a/w32api/ChangeLog
+++ b/w32api/ChangeLog
@@ -1,5 +1,14 @@
11 2021-06-13 Keith Marshall <keith@users.osdn.me>
22
3+ Implement pseudo-console legacy platform support.
4+
5+ * include/wincon.h [NTDDI_VERSION >= NTDDI_WIN10_RS5]
6+ [_MINGW_LEGACY_SUPPORT] (CreatePseudoConsole, ResizePseudoConsole)
7+ [_MINGW_LEGACY_SUPPORT] (ClosePseudoConsole): Add inline stub function
8+ implementations, to enforce run-time linking.
9+
10+2021-06-13 Keith Marshall <keith@users.osdn.me>
11+
312 Update to add Win10 pseudo-console support.
413
514 * include/winbase.h [_WIN32_WINNT >= _WIN32_WINNT_VISTA]
--- a/w32api/include/wincon.h
+++ b/w32api/include/wincon.h
@@ -425,6 +425,45 @@ WINAPI void ClosePseudoConsole (HPCON);
425425
426426 #define PSEUDOCONSOLE_INHERIT_CURSOR (DWORD)(1)
427427
428+#ifdef _MINGW_LEGACY_SUPPORT
429+/* For MinGW legacy platform support, provide inline redirector stubs,
430+ * to facilate graceful fallback action, in the event that any program,
431+ * which has been linked with the pseudo-console API, is run on an older
432+ * version of Windows.
433+ */
434+#include "legacy.h"
435+
436+__CRT_ALIAS WINAPI HRESULT CreatePseudoConsole
437+( COORD size, HANDLE input, HANDLE output, DWORD flags, HPCON *con )
438+{
439+ typedef WINAPI HRESULT (*api)( COORD, HANDLE, HANDLE, DWORD, HPCON * );
440+
441+ static void *call = API_UNCHECKED;
442+ return ((call = __kernel32_entry_point( call, __FUNCTION__ )) != NULL)
443+ ? ((api)(call))( size, input, output, flags, con )
444+ : __legacy_support( ERROR_OLD_WIN_VERSION );
445+}
446+
447+__CRT_ALIAS WINAPI HRESULT ResizePseudoConsole (HPCON con, COORD size)
448+{
449+ typedef WINAPI HRESULT (*api)( HPCON, COORD );
450+
451+ static void *call = API_UNCHECKED;
452+ return ((call = __kernel32_entry_point( call, __FUNCTION__ )) != NULL)
453+ ? ((api)(call))( con, size ) : __legacy_support( ERROR_OLD_WIN_VERSION );
454+}
455+
456+__CRT_ALIAS WINAPI void ClosePseudoConsole (HPCON con)
457+{
458+ typedef WINAPI void (*api)( HPCON );
459+
460+ static void *call = API_UNCHECKED;
461+ if( (call = __kernel32_entry_point( call, __FUNCTION__ )) == NULL )
462+ (void)__legacy_support( ERROR_OLD_WIN_VERSION );
463+ else ((api)(call))( con );
464+}
465+#endif /* _MINGW_LEGACY_SUPPORT */
466+
428467 #endif /* Win10 Redstone 5 and later */
429468 #endif /* Vista and later */
430469 #endif /* WinXP and later */
Show on old repository browser