From 7211f7ce183076bceb01fa176e0630b5df5a8d7f Mon Sep 17 00:00:00 2001 From: Andrew Nguyen Date: Thu, 8 Oct 2009 09:04:18 -0500 Subject: [PATCH] ddraw: Implement and test DirectDrawEnumerateExW. --- dlls/ddraw/ddraw.spec | 2 +- dlls/ddraw/main.c | 15 ++++++++--- dlls/ddraw/tests/ddrawmodes.c | 47 +++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/dlls/ddraw/ddraw.spec b/dlls/ddraw/ddraw.spec index 3b3916e3fb..75750910e4 100644 --- a/dlls/ddraw/ddraw.spec +++ b/dlls/ddraw/ddraw.spec @@ -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) diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index 137bb447d0..2a0d8f0488 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c @@ -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. diff --git a/dlls/ddraw/tests/ddrawmodes.c b/dlls/ddraw/tests/ddrawmodes.c index a095063480..7ea4d539ec 100644 --- a/dlls/ddraw/tests/ddrawmodes.c +++ b/dlls/ddraw/tests/ddrawmodes.c @@ -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)