Replace PROFILE_* functions by Reg*.
This commit is contained in:
parent
6ae29d6ac0
commit
043f64021d
|
@ -17,8 +17,8 @@
|
||||||
# include <float.h> /* FLT_MAX */
|
# include <float.h> /* FLT_MAX */
|
||||||
#endif
|
#endif
|
||||||
#include "winnt.h" /* HEAP_ZERO_MEMORY */
|
#include "winnt.h" /* HEAP_ZERO_MEMORY */
|
||||||
|
#include "winreg.h"
|
||||||
#include "psdrv.h"
|
#include "psdrv.h"
|
||||||
#include "options.h"
|
|
||||||
#include "debugtools.h"
|
#include "debugtools.h"
|
||||||
#include "heap.h"
|
#include "heap.h"
|
||||||
|
|
||||||
|
@ -977,15 +977,23 @@ static BOOL PSDRV_ReadAFMDir(const char* afmdir) {
|
||||||
|
|
||||||
BOOL PSDRV_GetFontMetrics(void)
|
BOOL PSDRV_GetFontMetrics(void)
|
||||||
{
|
{
|
||||||
int idx = 0;
|
int idx;
|
||||||
char key[256];
|
char key[256];
|
||||||
char value[256];
|
char value[256];
|
||||||
|
HKEY hkey;
|
||||||
|
DWORD type, key_len, value_len;
|
||||||
|
|
||||||
if (PSDRV_GlyphListInit() != 0)
|
if (PSDRV_GlyphListInit() != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
while (PROFILE_EnumWineIniString( "afmfiles", idx++, key, sizeof(key),
|
if(RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\afmfiles",
|
||||||
value, sizeof(value)))
|
0, KEY_READ, &hkey))
|
||||||
|
goto no_afmfiles;
|
||||||
|
|
||||||
|
idx = 0;
|
||||||
|
key_len = sizeof(key);
|
||||||
|
value_len = sizeof(value);
|
||||||
|
while(!RegEnumValueA(hkey, idx++, key, &key_len, NULL, &type, value, &value_len))
|
||||||
{
|
{
|
||||||
AFM* afm = PSDRV_AFMParse(value);
|
AFM* afm = PSDRV_AFMParse(value);
|
||||||
|
|
||||||
|
@ -995,18 +1003,44 @@ BOOL PSDRV_GetFontMetrics(void)
|
||||||
PSDRV_ReencodeCharWidths(afm);
|
PSDRV_ReencodeCharWidths(afm);
|
||||||
}
|
}
|
||||||
if (PSDRV_AddAFMtoList(&PSDRV_AFMFontList, afm) == FALSE) {
|
if (PSDRV_AddAFMtoList(&PSDRV_AFMFontList, afm) == FALSE) {
|
||||||
|
RegCloseKey(hkey);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
WARN("Error parsing %s\n", value);
|
WARN("Error parsing %s\n", value);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (idx = 0; PROFILE_EnumWineIniString ("afmdirs", idx, key, sizeof (key),
|
/* initialize lengths for new iteration */
|
||||||
value, sizeof (value)); ++idx)
|
key_len = sizeof(key);
|
||||||
|
value_len = sizeof(value);
|
||||||
|
}
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
|
||||||
|
no_afmfiles:
|
||||||
|
|
||||||
|
if(RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\afmdirs",
|
||||||
|
0, KEY_READ, &hkey))
|
||||||
|
goto no_afmdirs;
|
||||||
|
|
||||||
|
idx = 0;
|
||||||
|
key_len = sizeof(key);
|
||||||
|
value_len = sizeof(value);
|
||||||
|
while(!RegEnumValueA(hkey, idx++, key, &key_len, NULL, &type, value, &value_len))
|
||||||
|
{
|
||||||
if (PSDRV_ReadAFMDir (value) == FALSE)
|
if (PSDRV_ReadAFMDir (value) == FALSE)
|
||||||
|
{
|
||||||
|
RegCloseKey(hkey);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* initialize lengths for new iteration */
|
||||||
|
key_len = sizeof(key);
|
||||||
|
value_len = sizeof(value);
|
||||||
|
}
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
|
||||||
|
no_afmdirs:
|
||||||
|
|
||||||
PSDRV_IndexGlyphList(); /* So SortFontMetrics will work */
|
PSDRV_IndexGlyphList(); /* So SortFontMetrics will work */
|
||||||
if (SortFontMetrics() == FALSE)
|
if (SortFontMetrics() == FALSE)
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "winreg.h"
|
#include "winreg.h"
|
||||||
#include "winspool.h"
|
#include "winspool.h"
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
#include "options.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_CUPS
|
#ifdef HAVE_CUPS
|
||||||
# include <cups/cups.h>
|
# include <cups/cups.h>
|
||||||
|
@ -468,6 +467,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
|
||||||
HANDLE hPrinter;
|
HANDLE hPrinter;
|
||||||
const char *ppd = NULL;
|
const char *ppd = NULL;
|
||||||
char ppdFileName[256];
|
char ppdFileName[256];
|
||||||
|
HKEY hkey;
|
||||||
|
|
||||||
TRACE("'%s'\n", name);
|
TRACE("'%s'\n", name);
|
||||||
|
|
||||||
|
@ -538,10 +538,16 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
|
||||||
/* Look for a ppd file for this printer in the config file.
|
/* Look for a ppd file for this printer in the config file.
|
||||||
* First look for the names of the printer, then for 'generic'
|
* First look for the names of the printer, then for 'generic'
|
||||||
*/
|
*/
|
||||||
if ((res!=ERROR_SUCCESS) &&
|
if((res != ERROR_SUCCESS) && !RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\ppd", &hkey))
|
||||||
!PROFILE_GetWineIniString("ppd",name,"",ppdFileName,sizeof(ppdFileName)) &&
|
{
|
||||||
!PROFILE_GetWineIniString("ppd","generic","",ppdFileName,sizeof(ppdFileName))
|
DWORD count = sizeof(ppdFileName);
|
||||||
)
|
ppdFileName[0] = 0;
|
||||||
|
if(RegQueryValueExA(hkey, name, 0, &type, ppdFileName, &count) != ERROR_SUCCESS)
|
||||||
|
RegQueryValueExA(hkey, "generic", 0, &type, ppdFileName, &count);
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!ppdFileName[0])
|
||||||
res = ERROR_FILE_NOT_FOUND;
|
res = ERROR_FILE_NOT_FOUND;
|
||||||
else
|
else
|
||||||
res = ERROR_SUCCESS;
|
res = ERROR_SUCCESS;
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "winnt.h"
|
#include "winnt.h"
|
||||||
#include "options.h"
|
#include "winreg.h"
|
||||||
#include "psdrv.h"
|
#include "psdrv.h"
|
||||||
#include "debugtools.h"
|
#include "debugtools.h"
|
||||||
#include "heap.h"
|
#include "heap.h"
|
||||||
|
@ -558,11 +558,13 @@ static BOOL ReadTrueTypeFile(LPCSTR filename)
|
||||||
* that event.
|
* that event.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
BOOL PSDRV_GetTrueTypeMetrics()
|
BOOL PSDRV_GetTrueTypeMetrics(void)
|
||||||
{
|
{
|
||||||
CHAR keybuf[256], namebuf[256];
|
CHAR keybuf[256], namebuf[256];
|
||||||
INT i = 0;
|
INT i = 0;
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
|
HKEY hkey;
|
||||||
|
DWORD type, key_len, name_len;
|
||||||
|
|
||||||
error = FT_Init_FreeType(&library);
|
error = FT_Init_FreeType(&library);
|
||||||
if (error != FT_Err_Ok)
|
if (error != FT_Err_Ok)
|
||||||
|
@ -571,8 +573,13 @@ BOOL PSDRV_GetTrueTypeMetrics()
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (PROFILE_EnumWineIniString("TrueType Font Directories", i++, keybuf,
|
if(RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\TrueType Font Directories",
|
||||||
sizeof(keybuf), namebuf, sizeof(namebuf)))
|
0, KEY_READ, &hkey))
|
||||||
|
goto no_metrics;
|
||||||
|
|
||||||
|
key_len = sizeof(keybuf);
|
||||||
|
name_len = sizeof(namebuf);
|
||||||
|
while(!RegEnumValueA(hkey, i++, keybuf, &key_len, NULL, &type, namebuf, &name_len))
|
||||||
{
|
{
|
||||||
struct dirent *dent;
|
struct dirent *dent;
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
|
@ -614,14 +621,21 @@ BOOL PSDRV_GetTrueTypeMetrics()
|
||||||
{
|
{
|
||||||
ERR("Error reading '%s'\n", namebuf);
|
ERR("Error reading '%s'\n", namebuf);
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
RegCloseKey(hkey);
|
||||||
FT_Done_FreeType(library);
|
FT_Done_FreeType(library);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
|
||||||
|
/* initialize lengths for new iteration */
|
||||||
|
key_len = sizeof(keybuf);
|
||||||
|
name_len = sizeof(namebuf);
|
||||||
}
|
}
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
|
||||||
|
no_metrics:
|
||||||
FT_Done_FreeType(library);
|
FT_Done_FreeType(library);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue