Removed references to advapi32 registry functions from some of the
kernel functions.
This commit is contained in:
parent
c227edc5c3
commit
81bdcf126f
51
files/file.c
51
files/file.c
|
@ -58,7 +58,6 @@
|
|||
#include "winerror.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winreg.h"
|
||||
#include "winternl.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "wine/server.h"
|
||||
|
@ -947,7 +946,7 @@ BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD attributes)
|
|||
BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD attributes)
|
||||
{
|
||||
UNICODE_STRING filenameW;
|
||||
HANDLE ret = FALSE;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
if (!lpFileName)
|
||||
{
|
||||
|
@ -2495,15 +2494,32 @@ static BOOL FILE_AddBootRenameEntry( LPCWSTR fn1, LPCWSTR fn2, DWORD flags )
|
|||
static const WCHAR ValueName[] = {'P','e','n','d','i','n','g',
|
||||
'F','i','l','e','R','e','n','a','m','e',
|
||||
'O','p','e','r','a','t','i','o','n','s',0};
|
||||
static const WCHAR SessionW[] = {'M','a','c','h','i','n','e','\\',
|
||||
'S','y','s','t','e','m','\\',
|
||||
'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
|
||||
'C','o','n','t','r','o','l','\\',
|
||||
'S','e','s','s','i','o','n',' ','M','a','n','a','g','e','r',0};
|
||||
static const int info_size = FIELD_OFFSET( KEY_VALUE_PARTIAL_INFORMATION, Data );
|
||||
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
KEY_VALUE_PARTIAL_INFORMATION *info;
|
||||
BOOL rc = FALSE;
|
||||
HKEY Reboot = 0;
|
||||
DWORD Type, len0, len1, len2;
|
||||
DWORD len0, len1, len2;
|
||||
DWORD DataSize = 0;
|
||||
BYTE *Buffer = NULL;
|
||||
WCHAR *p;
|
||||
|
||||
if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Session Manager",
|
||||
&Reboot) != ERROR_SUCCESS)
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &nameW, SessionW );
|
||||
|
||||
if (NtCreateKey( &Reboot, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ) != STATUS_SUCCESS)
|
||||
{
|
||||
WARN("Error creating key for reboot managment [%s]\n",
|
||||
"SYSTEM\\CurrentControlSet\\Control\\Session Manager");
|
||||
|
@ -2524,19 +2540,25 @@ static BOOL FILE_AddBootRenameEntry( LPCWSTR fn1, LPCWSTR fn2, DWORD flags )
|
|||
len1 *= sizeof(WCHAR);
|
||||
len2 *= sizeof(WCHAR);
|
||||
|
||||
RtlInitUnicodeString( &nameW, ValueName );
|
||||
|
||||
/* First we check if the key exists and if so how many bytes it already contains. */
|
||||
if (RegQueryValueExW(Reboot, ValueName, NULL, &Type, NULL, &DataSize) == ERROR_SUCCESS)
|
||||
if (NtQueryValueKey( Reboot, &nameW, KeyValuePartialInformation,
|
||||
NULL, 0, &DataSize ) == STATUS_BUFFER_OVERFLOW)
|
||||
{
|
||||
if (Type != REG_MULTI_SZ) goto Quit;
|
||||
if (!(Buffer = HeapAlloc( GetProcessHeap(), 0, DataSize + len1 + len2 + sizeof(WCHAR) ))) goto Quit;
|
||||
if (RegQueryValueExW(Reboot, ValueName, NULL, &Type, Buffer, &DataSize) != ERROR_SUCCESS)
|
||||
if (!(Buffer = HeapAlloc( GetProcessHeap(), 0, DataSize + len1 + len2 + sizeof(WCHAR) )))
|
||||
goto Quit;
|
||||
if (DataSize) DataSize -= sizeof(WCHAR); /* remove terminating null (will be added back later) */
|
||||
if (NtQueryValueKey( Reboot, &nameW, KeyValuePartialInformation,
|
||||
Buffer, DataSize, &DataSize )) goto Quit;
|
||||
info = (KEY_VALUE_PARTIAL_INFORMATION *)Buffer;
|
||||
if (info->Type != REG_MULTI_SZ) goto Quit;
|
||||
if (DataSize > sizeof(info)) DataSize -= sizeof(WCHAR); /* remove terminating null (will be added back later) */
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(Buffer = HeapAlloc( GetProcessHeap(), 0, len1 + len2 + sizeof(WCHAR) ))) goto Quit;
|
||||
DataSize = 0;
|
||||
DataSize = info_size;
|
||||
if (!(Buffer = HeapAlloc( GetProcessHeap(), 0, DataSize + len1 + len2 + sizeof(WCHAR) )))
|
||||
goto Quit;
|
||||
}
|
||||
|
||||
p = (WCHAR *)(Buffer + DataSize);
|
||||
|
@ -2563,10 +2585,11 @@ static BOOL FILE_AddBootRenameEntry( LPCWSTR fn1, LPCWSTR fn2, DWORD flags )
|
|||
p = (WCHAR *)(Buffer + DataSize);
|
||||
*p = 0;
|
||||
DataSize += sizeof(WCHAR);
|
||||
rc = !RegSetValueExW( Reboot, ValueName, 0, REG_MULTI_SZ, Buffer, DataSize );
|
||||
|
||||
rc = !NtSetValueKey(Reboot, &nameW, 0, REG_MULTI_SZ, Buffer + info_size, DataSize - info_size);
|
||||
|
||||
Quit:
|
||||
if (Reboot) RegCloseKey(Reboot);
|
||||
if (Reboot) NtClose(Reboot);
|
||||
if (Buffer) HeapFree( GetProcessHeap(), 0, Buffer );
|
||||
return(rc);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "winerror.h"
|
||||
#include "winternl.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "winreg.h"
|
||||
#include "drive.h"
|
||||
#include "file.h"
|
||||
#include "heap.h"
|
||||
|
@ -972,19 +971,34 @@ static BOOL PROFILE_SetString( LPCWSTR section_name, LPCWSTR key_name,
|
|||
int PROFILE_GetWineIniString( LPCWSTR section, LPCWSTR key_name,
|
||||
LPCWSTR def, LPWSTR buffer, int len )
|
||||
{
|
||||
WCHAR tmp[PROFILE_MAX_LINE_LEN];
|
||||
HKEY hkey;
|
||||
DWORD err;
|
||||
NTSTATUS err;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
|
||||
if (!(err = RegOpenKeyW( wine_profile_key, section, &hkey )))
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = wine_profile_key;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &nameW, section );
|
||||
if (!(err = NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )))
|
||||
{
|
||||
DWORD type;
|
||||
DWORD count = sizeof(tmp);
|
||||
err = RegQueryValueExW( hkey, key_name, 0, &type, (LPBYTE)tmp, &count );
|
||||
RegCloseKey( hkey );
|
||||
char tmp[PROFILE_MAX_LINE_LEN*sizeof(WCHAR) + sizeof(KEY_VALUE_PARTIAL_INFORMATION)];
|
||||
DWORD count;
|
||||
|
||||
RtlInitUnicodeString( &nameW, key_name );
|
||||
if (!(err = NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation,
|
||||
tmp, sizeof(tmp), &count )))
|
||||
{
|
||||
WCHAR *str = (WCHAR *)((KEY_VALUE_PARTIAL_INFORMATION *)tmp)->Data;
|
||||
PROFILE_CopyEntry( buffer, str, len, TRUE, TRUE );
|
||||
}
|
||||
NtClose( hkey );
|
||||
}
|
||||
|
||||
PROFILE_CopyEntry( buffer, err ? def : tmp, len, TRUE, TRUE );
|
||||
if (err) PROFILE_CopyEntry( buffer, def, len, TRUE, TRUE );
|
||||
TRACE( "(%s,%s,%s): returning %s\n", debugstr_w(section),
|
||||
debugstr_w(key_name), debugstr_w(def), debugstr_w(buffer) );
|
||||
return strlenW(buffer);
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winreg.h"
|
||||
#include "winerror.h"
|
||||
#include "winternl.h"
|
||||
#include "file.h"
|
||||
#include "module.h"
|
||||
#include "wine/debug.h"
|
||||
|
@ -379,8 +379,16 @@ static BOOL get_list_load_order( const char *module, const struct loadorder_list
|
|||
*/
|
||||
static HKEY open_app_key( const char *module )
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
HKEY hkey, appkey;
|
||||
char buffer[MAX_PATH+16], *appname;
|
||||
static const WCHAR AppDefaultsW[] = {'M','a','c','h','i','n','e','\\',
|
||||
'S','o','f','t','w','a','r','e','\\',
|
||||
'W','i','n','e','\\',
|
||||
'W','i','n','e','\\',
|
||||
'C','o','n','f','i','g','\\',
|
||||
'A','p','p','D','e','f','a','u','l','t','s',0};
|
||||
|
||||
if (!GetModuleFileNameA( 0, buffer, MAX_PATH ))
|
||||
{
|
||||
|
@ -391,13 +399,23 @@ static HKEY open_app_key( const char *module )
|
|||
|
||||
TRACE( "searching '%s' in AppDefaults\\%s\\DllOverrides\n", module, appname );
|
||||
|
||||
if (RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\AppDefaults", &hkey ))
|
||||
return 0;
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &nameW, AppDefaultsW );
|
||||
|
||||
if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) return 0;
|
||||
attr.RootDirectory = hkey;
|
||||
|
||||
/* open AppDefaults\\appname\\DllOverrides key */
|
||||
strcat( appname, "\\DllOverrides" );
|
||||
if (RegOpenKeyA( hkey, appname, &appkey )) appkey = 0;
|
||||
RegCloseKey( hkey );
|
||||
RtlCreateUnicodeStringFromAsciiz( &nameW, appname );
|
||||
if (NtOpenKey( &appkey, KEY_ALL_ACCESS, &attr )) appkey = 0;
|
||||
RtlFreeUnicodeString( &nameW );
|
||||
NtClose( hkey );
|
||||
return appkey;
|
||||
}
|
||||
|
||||
|
@ -409,12 +427,47 @@ static HKEY open_app_key( const char *module )
|
|||
*/
|
||||
static BOOL get_registry_value( HKEY hkey, const char *module, enum loadorder_type lo[] )
|
||||
{
|
||||
UNICODE_STRING valueW;
|
||||
char buffer[80];
|
||||
DWORD count, type;
|
||||
DWORD count;
|
||||
BOOL ret;
|
||||
|
||||
count = sizeof(buffer);
|
||||
if (RegQueryValueExA( hkey, module, NULL, &type, buffer, &count )) return FALSE;
|
||||
return ParseLoadOrder( buffer, lo );
|
||||
RtlCreateUnicodeStringFromAsciiz( &valueW, module );
|
||||
|
||||
if ((ret = !NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation,
|
||||
buffer, sizeof(buffer), &count )))
|
||||
{
|
||||
int i, n = 0;
|
||||
WCHAR *str = (WCHAR *)((KEY_VALUE_PARTIAL_INFORMATION *)buffer)->Data;
|
||||
|
||||
while (*str)
|
||||
{
|
||||
enum loadorder_type type = LOADORDER_INVALID;
|
||||
|
||||
while (*str == ',' || isspaceW(*str)) str++;
|
||||
if (!*str) break;
|
||||
|
||||
switch(tolowerW(*str))
|
||||
{
|
||||
case 'n': type = LOADORDER_DLL; break;
|
||||
case 's': type = LOADORDER_SO; break;
|
||||
case 'b': type = LOADORDER_BI; break;
|
||||
case 0: break; /* end of string */
|
||||
default:
|
||||
ERR("Invalid load order module-type %s, ignored\n", debugstr_w(str));
|
||||
break;
|
||||
}
|
||||
if (type != LOADORDER_INVALID)
|
||||
{
|
||||
for (i = 0; i < n; i++) if (lo[i] == type) break; /* already specified */
|
||||
if (i == n) lo[n++] = type;
|
||||
}
|
||||
while (*str && *str != ',' && !isspaceW(*str)) str++;
|
||||
}
|
||||
lo[n] = LOADORDER_INVALID;
|
||||
}
|
||||
RtlFreeUnicodeString( &valueW );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -484,6 +537,13 @@ BOOL MODULE_GetBuiltinPath( const char *libname, const char *ext, char *filename
|
|||
*/
|
||||
void MODULE_GetLoadOrder( enum loadorder_type loadorder[], const char *path, BOOL win32 )
|
||||
{
|
||||
static const WCHAR DllOverridesW[] = {'M','a','c','h','i','n','e','\\',
|
||||
'S','o','f','t','w','a','r','e','\\',
|
||||
'W','i','n','e','\\',
|
||||
'W','i','n','e','\\',
|
||||
'C','o','n','f','i','g','\\',
|
||||
'D','l','l','O','v','e','r','r','i','d','e','s',0};
|
||||
|
||||
static HKEY std_key = (HKEY)-1; /* key to standard section, cached */
|
||||
HKEY app_key = 0;
|
||||
char *module, *basename;
|
||||
|
@ -547,7 +607,20 @@ void MODULE_GetLoadOrder( enum loadorder_type loadorder[], const char *path, BOO
|
|||
|
||||
/* then explicit module name in standard section */
|
||||
if (std_key == (HKEY)-1)
|
||||
RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\DllOverrides", &std_key );
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &nameW, DllOverridesW );
|
||||
|
||||
if (NtOpenKey( &std_key, KEY_ALL_ACCESS, &attr )) std_key = 0;
|
||||
}
|
||||
|
||||
if (std_key && get_registry_value( std_key, module+1, loadorder ))
|
||||
{
|
||||
|
@ -608,6 +681,6 @@ void MODULE_GetLoadOrder( enum loadorder_type loadorder[], const char *path, BOO
|
|||
|
||||
|
||||
done:
|
||||
if (app_key) RegCloseKey( app_key );
|
||||
if (app_key) NtClose( app_key );
|
||||
HeapFree( GetProcessHeap(), 0, module );
|
||||
}
|
||||
|
|
138
misc/version.c
138
misc/version.c
|
@ -29,14 +29,14 @@
|
|||
#include <stdio.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winreg.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winternl.h"
|
||||
#include "winerror.h"
|
||||
#include "wine/winbase16.h"
|
||||
#include "module.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
#include "winerror.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(ver);
|
||||
|
||||
|
@ -270,77 +270,115 @@ static void VERSION_ParseDosVersion( const char *arg )
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* VERSION_ParseVersion
|
||||
*
|
||||
* Parse the contents of the Version key.
|
||||
*/
|
||||
static void VERSION_ParseVersion( HKEY hkey, BOOL *got_win_ver, BOOL *got_dos_ver )
|
||||
{
|
||||
static const WCHAR WindowsW[] = {'W','i','n','d','o','w','s',0};
|
||||
static const WCHAR DosW[] = {'D','O','S',0};
|
||||
|
||||
UNICODE_STRING valueW;
|
||||
char tmp[64], buffer[50];
|
||||
KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)tmp;
|
||||
DWORD count, len;
|
||||
|
||||
if (!*got_win_ver)
|
||||
{
|
||||
RtlInitUnicodeString( &valueW, WindowsW );
|
||||
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp), &count ))
|
||||
{
|
||||
RtlUnicodeToMultiByteN( buffer, sizeof(buffer)-1, &len,
|
||||
(WCHAR *)info->Data, info->DataLength );
|
||||
buffer[len] = 0;
|
||||
VERSION_ParseWinVersion( buffer );
|
||||
TRACE( "got win version %s\n", WinVersionNames[forcedWinVersion] );
|
||||
*got_win_ver = TRUE;
|
||||
}
|
||||
}
|
||||
if (!*got_dos_ver)
|
||||
{
|
||||
RtlInitUnicodeString( &valueW, DosW );
|
||||
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp), &count ))
|
||||
{
|
||||
RtlUnicodeToMultiByteN( buffer, sizeof(buffer)-1, &len,
|
||||
(WCHAR *)info->Data, info->DataLength );
|
||||
buffer[len] = 0;
|
||||
VERSION_ParseDosVersion( buffer );
|
||||
TRACE( "got dos version %lx\n", VersionData[WIN31].getVersion16 );
|
||||
*got_dos_ver = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* VERSION_Init
|
||||
*/
|
||||
static void VERSION_Init(void)
|
||||
{
|
||||
HKEY hkey, appkey;
|
||||
DWORD count, type;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
HKEY hkey, config_key;
|
||||
BOOL got_win_ver = FALSE, got_dos_ver = FALSE;
|
||||
char buffer[MAX_PATH+16], *appname, *p;
|
||||
WCHAR buffer[MAX_PATH], appversion[MAX_PATH+20], *appname, *p;
|
||||
static BOOL init_done;
|
||||
static const WCHAR configW[] = {'M','a','c','h','i','n','e','\\',
|
||||
'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 versionW[] = {'\\','V','e','r','s','i','o','n',0};
|
||||
|
||||
if (init_done) return;
|
||||
if (!GetModuleFileNameA( 0, buffer, MAX_PATH ))
|
||||
if (!GetModuleFileNameW( 0, buffer, MAX_PATH ))
|
||||
{
|
||||
WARN( "could not get module file name\n" );
|
||||
return;
|
||||
}
|
||||
init_done = TRUE;
|
||||
appname = buffer;
|
||||
if ((p = strrchr( appname, '/' ))) appname = p + 1;
|
||||
if ((p = strrchr( appname, '\\' ))) appname = p + 1;
|
||||
if ((p = strrchrW( appname, '/' ))) appname = p + 1;
|
||||
if ((p = strrchrW( appname, '\\' ))) appname = p + 1;
|
||||
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &nameW, configW );
|
||||
|
||||
if (NtOpenKey( &config_key, KEY_ALL_ACCESS, &attr )) return;
|
||||
attr.RootDirectory = config_key;
|
||||
|
||||
if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\AppDefaults", &hkey ))
|
||||
{
|
||||
/* open AppDefaults\\appname\\Version key */
|
||||
strcat( appname, "\\Version" );
|
||||
if (!RegOpenKeyA( hkey, appname, &appkey ))
|
||||
|
||||
strcpyW( appversion, appdefaultsW );
|
||||
strcatW( appversion, appname );
|
||||
strcatW( appversion, versionW );
|
||||
RtlInitUnicodeString( &nameW, appversion );
|
||||
|
||||
if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
|
||||
{
|
||||
count = sizeof(buffer);
|
||||
if (!RegQueryValueExA( appkey, "Windows", NULL, &type, buffer, &count ))
|
||||
{
|
||||
VERSION_ParseWinVersion( buffer );
|
||||
TRACE( "got app win version %s\n", WinVersionNames[forcedWinVersion] );
|
||||
got_win_ver = TRUE;
|
||||
}
|
||||
count = sizeof(buffer);
|
||||
if (!RegQueryValueExA( appkey, "DOS", NULL, &type, buffer, &count ))
|
||||
{
|
||||
VERSION_ParseDosVersion( buffer );
|
||||
TRACE( "got app dos version %lx\n", VersionData[WIN31].getVersion16 );
|
||||
got_dos_ver = TRUE;
|
||||
}
|
||||
RegCloseKey( appkey );
|
||||
}
|
||||
RegCloseKey( hkey );
|
||||
VERSION_ParseVersion( hkey, &got_win_ver, &got_dos_ver );
|
||||
NtClose( hkey );
|
||||
}
|
||||
|
||||
if (got_win_ver && got_dos_ver) return;
|
||||
if (got_win_ver && got_dos_ver) goto done;
|
||||
|
||||
if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Version", &hkey ))
|
||||
RtlInitUnicodeString( &nameW, versionW + 1 );
|
||||
if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
|
||||
{
|
||||
if (!got_win_ver)
|
||||
{
|
||||
count = sizeof(buffer);
|
||||
if (!RegQueryValueExA( hkey, "Windows", NULL, &type, buffer, &count ))
|
||||
{
|
||||
VERSION_ParseWinVersion( buffer );
|
||||
TRACE( "got default win version %s\n", WinVersionNames[forcedWinVersion] );
|
||||
}
|
||||
}
|
||||
if (!got_dos_ver)
|
||||
{
|
||||
count = sizeof(buffer);
|
||||
if (!RegQueryValueExA( hkey, "DOS", NULL, &type, buffer, &count ))
|
||||
{
|
||||
VERSION_ParseDosVersion( buffer );
|
||||
TRACE( "got default dos version %lx\n", VersionData[WIN31].getVersion16 );
|
||||
}
|
||||
}
|
||||
RegCloseKey( hkey );
|
||||
VERSION_ParseVersion( hkey, &got_win_ver, &got_dos_ver );
|
||||
NtClose( hkey );
|
||||
}
|
||||
|
||||
done:
|
||||
NtClose( config_key );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#include <linux/ppdev.h>
|
||||
|
||||
#include "winerror.h"
|
||||
#include "winreg.h"
|
||||
|
||||
#include "winternl.h"
|
||||
#include "miscemu.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
@ -66,24 +65,49 @@ static int IO_pp_sort(const void *p1,const void *p2)
|
|||
char IO_pp_init(void)
|
||||
{
|
||||
char name[80];
|
||||
char buffer[1024];
|
||||
char buffer[256];
|
||||
HKEY hkey;
|
||||
char temp[256];
|
||||
int i,idx=0,fd,res,userbase,nports=0;
|
||||
char * timeout;
|
||||
char ret=1;
|
||||
int lasterror;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
|
||||
static const WCHAR configW[] = {'M','a','c','h','i','n','e','\\',
|
||||
'S','o','f','t','w','a','r','e','\\',
|
||||
'W','i','n','e','\\',
|
||||
'W','i','n','e','\\',
|
||||
'C','o','n','f','i','g','\\',
|
||||
'p','p','d','e','v',0};
|
||||
|
||||
TRACE("\n");
|
||||
if (RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\ppdev", &hkey ) != ERROR_SUCCESS)
|
||||
return 1;
|
||||
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &nameW, configW );
|
||||
|
||||
if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) return 1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
DWORD type, count = sizeof(buffer), name_len = sizeof(name);
|
||||
DWORD total_size, len;
|
||||
char temp[256];
|
||||
KEY_VALUE_FULL_INFORMATION *info = (KEY_VALUE_FULL_INFORMATION *)temp;
|
||||
|
||||
if (RegEnumValueA( hkey, idx, name, &name_len, NULL, &type, buffer, &count )!= ERROR_SUCCESS)
|
||||
break;
|
||||
if (NtEnumerateValueKey( hkey, idx, KeyValueFullInformation,
|
||||
temp, sizeof(temp), &total_size )) break;
|
||||
if (info->Type != REG_SZ) break;
|
||||
|
||||
RtlUnicodeToMultiByteN( name, sizeof(name)-1, &len, info->Name, info->NameLength );
|
||||
name[len] = 0;
|
||||
RtlUnicodeToMultiByteN( buffer, sizeof(buffer)-1, &len,
|
||||
(WCHAR *)(temp + info->DataOffset), total_size-info->DataOffset );
|
||||
buffer[len] = 0;
|
||||
|
||||
idx++;
|
||||
if(nports >4)
|
||||
|
@ -138,7 +162,7 @@ char IO_pp_init(void)
|
|||
(ioctl(fd,PPRCONTROL,&res))||
|
||||
(ioctl(fd,PPRCONTROL,&res)))
|
||||
{
|
||||
ERR("PPUSER IOCTL not available for parport device %s\n",temp);
|
||||
ERR("PPUSER IOCTL not available for parport device %s\n",buffer);
|
||||
continue;
|
||||
}
|
||||
if (ioctl (fd,PPRELEASE,0))
|
||||
|
@ -172,7 +196,7 @@ char IO_pp_init(void)
|
|||
nports++;
|
||||
}
|
||||
TRACE("found %d ports\n",nports);
|
||||
RegCloseKey( hkey );
|
||||
NtClose( hkey );
|
||||
|
||||
PPDeviceNum= nports;
|
||||
if (nports > 1)
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
|
||||
#include "winnt.h"
|
||||
#include "winternl.h"
|
||||
#include "winreg.h"
|
||||
#include "stackframe.h"
|
||||
#include "module.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(relay);
|
||||
|
@ -45,12 +45,16 @@ const char **debug_snoop_includelist = NULL;
|
|||
*
|
||||
* Build a function list from a ';'-separated string.
|
||||
*/
|
||||
static const char **build_list( const char *buffer )
|
||||
static const char **build_list( const WCHAR *bufferW )
|
||||
{
|
||||
int count = 1;
|
||||
char buffer[1024];
|
||||
const char *p = buffer;
|
||||
const char **ret;
|
||||
|
||||
RtlUnicodeToMultiByteN( buffer, sizeof(buffer), NULL,
|
||||
bufferW, (strlenW(bufferW)+1) * sizeof(WCHAR) );
|
||||
|
||||
while ((p = strchr( p, ';' )))
|
||||
{
|
||||
count++;
|
||||
|
@ -83,41 +87,63 @@ static const char **build_list( const char *buffer )
|
|||
*/
|
||||
void RELAY_InitDebugLists(void)
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING name;
|
||||
char buffer[1024];
|
||||
HKEY hkey;
|
||||
DWORD count, type;
|
||||
DWORD count;
|
||||
WCHAR *str;
|
||||
static const WCHAR configW[] = {'M','a','c','h','i','n','e','\\',
|
||||
'S','o','f','t','w','a','r','e','\\',
|
||||
'W','i','n','e','\\',
|
||||
'W','i','n','e','\\',
|
||||
'C','o','n','f','i','g','\\',
|
||||
'D','e','b','u','g',0};
|
||||
static const WCHAR RelayIncludeW[] = {'R','e','l','a','y','I','n','c','l','u','d','e',0};
|
||||
static const WCHAR RelayExcludeW[] = {'R','e','l','a','y','E','x','c','l','u','d','e',0};
|
||||
static const WCHAR SnoopIncludeW[] = {'S','n','o','o','p','I','n','c','l','u','d','e',0};
|
||||
static const WCHAR SnoopExcludeW[] = {'S','n','o','o','p','E','x','c','l','u','d','e',0};
|
||||
|
||||
if (RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Debug", &hkey )) return;
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &name;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &name, configW );
|
||||
|
||||
count = sizeof(buffer);
|
||||
if (!RegQueryValueExA( hkey, "RelayInclude", NULL, &type, buffer, &count ))
|
||||
if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) return;
|
||||
|
||||
str = (WCHAR *)((KEY_VALUE_PARTIAL_INFORMATION *)buffer)->Data;
|
||||
RtlInitUnicodeString( &name, RelayIncludeW );
|
||||
if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
|
||||
{
|
||||
TRACE("RelayInclude = %s\n", buffer );
|
||||
debug_relay_includelist = build_list( buffer );
|
||||
TRACE("RelayInclude = %s\n", debugstr_w(str) );
|
||||
debug_relay_includelist = build_list( str );
|
||||
}
|
||||
|
||||
count = sizeof(buffer);
|
||||
if (!RegQueryValueExA( hkey, "RelayExclude", NULL, &type, buffer, &count ))
|
||||
RtlInitUnicodeString( &name, RelayExcludeW );
|
||||
if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
|
||||
{
|
||||
TRACE( "RelayExclude = %s\n", buffer );
|
||||
debug_relay_excludelist = build_list( buffer );
|
||||
TRACE( "RelayExclude = %s\n", debugstr_w(str) );
|
||||
debug_relay_excludelist = build_list( str );
|
||||
}
|
||||
|
||||
count = sizeof(buffer);
|
||||
if (!RegQueryValueExA( hkey, "SnoopInclude", NULL, &type, buffer, &count ))
|
||||
RtlInitUnicodeString( &name, SnoopIncludeW );
|
||||
if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
|
||||
{
|
||||
TRACE_(snoop)( "SnoopInclude = %s\n", buffer );
|
||||
debug_snoop_includelist = build_list( buffer );
|
||||
TRACE_(snoop)( "SnoopInclude = %s\n", debugstr_w(str) );
|
||||
debug_snoop_includelist = build_list( str );
|
||||
}
|
||||
|
||||
count = sizeof(buffer);
|
||||
if (!RegQueryValueExA( hkey, "SnoopExclude", NULL, &type, buffer, &count ))
|
||||
RtlInitUnicodeString( &name, SnoopExcludeW );
|
||||
if (!NtQueryValueKey( hkey, &name, KeyValuePartialInformation, buffer, sizeof(buffer), &count ))
|
||||
{
|
||||
TRACE_(snoop)( "SnoopExclude = %s\n", buffer );
|
||||
debug_snoop_excludelist = build_list( buffer );
|
||||
TRACE_(snoop)( "SnoopExclude = %s\n", debugstr_w(str) );
|
||||
debug_snoop_excludelist = build_list( str );
|
||||
}
|
||||
|
||||
RegCloseKey( hkey );
|
||||
NtClose( hkey );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue