Use PFNGETFOLDERPATHA typedef

FARPROC is defined with an empty parameter list, which newer versions of GCC consider equivalent to (void). Compilation fails when qSHGetFolderPath gets called with arguments.
This commit is contained in:
J.Ingram 2025-06-28 13:59:22 -04:00 committed by Tim Angus
parent abc448faec
commit 465f72dcd4

View File

@ -38,6 +38,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <io.h>
#include <conio.h>
#include <wincrypt.h>
#include <shfolder.h>
#include <shlobj.h>
#include <psapi.h>
#include <float.h>
@ -103,7 +104,7 @@ Sys_DefaultHomePath
char *Sys_DefaultHomePath( void )
{
TCHAR szPath[MAX_PATH];
FARPROC qSHGetFolderPath;
PFNSHGETFOLDERPATHA qSHGetFolderPath;
HMODULE shfolder = LoadLibrary("shfolder.dll");
if(shfolder == NULL)
@ -114,7 +115,7 @@ char *Sys_DefaultHomePath( void )
if(!*homePath && com_homepath)
{
qSHGetFolderPath = GetProcAddress(shfolder, "SHGetFolderPathA");
qSHGetFolderPath = (PFNSHGETFOLDERPATHA)GetProcAddress(shfolder, "SHGetFolderPathA");
if(qSHGetFolderPath == NULL)
{
Com_Printf("Unable to find SHGetFolderPath in SHFolder.dll\n");
@ -239,7 +240,7 @@ char* Sys_MicrosoftStorePath(void)
if (!microsoftStorePath[0])
{
TCHAR szPath[MAX_PATH];
FARPROC qSHGetFolderPath;
PFNSHGETFOLDERPATHA qSHGetFolderPath;
HMODULE shfolder = LoadLibrary("shfolder.dll");
if(shfolder == NULL)
@ -248,7 +249,7 @@ char* Sys_MicrosoftStorePath(void)
return microsoftStorePath;
}
qSHGetFolderPath = GetProcAddress(shfolder, "SHGetFolderPathA");
qSHGetFolderPath = (PFNSHGETFOLDERPATHA)GetProcAddress(shfolder, "SHGetFolderPathA");
if(qSHGetFolderPath == NULL)
{
Com_Printf("Unable to find SHGetFolderPath in SHFolder.dll\n");