Commit c6f9cbaa authored by sof's avatar sof
Browse files

[project @ 2005-03-21 18:04:48 by sof]

__hscore_getFolderPath(): Don't limit ourselves to shell32.dll, look up
  shfolder.dll too.

Merge to STABLE.
parent 6bcf0343
...@@ -67,26 +67,28 @@ __hscore_getFolderPath(HWND hwndOwner, ...@@ -67,26 +67,28 @@ __hscore_getFolderPath(HWND hwndOwner,
static int loaded_dll = 0; static int loaded_dll = 0;
static HMODULE hMod = (HMODULE)NULL; static HMODULE hMod = (HMODULE)NULL;
static HSCORE_GETAPPFOLDERFUNTY funcPtr = NULL; static HSCORE_GETAPPFOLDERFUNTY funcPtr = NULL;
/* The DLLs to try loading entry point from */
char* dlls[] = { "shell32.dll", "shfolder.dll" };
if (loaded_dll < 0) { if (loaded_dll < 0) {
return (-1); return (-1);
} else if (loaded_dll == 0) { } else if (loaded_dll == 0) {
hMod = LoadLibrary("shell32.dll"); int i;
if (hMod == NULL) { for(i=0;i < sizeof(dlls); i++) {
loaded_dll = (-1); hMod = LoadLibrary(dlls[i]);
return (-1); if ( hMod != NULL &&
} else { (funcPtr = (HSCORE_GETAPPFOLDERFUNTY)GetProcAddress(hMod, "SHGetFolderPathA")) ) {
funcPtr = (HSCORE_GETAPPFOLDERFUNTY)GetProcAddress(hMod, "SHGetFolderPathA");
if (!funcPtr) {
loaded_dll = (-1);
return (-1);
} else {
loaded_dll = 1; loaded_dll = 1;
break;
} }
} }
if (loaded_dll == 0) {
loaded_dll = (-1);
return (-1);
}
} }
/* OK, if we got this far the function has been bound */ /* OK, if we got this far the function has been bound */
return (int)funcPtr(hwndOwner,nFolder,hToken,dwFlags,pszPath); return (int)funcPtr(hwndOwner,nFolder,hToken,dwFlags,pszPath);
/* ToDo: unload the DLL? */ /* ToDo: unload the DLL on shutdown? */
} }
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment