27#define DDRAW_INIT_GUID
70 char DriverName[512] =
"", DriverDescription[512] =
"";
74 memset(&adapter_id, 0x0,
sizeof(adapter_id));
95 if (!(
t->entries = heap_alloc_zero(initial_size *
sizeof(*
t->entries))))
97 ERR(
"Failed to allocate handle table memory.\n");
100 t->free_entries =
NULL;
101 t->table_size = initial_size;
124 ERR(
"Handle %#x (%p) is in the free list, but has type %#x.\n",
idx,
entry->object,
entry->type);
127 t->free_entries =
entry->object;
134 if (!(
t->entry_count <
t->table_size))
137 UINT new_size =
t->table_size + (
t->table_size >> 1);
140 if (!(new_entries =
heap_realloc(
t->entries, new_size *
sizeof(*
t->entries))))
142 ERR(
"Failed to grow the handle table.\n");
145 t->entries = new_entries;
146 t->table_size = new_size;
149 entry = &
t->entries[
t->entry_count];
153 return t->entry_count++;
174 object =
entry->object;
175 entry->object =
t->free_entries;
199 return entry->object;
206 TRACE(
"dc %p, surface %p, device_dc %p.\n",
dc, surface, device_dc);
270 TRACE(
"driver_guid %s, ddraw %p, outer_unknown %p, interface_iid %s.\n",
293 if (UnkOuter !=
NULL)
300 if (!(
ddraw = heap_alloc_zero(
sizeof(*
ddraw))))
302 ERR(
"Out of memory when creating DirectDraw\n");
309 WARN(
"Failed to initialize ddraw object, hr %#x.\n",
hr);
337 TRACE(
"driver_guid %s, ddraw %p, outer %p.\n",
346 if (
FAILED(
hr = IDirectDraw_Initialize(*
ddraw, driver_guid)))
347 IDirectDraw_Release(*
ddraw);
367 TRACE(
"driver_guid %s, ddraw %p, interface_iid %s, outer %p.\n",
370 if (!
IsEqualGUID(interface_iid, &IID_IDirectDraw7))
380 hr = IDirectDraw7_Initialize(ddraw7, driver_guid);
382 IDirectDraw7_Release(ddraw7);
442 TRACE(
"Enumerating ddraw interfaces\n");
447 WARN(
"Failed to create a wined3d object.\n");
451 WARN(
"Created a wined3d object without 3D support.\n");
457 static CHAR driver_desc[] =
"DirectDraw HAL",
458 driver_name[] =
"display";
461 TRACE(
"Default interface: DirectDraw HAL\n");
476 TRACE(
"End of enumeration\n");
563 IDirectDrawClipper *Clip;
575 hr = IDirectDrawClipper_QueryInterface(Clip,
riid,
obj);
576 IDirectDrawClipper_Release(Clip);
624 IClassFactory_AddRef(iface);
694 TRACE(
"iface %p, outer_unknown %p, riid %s, out %p.\n",
714 FIXME(
"iface %p, dolock %#x stub!\n", iface, dolock);
736 TRACE(
"rclsid %s, riid %s, out %p.\n",
826 ERR(
"Failed to register ddraw window class, last error %#x.\n",
GetLastError());
857 TRACE(
"ForceRefreshRate set; overriding refresh rate to %d Hz\n",
data);
871 (
const WCHAR *)&ddraw_self, &ddraw_self))
872 ERR(
"Failed to get own module handle.\n");
888 WARN(
"DirectDraw object %p has reference counts {%u, %u, %u, %u, %u}.\n",
896 WARN(
"Surface %p has reference counts {%u, %u, %u, %u, %u, %u}.\n",
static BOOL heap_free(void *mem)
static void * heap_realloc(void *mem, size_t len)
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static void list_add_head(struct list_entry *head, struct list_entry *entry)
const GUID IID_IClassFactory
#define RegCloseKey(hKey)
#define DDRAW_WINDOW_CLASS_NAME
#define DDRAW_INVALID_HANDLE
#define DDRAW_WINED3D_FLAGS
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
HRESULT WINAPI DirectDrawEnumerateExW(LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags)
HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW lpCallback, LPVOID lpContext)
HRESULT WINAPI DirectDrawCreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER *lplpDDClipper, LPUNKNOWN pUnkOuter)
HRESULT WINAPI DirectDrawCreateEx(LPGUID lpGUID, LPVOID *lplpDD, REFIID id, LPUNKNOWN pUnkOuter)
HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA lpCallback, LPVOID lpContext)
HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags)
HRESULT WINAPI DirectDrawCreate(LPGUID lpGUID, LPDIRECTDRAW *lplpDD, LPUNKNOWN pUnkOuter)
static const struct object_creation_info object_creation[]
HRESULT WINAPI DllRegisterServer(void)
static HINSTANCE instance
HRESULT WINAPI DllUnregisterServer(void)
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
HRESULT WINAPI DllCanUnloadNow(void)
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
HRESULT ddraw_init(struct ddraw *ddraw, DWORD flags, enum wined3d_device_type device_type)
static HRESULT WINAPI ddraw_class_factory_LockServer(IClassFactory *iface, BOOL dolock)
void * ddraw_free_handle(struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type)
static HRESULT CF_CreateDirectDrawClipper(IUnknown *UnkOuter, REFIID riid, void **obj)
static HRESULT DDRAW_Create(const GUID *guid, void **DD, IUnknown *UnkOuter, REFIID iid)
void * ddraw_get_object(struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type)
static void ddraw_enumerate_secondary_devices(struct wined3d *wined3d, LPDDENUMCALLBACKEXA callback, void *context)
void ddraw_handle_table_destroy(struct ddraw_handle_table *t)
static HRESULT WINAPI ddraw_class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out)
static BOOL CALLBACK enum_callback(GUID *guid, char *description, char *driver_name, void *context, HMONITOR monitor)
static const IClassFactoryVtbl IClassFactory_Vtbl
static ULONG WINAPI ddraw_class_factory_AddRef(IClassFactory *iface)
BOOL ddraw_handle_table_init(struct ddraw_handle_table *t, UINT initial_size)
static struct list global_ddraw_list
DWORD ddraw_allocate_handle(struct ddraw_handle_table *t, void *object, enum ddraw_handle_type type)
static HRESULT CF_CreateDirectDraw(IUnknown *UnkOuter, REFIID iid, void **obj)
HRESULT WINAPI GetSurfaceFromDC(HDC dc, IDirectDrawSurface4 **surface, HDC *device_dc)
static HRESULT WINAPI ddraw_class_factory_CreateInstance(IClassFactory *iface, IUnknown *outer_unknown, REFIID riid, void **out)
static ULONG WINAPI ddraw_class_factory_Release(IClassFactory *iface)
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
#define DLL_PROCESS_ATTACH
#define DLL_PROCESS_DETACH
#define __EXCEPT_PAGE_FAULT
BOOL WINAPI GetModuleHandleExW(IN DWORD dwFlags, IN LPCWSTR lpwModuleName OPTIONAL, OUT HMODULE *phModule)
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
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
static IPrintDialogCallback callback
#define IsEqualGUID(rguid1, rguid2)
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
#define DDENUM_ATTACHEDSECONDARYDEVICES
#define DDERR_UNSUPPORTED
#define DDCREATE_HARDWAREONLY
#define DDERR_INVALIDPARAMS
#define DDENUM_DETACHEDSECONDARYDEVICES
#define DDENUM_NONDISPLAYDEVICES
#define DDCREATE_EMULATIONONLY
#define DECLSPEC_HOTPATCH
static __inline const char * wine_dbgstr_guid(const GUID *id)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
LPDDENUMCALLBACKA callback
IClassFactory IClassFactory_iface
HRESULT(* pfnCreateInstance)(IUnknown *outer, REFIID iid, void **out)
struct list surface_list_entry
struct d3d_device * d3ddevice
IDirectDraw7 IDirectDraw7_iface
IDirectDraw4 IDirectDraw4_iface
struct list ddraw_list_entry
IClassFactory IClassFactory_iface
#define CONTAINING_RECORD(address, type, field)
DWORD WINAPI GetLastError(void)
ULONG CDECL wined3d_decref(struct wined3d *wined3d)
HRESULT CDECL wined3d_get_output_desc(const struct wined3d *wined3d, unsigned int adapter_idx, struct wined3d_output_desc *desc)
HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d, UINT adapter_idx, DWORD flags, struct wined3d_adapter_identifier *identifier)
#define WINED3D_LEGACY_FFP_LIGHTING
@ WINED3D_DEVICE_TYPE_HAL
@ WINED3D_DEVICE_TYPE_REF
void WINAPI wined3d_mutex_unlock(void)
struct wined3d *CDECL wined3d_create(DWORD flags)
void WINAPI wined3d_mutex_lock(void)
#define CLASS_E_NOAGGREGATION
#define CLASS_E_CLASSNOTAVAILABLE
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define HKEY_LOCAL_MACHINE
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)