Skip to main content

How to get OS version. Part 2.

Not so long time ago I have published short article about reading Windows OS version. I have got lot of e-mails asking me for source code. In fact, there is nothing hard to do what I described but after describing it lot of times I decided to create few units with read OS version functions.

There are three units: for Delphi, for C# and for C++.

You can download it on GitHub

I use this method in my Wireless Communication Library and it works great on all supported platforms in any possible situation (at least for now).

Should you have any question please contact me by mike@btframework.com

Comments

Popular posts from this blog

Remote Control Joystick

It appeared that I need to connect my Spektrum DX9 to PC. Unfortunately I have no USB cable for that. And also I read that it may die when connected to PC through trainer port.

Fortunately I have Orange 6-channel RX and Arduino UNO. So I decided to create own joystick that I can use with LiftOff simulator.



Hardware To create your own Remote Control Joystick you need:
Any receiver (currently up to eight channels is supported).Arduino UNO or Arduino MEGA with 8u2, 16u2  or 32u2 USB chip.9 wires.Note: some cheap Arduino built with other USB-Serial bridge. Make sure your uses Atmeg as USB interface.

Preparing
First you must prepare your Arduino so it appears as USB HID device for your PC. By default Arduino appears as VCP only. To do so yo uhave to flash your 16u2 with HoodLoader. 

There are 2 ways to flash it: Standalone Arduino or from other Arduino. Select which is better for you. I used first method.

Note: There is 100nF capacitor required to flash Arduino as standalone. However on…

How to get OS version

Have you ever tried to get correct OS version number on Windows 10? If yes, you know what the pain in the ass it is.

Old days we can simple call GetVersion() or GetVersionEx() and can be sure that information returned by the function is ansolutely correct.

However, starting from Windows 8.1 Microsoft has changed the behavior of those functions. Now it returns weather on the Mars but not OS version. This is how it is described in MSDN

With the release of Windows 8.1, the behavior of the GetVersion API has changed in the value it will return for the operating system version. The value returned by the GetVersion function now depends on how the application is manifested.

Applications not manifested for Windows 8.1 or Windows 10 will return the Windows 8 OS version value (6.2). Once an application is manifested for a given operating system version, GetVersion will always return the version that the application is manifested for in future releases. They offer to use IsOSxxx functions.…