Commit bab8f7e5 authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

ddraw: Implement and test DirectDrawEnumerateW.

parent 4c61c2ff
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
@ stdcall DirectDrawEnumerateA(ptr ptr) @ stdcall DirectDrawEnumerateA(ptr ptr)
@ stdcall DirectDrawEnumerateExA(ptr ptr long) @ stdcall DirectDrawEnumerateExA(ptr ptr long)
@ stub DirectDrawEnumerateExW @ stub DirectDrawEnumerateExW
@ stub DirectDrawEnumerateW @ stdcall DirectDrawEnumerateW(ptr ptr)
@ stdcall -private DllCanUnloadNow() @ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr) @ stdcall -private DllGetClassObject(ptr ptr ptr)
@ stdcall -private DllRegisterServer() @ stdcall -private DllRegisterServer()
......
...@@ -428,12 +428,21 @@ DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA Callback, ...@@ -428,12 +428,21 @@ DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA Callback,
/*********************************************************************** /***********************************************************************
* DirectDrawEnumerateW (DDRAW.@) * DirectDrawEnumerateW (DDRAW.@)
* *
* Enumerates legacy drivers, unicode version. See * Enumerates legacy drivers, unicode version.
* the comments above DirectDrawEnumerateA for more details. * This function is not implemented on Windows.
*
* The Flag member is not supported right now.
* *
***********************************************************************/ ***********************************************************************/
HRESULT WINAPI
DirectDrawEnumerateW(LPDDENUMCALLBACKW Callback,
LPVOID Context)
{
TRACE("(%p, %p)\n", Callback, Context);
if (!Callback)
return DDERR_INVALIDPARAMS;
else
return DDERR_UNSUPPORTED;
}
/*********************************************************************** /***********************************************************************
* DirectDrawEnumerateExW (DDRAW.@) * DirectDrawEnumerateExW (DDRAW.@)
......
...@@ -39,11 +39,13 @@ static int modes_size; ...@@ -39,11 +39,13 @@ static int modes_size;
static LPDDSURFACEDESC modes; static LPDDSURFACEDESC modes;
static HRESULT (WINAPI *pDirectDrawEnumerateA)(LPDDENUMCALLBACKA,LPVOID); static HRESULT (WINAPI *pDirectDrawEnumerateA)(LPDDENUMCALLBACKA,LPVOID);
static HRESULT (WINAPI *pDirectDrawEnumerateW)(LPDDENUMCALLBACKW,LPVOID);
static void init_function_pointers(void) static void init_function_pointers(void)
{ {
HMODULE hmod = GetModuleHandleA("ddraw.dll"); HMODULE hmod = GetModuleHandleA("ddraw.dll");
pDirectDrawEnumerateA = (void*)GetProcAddress(hmod, "DirectDrawEnumerateA"); pDirectDrawEnumerateA = (void*)GetProcAddress(hmod, "DirectDrawEnumerateA");
pDirectDrawEnumerateW = (void*)GetProcAddress(hmod, "DirectDrawEnumerateW");
} }
static void createwindow(void) static void createwindow(void)
...@@ -158,6 +160,40 @@ static void test_DirectDrawEnumerateA(void) ...@@ -158,6 +160,40 @@ static void test_DirectDrawEnumerateA(void)
ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret); 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) static void adddisplaymode(LPDDSURFACEDESC lpddsd)
{ {
if (!modes) if (!modes)
...@@ -486,6 +522,7 @@ START_TEST(ddrawmodes) ...@@ -486,6 +522,7 @@ START_TEST(ddrawmodes)
return; return;
test_DirectDrawEnumerateA(); test_DirectDrawEnumerateA();
test_DirectDrawEnumerateW();
enumdisplaymodes(); enumdisplaymodes();
if (winetest_interactive) if (winetest_interactive)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment