r909 - in trunk: . code/win32

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Sep 20 12:13:21 EDT 2006


Author: tjw
Date: 2006-09-20 12:13:20 -0400 (Wed, 20 Sep 2006)
New Revision: 909

Modified:
   trunk/Makefile
   trunk/code/win32/win_shared.c
Log:
* (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)


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2006-09-13 23:52:54 UTC (rev 908)
+++ trunk/Makefile	2006-09-20 16:13:20 UTC (rev 909)
@@ -468,7 +468,7 @@
 
   BINEXT=.exe
 
-  LDFLAGS= -mwindows -lshfolder -lwsock32 -lgdi32 -lwinmm -lole32
+  LDFLAGS= -mwindows -lwsock32 -lgdi32 -lwinmm -lole32
   CLIENT_LDFLAGS=
 
   ifeq ($(USE_CURL),1)

Modified: trunk/code/win32/win_shared.c
===================================================================
--- trunk/code/win32/win_shared.c	2006-09-13 23:52:54 UTC (rev 908)
+++ trunk/code/win32/win_shared.c	2006-09-20 16:13:20 UTC (rev 909)
@@ -287,14 +287,32 @@
 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;
+	}
 
-	if( !SUCCEEDED( SHGetFolderPath( NULL, CSIDL_APPDATA,
+	qSHGetFolderPath = GetProcAddress(shfolder, "SHGetFolderPathA");
+	if(qSHGetFolderPath == NULL)
+	{
+		Com_Printf("Unable to find SHGetFolderPath in SHFolder.dll\n");
+		FreeLibrary(shfolder);
+		return NULL;
+	}
+
+	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 )




More information about the quake3-commits mailing list