Andrew Nguyen : ddraw: Implement and test DirectDrawEnumerateW.
Alexandre Julliard
julliard at winehq.org
Fri Oct 9 09:24:10 CDT 2009
Module: wine
Branch: master
Commit: bab8f7e557c681927aeb3214d6b5402fcf09508c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bab8f7e557c681927aeb3214d6b5402fcf09508c
Author: Andrew Nguyen <arethusa26 at gmail.com>
Date: Thu Oct 8 09:04:00 2009 -0500
ddraw: Implement and test DirectDrawEnumerateW.
---
dlls/ddraw/ddraw.spec | 2 +-
dlls/ddraw/main.c | 17 +++++++++++++----
dlls/ddraw/tests/ddrawmodes.c | 37 +++++++++++++++++++++++++++++++++++++
3 files changed, 51 insertions(+), 5 deletions(-)
diff --git a/dlls/ddraw/ddraw.spec b/dlls/ddraw/ddraw.spec
index 0cd1d0f..3b3916e 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 647ea2f..be4208d 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 013862b..17031b0 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)
More information about the wine-cvs
mailing list