From 99daff8f0349a8a1df316f14c0f471657dc4b4e5 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 7 Nov 2012 21:41:12 +0100 Subject: [PATCH] ddraw: Avoid LPDIRECTDRAW. --- dlls/ddraw/main.c | 16 ++++++---------- dlls/ddraw/tests/ddrawmodes.c | 2 +- dlls/ddraw/tests/dsurface.c | 2 +- include/amvideo.idl | 6 +++--- include/ddraw.h | 16 ++++++++-------- 5 files changed, 19 insertions(+), 23 deletions(-) diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index 6d0ddc48d85..51f9dda3cae 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c @@ -270,25 +270,21 @@ DDRAW_Create(const GUID *guid, * Arguments, return values: See DDRAW_Create * ***********************************************************************/ -HRESULT WINAPI DECLSPEC_HOTPATCH -DirectDrawCreate(GUID *GUID, - LPDIRECTDRAW *DD, - IUnknown *UnkOuter) +HRESULT WINAPI DECLSPEC_HOTPATCH DirectDrawCreate(GUID *driver_guid, IDirectDraw **ddraw, IUnknown *outer) { HRESULT hr; - TRACE("driver_guid %s, ddraw %p, outer_unknown %p.\n", - debugstr_guid(GUID), DD, UnkOuter); + TRACE("driver_guid %s, ddraw %p, outer %p.\n", + debugstr_guid(driver_guid), ddraw, outer); wined3d_mutex_lock(); - hr = DDRAW_Create(GUID, (void **) DD, UnkOuter, &IID_IDirectDraw); + hr = DDRAW_Create(driver_guid, (void **)ddraw, outer, &IID_IDirectDraw); wined3d_mutex_unlock(); if (SUCCEEDED(hr)) { - hr = IDirectDraw_Initialize(*DD, GUID); - if (FAILED(hr)) - IDirectDraw_Release(*DD); + if (FAILED(hr = IDirectDraw_Initialize(*ddraw, driver_guid))) + IDirectDraw_Release(*ddraw); } return hr; diff --git a/dlls/ddraw/tests/ddrawmodes.c b/dlls/ddraw/tests/ddrawmodes.c index 548ca9b4fcf..5068f54295b 100644 --- a/dlls/ddraw/tests/ddrawmodes.c +++ b/dlls/ddraw/tests/ddrawmodes.c @@ -29,9 +29,9 @@ #include "wine/test.h" #include "ddraw.h" -static LPDIRECTDRAW lpDD = NULL; static IDirectDrawSurface *lpDDSPrimary; static IDirectDrawSurface *lpDDSBack; +static IDirectDraw *lpDD; static WNDCLASS wc; static HWND hwnd, hwnd2; static int modes_cnt; diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c index c9d7d113351..c8f90c911e4 100644 --- a/dlls/ddraw/tests/dsurface.c +++ b/dlls/ddraw/tests/dsurface.c @@ -31,7 +31,7 @@ static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID *, void **, REFIID, IUnknown *); -static LPDIRECTDRAW lpDD = NULL; +static IDirectDraw *lpDD; static DDCAPS ddcaps; static BOOL CreateDirectDraw(void) diff --git a/include/amvideo.idl b/include/amvideo.idl index 37d06ff0841..ad9205506c1 100644 --- a/include/amvideo.idl +++ b/include/amvideo.idl @@ -21,7 +21,7 @@ import "objidl.idl"; /* trick widl into thinking that it knows the DirectDraw types * as there is no IDL file for them (yet) */ cpp_quote("#if 0") -typedef void * LPDIRECTDRAW; +typedef void IDirectDraw; typedef void DDSURFACEDESC,DDCAPS; typedef DWORD RGBQUAD; typedef LONGLONG REFERENCE_TIME; @@ -73,8 +73,8 @@ interface IDirectDrawVideo : IUnknown HRESULT GetEmulatedCaps([out] DDCAPS *pCaps); HRESULT GetSurfaceDesc([out] DDSURFACEDESC * pSurfaceDesc); HRESULT GetFourCCCodes([out] DWORD * pCount, [out] DWORD * pCodes); - HRESULT SetDirectDraw([in] LPDIRECTDRAW pDirectDraw); - HRESULT GetDirectDraw([out] LPDIRECTDRAW * ppDirectDraw); + HRESULT SetDirectDraw([in] IDirectDraw *ddraw); + HRESULT GetDirectDraw([out] IDirectDraw **ddraw); HRESULT GetSurfaceType([out] DWORD * pSurfaceType); HRESULT SetDefault(); HRESULT UseScanLine([in] long UseScanLine); diff --git a/include/ddraw.h b/include/ddraw.h index ede7885e002..8bdb99fd9df 100644 --- a/include/ddraw.h +++ b/include/ddraw.h @@ -1235,7 +1235,7 @@ DECLARE_INTERFACE_(IDirectDrawPalette,IUnknown) /*** IDirectDrawPalette methods ***/ STDMETHOD(GetCaps)(THIS_ LPDWORD lpdwCaps) PURE; STDMETHOD(GetEntries)(THIS_ DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable) PURE; + STDMETHOD(Initialize)(THIS_ struct IDirectDraw *ddraw, DWORD flags, PALETTEENTRY *color_table) PURE; STDMETHOD(SetEntries)(THIS_ DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries) PURE; }; #undef INTERFACE @@ -1276,7 +1276,7 @@ DECLARE_INTERFACE_(IDirectDrawClipper,IUnknown) /*** IDirectDrawClipper methods ***/ STDMETHOD(GetClipList)(THIS_ LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize) PURE; STDMETHOD(GetHWnd)(THIS_ HWND *lphWnd) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, DWORD dwFlags) PURE; + STDMETHOD(Initialize)(THIS_ struct IDirectDraw *ddraw, DWORD flags) PURE; STDMETHOD(IsClipListChanged)(THIS_ BOOL *lpbChanged) PURE; STDMETHOD(SetClipList)(THIS_ LPRGNDATA lpClipList, DWORD dwFlags) PURE; STDMETHOD(SetHWnd)(THIS_ DWORD dwFlags, HWND hWnd) PURE; @@ -1893,7 +1893,7 @@ DECLARE_INTERFACE_(IDirectDrawSurface,IUnknown) /*50*/ STDMETHOD(GetPalette)(THIS_ IDirectDrawPalette **palette) PURE; /*54*/ STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; /*58*/ STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; -/*5c*/ STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE; +/*5c*/ STDMETHOD(Initialize)(THIS_ IDirectDraw *ddraw, DDSURFACEDESC *surface_desc) PURE; /*60*/ STDMETHOD(IsLost)(THIS) PURE; /*64*/ STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; /*68*/ STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE; @@ -2027,7 +2027,7 @@ DECLARE_INTERFACE_(IDirectDrawSurface2,IUnknown) STDMETHOD(GetPalette)(THIS_ IDirectDrawPalette **palette) PURE; STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE; + STDMETHOD(Initialize)(THIS_ IDirectDraw *ddraw, DDSURFACEDESC *surface_desc) PURE; STDMETHOD(IsLost)(THIS) PURE; STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE; @@ -2173,7 +2173,7 @@ DECLARE_INTERFACE_(IDirectDrawSurface3,IUnknown) STDMETHOD(GetPalette)(THIS_ IDirectDrawPalette **palette) PURE; STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC lpDDSurfaceDesc) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) PURE; + STDMETHOD(Initialize)(THIS_ IDirectDraw *ddraw, DDSURFACEDESC *surface_desc) PURE; STDMETHOD(IsLost)(THIS) PURE; STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE; @@ -2324,7 +2324,7 @@ DECLARE_INTERFACE_(IDirectDrawSurface4,IUnknown) STDMETHOD(GetPalette)(THIS_ IDirectDrawPalette **palette) PURE; STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE; + STDMETHOD(Initialize)(THIS_ IDirectDraw *ddraw, DDSURFACEDESC2 *surface_desc) PURE; STDMETHOD(IsLost)(THIS) PURE; STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC2 lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE; @@ -2491,7 +2491,7 @@ DECLARE_INTERFACE_(IDirectDrawSurface7,IUnknown) STDMETHOD(GetPalette)(THIS_ IDirectDrawPalette **palette) PURE; STDMETHOD(GetPixelFormat)(THIS_ LPDDPIXELFORMAT lpDDPixelFormat) PURE; STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE; - STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW lpDD, LPDDSURFACEDESC2 lpDDSurfaceDesc) PURE; + STDMETHOD(Initialize)(THIS_ IDirectDraw *ddraw, DDSURFACEDESC2 *surface_desc) PURE; STDMETHOD(IsLost)(THIS) PURE; STDMETHOD(Lock)(THIS_ LPRECT lpDestRect, LPDDSURFACEDESC2 lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent) PURE; STDMETHOD(ReleaseDC)(THIS_ HDC hDC) PURE; @@ -2708,7 +2708,7 @@ DECLARE_INTERFACE_(IDirectDrawGammaControl,IUnknown) #endif -HRESULT WINAPI DirectDrawCreate(GUID*,LPDIRECTDRAW*,IUnknown*); +HRESULT WINAPI DirectDrawCreate(GUID *driver_guid, IDirectDraw **ddraw, IUnknown *outer); HRESULT WINAPI DirectDrawCreateEx(GUID*,LPVOID*,REFIID,IUnknown*); HRESULT WINAPI DirectDrawCreateClipper(DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer);