2 * Graphics driver management functions
4 * Copyright 1996 Alexandre Julliard
10 #include "debugtools.h"
12 DECLARE_DEBUG_CHANNEL(driver
)
13 DECLARE_DEBUG_CHANNEL(gdi
)
15 typedef struct tagGRAPHICS_DRIVER
17 struct tagGRAPHICS_DRIVER
*next
;
19 const DC_FUNCTIONS
*funcs
;
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
;
35 driver
->name
= HEAP_strdupA( SystemHeap
, 0, name
);
36 driver
->next
= firstDriver
;
40 /* No name -> it's the generic driver */
43 WARN_(driver
)(" already a generic driver\n" );
44 HeapFree( SystemHeap
, 0, driver
);
48 genericDriver
= driver
;
53 /**********************************************************************
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
)
76 GRAPHICS_DRIVER
**ppDriver
= &firstDriver
;
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
);
87 ppDriver
= &(*ppDriver
)->next
;
93 if (!genericDriver
) return FALSE
;
94 HeapFree( SystemHeap
, 0, genericDriver
);
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
);
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:
129 * HPROPSHEETPAGE pages[10];
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
);
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
);
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
);
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
,
181 FIXME_(gdi
)("(%s, %s, %ld, %p, %p)\n",
182 lpszDevice
, lpszPort
, fwCapability
, lpszOutput
, lpdm
);