Allow access to MS-Windows fonts directory with SAFER

"Russell Lang" <[email protected]> Mon, 22 Nov 2004 07:28:25 +1100
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <41A19519.7254.11E3731C@localhost>
I omitted a few lines from my previous patch to the Ghostscript 
Windows installer to allow the use of CJK Windows TrueType fonts.

Log message:
When using CJK Windows TrueType fonts, add the Windows fonts 
directory to the GS_LIB registry variable to allow access to this
directory when SAFER is used.

Russell Lang                   [email protected]
Ghostgum Software Pty Ltd      http://www.ghostgum.com.au/

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review
wincjk9.txt (application/octet-stream, 988 B)
diff -u l:/cvs/gs/src/dwsetup.cpp src/dwsetup.cpp
--- l:/cvs/gs/src/dwsetup.cpp	Thu Nov 18 06:48:41 2004
+++ src/dwsetup.cpp	Sun Nov 21 20:18:02 2004
@@ -140,6 +140,7 @@
 BOOL install_prog();
 BOOL install_fonts();
 BOOL make_filelist(int argc, char *argv[]);
+int get_font_path(char *path, unsigned int pathlen);
 BOOL write_cidfmap(const char *gspath, const char *cidpath);
 
 
@@ -694,7 +695,7 @@
 	char *regkey1 = "AFPL Ghostscript";
 	char regkey2[16];
 	char szDLL[MAXSTR];
-	char szLIB[MAXSTR];
+	char szLIB[MAXSTR+MAXSTR];
 	char szProgram[MAXSTR];
 	char szArguments[MAXSTR];
 	char szDescription[MAXSTR];
@@ -760,6 +761,10 @@
 	strcat(szLIB, "\\");
 	strcat(szLIB, cinst.GetMainDir());
 	strcat(szLIB, "\\Resource");
+	if (g_bCJKFonts) {
+	    strcat(szLIB, ";");
+	    get_font_path(szLIB+strlen(szLIB), sizeof(szLIB)-strlen(szLIB)-1);
+	}
 	if (!cinst.UpdateRegistryValue(regkey1, regkey2, "GS_LIB", szLIB)) {
 		gs_addmess("Failed to add registry value\n");
 		return FALSE;