Removed no longer needed PROFILE_LoadWineIni().
diff --git a/files/profile.c b/files/profile.c
index 525e235..a66c332 100644
--- a/files/profile.c
+++ b/files/profile.c
@@ -83,14 +83,8 @@
#define CurProfile (MRUProfile[0])
-/* wine.ini config file registry root */
-static HKEY wine_profile_key;
-
#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 */
#define IS_ENTRY_COMMENT(str) ((str)[0] == ';')
@@ -897,6 +891,41 @@
/***********************************************************************
+ * 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
*
* Get a config string from the wine.ini file.
@@ -910,7 +939,7 @@
UNICODE_STRING nameW;
attr.Length = sizeof(attr);
- attr.RootDirectory = wine_profile_key;
+ attr.RootDirectory = get_profile_key();
attr.ObjectName = &nameW;
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
@@ -989,54 +1018,6 @@
/***********************************************************************
- * 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
*
* Explain the wine.ini file to those who don't read documentation.
diff --git a/include/file.h b/include/file.h
index 60aed61..d9f8b92 100644
--- a/include/file.h
+++ b/include/file.h
@@ -109,7 +109,6 @@
int skip, WIN32_FIND_DATAA *entry );
/* profile.c */
-extern int PROFILE_LoadWineIni(void);
extern void PROFILE_UsageWineIni(void);
extern int PROFILE_GetWineIniString( LPCWSTR section, LPCWSTR key_name,
LPCWSTR def, LPWSTR buffer, int len );
diff --git a/loader/main.c b/loader/main.c
index 12dd29f..8e23805 100644
--- a/loader/main.c
+++ b/loader/main.c
@@ -67,9 +67,6 @@
setbuf(stderr,NULL);
setlocale(LC_CTYPE,"");
- /* Load the configuration file */
- if (!PROFILE_LoadWineIni()) return FALSE;
-
/* Initialise DOS drives */
if (!DRIVE_Init()) return FALSE;