[cpp-sp] branch main updated: Always Use 8-bit character APIs for Win32 native calls in the Status Handler

Rod Widdowson rdw at steadingsoftware.com
Sat Jan 11 14:27:43 UTC 2025


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

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

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

The following commit(s) were added to refs/heads/main by this push:
     new ddf5b2e8 Always Use 8-bit character APIs for Win32 native calls in the Status Handler
ddf5b2e8 is described below

commit ddf5b2e888afc38ae00dce97d5d430c773259c2b
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Dec 14 15:26:55 2024 +0000

    Always Use 8-bit character APIs for Win32 native calls in the Status Handler
    
    Also use the APIs directly rather that calling GetProcessAddress.
    They are always there in the OS's we care about
---
 shibsp/handler/impl/StatusHandler.cpp | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/shibsp/handler/impl/StatusHandler.cpp b/shibsp/handler/impl/StatusHandler.cpp
index 2117ac5e..9249b33c 100644
--- a/shibsp/handler/impl/StatusHandler.cpp
+++ b/shibsp/handler/impl/StatusHandler.cpp
@@ -274,11 +274,6 @@ pair<bool,long> StatusHandler::run(SPRequest& request, bool isHandler) const
     }
 }
 
-#ifdef WIN32
-typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
-typedef BOOL (WINAPI *PGVEA)(LPOSVERSIONINFOA);
-#endif
-
 ostream& StatusHandler::systemInfo(ostream& os) const
 {
 #if defined(HAVE_SYS_UTSNAME_H)
@@ -298,11 +293,11 @@ ostream& StatusHandler::systemInfo(ostream& os) const
         os << "/>";
     }
 #elif defined(WIN32)
-    OSVERSIONINFOEX osvi;
-    memset(&osvi, 0, sizeof(OSVERSIONINFOEX));
+    OSVERSIONINFOEXA osvi;
+    memset(&osvi, 0, sizeof(OSVERSIONINFOEXA));
     osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-    PGVEA pGVEA = (PGVEA)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetVersionExA");
-    if(pGVEA && pGVEA((OSVERSIONINFO*)&osvi)) {
+
+    if(GetVersionExA((LPOSVERSIONINFOA)&osvi)) {
         os << "<Windows"
            << " version='" << osvi.dwMajorVersion << "." << osvi.dwMinorVersion << "'"
            << " build='" << osvi.dwBuildNumber << "'";
@@ -320,11 +315,7 @@ ostream& StatusHandler::systemInfo(ostream& os) const
 
         SYSTEM_INFO si;
         memset(&si, 0, sizeof(SYSTEM_INFO));
-        PGNSI pGNSI = (PGNSI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo");
-        if(pGNSI)
-            pGNSI(&si);
-        else
-            GetSystemInfo(&si);
+        GetNativeSystemInfo(&si);
         switch (si.dwProcessorType) {
             case PROCESSOR_ARCHITECTURE_INTEL:
                 os << " arch='i386'";

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


More information about the commits mailing list