[Scummvm-git-logs] scummvm master -> cdcdb26ac81178503d21f29b7b82fe12d0bdd4b1

bluegr noreply at scummvm.org
Mon Jan 31 06:32:09 UTC 2022


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ff5700cd44 WIN32: Detect SHGetSpecialFolderPath at runtime
cdcdb26ac8 WIN32: Fix bug in SHGetFolderPathFunc fallback code


Commit: ff5700cd44fc034d7b3bc1ffa37419b8c828e0d2
    https://github.com/scummvm/scummvm/commit/ff5700cd44fc034d7b3bc1ffa37419b8c828e0d2
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-01-31T08:32:05+02:00

Commit Message:
WIN32: Detect SHGetSpecialFolderPath at runtime

Changed paths:
    backends/platform/sdl/win32/win32_wrapper.cpp


diff --git a/backends/platform/sdl/win32/win32_wrapper.cpp b/backends/platform/sdl/win32/win32_wrapper.cpp
index 0fcfd794e3d..6e0f308b9df 100644
--- a/backends/platform/sdl/win32/win32_wrapper.cpp
+++ b/backends/platform/sdl/win32/win32_wrapper.cpp
@@ -68,7 +68,19 @@ HRESULT SHGetFolderPathFunc(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags,
 	if (pSHGetFolderPath)
 		return pSHGetFolderPath(hwnd, csidl, hToken, dwFlags, pszPath);
 
-	return SHGetSpecialFolderPath(hwnd, pszPath, csidl & !CSIDL_FLAG_MASK, csidl & CSIDL_FLAG_CREATE) ? S_OK : E_NOTIMPL;
+	typedef BOOL (WINAPI *SHGetSpecialFolderPathFunc)(HWND hwnd, LPTSTR pszPath, int csidl, BOOL fCreate);
+
+	SHGetSpecialFolderPathFunc pSHGetSpecialFolderPath = (SHGetSpecialFolderPathFunc)(void *)GetProcAddress(GetModuleHandle(TEXT("shell32.dll")),
+#ifndef UNICODE
+		"SHGetSpecialFolderPathA"
+#else
+		"SHGetSpecialFolderPathW"
+#endif
+	);
+	if (pSHGetSpecialFolderPath)
+		return pSHGetSpecialFolderPath(hwnd, pszPath, csidl & !CSIDL_FLAG_MASK, csidl & CSIDL_FLAG_CREATE) ? S_OK : E_FAIL;
+
+	return E_NOTIMPL;
 }
 
 namespace Win32 {


Commit: cdcdb26ac81178503d21f29b7b82fe12d0bdd4b1
    https://github.com/scummvm/scummvm/commit/cdcdb26ac81178503d21f29b7b82fe12d0bdd4b1
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-01-31T08:32:05+02:00

Commit Message:
WIN32: Fix bug in SHGetFolderPathFunc fallback code

Changed paths:
    backends/platform/sdl/win32/win32_wrapper.cpp


diff --git a/backends/platform/sdl/win32/win32_wrapper.cpp b/backends/platform/sdl/win32/win32_wrapper.cpp
index 6e0f308b9df..6d32f096de2 100644
--- a/backends/platform/sdl/win32/win32_wrapper.cpp
+++ b/backends/platform/sdl/win32/win32_wrapper.cpp
@@ -78,7 +78,7 @@ HRESULT SHGetFolderPathFunc(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags,
 #endif
 	);
 	if (pSHGetSpecialFolderPath)
-		return pSHGetSpecialFolderPath(hwnd, pszPath, csidl & !CSIDL_FLAG_MASK, csidl & CSIDL_FLAG_CREATE) ? S_OK : E_FAIL;
+		return pSHGetSpecialFolderPath(hwnd, pszPath, csidl & ~CSIDL_FLAG_MASK, csidl & CSIDL_FLAG_CREATE) ? S_OK : E_FAIL;
 
 	return E_NOTIMPL;
 }




More information about the Scummvm-git-logs mailing list