diff --git a/graphics/win16drv/init.c b/graphics/win16drv/init.c index c3c3e7c350a..dfd4b6678ac 100644 --- a/graphics/win16drv/init.c +++ b/graphics/win16drv/init.c @@ -9,12 +9,12 @@ #include #include +#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 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, 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 --git a/objects/gdiobj.c b/objects/gdiobj.c index 65515eed60e..bfeceba94a7 100644 --- a/objects/gdiobj.c +++ b/objects/gdiobj.c @@ -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 @@ HBITMAP hPseudoStockBitmap; /* 1x1 bitmap for memory DCs */ 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 @@ static void ReadFontInformation( 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 --git a/objects/metafile.c b/objects/metafile.c index 2e1c2cadd8d..cd80d3eaef4 100644 --- a/objects/metafile.c +++ b/objects/metafile.c @@ -93,15 +93,16 @@ HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh) 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; }