Commit 6c8d9171 authored by Alexandre Julliard's avatar Alexandre Julliard

Added a real root key and simplified creation of the HKEY_* special root keys.

Do not prefix all keys with the name of the top key when saving to a file. Try to load $WINEPREFIX/config into the Wine config branch at startup.
parent b8ba8459
......@@ -971,6 +971,7 @@ int PROFILE_LoadWineIni(void)
const char *p;
FILE *f;
HKEY hKeySW;
DWORD disp;
/* make sure HKLM\\Software\\Wine\\Wine exists as non-volatile key */
if (RegCreateKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine", &hKeySW ))
......@@ -980,7 +981,7 @@ int PROFILE_LoadWineIni(void)
}
RegCloseKey( hKeySW );
if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config", 0, NULL,
REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &wine_profile_key, NULL ))
REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &wine_profile_key, &disp ))
{
ERR("Cannot create config registry key\n" );
return 0;
......@@ -1019,11 +1020,23 @@ int PROFILE_LoadWineIni(void)
lstrcpynA(PROFILE_WineIniUsed,WINE_INI_GLOBAL,MAX_PATHNAME_LEN);
goto found;
}
if (disp == REG_OPENED_EXISTING_KEY) return 1; /* loaded by the server */
MESSAGE( "Can't open configuration file %s or $HOME%s\n",
WINE_INI_GLOBAL, PROFILE_WineIniName );
return 0;
found:
if (disp == REG_OPENED_EXISTING_KEY)
{
MESSAGE( "Warning: configuration loaded by the server from %s/config,\n"
" file %s was ignored.\n", get_config_dir(), PROFILE_WineIniUsed );
fclose( f );
return 1;
}
PROFILE_RegistryLoad( wine_profile_key, f );
fclose( f );
return 1;
......
......@@ -76,6 +76,7 @@ int main( int argc, char *argv[] )
setvbuf( stderr, NULL, _IOLBF, 0 );
if (debug_level) fprintf( stderr, "Server: starting (pid=%ld)\n", (long) getpid() );
init_registry();
select_loop();
close_registry();
if (debug_level) fprintf( stderr, "Server: exiting (pid=%ld)\n", (long) getpid() );
......
......@@ -51,7 +51,7 @@ void *mem_alloc( size_t size )
{
void *ptr = malloc( size );
if (ptr) memset( ptr, 0x55, size );
else if (current) set_error( STATUS_NO_MEMORY );
else set_error( STATUS_NO_MEMORY );
return ptr;
}
......@@ -60,7 +60,7 @@ void *memdup( const void *data, size_t len )
{
void *ptr = malloc( len );
if (ptr) memcpy( ptr, data, len );
else if (current) set_error( STATUS_NO_MEMORY );
else set_error( STATUS_NO_MEMORY );
return ptr;
}
......
......@@ -174,6 +174,7 @@ extern int get_page_size(void);
/* registry functions */
extern void init_registry(void);
extern void close_registry(void);
/* atom functions */
......
......@@ -72,6 +72,7 @@ static const struct object_ops master_socket_ops =
struct thread *current = NULL; /* thread handling the current request */
int global_error = 0; /* global error code for when no thread is current */
static struct master_socket *master_socket; /* the master socket object */
......@@ -103,8 +104,7 @@ void fatal_protocol_error( struct thread *thread, const char *err, ... )
}
/* die on a fatal error */
static void fatal_error( const char *err, ... ) WINE_NORETURN;
static void fatal_error( const char *err, ... )
void fatal_error( const char *err, ... )
{
va_list args;
......@@ -116,8 +116,7 @@ static void fatal_error( const char *err, ... )
}
/* die on a fatal error */
static void fatal_perror( const char *err, ... ) WINE_NORETURN;
static void fatal_perror( const char *err, ... )
void fatal_perror( const char *err, ... )
{
va_list args;
......@@ -306,7 +305,7 @@ static void master_socket_destroy( struct object *obj )
}
/* return the configuration directory ($WINEPREFIX or $HOME/.wine) */
static const char *get_config_dir(void)
const char *get_config_dir(void)
{
static char *confdir;
if (!confdir)
......
......@@ -28,6 +28,9 @@ extern void fatal_protocol_error( struct thread *thread,
extern void fatal_protocol_error( struct thread *thread, const char *err, ... );
#endif
extern void fatal_error( const char *err, ... ) WINE_NORETURN;
extern void fatal_perror( const char *err, ... ) WINE_NORETURN;
extern const char *get_config_dir(void);
extern void read_request( struct thread *thread );
extern int write_request( struct thread *thread );
extern void set_reply_fd( struct thread *thread, int pass_fd );
......
......@@ -107,9 +107,10 @@ extern int read_thread_int( struct thread *thread, const int *addr, int *data );
extern int write_thread_int( struct thread *thread, int *addr, int data, unsigned int mask );
extern void *get_thread_ip( struct thread *thread );
extern int global_error; /* global error code for when no thread is current */
static inline int get_error(void) { return current->error; }
static inline void set_error( int err ) { current->error = err; }
static inline int get_error(void) { return current ? current->error : global_error; }
static inline void set_error( int err ) { global_error = err; if (current) current->error = err; }
static inline void clear_error(void) { set_error(0); }
static inline void *get_thread_id( struct thread *thread ) { return thread; }
......
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