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;
|
||||
|
||||
WORD USER_HeapSel = 0; /* USER heap selector */
|
||||
|
||||
static HMODULE graphics_driver;
|
||||
|
||||
#define GET_USER_FUNC(name) \
|
||||
|
@ -43,16 +45,13 @@ static BOOL load_driver(void)
|
|||
HKEY hkey;
|
||||
DWORD type, count;
|
||||
|
||||
if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Wine", 0, NULL,
|
||||
REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
|
||||
strcpy( buffer, "x11drv" ); /* default value */
|
||||
if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Wine", &hkey ))
|
||||
{
|
||||
MESSAGE("load_driver: Cannot create config registry key\n" );
|
||||
return FALSE;
|
||||
count = sizeof(buffer);
|
||||
RegQueryValueExA( hkey, "GraphicsDriver", 0, &type, buffer, &count );
|
||||
RegCloseKey( hkey );
|
||||
}
|
||||
count = sizeof(buffer);
|
||||
if (RegQueryValueExA( hkey, "GraphicsDriver", 0, &type, buffer, &count ))
|
||||
strcpy( buffer, "x11drv" ); /* default value */
|
||||
RegCloseKey( hkey );
|
||||
|
||||
if (!(graphics_driver = LoadLibraryA( buffer )))
|
||||
{
|
||||
|
@ -163,8 +162,7 @@ static void tweak_init(void)
|
|||
HKEY hkey;
|
||||
DWORD type, count = sizeof(buffer);
|
||||
|
||||
if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Tweak.Layout", 0, NULL,
|
||||
REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
|
||||
if (RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Tweak.Layout", &hkey ))
|
||||
return;
|
||||
if (RegQueryValueExA( hkey, "WineLook", 0, &type, buffer, &count ))
|
||||
strcpy( buffer, "Win31" ); /* default value */
|
||||
|
@ -197,7 +195,7 @@ BOOL WINAPI USER_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|||
|
||||
/* Create USER heap */
|
||||
if ((instance = LoadLibrary16( "USER.EXE" )) < 32) return FALSE;
|
||||
USER_HeapSel = GlobalHandleToSel16( instance );
|
||||
USER_HeapSel = instance | 7;
|
||||
|
||||
/* Global atom table initialisation */
|
||||
if (!ATOM_Init( USER_HeapSel )) return FALSE;
|
||||
|
|
118
files/profile.c
118
files/profile.c
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -271,7 +272,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
|
|||
}
|
||||
|
||||
/* 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 *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 */
|
||||
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" );
|
||||
fprintf( out, "WINE REGISTRY Version 2\n" );
|
||||
|
@ -342,71 +347,6 @@ static int convert_config( FILE *in, const char *output_name )
|
|||
fprintf( out, "\"\n" );
|
||||
}
|
||||
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)
|
||||
{
|
||||
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 (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" );
|
||||
return 0;
|
||||
ExitProcess( 1 );
|
||||
}
|
||||
RegCloseKey( hKeySW );
|
||||
if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config", 0, NULL,
|
||||
REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &wine_profile_key, &disp ))
|
||||
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" );
|
||||
return 0;
|
||||
ExitProcess( 1 );
|
||||
}
|
||||
RtlFreeUnicodeString( &nameW );
|
||||
|
||||
if (!CLIENT_IsBootThread()) return 1; /* already loaded */
|
||||
|
||||
|
@ -1118,18 +1072,14 @@ int PROFILE_LoadWineIni(void)
|
|||
|
||||
/* convert to the new format */
|
||||
sprintf( buffer, "%s/config", get_config_dir() );
|
||||
if (convert_config( f, buffer ))
|
||||
{
|
||||
MESSAGE( "The '%s' configuration file has been converted\n"
|
||||
"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"
|
||||
"and then remove the old one and restart Wine.\n" );
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
PROFILE_RegistryLoad( wine_profile_key, f );
|
||||
convert_config( f, buffer );
|
||||
fclose( f );
|
||||
return 1;
|
||||
|
||||
MESSAGE( "The '%s' configuration file has been converted\n"
|
||||
"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"
|
||||
"and then remove the old one and restart Wine.\n" );
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -116,8 +116,6 @@ typedef struct
|
|||
|
||||
#define LOCAL_HEAP_MAGIC 0x484c /* 'LH' */
|
||||
|
||||
WORD USER_HeapSel = 0; /* USER heap selector */
|
||||
|
||||
/* All local heap allocations are aligned on 4-byte boundaries */
|
||||
#define LALIGN(word) (((word) + 3) & ~3)
|
||||
|
||||
|
|
|
@ -320,7 +320,7 @@ BOOL GDI_Init(void)
|
|||
|
||||
/* create GDI heap */
|
||||
if ((instance = LoadLibrary16( "GDI.EXE" )) < 32) return FALSE;
|
||||
GDI_HeapSel = GlobalHandleToSel16( instance );
|
||||
GDI_HeapSel = instance | 7;
|
||||
|
||||
/* TWEAK: Initialize font hints */
|
||||
ReadFontInformation("OEMFixed", &OEMFixedFont, 0, 0, 0, 0, 0);
|
||||
|
|
|
@ -599,7 +599,7 @@ BOOL16 WINAPI EnumMetaFile16( HDC16 hdc, HMETAFILE16 hmf,
|
|||
sizeof(HANDLETABLE16) * mh->mtNoObjects);
|
||||
spht = K32WOWGlobalLock16(hHT);
|
||||
|
||||
seg = GlobalHandleToSel16(hmf);
|
||||
seg = hmf | 7;
|
||||
offset = mh->mtHeaderSize * 2;
|
||||
|
||||
/* loop through metafile records */
|
||||
|
|
|
@ -44,7 +44,7 @@ WORD WINAPI GetFreeSystemResources16( WORD resType )
|
|||
int userPercent, gdiPercent;
|
||||
|
||||
if ((gdi_inst = LoadLibrary16( "GDI" )) < 32) return 0;
|
||||
gdi_heap = GlobalHandleToSel16( gdi_inst );
|
||||
gdi_heap = gdi_inst | 7;
|
||||
|
||||
switch(resType)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue