ddraw: More fully implement and test DirectDrawEnumerateExA.
This commit is contained in:
parent
bab8f7e557
commit
3496fe5f43
|
@ -403,7 +403,16 @@ DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA Callback,
|
||||||
LPVOID Context,
|
LPVOID Context,
|
||||||
DWORD Flags)
|
DWORD Flags)
|
||||||
{
|
{
|
||||||
BOOL stop = FALSE;
|
TRACE("(%p, %p, 0x%08x)\n", Callback, Context, Flags);
|
||||||
|
|
||||||
|
if (Flags & ~(DDENUM_ATTACHEDSECONDARYDEVICES |
|
||||||
|
DDENUM_DETACHEDSECONDARYDEVICES |
|
||||||
|
DDENUM_NONDISPLAYDEVICES))
|
||||||
|
return DDERR_INVALIDPARAMS;
|
||||||
|
|
||||||
|
if (Flags)
|
||||||
|
FIXME("flags 0x%08x not handled\n", Flags);
|
||||||
|
|
||||||
TRACE("Enumerating default DirectDraw HAL interface\n");
|
TRACE("Enumerating default DirectDraw HAL interface\n");
|
||||||
|
|
||||||
/* We only have one driver by now */
|
/* We only have one driver by now */
|
||||||
|
@ -413,11 +422,11 @@ DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA Callback,
|
||||||
driver_name[] = "display";
|
driver_name[] = "display";
|
||||||
|
|
||||||
/* QuickTime expects the description "DirectDraw HAL" */
|
/* QuickTime expects the description "DirectDraw HAL" */
|
||||||
stop = !Callback(NULL, driver_desc, driver_name, Context, 0);
|
Callback(NULL, driver_desc, driver_name, Context, 0);
|
||||||
}
|
}
|
||||||
__EXCEPT_PAGE_FAULT
|
__EXCEPT_PAGE_FAULT
|
||||||
{
|
{
|
||||||
return E_INVALIDARG;
|
return DDERR_INVALIDPARAMS;
|
||||||
}
|
}
|
||||||
__ENDTRY;
|
__ENDTRY;
|
||||||
|
|
||||||
|
|
|
@ -40,12 +40,14 @@ static LPDDSURFACEDESC modes;
|
||||||
|
|
||||||
static HRESULT (WINAPI *pDirectDrawEnumerateA)(LPDDENUMCALLBACKA,LPVOID);
|
static HRESULT (WINAPI *pDirectDrawEnumerateA)(LPDDENUMCALLBACKA,LPVOID);
|
||||||
static HRESULT (WINAPI *pDirectDrawEnumerateW)(LPDDENUMCALLBACKW,LPVOID);
|
static HRESULT (WINAPI *pDirectDrawEnumerateW)(LPDDENUMCALLBACKW,LPVOID);
|
||||||
|
static HRESULT (WINAPI *pDirectDrawEnumerateExA)(LPDDENUMCALLBACKEXA,LPVOID,DWORD);
|
||||||
|
|
||||||
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");
|
pDirectDrawEnumerateW = (void*)GetProcAddress(hmod, "DirectDrawEnumerateW");
|
||||||
|
pDirectDrawEnumerateExA = (void*)GetProcAddress(hmod, "DirectDrawEnumerateExA");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void createwindow(void)
|
static void createwindow(void)
|
||||||
|
@ -194,6 +196,83 @@ static void test_DirectDrawEnumerateW(void)
|
||||||
ok(ret == DDERR_UNSUPPORTED, "Expected DDERR_UNSUPPORTED, got %d\n", ret);
|
ok(ret == DDERR_UNSUPPORTED, "Expected DDERR_UNSUPPORTED, got %d\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL WINAPI crash_callbackExA(GUID *lpGUID, LPSTR lpDriverDescription,
|
||||||
|
LPSTR lpDriverName, LPVOID lpContext,
|
||||||
|
HMONITOR hm)
|
||||||
|
{
|
||||||
|
*(volatile char*)0 = 2;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL WINAPI test_nullcontext_callbackExA(GUID *lpGUID, LPSTR lpDriverDescription,
|
||||||
|
LPSTR lpDriverName, LPVOID lpContext,
|
||||||
|
HMONITOR hm)
|
||||||
|
{
|
||||||
|
trace("test_nullcontext_callbackExA: %p %s %s %p %p\n", lpGUID,
|
||||||
|
lpDriverDescription, lpDriverName, lpContext, hm);
|
||||||
|
|
||||||
|
ok(!lpContext, "Expected NULL lpContext\n");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL WINAPI test_context_callbackExA(GUID *lpGUID, LPSTR lpDriverDescription,
|
||||||
|
LPSTR lpDriverName, LPVOID lpContext,
|
||||||
|
HMONITOR hm)
|
||||||
|
{
|
||||||
|
trace("test_context_callbackExA: %p %s %s %p %p\n", lpGUID,
|
||||||
|
lpDriverDescription, lpDriverName, lpContext, hm);
|
||||||
|
|
||||||
|
ok(lpContext == (LPVOID)0xdeadbeef, "Expected non-NULL lpContext\n");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_DirectDrawEnumerateExA(void)
|
||||||
|
{
|
||||||
|
HRESULT ret;
|
||||||
|
|
||||||
|
if (!pDirectDrawEnumerateExA)
|
||||||
|
{
|
||||||
|
win_skip("DirectDrawEnumerateExA is not available\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Test with NULL callback parameter. */
|
||||||
|
ret = pDirectDrawEnumerateExA(NULL, NULL, 0);
|
||||||
|
ok(ret == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %d\n", ret);
|
||||||
|
|
||||||
|
/* Test with invalid callback parameter. */
|
||||||
|
ret = pDirectDrawEnumerateExA((LPDDENUMCALLBACKEXA)0xdeadbeef, NULL, 0);
|
||||||
|
ok(ret == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %d\n", ret);
|
||||||
|
|
||||||
|
/* Test with callback that crashes. */
|
||||||
|
ret = pDirectDrawEnumerateExA(crash_callbackExA, NULL, 0);
|
||||||
|
ok(ret == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %d\n", ret);
|
||||||
|
|
||||||
|
/* Test with valid callback parameter and invalid flags */
|
||||||
|
ret = pDirectDrawEnumerateExA(test_nullcontext_callbackExA, NULL, ~0);
|
||||||
|
ok(ret == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %d\n", ret);
|
||||||
|
|
||||||
|
/* Test with valid callback parameter and NULL context parameter. */
|
||||||
|
trace("Calling DirectDrawEnumerateExA with empty flags and NULL context.\n");
|
||||||
|
ret = pDirectDrawEnumerateExA(test_nullcontext_callbackExA, NULL, 0);
|
||||||
|
ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret);
|
||||||
|
|
||||||
|
/* Test with valid callback parameter and non-NULL context parameter. */
|
||||||
|
trace("Calling DirectDrawEnumerateExA with empty flags and non-NULL context.\n");
|
||||||
|
ret = pDirectDrawEnumerateExA(test_context_callbackExA, (LPVOID)0xdeadbeef, 0);
|
||||||
|
ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret);
|
||||||
|
|
||||||
|
/* Test with valid callback parameter, NULL context parameter, and all flags set. */
|
||||||
|
trace("Calling DirectDrawEnumerateExA with all flags set and NULL context.\n");
|
||||||
|
ret = pDirectDrawEnumerateExA(test_nullcontext_callbackExA, NULL,
|
||||||
|
DDENUM_ATTACHEDSECONDARYDEVICES |
|
||||||
|
DDENUM_DETACHEDSECONDARYDEVICES |
|
||||||
|
DDENUM_NONDISPLAYDEVICES);
|
||||||
|
ok(ret == DD_OK, "Expected DD_OK, got %d\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
static void adddisplaymode(LPDDSURFACEDESC lpddsd)
|
static void adddisplaymode(LPDDSURFACEDESC lpddsd)
|
||||||
{
|
{
|
||||||
if (!modes)
|
if (!modes)
|
||||||
|
@ -523,6 +602,7 @@ START_TEST(ddrawmodes)
|
||||||
|
|
||||||
test_DirectDrawEnumerateA();
|
test_DirectDrawEnumerateA();
|
||||||
test_DirectDrawEnumerateW();
|
test_DirectDrawEnumerateW();
|
||||||
|
test_DirectDrawEnumerateExA();
|
||||||
|
|
||||||
enumdisplaymodes();
|
enumdisplaymodes();
|
||||||
if (winetest_interactive)
|
if (winetest_interactive)
|
||||||
|
|
Loading…
Reference in New Issue