Changed serial ports in wine.ini to /dev/ttySX from /dev/cuaX in
[wine.git] / graphics / driver.c
blobc5ab9a19e975ab5de69d2db14c6c6273fdcb1b4a
1 /*
2 * Graphics driver management functions
4 * Copyright 1996 Alexandre Julliard
5 */
7 #include <string.h>
8 #include "gdi.h"
9 #include "heap.h"
10 #include "debugtools.h"
12 DECLARE_DEBUG_CHANNEL(driver)
13 DECLARE_DEBUG_CHANNEL(gdi)
15 typedef struct tagGRAPHICS_DRIVER
17 struct tagGRAPHICS_DRIVER *next;
18 LPSTR name;
19 const DC_FUNCTIONS *funcs;
20 } GRAPHICS_DRIVER;
22 static GRAPHICS_DRIVER *firstDriver = NULL;
23 static GRAPHICS_DRIVER *genericDriver = NULL;
25 /**********************************************************************
26 * DRIVER_RegisterDriver
28 BOOL DRIVER_RegisterDriver( LPCSTR name, const DC_FUNCTIONS *funcs )
30 GRAPHICS_DRIVER *driver = HeapAlloc( SystemHeap, 0, sizeof(*driver) );
31 if (!driver) return FALSE;
32 driver->funcs = funcs;
33 if (name)
35 driver->name = HEAP_strdupA( SystemHeap, 0, name );
36 driver->next = firstDriver;
37 firstDriver = driver;
38 return TRUE;
40 /* No name -> it's the generic driver */
41 if (genericDriver)
43 WARN_(driver)(" already a generic driver\n" );
44 HeapFree( SystemHeap, 0, driver );
45 return FALSE;
47 driver->name = NULL;
48 genericDriver = driver;
49 return TRUE;
53 /**********************************************************************
54 * DRIVER_FindDriver
56 const DC_FUNCTIONS *DRIVER_FindDriver( LPCSTR name )
58 GRAPHICS_DRIVER *driver = firstDriver;
60 while (driver && name)
62 if (!strcasecmp( driver->name, name )) return driver->funcs;
63 driver = driver->next;
65 return genericDriver ? genericDriver->funcs : NULL;
69 /**********************************************************************
70 * DRIVER_UnregisterDriver
72 BOOL DRIVER_UnregisterDriver( LPCSTR name )
74 if (name)
76 GRAPHICS_DRIVER **ppDriver = &firstDriver;
77 while (*ppDriver)
79 if (!strcasecmp( (*ppDriver)->name, name ))
81 GRAPHICS_DRIVER *driver = *ppDriver;
82 (*ppDriver) = driver->next;
83 HeapFree( SystemHeap, 0, driver->name );
84 HeapFree( SystemHeap, 0, driver );
85 return TRUE;
87 ppDriver = &(*ppDriver)->next;
89 return FALSE;
91 else
93 if (!genericDriver) return FALSE;
94 HeapFree( SystemHeap, 0, genericDriver );
95 genericDriver = NULL;
96 return TRUE;
102 /*****************************************************************************
103 * GDI_CallDevInstall16 [GDI32.100]
105 * This should thunk to 16-bit and simply call the proc with the given args.
107 INT WINAPI GDI_CallDevInstall16( FARPROC16 lpfnDevInstallProc, HWND hWnd,
108 LPSTR lpModelName, LPSTR OldPort, LPSTR NewPort )
110 FIXME_(gdi)("(%p, %04x, %s, %s, %s)\n",
111 lpfnDevInstallProc, hWnd, lpModelName, OldPort, NewPort );
112 return -1;
115 /*****************************************************************************
116 * GDI_CallExtDeviceModePropSheet16 [GDI32.101]
118 * This should load the correct driver for lpszDevice and calls this driver's
119 * ExtDeviceModePropSheet proc.
121 * Note: The driver calls a callback routine for each property sheet page; these
122 * pages are supposed to be filled into the structure pointed to by lpPropSheet.
123 * The layout of this structure is:
125 * struct
127 * DWORD nPages;
128 * DWORD unknown;
129 * HPROPSHEETPAGE pages[10];
130 * };
132 INT WINAPI GDI_CallExtDeviceModePropSheet16( HWND hWnd, LPCSTR lpszDevice,
133 LPCSTR lpszPort, LPVOID lpPropSheet )
135 FIXME_(gdi)("(%04x, %s, %s, %p)\n",
136 hWnd, lpszDevice, lpszPort, lpPropSheet );
137 return -1;
140 /*****************************************************************************
141 * GDI_CallExtDeviceMode16 [GDI32.102]
143 * This should load the correct driver for lpszDevice and calls this driver's
144 * ExtDeviceMode proc.
146 INT WINAPI GDI_CallExtDeviceMode16( HWND hwnd,
147 LPDEVMODE16 lpdmOutput, LPSTR lpszDevice,
148 LPSTR lpszPort, LPDEVMODE16 lpdmInput,
149 LPSTR lpszProfile, DWORD fwMode )
151 FIXME_(gdi)("(%04x, %p, %s, %s, %p, %s, %ld)\n",
152 hwnd, lpdmOutput, lpszDevice, lpszPort,
153 lpdmInput, lpszProfile, fwMode );
154 return -1;
157 /****************************************************************************
158 * GDI_CallAdvancedSetupDialog16 [GDI32.103]
160 * This should load the correct driver for lpszDevice and calls this driver's
161 * AdvancedSetupDialog proc.
163 INT WINAPI GDI_CallAdvancedSetupDialog16( HWND hwnd, LPSTR lpszDevice,
164 LPDEVMODE16 devin, LPDEVMODE16 devout )
166 FIXME_(gdi)("(%04x, %s, %p, %p)\n",
167 hwnd, lpszDevice, devin, devout );
168 return -1;
171 /*****************************************************************************
172 * GDI_CallDeviceCapabilities16 [GDI32.104]
174 * This should load the correct driver for lpszDevice and calls this driver's
175 * DeviceCapabilities proc.
177 DWORD WINAPI GDI_CallDeviceCapabilities16( LPSTR lpszDevice, LPSTR lpszPort,
178 DWORD fwCapability, LPSTR lpszOutput,
179 LPDEVMODE16 lpdm )
181 FIXME_(gdi)("(%s, %s, %ld, %p, %p)\n",
182 lpszDevice, lpszPort, fwCapability, lpszOutput, lpdm );
183 return -1L;