PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.43k stars 296 forks source link

win: New PaWinUtil_GetOsVersion() function for getting Windows OS version #830

Closed dmitrykos closed 1 year ago

dmitrykos commented 1 year ago

As per discussion in #796 introducing a single API for getting Windows OS version in PA that will improve client code readability and reliability.

Additionally:

dmitrykos commented 1 year ago

Overlooked that WDMKS is also using GetVersion, just added it into the PR.

dmitrykos commented 1 year ago

In addition to my one review comment, could you please let us know what tests you have run on this new code.

I tested on Windows 10:

PortAudio Test: output sine wave. SR = 44100, BufSize = 64
before paHostApiInitializers[0].
getting Windows version with RtlGetVersion(): major=10, minor=0, build=19045, platform=2
Windows version=10

also Windows UWP and the lowest I have is Windows Server 2003 R2. I did not test on Windows Vista, 7, 8.

Windows Server 2003 R2 is practically latest Windows XP with 3790 build (https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions) which is detected correctly:

PortAudio Test: output sine wave. SR = 44100, BufSize = 64
before paHostApiInitializers[0].
getting Windows version with RtlGetVersion(): major=5, minor=2, build=3790, platform=2
Windows version=5

Unfortunately I did not implement testing of every Windows version that could be done with Docker I believe due to lack of time resource. The underlying implementation is a copy-paste from the WASAPI's implementation which is time-tested on Windows Vista, 7, 8.