ddraw: Implement and test DirectDrawEnumerateW.

This commit is contained in:
Andrew Nguyen 2009-10-08 09:04:00 -05:00 committed by Alexandre Julliard
parent 4c61c2ff63
commit bab8f7e557
3 changed files with 51 additions and 5 deletions

View File

@ -9,7 +9,7 @@
@ stdcall DirectDrawEnumerateA(ptr ptr)
@ stdcall DirectDrawEnumerateExA(ptr ptr long)
@ stub DirectDrawEnumerateExW
@ stub DirectDrawEnumerateW
@ stdcall DirectDrawEnumerateW(ptr ptr)
@ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr)
@ stdcall -private DllRegisterServer()

View File

@ -428,12 +428,21 @@ DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA Callback,
/***********************************************************************
* DirectDrawEnumerateW (DDRAW.@)
*
* Enumerates legacy drivers, unicode version. See
* the comments above DirectDrawEnumerateA for more details.
*
* The Flag member is not supported right now.
* Enumerates legacy drivers, unicode version.
* This function is not implemented on Windows.
*
***********************************************************************/
HRESULT WINAPI
DirectDrawEnumerateW(LPDDENUMCALLBACKW Callback,
LPVOID Context)
{
TRACE("(%p, %p)\n", Callback, Context);
if (!Callback)
return DDERR_INVALIDPARAMS;
else
return DDERR_UNSUPPORTED;
}
/***********************************************************************
* DirectDrawEnumerateExW (DDRAW.@)

View File

@ -39,11 +39,13 @@ static int modes_size;
static LPDDSURFACEDESC modes;
static HRESULT (WINAPI *pDirectDrawEnumerateA)(LPDDENUMCALLBACKA,LPVOID);
static HRESULT (WINAPI *pDirectDrawEnumerateW)(LPDDENUMCALLBACKW,LPVOID);
static void init_function_pointers(void)
{
HMODULE hmod = GetModuleHandleA("ddraw.dll");
pDirectDrawEnumerateA = (void*)GetProcAddress(hmod, "DirectDrawEnumerateA");
pDirectDrawEnumerateW = (void*)GetProcAddress(hmod, "DirectDrawEnumerateW");
}
static void createwindow(void)
@ -158,6 +160,40 @@ static void test_DirectDrawEnumerateA(void)
ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret);
}
static BOOL WINAPI test_callbackW(GUID *lpGUID, LPWSTR lpDriverDescription,
LPWSTR lpDriverName, LPVOID lpContext)
{
ok(0, "The callback should not be invoked by DirectDrawEnumerateW\n");
return TRUE;
}
static void test_DirectDrawEnumerateW(void)
{
HRESULT ret;
if (!pDirectDrawEnumerateW)
{
win_skip("DirectDrawEnumerateW is not available\n");
return;
}
/* DirectDrawEnumerateW is not implemented on Windows. */
/* Test with NULL callback parameter. */
ret = pDirectDrawEnumerateW(NULL, NULL);
ok(ret == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %d\n", ret);
/* Test with invalid callback parameter. */
ret = pDirectDrawEnumerateW((LPDDENUMCALLBACKW)0xdeadbeef, NULL);
ok(ret == DDERR_INVALIDPARAMS /* XP */ ||
ret == DDERR_UNSUPPORTED /* Win7 */,
"Expected DDERR_INVALIDPARAMS or DDERR_UNSUPPORTED, got %d\n", ret);
/* Test with valid callback parameter and NULL context parameter. */
ret = pDirectDrawEnumerateW(test_callbackW, NULL);
ok(ret == DDERR_UNSUPPORTED, "Expected DDERR_UNSUPPORTED, got %d\n", ret);
}
static void adddisplaymode(LPDDSURFACEDESC lpddsd)
{
if (!modes)
@ -486,6 +522,7 @@ START_TEST(ddrawmodes)
return;
test_DirectDrawEnumerateA();
test_DirectDrawEnumerateW();
enumdisplaymodes();
if (winetest_interactive)