mirror of
git://source.winehq.org/git/wine.git
synced 2024-08-31 10:14:06 +00:00
Removed remaining references to advapi32 registry functions from
kernel functions.
This commit is contained in:
parent
29d48a504f
commit
dafbc3f73f
|
@ -70,6 +70,35 @@ inline static UINT get_lcid_codepage( LCID lcid )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* create_registry_key
|
||||
*
|
||||
* Create the Control Panel\\International registry key.
|
||||
*/
|
||||
inline static HKEY create_registry_key(void)
|
||||
{
|
||||
static const WCHAR intlW[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
|
||||
'I','n','t','e','r','n','a','t','i','o','n','a','l',0};
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
HKEY hkey;
|
||||
|
||||
if (RtlOpenCurrentUser( KEY_ALL_ACCESS, &hkey ) != STATUS_SUCCESS) return 0;
|
||||
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = hkey;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &nameW, intlW );
|
||||
|
||||
if (NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ) != STATUS_SUCCESS) hkey = 0;
|
||||
NtClose( attr.RootDirectory );
|
||||
return hkey;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* update_registry
|
||||
*
|
||||
|
@ -78,20 +107,27 @@ inline static UINT get_lcid_codepage( LCID lcid )
|
|||
*/
|
||||
inline static void update_registry( LCID lcid )
|
||||
{
|
||||
static const WCHAR LocaleW[] = {'L','o','c','a','l','e',0};
|
||||
UNICODE_STRING nameW;
|
||||
char buffer[20];
|
||||
WCHAR bufferW[80];
|
||||
DWORD count = sizeof(buffer);
|
||||
HKEY hkey;
|
||||
|
||||
if (RegCreateKeyExA( HKEY_CURRENT_USER, "Control Panel\\International", 0, NULL,
|
||||
0, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
|
||||
if (!(hkey = create_registry_key()))
|
||||
return; /* don't do anything if we can't create the registry key */
|
||||
|
||||
if (!RegQueryValueExA( hkey, "Locale", NULL, NULL, (LPBYTE)buffer, &count ))
|
||||
RtlInitUnicodeString( &nameW, LocaleW );
|
||||
count = sizeof(bufferW);
|
||||
if (!NtQueryValueKey(hkey, &nameW, KeyValuePartialInformation, (LPBYTE)bufferW, count, &count))
|
||||
{
|
||||
KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)bufferW;
|
||||
RtlUnicodeToMultiByteN( buffer, sizeof(buffer)-1, &count,
|
||||
(WCHAR *)info->Data, info->DataLength );
|
||||
buffer[count] = 0;
|
||||
if (strtol( buffer, NULL, 16 ) == lcid) /* already set correctly */
|
||||
{
|
||||
RegCloseKey( hkey );
|
||||
NtClose( hkey );
|
||||
return;
|
||||
}
|
||||
TRACE( "updating registry, locale changed %s -> %08lx\n", buffer, lcid );
|
||||
|
@ -99,8 +135,9 @@ inline static void update_registry( LCID lcid )
|
|||
else TRACE( "updating registry, locale changed none -> %08lx\n", lcid );
|
||||
|
||||
sprintf( buffer, "%08lx", lcid );
|
||||
RegSetValueExA( hkey, "Locale", 0, REG_SZ, (LPBYTE)buffer, strlen(buffer)+1 );
|
||||
RegCloseKey( hkey );
|
||||
RtlMultiByteToUnicodeN( bufferW, sizeof(bufferW), NULL, buffer, strlen(buffer)+1 );
|
||||
NtSetValueKey( hkey, &nameW, 0, REG_SZ, bufferW, (strlenW(bufferW)+1) * sizeof(WCHAR) );
|
||||
NtClose( hkey );
|
||||
|
||||
#define UPDATE_VALUE(lctype) do { \
|
||||
GetLocaleInfoW( lcid, (lctype)|LOCALE_NOUSEROVERRIDE, bufferW, sizeof(bufferW)/sizeof(WCHAR) ); \
|
||||
|
@ -445,15 +482,14 @@ static INT get_registry_locale_info( LPCWSTR value, LPWSTR buffer, INT len )
|
|||
KEY_VALUE_PARTIAL_INFORMATION *info;
|
||||
static const int info_size = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data);
|
||||
|
||||
if (RegOpenKeyExA( HKEY_CURRENT_USER, "Control Panel\\International", 0, KEY_READ, &hkey))
|
||||
return -1;
|
||||
if (!(hkey = create_registry_key())) return -1;
|
||||
|
||||
RtlInitUnicodeString( &nameW, value );
|
||||
size = info_size + len * sizeof(WCHAR);
|
||||
|
||||
if (!(info = HeapAlloc( GetProcessHeap(), 0, size )))
|
||||
{
|
||||
RegCloseKey( hkey );
|
||||
NtClose( hkey );
|
||||
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
|
||||
return 0;
|
||||
}
|
||||
|
@ -489,7 +525,7 @@ static INT get_registry_locale_info( LPCWSTR value, LPWSTR buffer, INT len )
|
|||
ret = 0;
|
||||
}
|
||||
}
|
||||
RegCloseKey( hkey );
|
||||
NtClose( hkey );
|
||||
HeapFree( GetProcessHeap(), 0, info );
|
||||
return ret;
|
||||
}
|
||||
|
@ -714,11 +750,10 @@ BOOL WINAPI SetLocaleInfoW( LCID lcid, LCTYPE lctype, LPCWSTR data )
|
|||
/* FIXME: profile functions should map to registry */
|
||||
WriteProfileStringW( intlW, value, data );
|
||||
|
||||
if (RegCreateKeyExA( HKEY_CURRENT_USER, "Control Panel\\International", 0, NULL,
|
||||
0, KEY_ALL_ACCESS, NULL, &hkey, NULL )) return FALSE;
|
||||
if (!(hkey = create_registry_key())) return FALSE;
|
||||
RtlInitUnicodeString( &valueW, value );
|
||||
status = NtSetValueKey( hkey, &valueW, 0, REG_SZ, data, (strlenW(data)+1)*sizeof(WCHAR) );
|
||||
RegCloseKey( hkey );
|
||||
NtClose( hkey );
|
||||
|
||||
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
||||
return !status;
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "wingdi.h"
|
||||
#include "wine/winuser16.h"
|
||||
#include "winerror.h"
|
||||
#include "winreg.h"
|
||||
#include "winternl.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "drive.h"
|
||||
|
@ -745,37 +744,53 @@ static BOOL DIR_TryModulePath( LPCWSTR name, DOS_FULL_NAME *full_name, BOOL win3
|
|||
static BOOL DIR_TryAppPath( LPCWSTR name, DOS_FULL_NAME *full_name )
|
||||
{
|
||||
HKEY hkAppPaths = 0, hkApp = 0;
|
||||
WCHAR lpAppName[MAX_PATHNAME_LEN], lpAppPaths[MAX_PATHNAME_LEN];
|
||||
WCHAR buffer[MAX_PATHNAME_LEN], *lpAppPaths;
|
||||
LPWSTR lpFileName;
|
||||
BOOL res = FALSE;
|
||||
DWORD type, count;
|
||||
DWORD count;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
KEY_VALUE_PARTIAL_INFORMATION *info;
|
||||
static const WCHAR PathW[] = {'P','a','t','h',0};
|
||||
static const WCHAR AppPathsW[] = {'M','a','c','h','i','n','e','\\',
|
||||
'S','o','f','t','w','a','r','e','\\',
|
||||
'M','i','c','r','o','s','o','f','t','\\',
|
||||
'W','i','n','d','o','w','s','\\',
|
||||
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
||||
'A','p','p',' ','P','a','t','h','s',0};
|
||||
|
||||
if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths", &hkAppPaths) != ERROR_SUCCESS)
|
||||
return FALSE;
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &nameW, AppPathsW );
|
||||
if (NtOpenKey( &hkAppPaths, KEY_ALL_ACCESS, &attr ) != STATUS_SUCCESS) return FALSE;
|
||||
|
||||
if (!GetModuleFileNameW(0, lpAppName, MAX_PATHNAME_LEN))
|
||||
if (!GetModuleFileNameW(0, buffer, MAX_PATHNAME_LEN))
|
||||
{
|
||||
WARN("huh, module not found ??\n");
|
||||
goto end;
|
||||
}
|
||||
lpFileName = strrchrW(lpAppName, '\\');
|
||||
if (!lpFileName)
|
||||
goto end;
|
||||
lpFileName = strrchrW(buffer, '\\');
|
||||
if (!lpFileName) lpFileName = buffer;
|
||||
else lpFileName++; /* skip '\\' */
|
||||
if (RegOpenKeyW(hkAppPaths, lpFileName, &hkApp) != ERROR_SUCCESS)
|
||||
goto end;
|
||||
count = sizeof(lpAppPaths);
|
||||
if (RegQueryValueExW(hkApp, PathW, 0, &type, (LPBYTE)lpAppPaths, &count) != ERROR_SUCCESS)
|
||||
goto end;
|
||||
TRACE("successfully opened App Paths for %s\n", debugstr_w(lpFileName));
|
||||
|
||||
attr.RootDirectory = hkAppPaths;
|
||||
RtlInitUnicodeString( &nameW, lpFileName );
|
||||
if (NtOpenKey( &hkApp, KEY_ALL_ACCESS, &attr ) != STATUS_SUCCESS) goto end;
|
||||
|
||||
RtlInitUnicodeString( &nameW, PathW );
|
||||
if (NtQueryValueKey( hkApp, &nameW, KeyValuePartialInformation,
|
||||
buffer, sizeof(buffer)-sizeof(WCHAR), &count )) goto end;
|
||||
info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer;
|
||||
lpAppPaths = (WCHAR *)info->Data;
|
||||
lpAppPaths[info->DataLength/sizeof(WCHAR)] = 0;
|
||||
res = DIR_SearchSemicolonedPaths(name, full_name, lpAppPaths);
|
||||
end:
|
||||
if (hkApp)
|
||||
RegCloseKey(hkApp);
|
||||
if (hkAppPaths)
|
||||
RegCloseKey(hkAppPaths);
|
||||
if (hkApp) NtClose(hkApp);
|
||||
if (hkAppPaths) NtClose(hkAppPaths);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
102
misc/cpu.c
102
misc/cpu.c
|
@ -27,15 +27,76 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "winbase.h"
|
||||
#include "winreg.h"
|
||||
#include "winnt.h"
|
||||
#include "winternl.h"
|
||||
#include "winerror.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(reg);
|
||||
|
||||
static BYTE PF[64] = {0,};
|
||||
|
||||
static void create_registry_keys( const SYSTEM_INFO *info )
|
||||
{
|
||||
static const WCHAR SystemW[] = {'M','a','c','h','i','n','e','\\',
|
||||
'H','a','r','d','w','a','r','e','\\',
|
||||
'D','e','s','c','r','i','p','t','i','o','n','\\',
|
||||
'S','y','s','t','e','m',0};
|
||||
static const WCHAR fpuW[] = {'F','l','o','a','t','i','n','g','P','o','i','n','t','P','r','o','c','e','s','s','o','r',0};
|
||||
static const WCHAR cpuW[] = {'C','e','n','t','r','a','l','P','r','o','c','e','s','s','o','r',0};
|
||||
static const WCHAR IdentifierW[] = {'I','d','e','n','t','i','f','i','e','r',0};
|
||||
static const WCHAR SysidW[] = {'A','T',' ','c','o','m','p','a','t','i','b','l','e',0};
|
||||
|
||||
int i;
|
||||
HKEY hkey, system_key, cpu_key;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW, valueW;
|
||||
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
|
||||
RtlInitUnicodeString( &nameW, SystemW );
|
||||
if (NtCreateKey( &system_key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL )) return;
|
||||
|
||||
RtlInitUnicodeString( &valueW, IdentifierW );
|
||||
NtSetValueKey( system_key, &valueW, 0, REG_SZ, SysidW, (strlenW(SysidW)+1) * sizeof(WCHAR) );
|
||||
|
||||
attr.RootDirectory = system_key;
|
||||
RtlInitUnicodeString( &nameW, fpuW );
|
||||
if (!NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL )) NtClose( hkey );
|
||||
|
||||
RtlInitUnicodeString( &nameW, cpuW );
|
||||
if (!NtCreateKey( &cpu_key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
|
||||
{
|
||||
for (i = 0; i < info->dwNumberOfProcessors; i++)
|
||||
{
|
||||
char num[10], id[20];
|
||||
|
||||
attr.RootDirectory = cpu_key;
|
||||
sprintf( num, "%d", i );
|
||||
RtlCreateUnicodeStringFromAsciiz( &nameW, num );
|
||||
if (!NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
|
||||
{
|
||||
WCHAR idW[20];
|
||||
|
||||
sprintf( id, "CPU %ld", info->dwProcessorType );
|
||||
RtlMultiByteToUnicodeN( idW, sizeof(idW), NULL, id, strlen(id)+1 );
|
||||
NtSetValueKey( hkey, &valueW, 0, REG_SZ, idW, (strlenW(idW)+1)*sizeof(WCHAR) );
|
||||
NtClose( hkey );
|
||||
}
|
||||
RtlFreeUnicodeString( &nameW );
|
||||
}
|
||||
NtClose( cpu_key );
|
||||
}
|
||||
NtClose( system_key );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetSystemInfo [KERNEL32.@]
|
||||
*
|
||||
|
@ -62,7 +123,6 @@ VOID WINAPI GetSystemInfo(
|
|||
) {
|
||||
static int cache = 0;
|
||||
static SYSTEM_INFO cachedsi;
|
||||
HKEY xhkey=0,hkey;
|
||||
|
||||
if (cache) {
|
||||
memcpy(si,&cachedsi,sizeof(*si));
|
||||
|
@ -91,23 +151,13 @@ VOID WINAPI GetSystemInfo(
|
|||
|
||||
/* Hmm, reasonable processor feature defaults? */
|
||||
|
||||
/* Create these registry keys for all systems
|
||||
* FPU entry is often empty on Windows, so we don't care either */
|
||||
if ( (RegCreateKeyA(HKEY_LOCAL_MACHINE,"HARDWARE\\DESCRIPTION\\System\\FloatingPointProcessor",&hkey)!=ERROR_SUCCESS)
|
||||
|| (RegCreateKeyA(HKEY_LOCAL_MACHINE,"HARDWARE\\DESCRIPTION\\System\\CentralProcessor",&hkey)!=ERROR_SUCCESS) )
|
||||
{
|
||||
WARN("Unable to write FPU/CPU info to registry\n");
|
||||
}
|
||||
|
||||
#ifdef linux
|
||||
{
|
||||
char buf[20];
|
||||
char line[200];
|
||||
FILE *f = fopen ("/proc/cpuinfo", "r");
|
||||
|
||||
if (!f)
|
||||
return;
|
||||
xhkey = 0;
|
||||
while (fgets(line,200,f)!=NULL) {
|
||||
char *s,*value;
|
||||
|
||||
|
@ -149,10 +199,6 @@ VOID WINAPI GetSystemInfo(
|
|||
break;
|
||||
}
|
||||
}
|
||||
/* set the CPU type of the current processor */
|
||||
sprintf(buf,"CPU %ld",cachedsi.dwProcessorType);
|
||||
if (xhkey)
|
||||
RegSetValueExA(xhkey,"Identifier",0,REG_SZ,buf,strlen(buf));
|
||||
continue;
|
||||
}
|
||||
/* old 2.0 method */
|
||||
|
@ -177,14 +223,6 @@ VOID WINAPI GetSystemInfo(
|
|||
break;
|
||||
}
|
||||
}
|
||||
/* set the CPU type of the current processor
|
||||
* FIXME: someone reported P4 as being set to
|
||||
* " Intel(R) Pentium(R) 4 CPU 1500MHz"
|
||||
* Do we need to do the same ?
|
||||
* */
|
||||
sprintf(buf,"CPU %ld",cachedsi.dwProcessorType);
|
||||
if (xhkey)
|
||||
RegSetValueExA(xhkey,"Identifier",0,REG_SZ,buf,strlen(buf));
|
||||
continue;
|
||||
}
|
||||
if (!strncasecmp(line,"fdiv_bug",strlen("fdiv_bug"))) {
|
||||
|
@ -206,14 +244,6 @@ VOID WINAPI GetSystemInfo(
|
|||
if (sscanf(value,"%d",&x))
|
||||
if (x+1>cachedsi.dwNumberOfProcessors)
|
||||
cachedsi.dwNumberOfProcessors=x+1;
|
||||
|
||||
/* Create a new processor subkey on a multiprocessor
|
||||
* system
|
||||
*/
|
||||
sprintf(buf,"%d",x);
|
||||
if (xhkey)
|
||||
RegCloseKey(xhkey);
|
||||
RegCreateKeyA(hkey,buf,&xhkey);
|
||||
}
|
||||
if (!strncasecmp(line,"stepping",strlen("stepping"))) {
|
||||
int x;
|
||||
|
@ -238,19 +268,15 @@ VOID WINAPI GetSystemInfo(
|
|||
memcpy(si,&cachedsi,sizeof(*si));
|
||||
#else /* linux */
|
||||
FIXME("not yet supported on this system\n");
|
||||
RegCreateKeyA(hkey,"0",&xhkey);
|
||||
RegSetValueExA(xhkey,"Identifier",0,REG_SZ,"CPU 386",strlen("CPU 386"));
|
||||
#endif /* !linux */
|
||||
if (xhkey)
|
||||
RegCloseKey(xhkey);
|
||||
if (hkey)
|
||||
RegCloseKey(hkey);
|
||||
TRACE("<- CPU arch %d, res'd %d, pagesize %ld, minappaddr %p, maxappaddr %p,"
|
||||
" act.cpumask %08lx, numcpus %ld, CPU type %ld, allocgran. %ld, CPU level %d, CPU rev %d\n",
|
||||
si->u.s.wProcessorArchitecture, si->u.s.wReserved, si->dwPageSize,
|
||||
si->lpMinimumApplicationAddress, si->lpMaximumApplicationAddress,
|
||||
si->dwActiveProcessorMask, si->dwNumberOfProcessors, si->dwProcessorType,
|
||||
si->dwAllocationGranularity, si->wProcessorLevel, si->wProcessorRevision);
|
||||
|
||||
create_registry_keys( &cachedsi );
|
||||
}
|
||||
|
||||
|
||||
|
|
240
misc/registry.c
240
misc/registry.c
|
@ -73,6 +73,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(reg);
|
|||
#define SAVE_LOCAL_REGBRANCH_USER_DEFAULT "userdef.reg"
|
||||
#define SAVE_LOCAL_REGBRANCH_LOCAL_MACHINE "system.reg"
|
||||
|
||||
static const WCHAR ClassesRootW[] = {'M','a','c','h','i','n','e','\\',
|
||||
'S','o','f','t','w','a','r','e','\\',
|
||||
'C','l','a','s','s','e','s',0};
|
||||
|
||||
/* _xmalloc [Internal] */
|
||||
static void *_xmalloc( size_t size )
|
||||
{
|
||||
|
@ -309,44 +313,64 @@ struct _w31_valent {
|
|||
/* recursive helper function to display a directory tree [Internal] */
|
||||
void _w31_dumptree(unsigned short idx,unsigned char *txt,struct _w31_tabent *tab,struct _w31_header *head,HKEY hkey,time_t lastmodified, int level)
|
||||
{
|
||||
static const WCHAR classesW[] = {'.','c','l','a','s','s','e','s',0};
|
||||
struct _w31_dirent *dir;
|
||||
struct _w31_keyent *key;
|
||||
struct _w31_valent *val;
|
||||
HKEY subkey = 0;
|
||||
static char tail[400];
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW, valueW;
|
||||
static WCHAR tail[400];
|
||||
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = hkey;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &valueW, NULL );
|
||||
|
||||
while (idx!=0) {
|
||||
dir=(struct _w31_dirent*)&tab[idx];
|
||||
|
||||
if (dir->key_idx) {
|
||||
DWORD len;
|
||||
key = (struct _w31_keyent*)&tab[dir->key_idx];
|
||||
|
||||
memcpy(tail,&txt[key->string_off],key->length);
|
||||
tail[key->length]='\0';
|
||||
RtlMultiByteToUnicodeN( tail, sizeof(tail)-sizeof(WCHAR), &len,
|
||||
&txt[key->string_off], key->length);
|
||||
tail[len/sizeof(WCHAR)] = 0;
|
||||
|
||||
/* all toplevel entries AND the entries in the
|
||||
* toplevel subdirectory belong to \SOFTWARE\Classes
|
||||
*/
|
||||
if (!level && !strcmp(tail,".classes")) {
|
||||
if (!level && !strcmpW(tail,classesW))
|
||||
{
|
||||
_w31_dumptree(dir->child_idx,txt,tab,head,hkey,lastmodified,level+1);
|
||||
idx=dir->sibling_idx;
|
||||
continue;
|
||||
}
|
||||
if (subkey) RegCloseKey( subkey );
|
||||
if (RegCreateKeyA( hkey, tail, &subkey ) != ERROR_SUCCESS) subkey = 0;
|
||||
|
||||
if (subkey) NtClose( subkey );
|
||||
RtlInitUnicodeString( &nameW, tail );
|
||||
if (NtCreateKey( &subkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL )) subkey = 0;
|
||||
|
||||
/* only add if leaf node or valued node */
|
||||
if (dir->value_idx!=0||dir->child_idx==0) {
|
||||
if (dir->value_idx) {
|
||||
DWORD len;
|
||||
val=(struct _w31_valent*)&tab[dir->value_idx];
|
||||
memcpy(tail,&txt[val->string_off],val->length);
|
||||
tail[val->length]='\0';
|
||||
RegSetValueA( subkey, NULL, REG_SZ, tail, 0 );
|
||||
RtlMultiByteToUnicodeN( tail, sizeof(tail) - sizeof(WCHAR), &len,
|
||||
&txt[val->string_off], val->length);
|
||||
tail[len/sizeof(WCHAR)] = 0;
|
||||
NtSetValueKey( subkey, &valueW, 0, REG_SZ, tail, len + sizeof(WCHAR) );
|
||||
}
|
||||
}
|
||||
} else TRACE("strange: no directory key name, idx=%04x\n", idx);
|
||||
_w31_dumptree(dir->child_idx,txt,tab,head,subkey,lastmodified,level+1);
|
||||
idx=dir->sibling_idx;
|
||||
}
|
||||
if (subkey) RegCloseKey( subkey );
|
||||
if (subkey) NtClose( subkey );
|
||||
}
|
||||
|
||||
|
||||
|
@ -356,6 +380,9 @@ void _w31_dumptree(unsigned short idx,unsigned char *txt,struct _w31_tabent *tab
|
|||
void _w31_loadreg(void)
|
||||
{
|
||||
HFILE hf;
|
||||
HKEY root;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
struct _w31_header head;
|
||||
struct _w31_tabent *tab;
|
||||
unsigned char *txt;
|
||||
|
@ -416,7 +443,20 @@ void _w31_loadreg(void)
|
|||
return;
|
||||
}
|
||||
lastmodified = DOSFS_FileTimeToUnixTime(&hfinfo.ftLastWriteTime,NULL);
|
||||
_w31_dumptree(tab[0].w1,txt,tab,&head,HKEY_CLASSES_ROOT,lastmodified,0);
|
||||
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &nameW, ClassesRootW );
|
||||
|
||||
if (!NtCreateKey( &root, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
|
||||
{
|
||||
_w31_dumptree(tab[0].w1,txt,tab,&head,root,lastmodified,0);
|
||||
NtClose( root );
|
||||
}
|
||||
free(tab);
|
||||
free(txt);
|
||||
_lclose(hf);
|
||||
|
@ -1077,42 +1117,61 @@ static void _init_registry_saving( HKEY hkey_users_default )
|
|||
* _allocate_default_keys [Internal]
|
||||
* Registry initialisation, allocates some default keys.
|
||||
*/
|
||||
static void _allocate_default_keys(void) {
|
||||
HKEY hkey;
|
||||
char buf[200];
|
||||
static void _allocate_default_keys(void)
|
||||
{
|
||||
HKEY hkey;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW, valueW;
|
||||
WCHAR computer_name[200];
|
||||
DWORD size = sizeof(computer_name)/sizeof(WCHAR);
|
||||
|
||||
TRACE("(void)\n");
|
||||
static const WCHAR StatDataW[] = {'D','y','n','D','a','t','a','\\',
|
||||
'P','e','r','f','S','t','a','t','s','\\',
|
||||
'S','t','a','t','D','a','t','a',0};
|
||||
static const WCHAR ComputerW[] = {'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','\\',
|
||||
'C','o','m','p','u','t','e','r','N','a','m','e','\\',
|
||||
'C','o','m','p','u','t','e','r','N','a','m','e',0};
|
||||
static const WCHAR ComputerNameW[] = {'C','o','m','p','u','t','e','r','N','a','m','e',0};
|
||||
|
||||
RegCreateKeyA(HKEY_DYN_DATA,"PerfStats\\StatData",&hkey);
|
||||
RegCloseKey(hkey);
|
||||
TRACE("(void)\n");
|
||||
|
||||
/* This was an Open, but since it is called before the real registries
|
||||
are loaded, it was changed to a Create - MTB 980507*/
|
||||
RegCreateKeyA(HKEY_LOCAL_MACHINE,"HARDWARE\\DESCRIPTION\\System",&hkey);
|
||||
RegSetValueExA(hkey,"Identifier",0,REG_SZ,"SystemType WINE",strlen("SystemType WINE"));
|
||||
RegCloseKey(hkey);
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
|
||||
/* \\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion
|
||||
* CurrentVersion
|
||||
* CurrentBuildNumber
|
||||
* CurrentType
|
||||
* string RegisteredOwner
|
||||
* string RegisteredOrganization
|
||||
*
|
||||
*/
|
||||
/* System\\CurrentControlSet\\Services\\SNMP\\Parameters\\RFC1156Agent
|
||||
* string SysContact
|
||||
* string SysLocation
|
||||
* SysServices
|
||||
*/
|
||||
if (-1!=gethostname(buf,200)) {
|
||||
RegCreateKeyA(HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Control\\ComputerName\\ComputerName",&hkey);
|
||||
RegSetValueExA(hkey,"ComputerName",0,REG_SZ,buf,strlen(buf)+1);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
RtlInitUnicodeString( &nameW, StatDataW );
|
||||
if (!NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL )) NtClose( hkey );
|
||||
|
||||
RegCreateKeyA(HKEY_USERS,".Default",&hkey);
|
||||
RegCloseKey(hkey);
|
||||
/* \\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion
|
||||
* CurrentVersion
|
||||
* CurrentBuildNumber
|
||||
* CurrentType
|
||||
* string RegisteredOwner
|
||||
* string RegisteredOrganization
|
||||
*
|
||||
*/
|
||||
/* System\\CurrentControlSet\\Services\\SNMP\\Parameters\\RFC1156Agent
|
||||
* string SysContact
|
||||
* string SysLocation
|
||||
* SysServices
|
||||
*/
|
||||
if (GetComputerNameW( computer_name, &size ))
|
||||
{
|
||||
RtlInitUnicodeString( &nameW, ComputerW );
|
||||
if (!NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
|
||||
{
|
||||
RtlInitUnicodeString( &valueW, ComputerNameW );
|
||||
NtSetValueKey( hkey, &valueW, 0, REG_SZ, computer_name,
|
||||
(strlenW(computer_name) + 1) * sizeof(WCHAR) );
|
||||
NtClose(hkey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define REG_DONTLOAD -1
|
||||
|
@ -1449,9 +1508,26 @@ static void _load_windows_registry( HKEY hkey_users_default )
|
|||
int reg_type;
|
||||
WCHAR windir[MAX_PATHNAME_LEN];
|
||||
WCHAR path[MAX_PATHNAME_LEN];
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
HKEY hkey;
|
||||
|
||||
static const WCHAR WineW[] = {'W','i','n','e',0};
|
||||
static const WCHAR ProfileW[] = {'P','r','o','f','i','l','e',0};
|
||||
static const WCHAR empty_strW[] = { 0 };
|
||||
static const WCHAR Machine[] = {'M','a','c','h','i','n','e',0};
|
||||
static const WCHAR System[] = {'M','a','c','h','i','n','e','\\','S','y','s','t','e','m',0};
|
||||
static const WCHAR Software[] = {'M','a','c','h','i','n','e','\\','S','o','f','t','w','a','r','e',0};
|
||||
static const WCHAR Clone[] = {'M','a','c','h','i','n','e','\\',
|
||||
'S','y','s','t','e','m','\\',
|
||||
'C','l','o','n','e',0};
|
||||
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
|
||||
GetWindowsDirectoryW(windir, MAX_PATHNAME_LEN);
|
||||
|
||||
|
@ -1483,31 +1559,39 @@ static void _load_windows_registry( HKEY hkey_users_default )
|
|||
* FIXME
|
||||
* map HLM\System\ControlSet001 to HLM\System\CurrentControlSet
|
||||
*/
|
||||
|
||||
if (!RegCreateKeyA(HKEY_LOCAL_MACHINE, "SYSTEM", &hkey)) {
|
||||
strcpyW(path, windir);
|
||||
strcatW(path, systemW);
|
||||
_convert_and_load_native_registry(path,hkey,REG_WINNT,1);
|
||||
RegCloseKey(hkey);
|
||||
RtlInitUnicodeString( &nameW, System );
|
||||
if (!NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
|
||||
{
|
||||
strcpyW(path, windir);
|
||||
strcatW(path, systemW);
|
||||
_convert_and_load_native_registry(path,hkey,REG_WINNT,1);
|
||||
NtClose( hkey );
|
||||
}
|
||||
|
||||
if (!RegCreateKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE", &hkey)) {
|
||||
RtlInitUnicodeString( &nameW, Software );
|
||||
if (!NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
|
||||
{
|
||||
strcpyW(path, windir);
|
||||
strcatW(path, softwareW);
|
||||
_convert_and_load_native_registry(path,hkey,REG_WINNT,1);
|
||||
RegCloseKey(hkey);
|
||||
NtClose( hkey );
|
||||
}
|
||||
|
||||
strcpyW(path, windir);
|
||||
strcatW(path, samW);
|
||||
_convert_and_load_native_registry(path,HKEY_LOCAL_MACHINE,REG_WINNT,0);
|
||||
RtlInitUnicodeString( &nameW, Machine );
|
||||
if (!NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
|
||||
{
|
||||
strcpyW(path, windir);
|
||||
strcatW(path, samW);
|
||||
_convert_and_load_native_registry(path,hkey,REG_WINNT,0);
|
||||
|
||||
strcpyW(path,windir);
|
||||
strcatW(path, securityW);
|
||||
_convert_and_load_native_registry(path,HKEY_LOCAL_MACHINE,REG_WINNT,0);
|
||||
strcpyW(path,windir);
|
||||
strcatW(path, securityW);
|
||||
_convert_and_load_native_registry(path,hkey,REG_WINNT,0);
|
||||
NtClose( hkey );
|
||||
}
|
||||
|
||||
/* this key is generated when the nt-core booted successfully */
|
||||
if (!RegCreateKeyA(HKEY_LOCAL_MACHINE,"System\\Clone",&hkey)) RegCloseKey(hkey);
|
||||
RtlInitUnicodeString( &nameW, Clone );
|
||||
if (!NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL )) NtClose( hkey );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1518,15 +1602,25 @@ static void _load_windows_registry( HKEY hkey_users_default )
|
|||
static const WCHAR classes_datW[] = {'\\','c','l','a','s','s','e','s','.','d','a','t',0};
|
||||
static const WCHAR user_datW[] = {'\\','u','s','e','r','.','d','a','t',0};
|
||||
|
||||
_convert_and_load_native_registry(system_1stW,HKEY_LOCAL_MACHINE,REG_WIN95,0);
|
||||
RtlInitUnicodeString( &nameW, Machine );
|
||||
if (!NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
|
||||
{
|
||||
_convert_and_load_native_registry(system_1stW,hkey,REG_WIN95,0);
|
||||
|
||||
strcpyW(path, windir);
|
||||
strcatW(path, system_datW);
|
||||
_convert_and_load_native_registry(path,HKEY_LOCAL_MACHINE,REG_WIN95,0);
|
||||
strcpyW(path, windir);
|
||||
strcatW(path, system_datW);
|
||||
_convert_and_load_native_registry(path,hkey,REG_WIN95,0);
|
||||
NtClose( hkey );
|
||||
}
|
||||
|
||||
strcpyW(path, windir);
|
||||
strcatW(path, classes_datW);
|
||||
_convert_and_load_native_registry(path,HKEY_CLASSES_ROOT,REG_WIN95,0);
|
||||
RtlInitUnicodeString( &nameW, ClassesRootW );
|
||||
if (!NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
|
||||
{
|
||||
strcpyW(path, windir);
|
||||
strcatW(path, classes_datW);
|
||||
_convert_and_load_native_registry(path,hkey,REG_WIN95,0);
|
||||
NtClose( hkey );
|
||||
}
|
||||
|
||||
if (PROFILE_GetWineIniString(WineW, ProfileW, empty_strW, path, MAX_PATHNAME_LEN)) {
|
||||
/* user specific user.dat */
|
||||
|
@ -1600,6 +1694,10 @@ static void _load_home_registry( HKEY hkey_users_default )
|
|||
void SHELL_LoadRegistry( void )
|
||||
{
|
||||
HKEY hkey_users_default;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
|
||||
static const WCHAR DefaultW[] = {'U','s','e','r','\\','.','D','e','f','a','u','l','t',0};
|
||||
static const WCHAR RegistryW[] = {'R','e','g','i','s','t','r','y',0};
|
||||
static const WCHAR load_win_reg_filesW[] = {'L','o','a','d','W','i','n','d','o','w','s','R','e','g','i','s','t','r','y','F','i','l','e','s',0};
|
||||
static const WCHAR load_global_reg_filesW[] = {'L','o','a','d','G','l','o','b','a','l','R','e','g','i','s','t','r','y','F','i','l','e','s',0};
|
||||
|
@ -1609,14 +1707,22 @@ void SHELL_LoadRegistry( void )
|
|||
|
||||
if (!CLIENT_IsBootThread()) return; /* already loaded */
|
||||
|
||||
if (RegCreateKeyA(HKEY_USERS,".Default",&hkey_users_default))
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
|
||||
RtlInitUnicodeString( &nameW, DefaultW );
|
||||
if (NtCreateKey( &hkey_users_default, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
|
||||
{
|
||||
ERR("Cannot create HKEY_USERS/.Default\n" );
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
_allocate_default_keys();
|
||||
_set_registry_levels(0,0,0);
|
||||
_allocate_default_keys();
|
||||
if (PROFILE_GetWineIniBool(RegistryW, load_win_reg_filesW, 1))
|
||||
_load_windows_registry( hkey_users_default );
|
||||
if (PROFILE_GetWineIniBool(RegistryW, load_global_reg_filesW, 1))
|
||||
|
|
|
@ -48,9 +48,10 @@
|
|||
#include "wine/library.h"
|
||||
#include "thread.h"
|
||||
#include "stackframe.h"
|
||||
#include "wine/server.h"
|
||||
#include "wine/debug.h"
|
||||
#include "msvcrt/excpt.h"
|
||||
#include "wine/server.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(seh);
|
||||
|
||||
|
@ -210,6 +211,8 @@ static int send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *c
|
|||
*/
|
||||
static BOOL start_debugger(PEXCEPTION_POINTERS epointers, HANDLE hEvent)
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
HKEY hDbgConf;
|
||||
DWORD bAuto = FALSE;
|
||||
PROCESS_INFORMATION info;
|
||||
|
@ -219,40 +222,75 @@ static BOOL start_debugger(PEXCEPTION_POINTERS epointers, HANDLE hEvent)
|
|||
DWORD format_size;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
static const WCHAR AeDebugW[] = {'M','a','c','h','i','n','e','\\',
|
||||
'S','o','f','t','w','a','r','e','\\',
|
||||
'M','i','c','r','o','s','o','f','t','\\',
|
||||
'W','i','n','d','o','w','s',' ','N','T','\\',
|
||||
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
||||
'A','e','D','e','b','u','g',0};
|
||||
static const WCHAR DebuggerW[] = {'D','e','b','u','g','g','e','r',0};
|
||||
static const WCHAR AutoW[] = {'A','u','t','o',0};
|
||||
|
||||
MESSAGE("wine: Unhandled exception, starting debugger...\n");
|
||||
|
||||
if (!RegOpenKeyA(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", &hDbgConf)) {
|
||||
DWORD type;
|
||||
DWORD count;
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &nameW, AeDebugW );
|
||||
|
||||
format_size = 0;
|
||||
if (!RegQueryValueExA(hDbgConf, "Debugger", 0, &type, NULL, &format_size)) {
|
||||
format = HeapAlloc(GetProcessHeap(), 0, format_size);
|
||||
RegQueryValueExA(hDbgConf, "Debugger", 0, &type, format, &format_size);
|
||||
if (type==REG_EXPAND_SZ) {
|
||||
char* tmp;
|
||||
if (!NtOpenKey( &hDbgConf, KEY_ALL_ACCESS, &attr ))
|
||||
{
|
||||
char buffer[64];
|
||||
KEY_VALUE_PARTIAL_INFORMATION *info;
|
||||
|
||||
/* Expand environment variable references */
|
||||
format_size=ExpandEnvironmentStringsA(format,NULL,0);
|
||||
tmp=HeapAlloc(GetProcessHeap(), 0, format_size);
|
||||
ExpandEnvironmentStringsA(format,tmp,format_size);
|
||||
HeapFree(GetProcessHeap(), 0, format);
|
||||
format=tmp;
|
||||
format_size = 0;
|
||||
RtlInitUnicodeString( &nameW, DebuggerW );
|
||||
if (NtQueryValueKey( hDbgConf, &nameW, KeyValuePartialInformation,
|
||||
NULL, 0, &format_size ) == STATUS_BUFFER_OVERFLOW)
|
||||
{
|
||||
char *data = HeapAlloc(GetProcessHeap(), 0, format_size);
|
||||
NtQueryValueKey( hDbgConf, &nameW, KeyValuePartialInformation,
|
||||
data, format_size, &format_size );
|
||||
info = (KEY_VALUE_PARTIAL_INFORMATION *)data;
|
||||
RtlUnicodeToMultiByteSize( &format_size, (WCHAR *)info->Data, info->DataLength );
|
||||
format = HeapAlloc( GetProcessHeap(), 0, format_size+1 );
|
||||
RtlUnicodeToMultiByteN( format, format_size, NULL,
|
||||
(WCHAR *)info->Data, info->DataLength );
|
||||
format[format_size] = 0;
|
||||
|
||||
if (info->Type == REG_EXPAND_SZ)
|
||||
{
|
||||
char* tmp;
|
||||
|
||||
/* Expand environment variable references */
|
||||
format_size=ExpandEnvironmentStringsA(format,NULL,0);
|
||||
tmp=HeapAlloc(GetProcessHeap(), 0, format_size);
|
||||
ExpandEnvironmentStringsA(format,tmp,format_size);
|
||||
HeapFree(GetProcessHeap(), 0, format);
|
||||
format=tmp;
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, data );
|
||||
}
|
||||
|
||||
RtlInitUnicodeString( &nameW, AutoW );
|
||||
if (!NtQueryValueKey( hDbgConf, &nameW, KeyValuePartialInformation,
|
||||
buffer, sizeof(buffer)-sizeof(WCHAR), &format_size ))
|
||||
{
|
||||
info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer;
|
||||
if (info->Type == REG_DWORD) memcpy( &bAuto, info->Data, sizeof(DWORD) );
|
||||
else if (info->Type == REG_SZ)
|
||||
{
|
||||
WCHAR *str = (WCHAR *)info->Data;
|
||||
str[info->DataLength/sizeof(WCHAR)] = 0;
|
||||
bAuto = atoiW( str );
|
||||
}
|
||||
}
|
||||
else bAuto = TRUE;
|
||||
|
||||
count = sizeof(bAuto);
|
||||
if (RegQueryValueExA(hDbgConf, "Auto", 0, &type, (char*)&bAuto, &count))
|
||||
bAuto = TRUE;
|
||||
else if (type == REG_SZ)
|
||||
{
|
||||
char autostr[10];
|
||||
count = sizeof(autostr);
|
||||
if (!RegQueryValueExA(hDbgConf, "Auto", 0, &type, autostr, &count))
|
||||
bAuto = atoi(autostr);
|
||||
}
|
||||
RegCloseKey(hDbgConf);
|
||||
NtClose(hDbgConf);
|
||||
} else {
|
||||
/* try a default setup... */
|
||||
strcpy( format, "winedbg --debugmsg -all --auto %ld %ld" );
|
||||
|
|
Loading…
Reference in a new issue