Skip to content

Commit

Permalink
2024-10-18 07:56 UTC+0200 Aleksander Czajczynski (hb fki.pl)
Browse files Browse the repository at this point in the history
  * src/common/hbver.c
    * guard Win10 build number getter from the unknown,
      using old Win32 API that is not going to be deprecated.
  • Loading branch information
alcz committed Oct 18, 2024
1 parent c88029e commit a8693f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
Entries may not always be in chronological/commit order.
See license at the end of file. */

2024-10-18 07:56 UTC+0200 Aleksander Czajczynski (hb fki.pl)
* src/common/hbver.c
* guard Win10 build number getter from the unknown,
using old Win32 API that is not going to be deprecated.

2024-10-17 15:04 UTC+0200 Aleksander Czajczynski (hb fki.pl)
* .github/workflows/windows-ci.yml
* update windows MSYS2 integration runner set of
Expand Down
10 changes: 9 additions & 1 deletion src/common/hbver.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,15 @@ static void s_hb_winVerInit( void )
memory, though build number is there only on Win10 and up.
https://www.geoffchappell.com/studies/windows/km/ntoskrnl/inc/api/ntexapi_x/kuser_shared_data/index.htm */

s_iWinNT = ( int ) * ( PULONG ) ( 0x7FFE0000 + 0x0260 );
MEMORY_BASIC_INFORMATION minfo;
minfo.Protect = 0;
if( VirtualQuery( ( void * ) 0x7FFE0000, &minfo, sizeof( minfo ) ) &&
( minfo.Protect & ( PAGE_READONLY | PAGE_READWRITE | PAGE_WRITECOPY |
PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY ) ) &&
! ( minfo.Protect & ( PAGE_GUARD | PAGE_NOACCESS ) ) )
s_iWinNT = ( int ) * ( PULONG ) ( 0x7FFE0000 + 0x0260 );
else
s_iWinNT = 1; /* unknown NT emulator */

/* COMPAT: this seems much simpler than dyn-calling GetVersionEx
or WDK RtlGetVersion (having in mind deprecation warnings,
Expand Down

0 comments on commit a8693f9

Please sign in to comment.