Store config file contents in the registry so we only have to load it

once per session.
Replaced PROFILE_EnumerateWineIniSection by PROFILE_EnumWineIniString.
Removed a few unnecessary/unused command-line options.
This commit is contained in:
Alexandre Julliard 2000-02-19 20:50:00 +00:00
parent 67a24c8cfb
commit 00377a78b7
12 changed files with 180 additions and 356 deletions

View file

@ -21,20 +21,10 @@ static int pop_driver(char **, char **, int *);
static int console_initialized = FALSE; static int console_initialized = FALSE;
int CONSOLE_Init(char *drivers) static int CONSOLE_Init(void)
{ {
/* When this function is called drivers should be a string char buffer[256];
that consists of driver names followed by plus (+) signs char *single, *drivers = buffer;
to denote additions.
For example:
drivers = tty Load just the tty driver
drivers = ncurses+xterm Load ncurses then xterm
The "default" value is just tty.
*/
char *single;
int length; int length;
char initial_rows[5]; char initial_rows[5];
char initial_columns[5]; char initial_columns[5];
@ -43,6 +33,18 @@ int CONSOLE_Init(char *drivers)
driver.console_out = stdout; driver.console_out = stdout;
driver.console_in = stdin; driver.console_in = stdin;
/* drivers should be a string that consists of driver names
followed by plus (+) signs to denote additions.
For example:
drivers = tty Load just the tty driver
drivers = ncurses+xterm Load ncurses then xterm
The "default" value is just tty.
*/
PROFILE_GetWineIniString( "console", "Drivers", CONSOLE_DEFAULT_DRIVER,
buffer, sizeof(buffer) );
while (pop_driver(&drivers, &single, &length)) while (pop_driver(&drivers, &single, &length))
{ {
if (!strncmp(single, "tty", length)) if (!strncmp(single, "tty", length))
@ -92,7 +94,7 @@ int CONSOLE_Init(char *drivers)
void CONSOLE_Write(char out, int fg_color, int bg_color, int attribute) void CONSOLE_Write(char out, int fg_color, int bg_color, int attribute)
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.write) if (driver.write)
{ {
@ -111,7 +113,7 @@ void CONSOLE_Close()
void CONSOLE_MoveCursor(char row, char col) void CONSOLE_MoveCursor(char row, char col)
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.moveCursor) if (driver.moveCursor)
{ {
@ -125,7 +127,7 @@ void CONSOLE_ClearWindow(char row1, char col1, char row2, char col2,
int bg_color, int attribute) int bg_color, int attribute)
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.clearWindow) if (driver.clearWindow)
{ {
@ -139,7 +141,7 @@ void CONSOLE_ScrollUpWindow(char row1, char col1, char row2, char col2,
char lines, int bg_color, int attribute) char lines, int bg_color, int attribute)
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.scrollUpWindow) if (driver.scrollUpWindow)
{ {
@ -154,7 +156,7 @@ void CONSOLE_ScrollDownWindow(char row1, char col1, char row2, char col2,
char lines, int bg_color, int attribute) char lines, int bg_color, int attribute)
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.scrollDownWindow) if (driver.scrollDownWindow)
{ {
@ -171,7 +173,7 @@ int CONSOLE_CheckForKeystroke(char *scan, char *ascii)
a conv_* function in int16.c. Yuck. */ a conv_* function in int16.c. Yuck. */
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.checkForKeystroke) if (driver.checkForKeystroke)
return driver.checkForKeystroke(scan, ascii); return driver.checkForKeystroke(scan, ascii);
@ -182,7 +184,7 @@ int CONSOLE_CheckForKeystroke(char *scan, char *ascii)
void CONSOLE_GetKeystroke(char *scan, char *ascii) void CONSOLE_GetKeystroke(char *scan, char *ascii)
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.getKeystroke) if (driver.getKeystroke)
driver.getKeystroke(scan, ascii); driver.getKeystroke(scan, ascii);
@ -191,7 +193,7 @@ void CONSOLE_GetKeystroke(char *scan, char *ascii)
void CONSOLE_GetCursorPosition(char *row, char *col) void CONSOLE_GetCursorPosition(char *row, char *col)
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.getCursorPosition) if (driver.getCursorPosition)
driver.getCursorPosition(row, col); driver.getCursorPosition(row, col);
@ -200,7 +202,7 @@ void CONSOLE_GetCursorPosition(char *row, char *col)
void CONSOLE_GetCharacterAtCursor(char *ch, int *fg, int *bg, int *a) void CONSOLE_GetCharacterAtCursor(char *ch, int *fg, int *bg, int *a)
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.getCharacterAtCursor) if (driver.getCharacterAtCursor)
driver.getCharacterAtCursor(ch, fg, bg, a); driver.getCharacterAtCursor(ch, fg, bg, a);
@ -209,7 +211,7 @@ void CONSOLE_GetCharacterAtCursor(char *ch, int *fg, int *bg, int *a)
void CONSOLE_Refresh() void CONSOLE_Refresh()
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.refresh) if (driver.refresh)
driver.refresh(); driver.refresh();
@ -218,7 +220,7 @@ void CONSOLE_Refresh()
int CONSOLE_AllocColor(int color) int CONSOLE_AllocColor(int color)
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.allocColor) if (driver.allocColor)
return driver.allocColor(color); return driver.allocColor(color);
@ -229,7 +231,7 @@ int CONSOLE_AllocColor(int color)
void CONSOLE_ClearScreen() void CONSOLE_ClearScreen()
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.clearScreen) if (driver.clearScreen)
{ {
@ -242,7 +244,7 @@ void CONSOLE_ClearScreen()
char CONSOLE_GetCharacter() char CONSOLE_GetCharacter()
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
/* I'm not sure if we need this really. This is a function that can be /* I'm not sure if we need this really. This is a function that can be
accelerated that returns the next *non extended* keystroke */ accelerated that returns the next *non extended* keystroke */
@ -255,7 +257,7 @@ char CONSOLE_GetCharacter()
void CONSOLE_ResizeScreen(int x, int y) void CONSOLE_ResizeScreen(int x, int y)
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.resizeScreen) if (driver.resizeScreen)
driver.resizeScreen(x, y); driver.resizeScreen(x, y);
@ -270,7 +272,7 @@ void CONSOLE_NotifyResizeScreen(int x, int y)
void CONSOLE_SetBackgroundColor(int fg, int bg) void CONSOLE_SetBackgroundColor(int fg, int bg)
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.setBackgroundColor) if (driver.setBackgroundColor)
driver.setBackgroundColor(fg, bg); driver.setBackgroundColor(fg, bg);
@ -279,7 +281,7 @@ void CONSOLE_SetBackgroundColor(int fg, int bg)
void CONSOLE_GetBackgroundColor(int *fg, int *bg) void CONSOLE_GetBackgroundColor(int *fg, int *bg)
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
if (driver.getBackgroundColor) if (driver.getBackgroundColor)
driver.getBackgroundColor(fg, bg); driver.getBackgroundColor(fg, bg);
@ -288,7 +290,7 @@ void CONSOLE_GetBackgroundColor(int *fg, int *bg)
void CONSOLE_WriteRawString(char *str) void CONSOLE_WriteRawString(char *str)
{ {
if (!console_initialized) if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list); console_initialized = CONSOLE_Init();
/* This is a special function that is only for internal use and /* This is a special function that is only for internal use and
does not actually call any of the console drivers. It's does not actually call any of the console drivers. It's

View file

@ -91,12 +91,6 @@ For more information, see the
file contained in the source distribution. file contained in the source distribution.
.SH OPTIONS .SH OPTIONS
.TP .TP
.I -backingstore
Turn on backing store
Backingstore stores pixels of obscured window parts off-screen.
This buffer is used to restore these parts faster once they are to reappear,
but it consumes additional memory of course.
.TP
.I -config filename .I -config filename
Use the named configuration file rather than the default Use the named configuration file rather than the default
(@sysconfdir@/wine.conf or ~/.winerc). (@sysconfdir@/wine.conf or ~/.winerc).
@ -212,12 +206,6 @@ Read only files may not be opened in write mode (the default is to
allow opening read-only files for writing, because most Windows allow opening read-only files for writing, because most Windows
programs always request read-write access, even on CD-ROM drives...). programs always request read-write access, even on CD-ROM drives...).
.TP .TP
.I -fixedmap
Use a "standard" color map.
.TP
.I -iconic
Start as an icon
.TP
.I -language xx .I -language xx
Set the language to Set the language to
.I xx .I xx
@ -227,15 +215,6 @@ Set the language to
Create each top-level window as a properly managed X window instead of Create each top-level window as a properly managed X window instead of
creating our own "sticky" window. creating our own "sticky" window.
.TP .TP
.I -mode modename
Determines the mode in which
.B wine
is started. Possible mode names are
.I standard
and
.I enhanced.
Enhanced mode is the default (when no -mode option is specified).
.TP
.I -name name .I -name name
Set the application name Set the application name
.TP .TP

View file

@ -21,11 +21,13 @@
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "winnls.h" #include "winnls.h"
#include "winreg.h"
#include "file.h" #include "file.h"
#include "heap.h" #include "heap.h"
#include "debugtools.h" #include "debugtools.h"
#include "xmalloc.h" #include "xmalloc.h"
#include "options.h" #include "options.h"
#include "server.h"
DEFAULT_DEBUG_CHANNEL(profile); DEFAULT_DEBUG_CHANNEL(profile);
@ -62,8 +64,8 @@ static PROFILE *MRUProfile[N_CACHED_PROFILES]={NULL};
#define CurProfile (MRUProfile[0]) #define CurProfile (MRUProfile[0])
/* wine.ini profile content */ /* wine.ini config file registry root */
static PROFILESECTION *PROFILE_WineProfile; static HKEY wine_profile_key;
#define PROFILE_MAX_LINE_LEN 1024 #define PROFILE_MAX_LINE_LEN 1024
@ -79,7 +81,7 @@ static char PROFILE_WineIniUsed[MAX_PATHNAME_LEN] = "";
#define WINE_INI_GLOBAL ETCDIR "/wine.conf" #define WINE_INI_GLOBAL ETCDIR "/wine.conf"
#define WINE_CONFIG_DIR "/.wine" /* config dir inside $HOME */ #define WINE_CONFIG_DIR "/.wine" /* config dir inside $HOME */
static LPCWSTR wininiW = NULL; static const WCHAR wininiW[] = { 'w','i','n','.','i','n','i',0 };
static CRITICAL_SECTION PROFILE_CritSect; static CRITICAL_SECTION PROFILE_CritSect;
@ -299,6 +301,70 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
} }
/***********************************************************************
* PROFILE_RegistryLoad
*
* Load a profile tree from a file into a registry key.
*/
static DWORD PROFILE_RegistryLoad( HKEY root, FILE *file )
{
HKEY hkey = 0;
DWORD err = 0;
char buffer[PROFILE_MAX_LINE_LEN];
char *p, *p2;
int line = 0;
while (fgets( buffer, PROFILE_MAX_LINE_LEN, file ))
{
line++;
p = buffer;
while (*p && PROFILE_isspace(*p)) p++;
if (*p == '[') /* section start */
{
if (!(p2 = strrchr( p, ']' )))
{
WARN("Invalid section header at line %d: '%s'\n",
line, p );
}
else
{
*p2 = '\0';
p++;
if (hkey) RegCloseKey( hkey );
if ((err = RegCreateKeyExA( root, p, 0, NULL, REG_OPTION_VOLATILE,
KEY_ALL_ACCESS, NULL, &hkey, NULL ))) return err;
TRACE("New section: '%s'\n",p);
continue;
}
}
p2=p+strlen(p) - 1;
while ((p2 > p) && ((*p2 == '\n') || PROFILE_isspace(*p2))) *p2--='\0';
if ((p2 = strchr( p, '=' )) != NULL)
{
char *p3 = p2 - 1;
while ((p3 > p) && PROFILE_isspace(*p3)) *p3-- = '\0';
*p2++ = '\0';
while (*p2 && PROFILE_isspace(*p2)) p2++;
}
if (*p && hkey && !IS_ENTRY_COMMENT(p))
{
if (!p2) p2 = "";
if ((err = RegSetValueExA( hkey, p, 0, REG_SZ, p2, strlen(p2)+1 )))
{
RegCloseKey( hkey );
return err;
}
TRACE("New key: name='%s', value='%s'\n",p,p2);
}
}
if (hkey) RegCloseKey( hkey );
return 0;
}
/*********************************************************************** /***********************************************************************
* PROFILE_DeleteSection * PROFILE_DeleteSection
* *
@ -766,26 +832,45 @@ static BOOL PROFILE_SetString( LPCSTR section_name, LPCSTR key_name,
int PROFILE_GetWineIniString( const char *section, const char *key_name, int PROFILE_GetWineIniString( const char *section, const char *key_name,
const char *def, char *buffer, int len ) const char *def, char *buffer, int len )
{ {
int ret; char tmp[PROFILE_MAX_LINE_LEN];
HKEY hkey;
DWORD err;
EnterCriticalSection( &PROFILE_CritSect ); if (!(err = RegOpenKeyA( wine_profile_key, section, &hkey )))
if (key_name)
{ {
PROFILEKEY *key = PROFILE_Find(&PROFILE_WineProfile, section, key_name, FALSE); DWORD type;
PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def, DWORD count = sizeof(tmp);
len, TRUE ); err = RegQueryValueExA( hkey, key_name, 0, &type, tmp, &count );
TRACE("('%s','%s','%s'): returning '%s'\n", RegCloseKey( hkey );
section, key_name, def, buffer );
ret = strlen( buffer );
}
else
{
ret = PROFILE_GetSection( PROFILE_WineProfile, section, buffer, len, TRUE, FALSE );
} }
LeaveCriticalSection( &PROFILE_CritSect ); PROFILE_CopyEntry( buffer, err ? def : tmp, len, TRUE );
TRACE( "('%s','%s','%s'): returning '%s'\n", section, key_name, def, buffer );
return strlen(buffer);
}
return ret;
/***********************************************************************
* PROFILE_EnumWineIniString
*
* Get a config string from the wine.ini file.
*/
BOOL PROFILE_EnumWineIniString( const char *section, int index,
char *name, int name_len, char *buffer, int len )
{
char tmp[PROFILE_MAX_LINE_LEN];
HKEY hkey;
DWORD err, type;
DWORD count = sizeof(tmp);
if (RegOpenKeyA( wine_profile_key, section, &hkey )) return FALSE;
err = RegEnumValueA( hkey, index, name, (DWORD*)&name_len, NULL, &type, tmp, &count );
RegCloseKey( hkey );
if (!err)
{
PROFILE_CopyEntry( buffer, tmp, len, TRUE );
TRACE( "('%s',%d): returning '%s'='%s'\n", section, index, name, buffer );
}
return !err;
} }
@ -799,87 +884,11 @@ int PROFILE_GetWineIniInt( const char *section, const char *key_name, int def )
char buffer[20]; char buffer[20];
char *p; char *p;
long result; long result;
PROFILEKEY *key;
int ret;
EnterCriticalSection( &PROFILE_CritSect ); PROFILE_GetWineIniString( section, key_name, "", buffer, sizeof(buffer) );
if (!buffer[0]) return def;
key = PROFILE_Find( &PROFILE_WineProfile, section, key_name, FALSE ); result = strtol( buffer, &p, 0 );
if (!key || !key->value) { return (p == buffer) ? 0 /* No digits at all */ : (int)result;
ret = def;
} else {
PROFILE_CopyEntry( buffer, key->value, sizeof(buffer), TRUE );
result = strtol( buffer, &p, 0 );
ret = (p == buffer) ? 0 /* No digits at all */ : (int)result;
}
LeaveCriticalSection( &PROFILE_CritSect );
return ret;
}
/******************************************************************************
*
* int PROFILE_EnumerateWineIniSection(
* char const *section, #Name of the section to enumerate
* void (*cbfn)(char const *key, char const *value, void *user),
* # Address of the callback function
* void *user ) # User-specified pointer.
*
* For each entry in a section in the wine.conf file, this function will
* call the specified callback function, informing it of each key and
* value. An optional user pointer may be passed to it (if this is not
* needed, pass NULL through it and ignore the value in the callback
* function).
*
* The callback function must accept three parameters:
* The name of the key (char const *)
* The value of the key (char const *)
* A user-specified parameter (void *)
* Note that the first two are char CONST *'s, not char *'s! The callback
* MUST not modify these strings!
*
* The return value indicates the number of times the callback function
* was called.
*/
int PROFILE_EnumerateWineIniSection(
char const *section,
void (*cbfn)(char const *, char const *, void *),
void *userptr )
{
PROFILESECTION *scansect;
PROFILEKEY *scankey;
int calls = 0;
EnterCriticalSection( &PROFILE_CritSect );
/* Search for the correct section */
for(scansect = PROFILE_WineProfile; scansect; scansect = scansect->next) {
if(scansect->name && !strcasecmp(scansect->name, section)) {
/* Enumerate each key with the callback */
for(scankey = scansect->key; scankey; scankey = scankey->next) {
/* Ignore blank entries -- these shouldn't exist, but let's
be extra careful */
if (!scankey->name[0]) continue;
if (!scankey->value) cbfn(scankey->name, NULL, userptr);
else
{
char value[1024];
PROFILE_CopyEntry(value, scankey->value, sizeof(value), TRUE);
cbfn(scankey->name, value, userptr);
}
++calls;
}
break;
}
}
LeaveCriticalSection( &PROFILE_CritSect );
return calls;
} }
@ -950,24 +959,29 @@ int PROFILE_LoadWineIni(void)
const char *p; const char *p;
FILE *f; FILE *f;
if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config", 0, NULL,
REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &wine_profile_key, NULL ))
{
ERR("Cannot create config registry key\n" );
return 0;
}
InitializeCriticalSection( &PROFILE_CritSect ); InitializeCriticalSection( &PROFILE_CritSect );
MakeCriticalSectionGlobal( &PROFILE_CritSect ); MakeCriticalSectionGlobal( &PROFILE_CritSect );
if (!CLIENT_IsBootThread()) return 1; /* already loaded */
if ( (Options.configFileName!=NULL) && (f = fopen(Options.configFileName, "r")) ) if ( (Options.configFileName!=NULL) && (f = fopen(Options.configFileName, "r")) )
{ {
/* Open -config specified file */ /* Open -config specified file */
PROFILE_WineProfile = PROFILE_Load ( f);
fclose ( f );
lstrcpynA(PROFILE_WineIniUsed,Options.configFileName,MAX_PATHNAME_LEN); lstrcpynA(PROFILE_WineIniUsed,Options.configFileName,MAX_PATHNAME_LEN);
return 1; goto found;
} }
if ( (p = getenv( "WINE_INI" )) && (f = fopen( p, "r" )) ) if ( (p = getenv( "WINE_INI" )) && (f = fopen( p, "r" )) )
{ {
PROFILE_WineProfile = PROFILE_Load( f );
fclose( f );
lstrcpynA(PROFILE_WineIniUsed,p,MAX_PATHNAME_LEN); lstrcpynA(PROFILE_WineIniUsed,p,MAX_PATHNAME_LEN);
return 1; goto found;
} }
if ((p = getenv( "HOME" )) != NULL) if ((p = getenv( "HOME" )) != NULL)
{ {
@ -975,10 +989,8 @@ int PROFILE_LoadWineIni(void)
strcat( buffer, PROFILE_WineIniName ); strcat( buffer, PROFILE_WineIniName );
if ((f = fopen( buffer, "r" )) != NULL) if ((f = fopen( buffer, "r" )) != NULL)
{ {
PROFILE_WineProfile = PROFILE_Load( f );
fclose( f );
lstrcpynA(PROFILE_WineIniUsed,buffer,MAX_PATHNAME_LEN); lstrcpynA(PROFILE_WineIniUsed,buffer,MAX_PATHNAME_LEN);
return 1; goto found;
} }
} }
else WARN("could not get $HOME value for config file.\n" ); else WARN("could not get $HOME value for config file.\n" );
@ -987,14 +999,17 @@ int PROFILE_LoadWineIni(void)
if ((f = fopen( WINE_INI_GLOBAL, "r" )) != NULL) if ((f = fopen( WINE_INI_GLOBAL, "r" )) != NULL)
{ {
PROFILE_WineProfile = PROFILE_Load( f );
fclose( f );
lstrcpynA(PROFILE_WineIniUsed,WINE_INI_GLOBAL,MAX_PATHNAME_LEN); lstrcpynA(PROFILE_WineIniUsed,WINE_INI_GLOBAL,MAX_PATHNAME_LEN);
return 1; goto found;
} }
MESSAGE( "Can't open configuration file %s or $HOME%s\n", MESSAGE( "Can't open configuration file %s or $HOME%s\n",
WINE_INI_GLOBAL, PROFILE_WineIniName ); WINE_INI_GLOBAL, PROFILE_WineIniName );
return 0; return 0;
found:
PROFILE_RegistryLoad( wine_profile_key, f );
fclose( f );
return 1;
} }
@ -1066,7 +1081,6 @@ UINT WINAPI GetProfileIntA( LPCSTR section, LPCSTR entry, INT def_val )
*/ */
UINT WINAPI GetProfileIntW( LPCWSTR section, LPCWSTR entry, INT def_val ) UINT WINAPI GetProfileIntW( LPCWSTR section, LPCWSTR entry, INT def_val )
{ {
if (!wininiW) wininiW = HEAP_strdupAtoW( GetProcessHeap(), 0, "win.ini" );
return GetPrivateProfileIntW( section, entry, def_val, wininiW ); return GetPrivateProfileIntW( section, entry, def_val, wininiW );
} }
@ -1096,7 +1110,6 @@ INT WINAPI GetProfileStringA( LPCSTR section, LPCSTR entry, LPCSTR def_val,
INT WINAPI GetProfileStringW( LPCWSTR section, LPCWSTR entry, INT WINAPI GetProfileStringW( LPCWSTR section, LPCWSTR entry,
LPCWSTR def_val, LPWSTR buffer, UINT len ) LPCWSTR def_val, LPWSTR buffer, UINT len )
{ {
if (!wininiW) wininiW = HEAP_strdupAtoW( GetProcessHeap(), 0, "win.ini" );
return GetPrivateProfileStringW( section, entry, def_val, return GetPrivateProfileStringW( section, entry, def_val,
buffer, len, wininiW ); buffer, len, wininiW );
} }
@ -1125,7 +1138,6 @@ BOOL WINAPI WriteProfileStringA( LPCSTR section, LPCSTR entry,
BOOL WINAPI WriteProfileStringW( LPCWSTR section, LPCWSTR entry, BOOL WINAPI WriteProfileStringW( LPCWSTR section, LPCWSTR entry,
LPCWSTR string ) LPCWSTR string )
{ {
if (!wininiW) wininiW = HEAP_strdupAtoW( GetProcessHeap(), 0, "win.ini" );
return WritePrivateProfileStringW( section, entry, string, wininiW ); return WritePrivateProfileStringW( section, entry, string, wininiW );
} }
@ -1306,7 +1318,6 @@ INT WINAPI GetProfileSectionA( LPCSTR section, LPSTR buffer, DWORD len )
*/ */
INT WINAPI GetProfileSectionW( LPCWSTR section, LPWSTR buffer, DWORD len ) INT WINAPI GetProfileSectionW( LPCWSTR section, LPWSTR buffer, DWORD len )
{ {
if (!wininiW) wininiW = HEAP_strdupAtoW( GetProcessHeap(), 0, "win.ini" );
return GetPrivateProfileSectionW( section, buffer, len, wininiW ); return GetPrivateProfileSectionW( section, buffer, len, wininiW );
} }
@ -1442,8 +1453,6 @@ BOOL WINAPI WriteProfileSectionA( LPCSTR section, LPCSTR keys_n_values)
*/ */
BOOL WINAPI WriteProfileSectionW( LPCWSTR section, LPCWSTR keys_n_values) BOOL WINAPI WriteProfileSectionW( LPCWSTR section, LPCWSTR keys_n_values)
{ {
if (!wininiW) wininiW = HEAP_strdupAtoW( GetProcessHeap(), 0, "win.ini");
return (WritePrivateProfileSectionW (section,keys_n_values, wininiW)); return (WritePrivateProfileSectionW (section,keys_n_values, wininiW));
} }

View file

@ -382,31 +382,6 @@ static void PSDRV_ReencodeCharWidths(AFM *afm)
return; return;
} }
/***********************************************************
*
* PSDRV_afmfilesCallback
*
* Callback for PROFILE_EnumerateWineIniSection
* Try to parse AFM file `value', alter the CharWidths field of afm struct if
* the font is using AdobeStandardEncoding to correspond to WinANSI, then add
* afm to system font list.
*/
static void PSDRV_afmfilesCallback(char const *key, char const *value,
void *user)
{
AFM *afm;
afm = PSDRV_AFMParse(value);
if(afm) {
if(afm->EncodingScheme &&
!strcmp(afm->EncodingScheme, "AdobeStandardEncoding")) {
PSDRV_ReencodeCharWidths(afm);
}
PSDRV_AddAFMtoList(&PSDRV_AFMFontList, afm);
}
return;
}
/*********************************************************** /***********************************************************
* *
@ -437,7 +412,22 @@ static void PSDRV_DumpFontList(void)
*/ */
BOOL PSDRV_GetFontMetrics(void) BOOL PSDRV_GetFontMetrics(void)
{ {
PROFILE_EnumerateWineIniSection( "afmfiles", PSDRV_afmfilesCallback, NULL); int idx = 0;
char key[256];
char value[256];
while (PROFILE_EnumWineIniString( "afmfiles", idx++, key, sizeof(key), value, sizeof(value)))
{
AFM *afm = PSDRV_AFMParse(value);
if (afm)
{
if(afm->EncodingScheme &&
!strcmp(afm->EncodingScheme, "AdobeStandardEncoding")) {
PSDRV_ReencodeCharWidths(afm);
}
PSDRV_AddAFMtoList(&PSDRV_AFMFontList, afm);
}
}
PSDRV_DumpFontList(); PSDRV_DumpFontList();
return TRUE; return TRUE;
} }

View file

@ -2120,83 +2120,6 @@ static BOOL XFONT_WriteCachedMetrics( int fd, unsigned x_checksum, int x_count,
return FALSE; return FALSE;
} }
/***********************************************************************
* XFONT_CheckIniSection
*
* INIT ONLY
*
* Examines wine.conf for old/invalid font entries and recommend changes to
* the user.
*
* Revision history
* 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation.
*/
static void XFONT_CheckIniCallback(char const *, char const *, void *);
static char const *fontmsgprologue =
"Wine warning:\n"
" The following entries in the [fonts] section of the wine.conf file are\n"
" obsolete or invalid:\n";
static char const *fontmsgepilogue =
" These entries should be eliminated or updated.\n"
" See the documentation/fonts file for more information.\n";
static int XFONT_CheckIniSection(void)
{
int found = 0;
PROFILE_EnumerateWineIniSection("Fonts", &XFONT_CheckIniCallback,
(void *)&found);
if(found)
MESSAGE(fontmsgepilogue);
return 1;
}
static void XFONT_CheckIniCallback(
char const *key,
char const *value,
void *found)
{
/* Ignore any keys that start with potential comment characters "'", '#',
or ';'. */
if(key[0] == '\'' || key[0] == '#' || key[0] == ';' || key[0] == '\0')
return;
/* Make sure this is a valid key */
if((strncasecmp(key, INIAliasSection, 5) == 0) ||
(strncasecmp(key, INIIgnoreSection, 6) == 0) ||
(strcasecmp( key, INIDefault) == 0) ||
(strcasecmp( key, INIDefaultFixed) == 0) ||
(strcasecmp( key, INIGlobalMetrics) == 0) ||
(strcasecmp( key, INIResolution) == 0) ||
(strcasecmp( key, INIDefaultSerif) == 0) ||
(strcasecmp( key, INIDefaultSansSerif) ==0) )
{
/* Valid key; make sure the value doesn't contain a wildcard */
if(strchr(value, '*')) {
if(*(int *)found == 0) {
MESSAGE(fontmsgprologue);
++*(int *)found;
}
MESSAGE(" %s=%s [no wildcards allowed]\n", key, value);
}
}
else {
/* Not a valid key */
if(*(int *)found == 0) {
MESSAGE(fontmsgprologue);
++*(int *)found;
}
MESSAGE(" %s=%s [obsolete]\n", key, value);
}
return;
}
/*********************************************************************** /***********************************************************************
* XFONT_GetPointResolution() * XFONT_GetPointResolution()
* *
@ -2631,8 +2554,6 @@ BOOL X11DRV_FONT_Init( DeviceCaps* pDevCaps )
int i,res, x_count, fd, buf_size; int i,res, x_count, fd, buf_size;
char *buffer; char *buffer;
XFONT_CheckIniSection();
res = XFONT_GetPointResolution( pDevCaps ); res = XFONT_GetPointResolution( pDevCaps );
x_pattern = TSXListFonts(display, "*", MAX_FONTS, &x_count ); x_pattern = TSXListFonts(display, "*", MAX_FONTS, &x_count );

View file

@ -58,7 +58,6 @@ typedef struct CONSOLE_DRIVER
/* Other data */ /* Other data */
int norefresh; int norefresh;
char *driver_list;
FILE *console_out; FILE *console_out;
FILE *console_in; FILE *console_in;
int x_res; int x_res;
@ -69,7 +68,6 @@ typedef struct CONSOLE_DRIVER
extern CONSOLE_device driver; /* Global driver struct */ extern CONSOLE_device driver; /* Global driver struct */
/* Generic defines */ /* Generic defines */
int CONSOLE_Init(char *drivers);
void CONSOLE_Close(void); void CONSOLE_Close(void);
void CONSOLE_Write(char out, int fg_color, int bg_color, int attribute); void CONSOLE_Write(char out, int fg_color, int bg_color, int attribute);
void CONSOLE_MoveCursor(char row, char col); void CONSOLE_MoveCursor(char row, char col);

View file

@ -15,7 +15,6 @@ extern int MAIN_GetLanguageID(char*lang, char*country, char*charset, char*dialec
extern BOOL MAIN_ParseDebugOptions(char *options); extern BOOL MAIN_ParseDebugOptions(char *options);
extern void MAIN_ParseLanguageOption( char *arg ); extern void MAIN_ParseLanguageOption( char *arg );
extern void MAIN_ParseModeOption( char *arg );
extern BOOL RELAY_Init(void); extern BOOL RELAY_Init(void);
extern void THUNK_InitCallout(void); extern void THUNK_InitCallout(void);

View file

@ -51,13 +51,6 @@ typedef struct
extern const WINE_LANGUAGE_DEF Languages[]; extern const WINE_LANGUAGE_DEF Languages[];
/* Supported modes */
typedef enum
{
MODE_STANDARD,
MODE_ENHANCED
} WINE_MODE;
struct options struct options
{ {
int *argc; int *argc;
@ -66,15 +59,10 @@ struct options
char * programName; /* To use when loading resources */ char * programName; /* To use when loading resources */
char *dllFlags; /* -dll flags (hack for Winelib support) */ char *dllFlags; /* -dll flags (hack for Winelib support) */
int usePrivateMap; int usePrivateMap;
int useFixedMap;
int synchronous; /* X synchronous mode */ int synchronous; /* X synchronous mode */
int backingstore; /* Use backing store */
short cmdShow;
int debug; int debug;
int failReadOnly; /* Opening a read only file will fail int failReadOnly; /* Opening a read only file will fail
if write access is requested */ if write access is requested */
WINE_MODE mode; /* Start Wine in selected mode
(standard/enhanced) */
WINE_LANGUAGE language; /* Current language */ WINE_LANGUAGE language; /* Current language */
int managed; /* Managed windows */ int managed; /* Managed windows */
int perfectGraphics; /* Favor correctness over speed for graphics */ int perfectGraphics; /* Favor correctness over speed for graphics */
@ -95,14 +83,10 @@ extern int PROFILE_LoadWineIni(void);
extern void PROFILE_UsageWineIni(void); extern void PROFILE_UsageWineIni(void);
extern int PROFILE_GetWineIniString( const char *section, const char *key_name, extern int PROFILE_GetWineIniString( const char *section, const char *key_name,
const char *def, char *buffer, int len ); const char *def, char *buffer, int len );
extern int PROFILE_GetWineIniInt( const char *section, const char *key_name, extern BOOL PROFILE_EnumWineIniString( const char *section, int index,
int def ); char *name, int name_len, char *buffer, int len );
extern int PROFILE_EnumerateWineIniSection( extern int PROFILE_GetWineIniInt( const char *section, const char *key_name, int def );
char const *section, extern int PROFILE_GetWineIniBool( char const *section, char const *key_name, int def );
void (*callback)(char const *key, char const *name, void *user),
void *userptr );
extern int PROFILE_GetWineIniBool( char const *section, char const *key_name,
int def );
extern char* PROFILE_GetStringItem( char* ); extern char* PROFILE_GetStringItem( char* );
/* Version functions */ /* Version functions */

View file

@ -94,13 +94,9 @@ struct options Options =
NULL, /* programName */ NULL, /* programName */
NULL, /* dllFlags */ NULL, /* dllFlags */
FALSE, /* usePrivateMap */ FALSE, /* usePrivateMap */
FALSE, /* useFixedMap */
FALSE, /* synchronous */ FALSE, /* synchronous */
FALSE, /* backing store */
SW_SHOWNORMAL, /* cmdShow */
FALSE, FALSE,
FALSE, /* failReadOnly */ FALSE, /* failReadOnly */
MODE_ENHANCED, /* Enhanced mode */
#ifdef DEFAULT_LANG #ifdef DEFAULT_LANG
DEFAULT_LANG, /* Default language */ DEFAULT_LANG, /* Default language */
#else #else
@ -122,9 +118,7 @@ static const char szUsage[] =
"Usage: %s [options] \"program_name [arguments]\"\n" "Usage: %s [options] \"program_name [arguments]\"\n"
"\n" "\n"
"Options:\n" "Options:\n"
" -backingstore Turn on backing store\n"
" -config name Specify config file to use\n" " -config name Specify config file to use\n"
" -console driver Select which driver(s) to use for the console\n"
" -debug Enter debugger before starting application\n" " -debug Enter debugger before starting application\n"
" -debugmsg name Turn debugging-messages on or off\n" " -debugmsg name Turn debugging-messages on or off\n"
" -depth n Change the depth to use for multiple-depth screens\n" " -depth n Change the depth to use for multiple-depth screens\n"
@ -132,13 +126,10 @@ static const char szUsage[] =
" -display name Use the specified display\n" " -display name Use the specified display\n"
" -dll name Enable or disable built-in DLLs\n" " -dll name Enable or disable built-in DLLs\n"
" -failreadonly Read only files may not be opened in write mode\n" " -failreadonly Read only files may not be opened in write mode\n"
" -fixedmap Use a \"standard\" color map\n"
" -help Show this help message\n" " -help Show this help message\n"
" -iconic Start as an icon\n"
" -language xx Set the language (one of Br,Ca,Cs,Cy,Da,De,En,Eo,Es,Fi,Fr,Ga,Gd,Gv\n" " -language xx Set the language (one of Br,Ca,Cs,Cy,Da,De,En,Eo,Es,Fi,Fr,Ga,Gd,Gv\n"
" Hu,It,Ko,Kw,Nl,No,Pl,Pt,Sv,Ru,Wa)\n" " Hu,It,Ko,Kw,Nl,No,Pl,Pt,Sv,Ru,Wa)\n"
" -managed Allow the window manager to manage created windows\n" " -managed Allow the window manager to manage created windows\n"
" -mode mode Start Wine in a particular mode (standard or enhanced)\n"
" -name name Set the application name\n" " -name name Set the application name\n"
" -nodga Disable XFree86 DGA extensions\n" " -nodga Disable XFree86 DGA extensions\n"
" -noxshm Disable XSHM extension\n" " -noxshm Disable XSHM extension\n"
@ -718,23 +709,6 @@ void MAIN_ParseLanguageOption( char *arg )
} }
/***********************************************************************
* MAIN_ParseModeOption
*
* Parse -mode option.
*/
void MAIN_ParseModeOption( char *arg )
{
if (!lstrcmpiA("enhanced", arg)) Options.mode = MODE_ENHANCED;
else if (!lstrcmpiA("standard", arg)) Options.mode = MODE_STANDARD;
else
{
MESSAGE( "Invalid mode '%s' specified.\n", arg);
MESSAGE( "Valid modes are: 'standard', 'enhanced' (default).\n");
ExitProcess(1);
}
}
/*********************************************************************** /***********************************************************************
* MAIN_ParseOptions * MAIN_ParseOptions
* *

View file

@ -471,22 +471,7 @@ DWORD WINAPI GetWinFlags16(void)
GetSystemInfo(&si); GetSystemInfo(&si);
/* There doesn't seem to be any Pentium flag. */ /* There doesn't seem to be any Pentium flag. */
result = cpuflags[MIN (si.wProcessorLevel, 4)]; result = cpuflags[MIN (si.wProcessorLevel, 4)] | WF_ENHANCED | WF_PMODE | WF_80x87 | WF_PAGING;
switch(Options.mode)
{
case MODE_STANDARD:
result |= WF_STANDARD | WF_PMODE | WF_80x87;
break;
case MODE_ENHANCED:
result |= WF_ENHANCED | WF_PMODE | WF_80x87 | WF_PAGING;
break;
default:
ERR("Unknown mode set? This shouldn't happen. Check GetWinFlags()!\n");
break;
}
if (si.wProcessorLevel >= 4) result |= WF_HASCPUID; if (si.wProcessorLevel >= 4) result |= WF_HASCPUID;
ovi.dwOSVersionInfoSize = sizeof(ovi); ovi.dwOSVersionInfoSize = sizeof(ovi);
GetVersionExA(&ovi); GetVersionExA(&ovi);

View file

@ -20,7 +20,6 @@
#include <unistd.h> #include <unistd.h>
#include "clipboard.h" #include "clipboard.h"
#include "console.h"
#include "debugtools.h" #include "debugtools.h"
#include "desktop.h" #include "desktop.h"
#include "keyboard.h" #include "keyboard.h"
@ -49,7 +48,6 @@ void X11DRV_USER_RestoreSetup(void);
static XrmOptionDescRec optionsTable[] = static XrmOptionDescRec optionsTable[] =
{ {
{ "-backingstore", ".backingstore", XrmoptionNoArg, (caddr_t)"on" },
{ "-desktop", ".desktop", XrmoptionSepArg, (caddr_t)NULL }, { "-desktop", ".desktop", XrmoptionSepArg, (caddr_t)NULL },
{ "-depth", ".depth", XrmoptionSepArg, (caddr_t)NULL }, { "-depth", ".depth", XrmoptionSepArg, (caddr_t)NULL },
{ "-display", ".display", XrmoptionSepArg, (caddr_t)NULL }, { "-display", ".display", XrmoptionSepArg, (caddr_t)NULL },
@ -58,20 +56,17 @@ static XrmOptionDescRec optionsTable[] =
{ "-name", ".name", XrmoptionSepArg, (caddr_t)NULL }, { "-name", ".name", XrmoptionSepArg, (caddr_t)NULL },
{ "-perfect", ".perfect", XrmoptionNoArg, (caddr_t)"on" }, { "-perfect", ".perfect", XrmoptionNoArg, (caddr_t)"on" },
{ "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" }, { "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" },
{ "-fixedmap", ".fixedmap", XrmoptionNoArg, (caddr_t)"on" },
{ "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" }, { "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" },
{ "-debug", ".debug", XrmoptionNoArg, (caddr_t)"on" }, { "-debug", ".debug", XrmoptionNoArg, (caddr_t)"on" },
{ "-debugmsg", ".debugmsg", XrmoptionSepArg, (caddr_t)NULL }, { "-debugmsg", ".debugmsg", XrmoptionSepArg, (caddr_t)NULL },
{ "-dll", ".dll", XrmoptionSepArg, (caddr_t)NULL }, { "-dll", ".dll", XrmoptionSepArg, (caddr_t)NULL },
{ "-failreadonly", ".failreadonly", XrmoptionNoArg, (caddr_t)"on" }, { "-failreadonly", ".failreadonly", XrmoptionNoArg, (caddr_t)"on" },
{ "-mode", ".mode", XrmoptionSepArg, (caddr_t)NULL },
{ "-managed", ".managed", XrmoptionNoArg, (caddr_t)"off"}, { "-managed", ".managed", XrmoptionNoArg, (caddr_t)"off"},
{ "-winver", ".winver", XrmoptionSepArg, (caddr_t)NULL }, { "-winver", ".winver", XrmoptionSepArg, (caddr_t)NULL },
{ "-config", ".config", XrmoptionSepArg, (caddr_t)NULL }, { "-config", ".config", XrmoptionSepArg, (caddr_t)NULL },
{ "-nodga", ".nodga", XrmoptionNoArg, (caddr_t)"off"}, { "-nodga", ".nodga", XrmoptionNoArg, (caddr_t)"off"},
{ "-noxshm", ".noxshm", XrmoptionNoArg, (caddr_t)"off"}, { "-noxshm", ".noxshm", XrmoptionNoArg, (caddr_t)"off"},
{ "-dxgrab", ".dxgrab", XrmoptionNoArg, (caddr_t)"on" }, { "-dxgrab", ".dxgrab", XrmoptionNoArg, (caddr_t)"on" },
{ "-console", ".console", XrmoptionSepArg, (caddr_t)NULL },
{ "-dosver", ".dosver", XrmoptionSepArg, (caddr_t)NULL } { "-dosver", ".dosver", XrmoptionSepArg, (caddr_t)NULL }
}; };
@ -229,16 +224,10 @@ void X11DRV_USER_ParseOptions(int *argc, char *argv[])
Options.programName, argc, argv ); Options.programName, argc, argv );
/* Get all options */ /* Get all options */
if (X11DRV_USER_GetResource( db, ".iconic", &value ))
Options.cmdShow = SW_SHOWMINIMIZED;
if (X11DRV_USER_GetResource( db, ".privatemap", &value )) if (X11DRV_USER_GetResource( db, ".privatemap", &value ))
Options.usePrivateMap = TRUE; Options.usePrivateMap = TRUE;
if (X11DRV_USER_GetResource( db, ".fixedmap", &value ))
Options.useFixedMap = TRUE;
if (X11DRV_USER_GetResource( db, ".synchronous", &value )) if (X11DRV_USER_GetResource( db, ".synchronous", &value ))
Options.synchronous = TRUE; Options.synchronous = TRUE;
if (X11DRV_USER_GetResource( db, ".backingstore", &value ))
Options.backingstore = TRUE;
if (X11DRV_USER_GetResource( db, ".debug", &value )) if (X11DRV_USER_GetResource( db, ".debug", &value ))
Options.debug = TRUE; Options.debug = TRUE;
if (X11DRV_USER_GetResource( db, ".failreadonly", &value )) if (X11DRV_USER_GetResource( db, ".failreadonly", &value ))
@ -253,8 +242,6 @@ void X11DRV_USER_ParseOptions(int *argc, char *argv[])
MAIN_ParseLanguageOption( (char *)value.addr ); MAIN_ParseLanguageOption( (char *)value.addr );
if (X11DRV_USER_GetResource( db, ".managed", &value)) if (X11DRV_USER_GetResource( db, ".managed", &value))
Options.managed = TRUE; Options.managed = TRUE;
if (X11DRV_USER_GetResource( db, ".mode", &value))
MAIN_ParseModeOption( (char *)value.addr );
if (X11DRV_USER_GetResource( db, ".debugoptions", &value)) if (X11DRV_USER_GetResource( db, ".debugoptions", &value))
MAIN_ParseDebugOptions((char*)value.addr); MAIN_ParseDebugOptions((char*)value.addr);
if (X11DRV_USER_GetResource( db, ".debugmsg", &value)) if (X11DRV_USER_GetResource( db, ".debugmsg", &value))
@ -284,10 +271,6 @@ void X11DRV_USER_ParseOptions(int *argc, char *argv[])
Options.noXSHM = TRUE; Options.noXSHM = TRUE;
if (X11DRV_USER_GetResource( db, ".dxgrab", &value)) if (X11DRV_USER_GetResource( db, ".dxgrab", &value))
Options.DXGrab = TRUE; Options.DXGrab = TRUE;
if (X11DRV_USER_GetResource( db, ".console", &value))
driver.driver_list = xstrdup((char *)value.addr);
else
driver.driver_list = CONSOLE_DEFAULT_DRIVER;
} }
/*********************************************************************** /***********************************************************************

View file

@ -216,7 +216,7 @@ BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO
win_attr.bit_gravity = (classPtr->style & (CS_VREDRAW | CS_HREDRAW)) ? BGForget : BGNorthWest; win_attr.bit_gravity = (classPtr->style & (CS_VREDRAW | CS_HREDRAW)) ? BGForget : BGNorthWest;
win_attr.colormap = X11DRV_PALETTE_PaletteXColormap; win_attr.colormap = X11DRV_PALETTE_PaletteXColormap;
win_attr.backing_store = Options.backingstore ? WhenMapped : NotUseful; win_attr.backing_store = NotUseful;
win_attr.save_under = ((classPtr->style & CS_SAVEBITS) != 0); win_attr.save_under = ((classPtr->style & CS_SAVEBITS) != 0);
win_attr.cursor = X11DRV_MOUSE_XCursor; win_attr.cursor = X11DRV_MOUSE_XCursor;