Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poco::Environment::osDisplayName #3180

Closed
micheleselea opened this issue Jan 5, 2021 · 4 comments
Closed

Poco::Environment::osDisplayName #3180

micheleselea opened this issue Jan 5, 2021 · 4 comments

Comments

@micheleselea
Copy link
Contributor

the standard GetVersionEx returns always windows8 without a manifest.
Probably should we use this implementation
https://stackoverflow.com/questions/37700605/getting-windows-os-version-programmatically

BOOL GetTrueWindowsVersion(OSVERSIONINFOEX* pOSversion)
{
   // Function pointer to driver function
   NTSTATUS (WINAPI *pRtlGetVersion)(
      PRTL_OSVERSIONINFOW lpVersionInformation) = NULL;

   // load the System-DLL
   HINSTANCE hNTdllDll = LoadLibrary("ntdll.dll");

   // successfully loaded?
   if (hNTdllDll != NULL)
   {
      // get the function pointer to RtlGetVersion
      pRtlGetVersion = (NTSTATUS (WINAPI *)(PRTL_OSVERSIONINFOW))
            GetProcAddress (hNTdllDll, "RtlGetVersion");

      // if successfull then read the function
      if (pRtlGetVersion != NULL)
         pRtlGetVersion((PRTL_OSVERSIONINFOW)pOSversion);

      // free the library
      FreeLibrary(hNTdllDll);
   } // if (hNTdllDll != NULL)

   // if function failed, use fallback to old version
   if (pRtlGetVersion == NULL)
      GetVersionEx((OSVERSIONINFO*)pOSversion);

   // always true ...
   return (TRUE);
} // GetTrueWindowsVersion

that gives the correct version

@obiltschnig obiltschnig self-assigned this Jan 6, 2021
@obiltschnig obiltschnig added this to the Release 1.10.2 milestone Jan 6, 2021
@micheleselea
Copy link
Contributor Author

Be aware that RtlGetVersion I think does not give you server/client information, for that I think we can call GetVersionEx before

@github-actions
Copy link

This issue is stale because it has been open for 365 days with no activity.

@github-actions github-actions bot added the stale label May 19, 2023
@github-actions
Copy link

This issue was closed because it has been inactive for 60 days since being marked as stale.

@aleks-f aleks-f modified the milestones: Release 1.13.1, Release 1.14.0 Feb 4, 2024
@aleks-f aleks-f added this to 1.14 Feb 4, 2024
@aleks-f aleks-f reopened this Feb 4, 2024
Copy link

github-actions bot commented Apr 4, 2024

This issue was closed because it has been inactive for 60 days since being marked as stale.

@github-actions github-actions bot closed this as completed Apr 4, 2024
@github-project-automation github-project-automation bot moved this to Done in 1.14 Apr 4, 2024
@matejk matejk reopened this Apr 4, 2024
@matejk matejk removed the stale label Apr 4, 2024
@aleks-f aleks-f added the fixed label Oct 31, 2024
@matejk matejk closed this as completed Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

4 participants