Skip to content

Deprecated API usage in system_win32.c #4995

Closed

Description

@FuccDucc

The current version of cURL is using a deprecated Windows API function GetVersionEx at this location: system_win32.c @ 226

Is this really neccesary? For increased reliability, refactoring it using the replacement, Version Helper Functions, sounds like a good idea.

Activity

  1. jay commented on Feb 28, 2020

    @jay
    Member

    VerifyVersionInfo is used when available. I don't see the problem.

    /cc @captain-caveman2k

  2. FuccDucc commented on Feb 28, 2020

    @FuccDucc
    Author

    VerifyVersionInfo is used when available. I don't see the problem.

    Well, let me reverse the question.

    This usage causes a compiler warning in projects that use cURL.

    Why would you keep using a deprecated function? Why would you use it when a replacement (or alternative) is available, when using the deprecated function is also unnecesary, since all old Windows versions support the replacement. Without a reason not to upgrade it. Pro's versus cons.

    Deprecated functions, like the MS article for this one also says, also may not be reliable (or unavailable) in future and thus there is a risk they'll behave in unexpected ways. This future risk is unnecesary, since you can replace the usage.

  3. jay commented on Feb 28, 2020

    @jay
    Member

    This usage causes a compiler warning in projects that use cURL.

    What is the warning, how are you building curl and what are you using to build it?

    Why would you keep using a deprecated function?

    Because not all build systems or targets may support the replacement function.

  4. FuccDucc commented on Feb 28, 2020

    @FuccDucc
    Author

    What is the warning, how are you building curl and what are you using to build it?

    All modern versions of Visual Studio, for example, give a deprecation warning.

    Because not all build systems or targets may support the replacement function.

    Yes they do, GetVersionEx is a Windows API (talking about targets) and the replacement, like I said, supports all old versions of Windows.

    Since it appears no one understands anything, maybe it's better to go and read this article: https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getversionexa

    It is deprecated. The following description matters to understand the pro's and cons (as I said before, you don't want to risk unexpected behavior in the future for no good reason right? Any arguing against upgrading is just a case of principle/project practise, so I will leave this issue now and you can do whatever you want):

    [GetVersionEx may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper functions]
    With the release of Windows 8.1, the behavior of the GetVersionEx API has changed in the value it will return for the operating system version

  5. jay commented on Feb 28, 2020

    @jay
    Member

    VerifyVersionInfo should be used when available. Please tell us:

    What is the warning, how are you building curl and what are you using to build it?

  6. bagder commented on Feb 28, 2020

    @bagder
    Member

    Since it appears no one understands anything

    I think it is you who misses the point: the code tries to use the right function already and we'd appreciate if you helped us figure out why it doesn't!

  7. captain-caveman2k commented on Feb 29, 2020

    @captain-caveman2k
    Contributor

    I've only just seen this - so my apologies for jumping in late.

    The idea with #if block at line 218 is that GetVersionEx() should only be used on Non-Windows NT based versions of Windows (i.e. Windows 9x / ME and versions of NT earlier than Windows 2000, ie Windows NT 3.5x and 4.0) where a) it isn't deprecated and b) VerifyVersionInfo() isn't available. Anything newer should be using VerifyVersionInfo() as seen at line 345.

    It would seem that for some reason this #if block isn't working as intended and I, like my colleagues, would like to try and understand why.

    • Where was the source code/libcurl API obtained from (Official tarball/zip, Github, NuGet, etc...)?
    • Are you using libcurl with the default config-win32.h?
    • Are you compiling libcurl yourself? If so how is it built (Visual Studio Projects, nmake, cmake, msys)?
  8. bagder commented on Mar 5, 2020

    @bagder
    Member

    No feedback, closing.

  9. locked as resolved and limited conversation to collaborators on Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions