Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Version Helper functions for Windows XP

In my application I need to check windows version. I'm using Version Helper functions in Visual Studio 2013 (v120) platform toolset. But then the program does not work in Windows XP. error is:

'xxx.exe' is not a valid win32 application

So I changed platform toolset to Visual Studio 2013 - Windows XP (v120_xp). But in this case application will not compile. The error is:

error C1083: Cannot open include file: 'VersionHelpers.h': No such file or directory

What can I do? Can I use old GetVersionEx function? MSDN says:

GetVersionEx may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper APIs

But may be I should use it for now!

like image 920
Mahmood Dehghan Avatar asked Dec 25 '22 02:12

Mahmood Dehghan


1 Answers

I've managed to solve it using Remmy Lebeau's comment.

I copied VersionHelpers.h from C:\Program Files (x86)\Windows Kits\8.1\Include\um and winapifamily.h and sdkddkver.h from C:\Program Files (x86)\Windows Kits\8.1\Include\shared into my project and changed some includes in them.

Now it compiles with Windows XP toolset.

I've tested it and it's working as expected in all versions of windows.

like image 172
Mahmood Dehghan Avatar answered Jan 02 '23 09:01

Mahmood Dehghan