Small dll separation fixes.
This commit is contained in:
parent
ab5e975907
commit
9515336378
|
@ -30,6 +30,8 @@ USER_DRIVER USER_Driver;
|
||||||
|
|
||||||
WINE_LOOK TWEAK_WineLook = WIN31_LOOK;
|
WINE_LOOK TWEAK_WineLook = WIN31_LOOK;
|
||||||
|
|
||||||
|
WORD USER_HeapSel = 0; /* USER heap selector */
|
||||||
|
|
||||||
static HMODULE graphics_driver;
|
static HMODULE graphics_driver;
|
||||||
|
|
||||||
#define GET_USER_FUNC(name) \
|
#define GET_USER_FUNC(name) \
|
||||||
|
@ -43,16 +45,13 @@ static BOOL load_driver(void)
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
DWORD type, count;
|
DWORD type, count;
|
||||||
|
|
||||||
if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Wine", 0, NULL,
|
|
||||||
REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
|
|
||||||
{
|
|
||||||
MESSAGE("load_driver: Cannot create config registry key\n" );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
count = sizeof(buffer);
|
|
||||||
if (RegQueryValueExA( hkey, "GraphicsDriver", 0, &type, buffer, &count ))
|
|
||||||
strcpy( buffer, "x11drv" ); /* default value */
|
strcpy( buffer, "x11drv" ); /* default value */
|
||||||
|
if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Wine", &hkey ))
|
||||||
|
{
|
||||||
|
count = sizeof(buffer);
|
||||||
|
RegQueryValueExA( hkey, "GraphicsDriver", 0, &type, buffer, &count );
|
||||||
RegCloseKey( hkey );
|
RegCloseKey( hkey );
|
||||||
|
}
|
||||||
|
|
||||||
if (!(graphics_driver = LoadLibraryA( buffer )))
|
if (!(graphics_driver = LoadLibraryA( buffer )))
|
||||||
{
|
{
|
||||||
|
@ -163,8 +162,7 @@ static void tweak_init(void)
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
DWORD type, count = sizeof(buffer);
|
DWORD type, count = sizeof(buffer);
|
||||||
|
|
||||||
if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Tweak.Layout", 0, NULL,
|
if (RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Tweak.Layout", &hkey ))
|
||||||
REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
|
|
||||||
return;
|
return;
|
||||||
if (RegQueryValueExA( hkey, "WineLook", 0, &type, buffer, &count ))
|
if (RegQueryValueExA( hkey, "WineLook", 0, &type, buffer, &count ))
|
||||||
strcpy( buffer, "Win31" ); /* default value */
|
strcpy( buffer, "Win31" ); /* default value */
|
||||||
|
@ -197,7 +195,7 @@ BOOL WINAPI USER_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
|
||||||
/* Create USER heap */
|
/* Create USER heap */
|
||||||
if ((instance = LoadLibrary16( "USER.EXE" )) < 32) return FALSE;
|
if ((instance = LoadLibrary16( "USER.EXE" )) < 32) return FALSE;
|
||||||
USER_HeapSel = GlobalHandleToSel16( instance );
|
USER_HeapSel = instance | 7;
|
||||||
|
|
||||||
/* Global atom table initialisation */
|
/* Global atom table initialisation */
|
||||||
if (!ATOM_Init( USER_HeapSel )) return FALSE;
|
if (!ATOM_Init( USER_HeapSel )) return FALSE;
|
||||||
|
|
110
files/profile.c
110
files/profile.c
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -271,7 +272,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* convert the .winerc file to the new format */
|
/* convert the .winerc file to the new format */
|
||||||
static int convert_config( FILE *in, const char *output_name )
|
static void convert_config( FILE *in, const char *output_name )
|
||||||
{
|
{
|
||||||
char buffer[PROFILE_MAX_LINE_LEN];
|
char buffer[PROFILE_MAX_LINE_LEN];
|
||||||
char *p, *p2;
|
char *p, *p2;
|
||||||
|
@ -279,7 +280,11 @@ static int convert_config( FILE *in, const char *output_name )
|
||||||
|
|
||||||
/* create the output file, only if it doesn't exist already */
|
/* create the output file, only if it doesn't exist already */
|
||||||
int fd = open( output_name, O_WRONLY|O_CREAT|O_EXCL, 0666 );
|
int fd = open( output_name, O_WRONLY|O_CREAT|O_EXCL, 0666 );
|
||||||
if (fd == -1) return 0;
|
if (fd == -1)
|
||||||
|
{
|
||||||
|
MESSAGE( "Could not create new config file '%s': %s\n", output_name, strerror(errno) );
|
||||||
|
ExitProcess(1);
|
||||||
|
}
|
||||||
|
|
||||||
out = fdopen( fd, "w" );
|
out = fdopen( fd, "w" );
|
||||||
fprintf( out, "WINE REGISTRY Version 2\n" );
|
fprintf( out, "WINE REGISTRY Version 2\n" );
|
||||||
|
@ -342,71 +347,6 @@ static int convert_config( FILE *in, const char *output_name )
|
||||||
fprintf( out, "\"\n" );
|
fprintf( out, "\"\n" );
|
||||||
}
|
}
|
||||||
fclose( out );
|
fclose( out );
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* PROFILE_RegistryLoad
|
|
||||||
*
|
|
||||||
* Load a profile tree from a file into a registry key.
|
|
||||||
*/
|
|
||||||
static DWORD PROFILE_RegistryLoad( HKEY root, FILE *file )
|
|
||||||
{
|
|
||||||
HKEY hkey = 0;
|
|
||||||
DWORD err = 0;
|
|
||||||
char buffer[PROFILE_MAX_LINE_LEN];
|
|
||||||
char *p, *p2;
|
|
||||||
int line = 0;
|
|
||||||
|
|
||||||
while (fgets( buffer, PROFILE_MAX_LINE_LEN, file ))
|
|
||||||
{
|
|
||||||
line++;
|
|
||||||
p = buffer;
|
|
||||||
while (*p && PROFILE_isspace(*p)) p++;
|
|
||||||
if (*p == '[') /* section start */
|
|
||||||
{
|
|
||||||
if (!(p2 = strrchr( p, ']' )))
|
|
||||||
{
|
|
||||||
WARN("Invalid section header at line %d: '%s'\n",
|
|
||||||
line, p );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*p2 = '\0';
|
|
||||||
p++;
|
|
||||||
if (hkey) RegCloseKey( hkey );
|
|
||||||
if ((err = RegCreateKeyExA( root, p, 0, NULL, REG_OPTION_VOLATILE,
|
|
||||||
KEY_ALL_ACCESS, NULL, &hkey, NULL ))) return err;
|
|
||||||
TRACE("New section: '%s'\n",p);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
p2=p+strlen(p) - 1;
|
|
||||||
while ((p2 > p) && ((*p2 == '\n') || PROFILE_isspace(*p2))) *p2--='\0';
|
|
||||||
|
|
||||||
if ((p2 = strchr( p, '=' )) != NULL)
|
|
||||||
{
|
|
||||||
char *p3 = p2 - 1;
|
|
||||||
while ((p3 > p) && PROFILE_isspace(*p3)) *p3-- = '\0';
|
|
||||||
*p2++ = '\0';
|
|
||||||
while (*p2 && PROFILE_isspace(*p2)) p2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*p && hkey && !IS_ENTRY_COMMENT(p))
|
|
||||||
{
|
|
||||||
if (!p2) p2 = "";
|
|
||||||
if ((err = RegSetValueExA( hkey, p, 0, REG_SZ, p2, strlen(p2)+1 )))
|
|
||||||
{
|
|
||||||
RegCloseKey( hkey );
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
TRACE("New key: name='%s', value='%s'\n",p,p2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hkey) RegCloseKey( hkey );
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1067,25 +1007,39 @@ int PROFILE_GetWineIniBool(
|
||||||
*/
|
*/
|
||||||
int PROFILE_LoadWineIni(void)
|
int PROFILE_LoadWineIni(void)
|
||||||
{
|
{
|
||||||
|
OBJECT_ATTRIBUTES attr;
|
||||||
|
UNICODE_STRING nameW;
|
||||||
char buffer[MAX_PATHNAME_LEN];
|
char buffer[MAX_PATHNAME_LEN];
|
||||||
const char *p;
|
const char *p;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
HKEY hKeySW;
|
HKEY hKeySW;
|
||||||
DWORD disp;
|
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 */
|
/* make sure HKLM\\Software\\Wine\\Wine exists as non-volatile key */
|
||||||
if (RegCreateKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine", &hKeySW ))
|
if (!RtlCreateUnicodeStringFromAsciiz( &nameW, "Machine\\Software\\Wine\\Wine" ) ||
|
||||||
|
NtCreateKey( &hKeySW, KEY_ALL_ACCESS, &attr, 0, NULL, 0, &disp ))
|
||||||
{
|
{
|
||||||
ERR("Cannot create config registry key\n" );
|
ERR("Cannot create config registry key\n" );
|
||||||
return 0;
|
ExitProcess( 1 );
|
||||||
}
|
}
|
||||||
RegCloseKey( hKeySW );
|
RtlFreeUnicodeString( &nameW );
|
||||||
if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config", 0, NULL,
|
NtClose( hKeySW );
|
||||||
REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &wine_profile_key, &disp ))
|
|
||||||
|
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" );
|
ERR("Cannot create config registry key\n" );
|
||||||
return 0;
|
ExitProcess( 1 );
|
||||||
}
|
}
|
||||||
|
RtlFreeUnicodeString( &nameW );
|
||||||
|
|
||||||
if (!CLIENT_IsBootThread()) return 1; /* already loaded */
|
if (!CLIENT_IsBootThread()) return 1; /* already loaded */
|
||||||
|
|
||||||
|
@ -1118,8 +1072,9 @@ int PROFILE_LoadWineIni(void)
|
||||||
|
|
||||||
/* convert to the new format */
|
/* convert to the new format */
|
||||||
sprintf( buffer, "%s/config", get_config_dir() );
|
sprintf( buffer, "%s/config", get_config_dir() );
|
||||||
if (convert_config( f, buffer ))
|
convert_config( f, buffer );
|
||||||
{
|
fclose( f );
|
||||||
|
|
||||||
MESSAGE( "The '%s' configuration file has been converted\n"
|
MESSAGE( "The '%s' configuration file has been converted\n"
|
||||||
"to the new format and saved as '%s'.\n", PROFILE_WineIniUsed, buffer );
|
"to the new format and saved as '%s'.\n", PROFILE_WineIniUsed, buffer );
|
||||||
MESSAGE( "You should verify that the contents of the new file are correct,\n"
|
MESSAGE( "You should verify that the contents of the new file are correct,\n"
|
||||||
|
@ -1127,11 +1082,6 @@ int PROFILE_LoadWineIni(void)
|
||||||
ExitProcess(0);
|
ExitProcess(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PROFILE_RegistryLoad( wine_profile_key, f );
|
|
||||||
fclose( f );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* PROFILE_UsageWineIni
|
* PROFILE_UsageWineIni
|
||||||
|
|
|
@ -116,8 +116,6 @@ typedef struct
|
||||||
|
|
||||||
#define LOCAL_HEAP_MAGIC 0x484c /* 'LH' */
|
#define LOCAL_HEAP_MAGIC 0x484c /* 'LH' */
|
||||||
|
|
||||||
WORD USER_HeapSel = 0; /* USER heap selector */
|
|
||||||
|
|
||||||
/* All local heap allocations are aligned on 4-byte boundaries */
|
/* All local heap allocations are aligned on 4-byte boundaries */
|
||||||
#define LALIGN(word) (((word) + 3) & ~3)
|
#define LALIGN(word) (((word) + 3) & ~3)
|
||||||
|
|
||||||
|
|
|
@ -320,7 +320,7 @@ BOOL GDI_Init(void)
|
||||||
|
|
||||||
/* create GDI heap */
|
/* create GDI heap */
|
||||||
if ((instance = LoadLibrary16( "GDI.EXE" )) < 32) return FALSE;
|
if ((instance = LoadLibrary16( "GDI.EXE" )) < 32) return FALSE;
|
||||||
GDI_HeapSel = GlobalHandleToSel16( instance );
|
GDI_HeapSel = instance | 7;
|
||||||
|
|
||||||
/* TWEAK: Initialize font hints */
|
/* TWEAK: Initialize font hints */
|
||||||
ReadFontInformation("OEMFixed", &OEMFixedFont, 0, 0, 0, 0, 0);
|
ReadFontInformation("OEMFixed", &OEMFixedFont, 0, 0, 0, 0, 0);
|
||||||
|
|
|
@ -599,7 +599,7 @@ BOOL16 WINAPI EnumMetaFile16( HDC16 hdc, HMETAFILE16 hmf,
|
||||||
sizeof(HANDLETABLE16) * mh->mtNoObjects);
|
sizeof(HANDLETABLE16) * mh->mtNoObjects);
|
||||||
spht = K32WOWGlobalLock16(hHT);
|
spht = K32WOWGlobalLock16(hHT);
|
||||||
|
|
||||||
seg = GlobalHandleToSel16(hmf);
|
seg = hmf | 7;
|
||||||
offset = mh->mtHeaderSize * 2;
|
offset = mh->mtHeaderSize * 2;
|
||||||
|
|
||||||
/* loop through metafile records */
|
/* loop through metafile records */
|
||||||
|
|
|
@ -44,7 +44,7 @@ WORD WINAPI GetFreeSystemResources16( WORD resType )
|
||||||
int userPercent, gdiPercent;
|
int userPercent, gdiPercent;
|
||||||
|
|
||||||
if ((gdi_inst = LoadLibrary16( "GDI" )) < 32) return 0;
|
if ((gdi_inst = LoadLibrary16( "GDI" )) < 32) return 0;
|
||||||
gdi_heap = GlobalHandleToSel16( gdi_inst );
|
gdi_heap = gdi_inst | 7;
|
||||||
|
|
||||||
switch(resType)
|
switch(resType)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue