Commit 87ef65ab authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Avoid LPVOID.

parent 9ccced6f
...@@ -296,28 +296,25 @@ HRESULT WINAPI DECLSPEC_HOTPATCH DirectDrawCreate(GUID *driver_guid, IDirectDraw ...@@ -296,28 +296,25 @@ HRESULT WINAPI DECLSPEC_HOTPATCH DirectDrawCreate(GUID *driver_guid, IDirectDraw
* Arguments, return values: See DDRAW_Create * Arguments, return values: See DDRAW_Create
* *
***********************************************************************/ ***********************************************************************/
HRESULT WINAPI DECLSPEC_HOTPATCH HRESULT WINAPI DECLSPEC_HOTPATCH DirectDrawCreateEx(GUID *driver_guid,
DirectDrawCreateEx(GUID *guid, void **ddraw, REFIID interface_iid, IUnknown *outer)
LPVOID *dd,
REFIID iid,
IUnknown *UnkOuter)
{ {
HRESULT hr; HRESULT hr;
TRACE("driver_guid %s, ddraw %p, interface_iid %s, outer_unknown %p.\n", TRACE("driver_guid %s, ddraw %p, interface_iid %s, outer %p.\n",
debugstr_guid(guid), dd, debugstr_guid(iid), UnkOuter); debugstr_guid(driver_guid), ddraw, debugstr_guid(interface_iid), outer);
if (!IsEqualGUID(iid, &IID_IDirectDraw7)) if (!IsEqualGUID(interface_iid, &IID_IDirectDraw7))
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = DDRAW_Create(guid, dd, UnkOuter, iid); hr = DDRAW_Create(driver_guid, ddraw, outer, interface_iid);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
IDirectDraw7 *ddraw7 = *(IDirectDraw7 **)dd; IDirectDraw7 *ddraw7 = *(IDirectDraw7 **)ddraw;
hr = IDirectDraw7_Initialize(ddraw7, guid); hr = IDirectDraw7_Initialize(ddraw7, driver_guid);
if (FAILED(hr)) if (FAILED(hr))
IDirectDraw7_Release(ddraw7); IDirectDraw7_Release(ddraw7);
} }
...@@ -551,7 +548,7 @@ struct ddraw_class_factory ...@@ -551,7 +548,7 @@ struct ddraw_class_factory
IClassFactory IClassFactory_iface; IClassFactory IClassFactory_iface;
LONG ref; LONG ref;
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, REFIID iid, LPVOID *ppObj); HRESULT (*pfnCreateInstance)(IUnknown *outer, REFIID iid, void **out);
}; };
static inline struct ddraw_class_factory *impl_from_IClassFactory(IClassFactory *iface) static inline struct ddraw_class_factory *impl_from_IClassFactory(IClassFactory *iface)
...@@ -687,30 +684,13 @@ static const IClassFactoryVtbl IClassFactory_Vtbl = ...@@ -687,30 +684,13 @@ static const IClassFactoryVtbl IClassFactory_Vtbl =
ddraw_class_factory_LockServer ddraw_class_factory_LockServer
}; };
/******************************************************************************* HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **out)
* DllGetClassObject [DDRAW.@]
* Retrieves class object from a DLL object
*
* NOTES
* Docs say returns STDAPI
*
* PARAMS
* rclsid [I] CLSID for the class object
* riid [I] Reference to identifier of interface for class object
* ppv [O] Address of variable to receive interface pointer for riid
*
* RETURNS
* Success: S_OK
* Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
* E_UNEXPECTED
*/
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{ {
struct ddraw_class_factory *factory; struct ddraw_class_factory *factory;
unsigned int i; unsigned int i;
TRACE("rclsid %s, riid %s, object %p.\n", TRACE("rclsid %s, riid %s, out %p.\n",
debugstr_guid(rclsid), debugstr_guid(riid), ppv); debugstr_guid(rclsid), debugstr_guid(riid), out);
if (!IsEqualGUID(&IID_IClassFactory, riid) if (!IsEqualGUID(&IID_IClassFactory, riid)
&& !IsEqualGUID(&IID_IUnknown, riid)) && !IsEqualGUID(&IID_IUnknown, riid))
...@@ -736,7 +716,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) ...@@ -736,7 +716,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance; factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
*ppv = factory; *out = factory;
return S_OK; return S_OK;
} }
...@@ -826,9 +806,8 @@ DestroyCallback(IDirectDrawSurface7 *surf, ...@@ -826,9 +806,8 @@ DestroyCallback(IDirectDrawSurface7 *surf,
* app didn't release them properly(Gothic 2, Diablo 2, Moto racer, ...) * app didn't release them properly(Gothic 2, Diablo 2, Moto racer, ...)
* *
***********************************************************************/ ***********************************************************************/
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved) BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved)
{ {
TRACE("(%p,%x,%p)\n", hInstDLL, reason, reserved);
switch (reason) switch (reason)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
...@@ -844,7 +823,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved) ...@@ -844,7 +823,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved)
wc.lpfnWndProc = DefWindowProcA; wc.lpfnWndProc = DefWindowProcA;
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
wc.hInstance = hInstDLL; wc.hInstance = inst;
wc.hIcon = 0; wc.hIcon = 0;
wc.hCursor = 0; wc.hCursor = 0;
wc.hbrBackground = GetStockObject(BLACK_BRUSH); wc.hbrBackground = GetStockObject(BLACK_BRUSH);
...@@ -899,8 +878,8 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved) ...@@ -899,8 +878,8 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved)
if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (const WCHAR *)&ddraw_self, &ddraw_self)) if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (const WCHAR *)&ddraw_self, &ddraw_self))
ERR("Failed to get own module handle.\n"); ERR("Failed to get own module handle.\n");
instance = hInstDLL; instance = inst;
DisableThreadLibraryCalls(hInstDLL); DisableThreadLibraryCalls(inst);
break; break;
} }
...@@ -969,7 +948,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved) ...@@ -969,7 +948,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved)
} }
if (reserved) break; if (reserved) break;
UnregisterClassA(DDRAW_WINDOW_CLASS_NAME, hInstDLL); UnregisterClassA(DDRAW_WINDOW_CLASS_NAME, inst);
} }
return TRUE; return TRUE;
......
...@@ -67,7 +67,8 @@ typedef struct ...@@ -67,7 +67,8 @@ typedef struct
char callback_name_strings[MAX_ENUMERATION_COUNT][100]; char callback_name_strings[MAX_ENUMERATION_COUNT][100];
} D3D7ELifetimeTest; } D3D7ELifetimeTest;
static HRESULT (WINAPI *pDirectDrawCreateEx)(LPGUID,LPVOID*,REFIID,LPUNKNOWN); static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID *driver_guid,
void **ddraw, REFIID interface_iid, IUnknown *outer);
static void init_function_pointers(void) static void init_function_pointers(void)
{ {
......
...@@ -43,10 +43,10 @@ static int modes16bpp_cnt; ...@@ -43,10 +43,10 @@ static int modes16bpp_cnt;
static int refresh_rate; static int refresh_rate;
static int refresh_rate_cnt; static int refresh_rate_cnt;
static HRESULT (WINAPI *pDirectDrawEnumerateA)(LPDDENUMCALLBACKA,LPVOID); static HRESULT (WINAPI *pDirectDrawEnumerateA)(LPDDENUMCALLBACKA cb, void *ctx);
static HRESULT (WINAPI *pDirectDrawEnumerateW)(LPDDENUMCALLBACKW,LPVOID); static HRESULT (WINAPI *pDirectDrawEnumerateW)(LPDDENUMCALLBACKW cb, void *ctx);
static HRESULT (WINAPI *pDirectDrawEnumerateExA)(LPDDENUMCALLBACKEXA,LPVOID,DWORD); static HRESULT (WINAPI *pDirectDrawEnumerateExA)(LPDDENUMCALLBACKEXA cb, void *ctx, DWORD flags);
static HRESULT (WINAPI *pDirectDrawEnumerateExW)(LPDDENUMCALLBACKEXW,LPVOID,DWORD); static HRESULT (WINAPI *pDirectDrawEnumerateExW)(LPDDENUMCALLBACKEXW cb, void *ctx, DWORD flags);
static void init_function_pointers(void) static void init_function_pointers(void)
{ {
...@@ -104,8 +104,8 @@ static void releasedirectdraw(void) ...@@ -104,8 +104,8 @@ static void releasedirectdraw(void)
} }
} }
static BOOL WINAPI test_nullcontext_callbackA(GUID *lpGUID, LPSTR lpDriverDescription, static BOOL WINAPI test_nullcontext_callbackA(GUID *lpGUID,
LPSTR lpDriverName, LPVOID lpContext) char *lpDriverDescription, char *lpDriverName, void *lpContext)
{ {
trace("test_nullcontext_callbackA: %p %s %s %p\n", trace("test_nullcontext_callbackA: %p %s %s %p\n",
lpGUID, lpDriverDescription, lpDriverName, lpContext); lpGUID, lpDriverDescription, lpDriverName, lpContext);
...@@ -115,13 +115,13 @@ static BOOL WINAPI test_nullcontext_callbackA(GUID *lpGUID, LPSTR lpDriverDescri ...@@ -115,13 +115,13 @@ static BOOL WINAPI test_nullcontext_callbackA(GUID *lpGUID, LPSTR lpDriverDescri
return TRUE; return TRUE;
} }
static BOOL WINAPI test_context_callbackA(GUID *lpGUID, LPSTR lpDriverDescription, static BOOL WINAPI test_context_callbackA(GUID *lpGUID,
LPSTR lpDriverName, LPVOID lpContext) char *lpDriverDescription, char *lpDriverName, void *lpContext)
{ {
trace("test_context_callbackA: %p %s %s %p\n", trace("test_context_callbackA: %p %s %s %p\n",
lpGUID, lpDriverDescription, lpDriverName, lpContext); lpGUID, lpDriverDescription, lpDriverName, lpContext);
ok(lpContext == (LPVOID)0xdeadbeef, "Expected non-NULL lpContext\n"); ok(lpContext == (void *)0xdeadbeef, "Expected non-NULL lpContext\n");
return TRUE; return TRUE;
} }
...@@ -147,12 +147,12 @@ static void test_DirectDrawEnumerateA(void) ...@@ -147,12 +147,12 @@ static void test_DirectDrawEnumerateA(void)
/* Test with valid callback parameter and valid context parameter. */ /* Test with valid callback parameter and valid context parameter. */
trace("Calling DirectDrawEnumerateA with test_context_callbackA callback and non-NULL context.\n"); trace("Calling DirectDrawEnumerateA with test_context_callbackA callback and non-NULL context.\n");
ret = pDirectDrawEnumerateA(test_context_callbackA, (LPVOID)0xdeadbeef); ret = pDirectDrawEnumerateA(test_context_callbackA, (void *)0xdeadbeef);
ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret); ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret);
} }
static BOOL WINAPI test_callbackW(GUID *lpGUID, LPWSTR lpDriverDescription, static BOOL WINAPI test_callbackW(GUID *lpGUID, WCHAR *lpDriverDescription,
LPWSTR lpDriverName, LPVOID lpContext) WCHAR *lpDriverName, void *lpContext)
{ {
ok(0, "The callback should not be invoked by DirectDrawEnumerateW\n"); ok(0, "The callback should not be invoked by DirectDrawEnumerateW\n");
return TRUE; return TRUE;
...@@ -187,9 +187,8 @@ static void test_DirectDrawEnumerateW(void) ...@@ -187,9 +187,8 @@ static void test_DirectDrawEnumerateW(void)
ok(ret == DDERR_UNSUPPORTED, "Expected DDERR_UNSUPPORTED, got %d\n", ret); ok(ret == DDERR_UNSUPPORTED, "Expected DDERR_UNSUPPORTED, got %d\n", ret);
} }
static BOOL WINAPI test_nullcontext_callbackExA(GUID *lpGUID, LPSTR lpDriverDescription, static BOOL WINAPI test_nullcontext_callbackExA(GUID *lpGUID, char *lpDriverDescription,
LPSTR lpDriverName, LPVOID lpContext, char *lpDriverName, void *lpContext, HMONITOR hm)
HMONITOR hm)
{ {
trace("test_nullcontext_callbackExA: %p %s %s %p %p\n", lpGUID, trace("test_nullcontext_callbackExA: %p %s %s %p %p\n", lpGUID,
lpDriverDescription, lpDriverName, lpContext, hm); lpDriverDescription, lpDriverName, lpContext, hm);
...@@ -199,14 +198,13 @@ static BOOL WINAPI test_nullcontext_callbackExA(GUID *lpGUID, LPSTR lpDriverDesc ...@@ -199,14 +198,13 @@ static BOOL WINAPI test_nullcontext_callbackExA(GUID *lpGUID, LPSTR lpDriverDesc
return TRUE; return TRUE;
} }
static BOOL WINAPI test_context_callbackExA(GUID *lpGUID, LPSTR lpDriverDescription, static BOOL WINAPI test_context_callbackExA(GUID *lpGUID, char *lpDriverDescription,
LPSTR lpDriverName, LPVOID lpContext, char *lpDriverName, void *lpContext, HMONITOR hm)
HMONITOR hm)
{ {
trace("test_context_callbackExA: %p %s %s %p %p\n", lpGUID, trace("test_context_callbackExA: %p %s %s %p %p\n", lpGUID,
lpDriverDescription, lpDriverName, lpContext, hm); lpDriverDescription, lpDriverName, lpContext, hm);
ok(lpContext == (LPVOID)0xdeadbeef, "Expected non-NULL lpContext\n"); ok(lpContext == (void *)0xdeadbeef, "Expected non-NULL lpContext\n");
return TRUE; return TRUE;
} }
...@@ -236,7 +234,7 @@ static void test_DirectDrawEnumerateExA(void) ...@@ -236,7 +234,7 @@ static void test_DirectDrawEnumerateExA(void)
/* Test with valid callback parameter and non-NULL context parameter. */ /* Test with valid callback parameter and non-NULL context parameter. */
trace("Calling DirectDrawEnumerateExA with empty flags and non-NULL context.\n"); trace("Calling DirectDrawEnumerateExA with empty flags and non-NULL context.\n");
ret = pDirectDrawEnumerateExA(test_context_callbackExA, (LPVOID)0xdeadbeef, 0); ret = pDirectDrawEnumerateExA(test_context_callbackExA, (void *)0xdeadbeef, 0);
ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret); ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret);
/* Test with valid callback parameter, NULL context parameter, and all flags set. */ /* Test with valid callback parameter, NULL context parameter, and all flags set. */
...@@ -248,9 +246,8 @@ static void test_DirectDrawEnumerateExA(void) ...@@ -248,9 +246,8 @@ static void test_DirectDrawEnumerateExA(void)
ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret); ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret);
} }
static BOOL WINAPI test_callbackExW(GUID *lpGUID, LPWSTR lpDriverDescription, static BOOL WINAPI test_callbackExW(GUID *lpGUID, WCHAR *lpDriverDescription,
LPWSTR lpDriverName, LPVOID lpContext, WCHAR *lpDriverName, void *lpContext, HMONITOR hm)
HMONITOR hm)
{ {
ok(0, "The callback should not be invoked by DirectDrawEnumerateExW.\n"); ok(0, "The callback should not be invoked by DirectDrawEnumerateExW.\n");
return TRUE; return TRUE;
......
...@@ -740,7 +740,7 @@ static void QueryInterface(void) ...@@ -740,7 +740,7 @@ static void QueryInterface(void)
{ {
IDirectDrawSurface *dsurface; IDirectDrawSurface *dsurface;
DDSURFACEDESC surface; DDSURFACEDESC surface;
LPVOID object; void *object;
HRESULT ret; HRESULT ret;
/* Create a surface */ /* Create a surface */
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
#include "ddraw.h" #include "ddraw.h"
#include "unknwn.h" #include "unknwn.h"
static HRESULT (WINAPI *pDirectDrawCreateEx)(LPGUID,LPVOID*,REFIID,LPUNKNOWN); static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID *driver_guid,
void **ddraw, REFIID interface_iid, IUnknown *outer);
static IDirectDraw7 *ddraw = NULL; static IDirectDraw7 *ddraw = NULL;
static IDirectDrawSurface7 *primary = NULL; static IDirectDrawSurface7 *primary = NULL;
......
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
#include "d3d.h" #include "d3d.h"
#include "unknwn.h" #include "unknwn.h"
static HRESULT (WINAPI *pDirectDrawCreateEx)(LPGUID,LPVOID*,REFIID,LPUNKNOWN); static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID *driver_guid,
void **ddraw, REFIID interface_iid, IUnknown *outer);
static void init_function_pointers(void) static void init_function_pointers(void)
{ {
......
...@@ -39,7 +39,8 @@ static IDirect3DViewport *Viewport; ...@@ -39,7 +39,8 @@ static IDirect3DViewport *Viewport;
static BOOL refdevice = FALSE; static BOOL refdevice = FALSE;
static HRESULT (WINAPI *pDirectDrawCreateEx)(LPGUID,LPVOID*,REFIID,LPUNKNOWN); static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID *driver_guid,
void **ddraw, REFIID interface_iid, IUnknown *outer);
static BOOL color_match(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) static BOOL color_match(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff)
{ {
......
...@@ -390,7 +390,7 @@ typedef struct _D3DExecuteBufferDesc { ...@@ -390,7 +390,7 @@ typedef struct _D3DExecuteBufferDesc {
DWORD dwFlags; DWORD dwFlags;
DWORD dwCaps; DWORD dwCaps;
DWORD dwBufferSize; DWORD dwBufferSize;
LPVOID lpData; void *lpData;
} D3DEXECUTEBUFFERDESC, *LPD3DEXECUTEBUFFERDESC; } D3DEXECUTEBUFFERDESC, *LPD3DEXECUTEBUFFERDESC;
#define D3DDEB_BUFSIZE 0x00000001 #define D3DDEB_BUFSIZE 0x00000001
......
...@@ -71,7 +71,7 @@ typedef LONG D3DFIXED; ...@@ -71,7 +71,7 @@ typedef LONG D3DFIXED;
#define D3DENUMRET_CANCEL DDENUMRET_CANCEL #define D3DENUMRET_CANCEL DDENUMRET_CANCEL
#define D3DENUMRET_OK DDENUMRET_OK #define D3DENUMRET_OK DDENUMRET_OK
typedef HRESULT (CALLBACK *LPD3DVALIDATECALLBACK)(LPVOID lpUserArg, DWORD dwOffset); typedef HRESULT (CALLBACK *LPD3DVALIDATECALLBACK)(void *ctx, DWORD offset);
typedef HRESULT (CALLBACK *LPD3DENUMTEXTUREFORMATSCALLBACK)(DDSURFACEDESC *surface_desc, void *ctx); typedef HRESULT (CALLBACK *LPD3DENUMTEXTUREFORMATSCALLBACK)(DDSURFACEDESC *surface_desc, void *ctx);
typedef HRESULT (CALLBACK *LPD3DENUMPIXELFORMATSCALLBACK)(DDPIXELFORMAT *format, void *ctx); typedef HRESULT (CALLBACK *LPD3DENUMPIXELFORMATSCALLBACK)(DDPIXELFORMAT *format, void *ctx);
...@@ -468,9 +468,9 @@ typedef struct _D3DVIEWPORT7 { ...@@ -468,9 +468,9 @@ typedef struct _D3DVIEWPORT7 {
typedef struct _D3DTRANSFORMDATA { typedef struct _D3DTRANSFORMDATA {
DWORD dwSize; DWORD dwSize;
LPVOID lpIn; void *lpIn;
DWORD dwInSize; DWORD dwInSize;
LPVOID lpOut; void *lpOut;
DWORD dwOutSize; DWORD dwOutSize;
D3DHVERTEX *lpHOut; D3DHVERTEX *lpHOut;
DWORD dwClip; DWORD dwClip;
...@@ -1270,9 +1270,10 @@ typedef struct _D3DVERTEXBUFFERDESC { ...@@ -1270,9 +1270,10 @@ typedef struct _D3DVERTEXBUFFERDESC {
#define D3DFVF_TLVERTEX ( D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | \ #define D3DFVF_TLVERTEX ( D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | \
D3DFVF_TEX1 ) D3DFVF_TEX1 )
typedef struct _D3DDP_PTRSTRIDE { typedef struct _D3DDP_PTRSTRIDE
LPVOID lpvData; {
DWORD dwStride; void *lpvData;
DWORD dwStride;
} D3DDP_PTRSTRIDE; } D3DDP_PTRSTRIDE;
#define D3DDP_MAXTEXCOORD 8 #define D3DDP_MAXTEXCOORD 8
......
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