[cpp-sp] 02/08: Windows include master header file and pin to 8 bit character API

Rod Widdowson rdw at steadingsoftware.com
Sat Dec 7 15:54:32 UTC 2024


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=f49268b6ec49cf73b3f31ca53ca0bc9978afcdec

commit f49268b6ec49cf73b3f31ca53ca0bc9978afcdec
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Dec 7 14:27:57 2024 +0000

    Windows include master header file and pin to 8 bit character API
---
 shibsp/impl/AgentConfig.cpp  | 8 ++++++--
 shibsp/util/PathResolver.cpp | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/shibsp/impl/AgentConfig.cpp b/shibsp/impl/AgentConfig.cpp
index 29da81a4..69dfc8ed 100644
--- a/shibsp/impl/AgentConfig.cpp
+++ b/shibsp/impl/AgentConfig.cpp
@@ -38,6 +38,10 @@
 #include <boost/property_tree/ptree.hpp>
 #include <boost/property_tree/ini_parser.hpp>
 
+#ifdef WIN32
+#include <Windows.h>
+#endif
+
 #ifdef HAVE_DLFCN_H
 # include <dlfcn.h>
 #endif
@@ -356,9 +360,9 @@ bool AgentInternalConfig::load_library(const char* path, void* context)
 
     UINT em=SetErrorMode(SEM_FAILCRITICALERRORS);
     try {
-        handle=LoadLibraryEx(resolved.c_str(),nullptr,LOAD_WITH_ALTERED_SEARCH_PATH);
+        handle=LoadLibraryExA(resolved.c_str(),nullptr,LOAD_WITH_ALTERED_SEARCH_PATH);
         if (!handle)
-             handle=LoadLibraryEx(resolved.c_str(),nullptr,0);
+             handle=LoadLibraryExA(resolved.c_str(),nullptr,0);
         if (!handle)
             throw runtime_error(string("unable to load extension library: ") + resolved);
         FARPROC fn=GetProcAddress(handle,"shibsp_extension_init");
diff --git a/shibsp/util/PathResolver.cpp b/shibsp/util/PathResolver.cpp
index 1e63c6f0..47324c33 100644
--- a/shibsp/util/PathResolver.cpp
+++ b/shibsp/util/PathResolver.cpp
@@ -106,12 +106,12 @@ const string& PathResolver::resolve(string& s, file_type_t filetype, const char*
         // This is an ugly workaround for Windows XP/2003, which don't support the PROGRAMDATA variable.
         if (!getenv("PROGRAMDATA") && s.find("%PROGRAMDATA%") != string::npos) {
             char appdatapath[MAX_PATH + 2];
-            if (SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdatapath) == S_OK) {
+            if (SHGetFolderPathA(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdatapath) == S_OK) {
                 s.replace(s.find("%PROGRAMDATA%"), 13, appdatapath);
             }
         }
         char expbuf[MAX_PATH + 2];
-        DWORD cnt = ExpandEnvironmentStrings(s.c_str(), expbuf, sizeof(expbuf));
+        DWORD cnt = ExpandEnvironmentStringsA(s.c_str(), expbuf, sizeof(expbuf));
         if (cnt != 0 && cnt <= sizeof(expbuf))
             s = expbuf;
     }

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


More information about the commits mailing list