Commit 2fe7c110 authored by Alexandre Julliard's avatar Alexandre Julliard

Fixed win16drv initialisation.

parent 97ac9612
......@@ -10,6 +10,7 @@
#include "ntddk.h"
#include "gdi.h"
#include "win16drv.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(driver);
......@@ -25,6 +26,7 @@ struct graphics_driver
static struct graphics_driver *first_driver;
static struct graphics_driver *display_driver;
static const DC_FUNCTIONS *win16_driver;
/**********************************************************************
......@@ -230,8 +232,9 @@ const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name )
if (!(module = LoadLibraryA( name )))
{
if (!win16_driver) win16_driver = WIN16DRV_Init();
RtlReleasePebLock();
return NULL;
return win16_driver;
}
if (!(driver = create_driver( module )))
......@@ -257,10 +260,13 @@ const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs )
struct graphics_driver *driver;
RtlAcquirePebLock();
for (driver = first_driver; driver; driver = driver->next)
if (&driver->funcs == funcs) break;
if (!driver) ERR( "driver not found, trouble ahead\n" );
driver->count++;
if (funcs != win16_driver)
{
for (driver = first_driver; driver; driver = driver->next)
if (&driver->funcs == funcs) break;
if (!driver) ERR( "driver not found, trouble ahead\n" );
driver->count++;
}
RtlReleasePebLock();
return funcs;
}
......@@ -277,6 +283,8 @@ void DRIVER_release_driver( const DC_FUNCTIONS *funcs )
RtlAcquirePebLock();
if (funcs == win16_driver) goto done;
for (driver = first_driver; driver; driver = driver->next)
if (&driver->funcs == funcs) break;
......
......@@ -146,16 +146,36 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
};
/* FIXME: this no longer works */
#if 0
/**********************************************************************
* WIN16DRV_Init
*/
BOOL WIN16DRV_Init(void)
const DC_FUNCTIONS *WIN16DRV_Init(void)
{
return DRIVER_RegisterDriver( NULL /* generic driver */, &WIN16DRV_Funcs );
static int enabled = -1;
if (enabled == -1)
{
char printerEnabled[20];
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);
}
enabled = !strcasecmp( printerEnabled, "on" );
if (!enabled)
{
MESSAGE("Printing disabled in wine.conf or .winerc file\n");
MESSAGE("Use \"printer=on\" in the \"[wine]\" section to enable it.\n");
}
}
return enabled ? &WIN16DRV_Funcs : NULL;
}
#endif
/* Tempory functions, for initialising structures */
/* These values should be calculated, not hardcoded */
......@@ -203,24 +223,6 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
int nPDEVICEsize;
PDEVICE_HEADER *pPDH;
WIN16DRV_PDEVICE *physDev;
char printerEnabled[20];
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");
MESSAGE("Use \"printer=on\" in the \"[wine]\" section to enable it.\n");
return FALSE;
}
TRACE("In creatdc for (%s,%s,%s) initData 0x%p\n",
driver, device, output, initData);
......
......@@ -240,7 +240,7 @@ extern WORD PRTDRV_GetCharWidth(LPPDEVICE lpDestDev, LPINT lpBuffer,
/* Wine driver functions */
extern BOOL WIN16DRV_Init(void);
extern const DC_FUNCTIONS *WIN16DRV_Init(void);
extern BOOL WIN16DRV_GetCharWidth( struct tagDC *dc, UINT firstChar, UINT lastChar,
LPINT buffer );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment