Commit 0293e199 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw/tests: Make sure the window is properly released by ddraw in test_wndproc().

parent 02f0d82d
......@@ -3251,6 +3251,27 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM
return DefWindowProcA(hwnd, message, wparam, lparam);
}
/* Set the wndproc back to what ddraw expects it to be, and release the ddraw
* interface. This prevents subsequent SetCooperativeLevel() calls on a
* different window from failing with DDERR_HWNDALREADYSET. */
static void fix_wndproc(HWND window, LONG_PTR proc)
{
IDirectDraw7 *ddraw7;
HRESULT hr;
hr = pDirectDrawCreateEx(NULL, (void **)&ddraw7, &IID_IDirectDraw7, NULL);
ok(SUCCEEDED(hr), "Failed to create IDirectDraw7 object, hr %#x.", hr);
if (FAILED(hr)) return;
SetWindowLongPtrA(window, GWLP_WNDPROC, proc);
hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
IDirectDraw7_Release(ddraw7);
}
static void test_wndproc(void)
{
LONG_PTR proc, ddraw_proc;
......@@ -3458,6 +3479,7 @@ static void test_wndproc(void)
(LONG_PTR)DefWindowProcA, proc);
done:
fix_wndproc(window, (LONG_PTR)test_proc);
expect_messages = NULL;
DestroyWindow(window);
UnregisterClassA("d3d7_test_wndproc_wc", GetModuleHandleA(NULL));
......
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