Commit 7e39d1d1 authored by Alexandre Julliard's avatar Alexandre Julliard

Moved version key to HKCU\Software\Wine.

parent fb99124f
...@@ -191,7 +191,7 @@ static WINDOWS_VERSION forcedWinVersion; /* init value irrelevant */ ...@@ -191,7 +191,7 @@ static WINDOWS_VERSION forcedWinVersion; /* init value irrelevant */
*/ */
static BOOL parse_win_version( HANDLE hkey ) static BOOL parse_win_version( HANDLE hkey )
{ {
static const WCHAR WindowsW[] = {'W','i','n','d','o','w','s',0}; static const WCHAR VersionW[] = {'V','e','r','s','i','o','n',0};
UNICODE_STRING valueW; UNICODE_STRING valueW;
char tmp[64], buffer[50]; char tmp[64], buffer[50];
...@@ -199,7 +199,7 @@ static BOOL parse_win_version( HANDLE hkey ) ...@@ -199,7 +199,7 @@ static BOOL parse_win_version( HANDLE hkey )
DWORD count, len; DWORD count, len;
int i; int i;
RtlInitUnicodeString( &valueW, WindowsW ); RtlInitUnicodeString( &valueW, VersionW );
if (NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp), &count )) if (NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp), &count ))
return FALSE; return FALSE;
...@@ -246,27 +246,25 @@ void VERSION_Init( const WCHAR *appname ) ...@@ -246,27 +246,25 @@ void VERSION_Init( const WCHAR *appname )
{ {
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW; UNICODE_STRING nameW;
HANDLE hkey, config_key; HANDLE root, hkey, config_key;
static const WCHAR configW[] = {'M','a','c','h','i','n','e','\\', static const WCHAR configW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0};
'S','o','f','t','w','a','r','e','\\',
'W','i','n','e','\\',
'W','i','n','e','\\',
'C','o','n','f','i','g',0};
static const WCHAR appdefaultsW[] = {'A','p','p','D','e','f','a','u','l','t','s','\\',0}; static const WCHAR appdefaultsW[] = {'A','p','p','D','e','f','a','u','l','t','s','\\',0};
static const WCHAR versionW[] = {'\\','V','e','r','s','i','o','n',0};
RtlOpenCurrentUser( KEY_ALL_ACCESS, &root );
attr.Length = sizeof(attr); attr.Length = sizeof(attr);
attr.RootDirectory = 0; attr.RootDirectory = root;
attr.ObjectName = &nameW; attr.ObjectName = &nameW;
attr.Attributes = 0; attr.Attributes = 0;
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &nameW, configW ); RtlInitUnicodeString( &nameW, configW );
if (NtOpenKey( &config_key, KEY_ALL_ACCESS, &attr )) return; /* @@ Wine registry key: HKCU\Software\Wine */
attr.RootDirectory = config_key; if (NtOpenKey( &config_key, KEY_ALL_ACCESS, &attr )) config_key = 0;
NtClose( root );
if (!config_key) return;
/* open AppDefaults\\appname\\Version key */ /* open AppDefaults\\appname key */
if (appname && *appname) if (appname && *appname)
{ {
const WCHAR *p; const WCHAR *p;
...@@ -278,11 +276,11 @@ void VERSION_Init( const WCHAR *appname ) ...@@ -278,11 +276,11 @@ void VERSION_Init( const WCHAR *appname )
strcpyW( appversion, appdefaultsW ); strcpyW( appversion, appdefaultsW );
strcatW( appversion, appname ); strcatW( appversion, appname );
strcatW( appversion, versionW );
TRACE( "getting version from %s\n", debugstr_w(appversion) ); TRACE( "getting version from %s\n", debugstr_w(appversion) );
RtlInitUnicodeString( &nameW, appversion ); RtlInitUnicodeString( &nameW, appversion );
attr.RootDirectory = config_key;
/* @@ Wine registry key: HKLM\Software\Wine\Wine\Config\AppDefaults\app.exe\Version */ /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe */
if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
{ {
got_win_ver = parse_win_version( hkey ); got_win_ver = parse_win_version( hkey );
...@@ -292,13 +290,7 @@ void VERSION_Init( const WCHAR *appname ) ...@@ -292,13 +290,7 @@ void VERSION_Init( const WCHAR *appname )
} }
TRACE( "getting default version\n" ); TRACE( "getting default version\n" );
RtlInitUnicodeString( &nameW, versionW + 1 ); parse_win_version( config_key );
/* @@ Wine registry key: HKLM\Software\Wine\Wine\Config\Version */
if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
{
parse_win_version( hkey );
NtClose( hkey );
}
done: done:
NtClose( config_key ); NtClose( config_key );
......
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