Fix some of the dll separation issues

Dmitry Timoshkov dmitry at baikal.ru
Tue May 22 09:26:36 CDT 2001


Hello.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Fix some of the dll separation issues.

diff -u cvs/wine/graphics/win16drv/init.c wine/graphics/win16drv/init.c
--- cvs/wine/graphics/win16drv/init.c	Thu May 10 02:00:28 2001
+++ wine/graphics/win16drv/init.c	Tue May 22 09:21:56 2001
@@ -9,12 +9,12 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "winreg.h"
 #include "win16drv.h"
 #include "gdi.h"
 #include "bitmap.h"
 #include "heap.h"
 #include "font.h"
-#include "options.h"
 #include "debugtools.h"
 
 DEFAULT_DEBUG_CHANNEL(win16drv);
@@ -205,8 +205,17 @@
     PDEVICE_HEADER *pPDH;
     WIN16DRV_PDEVICE *physDev;
     char printerEnabled[20];
-    PROFILE_GetWineIniString( "wine", "printer", "off",
-                             printerEnabled, sizeof(printerEnabled) );
+    HKEY hkey;
+
+    /* default value */
+    strcpy(printerEnabled, "off");
+    if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\wine", &hkey))
+    {
+	DWORD type, count = sizeof(printerEnabled);
+	RegQueryValueExA(hkey, "printer", 0, &type, printerEnabled, &count);
+	RegCloseKey(hkey);
+    }
+
     if (strcasecmp(printerEnabled,"on"))
     {
         MESSAGE("Printing disabled in wine.conf or .winerc file\n");
diff -u cvs/wine/objects/gdiobj.c wine/objects/gdiobj.c
--- cvs/wine/objects/gdiobj.c	Tue May 22 09:25:16 2001
+++ wine/objects/gdiobj.c	Tue May 22 09:25:20 2001
@@ -12,6 +12,7 @@
 
 #include "windef.h"
 #include "wingdi.h"
+#include "winreg.h"
 #include "winerror.h"
 #include "wine/winbase16.h"
 
@@ -20,7 +21,6 @@
 #include "font.h"
 #include "heap.h"
 #include "local.h"
-#include "options.h"
 #include "palette.h"
 #include "pen.h"
 #include "region.h"
@@ -173,6 +173,28 @@
 static SYSLEVEL GDI_level = { CRITICAL_SECTION_INIT, 3 };
 static WORD GDI_HeapSel;
 
+static BOOL get_bool(char *buffer, BOOL def_value)
+{
+    switch(buffer[0])
+    {
+	case 'n':
+	case 'N':
+	case 'f':
+	case 'F':
+	case '0':
+	    return FALSE;
+
+	case 'y':
+	case 'Y':
+	case 't':
+	case 'T':
+	case '1':
+	    return TRUE;
+
+	default:
+	    return def_value;
+    }
+}
 
 /******************************************************************************
  *
@@ -203,32 +225,50 @@
     int  defStrikeOut )
 {
     char  key[256];
+    char buffer[MAX_PATH];
+    HKEY hkey;
+    DWORD type, count;
 
     /* In order for the stock fonts to be independent of 
      * mapping mode, the height (& width) must be 0
      */
+
+    /* assign defaults */
+    font->logfont.lfHeight = defHeight;
+    font->logfont.lfWeight = defBold;
+    font->logfont.lfItalic = defItalic;
+    font->logfont.lfUnderline = defUnderline;
+    font->logfont.lfStrikeOut = defStrikeOut;
+
+    if(RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Tweak.Fonts", &hkey))
+	return;
+
     sprintf(key, "%s.Height", fontName);
-    font->logfont.lfHeight =
-	PROFILE_GetWineIniInt("Tweak.Fonts", key, defHeight);
+    count = sizeof(buffer);
+    if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
+	font->logfont.lfHeight = atoi(buffer);
 
     sprintf(key, "%s.Bold", fontName);
-    font->logfont.lfWeight =
-	(PROFILE_GetWineIniBool("Tweak.Fonts", key, defBold)) ?
-	FW_BOLD : FW_NORMAL;
+    count = sizeof(buffer);
+    if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
+	font->logfont.lfWeight = get_bool(buffer, defBold) ? FW_BOLD : FW_NORMAL;
 
     sprintf(key, "%s.Italic", fontName);
-    font->logfont.lfItalic =
-	PROFILE_GetWineIniBool("Tweak.Fonts", key, defItalic);
+    count = sizeof(buffer);
+    if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
+	font->logfont.lfItalic = get_bool(buffer, defItalic);
 
     sprintf(key, "%s.Underline", fontName);
-    font->logfont.lfUnderline =
-	PROFILE_GetWineIniBool("Tweak.Fonts", key, defUnderline);
+    count = sizeof(buffer);
+    if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
+	font->logfont.lfUnderline = get_bool(buffer, defUnderline);
 
     sprintf(key, "%s.StrikeOut", fontName);
-    font->logfont.lfStrikeOut =
-	PROFILE_GetWineIniBool("Tweak.Fonts", key, defStrikeOut);
+    count = sizeof(buffer);
+    if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
+	font->logfont.lfStrikeOut = get_bool(buffer, defStrikeOut);
 
-    return;
+    RegCloseKey(hkey);
 }
 
 /***********************************************************************
diff -u cvs/wine/objects/metafile.c wine/objects/metafile.c
--- cvs/wine/objects/metafile.c	Tue Mar 27 14:17:06 2001
+++ wine/objects/metafile.c	Tue May 22 06:56:20 2001
@@ -93,15 +93,16 @@
 HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh)
 {
     HMETAFILE16 hmf;
-    DWORD size;
+    DWORD size = mh->mtSize * sizeof(WORD);
 
-    if(mh->mtType == METAFILE_MEMORY)
-        size = mh->mtSize * sizeof(WORD);
-    else
-        size = sizeof(METAHEADER) + sizeof(METAHEADERDISK);
-
-    hmf = GLOBAL_CreateBlock( GMEM_MOVEABLE, mh, mh->mtSize * sizeof(WORD),
-                              GetCurrentPDB16(), WINE_LDT_FLAGS_DATA );
+    hmf = GlobalAlloc16(GMEM_MOVEABLE, size);
+    if(hmf)
+    {
+	METAHEADER *mh_dest = GlobalLock16(hmf);
+	memcpy(mh_dest, mh, size);
+	GlobalUnlock16(hmf);
+    }
+    HeapFree(GetProcessHeap(), 0, mh);
     return hmf;
 }
 






More information about the wine-patches mailing list