63{
70 HKEY DrvKey, CustomKey;
74
75
76
77
78
80 {
81
84
87 goto custom_end;
88
92
94 goto custom_end;
95
97 {
98
99 ERR(
"Forcing ReactOS Software Implementation\n");
102 }
103
106 goto custom_end;
107
110 goto custom_end;
111
115 goto custom_end;
116
117 dwInput = sizeof(DriverVersion);
120
121
123
124custom_end:
125 if(OglKey)
128 }
129
130
132 {
134 }
136 {
138 }
139 else
140 {
141
144
145
148
149
152
154 {
155 ERR(
"Driver claims to support OPENGL_GETINFO escape code, but doesn't. ret: %X\n",
ret);
157 }
158
159 pDrvInfo = &DrvInfo;
160 }
161
162
164
165
168 {
170 {
171
172 TRACE(
"Found already loaded %p.\n",
data);
175 }
177 }
178
179
182 {
183 ERR(
"Failed to open the OpenGLDrivers key.\n");
185 }
188 {
189
190 TRACE(
"No driver subkey for %S, trying to get DLL name directly.\n", pDrvInfo->
DriverName);
191 dwInput = sizeof(DllName);
194 {
195 ERR(
"Unable to get ICD DLL name!\n");
198 }
200 TRACE(
"DLL name is %S.\n", DllName);
201 }
202 else
203 {
204
205 TRACE(
"Querying details from registry for %S.\n", pDrvInfo->
DriverName);
206 dwInput = sizeof(DllName);
209 {
210 ERR(
"Unable to get ICD DLL name!.\n");
214 }
215
219 {
220 WARN(
"No version in driver subkey\n");
221 }
223 {
224 ERR(
"Version mismatch between registry (%lu) and display driver (%lu).\n",
Version, pDrvInfo->
Version);
228 }
229
230 dwInput = sizeof(DriverVersion);
233 {
234 WARN(
"No driver version in driver subkey\n");
235 }
237 {
238 ERR(
"Driver version mismatch between registry (%lu) and display driver (%lu).\n", DriverVersion, pDrvInfo->
DriverVersion);
242 }
243
244 dwInput =
sizeof(
Flags);
247 {
248 WARN(
"No driver version in driver subkey\n");
250 }
251
252
254 TRACE(
"DLL name is %S, Version %lx, DriverVersion %lx, Flags %lx.\n", DllName,
Version, DriverVersion,
Flags);
255 }
256
258
259
262 {
263 ERR(
"Unable to allocate ICD data!\n");
265 }
266
267
270 {
271 ERR(
"Could not load the ICD DLL: %S.\n", DllName);
275 }
276
277
278
279
280
282 if(DrvValidateVersion)
283 {
285 {
286 ERR(
"DrvValidateVersion failed!.\n");
287 goto fail;
288 }
289 }
290
291
293 if(DrvSetCallbackProcs)
294 {
300 }
301
302
303#define DRV_LOAD(x) do \
304{ \
305 data->x = (void*)GetProcAddress(data->hModule, #x); \
306 if(!data->x) { \
307 ERR("%S lacks " #x "!\n", DllName); \
308 goto fail; \
309 } \
310} while(0)
317 DRV_LOAD(DrvGetLayerPaletteEntries);
322 DRV_LOAD(DrvSetLayerPaletteEntries);
327#undef DRV_LOAD
328
329
330
332 {
333
334 TRACE(
"Forwarding WGL calls to win32k!\n");
338 }
339
340
342
343
346
348 TRACE(
"ICD driver %S (%S) successfully loaded.\n", pDrvInfo->
DriverName, DllName);
349
351
354
355fail:
360}
#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)
#define OPENGL_GETINFO_DRVNAME
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)
WCHAR DriverName[MAX_PATH+1]
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