aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjw <tjw@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-09-20 16:13:20 +0000
committertjw <tjw@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-09-20 16:13:20 +0000
commit81bedfa3b19da126f355cf7d52489719fe79db71 (patch)
tree04a6db7171db24f89b684846ee31296bf1fbfc72
parenteb07490162d035aafd6256381c089f9135765ccc (diff)
downloadioquake3-aero-81bedfa3b19da126f355cf7d52489719fe79db71.tar.gz
ioquake3-aero-81bedfa3b19da126f355cf7d52489719fe79db71.zip
* (bug 2813) ioquake3 on win32 is no longer linked to SHFolder.dll. instead
it is dynamically loaded at run-time. this means that win95/win98 systems can fail the homepath detection gracefully if they don't have the dll installed (this dll is only provided by Internet Explorer updates on those systems) git-svn-id: svn://svn.icculus.org/quake3/trunk@909 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--Makefile2
-rw-r--r--code/win32/win_shared.c20
2 files changed, 20 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index c4f743b..d556c19 100644
--- a/Makefile
+++ b/Makefile
@@ -468,7 +468,7 @@ ifeq ($(PLATFORM),mingw32)
BINEXT=.exe
- LDFLAGS= -mwindows -lshfolder -lwsock32 -lgdi32 -lwinmm -lole32
+ LDFLAGS= -mwindows -lwsock32 -lgdi32 -lwinmm -lole32
CLIENT_LDFLAGS=
ifeq ($(USE_CURL),1)
diff --git a/code/win32/win_shared.c b/code/win32/win_shared.c
index 5ba8694..f28ff3a 100644
--- a/code/win32/win_shared.c
+++ b/code/win32/win_shared.c
@@ -287,14 +287,32 @@ char *Sys_GetCurrentUser( void )
char *Sys_DefaultHomePath(void) {
TCHAR szPath[MAX_PATH];
static char path[MAX_OSPATH];
+ FARPROC qSHGetFolderPath;
+ HMODULE shfolder = LoadLibrary("shfolder.dll");
+
+ if(shfolder == NULL) {
+ Com_Printf("Unable to load SHFolder.dll\n");
+ return NULL;
+ }
+
+ qSHGetFolderPath = GetProcAddress(shfolder, "SHGetFolderPathA");
+ if(qSHGetFolderPath == NULL)
+ {
+ Com_Printf("Unable to find SHGetFolderPath in SHFolder.dll\n");
+ FreeLibrary(shfolder);
+ return NULL;
+ }
- if( !SUCCEEDED( SHGetFolderPath( NULL, CSIDL_APPDATA,
+ if( !SUCCEEDED( qSHGetFolderPath( NULL, CSIDL_APPDATA,
NULL, 0, szPath ) ) )
{
+ Com_Printf("Unable to detect CSIDL_APPDATA\n");
+ FreeLibrary(shfolder);
return NULL;
}
Q_strncpyz( path, szPath, sizeof(path) );
Q_strcat( path, sizeof(path), "\\Quake3" );
+ FreeLibrary(shfolder);
if( !CreateDirectory( path, NULL ) )
{
if( GetLastError() != ERROR_ALREADY_EXISTS )