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
* Arguments, return values: See DDRAW_Create
*
***********************************************************************/
HRESULT WINAPI DECLSPEC_HOTPATCH
DirectDrawCreateEx(GUID *guid,
LPVOID *dd,
REFIID iid,
IUnknown *UnkOuter)
HRESULT WINAPI DECLSPEC_HOTPATCH DirectDrawCreateEx(GUID *driver_guid,
void **ddraw, REFIID interface_iid, IUnknown *outer)
{
HRESULT hr;
TRACE("driver_guid %s, ddraw %p, interface_iid %s, outer_unknown %p.\n",
debugstr_guid(guid), dd, debugstr_guid(iid), UnkOuter);
TRACE("driver_guid %s, ddraw %p, interface_iid %s, outer %p.\n",
debugstr_guid(driver_guid), ddraw, debugstr_guid(interface_iid), outer);
if (!IsEqualGUID(iid, &IID_IDirectDraw7))
if (!IsEqualGUID(interface_iid, &IID_IDirectDraw7))
return DDERR_INVALIDPARAMS;
wined3d_mutex_lock();
hr = DDRAW_Create(guid, dd, UnkOuter, iid);
hr = DDRAW_Create(driver_guid, ddraw, outer, interface_iid);
wined3d_mutex_unlock();
if (SUCCEEDED(hr))
{
IDirectDraw7 *ddraw7 = *(IDirectDraw7 **)dd;
hr = IDirectDraw7_Initialize(ddraw7, guid);
IDirectDraw7 *ddraw7 = *(IDirectDraw7 **)ddraw;
hr = IDirectDraw7_Initialize(ddraw7, driver_guid);
if (FAILED(hr))
IDirectDraw7_Release(ddraw7);
}
......@@ -551,7 +548,7 @@ struct ddraw_class_factory
IClassFactory IClassFactory_iface;
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)
......@@ -687,30 +684,13 @@ static const IClassFactoryVtbl IClassFactory_Vtbl =
ddraw_class_factory_LockServer
};
/*******************************************************************************
* 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)
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **out)
{
struct ddraw_class_factory *factory;
unsigned int i;
TRACE("rclsid %s, riid %s, object %p.\n",
debugstr_guid(rclsid), debugstr_guid(riid), ppv);
TRACE("rclsid %s, riid %s, out %p.\n",
debugstr_guid(rclsid), debugstr_guid(riid), out);
if (!IsEqualGUID(&IID_IClassFactory, riid)
&& !IsEqualGUID(&IID_IUnknown, riid))
......@@ -736,7 +716,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
*ppv = factory;
*out = factory;
return S_OK;
}
......@@ -826,9 +806,8 @@ DestroyCallback(IDirectDrawSurface7 *surf,
* 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)
{
case DLL_PROCESS_ATTACH:
......@@ -844,7 +823,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved)
wc.lpfnWndProc = DefWindowProcA;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstDLL;
wc.hInstance = inst;
wc.hIcon = 0;
wc.hCursor = 0;
wc.hbrBackground = GetStockObject(BLACK_BRUSH);
......@@ -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))
ERR("Failed to get own module handle.\n");
instance = hInstDLL;
DisableThreadLibraryCalls(hInstDLL);
instance = inst;
DisableThreadLibraryCalls(inst);
break;
}
......@@ -969,7 +948,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved)
}
if (reserved) break;
UnregisterClassA(DDRAW_WINDOW_CLASS_NAME, hInstDLL);
UnregisterClassA(DDRAW_WINDOW_CLASS_NAME, inst);
}
return TRUE;
......
......@@ -67,7 +67,8 @@ typedef struct
char callback_name_strings[MAX_ENUMERATION_COUNT][100];
} 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)
{
......
......@@ -43,10 +43,10 @@ static int modes16bpp_cnt;
static int refresh_rate;
static int refresh_rate_cnt;
static HRESULT (WINAPI *pDirectDrawEnumerateA)(LPDDENUMCALLBACKA,LPVOID);
static HRESULT (WINAPI *pDirectDrawEnumerateW)(LPDDENUMCALLBACKW,LPVOID);
static HRESULT (WINAPI *pDirectDrawEnumerateExA)(LPDDENUMCALLBACKEXA,LPVOID,DWORD);
static HRESULT (WINAPI *pDirectDrawEnumerateExW)(LPDDENUMCALLBACKEXW,LPVOID,DWORD);
static HRESULT (WINAPI *pDirectDrawEnumerateA)(LPDDENUMCALLBACKA cb, void *ctx);
static HRESULT (WINAPI *pDirectDrawEnumerateW)(LPDDENUMCALLBACKW cb, void *ctx);
static HRESULT (WINAPI *pDirectDrawEnumerateExA)(LPDDENUMCALLBACKEXA cb, void *ctx, DWORD flags);
static HRESULT (WINAPI *pDirectDrawEnumerateExW)(LPDDENUMCALLBACKEXW cb, void *ctx, DWORD flags);
static void init_function_pointers(void)
{
......@@ -104,8 +104,8 @@ static void releasedirectdraw(void)
}
}
static BOOL WINAPI test_nullcontext_callbackA(GUID *lpGUID, LPSTR lpDriverDescription,
LPSTR lpDriverName, LPVOID lpContext)
static BOOL WINAPI test_nullcontext_callbackA(GUID *lpGUID,
char *lpDriverDescription, char *lpDriverName, void *lpContext)
{
trace("test_nullcontext_callbackA: %p %s %s %p\n",
lpGUID, lpDriverDescription, lpDriverName, lpContext);
......@@ -115,13 +115,13 @@ static BOOL WINAPI test_nullcontext_callbackA(GUID *lpGUID, LPSTR lpDriverDescri
return TRUE;
}
static BOOL WINAPI test_context_callbackA(GUID *lpGUID, LPSTR lpDriverDescription,
LPSTR lpDriverName, LPVOID lpContext)
static BOOL WINAPI test_context_callbackA(GUID *lpGUID,
char *lpDriverDescription, char *lpDriverName, void *lpContext)
{
trace("test_context_callbackA: %p %s %s %p\n",
lpGUID, lpDriverDescription, lpDriverName, lpContext);
ok(lpContext == (LPVOID)0xdeadbeef, "Expected non-NULL lpContext\n");
ok(lpContext == (void *)0xdeadbeef, "Expected non-NULL lpContext\n");
return TRUE;
}
......@@ -147,12 +147,12 @@ static void test_DirectDrawEnumerateA(void)
/* Test with valid callback parameter and valid context parameter. */
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);
}
static BOOL WINAPI test_callbackW(GUID *lpGUID, LPWSTR lpDriverDescription,
LPWSTR lpDriverName, LPVOID lpContext)
static BOOL WINAPI test_callbackW(GUID *lpGUID, WCHAR *lpDriverDescription,
WCHAR *lpDriverName, void *lpContext)
{
ok(0, "The callback should not be invoked by DirectDrawEnumerateW\n");
return TRUE;
......@@ -187,9 +187,8 @@ static void test_DirectDrawEnumerateW(void)
ok(ret == DDERR_UNSUPPORTED, "Expected DDERR_UNSUPPORTED, got %d\n", ret);
}
static BOOL WINAPI test_nullcontext_callbackExA(GUID *lpGUID, LPSTR lpDriverDescription,
LPSTR lpDriverName, LPVOID lpContext,
HMONITOR hm)
static BOOL WINAPI test_nullcontext_callbackExA(GUID *lpGUID, char *lpDriverDescription,
char *lpDriverName, void *lpContext, HMONITOR hm)
{
trace("test_nullcontext_callbackExA: %p %s %s %p %p\n", lpGUID,
lpDriverDescription, lpDriverName, lpContext, hm);
......@@ -199,14 +198,13 @@ static BOOL WINAPI test_nullcontext_callbackExA(GUID *lpGUID, LPSTR lpDriverDesc
return TRUE;
}
static BOOL WINAPI test_context_callbackExA(GUID *lpGUID, LPSTR lpDriverDescription,
LPSTR lpDriverName, LPVOID lpContext,
HMONITOR hm)
static BOOL WINAPI test_context_callbackExA(GUID *lpGUID, char *lpDriverDescription,
char *lpDriverName, void *lpContext, HMONITOR hm)
{
trace("test_context_callbackExA: %p %s %s %p %p\n", lpGUID,
lpDriverDescription, lpDriverName, lpContext, hm);
ok(lpContext == (LPVOID)0xdeadbeef, "Expected non-NULL lpContext\n");
ok(lpContext == (void *)0xdeadbeef, "Expected non-NULL lpContext\n");
return TRUE;
}
......@@ -236,7 +234,7 @@ static void test_DirectDrawEnumerateExA(void)
/* Test with valid callback parameter and non-NULL context parameter. */
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);
/* Test with valid callback parameter, NULL context parameter, and all flags set. */
......@@ -248,9 +246,8 @@ static void test_DirectDrawEnumerateExA(void)
ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret);
}
static BOOL WINAPI test_callbackExW(GUID *lpGUID, LPWSTR lpDriverDescription,
LPWSTR lpDriverName, LPVOID lpContext,
HMONITOR hm)
static BOOL WINAPI test_callbackExW(GUID *lpGUID, WCHAR *lpDriverDescription,
WCHAR *lpDriverName, void *lpContext, HMONITOR hm)
{
ok(0, "The callback should not be invoked by DirectDrawEnumerateExW.\n");
return TRUE;
......
......@@ -740,7 +740,7 @@ static void QueryInterface(void)
{
IDirectDrawSurface *dsurface;
DDSURFACEDESC surface;
LPVOID object;
void *object;
HRESULT ret;
/* Create a surface */
......
......@@ -23,7 +23,8 @@
#include "ddraw.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 IDirectDrawSurface7 *primary = NULL;
......
......@@ -24,7 +24,8 @@
#include "d3d.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)
{
......
......@@ -39,7 +39,8 @@ static IDirect3DViewport *Viewport;
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)
{
......
......@@ -390,7 +390,7 @@ typedef struct _D3DExecuteBufferDesc {
DWORD dwFlags;
DWORD dwCaps;
DWORD dwBufferSize;
LPVOID lpData;
void *lpData;
} D3DEXECUTEBUFFERDESC, *LPD3DEXECUTEBUFFERDESC;
#define D3DDEB_BUFSIZE 0x00000001
......
......@@ -71,7 +71,7 @@ typedef LONG D3DFIXED;
#define D3DENUMRET_CANCEL DDENUMRET_CANCEL
#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 *LPD3DENUMPIXELFORMATSCALLBACK)(DDPIXELFORMAT *format, void *ctx);
......@@ -468,9 +468,9 @@ typedef struct _D3DVIEWPORT7 {
typedef struct _D3DTRANSFORMDATA {
DWORD dwSize;
LPVOID lpIn;
void *lpIn;
DWORD dwInSize;
LPVOID lpOut;
void *lpOut;
DWORD dwOutSize;
D3DHVERTEX *lpHOut;
DWORD dwClip;
......@@ -1270,8 +1270,9 @@ typedef struct _D3DVERTEXBUFFERDESC {
#define D3DFVF_TLVERTEX ( D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | \
D3DFVF_TEX1 )
typedef struct _D3DDP_PTRSTRIDE {
LPVOID lpvData;
typedef struct _D3DDP_PTRSTRIDE
{
void *lpvData;
DWORD dwStride;
} D3DDP_PTRSTRIDE;
......
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