Commit efcecb9b authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddrawex: Implement a wrapper around IDirectDraw.

This allows us to cleanly implement the differences between ddraw.dll and ddrawex.dll without private functions and if checks if an object was created by ddraw or ddrawex. A similar wrapper will be added for IDirectDrawSurface.
parent 8eff8acc
......@@ -6,6 +6,7 @@ MODULE = ddrawex.dll
IMPORTS = dxguid uuid ddraw ole32 advapi32 kernel32
C_SRCS = \
ddraw.c \
main.c \
regsvr.c
......
......@@ -55,7 +55,7 @@ typedef struct
/******************************************************************************
* DirectDrawFactopry implementation
* DirectDrawFactory implementation
******************************************************************************/
typedef struct
{
......@@ -63,4 +63,23 @@ typedef struct
LONG ref;
} IDirectDrawFactoryImpl;
HRESULT WINAPI IDirectDrawFactoryImpl_CreateDirectDraw(IDirectDrawFactory* iface,
GUID * pGUID, HWND hWnd, DWORD dwCoopLevelFlags, DWORD dwReserved, IUnknown *pUnkOuter,
IDirectDraw **ppDirectDraw);
/******************************************************************************
* IDirectDraw wrapper implementation
******************************************************************************/
typedef struct
{
const IDirectDrawVtbl *IDirectDraw_Vtbl;
const IDirectDraw2Vtbl *IDirectDraw2_Vtbl;
const IDirectDraw3Vtbl *IDirectDraw3_Vtbl;
const IDirectDraw4Vtbl *IDirectDraw4_Vtbl;
LONG ref;
/* The interface we're forwarding to */
IDirectDraw4 *parent;
} IDirectDrawImpl;
#endif /* __WINE_DLLS_DDRAWEX_DDRAWEX_PRIVATE_H */
......@@ -33,7 +33,7 @@
#include "initguid.h"
#include "ddrawex_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
WINE_DEFAULT_DEBUG_CHANNEL(ddrawex);
/*******************************************************************************
......@@ -194,36 +194,6 @@ IDirectDrawFactoryImpl_Release(IDirectDrawFactory *iface)
return ref;
}
/*******************************************************************************
* IDirectDrawFactoryImpl_CreateDirectDraw
*******************************************************************************/
static HRESULT WINAPI
IDirectDrawFactoryImpl_CreateDirectDraw(IDirectDrawFactory* iface,
GUID * pGUID,
HWND hWnd,
DWORD dwCoopLevelFlags,
DWORD dwReserved,
IUnknown *pUnkOuter,
IDirectDraw **ppDirectDraw)
{
HRESULT hr;
TRACE("\n");
hr = DirectDrawCreateEx(pGUID, (void**)ppDirectDraw, &IID_IDirectDraw3, pUnkOuter);
if (FAILED(hr))
return hr;
hr = IDirectDraw_SetCooperativeLevel(*ppDirectDraw, hWnd, dwCoopLevelFlags);
if (FAILED(hr))
IDirectDraw_Release(*ppDirectDraw);
return hr;
}
/*******************************************************************************
* IDirectDrawFactoryImpl_DirectDrawEnumerate
*******************************************************************************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment