diff --git a/dlls/ddraw/ddraw.spec b/dlls/ddraw/ddraw.spec index 0cd1d0f305b..3b3916e3fbb 100644 --- a/dlls/ddraw/ddraw.spec +++ b/dlls/ddraw/ddraw.spec @@ -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() diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index 647ea2ff127..be4208d9a31 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c @@ -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.@) diff --git a/dlls/ddraw/tests/ddrawmodes.c b/dlls/ddraw/tests/ddrawmodes.c index 013862bbff2..17031b00708 100644 --- a/dlls/ddraw/tests/ddrawmodes.c +++ b/dlls/ddraw/tests/ddrawmodes.c @@ -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)