58{
65 HKEY DrvKey, CustomKey;
69
70
71
72
73
75 {
76
79
82 goto custom_end;
83
87
89 goto custom_end;
90
92 {
93
94 ERR(
"Forcing ReactOS Software Implementation\n");
97 }
98
101 goto custom_end;
102
105 goto custom_end;
106
110 goto custom_end;
111
112 dwInput = sizeof(DriverVersion);
115
116
118
119custom_end:
120 if(OglKey)
123 }
124
125
127 {
129 }
131 {
133 }
134 else
135 {
136
139
140
143
144
145 dwInput = 0;
147
149 {
150 ERR(
"Driver claims to support OPENGL_GETINFO escape code, but doesn't.\n");
152 }
153
154 pDrvInfo = &DrvInfo;
155 }
156
157
159
160
163 {
165 {
166
167 TRACE(
"Found already loaded %p.\n",
data);
170 }
172 }
173
174
177 {
178 ERR(
"Failed to open the OpenGLDrivers key.\n");
180 }
183 {
184
185 TRACE(
"No driver subkey for %S, trying to get DLL name directly.\n", pDrvInfo->
DriverName);
186 dwInput = sizeof(DllName);
189 {
190 ERR(
"Unable to get ICD DLL name!\n");
193 }
195 TRACE(
"DLL name is %S.\n", DllName);
196 }
197 else
198 {
199
200 TRACE(
"Querying details from registry for %S.\n", pDrvInfo->
DriverName);
201 dwInput = sizeof(DllName);
204 {
205 ERR(
"Unable to get ICD DLL name!.\n");
209 }
210
214 {
215 WARN(
"No version in driver subkey\n");
216 }
218 {
219 ERR(
"Version mismatch between registry (%lu) and display driver (%lu).\n",
Version, pDrvInfo->
Version);
223 }
224
225 dwInput = sizeof(DriverVersion);
228 {
229 WARN(
"No driver version in driver subkey\n");
230 }
232 {
233 ERR(
"Driver version mismatch between registry (%lu) and display driver (%lu).\n", DriverVersion, pDrvInfo->
DriverVersion);
237 }
238
239 dwInput =
sizeof(
Flags);
242 {
243 WARN(
"No driver version in driver subkey\n");
245 }
246
247
249 TRACE(
"DLL name is %S, Version %lx, DriverVersion %lx, Flags %lx.\n", DllName,
Version, DriverVersion,
Flags);
250 }
251
253
254
257 {
258 ERR(
"Unable to allocate ICD data!\n");
260 }
261
262
265 {
266 ERR(
"Could not load the ICD DLL: %S.\n", DllName);
270 }
271
272
273
274
275
277 if(DrvValidateVersion)
278 {
280 {
281 ERR(
"DrvValidateVersion failed!.\n");
282 goto fail;
283 }
284 }
285
286
288 if(DrvSetCallbackProcs)
289 {
295 }
296
297
298#define DRV_LOAD(x) do \
299{ \
300 data->x = (void*)GetProcAddress(data->hModule, #x); \
301 if(!data->x) { \
302 ERR("%S lacks " #x "!\n", DllName); \
303 goto fail; \
304 } \
305} while(0)
312 DRV_LOAD(DrvGetLayerPaletteEntries);
317 DRV_LOAD(DrvSetLayerPaletteEntries);
322#undef DRV_LOAD
323
324
325
327 {
328
329 TRACE(
"Forwarding WGL calls to win32k!\n");
333 }
334
335
337
338
341
343 TRACE(
"ICD driver %S (%S) successfully loaded.\n", pDrvInfo->
DriverName, DllName);
344
346
349
350fail:
355}
#define RegCloseKey(hKey)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
#define GetProcAddress(x, y)
#define HeapFree(x, y, z)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
BOOL APIENTRY GdiSetPixelFormat(HDC hdc, INT ipfd)
static void APIENTRY wglSetCurrentValue(PVOID value)
static CRITICAL_SECTION icdload_cs
BOOL APIENTRY GdiSwapBuffers(HDC hdc)
static struct ICD_Data * ICD_Data_List
static CUSTOM_DRIVER_STATE CustomDriverState
static const WCHAR OpenGLDrivers_Key[]
static DHGLRC APIENTRY wglGetDHGLRC(struct wgl_context *context)
INT APIENTRY GdiDescribePixelFormat(HDC hdc, INT ipfd, UINT cjpfd, PPIXELFORMATDESCRIPTOR ppfd)
static const WCHAR CustomDrivers_Key[]
static PVOID APIENTRY wglGetCurrentValue()
static Drv_Opengl_Info CustomDrvInfo
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
const GLCLTPROCTABLE *WINAPI * DrvSetContext(HDC hdc, DHGLRC hglrc, PFN_SETPROCTABLE callback)
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
FN_DrvDescribePixelFormat DrvDescribePixelFormat
FN_DrvSetPixelFormat DrvSetPixelFormat
FN_DrvSwapBuffers DrvSwapBuffers
int WINAPI ExtEscape(_In_ HDC hdc, _In_ int iEscape, _In_ int cjInput, _In_reads_bytes_opt_(cjInput) LPCSTR lpInData, _In_ int cjOutput, _Out_writes_bytes_opt_(cjOutput) LPSTR lpOutData)
#define HKEY_LOCAL_MACHINE
#define HKEY_CURRENT_USER
_Must_inspect_result_ _In_ ULONG Flags