チケット #42383

Implement a "legacy-safe" emulation of Microsoft's "versionhelpers" API.

登録: 2021-05-25 04:00 最終更新: 2021-05-26 01:14

報告者:
担当者:
チケットの種類:
状況:
オープン [担当者決定済み]
コンポーネント:
マイルストーン:
(未割り当て)
優先度:
5 - 中
重要度:
5 - 中
解決法:
受領
ファイル:
なし
投票
点数: 1
100.0% (1/1)
0.0% (0/1)

詳細

The Ada component for GCC-10 has introduced a gratuitous dependency on Microsoft's <versionhelpers.h> API. Notwithstanding that this is an appalling choice, by the GCC-Ada developers — OS version, (which is what this API tests,) is never a reliable indicator of feature availability — to facilitate continuing support for GCC-Ada, in MinGW, it is almost imperative that we provide our own <versionhelpers.h> API emulation; (the alternative would be to commit to patching future versions of GCC-Ada, in perpetuity, to circumvent this ill-advised dependency).

チケットの履歴 (3 件中 3 件表示)

2021-05-25 04:00 更新者: keith
  • 新しいチケット "Implement a "legacy-safe" emulation of Microsoft's "versionhelpers" API." が作成されました
2021-05-25 05:43 更新者: keith
コメント

Microsoft first introduced the <versionhelpers.h> API as a component of the Windows 8.1 Software Development Kit. However, as noted in Microsoft's documentation, this API is based on the VerifyVersionInfo() function, which, according to the pertinent documentation, has been supported on all WinNT derivatives since Windows 2000, and thus, the <versionhelpers.h> API is backwardly compatible with Win2K, and all subsequent WinNT derivatives.

Unfortunately, while backward compatibility with Win2K, and all later WinNT derivatives, may be sufficient for many applications, it does not satisfy MinGW's objective of supporting even earlier WinNT variants, and Win9x; (indeed, the MinGW libraries are compiled with nominal support for WinNT4, with additional compatibility infrastructure to support Win9x). Any MinGW emulation would, thus, need to incorporate such "legacy-support" infrastructure, even if such support offered no more than an indication that the run-time platform is too old for the requested level of support; (indeed, such an indication would be entirely appropriate, since the API specification incorporates no test for any OS version prior to IsWindowsXPOrGreater()).

2021-05-26 01:14 更新者: keith
  • 解決法なし から 受領 に更新されました
コメント

I committed 475f0b6. With this in place, the trivial program:

  1. #include <stdio.h>
  2. #include <versionhelpers.h>
  3. #include "legacy.h"
  4. const char *test( BOOL status )
  5. { return status ? "is" : "is not"; }
  6. void report( const char *what, BOOL status )
  7. { printf( "%s %s supported\n", what, test( status ) ); }
  8. int main()
  9. { printf( "Host %s a Windows server\n", test( IsWindowsServer() ) );
  10. report( "WinXP", IsWindowsXPOrGreater() );
  11. report( "WinXP-SP1", IsWindowsXPSP1OrGreater() );
  12. report( "WinXP-SP2", IsWindowsXPSP2OrGreater() );
  13. report( "WinXP-SP3", IsWindowsXPSP3OrGreater() );
  14. report( "Vista", IsWindowsVistaOrGreater() );
  15. report( "Vista-SP1", IsWindowsVistaSP1OrGreater() );
  16. report( "Vista-SP2", IsWindowsVistaSP2OrGreater() );
  17. report( "Win7", IsWindows7OrGreater() );
  18. report( "Win7-SP1", IsWindows7SP1OrGreater() );
  19. report( "Win8", IsWindows8OrGreater() );
  20. report( "Win8.1", IsWindows8Point1OrGreater() );
  21. report( "Win10", IsWindows10OrGreater() );
  22. return 0;
  23. }
produces this output, when run on a WinXP-SP2 virtual machine:
Host is not a Windows server
WinXP is supported
WinXP-SP1 is supported
WinXP-SP2 is supported
WinXP-SP3 is not supported
Vista is not supported
Vista-SP1 is not supported
Vista-SP2 is not supported
Win7 is not supported
Win7-SP1 is not supported
Win8 is not supported
Win8.1 is not supported
Win10 is not supported
while on a Win7-SP1 VM, it produces:
Host is not a Windows server
WinXP is supported
WinXP-SP1 is supported
WinXP-SP2 is supported
WinXP-SP3 is supported
Vista is supported
Vista-SP1 is supported
Vista-SP2 is supported
Win7 is supported
Win7-SP1 is supported
Win8 is not supported
Win8.1 is not supported
Win10 is not supported

I don't have ready access to any other Windows hosts, so if anyone else is able to help with further testing, it would be appreciated.

添付ファイルリスト

添付ファイルはありません

編集

このチケットにコメントを追加するには、ログインが必要です » ログインする