Removed no longer needed PROFILE_LoadWineIni().

This commit is contained in:
Alexandre Julliard 2002-11-23 02:24:53 +00:00
parent ab163db7c0
commit 11f361a29c
3 changed files with 36 additions and 59 deletions

View File

@ -83,14 +83,8 @@ static PROFILE *MRUProfile[N_CACHED_PROFILES]={NULL};
#define CurProfile (MRUProfile[0]) #define CurProfile (MRUProfile[0])
/* wine.ini config file registry root */
static HKEY wine_profile_key;
#define PROFILE_MAX_LINE_LEN 1024 #define PROFILE_MAX_LINE_LEN 1024
/* Wine profile: the profile file being used */
static char PROFILE_WineIniUsed[MAX_PATHNAME_LEN] = "";
/* Check for comments in profile */ /* Check for comments in profile */
#define IS_ENTRY_COMMENT(str) ((str)[0] == ';') #define IS_ENTRY_COMMENT(str) ((str)[0] == ';')
@ -896,6 +890,41 @@ static BOOL PROFILE_SetString( LPCWSTR section_name, LPCWSTR key_name,
} }
/***********************************************************************
* get_profile_key
*/
static HKEY get_profile_key(void)
{
static HKEY profile_key;
if (!profile_key)
{
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
HKEY hkey;
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
attr.ObjectName = &nameW;
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
if (!RtlCreateUnicodeStringFromAsciiz( &nameW, "Machine\\Software\\Wine\\Wine\\Config" ) ||
NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, REG_OPTION_VOLATILE, NULL ))
{
ERR("Cannot create config registry key\n" );
ExitProcess( 1 );
}
RtlFreeUnicodeString( &nameW );
if (InterlockedCompareExchangePointer( (void **)&profile_key, hkey, 0 ))
NtClose( hkey ); /* somebody beat us to it */
}
return profile_key;
}
/*********************************************************************** /***********************************************************************
* PROFILE_GetWineIniString * PROFILE_GetWineIniString
* *
@ -910,7 +939,7 @@ int PROFILE_GetWineIniString( LPCWSTR section, LPCWSTR key_name,
UNICODE_STRING nameW; UNICODE_STRING nameW;
attr.Length = sizeof(attr); attr.Length = sizeof(attr);
attr.RootDirectory = wine_profile_key; attr.RootDirectory = get_profile_key();
attr.ObjectName = &nameW; attr.ObjectName = &nameW;
attr.Attributes = 0; attr.Attributes = 0;
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
@ -988,54 +1017,6 @@ int PROFILE_GetWineIniBool( LPCWSTR section, LPCWSTR key_name, int def )
} }
/***********************************************************************
* PROFILE_LoadWineIni
*
* Load the old .winerc file.
*/
int PROFILE_LoadWineIni(void)
{
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
char buffer[MAX_PATHNAME_LEN];
const char *p;
FILE *f;
HKEY hKeySW;
DWORD disp;
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
attr.ObjectName = &nameW;
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
/* make sure HKLM\\Software\\Wine\\Wine exists as non-volatile key */
if (!RtlCreateUnicodeStringFromAsciiz( &nameW, "Machine\\Software\\Wine\\Wine" ) ||
NtCreateKey( &hKeySW, KEY_ALL_ACCESS, &attr, 0, NULL, 0, &disp ))
{
ERR("Cannot create config registry key\n" );
ExitProcess( 1 );
}
RtlFreeUnicodeString( &nameW );
NtClose( hKeySW );
if (!RtlCreateUnicodeStringFromAsciiz( &nameW, "Machine\\Software\\Wine\\Wine\\Config" ) ||
NtCreateKey( &wine_profile_key, KEY_ALL_ACCESS, &attr, 0,
NULL, REG_OPTION_VOLATILE, &disp ))
{
ERR("Cannot create config registry key\n" );
ExitProcess( 1 );
}
RtlFreeUnicodeString( &nameW );
if (disp == REG_OPENED_EXISTING_KEY) return 1; /* loaded by the server */
MESSAGE( "Can't open configuration file %s/config\n", wine_get_config_dir() );
return 0;
}
/*********************************************************************** /***********************************************************************
* PROFILE_UsageWineIni * PROFILE_UsageWineIni
* *

View File

@ -109,7 +109,6 @@ extern int DOSFS_FindNext( const char *path, const char *short_mask,
int skip, WIN32_FIND_DATAA *entry ); int skip, WIN32_FIND_DATAA *entry );
/* profile.c */ /* profile.c */
extern int PROFILE_LoadWineIni(void);
extern void PROFILE_UsageWineIni(void); extern void PROFILE_UsageWineIni(void);
extern int PROFILE_GetWineIniString( LPCWSTR section, LPCWSTR key_name, extern int PROFILE_GetWineIniString( LPCWSTR section, LPCWSTR key_name,
LPCWSTR def, LPWSTR buffer, int len ); LPCWSTR def, LPWSTR buffer, int len );

View File

@ -67,9 +67,6 @@ BOOL MAIN_MainInit(void)
setbuf(stderr,NULL); setbuf(stderr,NULL);
setlocale(LC_CTYPE,""); setlocale(LC_CTYPE,"");
/* Load the configuration file */
if (!PROFILE_LoadWineIni()) return FALSE;
/* Initialise DOS drives */ /* Initialise DOS drives */
if (!DRIVE_Init()) return FALSE; if (!DRIVE_Init()) return FALSE;