On 1/15/2012 19:04, André Hentschel wrote:
dlls/d3drm/device.c | 165 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 165 insertions(+), 0 deletions(-)
diff --git a/dlls/d3drm/device.c b/dlls/d3drm/device.c index f02ce33..957b465 100644 --- a/dlls/d3drm/device.c +++ b/dlls/d3drm/device.c @@ -29,17 +29,20 @@ #include "wingdi.h"
#include "d3drm_private.h" +#include "d3drmwin.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
typedef struct { IDirect3DRMDevice2 IDirect3DRMDevice2_iface; IDirect3DRMDevice3 IDirect3DRMDevice3_iface;
IDirect3DRMWinDevice IDirect3DRMWinDevice_iface; LONG ref; } IDirect3DRMDeviceImpl;
static const struct IDirect3DRMDevice2Vtbl Direct3DRMDevice2_Vtbl; static const struct IDirect3DRMDevice3Vtbl Direct3DRMDevice3_Vtbl;
+static const struct IDirect3DRMWinDeviceVtbl Direct3DRMWinDevice_Vtbl;
You can move instance creation call after all vtables initialization, so you won't need these forwards.
static inline IDirect3DRMDeviceImpl *impl_from_IDirect3DRMDevice2(IDirect3DRMDevice2 *iface) { @@ -51,6 +54,11 @@ static inline IDirect3DRMDeviceImpl *impl_from_IDirect3DRMDevice3(IDirect3DRMDev return CONTAINING_RECORD(iface, IDirect3DRMDeviceImpl, IDirect3DRMDevice3_iface); }
+static inline IDirect3DRMDeviceImpl *impl_from_IDirect3DRMWinDevice(IDirect3DRMWinDevice *iface) +{
- return CONTAINING_RECORD(iface, IDirect3DRMDeviceImpl, IDirect3DRMWinDevice_iface);
+}
- HRESULT Direct3DRMDevice_create(REFIID riid, IUnknown** ppObj) { IDirect3DRMDeviceImpl* object;
@@ -66,6 +74,7 @@ HRESULT Direct3DRMDevice_create(REFIID riid, IUnknown** ppObj)
object->IDirect3DRMDevice2_iface.lpVtbl =&Direct3DRMDevice2_Vtbl; object->IDirect3DRMDevice3_iface.lpVtbl =&Direct3DRMDevice3_Vtbl;
object->IDirect3DRMWinDevice_iface.lpVtbl =&Direct3DRMWinDevice_Vtbl; object->ref = 1;
if (IsEqualGUID(riid,&IID_IDirect3DRMFrame3))
@@ -96,6 +105,10 @@ static HRESULT WINAPI IDirect3DRMDevice2Impl_QueryInterface(IDirect3DRMDevice2* { *object =&This->IDirect3DRMDevice3_iface; }
- else if(IsEqualGUID(riid,&IID_IDirect3DRMWinDevice))
- {
*object =&This->IDirect3DRMWinDevice_iface;
- } else { FIXME("interface %s not implemented\n", debugstr_guid(riid));
@@ -1021,3 +1034,155 @@ static const struct IDirect3DRMDevice3Vtbl Direct3DRMDevice3_Vtbl = IDirect3DRMDevice3Impl_GetStateChangeOptions, IDirect3DRMDevice3Impl_SetStateChangeOptions };
+/*** IUnknown methods ***/ +static HRESULT WINAPI IDirect3DRMWinDeviceImpl_QueryInterface(IDirect3DRMWinDevice* iface,
REFIID riid, void** object)
+{
- IDirect3DRMDeviceImpl *This = impl_from_IDirect3DRMWinDevice(iface);
- return IDirect3DRMDevice2_QueryInterface(&This->IDirect3DRMDevice2_iface, riid, object);
+}
+static ULONG WINAPI IDirect3DRMWinDeviceImpl_AddRef(IDirect3DRMWinDevice* iface) +{
- IDirect3DRMDeviceImpl *This = impl_from_IDirect3DRMWinDevice(iface);
- TRACE("(%p)\n", This);
- return InterlockedIncrement(&This->ref);
+}
+static ULONG WINAPI IDirect3DRMWinDeviceImpl_Release(IDirect3DRMWinDevice* iface) +{
- IDirect3DRMDeviceImpl *This = impl_from_IDirect3DRMWinDevice(iface);
- ULONG ref = InterlockedDecrement(&This->ref);
- TRACE("(%p)\n", This);
- if (!ref)
HeapFree(GetProcessHeap(), 0, This);
- return ref;
+}
AddRef and Release should be forwards as well.