Commit 7894c1e8 authored by Alexandre Julliard's avatar Alexandre Julliard

Moved AFM dirs configuration to a single AFMPath key under

HKCU\Software\Wine\Fonts.
parent ab3d0794
...@@ -1172,35 +1172,41 @@ static BOOL ReadAFMDir(LPCSTR dirname) ...@@ -1172,35 +1172,41 @@ static BOOL ReadAFMDir(LPCSTR dirname)
*/ */
BOOL PSDRV_GetType1Metrics(void) BOOL PSDRV_GetType1Metrics(void)
{ {
CHAR name_buf[256], value_buf[256]; static const WCHAR pathW[] = {'A','F','M','P','a','t','h',0};
INT i = 0; HKEY hkey;
HKEY hkey; DWORD len;
DWORD type, name_len, value_len; LPWSTR valueW;
LPSTR valueA, ptr;
/* @@ Wine registry key: HKLM\Software\Wine\Wine\Config\afmdirs */
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
"Software\\Wine\\Wine\\Config\\afmdirs",
0, KEY_READ, &hkey) != ERROR_SUCCESS)
return TRUE;
name_len = sizeof(name_buf); /* @@ Wine registry key: HKCU\Software\Wine\Fonts */
value_len = sizeof(value_buf); if (RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Fonts", &hkey) != ERROR_SUCCESS)
return TRUE;
while (RegEnumValueA(hkey, i++, name_buf, &name_len, NULL, &type, value_buf, if (RegQueryValueExW( hkey, pathW, NULL, NULL, NULL, &len ) == ERROR_SUCCESS)
&value_len) == ERROR_SUCCESS)
{ {
value_buf[sizeof(value_buf) - 1] = '\0'; len += sizeof(WCHAR);
valueW = HeapAlloc( PSDRV_Heap, 0, len );
if (ReadAFMDir(value_buf) == FALSE) if (RegQueryValueExW( hkey, pathW, NULL, NULL, (LPBYTE)valueW, &len ) == ERROR_SUCCESS)
{ {
RegCloseKey(hkey); len = WideCharToMultiByte( CP_UNIXCP, 0, valueW, -1, NULL, 0, NULL, NULL );
return FALSE; valueA = HeapAlloc( PSDRV_Heap, 0, len );
} WideCharToMultiByte( CP_UNIXCP, 0, valueW, -1, valueA, len, NULL, NULL );
TRACE( "got AFM font path %s\n", debugstr_a(valueA) );
/* initialize lengths for new iteration */ ptr = valueA;
while (ptr)
name_len = sizeof(name_buf); {
value_len = sizeof(value_buf); LPSTR next = strchr( ptr, ':' );
if (next) *next++ = 0;
if (!ReadAFMDir( ptr ))
{
RegCloseKey(hkey);
return FALSE;
}
ptr = next;
}
HeapFree( PSDRV_Heap, 0, valueA );
}
HeapFree( PSDRV_Heap, 0, valueW );
} }
RegCloseKey(hkey); RegCloseKey(hkey);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment