cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Win32 use of GetVersionEx()

From: <myriachan_at_cox.net>
Date: Wed, 15 Jan 2014 15:03:47 -0800

Change VER_EQUAL to VER_GREATER_EQUAL. The existence of code like this is why Windows 7 is NT 6.1 and not 7.0 =^-^=

Put "static const" before DWORD majorVersion, or use #define, and perhaps capitalize it as VISTA_MAJOR_VERSION or something.

Since VerifyVersionInfo is specific to NT (I'm believing what you say), you might as well force Unicode use here. Use OSVERSIONINFOEXW and VerifyVersionInfoW.

Melissa

---- Steve Holme <steve_holme_at_hotmail.com> wrote:
> Dear Friends,
>
> I have just pushed commit c7a76bb056f31e to fix the build warnings
> associated with GetVersionEx() on Windows when compiling with Visual Studio
> 2013 [1].
>
> In summary, and as of Windows 8.1, this function has been marked deprecated
> and it's return value altered depending on an application's manifest file
> and what operating system it is targeted at [2]. Applications that are not
> manifested will only return v6.2 regardless of whether they are running on
> Windows 8 (NT Kernel v6.2) or Windows 8.1 (NT Kernel v6.3) and as such it is
> recommended to use the Version Helper API instead.
>
> Given this, I have implemented the appropriate Version Helper functions in
> both connect.c and curl_sspi.c where we currently use GetVersionEx(). The
> functions I have used have been available since Windows 2000 (NT Kernel
> v5.0) [3] rather than the newer aliases which Microsoft are also providing
> [4].
>
> I would appreciate it if some of my Win32 colleagues here, could take a look
> at the patch [5] and provide any additional feedback if required.
>
> You will note that I have kept the existing GetVersionEx() code and
> protected it by "#if !defined(VerifyVersionInfo)", in case it is compiled
> for an older version of the Windows NT kernel or even the old non NT
> variants (Windows 3.1, 95, 98 and ME). Note that the #if !defined could be
> modified to a specific version of Visual Studio or Platform SDK if need be -
> your thoughts are appreciated.
>
> Many thanks in advance.
>
> Steve
>
> [1] = http://curl.haxx.se/dev/log.cgi?id=20140115000200-10369#prob1
> [2] =
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).as
> px
> [3] =
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms725492(v=vs.85).as
> px
> [4] =
> http://msdn.microsoft.com/en-us/library/windows/desktop/dn424972(v=vs.85).as
> px
> [5] =
> https://github.com/bagder/curl/commit/c7a76bb056f31e1cf4766dd219d9ef5cb4e346
> 3d
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-01-16