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

WIN32: Fix missing export errors in Windows 98 #1430

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@SupSuper
Contributor

SupSuper commented Dec 1, 2018

Fixes bug #10613 by replacing API calls not available in Windows 98 with older equivalents.

You still need to compile with SDL 1.2 yourself, but otherwise it works: https://i.imgur.com/MEhve8U.png

@@ -192,7 +190,7 @@ Common::String OSystem_Win32::getScreenshotsPath() {
char picturesPath[MAXPATHLEN];
// Use the My Pictures folder.
if (SHGetFolderPath(NULL, CSIDL_MYPICTURES, NULL, SHGFP_TYPE_CURRENT, picturesPath) != S_OK) {
if (!SHGetSpecialFolderPath(NULL, picturesPath, CSIDL_MYPICTURES, FALSE)) {

This comment has been minimized.

@bluegr

bluegr Dec 1, 2018

Member

This function is marked as unsupported in MSDN

This comment has been minimized.

@SupSuper

SupSuper Dec 1, 2018

Contributor

Well I doubt they support anything 9x era, but from my testing it still works as recently as Windows 10. If you think it's unreliable I can dynamically link to the function instead (a version check isn't enough since Win32 calls are linked at compile-time).

This comment has been minimized.

@bluegr

bluegr Dec 3, 2018

Member

Indeed, it still works, and Microsoft is known to try and keep backwards compatibility with wrapper functions.

This comment has been minimized.

@bluegr

bluegr Dec 3, 2018

Member

And you are correct about the compile-time checks. How would you link dynamically to it?

This comment has been minimized.

@SupSuper

SupSuper Dec 4, 2018

Contributor

You have to use GetProcAddress to get a function pointer instead, you can see an example in the Win32TaskbarManager: https://github.com/scummvm/scummvm/blob/master/backends/taskbar/win32/win32-taskbar.cpp#L381

This comment has been minimized.

@bluegr

bluegr Dec 4, 2018

Member

I believe that this is a good way to tackle this: check if SHGetFolderPath() exists and use it, otherwise fall back to SHGetSpecialFolderPath() for Windows 9x

Show resolved Hide resolved backends/platform/sdl/win32/win32.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment