ReactOS 0.4.17-dev-966-gf06eace
main.c
Go to the documentation of this file.
1/* DirectDraw Base Functions
2 *
3 * Copyright 1997-1999 Marcus Meissner
4 * Copyright 1998 Lionel Ulmer
5 * Copyright 2000-2001 TransGaming Technologies Inc.
6 * Copyright 2006 Stefan Dösinger
7 * Copyright 2008 Denver Gingerich
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#define DDRAW_INIT_GUID
25#include "ddraw_private.h"
26#include "rpcproxy.h"
27
28#include "wine/exception.h"
29#include "winreg.h"
30
32
34
36
37/* value of ForceRefreshRate */
39
41
42/* Structure for converting DirectDrawEnumerateA to DirectDrawEnumerateExA */
44{
45 LPDDENUMCALLBACKA callback;
46 void *context;
47};
48
49/* Enumeration callback for converting DirectDrawEnumerateA to DirectDrawEnumerateExA */
50static BOOL CALLBACK enum_callback(GUID *guid, char *description, char *driver_name,
51 void *context, HMONITOR monitor)
52{
53 const struct callback_info *info = context;
54
55 return info->callback(guid, description, driver_name, info->context);
56}
57
58static void ddraw_enumerate_secondary_devices(struct wined3d *wined3d, LPDDENUMCALLBACKEXA callback,
59 void *context)
60{
61 struct wined3d_adapter_identifier adapter_id;
63 struct wined3d_output_desc output_desc;
65 unsigned int interface_count = 0;
66 unsigned int adapter_idx = 0;
67 unsigned int output_idx;
68 BOOL cont_enum = TRUE;
69 HRESULT hr;
70
71 while (cont_enum && (wined3d_adapter = wined3d_get_adapter(wined3d, adapter_idx)))
72 {
73 char device_name[512] = "", description[512] = "";
74
75 /* The Battle.net System Checker expects the GetAdapterIdentifier DeviceName to match the
76 * Driver Name, so obtain the DeviceName and GUID from D3D. */
77 memset(&adapter_id, 0x0, sizeof(adapter_id));
78 adapter_id.description = description;
79 adapter_id.description_size = sizeof(description);
80
83 {
84 WARN("Failed to get adapter identifier, hr %#lx.\n", hr);
86 break;
87 }
89
90 for (output_idx = 0; cont_enum && (wined3d_output = wined3d_adapter_get_output(
91 wined3d_adapter, output_idx)); ++output_idx)
92 {
94 if (FAILED(hr = wined3d_output_get_desc(wined3d_output, &output_desc)))
95 {
96 WARN("Failed to get output description, hr %#lx.\n", hr);
98 break;
99 }
101
102 TRACE("Interface %u: %s\n", interface_count++,
105 sizeof(device_name), NULL, NULL);
106 cont_enum = callback(&adapter_id.device_identifier, adapter_id.description,
107 device_name, context, output_desc.monitor);
108 }
109
110 if (FAILED(hr))
111 break;
112
113 ++adapter_idx;
114 }
115}
116
117/* Handle table functions */
119{
120 if (!(t->entries = calloc(initial_size, sizeof(*t->entries))))
121 {
122 ERR("Failed to allocate handle table memory.\n");
123 return FALSE;
124 }
125 t->free_entries = NULL;
126 t->table_size = initial_size;
127 t->entry_count = 0;
128
129 return TRUE;
130}
131
133{
134 free(t->entries);
135 memset(t, 0, sizeof(*t));
136}
137
139{
141
142 if (!t)
144
145 if (t->free_entries)
146 {
147 DWORD idx = t->free_entries - t->entries;
148 /* Use a free handle */
149 entry = t->free_entries;
150 if (entry->type != DDRAW_HANDLE_FREE)
151 {
152 ERR("Handle %#lx (%p) is in the free list, but has type %#x.\n", idx, entry->object, entry->type);
154 }
155 t->free_entries = entry->object;
156 entry->object = object;
157 entry->type = type;
158
159 return idx;
160 }
161
162 if (!(t->entry_count < t->table_size))
163 {
164 /* Grow the table */
165 UINT new_size = t->table_size + (t->table_size >> 1);
166 struct ddraw_handle_entry *new_entries;
167
168 if (!(new_entries = realloc(t->entries, new_size * sizeof(*t->entries))))
169 {
170 ERR("Failed to grow the handle table.\n");
172 }
173 t->entries = new_entries;
174 t->table_size = new_size;
175 }
176
177 entry = &t->entries[t->entry_count];
178 entry->object = object;
179 entry->type = type;
180
181 return t->entry_count++;
182}
183
185{
187 void *object;
188
189 if (!t)
191
192 if (handle == DDRAW_INVALID_HANDLE || handle >= t->entry_count)
193 {
194 WARN("Invalid handle %#lx passed.\n", handle);
195 return NULL;
196 }
197
198 entry = &t->entries[handle];
199 if (entry->type != type)
200 {
201 WARN("Handle %#lx (%p) is not of type %#x.\n", handle, entry->object, type);
202 return NULL;
203 }
204
205 object = entry->object;
206 entry->object = t->free_entries;
207 entry->type = DDRAW_HANDLE_FREE;
208 t->free_entries = entry;
209
210 return object;
211}
212
214{
216
217 if (!t)
219
220 if (handle == DDRAW_INVALID_HANDLE || handle >= t->entry_count)
221 {
222 WARN("Invalid handle %#lx passed.\n", handle);
223 return NULL;
224 }
225
226 entry = &t->entries[handle];
227 if (entry->type != type)
228 {
229 WARN("Handle %#lx (%p) is not of type %#x.\n", handle, entry->object, type);
230 return NULL;
231 }
232
233 return entry->object;
234}
235
236HRESULT WINAPI GetSurfaceFromDC(HDC dc, IDirectDrawSurface4 **surface, HDC *device_dc)
237{
238 struct ddraw *ddraw;
239
240 TRACE("dc %p, surface %p, device_dc %p.\n", dc, surface, device_dc);
241
242 if (!surface)
243 return E_INVALIDARG;
244
245 if (!device_dc)
246 {
247 *surface = NULL;
248
249 return E_INVALIDARG;
250 }
251
254 {
255 if (FAILED(IDirectDraw4_GetSurfaceFromDC(&ddraw->IDirectDraw4_iface, dc, surface)))
256 continue;
257
258 *device_dc = NULL; /* FIXME */
260 return DD_OK;
261 }
263
264 *surface = NULL;
265 *device_dc = NULL;
266
267 return DDERR_NOTFOUND;
268}
269
270/***********************************************************************
271 *
272 * Helper function for DirectDrawCreate and friends
273 * Creates a new DDraw interface with the given REFIID
274 *
275 * Interfaces that can be created:
276 * IDirectDraw, IDirectDraw2, IDirectDraw4, IDirectDraw7
277 * IDirect3D, IDirect3D2, IDirect3D3, IDirect3D7. (Does Windows return
278 * IDirect3D interfaces?)
279 *
280 * Arguments:
281 * guid: ID of the requested driver, NULL for the default driver.
282 * The GUID can be queried with DirectDrawEnumerate(Ex)A/W
283 * DD: Used to return the pointer to the created object
284 * UnkOuter: For aggregation, which is unsupported. Must be NULL
285 * iid: requested version ID.
286 *
287 * Returns:
288 * DD_OK if the Interface was created successfully
289 * CLASS_E_NOAGGREGATION if UnkOuter is not NULL
290 * E_OUTOFMEMORY if some allocation failed
291 *
292 ***********************************************************************/
293static HRESULT DDRAW_Create(const GUID *guid, void **out, IUnknown *outer_unknown, REFIID iid)
294{
296 struct ddraw *ddraw;
297 DWORD flags = 0;
298 HRESULT hr;
299
300 TRACE("driver_guid %s, ddraw %p, outer_unknown %p, interface_iid %s.\n",
301 debugstr_guid(guid), out, outer_unknown, debugstr_guid(iid));
302
303 *out = NULL;
304
306 {
308 }
309 else if (guid == (GUID *) DDCREATE_HARDWAREONLY)
310 {
312 }
313 else
314 {
316 }
317
318 /* DDraw doesn't support aggregation, according to msdn */
319 if (outer_unknown != NULL)
321
322 if (!IsEqualGUID(iid, &IID_IDirectDraw7))
324
325 if (!(ddraw = calloc(1, sizeof(*ddraw))))
326 {
327 ERR("Out of memory when creating DirectDraw.\n");
328 return E_OUTOFMEMORY;
329 }
330
332 {
333 WARN("Failed to initialize ddraw object, hr %#lx.\n", hr);
334 free(ddraw);
335 return hr;
336 }
337
338 hr = IDirectDraw7_QueryInterface(&ddraw->IDirectDraw7_iface, iid, out);
339 IDirectDraw7_Release(&ddraw->IDirectDraw7_iface);
340 if (SUCCEEDED(hr))
342 else
343 WARN("Failed to query interface %s from ddraw object %p.\n", debugstr_guid(iid), ddraw);
344
345 return hr;
346}
347
348/***********************************************************************
349 * DirectDrawCreate (DDRAW.@)
350 *
351 * Creates legacy DirectDraw Interfaces. Can't create IDirectDraw7
352 * interfaces in theory
353 *
354 * Arguments, return values: See DDRAW_Create
355 *
356 ***********************************************************************/
358{
359 HRESULT hr;
360
361 TRACE("driver_guid %s, ddraw %p, outer %p.\n",
362 debugstr_guid(driver_guid), ddraw, outer);
363
365 hr = DDRAW_Create(driver_guid, (void **)ddraw, outer, &IID_IDirectDraw);
367
368 if (SUCCEEDED(hr))
369 {
370 if (FAILED(hr = IDirectDraw_Initialize(*ddraw, driver_guid)))
371 IDirectDraw_Release(*ddraw);
372 }
373
374 return hr;
375}
376
377/***********************************************************************
378 * DirectDrawCreateEx (DDRAW.@)
379 *
380 * Only creates new IDirectDraw7 interfaces, supposed to fail if legacy
381 * interfaces are requested.
382 *
383 * Arguments, return values: See DDRAW_Create
384 *
385 ***********************************************************************/
387 void **ddraw, REFIID interface_iid, IUnknown *outer)
388{
389 HRESULT hr;
390
391 TRACE("driver_guid %s, ddraw %p, interface_iid %s, outer %p.\n",
392 debugstr_guid(driver_guid), ddraw, debugstr_guid(interface_iid), outer);
393
394 if (!IsEqualGUID(interface_iid, &IID_IDirectDraw7))
395 return DDERR_INVALIDPARAMS;
396
398 hr = DDRAW_Create(driver_guid, ddraw, outer, interface_iid);
400
401 if (SUCCEEDED(hr))
402 {
403 IDirectDraw7 *ddraw7 = *(IDirectDraw7 **)ddraw;
404 hr = IDirectDraw7_Initialize(ddraw7, driver_guid);
405 if (FAILED(hr))
406 IDirectDraw7_Release(ddraw7);
407 }
408
409 return hr;
410}
411
412/***********************************************************************
413 * DirectDrawEnumerateA (DDRAW.@)
414 *
415 * Enumerates legacy ddraw drivers, ascii version. We only have one
416 * driver, which relays to WineD3D. If we were sufficiently cool,
417 * we could offer various interfaces, which use a different default surface
418 * implementation, but I think it's better to offer this choice in
419 * winecfg, because some apps use the default driver, so we would need
420 * a winecfg option anyway, and there shouldn't be 2 ways to set one setting
421 *
422 * Arguments:
423 * Callback: Callback function from the app
424 * Context: Argument to the call back.
425 *
426 * Returns:
427 * DD_OK on success
428 * E_INVALIDARG if the Callback caused a page fault
429 *
430 *
431 ***********************************************************************/
433{
434 struct callback_info info;
435
436 TRACE("callback %p, context %p.\n", callback, context);
437
438 info.callback = callback;
439 info.context = context;
441}
442
443/***********************************************************************
444 * DirectDrawEnumerateExA (DDRAW.@)
445 *
446 * Enumerates DirectDraw7 drivers, ascii version. See
447 * the comments above DirectDrawEnumerateA for more details.
448 *
449 * The Flag member is not supported right now.
450 *
451 ***********************************************************************/
453{
454 struct wined3d *wined3d;
455
456 TRACE("callback %p, context %p, flags %#lx.\n", callback, context, flags);
457
461 return DDERR_INVALIDPARAMS;
462
464 FIXME("flags %#lx not handled\n", flags & ~DDENUM_ATTACHEDSECONDARYDEVICES);
465
466 TRACE("Enumerating ddraw interfaces\n");
468 {
470 {
471 WARN("Failed to create a wined3d object.\n");
472 return E_FAIL;
473 }
474
475 WARN("Created a wined3d object without 3D support.\n");
476 }
477
478 __TRY
479 {
480 /* QuickTime expects the description "DirectDraw HAL" */
481 static CHAR driver_desc[] = "DirectDraw HAL",
482 driver_name[] = "display";
483 BOOL cont_enum;
484
485 TRACE("Default interface: DirectDraw HAL\n");
486 cont_enum = callback(NULL, driver_desc, driver_name, context, 0);
487
488 /* The Battle.net System Checker expects both a NULL device and a GUID-based device */
489 if (cont_enum && (flags & DDENUM_ATTACHEDSECONDARYDEVICES))
491 }
493 {
495 return DDERR_INVALIDPARAMS;
496 }
497 __ENDTRY;
498
500 TRACE("End of enumeration\n");
501 return DD_OK;
502}
503
504/***********************************************************************
505 * DirectDrawEnumerateW (DDRAW.@)
506 *
507 * Enumerates legacy drivers, unicode version.
508 * This function is not implemented on Windows.
509 *
510 ***********************************************************************/
512{
513 TRACE("callback %p, context %p.\n", callback, context);
514
515 if (!callback)
516 return DDERR_INVALIDPARAMS;
517 else
518 return DDERR_UNSUPPORTED;
519}
520
521/***********************************************************************
522 * DirectDrawEnumerateExW (DDRAW.@)
523 *
524 * Enumerates DirectDraw7 drivers, unicode version.
525 * This function is not implemented on Windows.
526 *
527 ***********************************************************************/
529{
530 TRACE("callback %p, context %p, flags %#lx.\n", callback, context, flags);
531
532 return DDERR_UNSUPPORTED;
533}
534
535/***********************************************************************
536 * Classfactory implementation.
537 ***********************************************************************/
538
539/***********************************************************************
540 * CF_CreateDirectDraw
541 *
542 * DDraw creation function for the class factory
543 *
544 * Params:
545 * UnkOuter: Set to NULL
546 * iid: ID of the wanted interface
547 * obj: Address to pass the interface pointer back
548 *
549 * Returns
550 * DD_OK / DDERR*, see DDRAW_Create
551 *
552 ***********************************************************************/
553static HRESULT
555 void **obj)
556{
557 HRESULT hr;
558
559 TRACE("outer_unknown %p, riid %s, object %p.\n", UnkOuter, debugstr_guid(iid), obj);
560
562 hr = DDRAW_Create(NULL, obj, UnkOuter, iid);
564
565 return hr;
566}
567
568/***********************************************************************
569 * CF_CreateDirectDraw
570 *
571 * Clipper creation function for the class factory
572 *
573 * Params:
574 * UnkOuter: Set to NULL
575 * iid: ID of the wanted interface
576 * obj: Address to pass the interface pointer back
577 *
578 * Returns
579 * DD_OK / DDERR*, see DDRAW_Create
580 *
581 ***********************************************************************/
582static HRESULT
584 void **obj)
585{
586 HRESULT hr;
587 IDirectDrawClipper *Clip;
588
589 TRACE("outer_unknown %p, riid %s, object %p.\n", UnkOuter, debugstr_guid(riid), obj);
590
592 hr = DirectDrawCreateClipper(0, &Clip, UnkOuter);
593 if (hr != DD_OK)
594 {
596 return hr;
597 }
598
599 hr = IDirectDrawClipper_QueryInterface(Clip, riid, obj);
600 IDirectDrawClipper_Release(Clip);
601
603
604 return hr;
605}
606
608{
609 { &CLSID_DirectDraw, CF_CreateDirectDraw },
610 { &CLSID_DirectDraw7, CF_CreateDirectDraw },
611 { &CLSID_DirectDrawClipper, CF_CreateDirectDrawClipper }
612};
613
615{
617
620};
621
623{
625}
626
627/*******************************************************************************
628 * IDirectDrawClassFactory::QueryInterface
629 *
630 * QueryInterface for the class factory
631 *
632 * PARAMS
633 * riid Reference to identifier of queried interface
634 * ppv Address to return the interface pointer at
635 *
636 * RETURNS
637 * Success: S_OK
638 * Failure: E_NOINTERFACE
639 *
640 *******************************************************************************/
642{
643 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
644
647 {
648 IClassFactory_AddRef(iface);
649 *out = iface;
650 return S_OK;
651 }
652
653 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
654
655 return E_NOINTERFACE;
656}
657
658/*******************************************************************************
659 * IDirectDrawClassFactory::AddRef
660 *
661 * AddRef for the class factory
662 *
663 * RETURNS
664 * The new refcount
665 *
666 *******************************************************************************/
668{
671
672 TRACE("%p increasing refcount to %lu.\n", factory, ref);
673
674 return ref;
675}
676
677/*******************************************************************************
678 * IDirectDrawClassFactory::Release
679 *
680 * Release for the class factory. If the refcount falls to 0, the object
681 * is destroyed
682 *
683 * RETURNS
684 * The new refcount
685 *
686 *******************************************************************************/
688{
691
692 TRACE("%p decreasing refcount to %lu.\n", factory, ref);
693
694 if (!ref)
695 free(factory);
696
697 return ref;
698}
699
700
701/*******************************************************************************
702 * IDirectDrawClassFactory::CreateInstance
703 *
704 * What is this? Seems to create DirectDraw objects...
705 *
706 * Params
707 * The usual things???
708 *
709 * RETURNS
710 * ???
711 *
712 *******************************************************************************/
714 IUnknown *outer_unknown, REFIID riid, void **out)
715{
717
718 TRACE("iface %p, outer_unknown %p, riid %s, out %p.\n",
719 iface, outer_unknown, debugstr_guid(riid), out);
720
721 return factory->pfnCreateInstance(outer_unknown, riid, out);
722}
723
724/*******************************************************************************
725 * IDirectDrawClassFactory::LockServer
726 *
727 * What is this?
728 *
729 * Params
730 * ???
731 *
732 * RETURNS
733 * S_OK, because it's a stub
734 *
735 *******************************************************************************/
737{
738 FIXME("iface %p, dolock %#x stub!\n", iface, dolock);
739
740 return S_OK;
741}
742
743/*******************************************************************************
744 * The class factory VTable
745 *******************************************************************************/
746static const IClassFactoryVtbl IClassFactory_Vtbl =
747{
753};
754
756{
758 unsigned int i;
759
760 TRACE("rclsid %s, riid %s, out %p.\n",
762
765 return E_NOINTERFACE;
766
767 for (i=0; i < ARRAY_SIZE(object_creation); i++)
768 {
769 if (IsEqualGUID(object_creation[i].clsid, rclsid))
770 break;
771 }
772
774 {
775 FIXME("%s: no class found.\n", debugstr_guid(rclsid));
777 }
778
779 if (!(factory = calloc(1, sizeof(*factory))))
780 return E_OUTOFMEMORY;
781
783 factory->ref = 1;
784
785 factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
786
787 *out = factory;
788 return S_OK;
789}
790
791
792/***********************************************************************
793 * DllMain (DDRAW.0)
794 *
795 * Could be used to register DirectDraw drivers, if we have more than
796 * one. Also used to destroy any objects left at unload if the
797 * app didn't release them properly(Gothic 2, Diablo 2, Moto racer, ...)
798 *
799 ***********************************************************************/
801{
802 switch (reason)
803 {
805 {
806 static HMODULE ddraw_self;
807 HKEY hkey = 0;
808 WNDCLASSA wc;
809
810 /* Register the window class. This is used to create a hidden window
811 * for D3D rendering, if the application didn't pass one. It can also
812 * be used for creating a device window from SetCooperativeLevel(). */
815 wc.cbClsExtra = 0;
816 wc.cbWndExtra = 0;
817 wc.hInstance = inst;
818 wc.hIcon = 0;
819 wc.hCursor = 0;
821 wc.lpszMenuName = NULL;
823 if (!RegisterClassA(&wc))
824 {
825 ERR("Failed to register ddraw window class, last error %#lx.\n", GetLastError());
826 return FALSE;
827 }
828
830 {
832 return FALSE;
833 }
834
835 /* On Windows one can force the refresh rate that DirectDraw uses by
836 * setting an override value in dxdiag. This is documented in KB315614
837 * (main article), KB230002, and KB217348. By comparing registry dumps
838 * before and after setting the override, we see that the override value
839 * is stored in HKLM\Software\Microsoft\DirectDraw\ForceRefreshRate as a
840 * DWORD that represents the refresh rate to force. We use this
841 * registry entry to modify the behavior of SetDisplayMode so that Wine
842 * users can override the refresh rate in a Windows-compatible way.
843 *
844 * dxdiag will not accept a refresh rate lower than 40 or higher than
845 * 120 so this value should be within that range. It is, of course,
846 * possible for a user to set the registry entry value directly so that
847 * assumption might not hold.
848 *
849 * There is no current mechanism for setting this value through the Wine
850 * GUI. It would be most appropriate to set this value through a dxdiag
851 * clone, but it may be sufficient to use winecfg.
852 *
853 * TODO: Create a mechanism for setting this value through the Wine GUI.
854 */
855 if ( !RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectDraw", &hkey ) )
856 {
858
859 size = sizeof(data);
860 if (!RegQueryValueExA(hkey, "ForceRefreshRate", NULL, &type, (BYTE *)&data, &size) && type == REG_DWORD)
861 {
862 TRACE("ForceRefreshRate set; overriding refresh rate to %ld Hz\n", data);
864 }
865 RegCloseKey( hkey );
866 }
867
868 /* Prevent the ddraw module from being unloaded. When switching to
869 * exclusive mode, we replace the window proc of the ddraw window. If
870 * an application would unload ddraw from the WM_DESTROY handler for
871 * that window, it would return to unmapped memory and die. Apparently
872 * this is supposed to work on Windows. */
873 if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN,
874 (const WCHAR *)&ddraw_self, &ddraw_self))
875 ERR("Failed to get own module handle.\n");
876
877 instance = inst;
879 break;
880 }
881
883 if (WARN_ON(ddraw))
884 {
885 struct ddraw *ddraw;
886 unsigned int i;
887
889 {
890 struct ddraw_surface *surface;
891
892 WARN("DirectDraw object %p has reference counts {%lu, %lu, %lu, %lu, %lu}.\n",
894
896 WARN("DirectDraw object %p has Direct3D device(s) attached.\n", ddraw);
897
899 {
900 WARN("Surface %p has reference counts {%lu, %lu, %lu, %lu, %lu, %lu}.\n",
901 surface, surface->ref7, surface->ref4, surface->ref3,
902 surface->ref2, surface->ref1, surface->gamma_count);
903 }
904 }
905
906 for (i = 0; i < global_handle_table.entry_count; ++i)
907 {
908 struct ddraw_handle_entry *entry = &global_handle_table.entries[i];
909
910 switch (entry->type)
911 {
913 break;
914
916 WARN("Material handle %#x (%p) not unset properly.\n", i + 1, entry->object);
917 break;
918
920 WARN("Texture handle %#x (%p) not unset properly.\n", i + 1, entry->object);
921 break;
922
924 WARN("Leftover matrix handle %#x (%p), deleting.\n", i + 1, entry->object);
925 break;
926
927 default:
928 WARN("Handle %#x (%p) has unknown type %#x.\n", i + 1, entry->object, entry->type);
929 break;
930 }
931 }
933 }
934
935 if (reserved) break;
937 }
938
939 return TRUE;
940}
#define DECLSPEC_HOTPATCH
Definition: _mingw.h:240
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
static int list_empty(struct list_entry *head)
Definition: list.h:58
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
BOOL NTAPI DllMain(_In_ HINSTANCE hDll, _In_ ULONG dwReason, _In_opt_ PVOID pReserved)
Definition: main.c:33
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define RegCloseKey(hKey)
Definition: registry.h:49
Definition: list.h:39
HDC dc
Definition: cylfrac.c:34
void * description
#define DDRAW_WINDOW_CLASS_NAME
#define DDRAW_INVALID_HANDLE
ddraw_handle_type
@ DDRAW_HANDLE_SURFACE
@ DDRAW_HANDLE_MATRIX
@ DDRAW_HANDLE_MATERIAL
@ DDRAW_HANDLE_FREE
#define DDRAW_WINED3D_FLAGS
Definition: ddraw_private.h:63
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
HRESULT hr
Definition: delayimp.cpp:582
device_type
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT WINAPI DirectDrawEnumerateExW(LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags)
Definition: main.c:277
HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW lpCallback, LPVOID lpContext)
Definition: main.c:267
HRESULT WINAPI DirectDrawCreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER *lplpDDClipper, LPUNKNOWN pUnkOuter)
Definition: main.c:55
HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID *lplpDD, REFIID id, LPUNKNOWN pUnkOuter)
Definition: main.c:139
HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA lpCallback, LPVOID lpContext)
Definition: main.c:180
HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags)
Definition: main.c:208
HRESULT WINAPI DirectDrawCreate(LPGUID lpGUID, LPDIRECTDRAW *lplpDD, LPUNKNOWN pUnkOuter)
Definition: main.c:86
static const struct object_creation_info object_creation[]
Definition: main.c:60
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: main.c:153
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: main.c:49
HRESULT ddraw_init(struct ddraw *ddraw, DWORD flags, enum wined3d_device_type device_type)
Definition: ddraw.c:5079
static HRESULT WINAPI ddraw_class_factory_LockServer(IClassFactory *iface, BOOL dolock)
Definition: main.c:736
void * ddraw_free_handle(struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type)
Definition: main.c:184
DWORD force_refresh_rate
Definition: main.c:38
static HRESULT CF_CreateDirectDrawClipper(IUnknown *UnkOuter, REFIID riid, void **obj)
Definition: main.c:583
static HRESULT DDRAW_Create(const GUID *guid, void **out, IUnknown *outer_unknown, REFIID iid)
Definition: main.c:293
void * ddraw_get_object(struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type)
Definition: main.c:213
static HINSTANCE instance
Definition: main.c:35
static void ddraw_enumerate_secondary_devices(struct wined3d *wined3d, LPDDENUMCALLBACKEXA callback, void *context)
Definition: main.c:58
void ddraw_handle_table_destroy(struct ddraw_handle_table *t)
Definition: main.c:132
struct ddraw_handle_table global_handle_table
Definition: main.c:40
static HRESULT WINAPI ddraw_class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out)
Definition: main.c:641
static BOOL CALLBACK enum_callback(GUID *guid, char *description, char *driver_name, void *context, HMONITOR monitor)
Definition: main.c:50
static const IClassFactoryVtbl IClassFactory_Vtbl
Definition: main.c:746
static ULONG WINAPI ddraw_class_factory_AddRef(IClassFactory *iface)
Definition: main.c:667
BOOL ddraw_handle_table_init(struct ddraw_handle_table *t, UINT initial_size)
Definition: main.c:118
static struct list global_ddraw_list
Definition: main.c:33
DWORD ddraw_allocate_handle(struct ddraw_handle_table *t, void *object, enum ddraw_handle_type type)
Definition: main.c:138
static HRESULT CF_CreateDirectDraw(IUnknown *UnkOuter, REFIID iid, void **obj)
Definition: main.c:554
HRESULT WINAPI GetSurfaceFromDC(HDC dc, IDirectDrawSurface4 **surface, HDC *device_dc)
Definition: main.c:236
static HRESULT WINAPI ddraw_class_factory_CreateInstance(IClassFactory *iface, IUnknown *outer_unknown, REFIID riid, void **out)
Definition: main.c:713
static ULONG WINAPI ddraw_class_factory_Release(IClassFactory *iface)
Definition: main.c:687
unsigned int idx
Definition: utils.c:40
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3234
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1971
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define CP_ACP
Definition: compat.h:109
#define __TRY
Definition: compat.h:80
#define __ENDTRY
Definition: compat.h:82
#define CALLBACK
Definition: compat.h:35
#define WideCharToMultiByte
Definition: compat.h:111
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:81
BOOL WINAPI GetModuleHandleExW(IN DWORD dwFlags, IN LPCWSTR lpwModuleName OPTIONAL, OUT HMODULE *phModule)
Definition: loader.c:866
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
GUID guid
Definition: version.c:147
r reserved
Definition: btrfs.c:3006
static const WCHAR device_name[]
Definition: btrfs.c:60
size_t const new_size
Definition: expand.cpp:66
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble t
Definition: gl.h:2047
GLsizeiptr size
Definition: glext.h:5919
GLbitfield flags
Definition: glext.h:7161
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: sysinfo.c:13
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_guid
Definition: kernel32.h:35
#define WARN_ON(c)
Definition: module.h:257
static HDC
Definition: imagelist.c:88
static IPrintDialogCallback callback
Definition: printdlg.c:325
static IUnknown * outer
Definition: compobj.c:82
const CLSID * clsid
Definition: msctf.cpp:50
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
char CHAR
Definition: pedump.c:57
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
DWORD IDirectDraw7
Definition: vmrender.idl:21
#define CS_VREDRAW
Definition: winuser.h:666
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CS_HREDRAW
Definition: winuser.h:661
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define calloc
Definition: rosglue.h:14
#define REG_DWORD
Definition: sdbapi.c:615
#define DDERR_NOTFOUND
Definition: ddraw.h:99
#define DDENUM_ATTACHEDSECONDARYDEVICES
Definition: ddraw.h:193
#define DD_OK
Definition: ddraw.h:188
#define DDERR_UNSUPPORTED
Definition: ddraw.h:129
#define DDCREATE_HARDWAREONLY
Definition: ddraw.h:200
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:81
#define DDENUM_DETACHEDSECONDARYDEVICES
Definition: ddraw.h:194
#define DDENUM_NONDISPLAYDEVICES
Definition: ddraw.h:195
#define DDCREATE_EMULATIONONLY
Definition: ddraw.h:201
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:181
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:236
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
HBRUSH hbrBackground
Definition: winuser.h:3278
HICON hIcon
Definition: winuser.h:3276
HINSTANCE hInstance
Definition: winuser.h:3275
HCURSOR hCursor
Definition: winuser.h:3277
int cbWndExtra
Definition: winuser.h:3274
UINT style
Definition: winuser.h:3271
LPCSTR lpszMenuName
Definition: winuser.h:3279
LPCSTR lpszClassName
Definition: winuser.h:3280
WNDPROC lpfnWndProc
Definition: winuser.h:3272
int cbClsExtra
Definition: winuser.h:3273
LPDDENUMCALLBACKA callback
Definition: main.c:45
void * context
Definition: main.c:46
Definition: http.c:7252
IClassFactory IClassFactory_iface
Definition: main.c:616
HRESULT(* pfnCreateInstance)(IUnknown *outer, REFIID iid, void **out)
Definition: main.c:619
void * object
struct list surface_list_entry
LONG ref1
Definition: ddraw_private.h:94
IDirectDraw7 IDirectDraw7_iface
Definition: ddraw_private.h:83
LONG ref7
Definition: ddraw_private.h:94
struct list d3ddevice_list
struct list surface_list
IDirectDraw4 IDirectDraw4_iface
Definition: ddraw_private.h:84
struct list ddraw_list_entry
LONG ref4
Definition: ddraw_private.h:94
LONG ref2
Definition: ddraw_private.h:94
LONG ref3
Definition: ddraw_private.h:94
Definition: main.c:439
IClassFactory IClassFactory_iface
Definition: main.c:440
Definition: send.c:48
unsigned int description_size
Definition: wined3d.h:1746
WCHAR device_name[CCHDEVICENAME]
Definition: wined3d.h:2152
HMONITOR monitor
Definition: wined3d.h:2155
#define LIST_INIT(head)
Definition: queue.h:197
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
ULONG CDECL wined3d_decref(struct wined3d *wined3d)
Definition: directx.c:198
HRESULT CDECL wined3d_output_get_desc(const struct wined3d_output *output, struct wined3d_output_desc *desc)
Definition: directx.c:1256
HRESULT CDECL wined3d_adapter_get_identifier(const struct wined3d_adapter *adapter, uint32_t flags, struct wined3d_adapter_identifier *identifier)
Definition: directx.c:1785
struct wined3d_adapter *CDECL wined3d_get_adapter(const struct wined3d *wined3d, unsigned int idx)
Definition: directx.c:1009
struct wined3d_output *CDECL wined3d_adapter_get_output(const struct wined3d_adapter *adapter, unsigned int idx)
Definition: directx.c:1027
#define WINED3D_NO3D
Definition: wined3d.h:1323
#define WINED3D_LEGACY_FFP_LIGHTING
Definition: wined3d.h:1329
wined3d_device_type
Definition: wined3d.h:90
@ WINED3D_DEVICE_TYPE_HAL
Definition: wined3d.h:91
@ WINED3D_DEVICE_TYPE_REF
Definition: wined3d.h:92
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:544
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:539
struct wined3d *CDECL wined3d_create(uint32_t flags)
Definition: wined3d_main.c:142
#define E_NOINTERFACE
Definition: winerror.h:3479
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:3772
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define BLACK_BRUSH
Definition: wingdi.h:896
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
unsigned char BYTE
Definition: xxhash.c:193