The MinGW.org Windows System Libraries
修订版 | 603c0173c00f5e9890e3928e14eee9e44e34e515 (tree) |
---|---|
时间 | 2021-06-14 05:31:31 |
作者 | Keith Marshall <keith@user...> |
Commiter | Keith Marshall |
Implement pseudo-console legacy platform support.
@@ -1,5 +1,14 @@ | ||
1 | 1 | 2021-06-13 Keith Marshall <keith@users.osdn.me> |
2 | 2 | |
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 | + | |
3 | 12 | Update to add Win10 pseudo-console support. |
4 | 13 | |
5 | 14 | * include/winbase.h [_WIN32_WINNT >= _WIN32_WINNT_VISTA] |
@@ -425,6 +425,45 @@ WINAPI void ClosePseudoConsole (HPCON); | ||
425 | 425 | |
426 | 426 | #define PSEUDOCONSOLE_INHERIT_CURSOR (DWORD)(1) |
427 | 427 | |
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 | + | |
428 | 467 | #endif /* Win10 Redstone 5 and later */ |
429 | 468 | #endif /* Vista and later */ |
430 | 469 | #endif /* WinXP and later */ |