ddraw: Implement and test DirectDrawEnumerateExW.

This commit is contained in:
Andrew Nguyen 2009-10-08 09:04:18 -05:00 committed by Alexandre Julliard
parent 3496fe5f43
commit 7211f7ce18
3 changed files with 59 additions and 5 deletions

View File

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

View File

@ -456,12 +456,19 @@ DirectDrawEnumerateW(LPDDENUMCALLBACKW Callback,
/***********************************************************************
* DirectDrawEnumerateExW (DDRAW.@)
*
* Enumerates DirectDraw7 drivers, unicode version. See
* the comments above DirectDrawEnumerateA for more details.
*
* The Flag member is not supported right now.
* Enumerates DirectDraw7 drivers, unicode version.
* This function is not implemented on Windows.
*
***********************************************************************/
HRESULT WINAPI
DirectDrawEnumerateExW(LPDDENUMCALLBACKEXW Callback,
LPVOID Context,
DWORD Flags)
{
TRACE("(%p, %p, 0x%x)\n", Callback, Context, Flags);
return DDERR_UNSUPPORTED;
}
/***********************************************************************
* Classfactory implementation.

View File

@ -41,6 +41,7 @@ static LPDDSURFACEDESC modes;
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 void init_function_pointers(void)
{
@ -48,6 +49,7 @@ static void init_function_pointers(void)
pDirectDrawEnumerateA = (void*)GetProcAddress(hmod, "DirectDrawEnumerateA");
pDirectDrawEnumerateW = (void*)GetProcAddress(hmod, "DirectDrawEnumerateW");
pDirectDrawEnumerateExA = (void*)GetProcAddress(hmod, "DirectDrawEnumerateExA");
pDirectDrawEnumerateExW = (void*)GetProcAddress(hmod, "DirectDrawEnumerateExW");
}
static void createwindow(void)
@ -273,6 +275,50 @@ 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)
{
ok(0, "The callback should not be invoked by DirectDrawEnumerateExW.\n");
return TRUE;
}
static void test_DirectDrawEnumerateExW(void)
{
HRESULT ret;
if (!pDirectDrawEnumerateExW)
{
win_skip("DirectDrawEnumerateExW is not available\n");
return;
}
/* DirectDrawEnumerateExW is not implemented on Windows. */
/* Test with NULL callback parameter. */
ret = pDirectDrawEnumerateExW(NULL, NULL, 0);
ok(ret == DDERR_UNSUPPORTED, "Expected DDERR_UNSUPPORTED, got %d\n", ret);
/* Test with invalid callback parameter. */
ret = pDirectDrawEnumerateExW((LPDDENUMCALLBACKEXW)0xdeadbeef, NULL, 0);
ok(ret == DDERR_UNSUPPORTED, "Expected DDERR_UNSUPPORTED, got %d\n", ret);
/* Test with valid callback parameter and invalid flags */
ret = pDirectDrawEnumerateExW(test_callbackExW, NULL, ~0);
ok(ret == DDERR_UNSUPPORTED, "Expected DDERR_UNSUPPORTED, got %d\n", ret);
/* Test with valid callback parameter and NULL context parameter. */
ret = pDirectDrawEnumerateExW(test_callbackExW, NULL, 0);
ok(ret == DDERR_UNSUPPORTED, "Expected DDERR_UNSUPPORTED, got %d\n", ret);
/* Test with valid callback parameter, NULL context parameter, and all flags set. */
ret = pDirectDrawEnumerateExW(test_callbackExW, NULL,
DDENUM_ATTACHEDSECONDARYDEVICES |
DDENUM_DETACHEDSECONDARYDEVICES |
DDENUM_NONDISPLAYDEVICES);
ok(ret == DDERR_UNSUPPORTED, "Expected DDERR_UNSUPPORTED, got %d\n", ret);
}
static void adddisplaymode(LPDDSURFACEDESC lpddsd)
{
if (!modes)
@ -603,6 +649,7 @@ START_TEST(ddrawmodes)
test_DirectDrawEnumerateA();
test_DirectDrawEnumerateW();
test_DirectDrawEnumerateExA();
test_DirectDrawEnumerateExW();
enumdisplaymodes();
if (winetest_interactive)