[cpp-sp] 01/02: SSPCPP-881 Do not link directly against GetVersionEx

Rod Widdowson rdw at steadingsoftware.com
Sat Feb 15 12:00:07 EST 2020


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository cpp-sp.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=242668acd688f93b65bbb8d061063e9ecc873d9b

commit 242668acd688f93b65bbb8d061063e9ecc873d9b
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Feb 15 16:33:05 2020 +0000

    SSPCPP-881 Do not link directly against GetVersionEx
    
    https://issues.shibboleth.net/jira/browse/SSPCPP-881
---
 shibsp/handler/impl/StatusHandler.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/shibsp/handler/impl/StatusHandler.cpp b/shibsp/handler/impl/StatusHandler.cpp
index 45851cc..88c53eb 100644
--- a/shibsp/handler/impl/StatusHandler.cpp
+++ b/shibsp/handler/impl/StatusHandler.cpp
@@ -494,6 +494,7 @@ pair<bool,long> StatusHandler::processMessage(
 
 #ifdef WIN32
 typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
+typedef BOOL (WINAPI *PGVEA)(LPOSVERSIONINFOA);
 #endif
 
 ostream& StatusHandler::systemInfo(ostream& os) const
@@ -518,7 +519,8 @@ ostream& StatusHandler::systemInfo(ostream& os) const
     OSVERSIONINFOEX osvi;
     memset(&osvi, 0, sizeof(OSVERSIONINFOEX));
     osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-    if(GetVersionEx((OSVERSIONINFO*)&osvi)) {
+    PGVEA pGVEA = (PGVEA)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetVersionExA");
+    if(pGVEA && pGVEA((OSVERSIONINFO*)&osvi)) {
         os << "<Windows"
            << " version='" << osvi.dwMajorVersion << "." << osvi.dwMinorVersion << "'"
            << " build='" << osvi.dwBuildNumber << "'";
@@ -563,6 +565,9 @@ ostream& StatusHandler::systemInfo(ostream& os) const
 
         os << "/>";
     }
+    else {
+	os << "<Windows/>";
+    }
 #endif
     return os;
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list